Embedding Multiple Media Players on the same page

  • cjd
  • Born
  • Born
  • No Avatar
  • Joined: Oct 17, 2008
  • Posts: 2
  • Status: Offline

Post October 17th, 2008, 7:30 am

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
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 17th, 2008, 7:30 am

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post October 18th, 2008, 5:29 pm

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. }
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • cjd
  • Born
  • Born
  • No Avatar
  • Joined: Oct 17, 2008
  • Posts: 2
  • Status: Offline

Post October 19th, 2008, 12:03 pm

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
  • Joined: Sep 22, 2003
  • Posts: 6134
  • Loc: Seattle, WA
  • Status: Offline

Post October 20th, 2008, 5:30 pm

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

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 104 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.