Solved

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

Posted on 2003-12-09
4
690 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 400 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

756 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