MP4 Won't Load in Safari Using CloudFlare


#22

I don’t think the issue has anything to do with SSL. And I don’t have pull with the CF folks either. It’s odd that I never had an issue with MP4s in Safari, but you (and others) are.


#23

I’m having the exact same issue!
MP4 files wont load in Safari when served from CloudFlare.
Has anyone found a solution to this?


#24

I just realized I have cache everything on my domain.

Try caching the MP4 as a static resource. Use a page rule similar to:

*your-domain.com/*.mp4*
Browser Cache TTL: a year
Cache Level: Cache Everything
Edge Cache TTL: an hour

#25

We’ve been fighting this for years and just figured it out.

From Stack Overflow (https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari)
Safari requires webserver to support “Range” request header in order to play your media content.

https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6

For a legit “Range” request response, your web server need to return status code “206”.

Our proprietary CMS is built on PHP like Wordpress and we had to modify it to support Range request headers just like this code: https://gist.github.com/codler/3906826

Now the videos play in Safari!


#26

I’ve been working on this with another member offline. We’ve come to the same conclusion that it has to do with the way the file was served at the origin. But it’s not a 200-vs-206 issue.
Mine works and is sending 200.

From my email:

I would be thinking at this point it’s a fault at the server. My guess it’s not being served correctly. I tried to look for differences (see attached).

A few things to fiddle with on the server:
• Remove Etag
• Make sure files are being served in full rather than chunked/streamed protocol

My thinking is your server is trying to stream the video, only sending out 16KB. Cloudflare doesn’t like streaming unless you pay for it. That’s why they only ‘unofficially’ support small MP4s.
Since CF doesn’t get the whole file, it can’t tell the full size. You can see that my file shows the Content-Length but yours does not.
CF sends the 16KB that it got from your server and sends only that. You can see your file says 16.42KB but mine says 47.15MB

It’s conjecture. But sounds good! Give it a shot at least. Remember to flush cache and use Dev Mode after you make changes!

We don’t have confirmation yet though.


#27

Hi … I’m new, but since I’ve installed Cloudflare, all of my devices (i.e., iPhones and MacBook Pros) are receiving the following error message: “Error loading media: File could not be played” whenever I play video on my website. This has never happen before and has only happen since I implemented Cloudflare. Still, I have noticed that the IE and FireFox browsers continue to play the videos on my website without a problem. I’ve run my virus and spyware scanners and I’ve run my FixMeStick just to do the best I can checking out my devices for any malware. Non of the scanners reported any problems. I even tried running: “curl --range 0-99 http://example.com/test.mov -o /dev/null” (I did insert my own URL in the command) in Terminal and the tool reported that it downloaded 100 bytes. I’m guessing that means the media server has correctly handled the byte-range request. Hmmm … Safari is my default browser. Should I switch my default browser to IE or FireFox? Should I try to “pause” Cloudflare and then play the videos? Still, I could be all wrong … So, please know, that any help would be greatly appreciated. Thank you in advance …


#28

Check out the two messages just above yours. See if those recommendations help you.


#29

Thanks for the reply Jules … Everything was working for years before I added CloudFlare … Nope, nothing above seems to help now ( regarding the two (2) message just above mine ) … Maybe the best answer is to use another browser … Again, thanks for your help …


#30

You can’t expect users to use a certain browser though. The one correlation I see is that I am using a Windows server and it’s working OK. Maybe it’s sending out the file as one piece, where unix is being sophisticated and streaming bits at a time… and CF doesn’t like that.


#31

Anyone, or any cloudflare staff got any answers to this yet?


#32

ren, can you post your scenario? All information helps us find the cause and finally kill this bug. What kind of server is your site on?