Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-12-09
4
Medium Priority
?
721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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 …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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