Solved

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

Posted on 2003-12-09
4
651 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 400 total points
Comment Utility
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
Comment Utility
You're a genius and I'm an idiot...
works great. Thanks.
0
 

Expert Comment

by:raydess
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now