1
votes

I'm downloading a Fairplay HLS video with AVAssetDownloadTask and persisting the decryption key. After the download completes successfully I try to create an urlasset with the local url but after loading the asset into an avplayer it doesn't play. The same video plays when online so the decryption key is retrieved and persisted correctly.

What I noticed that the AVAssetResourceLoaderDelegate is not getting called offline so basically the player is not retrieving the decryption key.

Anyone have any idea what could be wrong ?

1
Have you got any solutionVineesh TP

1 Answers

0
votes

Ensure that you set preloadsEligibleContentKeys to true before creating an AVPlayer instance for your asset.

let asset = AVURLAsset(url: fileURL)
asset.resourceLoader.preloadsEligibleContentKeys = true
asset.resourceLoader.setDelegate(<#delegate#>, queue: DispatchQueue.global())