2017-07-31 86 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)創建數據。

相關問題