IE11中的http伪流媒体 [英] http pseudo-streaming in IE11

查看:384
本文介绍了IE11中的http伪流媒体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些视频,我需要能够在这之前没有下载整个视频的情况下寻找其中的各个点。到目前为止,我使用带有NodeJS的html5视频标签和vid-streamer模块在Firefox和Chrome中运行良好。但是,IE 11坚持要下载整个视频,我不能让它跳过,直到它下载到我想玩的那一点。 IE是否支持部分内容,是否有一些技巧可以触发它?或者是否已经使用其他标头之一(GetContentFeatures.DLNA.ORG ??)并且我的服务器无法理解?

I have some videos and I need to be able to seek to various points in them without having downloaded the entire video prior to that point. So far I have it working great in Firefox and Chrome using the html5 video tag with NodeJS and the vid-streamer module. However, IE 11 insists on downloading the entire video, I can't get it to skip ahead until it has downloaded up to the point I want to play. Does IE support partial content, and is there some trick to triggering it? Or is it already asking for it with one of the other headers (GetContentFeatures.DLNA.ORG??) and my server doesn't understand?

示例firefox请求标头 - -it每当你寻找时发送一个新请求,关键部分是范围标题,它甚至为初始请求发送它(bytes = 0 - ):

Sample firefox request header--it sends a new request whenever you seek, key piece being the range header, which it sends even for the initial request (bytes=0-):

Accept  video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5
Accept-Language en-us,en;q=0.5
Connection  keep-alive
Cookie  connect.sid=...
Host    ...
Range   bytes=75661312-
Referer ...
User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0

服务器响应:

Accept-Ranges   bytes
Cache-Control   public
Connection  keep-alive
Content-Disposition inline; filename=video.webm;
Content-Length  12509
Content-Range   bytes 75661312-75673820/75673821
Content-Transfer-Encoding   binary
Content-Type    video/webm
Date    Wed, 03 Sep 2014 21:42:08 GMT
Last-Modified   Thu, 28 Aug 2014 15:05:24 GMT
Pragma  public
Server  VidStreamer.js/0.1.4
Vary    Accept-Encoding
X-Powered-By    Express
status  206 Partial Content

IE11不发送范围:

IE11 does not send a range:

Request GET /videos/video.mp4 HTTP/1.1
Accept  */*
If-Modified-Since   Mon, 16 Nov 2009 14:05:45 GMT
User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Referer ...
GetContentFeatures.DLNA.ORG 1
Pragma  getIfoFileURI.dlna.org
Accept-Language en-US
Accept-Encoding gzip, deflate
Host    ...
Connection  Keep-Alive
Cookie  ...

和服务器(合理地,我认为)响应整个视频和200确定而不是206部分内容:

And the server (reasonably, I think) responds with the whole video and a 200 OK instead of 206 partial content:

Response    HTTP/1.1 200 OK
X-Powered-By    Express
Vary    Accept-Encoding
Cache-Control   public
Connection  keep-alive
Content-Type    video/mp4
Content-Disposition inline; filename=video.mp4;
Pragma  public
Last-Modified   Mon, 16 Nov 2009 14:05:45 GMT
Content-Transfer-Encoding   binary
Content-Length  36373917
Server  VidStreamer.js/0.1.4
Date    Wed, 03 Sep 2014 21:38:42 GMT


推荐答案

想出来。 IE11确实支持伪流,但是它需要Accept-Ranges:bytes标头才会打扰请求范围,因此无论是否实际发送字节范围,服务器都需要响应。我不得不修改我的vid-streamer模块来做到这一点。

Figured it out. IE11 does support pseudo streaming but it wants the "Accept-Ranges: bytes" header before it will bother requesting a range, so the server needs to respond with that regardless of whether it is actually sending a byte range. I had to modify my vid-streamer module to do that.

警告:我不知道哪些浏览器支持视频标签但不支持字节范围,所以我不能肯定地说这不会破坏某个地方,但似乎应该没问题......

Caveat: I have no idea which browsers support the video tag but not byte ranges, so I can't say for sure that this won't break something somewhere, but it seems like it should be ok...

这篇关于IE11中的http伪流媒体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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