Videos don’t play on Safari on a Mac

Applies to: VisualSP Classic
Print Friendly, PDF & Email

Scenario

You are on a Mac using the Safari browser. When you try to view a video, a window opens but the video does not preview, nor will it play. The video plays properly when viewed in Chrome on a Mac.

Solution

This issue can be solved by enabling Blob Cache for SharePoint. It is important to enable Blob Cache for all web front ends.

Blob Cache

You turn on Blob Cache by updating the web.config files for your web application(s). By default the Blob Cache XML in the web.config looks like:

<BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|themedbmp|themedcss|themedgif|themedjpg|themedpng|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv|ogg|ogv|oga|webm|xap)$" maxSize="10" enabled="false" />

For our purposes, we only care about mp4 video files, so to reduce the impact of our change, the web.config changes look like:

<BlobCache location="D:\BlobCache" path="\.(mp4)$" maxSize="10" max-age="3600" enabled="true" />

Notes: the location should be on a drive that is different than where the SharePoint ULS logs go to reduce contention. The maxSize is in GB and that is for the entire cache for this web application on this WFE. The max-age is not mentioned in the default entry in the web.config. The value you put here is in seconds (so 3600 = 1 hour) and will show up in a “Cache-Control” header in the response along with the video content. It instructs the browser how long to cache the content before requesting an update. This could be as low as 0 and still enable iOS Safari video playback.

You can see some performance improvement by enabling Blob Caching for the other file types listed by default but it’s not really needed. As for the size, the maxSize property is in GB so if you consider how much storage you want to allocate to it and how large are the overall files you want to cache (and how long you want them cached) you can often come up with a better number – if you’re not sure just stick with the default (10gb) if you know you have the capacity for it. But if you know you are only caching mp4 files and you only have something like 2gb then no point setting the value that high.

Updated on January 20, 2020

Related Articles