11

I am currently making a video streaming service where the video is transcoded in chunks of roughly 1MB each. The HTML5 player of Firefox, Chrome and IE all try their best to request partial content (by adding the Range header to their request). Unfortunately, most of the time this header looks like this:

Range:bytes=0-

I don't want to return the full content, but only 1MB of the content, so I return this:

Content-Range:bytes 0-1048575/5074944

Now Chrome accepts this completely and keeps requesting partial content until it has reached the total length. Firefox however makes only one request which contains the partial content and not the full. Firefox thinks it is the full content and thus not the full video is being played, only part of it. How would I get the same behavior in Firefox as I have in Chrome? I tried returning 416 Range not Satisfiable but both Chrome and Firefox seems to requesting after receiving this status code.

4

2 回答 2

5

所以我终于放弃了,看了一下火狐的源码。在 Firefox 收到的范围与预期不同的地方,开发人员会放置一条评论,询问在这种情况下该怎么做。规范没有指定在这种情况下要做什么,因此 Firefox 选择什么都不做。Chrome 更有创意,并提出了开发人员认为的最佳响应(这绝对是我想要的结果)。

似乎我不是唯一一个遇到这个问题的人,否则我不会得到支持。问题是:要让 Firefox 纠正这个问题,我们需要对规范进行更改,我认为这几乎是不可能的。因此,我将关闭此问题并将此帖子标记为答案。

于 2017-01-31T14:12:12.843 回答
-1

“如何在 Firefox 中获得与在 Chrome 中相同的行为?”问题的答案 是升级到Firefox 57.0(Quantum)。这个版本的 Firefox(在我自己的服务器代码的测试中,它对部分响应大小进行了相同的限制)能够在视频播放时请求额外的部分内容,这与 Chrome 和 IE 的方式非常相似。

话虽如此,如果我在视频中向后搜索,Firefox 将从新位置播放部分内容(大概使用该位置的缓存部分内容),但在缓冲时无法请求(或使用缓存的)部分内容内容用完 - 而是跳到最后。

看起来 Firefox 开发人员尝试解决部分内容小于预期的问题,但在查找和/或缓存方面做得并不好。

我很想知道 Firefox 源代码中关于“做什么”的原始评论,以了解实际做了什么,并可能向 Firefox 开发人员提供适当的反馈。

于 2017-12-07T04:41:38.990 回答