Hi,
I use AVAssetDownloadURLSession to download m3u8 playlists. I'm encountering a strange behavior. I don't know why.
I check the progress of the download with :
urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didLoad timeRange: CMTimeRange, totalTimeRangesLoaded loadedTimeRanges: [NSValue], timeRangeExpectedToLoad: CMTimeRange)
I compute the progress with the same code that Apple sample :
var percentComplete = 0.0
for value in loadedTimeRanges {
let loadedTimeRange = value.timeRangeValue
percentComplete += loadedTimeRange.duration.seconds / timeRangeExpectedToLoad.duration.seconds
}
percentComplete *= 100
but when the progress is equal 100, only for some media
urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didFinishDownloadingTo location: URL)
is not called immediatly (60-100 seconds after 100 percent) but I don't understand why.