How to play .m3u8 or .ts file in iOS?

I created one iOS application in xCode 4.5.1 .

The main purpose of this application is to play the .m3u8 video .m3u8 .

I am adding a single .m3u8 file with the entire segment (.ts) in our local resource package. So, how to use this file on iPhone locally using MPMoviePlayerController or UIWebView ?

And, Can we change or not this file after downloading from the server?

If possible, how to do it?

Tell me, any famous ...

+3
source share
2 answers

You can only play HLS content if it is served over HTTP. Therefore, you must run a simple HTTP server in a single thread, and then pass the local URL to MPMoviePlayerController . The URL will look like http://localhost:8080/file.m3u8 , and the video player will read the stream from the HTTP server that you are using in another stream.

Here's a question about running a web server on iOS that might help you: iPhone HTTP Server

+4
source

You can host the .m3u8 file on a local server, such as GCDWebServer. Just create your instance and pass the path to the .m3u8 file on this server. Then use the local host path created by the server and transfer it to the player. It will automatically extract the key and the .ts file according to the content written in the .m3u8 file.

0
source

All Articles