Forum Moderators: open
I have embedded windows media player (10) in a web page and while it works fine in IE and Netscape 7.2, the video player doesn't appear at all in Opera, Mozilla or Firefox. The code I am using to embed is:
<object width="250" height="230" id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" >
<param name="URL" value=" " />
<param name="captioningID" value="cc" />
<param name="AutoStart" value="true" />
<param name="AutoRewind" value="true" />
</object>
The video to be played is actually pased to the medi aplayer by a javascript function but I have checked and its working ok.
I have also checked that the relevant plug-ins are installed but still to no avail.
Can anyone help?
Thanks
After some digging around i realised that i needed the EBMED tag as well as the OBJECT tag. So now I can see WMP in Firefox, Opera and Mozilla using the following:
<object width="250" height="230" id="Player" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" >
<param name="URL" value=" " />
<param name="captioningID" value="cc" />
<param name="AutoStart" value="true" />
<param name="AutoRewind" value="true" />
<embed type="application/x-mplayer2"
pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
id="Player"
name="URL"
value=" "
width="250"
height="240"
autostart="false">
</embed>
</object>
BUT!....
I am playing the video files via a javascript function :
function Play( videoFile )
{
document.getElementById("Player").URL = videoFile;
}
which is triggered by an onclick:
onclick="Play('introduction.wvx');">
The trouble is that 'OBJECT' uses '<param name="URL" value=" " />' and 'EMBED' uses 'src=" "'
Any idea how I can populate the src=" " with the same value as the <param name="URL" value=" " />?
Hope this is clear to someone!
Thanks
function Play( videoFile )
{
document.getElementById("objectID").URL = videoFile;
document.getElementById("embedID").SRC = videoFile;
}
I'm not sure if this will work at all though as the only embedded object that I've accessed using JavaScript are Java applets....
Tried it but unfortunatley didn't seem to do the trick and it throws up a runtime error in IE :-(
The issue seems to be the difference between these two lines:
<param name="URL" value=" " /> in the <object> section.
src=" " in the <embed> section
I guess I need to pass the value from 'document.getElementById("Player").URL = videoFile' in the Play() function to both the <object> and <embed>.
Any thoughts whould be appreciated.
Thnaks again.
(also put a note on your video page for firefox/mozilla/opera/netscape visitors that if the video won't play they need to copy npdsplay.dll from their Program Files\Windows Media Player folder to the browser/plugins folder)
<embed name="player" id="player" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" type="application/x-mplayer2" src="" width="320" height="240" ShowControls=1 ShowDisplay=0 ShowStatusBar=0 autostart=1 autorewind=0 ShowPositionControls=1 ShowTracker=0>
</embed>
then in javascript this should work:
document.player.src="videofile.wmv";
document.getElementById("player").src="videofile.wmv";
last but not least if all this fails, feed the filename to the player dynamically via PHP or other through the URL
videos.php?filename=videofile.php src="<? echo $filename;?>" It's driving me mad! tried both suggestions but the value passes drom the Play() function just isn't reaching the src= " ".
Unfortunatly PHP isnt an option as the client has specified no serverside :-(
Looks like I'm going to have to have a rethink!
Thanks again
They had little success as well. But you could try using the innerhtml idea which is supported now by ie5+/firefox1+/opera7+/netscape7+
Just stuff the embed into a div and change the innerhtml of the div with a new embed when you want to change the filename. In theory should work.