【问题标题】:FairPlay offline playback does not work on iOS 10FairPlay 离线播放在 iOS 10 上不起作用
【发布时间】:2020-12-08 07:19:04
【问题描述】:

我们正在使用 EZDRM 进行 DRM 保护。

在线播放在 iOS 10-13 上运行良好,而离线播放在 iOS 11-13 上运行,但在 iOS 10 上不行;持久内容密钥是在 iOS 10 中引入的,因此它应该可以工作。

我已经使用 EZDRM 的示例项目进行了测试,它使用了AVAssetResourceLoaderDelegate。下载视频和内容密钥后,当我们尝试播放下载的视频时,出现以下错误。

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}

记录加载请求对象(来自 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>>

我发现:

  • disk caching permitted = NO 在 iOS 10 上
  • disk caching permitted = YES 在 iOS 11-13 上

不知道是不是失败的原因,也不知道是哪个部分控制了这个属性的值。

我也使用了苹果的 HLSCatalogWithFPS 进行测试,它使用了AVContentKeySession。本来它的部署目标是iOS 11.3,我稍微修改了一下让它也可以在iOS 10.3上运行,例如:

  • keyRequest.respondByRequestingPersistableContentKeyRequestAndReturnError() -> keyRequest.respondByRequestingPersistableContentKeyRequest()
  • AVAggregateAssetDownloadTask -> AVAssetDownloadTask

但是,在调用respondByRequestingPersistableContentKeyRequest()之后,contentKeySession:didProvidePersistableContentKeyRequest:并没有被调用,而是contentKeySession:didProvideContentKeyRequest:被调用了,它在这里创建了一个无限循环。

根据文档https://developer.apple.com/documentation/avfoundation/avcontentkeyrequest/2799207-respondbyrequestingpersistableco

如果您的委托未响应 contentKeySession:didProvidePersistableContentKeyRequest:,则返回 NSInternalInconsistencyException。

所以我试图注释掉那个委托方法,但一点也不例外;如果它在 iOS 11 上运行,则会出现异常。

似乎整个 FairPlay 离线播放功能在 iOS 10 上不起作用。有人可以帮忙吗?

【问题讨论】:

    标签: ios avfoundation drm fairplay


    【解决方案1】:

    在 EZDRM 的 iOS Offline Example 中,他们使用 iOS11 作为基础版本。这不是巧合,它只支持iOS11及以上

    持久性内容密钥是在 iOS 10 中引入的,所以它应该可以工作

    这不仅仅是关于持久内容密钥的全部内容,他们在此之后添加了更多内容,例如,他们在 iOS 10.3 版中添加了 AVContentKeySession 等。我不确定 EZDRM 是否支持,但这是 SDK 中的重要进展。

    公司只能支持稳定版本。我不确定他们的具体原因,但我能理解。我从未使用过 EZDRM 的 SDK。

    另外,请查看文档:https://www.ezdrm.com/Documentation/EZDRM_Testing_Playback_v2.pdf

    最好的。

    【讨论】:

    • 感谢您的回复。我了解有时支持某些功能不太稳定的旧操作系统很麻烦。我的问题与 EZDRM 无关,我还使用了我的问题中提到的 Apple 的 HLSCatalogWithFPS 示例。我试过 AVContentKeySession,它是在 iOS 10.3 中引入的,但是 respondByRequestingPersistableContentKeyRequest() 在 iOS 10.3 设备上没有按预期工作,这是主要问题。
    猜你喜欢
    • 1970-01-01
    • 2017-08-17
    • 1970-01-01
    • 2017-03-18
    • 2018-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多