Cole
Cole

Reputation: 317

Safari 9 MP4 Video Issues

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?

Upvotes: 1

Views: 2740

Answers (5)

Thor
Thor

Reputation: 308

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>

Upvotes: 0

Edu Wass
Edu Wass

Reputation: 2049

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.

Upvotes: 1

Amir Astaneh
Amir Astaneh

Reputation: 2196

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

Upvotes: 0

Capucine
Capucine

Reputation: 21

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.

Upvotes: 2

supert3d
supert3d

Reputation: 55

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

Upvotes: 2

Related Questions