Реализованы методы делегата AVContentKeySessionDelegate в моем ViewController.swift в моем iOS приложении, которое должно воспроизводить контент DRM с помощью Brightcove SDK.
Фрагмент кода:
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)
}
}
Проблема
- Ни один из этих методов делегата не вызывается.
- Кроме того, в консоли Xcode была замечена ошибка: NSURLConnection завершился с ошибкой - код -1002 ( Разрешить произвольную загрузку имеет значение true в настройках транспорта приложений в Info.plist )