在 AVAssetResourceLoaderDelegate 中处理错误的推荐方法是什么?shouldWaitForLoadingOfRequestedResource
特别是/中的网络请求shouldWaitForRenewalOfRequestedResource
?
但是,在我开始播放视频之前,我的应用程序无法知道出了什么问题。我在委托呼叫中尝试过loadingRequest.finishLoading(with: err)
,但在下载完成并且用户开始播放视频之前没有报告任何内容。return false
shouldWaitForLoadingOfRequestedResource
代码是这样的..
let urlAsset = AVURLAsset(url: url)
asset?.resourceLoader.preloadsEligibleContentKeys = true
asset?.resourceLoader.setDelegate(self.fairPlayAssetLoaderDelegate, queue: DispatchQueue.global(qos: .default)) // fairPlayAssetLoaderDelegate is an object that implements AVAssetResourceLoaderDelegate
// send urlAsset to AVAssetDownloadURLSession.makeAssetDownloadTask
设置后preloadsEligibleContentKeys = true
,似乎shouldWaitForLoadingOfRequestedResource
在 AVURLAsset 中设置资源加载器委托后立即调用。但是没有办法告诉资源加载器已经成功地获得了它想要的所有信息。
我尝试loadValuesAsynchronously
在 AVURLAsset 上使用,但这也是不行的。
AVAssetDownloadURLSession 也不总是报告错误。
提前致谢。