Contents

urlSession(_:assetDownloadTask:didLoad:totalTimeRangesLoaded:timeRangeExpectedToLoad:)

Tells the delegate that a download task loaded a new time range.

Declaration

optional func urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didLoad timeRange: CMTimeRange, totalTimeRangesLoaded loadedTimeRanges: [NSValue], timeRangeExpectedToLoad: CMTimeRange)

Parameters

  • session:

    The session the asset download task is on.

  • assetDownloadTask:

    The download task that loaded a new time range.

  • timeRange:

    A Cmtimerange value that indicates the time range the task loaded since the last call to this method.

  • loadedTimeRanges:

    An array of Cmtimerange values that indicate the time ranges the task has downloaded so far.

  • timeRangeExpectedToLoad:

    A Cmtimerange value that indicates the expected duration of the downloaded asset.

Discussion

Implement this method to track the download status of an asset. The following example shows how to calculate the percentage complete for the current download.

See Also

Responding to download events