2017-07-31 81 views
3

我正在实施Apple Fireplay DRM以将加密内容传递到设备。 我能够成功加载证书,但是当我尝试从AVAssetResourceLoadingRequest获得SPC数据时,出现此错误。获取密钥请求数据时出错:AVFoundationErrorDomain原因:可选(“发生未知错误(-42650)”)

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苹果开发者论坛,但没有运气!

+0

你尝试过多种设备吗? – aergistal

回答

1

我也有这个错误。在我的情况下,我使用错误的数据格式(resourceLoadingRequest.streamingContentKeyRequestData(forApp:contentIdentifier:options:)函数中的appIdentifier参数)生成applicationCertificate。提供给我的证书是base64编码的。所以我需要用Data(base64Encoded: yourCertificateString)创建数据。

相关问题