18

I've been having problems serving videos from my dev server that play in mobile Safari. My dev server does not support the 'Accept-Ranges' header and after reading a few forums I've discovered that may be my problem. Here is an example forum posting saying just that.

Is this correct? Does mobile Safari require the Accept-Ranges header? Can anyone point me to any Apple documentation actually stating that?

Thanks.

james.garriss
  • 12,959
  • 7
  • 83
  • 96
Chuck Phillips
  • 812
  • 1
  • 7
  • 15

2 Answers2

24

I found some Apple documentation that says that it does in fact need that for video.

HTTP servers hosting media files for iOS must support byte-range requests, which iOS uses to perform random access in media playback. (Byte-range support is also known as content-range or partial-range support.) Most, but not all, HTTP 1.1 servers already support byte-range requests.

If you are not sure whether your media server supports byte-range requests, you can open the Terminal application in OS X and use the curl command-line tool to download a short segment from a file on the server:

curl --range 0-99 http://example.com/test.mov -o /dev/null

If the tool reports that it downloaded 100 bytes, the media server correctly handled the byte-range request. If it downloads the entire file, you may need to update the media server.

Source: Apple Documentation

Steve Clay
  • 8,671
  • 2
  • 42
  • 48
Chuck Phillips
  • 812
  • 1
  • 7
  • 15
3

The answer above is helpful, but does not actually answer the question that was asked.

According to the HTTP RFC, the Accept-Ranges header is optional even when byte-range requests are supported.

However, the documented curl check implies that the answer is no: iOS does not require the Accept-Ranges header for video, but does require byte-range support with partial content (206) responses.

Disclaimer: I haven't checked it on an actual device.

amichair
  • 4,073
  • 1
  • 21
  • 19
  • 1
    I have checked it on several actual devices - if I disable byte-range support on my server, any Safari browser will refuse to play the video. – Michael Jan 20 '17 at 05:45
  • I think that part has already been established, but the question is whether it requires Accept-Ranges headers (which are not required by the RFC in order for byte-range requests to work). – amichair Jan 23 '17 at 14:34
  • I was trying to help you out with actual device tests, but OK. – Michael Feb 02 '17 at 09:07
  • Thanks! If there's a way to test the second part (with byte ranges and with/without accept-ranges headers), then we'll have the definitive answer. – amichair Feb 05 '17 at 12:01