1

I am trying to figure out why an MP4 video is not working on our server only in Safari 9.

I have tried the video on my local device and it plays just fine on the website using the same version of Safari.

It appears to only not be working in Safari 9 on the server. I believe all the MIME types are setup on the server because the video works on other browsers.

The site is behind Cloudflare and I have tried using a file rule on .mp4 for Cloudflare to ignore and not serve that file.

Any ideas on what else I can try to get this fixed in Safari?

Cole
  • 317
  • 4
  • 14

5 Answers5

2

I'm trying to resolve a similar issue myself. I found the following SO piece that might help? Safari 9.0 can not play mp4 video on the storage server

In summary Safari doesn't make a full Range request in the header, unlike Chrome and other browsers. As a result it doesn't know how to interpret the response.

Further reading suggests that Apple requires HTTP servers to support byte range requests. https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6

It also looks like Apache <= 2.2.20 surfed a DoS exploit back in 2011 with Range Headers and were subsequently disabled by default. http://httpd.apache.org/security/CVE-2011-3192

Community
  • 1
  • 1
supert3d
  • 55
  • 7
  • It appears to be an issue with Cloudflare. I have tried to ignore caching of all mp4 files on the domain but it still is not working. However when hitting our server IP directly the file passes the Apple test. Cloudflare must be the cause of this from the looks of it right now. – Cole Apr 20 '16 at 22:56
2

I also think the issue is with Cloudflare. The mp4 from my tags are working on all browsers, except Safari. Once Cloudflare has been paused, the videos work on Safari too. Resuming Cloudflare recreates the issue.

Capucine
  • 21
  • 1
1

If your server is Apache try placing this in .htaccess

SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|mp4|ogv|webm)$ no-gzip dont-vary

This solved videos not loading for me in Safari on a domain with Cloudflare enabled.

Edu Wass
  • 1,969
  • 1
  • 21
  • 22
  • 1
    Previously adding Header add Accept-Ranges "bytes" to the htaccess file fixed my mp4 streaming problem, but today, that wasn't enough and I had to add SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|mp4|ogv|webm)$ no-gzip dont-vary as well. Thanks! – Thor Nov 23 '22 at 16:51
0

I think it's related to video or music content that needs to stream and based on CloudFlare must move to a subdomain like cdn.domain.com

Sites that do streaming content, however, should move their streaming content to a subdomain we don't proxy in their DNS settings. link

Amir Astaneh
  • 2,152
  • 1
  • 20
  • 20
0

My Cloudflare isn't returning the Accept-Ranges header and so Safari won't play back my .mp4 files, regardless of size. Tried quite a few of the suggestions above without success. What finally worked was adding the missing header in via the .htaccess file.

<IfModule mod_headers.c>Header add Accept-Ranges "bytes"</IfModule>
Thor
  • 198
  • 1
  • 8