Manual FairPlay License Renewal: AVContentKeySessionDelegate not triggering via addContentKeyRecipient

Hi everyone,

I am working on an app that supports offline playback with FairPlay Streaming (FPS). I have successfully implemented the logic to download and persist the content keys (TLLV), and offline playback is working correctly using the stored persistent keys.

However, I am now trying to implement a manual renewal process for these licenses, and I’ve run into an issue where the delegate methods are not being fired as expected.

The Issue: I am calling contentKeySession.addContentKeyRecipient(asset) to force a renewal or re-fetch of the content key for a specific asset. Even though the asset is correctly initialized and the session is active, the AVContentKeySessionDelegate methods (specifically contentKeySession(_:didProvide:)) are not being triggered at all.

My Questions:

Why is the delegate not firing when adding the recipient? Is there a specific state or property the AVURLAsset needs to have (or a specific way it should be initialized) to trigger a new key request via addContentKeyRecipient?

Is it possible to perform a manual license renewal triggered by a UI action (e.g., a button tap) without actually initiating playback of the asset?

The goal is to allow users to refresh their licenses manually while online, ensuring the content remains playable offline before the previous license expires, all without forcing the user to start the video.

Any insights or best practices for this manual renewal flow would be greatly appreciated.

Hello,

Let me first clarify the use of contentKeySession.addContentKeyRecipient. This method is used to map the recipient (e.g. AVURLAsset) to the session such that any keys necessary for that recipient are handled by the given session.

contentKeySession.addContentKeyRecipient does not initiate a key load.

The only way to load a key is via processContentKeyRequest(withIdentifier:initializationData:options:) or via the AVPlayer which will invoke the delegate callbacks with the AVContentKeyRequest.

Regarding renewal, please take a look at renewExpiringResponseData(for:) to initiate a key renewal. You should then expect the contentKeySession(_:didProvideRenewingContentKeyRequest:) callback to be fired which will have a new content key request for an existing content key.

You mentioned renewing keys specific to the AVURLAsset. There is a property on the AVContentKeyRequest called originatingRecipient which maps the request to the recipient (AVURLAsset here). You can use this property to renew requests specific to the asset.

Hope that helps!

Manual FairPlay License Renewal: AVContentKeySessionDelegate not triggering via addContentKeyRecipient
 
 
Q