Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

multiple links that plays video in embedded windows media player when clicked

Posted on 2003-12-09
4
Medium Priority
?
729 Views
Last Modified: 2010-04-06
<HTML><HEAD></HEAD>
<BODY>
<OBJECT ID='Player' width='320' height='240' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>
<PARAM name='autoStart' value='True'>
<PARAM name='URL' value='http://www.mydoman.com/intro.asx'>
</OBJECT>

<SCRIPT LANGUAGE='JavaScript'>
     Player.settings.setMode('loop',true);
</SCRIPT>
</BODY></HTML>

The above code is used to embed a windows media player and loop a pre-determined video clip. It works fine. However, I want many links on the page, and depending on which link is pressed, the relevant movie should be played (on the same media player). So I tried to stick all the stuff between the object tags into a javascript function in the header section of the html page like so, but I'm stuck really early on.....

<script language="JavaScript">
function playvdo()   {

document.write ("<OBJECT ID='Player' width='320' height='240'  CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'><PARAM name='autoStart' value='True'><PARAM name='URL' value='http://www.citybroadcast.tv/intro.asx'></OBJECT>");

Player.settings.setMode("loop",true);
}
</script>

and I have a link like this to call the function : <a href="javascript:playvdo()">Click Me</a>

Now, there's something wrong already. I can't get even one video clip to work, let alone having multiple choices. Can someone help? Greatly Appreciated thanks.
0
Comment
Question by:skylabel
4 Comments
 
LVL 15

Accepted Solution

by:
Timbo87 earned 1600 total points
ID: 9909132
Add these to the body. Replace http://www.mydomain.com/movie1.asx with the URL of your movies.

<a href="#" onClick = "Player.URL = 'http://www.mydomain.com/movie1.asx';return false;">Movie 1</a>
<br>
<a href="#" onClick = "Player.URL = 'http://www.mydomain.com/movie2.asx';return false;">Movie 2</a>
<br>
<a href="#" onClick = "Player.URL = 'http://www.mydomain.com/movie3.asx';return false;">Movie 3</a>

Hope this helps.
0
 
LVL 1

Author Comment

by:skylabel
ID: 9909561
You're a genius and I'm an idiot...
works great. Thanks.
0
 

Expert Comment

by:raydess
ID: 11198469
i have a problem with this..i mean it works only when i preview it but when i save it and view it on my webpage the media players gone help?
0
 

Expert Comment

by:itortu
ID: 14987412
could you show the entire code of how to make it work? i have a similar problem and i am trying to use this code, but is not working

thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question