I'm using Sails.js to stream a mp4 file of a GridFS collection to my visitors. Chrome and Firefox are working fine, but Safari does it the Apple way - or in other words - it isn't working there. I only get the message "Failed to load resource".
For some research, I've just written the GridFS stream into a file and moved this one to my Sails.js assets folder to call it directly in all browsers. This works fine, also in Safari. So there must be an issue when I stream the files, because there Sails.js uses "Transfer-Encoding:chunked".
This are the different header responses:
Direct request to the mp4 file (/test/myvideo.mp4) - works on all browsers:
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>
Request to the GridFS stream (/videos/files/sdrrer545547568fdsdf3.mp4) - doesn't work on 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>
Has anybody an idea which information Safari needs to make it work?
// Edit: After responsing with the Byte-Range headers, I can now see my video, but Safari does now some very strange request, when I open the videos. Here are my logged Byte-Range requests for one video file:
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