iosavplayerhttp-live-streamingm3u8avassetdownloadtask

Downloading and playing offline HLS Content - iOS 10


Since iOS 10, Apple has provided the support for downloading HLS (m3u8) video for offline viewing.

My question is: Is it necessary that we can only download HLS when it is being played ? Or we can just download when user press download button and show progress.

Does anyone has implemented this in Objective C version? Actually my previous App is made in Objective C. Now I want to add support for downloading HLS rather than MP4 (previously I was downloading MP4 for offline view).

I am really desperate to this. Please share thoughts or any code if implemented.


Solution

  • The only way you can do this is to set up an HTTP server to serve the files locally after you've downloaded them.

    The Live playlist uses a sliding-window. You need to periodically reload it after target-duration time and download only the new segments as they appear in the list (they will be removed at a later time).

    Here are some related answers: Can IOS devices stream m3u8 segmented video from the local file system using html5 video and phonegap/cordova?