IPhone MPMoviePlayerController: download files during streaming, play them locally

I have a m3u8 file with all TS files. MPMoviePlayerController performs them perfectly through an HTTP request on a streaming server. But I would like to get the files locally in order to play them again without any connections.

I managed to download the m3u8 file and all TS files locally on my device, I edited the m3u8 files to point to the local .ts instead of http, but I can not read them from this installation. (VLC can do it well)

Is there a way to load segments during the game (to avoid 2 downloads) and then play them locally using MPMoviePlayerController or else.

+4
source share
1 answer

.m3u8 is Apple HTTP Live Streaming, right? I think what you are trying to do is simply against the design of this technology. You must set the original file and allow it to be downloaded.

From what I understand, it’s in the streaming design that you don’t get explicit access to the parts to put them together. For example, Netflix uses streaming through Silverlight, and one of the advantages (for Netflix) is that it protects data from being saved as if it were downloaded. In addition, since HTTP Live Streaming allows the stream to switch bitrates on the fly, it is designed so that each piece of time can be encoded with any number of bitrates, and not one of them is canonical.

Theoretically, there may be a way to collect all the fragments for a specific bitrate and transcode them into one video. But Apple’s replay APIs won’t give you that opportunity.

Instead of HTTP Live Streaming, consider progressive downloads. Just submit the original video file (transcode it into what the iPhone likes, if necessary). If your server is set up properly, the playback APIs will execute small requests to retrieve individual fragments of the file, rather than all of this at a time, and this is close to properly streaming. I would like to find where I read about it so that I can give the correct name for this. Amazon S3 is tuned for this if you need a quick fix.

But be careful, they say at Apple

If your application transmits video over cellular networks and the video is longer than 10 minutes or 5 MB of data in five minutes, you need to use HTTP Live Streaming. (Progressive download can be used for small clips.)

+3
source

Source: https://habr.com/ru/post/1345092/


All Articles