It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Prob in innerhtml for adding audio streamin

Prob in innerhtml for adding audio streamin

Postby amber22 on Sat Nov 20, 2010 7:29 pm

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: Select all
<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: Select all
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
amber22
 
Posts: 1
Joined: Sat Nov 20, 2010 7:03 pm

Re: Prob in innerhtml for adding audio streamin

Postby HotNoob on Mon Nov 22, 2010 4:25 am

works for me...

when the page loads it doesnt autoplay..

but uh, why do you want the entire page to be written using javascript?
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am


Who is online

Users browsing this forum: No registered users and 4 guests