Flash video still playing on DIV that is removed using jQuery (IE bug)

后端 未结 13 2143
你的背包
你的背包 2020-12-03 05:57

I have some jQuery tabs one of which holds a flash video. When I play the video in one tab and click to another in FF or Safari the video stops along with the sound, clicki

相关标签:
13条回答
  • It's unnecessary to use JQuery, a pure Javascript solution is enough. Just replace the player div with a clone of itself:

    oldVideoDiv = document.getElementById(videoId);

    newVideoDiv = oldVideoDiv.cloneNode(true);

    oldVideoDiv.parentNode.replaceChild(newVideoDiv, oldVideoDiv);

    0 讨论(0)
  • 2020-12-03 06:03

    Simply do like this to refresh :

    var a = document.getElementById('div_movie').innerHTML;
    document.getElementById('div_movie').innerHTML = a;
    
    0 讨论(0)
  • 2020-12-03 06:03

    My solution, This should work:

    $('#myVideoContainer object').remove();
    
    0 讨论(0)
  • 2020-12-03 06:05

    To remove the video and then re-add it, add the following to your function that closes the video window:

     // Remove and re-add video
     var clone = $("#video-holder").clone(true);
     $("#video-holder").remove();
     $("#video").html(clone);
    

    Where you have a surrounding "video" div, and inside a "video-holder" div that houses the embed code.

    0 讨论(0)
  • 2020-12-03 06:10
    $("#flashContainer").empty() 
    

    will also flush the embed code and stop Flash

    0 讨论(0)
  • 2020-12-03 06:17

    We had the same issue. Flash video was embedded using swfobject.embedSWF(...), however, IE9 did not stop the video when the div was hidden using jquery.

    Simple workardound: Call the swfobject.embedSWF(...) again to (re)load the swf into the same target div.

    If you have a video with autoplay, try to load another empty swf file when hiding. Cheers

    0 讨论(0)
提交回复
热议问题