Prevent divx web plugin fron replacing html5 video element?

后端 未结 4 636
傲寒
傲寒 2020-12-31 09:02

For some reason I\'m sure the folks at DivX think is important, there is no straightforward way to prevent their plugin from replacing all video elements on your page with t

4条回答
  •  梦谈多话
    2020-12-31 09:32

    It seems, that the plugin is only replacing the video when there are src elements within the video tag. For me it worked by first adding the video tag, and then - in a second thread - add the src tags. However, this doesn´t work in IE but IE had no problem with an insertion of the complete video tag at once.

    So following code worked for me in all browsers (of course, jQuery required):

    var $container = $('video_container');
    var video = 'my-movie';
    var videoSrc = '' +
        '' +
        '';
    
    if(!$.browser.msie) {
        $container.html('');
        // this timeout avoids divx player to be triggered
        setTimeout(function() {
            $container.find('video').html(videoSrc);
        }, 50);
    }
    else {
        // IE has no problem with divx player, so we add the src in the same thread
        $container.html('');
    }
    

提交回复
热议问题