首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未调用的AVContentKeySessionDelegate方法

未调用的AVContentKeySessionDelegate方法
EN

Stack Overflow用户
提问于 2020-06-16 06:40:10
回答 1查看 555关注 0票数 0

在我的ViewController.swift应用程序中实现ViewController.swift的委托方法,即使用Brightcove播放drm内容。

代码片段:

代码语言:javascript
复制
 class ViewController: UIViewController, AVContentKeySessionDelegate, BCOVPlaybackControllerDelegate {  
    var contentKeySession: AVContentKeySession!
      .
      . 
   func getVideo() { 
     // fetching video using an API call
        .
        .
     let asset = AVURLAsset(url: videoUrl)
     self.contentKeySession = AVContentKeySession(keySystem: .fairPlayStreaming)
     self.contentKeySession?.setDelegate(self, queue: DispatchQueue.main)
     self.contentKeySession?.addContentKeyRecipient(asset)
   }

  //MARK: - AVContentKeySessionDelegate Methods
  func contentKeySession(_ session: AVContentKeySession, didProvide keyRequest: AVContentKeyRequest) {
    handleKeyRequest(keyRequest: keyRequest)
  }

  func contentKeySession(_ session: AVContentKeySession, contentKeyRequest keyRequest: AVContentKeyRequest, didFailWithError err: Error) {
    print(err)
  }

  func contentKeySession(_ session: AVContentKeySession, contentKeyRequestDidSucceed keyRequest: AVContentKeyRequest) {
    print(keyRequest)
  }
 }

问题

  1. 没有调用这些委托方法。
  2. 还注意到Xcode控制台中出现了一个错误: NSURLConnection使用错误代码-1002 (Info.plist中的中允许任意加载设置为true )

EN

回答 1

Stack Overflow用户

发布于 2021-10-12 11:48:16

我相信self.contentKeySession.processContentKeyRequest的目的是缓存内容密钥。理论上,只要内容受到保护,就应该调用内容会话密钥委托。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62402392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档