Post

Replies

Boosts

Views

Activity

Playing clear-key DRM protected video with AVFoundation
I’m wondering if there is any way to play a clear-key DRM-protected video stream. I have {"clear-key-id": "clear-key"} pair, but I don’t know how to do it in code. It is not FairPlay Streaming nor Widevine. I override resourceLoader(_:shouldWaitForLoadingOfRequestedResource:) and done something similar to this: let key = "{\"key\": \"452948404d635166546a576e5a723475\",\"keyId\": \"2f423f4528482b4d6251655468576d5a\"}" let keyData = Data(key.utf8) loadingRequest.contentInformationRequest?.contentType = AVStreamingKeyDeliveryPersistentContentKeyType loadingRequest.contentInformationRequest?.isByteRangeAccessSupported = true loadingRequest.contentInformationRequest?.contentLength = Int64(keyData.count) loadingRequest.dataRequest?.respond(with: keyData) loadingRequest.finishLoading() I do not think this is the correct way to do it, as I arbitrarily loaded the key as a raw string and compressed it to Data type. I think there should be some API or func to call for that clear-key-based DRM.
0
0
1.3k
Feb ’23