3

I use mediaelement.js to Play Video with fallback Option to Flash. It works fine for all new Browsers. The Video autostart by display the page, for example in IE9 an IE10.

My Problem: In IE7 and IE8 it used the fallback option to Play the Video in flash. The video starts only by press the playbutton, but there is no autoplay.

<video id="player2" width="480" height="270" poster="bilder/nnn.jpg" controls="controls" preload="true" autoplay="true">
<source type="video/mp4" src="media/nnn_H264.mp4" />
<source type="video/webm" src="media/nnn_H264.webm" />
<source type="video/ogg" src="media/nnn_H264.ogv" />
<object width="480" height="270" type="application/x-shockwave-flash" data="videoplayer/flashmediaelement.swf">
    <param name="movie" value="videoplayer/flashmediaelement.swf" />
    <param name="flashvars" value="autoplay=true&amp;preload=true&amp;controls=true&amp;poster=../bilder/nnn_video.jpg&amp;file=../media/nnn_H264.mp4" /> 
    <img src="bilder/nnn_video.jpg" width="320" height="240" title="No video playback capabilities" />
</object>

and

<script>
var player = new MediaElementPlayer('#player2',/* Options */);
player.play();
</script>

Doe's anyone have an idea? thank you!


While searching for a other Problem I find my answer!

<script>
$('#player2').mediaelementplayer({
    plugins: ['flash', 'silverlight'],
    success: function(mediaElement, domObject) {
        if (mediaElement.pluginType == 'flash') {
            mediaElement.addEventListener('canplay', function() {
                // Player is ready
                mediaElement.play();
            }, false);
        }
    },
    error: function() {
        alert('Error setting media!');
    }
});
</script>

And now - it works!

Thank you xoreax for: Autoplay MediaElementPlayer

Community
  • 1
  • 1
Sarah Trees
  • 822
  • 12
  • 28

1 Answers1

0

Autoplay in firefox works for me when using autoplay=true in flashvars

 <object width="940" height="529" type="application/x-shockwave-flash"
        data="flashmediaelement.swf">
    <param name="movie" value="flashmediaelement.swf" />
    <param name="flashvars" value="autoplay=true&controls=true&file=file.mp4" />
</object>