Question

I have a simple page and a link on it which opens a simple popup ajax popup with embedded media player on it, like so

<object classid="..." id="mediaplayer1">
</object>

The problem is that after closing and disappearing popup it seems that Meda Player continues working, cause I am hearing movie sound. How can I stop this?

Was it helpful?

Solution 3

I solve this by finding popup frame and setting contentWindow.location = ''

OTHER TIPS

Here is code to add it media player to your page: Webreference

Here is code to pause/play it: WebDeveloper

function handlePlayOrPauseClick(){
     var state;
      playerStatus = document.mediaPlayer.playState;
      if (playerStatus == 6) {
        document.mediaPlayer.play();
        document.playerCtrl.playOrPause.value = " Pause ";
      } 
      else if (playerStatus == 1) {
        document.mediaPlayer.play();
        document.playerCtrl.playOrPause.value = " Pause ";
      } 
      else if (playerStatus == 2) {
        document.mediaPlayer.pause();
        document.playerCtrl.playOrPause.value = " Play  ";
      }
} 

You can use code for play/pause on window unload event to stop player.

On the click of the close button of the popup with the media player in it, try removing the element. I'll use some jQuery for terseness:

$('#close_popup').click(function(e){ $('#mediaplayer1').remove(); });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top