Search code examples
ioscocoa-touchmpmovieplayercontrollerhttp-live-streaming

Is there a way MPMovieplayerViewController can detect if video is a stream?


I'm making an iOS video player application that gets a whole bunch of URLs of videos from a web service and plays them in an MPMoviePlayerViewController.

Most of the videos are just .mp4 or .mov files, but some of them are live HTTP streams. The only thing I have is a URL and those don't indicate whether it's a file or stream.

Since I'm using MPMovieControlStyleNone and my own video controls, I need to be able to detect whether or not a video is a file or a live stream in order to change my controls.

Is there any way I can detect that?


Solution

  • Use an HTTP HEAD request. If the Content-Type is application/vnd.apple.mpegurl, then it's an http live streaming stream.