无法下载HLS内容

时间:2019-03-08 11:40:28

标签: ios swift download hls

我跟随苹果公司的Media Playback Programming Guide下载了HLS内容。以下实现通常可以正常工作,但是偶尔也没有明显的原因,只需停止工作即可。委托方法不会报告任何内容,下载进度也不会报告错误。下载只是拒绝开始。发生这种情况时,为了再次开始下载,唯一的方法是重新启动设备。有没有人遇到同样的问题?有人可以指出我的解决方法吗?

void OnTriggerEnter2D(Collider2D col)
{
    if(col.tag == "PlayerBullet")
    {
        this.score += 100;
    }
}

创建并配置下载会话:

func setupAssetDownload() {

    // Create new background session configuration.
    let configuration = URLSessionConfiguration.background(withIdentifier: "Player")
    configuration.isDiscretionary = true
    configuration.timeoutIntervalForResource = 300


    // Create a new AVAssetDownloadURLSession with background configuration, delegate, and queue
    downloadSession = AVAssetDownloadURLSession(configuration: configuration,
                                                assetDownloadDelegate: self,
                                                delegateQueue: OperationQueue.main)
}

0 个答案:

没有答案