HTML5视频 - video.buffered.length对IE 10/11返回0 [英] HTML5 video - video.buffered.length returns 0 on IE 10/11

查看:478
本文介绍了HTML5视频 - video.buffered.length对IE 10/11返回0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我监测的HTML5视频播放器下载进度。
10/11 IE在Windows 8 / 8.1是造成我的困扰。这里是我的code和问题后解释:

I am monitoring download progress for an HTML5 video player. IE 10/11 on Windows 8/8.1 is causing me troubles. Here is my code and the explanation of the issue after:

<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<video id="myVideo" width="640" height="360" controls>
<source src="pathto.mp4" type='video/mp4; codecs="avc1.42E01E,mp4a.40.2"' />
</video>
<script type="text/javascript">
var video= $('#myVideo')[0];   
var videoJ= $('#myVideo');    
function doUpdateProgress(){
console.log(video.buffered.length);
}
videoJ.on('progress', doUpdateProgress);
videoJ.on('canplay', doUpdateProgress);
</script> 

问题是在我的服务器url1to.mp4 video.buffered.length的URL总是在IE 10/11返回0(IE9返回undefined)。它适用于我已经测试(包括Chrome和FF)的所有其他浏览器的罚款。

Problem is with the URL on my server url1to.mp4 video.buffered.length always returns 0 in IE 10/11 (IE9 returns undefined). It works fine on all other browsers I have tested (including Chrome and FF).

如果我放在一个URL从url2to.mp4其预期甚至在IE10 / 11(在你不当然时间表寻求的情况下1)返回1共享服务器。的MP4文件是完全相同的打扰,因此服务器我知道这是不是从文件格式发出来的一样。我试着用另一种格式良好的MP4(从我主持这两个服务器上videojs样品),也导致该问题。

If I put in an URL from a shared server url2to.mp4 it returns 1 as expected even on IE10/11 (1 in the case you do not seek in the timeline of course). The mp4 files are exactly the same on bother servers hence I know it is not coming from a file format issue. I tried with another well-formatted mp4 (sample from videojs which I hosted on both server) and it also causes the issue.

服务器端 - 我的哑剧/类型似乎确定 - 我有部分支持(字节范围),我的服务器上启用(阿帕奇2.2.22 Ubuntu的服务器12.04.3 LTS上)的内容。虽然我也许认为它可能有一些做与HTTP字节范围支持任何客户​​端或服务器端一个好办法。

Server side - my mime/type seems ok - I have partial support (byte-range) content enabled on my server (Apache 2.2.22 on Ubuntu server 12.04.3 LTS). Though I maybe think it could have something to do with a tweak in HTTP byte range support either client side or server side.

由于它只是发生在IE9 / 10/11我有铅的零到哪里进一步调查。我问在MSDN上,但无济于事的问题。

As it only happens on IE9/10/11 I have zero lead as to where to investigate further. I did ask the question on msdn but to no avail.

有人可以带来一些光对此有何看法?

Can someone bring some light on this?

修改:从问题中移除真正的视频网址

EDIT: remove real video URLs from question.

感谢

推荐答案

确定我固定它最终与一个完整干净的Apache从2.2.22安装到2.4.9。我没有从源代码这一次编译从Ubuntu的服务器12.04.3 LTS采取默认的包来代替。我不能确定有关此问题的确切原因,但我认为它涉及到一系列的HTTP请求和响应IE 9/10/11和Apache的某个版本/设置之间是不兼容的。

OK I fixed it eventually with a complete clean install of Apache from 2.2.22 to 2.4.9. I did compile from source this time instead of taking the default package from Ubuntu server 12.04.3 LTS. I am unsure about the exact reason for this issue but I think it relates to HTTP range requests and responses being incompatible between IE 9/10/11 and some version/settings of Apache.

要总结一下我的故障排除步骤,任何人谁可能有类似的问题:

To summarize my troubleshooting steps for anybody who may have similar issue:


  • 检查服务器正常哑剧/类型

  • 外卡 CORS (MSDN建议)

  • 检查你的网页服务器支持的范围请求/ 206部分内容。我用卷曲来检查这个我的服务器上,它的工作确定。但是从这个页面样本PHP code似乎表明否则我认为这是什么困惑IE(范围头被正确返回,但响应code为200,而不是206的卷曲)。

  • 有时它只是似乎需要编译从源(从官方网站的可信源),而不是使用默认的包从操作系统。即使有可能在一开始(尤其是如果你有固定的依赖)的一个步骤的要求,有时更新 - 最终的结果可能是值得你的努力(我知道有利弊)

  • 检查您的MP4文件格式:尽量接待来自videojs的样品看看如果它工作得更好。您可能需要<一个href=\"http://stackoverflow.com/questions/22926844/html5-video-video-unsupported-invalid-file-type-ie\">repackage/re-trans$c$c.

  • check your server for proper mime/types
  • wild card CORS (msdn suggested that)
  • check your web sever supports ranges request/206 partial content. I have used CURL to check this on my server and it worked ok. However the sample PHP code from this page seemed to indicate otherwise which I think is what confused IE (the range headers were correctly returned but the response code was 200 and not 206 as with CURL).
  • sometimes it just seems you need to compile from source (and from trusted source of official website) instead of using default package from OS. Even if there could be a step requirement at the beginning (especially if you have to fix dependencies) and sometimes for update - the end result can be worth your effort (I know there are pros and cons).
  • check for your mp4 file format: try to host the sample from videojs and see if it works better. You may need to repackage/re-transcode.

这篇关于HTML5视频 - video.buffered.length对IE 10/11返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆