BalestraPatrick BalestraPatrick - 3 months ago 33
iOS Question

Can I stream an MP4 video of duration > 10 minutes on iOS

I'm building an app that is playing different streaming videos. The file that I'm playing in my

AVPlayer
object is an MP4 file.
Reading through the App Store Review Guidelines I just noticed that the rule 2.5.7 says:


Video streaming content over a cellular network longer than 10 minutes must use HTTP Live Streaming and include a baseline 192 kbps HTTP Live stream.


What does this mean exactly? Can I stream an MP4 video which is longer than 10 minutes?

Answer

If your MP4 video is less than 10 minutes then presumably you can just put it on a server somewhere and have the player download the file (progressive download) - you don't need to use a streaming protocol like HLS. However, if your video is more than 10 minutes then you must use HLS. This means segmenting your video into chunks and creating a playlist for them. You can do this with Apple's streaming tools - such as mediafilesegmenter - or you can use ffmpeg to segment your videos.

That guideline is for cellular networks only, so it doesn't apply if the user is connected via wifi. Take a look at Apple's recommendations for encoding your video(s) for HLS.