Streaming to iOS from the private files system
Streaming to iOS from the private files system is broken by default in Drupal 7. Here's why, and how to fix it.
The reason why Drupal 7 private files doesn't support iOS streaming is because Drupal 7 doesn't support byte range requests, but Apache/Nginx do support them. The public files folder isn't protected against unauthenticated access, so those requests will be handled by Apache/Nginx directly, the private folder is protected though, so all requests will be handled by PHP. The iOS video player makes byte-range requests, even if the server doesn't support them, like the private file system, which results in a broken video. There are two ways to fix it, one easy way, and one more performant way.
- Install the Resumable Download module, this module will fix it automatically.
- Install the xsendfile module. This requires some more work, as Apache needs mod_xsendfile, but Nginx supports this by default. This method will be way more performant because file IO is done by Apache/Nginx, which makes PHP able to handle more requests.
Don't forget to encode your files properly, MP4 x264 with the baseline profile should work on almost any device.