IOS 10 downloads encrypted HLS stream

I am currently trying to implement downloading an encrypted HLS stream to an iOS device. iOS 10 seems to support this out of the box (see https://developer.apple.com/videos/play/wwdc2016/504 ), but I can't get it to work. I mainly use AssetPersistenceManagerthe Apple code example ( https://developer.apple.com/library/content/samplecode/HLSCatalog/Introduction/Intro.html ), which calls makeAssetDownloadTaskof AVAssetDownloadURLSession. It works great online, but playback fails when playing an asset from a saved file.

Now the WWDC video indicates what you should use AVAssetResourceLoaderDelegateto provide an offline encryption key. Since http and https do not seem to be supported AVAssetResourceLoader(see, for example, AVAssetResourceLoaderDelegate methods not working on the device ), I tried to use a special scheme for the URI key and provide the aes local key shouldWaitForLoadingOfRequestedResource AVAssetResourceLoaderDelegate. Here it also works when streaming over the Internet, but regardless of whether I use the URL of the remote key or redefine it with the local key, AVPlayer always does not work offline in AVAsset.

Does anyone have experience downloading encrypted HLS or have a working example on how to provide an encryption key to play the local encrypted AVURLAsset offline?

The sample HSL file I'm using is here: http://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-aes.ism/.m3u8

+6
source share

All Articles