Flash in mediaelement.js only shows “download file”

非 Y 不嫁゛ 提交于 2019-11-30 13:29:07
ivan_pozdeev

1) You didn't specify <source/> inside video - that's why it doesn't work. You need to specify multiple <source/>'s for it to work in different browsers - see "Option B" at http://mediaelementjs.com/ .

"Download file" link is indeed generated by MediaElement logic (see mediaelement-and-player.js:1027).

2) Flash fallback will only be invoked if the browser doesn't support <video> tag. To test it in a browser that does, replace "<video>" with an invalid tag - say, "<voodeo>".

Here's the fixed code (replaced some paths to be able to test it):

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajmurmann.com/flash_test/mediaelement-and-player.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){        
            $('video').mediaelementplayer({
            enablePluginDebug: true,
            plugins: ['flash','silverlight']
        });
            });
        </script>
    </head>
    <body>
        <video width="1024" height="576" controls="controls">
            <!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
            <source type="video/mp4" src="http://mediaelementjs.com/media/echo-hereweare.mp4" />
            <!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
            <source type="video/webm" src="http://mediaelementjs.com/media/echo-hereweare.webm" />
            <!-- Ogg/Vorbis for older Firefox and Opera versions -->
            <source type="video/ogg" src="http://mediaelementjs.com/media/echo-hereweare.ogv" />
            <object width="1024" height="576" type="application/x-shockwave-flash" data="http://ajmurmann.com/flash_test/flashmediaelement.swf">
                <param name="movie" value="http://ajmurmann.com/flash_test/flashmediaelement.swf">
                <param name="flashvars" value="controls=true&amp;file=http://ajmurmann.com/flash_test/echo-hereweare.mp4">
            </object>
        </video>
    </body>
</html>

As ivan_pozdeev stated, you do need to specify a src tag in your video element. However, you do not need to provide multiple sources for MediaElement.js to work across different browsers.

In your case, you can provide a single .mp4 file and it will work across browsers (see Step 2: Option A at http://www.mediaelementjs.com) as long as you have Flash or Silverlight installed (i.e. ME's "Fall-Forward" functionality).

"Download File" will show up when HTML5 is not native to the browser you are using AND you do not have the respective plugin (i.e. Flash or Silverlight) installed. In mediaelement-and-player.js, break on line 162 (var pv = this.plugins[plugin];) - if "pv" has a value of "0, 0, 0", MediaElement has not detected a plugin and you will receive the "Download File" link.

If you're trying to do a youtube video and it's showing this, what happened was I forgot to put type="video/youtube" in the source tag. It was just set to type='video'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!