Help in adding audio stream in javascript through html (autostart prob)

ambergarg22

New Member
Messages
19
Reaction score
0
Points
0
I have added the following code in my html (without innerhtml) for playin an audio file.I had set the parameters autostart as false and 0 as i dont want autoplay.Till here it works perfectly fine(ie. no autoplay as i wanted).
Code:
<div id="Layer1">
  <OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"  CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701" STANDBY="Loading Microsoft Windows&reg; Media Player components..." TYPE="application/x-oleobject" width="280" height="50">
 <param name="fileName" value="http://www.ambergarg.x10.mx/clips/mehbooba  mehbooba/mehbooba.mp3">
 <param name="animationatStart" value="true">
 <param name="transparentatStart" value="true">
 <param name="autoStart" value="false">
 <param name="showControls" value="true">
 <param name="Volume" value="-300">
 <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"  src="http://www.ambergarg.x10.mx/clips/mehbooba mehbooba/mehbooba.mp3" name="MediaPlayer1" width=280 height=50 autostart=0 showcontrols=1 volume=-300>
  </OBJECT>  
 </div>
Now what i wanted is instead of adding the above div tag in html directly , i wanted to add it dynamically in javascript using innerHTML property.So i modified my code as below
Code:
  var div_player=document.createElement("div");
    div_player.style.position = "absolute";
    div_player.style.width = "200px";
    div_player.style.height = "52px";
    div_player.style.top = t_player + "px"; t_player=t_player+400;
    div_player.style.left = "140px";
    div_player.innerHTML="<OBJECT ID='MediaPlayer1' CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701' STANDBY='Loading Microsoft Windows&reg; Media Player components...' TYPE='application/x-oleobject' width='280' height='50'><param name='fileName' value='"+file+"'><param name='animationatStart' value='true'><param name='transparentatStart' value='true'<param name='autoStart' value='false'><param name='showControls' value='true'><param name='Volume' value='-300'><embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+file+"' name='MediaPlayer1' width=280 height=50 autostart=0 showcontrols=1 volume=-300></OBJECT>"  ;
    document.body.appendChild(div_player);
Now the player works fine but the only problem is that now it has autoplay ON which i dont want.IN the 1st code the autoplay was off as i wanted but here i dont know y its not set to OFF.

U can see the o/p of this at http://www.ambergarg.x10.mx/audio-plag1.html

---------- Post added 11-21-2010 at 06:49 AM ---------- Previous post was 11-20-2010 at 07:43 PM ----------

hey guys , sorry for trouble , i got it now.actually there was a small typing error. A '>' was missing just before the autoStart attribute thts y it was not working.Anyways thanks all of u
 
Top