简体   繁体   English

视频加载206 - 部分内容

[英]Videos loading with 206 - Partial Content

I'm having a problem loading videos - they are all returning with a 206 (Partial Content) response. 我在加载视频时遇到问题 - 他们都回复了206(部分内容)回复。 I'd like to fire an event when they are 100%, but it's not getting there. 我想在100%的时候开一个活动,但它没有到达那里。

Here's what I get in the inspector: 这是我在检查员中得到的:

Response Headers 响应标题

Accept-Ranges:bytes
Accept-Ranges:bytes
Connection:keep-alive
Content-Length:12465963
Content-Length:12465963
Content-Range:bytes 0-12465962/12465963
Content-Type:video/mp4
Date:Wed, 01 Apr 2015 00:26:29 GMT
ETag:"6f23fd3-be372b-51239e2090e70"
Host-Header:192fc2e7e50945beb8231a492d6a8024
Last-Modified:Fri, 27 Mar 2015 00:04:58 GMT
Server:Apache
X-Cache:SGCACHE-MISS
X-Forwarded-For:189.135.253.115

Request Headers 请求标题

Accept:*/*
Accept-Encoding:identity;q=1, *;q=0
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie:PHPSESSID=ml8n0hh37na09ggjcvvbeld383; key=76626f47b940e09d3601920b684befc62d703fd5%2Bda9d8d1ede4727d1486ac7274487ffa8994d18f3%7C1427415309%7Ce2fa179955ca0ce759d4ba10c1227e825bba261f%7CZGV2YWRtaW4%3D
DNT:1
Host:[xxxxx]
Pragma:no-cache
Range:bytes=0-
Referer:[xxxxx]
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.104 Safari/537.36

I saw this: Content-Range:bytes 0-12465962/12465963 - and noticed that it has loaded all but the last byte. 我看到了这个: Content-Range:bytes 0-12465962/12465963 - 并注意到它已经加载了除最后一个字节之外的所有字节。

Secondary question : I also see Cache-Control:no-cache . 次要问题 :我也看到了Cache-Control:no-cache The videos I'm loading aren't large, and it would be nice to keep them in the cache for a short amount of time. 我正在加载的视频并不大,将它们保存在缓存中的时间很短。

I'm clueless when it comes to headers and this kind of thing. 当谈到标题和这种事情时,我很无能为力。 What's going on? 这是怎么回事?

As long as you set Range:bytes=0- in the request, you will have a 206 response. 只要在请求中设置Range:bytes=0- ,就会有206响应。 0- means start at byte zero, and give me all bytes to the end of the file. 0-表示从字节0开始,并将所有字节给我到文件末尾。 And the server is doing exactly that. 服务器就是这样做的。 You are in fact receiving all the bytes, including the last byte. 实际上,您正在接收所有字节,包括最后一个字节。 Content-Range:bytes 0-12465962/12465963 is inclusive. Content-Range:bytes 0-12465962/12465963包含在内。 The first byte is at position 0, the second byte at position 1, etc. So 0-12465962 is 12465963 bytes total. 第一个字节位于0位,第二个字节位于位置1,等等。因此0-12465962总共为12465963个字节。

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

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