Embedding Multiple Media Players on the same page

  • cjd
  • Born
  • Born
  • cjd
  • Posts: 2

Post 3+ Months Ago

I am trying to embed many media players on the same page as a pronunciation facility, as it is a language website. I would like to have the actual media player hidden and instead have a button with "Pronounce".
Currently I can only make one media player work per page; the code I am using is:

<OBJECT ID="Player" height="0" width="0"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
</OBJECT>
<INPUT TYPE="BUTTON" NAME="BtnPlay" VALUE="Pronounce" OnClick="StartMeUp()">
<SCRIPT>
<!--

function StartMeUp ()
{
Player.URL = "myfile.mp3";
}

-->
</SCRIPT>

This code works for me with one media player but when I duplicate it it stops any of the media players working. I was thinking I might need some sort of asx file but I'm not sure how they work.

Can anyone help me?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

The object ID needs to be unique for each instance. Also the unique ID and the line "target" inside startMeUp need to match. Then the function name In this case "StartMeUp" needs to be unique and match the function in the script

ID="Player1" OnClick="StartMeUp1"
ID="Player2" OnClick="StartMeUp2"
etc and
Code: [ Select ]
function StartMeUp1 ()
{
Player1.URL = "urlForPlayer1.mpg";
}
 
function StartMeUp2 ()
{
Player2.URL = "urlForPlayer2.mpg";
}
  1. function StartMeUp1 ()
  2. {
  3. Player1.URL = "urlForPlayer1.mpg";
  4. }
  5.  
  6. function StartMeUp2 ()
  7. {
  8. Player2.URL = "urlForPlayer2.mpg";
  9. }
  • cjd
  • Born
  • Born
  • cjd
  • Posts: 2

Post 3+ Months Ago

Thanks, that solved it, I knew it was going to be something simple enough, you're a life saver!
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6247
  • Loc: Seattle, WA

Post 3+ Months Ago

Also, cjd, for the record, it would be a good idea to get into the habit of using all lowercase HTML tags.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.