简体   繁体   English

Mediaelement.js视频在Chrome中恢复播放问题

[英]Mediaelementjs video resume playback issues in Chrome

could use some help. 可以使用一些帮助。 We have a few Brightcove-hosted MP4 videos on our site. 我们的网站上有一些Brightcove托管的MP4视频。 They're being displayed using Mediaelementjs's HTML5 video player with a Flash fallback. 使用带有Flash后备功能的Mediaelementjs的HTML5视频播放器来显示它们。

Here's the issue: when a user pauses and resumes the video using the standard Mediaelementjs controls, the video doesn't always resume. 问题是:当用户使用标准的Mediaelementjs控件暂停并恢复视频时,视频并不总是恢复。 Occasionally, it simply goes back to the start. 有时,它只是回到开始。 This happens largely - but not always - when the video hasn't yet fully loaded. 当视频尚未完全加载时,这种情况在很大程度上(但并非总是如此)发生。 Oh, and only Chrome seems to be affected. 哦,似乎只有Chrome会受影响。

Now, the final spanner in the works is as follows: inspecting the videos in Chrome dev tools often gives us a "Inspected element has crashed" message, trashing the entire tab. 现在,工作的最后一部分如下:在Chrome开发工具中检查视频通常会给我们显示“已检查元素已崩溃”消息,从而浪费了整个标签。

Any idea what could be causing this? 知道是什么原因造成的吗? Above all I'm stumped for ideas on how to debug the issue. 首先,我为如何调试问题而烦恼。 i have already tried removing any conflicting scripts on the page, playing with the preload attribute, all to no avail. 我已经尝试过删除页面上所有有冲突的脚本,并使用preload属性,但都无济于事。

<div class="mejs-mediaelement"><video id="foo" style="width: 100%; height: 100%;" width="622" height="321" poster="foo">
<source id="foo" src="foo" type="video/mp4">
<object width="600" style="width: 100%; height: 100%;" height="338" type="application/x-shockwave-flash" src="/js/mediaelement/flashmediaelement.swf" data="/js/mediaelement/flashmediaelement.swf">
    <param name="movie" value="/js/mediaelement/flashmediaelement.swf">
    <param name="flashvars" value="foo">
</object>

In your mediaelement JS lib file, search for: 在您的中介JS lib文件中,搜索:

htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '')

Change: 更改:

if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== '' 
    // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
    || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {

To: 至:

if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no|maybe/, '') !== '' 
    // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
    || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no|maybe/, '') !== '') {

Let me know if it worked for you. 让我知道它是否对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM