12

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 they fancy logo.

What I need is a workaround for this, telling the plugin to skip some videos, i.e. not replace them with their playable content.

Horia Dragomir
  • 2,858
  • 24
  • 21
  • 2
    I'm trying to use HTML5 as a full screen background on my site. On machines with the DivX web plugin enabled, the video becomes overlayed on top of my site as the plugin completely ignores Zindexing. I personally find this **BROWSER HIJACK** disgusting. I used to have a lot of faith in DivX, they certainly destroyed that with this pathetic excuse for a plugin. – Forkoff.co.uk May 26 '11 at 10:17
  • The sad thing is that there is nothing we can do about it. :-( – Horia Dragomir May 26 '11 at 12:30

4 Answers4

9

I got around this by putting an empty HTML 5 video tag, then putting in the video source tags in a JavaScript function in the body onload event. The video then comes up in the normal HTML 5 player and not the DivX web player.

e.g. This would give the DivX player:

<video width="320" height="240" controls="controls">
  <source src="movie.mp4" type="video/mp4" />
</video>

But this would give the normal html 5 player:

    <head>
    <script type="text/javascript">
    function changevid() {
       document.getElementById('vid').innerHTML = '<source src="inc/videos/sample1.mp4" type="video/mp4" />';
       document.getElementById('vid').load();
    }
    </script>
    </head>
    <body onload="changevid()">

       <video id="vid" width="800" height="450" controls="controls">    
       </video>

    </body>
George
  • 280
  • 3
  • 10
  • You can go one further, and add the video tag in its entirety via javascript. I've tested this much personally, and the DivX extension doesn't catch/see anything added after the page has loaded. – Chris Hayes Aug 20 '12 at 21:06
  • mh, i tried this solution, but it does not work for me. No matter, if i use jquerys ready event, or directly body onload, divx always comes up, especially in chrome. – ghost23 Nov 18 '12 at 18:49
  • I used this solution, but using jQuery. I appended the video tag to a div, then appended the sources to the video tag. Worked like a charm – Navigatron Nov 27 '12 at 14:14
  • 2
    This is old, but it helped me fix my issue too. One specification: your answer does this already with the native `onload` function, but make sure to use that or a `$(window).load()` function. `$(document).ready()` was too early and the DivX plugin was still catching it. Thanks for the tip though!! – Scrimothy Sep 25 '13 at 20:51
  • @George, if I could +100 this I would. This has been driving me insane for weeks. – rescuecreative Feb 06 '14 at 15:55
3

At this time, there is no API or means to block the divx plugin from replacing video elements with their placeholder. :-(

Horia Dragomir
  • 2,858
  • 24
  • 21
2

i started reverse-engineering the divx-plugin to find out what can be done to hack a way into disabling it. An example, including the complete sourcecode of the divx-plugin, can be found here: http://jsfiddle.net/z4JPB/1/

It currently appears to me that a possible solution could work like this:

  • create a "clean" backup of the methods appendChild, replaceChild and insertBefore - this has to happen before the content-script from the chrome-extension is executed.
  • the content-script will execute, overrides the methods mentioned above and adds event-listeners to the DOMNodeInsertedIntoDocument and DOMNodeInserted events
  • after that, the event-listeners can be removed and the original DOM-Methods restored. You should now be able to replace the embed-elements created by the plugin with the video-elements
Martin Schuhfuß
  • 6,814
  • 1
  • 36
  • 44
  • unfortunately this didn't work out as i hoped it would. The only solution that worked for me was to observe the dom for unwanted 'embed'-tags, then removing them and presenting the fallback meant for browsers that don't support video at all. However i did contact the guys at divx who told me they would pass it on to their development-team – i dont believe in miracles, but who knows... – Martin Schuhfuß Jun 01 '12 at 15:46
1

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 = '<source src="video/'+video+'.mp4" type="video/mp4"></source>' +
    '<source src="video/'+video+'.webm" type="video/webm"></source>' +
    '<source src="video/'+video+'.ogv" type="video/ogg"></source>';

if(!$.browser.msie) {
    $container.html('<video autoplay loop></video>');
    // 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('<video autoplay loop>' + videoSrc + '</video>');
}
tomraithel
  • 958
  • 2
  • 13
  • 22