Mediaelement.js 在 IE 中出现故障,无法闪退

发布于 2024-11-10 13:32:01 字数 1903 浏览 5 评论 0原文

我在我的网站中使用了 mediaelement.js,我在示例中使用了带有 H.264 编解码器的 .mp4 文件,在所有浏览器中都能正常工作,但在任何版本的 Internet Explorer 中都不起作用当我发布网站时。在我的本地主机上,它没有任何问题(闪存回退工作正常),但在我的服务器上它不起作用。

我使用的代码是:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>VIDEO HTML5</title>

    <script type="text/javascript" src="player_files/jquery.js"></script>
    <script type="text/javascript" src="player_files/mediaelement-and-player.min.js"></script>
    <link href="player_files/mediaelementplayer.min.css" rel="Stylesheet" />
</head>

<body>


<video id="video1" src="http://www.teletica.com/html5/videos/precious.mp4" width="640" height="360" poster="http://www.teletica.com/html5/videos/precious.jpg" controls="controls" preload="none"></video>

<video width="640" height="360" id="video2" poster="videos/precious.jpg" controls="controls" preload="none">
    <source type="video/mp4" src="http://teletica.com/html5/videos/precious.mp4" />
    <source type="video/webm" src="http://teletica.com/html5/videos/precious.webm" />

    <object width="640" height="360" type="application/x-shockwave-flash" data="player_files/flashmediaelement.swf">        
        <param name="movie" value="player_files/flashmediaelement.swf" /> 
        <param name="flashvars" value="controls=true&file=http://teletica.com/html5/videos/precious.mp4" />         

        <img src="player_files/precious.jpg" width="640" height="360" alt="Here we are" title="No video playback capabilities" />
    </object>   
</video>

<script type="text/javascript">
    $('video, audio').mediaelementplayer();
</script>

播放器朝这个方向http://www.teletica.com/html5 工作。

I used the mediaelement.js in my site, I used for the example a .mp4 file with H.264 codec, works well in all browsers, but it doesn't works in any version of Internet Explorer when I publish the site. On my localhost, it doesn't have any problems (the flash fallback works well), but in my server it doesn't works.

The code I used is:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>VIDEO HTML5</title>

    <script type="text/javascript" src="player_files/jquery.js"></script>
    <script type="text/javascript" src="player_files/mediaelement-and-player.min.js"></script>
    <link href="player_files/mediaelementplayer.min.css" rel="Stylesheet" />
</head>

<body>


<video id="video1" src="http://www.teletica.com/html5/videos/precious.mp4" width="640" height="360" poster="http://www.teletica.com/html5/videos/precious.jpg" controls="controls" preload="none"></video>

<video width="640" height="360" id="video2" poster="videos/precious.jpg" controls="controls" preload="none">
    <source type="video/mp4" src="http://teletica.com/html5/videos/precious.mp4" />
    <source type="video/webm" src="http://teletica.com/html5/videos/precious.webm" />

    <object width="640" height="360" type="application/x-shockwave-flash" data="player_files/flashmediaelement.swf">        
        <param name="movie" value="player_files/flashmediaelement.swf" /> 
        <param name="flashvars" value="controls=true&file=http://teletica.com/html5/videos/precious.mp4" />         

        <img src="player_files/precious.jpg" width="640" height="360" alt="Here we are" title="No video playback capabilities" />
    </object>   
</video>

<script type="text/javascript">
    $('video, audio').mediaelementplayer();
</script>

The player works in this direction http://www.teletica.com/html5.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你的背包 2024-11-17 13:32:02

感谢一百万的调查工作和解决方案 - 我最终选择了稍微更独立的代码

var options = {...}

/*@cc_on
  @if (@_jscript_version == 9)
    options.mode = 'shim';
  @end
@*/

$('video, audio').mediaelementplayer(options);

Thanks a million for the investigative work and the solution — I ended up going with the slightly more separated code of

var options = {...}

/*@cc_on
  @if (@_jscript_version == 9)
    options.mode = 'shim';
  @end
@*/

$('video, audio').mediaelementplayer(options);
你怎么敢 2024-11-17 13:32:02

只是将其放在这里以便其他人看到它,我尝试使用此代码

/*@cc_on
@if (@_jscript_version == 9)
            mode: 'shim',
@end
@*/

,最终在 Internet Explorer 9 中遇到问题,浏览器似乎正在制作我的视频的另一个实例,该实例在其他所有内容上播放,但我无法完全控制。我最终选择了这个。

if($.browser.msie && ($.browser.version == '8.0' || $.browser.version
== '7.0'))
        options.mode = 'shim';

Just putting it here so other people see it, I tried using this code

/*@cc_on
@if (@_jscript_version == 9)
            mode: 'shim',
@end
@*/

And I ended up having issues in Internet Explorer 9, it seems that the browser was making an other instance of my video that played over everything else and that I couldn't control at all. I ended up going with this instead.

if($.browser.msie && ($.browser.version == '8.0' || $.browser.version
== '7.0'))
        options.mode = 'shim';
椵侞 2024-11-17 13:32:02

由于您的问题仅与您的系统有关,因此您的设置或 Flash 播放器可能有问题。您可以尝试以下一些操作:

  1. 如果您正在运行任何脚本,请尝试禁用这些脚本并再次播放视频。
  2. 如果您有任何辅助 Flash 播放器(例如“Gnash”),请尝试将其删除。
  3. 您的闪存播放器有可能已损坏。尝试重新安装它。
  4. 如果这些都不起作用,请尝试清除 cookie、缓存、历史记录。

您还可以重新安装 Internet Explorer 并查看它是否有效。一切顺利! :)

Since your problem persists with your system only, there might be problem with either your setting or the flash player. Here are some things you may try:

  1. If you have any scripts running, try disabling those scripts and playing video again.
  2. If you have any secondary flash players such as "Gnash", try removing them.
  3. There is a slight possibility that your flassh player might be corrupted. Try re-installing it.
  4. If none of these work, try clearing cookies, cache, history.

You can also, re-install your Internet Explorer and see if it works. All the best! :)

再见回来 2024-11-17 13:32:01

我遇到了同样的问题,并在 另一个中发现了未记录的功能post: mode:shim ~ 不确定它具体在做什么,但它似乎迫使所有浏览器重新使用 flash。

由于 chrome、ios 等可以正常处理 html5 视频,因此我使用条件注释来指定 IE9 并强制回退(flash 或 silverlight):

        var player = new MediaElementPlayer('video', {
/*@cc_on
@if (@_jscript_version == 9)
            mode: 'shim',
@end
@*/
            // remove or reorder to change plugin priority
            plugins: ['flash','silverlight'],

            // etc...

        }

I had the same problem and found an undocumented feature in another post: mode:shim ~ not sure of what its doing, specifically, but it seems to force all browsers to fall back on to flash.

Since chrome, ios, et al were working properly with html5 video, I used conditional comments to specify IE9 and force the fall back (flash or silverlight):

        var player = new MediaElementPlayer('video', {
/*@cc_on
@if (@_jscript_version == 9)
            mode: 'shim',
@end
@*/
            // remove or reorder to change plugin priority
            plugins: ['flash','silverlight'],

            // etc...

        }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文