将mp4视频流式传输到Safari

时间:2015-12-01 14:08:33

标签: safari sails.js mp4 gridfs-stream

我使用Sails.js将GridFS集合的mp4文件流式传输给访问者。 Chrome和Firefox工作正常,但Safari以Apple的方式运行 - 换句话说 - 它不在那里工作。我只收到消息"无法加载资源"。

对于某些研究,我只是将GridFS流写入文件并将其移动到我的Sails.js资源文件夹中,以便在所有浏览器中直接调用它。这在Safari中也很好用。因此,当我传输文件时必定存在问题,因为Sails.js使用" Transfer-Encoding:chunked"。

这是不同的标题响应:

直接请求mp4文件(/test/myvideo.mp4) - 适用于所有浏览器:

Accept-Ranges:bytes
Access-Control-Allow-Credentials:
Access-Control-Allow-Headers:
Access-Control-Allow-Methods:
Access-Control-Allow-Origin:
Cache-Control:public, max-age=0
Connection:keep-alive
Content-Length:28245
Content-Range:bytes 0-28244/28245
Content-Type:video/mp4
Date:Tue, 01 Dec 2015 13:38:03 GMT
ETag:W/"7dkKPef1hD8oj01oYkP4vw=="
Last-Modified:Tue, 01 Dec 2015 13:37:20 GMT
X-Powered-By:Sails <sailsjs.org>

请求GridFS流(/videos/files/sdrrer545547568fdsdf3.mp4) - 无法在Safari上运行

Access-Control-Allow-Credentials:
Access-Control-Allow-Headers:
Access-Control-Allow-Methods:
Access-Control-Allow-Origin:
Connection:keep-alive
Content-Type:video/mp4
Date:Tue, 01 Dec 2015 14:01:58 GMT
Transfer-Encoding:chunked
X-Powered-By:Sails <sailsjs.org>

有人知道Safari需要哪些信息才能使其正常工作?

//编辑:在使用字节范围标题回复后,我现在可以看到我的视频了,但是当我打开视频时,Safari现在会做一些非常奇怪的请求。以下是我记录的一个视频文件的字节范围请求:

undefined
bytes=0-1
bytes=0-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855
bytes=285855-285855

0 个答案:

没有答案