3

我正在实施 Apple Fireplay DRM 以向设备提供加密内容。我能够成功加载证书,但是当我尝试从 获取 SPC 数据时AVAssetResourceLoadingRequest,我收到此错误。

Error obtaining key request data: AVFoundationErrorDomain reason: Optional("An unknown error occurred (-42650)")

以下是检索 SPC 内容的代码

let spcData: Data!

    do {
        /* 
         To obtain the Server Playback Context (SPC), we call 
         AVAssetResourceLoadingRequest.streamingContentKeyRequestData(forApp:contentIdentifier:options:)
         using the information we obtained earlier.
         */
        spcData = try resourceLoadingRequest.streamingContentKeyRequestData(forApp: applicationCertificate, contentIdentifier: assetIDData, options: resourceLoadingRequestOptions)
    } catch let error as NSError {
        print("Error obtaining key request data: \(error.domain) reason: \(error.localizedFailureReason)")
        resourceLoadingRequest.finishLoading(with: error)
        return
    }

我已经在苹果开发者论坛上搜索了错误代码:42650,但没有运气!

4

1 回答 1

2

我也遇到了这个错误。就我而言,我使用错误的数据格式(函数中的 appIdentifier 参数resourceLoadingRequest.streamingContentKeyRequestData(forApp:contentIdentifier:options:))生成 applicationCertificate 给我的证书是 base64 编码的。所以我需要用Data(base64Encoded: yourCertificateString).

于 2017-08-30T15:30:30.897 回答