Offline FairPlay playback makes network requests to load m3u8 playlists

231 views Asked by At

We're building offline Fairplay playback feature in our app using AVAssetDownloadTask API set. We can successfully download the the content, but we noticed network activities, which are requests to the m3u8 playlists presented in the boot.xml in the movpkg package, when playing the downloaded content.

The problem is to load those m3u8 playlists requires cookies and the cookies are set to expire in 1 day, which leads to playback failure when the cookies expired. My question is why playing downloaded content needs to load those playlists? Isn't it supposed to play downloaded content without network?

Thanks.

1

There are 1 answers

0
M. LeRouge On

Make sure that you only have one instance of AVURLAsset pointing to your downloaded asset. When there are multiple AVURLAssets pointing to the same .movpkg, sometimes AVPlayerItem falls back to network playback.

Note that Apple said they improved this in iOS 14.2: https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-14_2-release-notes:

  • Support for multiple concurrent AVURLAsset instances on offline HLS filesystem URLs has been improved.
  • You can now use multiple concurrent AVPlayerItem objects and other AVFoundation objects on offline HLS assets with completed AVMediaSelection objects without triggering network reads.