Using AVContentKeySession with "clear key" encryption

I am attempting to use the new AVContentKeySession class to save some HLS content for offline viewing. Some of the videos are encrypted with AES-128, while others are encrypted using SAMPLE-AES (NOTE: This is not using FairPlay at all).


I have an AVConttentKeySession object created using the clear key system. I can call processContentKeyRequest() on that, and the didProvideKeyRequest delegate method gets called correctly. In there I query the server for the key, create a AVContentKeyResponse object, and then call processContentKeyResponse on the associated keyRequest object. I have also added the AVURLAsset to the contentKeyRecipient array.


I don't get any errors, and it appears things are working correctly. However, when attempting to playback the asset offline or online, the didProvideKeyRequest never gets called again, so I can't provide the key myself while the app is offline, and thus the video does not playback.


This workflow is described in the WWDC video from this year while using FairPlay streaming. Give that the AVContentKeySession can be created for FairPlay or a clear key I was assuming/hoping that this would work. Has anyone had any luck getting encrypted (but not FairPlay) HLS content to playback while offline. Or can anyone confirm that this is not yet supported and I'm trying to do something that isn't yet possible?

Replies

Hi,


Do you have any feedback on that question - AVConttentKeySession and AES -128 ?

Thanks !

If you have called processContentKeyRequest then you won't get the callback/delege when you play the stream with the same identifier as you have already pre-delivery the key to AVContentKeySession.

I'm not sure if the solution works as you don't provide the ckc to AVContentKeySession. It's better to use the AVAssetResourceLoader to do the non FairPlay stream.