Iphone – HTTP live streaming with ios

http-live-streamingiphone

My app is rejected by apple and they give a reason

We found that your app does not use the HTTP Live Streaming protocol, with a baseline stream of 64 kbps, to broadcast streaming video

Then I search for a solutions and over internet all the solutions suggest that I have to use .U8F8 and .ts extension for live streaming but my app has mp4 format. I already used MPMoviePlayerController for streaming.

So my question is:

  1. Do I have to convert mp4 video to M8U8?
  2. Do I have to use MPMoviePlayer?
  3. Can I convert mp4 video to M8U8 format during run-time and how to implement live streaming
  4. Is there any example code available for HTTP live streaming?

Thanks in advance.

Best Answer

I can only comment on pre-recorded video, not live streaming...

Do I have to convert mp4 video to M8U8?

I think you mean .m3u8. Basically, you need to take your .mp4 file and:

  1. Encode it to a friendly bitrate for mobile bandwidths. You can use Apple's Compressor* app for this, it has presets for HTTP Live Streaming. Pick something around 1000kbps if you're playing around.

  2. Slice it up the output using Apple's mediafilesegmenter. You'll end up with lots of small .ts files and a manifest (.m3u8) which lists them.

  3. Hit the .m3u8 file in your player (initWithContentURL...) and you're off.

  4. Repeat steps 1 and 2 above and specify differing bandwidths. We went for the presets in Compressor.

  5. You'll end up with different versions of your video, 1 for each bandwidth, use the variantplaylistcreator tool from Apple to create a master playlist file which will point your player to each bandwidth so it can switch automatically.

  6. Stick all your .ts files and .m3u8 files on the net and use the mediastreamvalidator tool to check your master playlist file is ok and points to each version correctly.

Make sure a decent quality bitrate is first in the master playlist file as this is the version that's played first. We went for something around the 1000kbps mark.

Do I have to use MPMoviePlayer?

I can't comment on other libraries, we used MPMoviePlayer.

Can I convert mp4 video to M8U8 format during run-time and how to implement live streaming

You can for live streams but for pre-recorded video do it all before. Put all your files online, validate your playlist (.m3u8) and play your videos using the master .m3u8 file.

Is there any example code available for HTTP live streaming?

In our implementation the client in iOS does all the work (e.g. switching streams depending on the available bandwidth). As such you just need to make sure all your files are in the right place before hand.

Compressor - https://www.apple.com/final-cut-pro/compressor/ The mediafilesegmenter and mediastreamvalidator tools command lines tools available to download from the Apple developer network site.

These articles have everything you need to know: https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html https://developer.apple.com/library/archive/technotes/tn2288/_index.html#//apple_ref/doc/uid/DTS40012238

Open this up in Safari: https://developer.apple.com/streaming/examples/advanced-stream.html - Each 'Gear' is a different bitrate stream

Crack open this .m3u8 file in a text editor for an example master playlist file: https://devimages.apple.com.edgekey.net/resources/http-streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

Related Topic