Post not yet marked as solved
Post marked as unsolved with 1 replies, 722 views
We are using EZDRM for DRM protection.
Online playback works fine on iOS 10-13, whereas offline playback works on iOS 11-13, but not iOS 10; persistent content key was introduced in iOS 10, so it should work.
I have used EZDRM's sample project to test, which uses AVAssetResourceLoaderDelegate. After downloading the video and content key, when we tried to play the downloaded video, the following errors occurred.
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x17005d1c0 {Error Domain=NSOSStatusErrorDomain Code=-42651 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-42651), NSLocalizedDescription=The operation could not be completed}
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x17005be40 {Error Domain=NSOSStatusErrorDomain Code=-12882 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-12882), NSLocalizedDescription=The operation could not be completed}
Logging the loading request object (from iOS 10):
<AVAssetResourceLoadingRequest: 0x174201f10, URL request = <NSMutableURLRequest: 0x1702009a0> { URL: skd://fps.ezdrm.com/;xxxxxx }, request ID = 2, content information request = <AVAssetResourceLoadingContentInformationRequest: 0x174202060, content type = "(null)", content length = 0, byte range access supported = NO, disk caching permitted = NO, renewal date = (null)>, data request = <AVAssetResourceLoadingDataRequest: 0x174201de0, requested offset = 0, requested length = 9223372036854775807, requests all data to end of resource = YES, current offset = 0>>
I found that: disk caching permitted = NO on iOS 10
disk caching permitted = YES on iOS 11-13
Not sure if it is the reason of failure, and don't know which part controls the value of this property.
I have also used Apple's HLSCatalogWithFPS to test, which uses AVContentKeySession. Originally, its deployment target is iOS 11.3, I've modified a bit so that it can also run on iOS 10.3, e.g.: keyRequest.respondByRequestingPersistableContentKeyRequestAndReturnError() -> keyRequest.respondByRequestingPersistableContentKeyRequest()
AVAggregateAssetDownloadTask -> AVAssetDownloadTask
However, after calling respondByRequestingPersistableContentKeyRequest(), contentKeySession:didProvidePersistableContentKeyRequest: did not get called, instead contentKeySession:didProvideContentKeyRequest: was called, and it created an infinite loop here.
According to the document https://developer.apple.com/documentation/avfoundation/avcontentkeyrequest/2799207-respondbyrequestingpersistableco :
An NSInternalInconsistencyException is returned if your delegate does not respond to contentKeySession:didProvidePersistableContentKeyRequest:. So I tried to comment out that delegate method, but there was no exception at all; there was exception if it was running on iOS 11.
It seems the whole FairPlay offline playback thing does not work on iOS 10. Can anyone help?