Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mediaelement.js Flash Fallback not working

I'm using Mediaelement.js to include a video on a page.

It can be found at http://badlands777.com/test/

I can get the video to work in Chrome and Safari perfectly well. However, the Flash fallback for Firefox doesn't seem to kick in.

To be specific, when I right click the flash player, it says 'Movie not loaded'. I have checked the path to the player and the video file, and they are both correct.

Here is the code I am using:

<object style="border: solid 1px #fff;" width="320" height="240" type="application/x-shockwave-flash" data="http://badlands777.com/js/flashmediaelement.swf">
    <param name="movie" value="http://badlands777.com/js/flashmediaelement.swf" />
    <param name="flashvars" value="controls=false&amp;file=http://badlands777.com/wp-content/uploads/2012/08/flamesintro_v02.mp4" />
    <!-- Image as a last resort -->
    <img src="myvideo.jpg" width="320" height="240" title="No video playback capabilities" />
</object>

<script>
MediaElement('player1', {success: function(me) {    
    me.play();
}});
</script>
like image 890
Squrler Avatar asked Oct 07 '22 19:10

Squrler


1 Answers

Managed to get it to work by using the following code:

HTML:

<video id="player1" width="100%" height="100%" controls="controls">
    <!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
    <source type="video/mp4" src="PATH_TO_VIDEO.mp4" />
    <object width="1024" height="576" type="application/x-shockwave-flash" data="PATH_TO_flashmediaelement.swf">
       <param name="movie" value="PATH_TO_flashmediaelement.swf">
       <param name="flashvars" value="controls=true&amp;file=PATH_TO_VIDEO.mp4">
    </object>
</video>

JS:

    jQuery(document).ready(function(){        

        // THE MOST HATED PIECE OF CODE IN THE WORLD.
        jQuery('video').mediaelementplayer({
            success: function(player, node) {

            // STARTS THE VIDEO IF IT'S FLASH VIDEO FALLBACK.
            jQuery('.mejs-overlay-button').trigger('click');

            // STARTS THE VIDEO IF IT'S HTML5 COMPATIBLE.
            player.play();
            }
        });

        // FADES IN TITLES.
        jQuery(".enter_logo").delay(2200).animate({opacity:1},2000);
        jQuery(".enter_button").delay(6000).animate({opacity:0.4},2000);

    });
like image 106
Squrler Avatar answered Oct 10 '22 02:10

Squrler