Swift AVAssetDownloadURLSession无法启动

问题描述

let background = URLSessionConfiguration.background(withIdentifier: "AAPL-Identifier")

var assetDownloadURLSession = AVAssetDownloadURLSession(configuration: background,assetDownloadDelegate: self,delegateQueue: OperationQueue.main)

let urlAsset = AVURLAsset(url: URL(string: "https://bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s-fmp4/f08e80da-bf1d-4e3d-8899-f0f6155f6efa_video_180_250000.m3u8")!)
guard let task = assetDownloadURLSession.aggregateAssetDownloadTask(with: urlAsset,mediaSelections: [urlAsset.preferredMediaSelection],assetTitle: "Testing",assetArtworkData: nil,options:[AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: 265_000]) else { return }

task.resume()

func urlSession(_ session: URLSession,aggregateAssetDownloadTask: AVAggregateAssetDownloadTask,didLoad timeRange: CMTimeRange,totalTimeRangesLoaded loadedTimeRanges: [NSValue],timeRangeExpectedToLoad: CMTimeRange,for mediaSelection: AVMediaSelection) {
    print("start download")
}

我正在使用官方sample code,它工作正常。

但是当我尝试创建新示例时,AVAssetDownloadDelegate永远不会触发...

请帮助,谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...