Question

I have a link to play a video in my website. When a user click on that video link, the div which embedded that video will popup(not popup window, its showing hidden div using jquery BlockUI). And there is close button it will hide the div which embedded video.

Everything is working fine. But video is not stopping on closing that div. I can hear the sound :( . I want to stop that sound too on closing that video. What to do. Please do the needful

<OBJECT ID="MediaPlayers" WIDTH="400" HEIGHT="350" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="1.wmv">
<PARAM name="autostart" VALUE="false">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
<EMBED TYPE="application/x-mplayer2" SRC="1.wmv" NAME="MediaPlayer"
WIDTH="400" HEIGHT="350" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>
</OBJECT>
Was it helpful?

Solution

Try to use this when you close the popup window.

document.getElementById("MediaPlayers").stop();

Or you can use another div to wrap this player, and then add your html into innerHTML when open popup window and then remove all when you close the window. like

<div id="playerWrap">
    <OBJECT ID="MediaPlayers" ....
    .....
    </OBJECT>
</div>

javascript code:

document.getElementById("palyerWrap").innerHTML = "";

reference by http://www.htmlforums.com/multimedia-elements/t-accessing-mediaplayer-functionality-from-javascript-65899.html

OTHER TIPS

if you want everybody to be able to your video, you should use the html5 video tag instead. this will not only relieve you from unexpected behavior of propriatory plugins (windows media player) but also allow you to reach a broader spectrum of devices and therefore a bigger audience.

i suggest to convert you video to the webm format and using jplayer to display it on your site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top