HTTP live streaming with ios
If your MP4 file is more that 10 minutes in length you will need to use HLS to stream the file.
For live streams, you can use software like this to encode it live:
http://www.mcommstv.com/products/mcomms-transcode
If it's a VoD file then pre-encode it with your favourite H.264/AAC encoder.
Remember to include multiple bitrate versions of your file, including 64kbps. If you don't include a 64kbps stream Apple will reject the App. We commonly use: 64k 120k 240k 480k 800kbps 1200kbps The bitrate that you list first in your multirate m3u8 file will be played for the first 30 seconds, put a medium bitrate first so it doesn't take too long to start streaming when users are on slow 3G networks. Here's an example:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=120000
120k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=60000
60k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=240000
240k/Playlist.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=480000
480k/Playlist.m3u8
We have to convert any audio file to m3U8 formnat.
At run time I could not find any plugin.I searched little.
So we setted up the IIS server while using the URl.
http://www.hanselman.com/blog/CommentView.aspx?guid=86968cd5-feeb-47f2-b02e-1eb4fa556379#commentstart
And got the link. like http://4a75a0cce3694e29bc670b3d574fec92.cloudapp.net/push.isml/manifest
by modifying it like http://4a75a0cce3694e29bc670b3d574fec92.cloudapp.net/push.isml/manifest(format=m3U8-aapl)
we can ply this URL in HTML5 using Video tag. We can also upload On demand video also.
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:
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.
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.
Hit the .m3u8 file in your player (initWithContentURL...) and you're off.
Repeat steps 1 and 2 above and specify differing bandwidths. We went for the presets in Compressor.
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.
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