FancyBox + MediaElement 播放器 + IE

发布于 2024-10-17 21:28:13 字数 574 浏览 0 评论 0原文

尝试将 mediaelement.js 播放器合并到灯箱中 (fancybox.net)。

播放器在没有 FancyBox 的 IE 中工作。 FancyBox 在 IE 中使用常规文本内容。 但是播放器 + fancybox 一起在 IE 中不起作用(完美地工作 在所有其他浏览器中)。

只是测试页面上的播放器: http://ways-means.channeltree.com/index3.html

测试页面上灯箱内的播放器:http://ways-means.channeltree.com /index4.html

还尝试通过 iframe 拉入内容(与上面相同的测试域,但使用index5.html)

一整天都在绞尽脑汁,它可能是我错过的一些小/愚蠢的东西,但不确定是什么。

如有任何帮助,我们将不胜感激 - 谢谢!

Trying to incorporate the mediaelement.js player into a lightbox (fancybox.net).

Player works in IE without FancyBox.
FancyBox works in IE with regular text content.
But The player + fancybox together doesn't work in IE (works perfectly
in all other browsers).

Just the player on a test page: http://ways-means.channeltree.com/index3.html

Player within lightbox on a test page: http://ways-means.channeltree.com/index4.html

Also tried pulling the content in via an iframe (same test domain as above, but with index5.html)

Been racking my head all day, and its possibly something small/stupid that I'm missing, but not sure what.

Any help is appreciated - thanks!

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

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

发布评论

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

评论(3

哀由 2024-10-24 21:28:13

我是在寻找解决方案时来到这里的。我什么也没找到,直到我自己找到解决方案。在这里,仅供参考。我希望它能帮助某人。

$('.open-fancybox').fancybox({
    'afterShow': function() {
        $('#mediaelement').mediaelementplayer();
    }
});

<a class="open-fancybox" href="#fancybox">
<div id="#fancybox">
    <video id="#mediaelement" src="...mp4">
</div>

I got here while looking for a solution. I did not find anything until I found a solution by myself. Here it is, just for info. I hope it helps someone.

$('.open-fancybox').fancybox({
    'afterShow': function() {
        $('#mediaelement').mediaelementplayer();
    }
});

<a class="open-fancybox" href="#fancybox">
<div id="#fancybox">
    <video id="#mediaelement" src="...mp4">
</div>
荆棘i 2024-10-24 21:28:13

我最近在一个项目中遇到了和你一样的问题。就我而言,fancybox 在模式窗口中正确加载了 mediaelement 播放器。然而,在 IE8 上,出现了 Flash 播放器,然后您可以看到控件被剥离并且从未被替换。

进一步查看该插件后,似乎 mediaelement 会侦听 Flash 播放器触发的事件,以便初始化播放器的控件。根据多种情况,我发现播放器在调用插件之前发出该事件,这意味着插件从未确定播放器是否准备好。

对我来说,解决方法是将 flashName 选项显式设置为 swf 的路径。然后,我只是从源中删除了对象标记,允许插件创建它。

显式设置 swf 的路径:

    <script>
    $(document).ready(function(){
      $('video').mediaelementplayer( {
      flashName: '/path_to_mediaelement_swf/flashmediaelement.swf',
      });
   });
  </script>

视频来源:

<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
    <!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
    <source type="video/mp4" src="myvideo.mp4" />
    <!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
    <source type="video/webm" src="myvideo.webm" />
    <!-- Ogg/Vorbis for older Firefox and Opera versions -->
    <source type="video/ogg" src="myvideo.ogv" />
    <!-- Optional: Add subtitles for each language -->
    <track kind="subtitles" src="subtitles.srt" srclang="en" />
    <!-- Optional: Add chapters -->
    <track kind="chapters" src="chapters.srt" srclang="en" /> 
    <!-- Allow the plugin to generate the object markup, preventing the swf source from loading too early  -->

</video>

希望这有帮助!

I recently encountered the same problem as you did on a project. In my case, fancybox properly loaded the mediaelement player in the modal window. However, on IE8, the flash player was presented and you could then see the controls get stripped away and never replaced.

After looking at the plugin a bit more, it seems mediaelement listens for an event fired by the flash player in order to initialize the controls for the player. Depending on a number of circumstances, I was finding that the player was emitting that event BEFORE the plugin was called, which meant that the plugin never determined the player to be ready.

The fix for me was to explicitly set the flashName option to the path of the swf. Then, I simply removed object markup from my source, allowing the plugin to create it.

Explicitly setting the path to the swf:

    <script>
    $(document).ready(function(){
      $('video').mediaelementplayer( {
      flashName: '/path_to_mediaelement_swf/flashmediaelement.swf',
      });
   });
  </script>

Video source:

<video width="320" height="240" poster="poster.jpg" controls="controls" preload="none">
    <!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
    <source type="video/mp4" src="myvideo.mp4" />
    <!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
    <source type="video/webm" src="myvideo.webm" />
    <!-- Ogg/Vorbis for older Firefox and Opera versions -->
    <source type="video/ogg" src="myvideo.ogv" />
    <!-- Optional: Add subtitles for each language -->
    <track kind="subtitles" src="subtitles.srt" srclang="en" />
    <!-- Optional: Add chapters -->
    <track kind="chapters" src="chapters.srt" srclang="en" /> 
    <!-- Allow the plugin to generate the object markup, preventing the swf source from loading too early  -->

</video>

Hope this helps!

是伱的 2024-10-24 21:28:13

我刚刚遇到了同样的问题,事实证明,在 IE 7/8 中,如果您在显示的 div 中有 na(Flash 播放器):none Flash 播放器将无法正确加载视频。

对我来说,解决方法是不显示 div,并使用 jquery 隐藏具有 .hidden_​​video 类的所有 div。

执行此操作后,视频在 fancybox 中正确加载。

I have just had the same issue, it turns out than in IE 7/8 if you have na (the flash player) in a div that is display:none the flash player wont load the video correctly.

The fix for me was to take the display none off the div, and use jquery to hide all divs with a class of .hidden_video.

After doing this, the video loaded correctly in the fancybox.

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