Issue:
I am supporting a streaming iOS application that uses Fairplay DRM to playback protected content.
On iOS 16 devices, I am seeing intermittent exceptions thrown when trying to process the CKC returned by the license server.
The thrown exception is as follows:
-[AVContentKeyRequest processContentKeyResponse:] AVContentKeySession's keySystem is not same as that of keyResponse"
This issue does not occur on older devices (we support iOS 13, 14, 15).
I am unable to find much documentation about this error so any insight is appreciated:
Code Overview
- Use ContentKeyRequest to request an application certificate
- Use returned Cert to call
makeStreamingContentKeyRequestData - Use returned data to request FairPlay license
- Use returned CKC to generate AVContentKeyResponse (i.e.
AVContentKeyResponse(fairPlayStreamingKeyResponseData) - Call
processContentKeyResponse(_) - App crash/exception thrown when callling
processContentKeyResponse
I am seeing other issues related to DRM and iOS 16 but none seem to match my particular problem. i.e. I am not dealing with downloaded content and offline DRM
-
Did you figure out what was causing this?Hackerman– Hackerman2023年02月01日 23:49:32 +00:00Commented Feb 1, 2023 at 23:49
-
@hackerman - not yet.rmigneco– rmigneco2023年02月06日 14:32:45 +00:00Commented Feb 6, 2023 at 14:32
-
I think this happens when the response is being called as ContentKeySession is being shutdown. Just a theory.Hackerman– Hackerman2023年03月07日 11:57:53 +00:00Commented Mar 7, 2023 at 11:57
-
@Hackerman I've noticed it when tuning into an asset for the first time or sometimes when retuning it. Its often very intermittentrmigneco– rmigneco2023年03月14日 16:56:01 +00:00Commented Mar 14, 2023 at 16:56
1 Answer 1
For me, this error is thrown when the content is dismissed before FairPlay has a chance to process the content key:
let keyResponse = AVContentKeyResponse(fairPlayStreamingKeyResponseData: ckcData)
// Error happens at this point if request is active
keyRequest.processContentKeyResponse(keyResponse)
Since I'm using Alamofire to make the certificate, SPC, and CKC calls, stopping all the requests immediately upon dismissing the content prevented the key processing:
Alamofire.Session.default.getAllTasks { tasks in
tasks.forEach{ 0ドル.cancel() }
}
Of course this may not be an ideal approach, but let me know if anyone finds a better way.
Explore related questions
See similar questions with these tags.