PreCacheHelper.Listener


interface PreCacheHelper.Listener


A listener for PreCacheHelper events.

The methods are called from the thread where the PreCacheHelper instance is created.

Summary

Public functions

Unit
onDownloadError(mediaItem: MediaItem!, error: IOException!)

Called from PreCacheHelper when error occurs during the download.

Unit
onPreCacheProgress(
    mediaItem: MediaItem!,
    contentLength: Long,
    bytesDownloaded: Long,
    percentageDownloaded: Float
)

Called from PreCacheHelper when progress is made during a download operation.

Unit
onPrepareError(mediaItem: MediaItem!, error: IOException!)

Called from PreCacheHelper when error occurs during the preparation.

Unit
onPrepared(originalMediaItem: MediaItem!, updatedMediaItem: MediaItem!)

Called from PreCacheHelper when the MediaItem is prepared.

Public functions

onDownloadError

fun onDownloadError(mediaItem: MediaItem!, error: IOException!): Unit

Called from PreCacheHelper when error occurs during the download.

Parameters
mediaItem: MediaItem!

The MediaItem passed to create the PreCacheHelper.

error: IOException!

The error.

onPreCacheProgress

fun onPreCacheProgress(
    mediaItem: MediaItem!,
    contentLength: Long,
    bytesDownloaded: Long,
    percentageDownloaded: Float
): Unit

Called from PreCacheHelper when progress is made during a download operation.

Parameters
mediaItem: MediaItem!

The MediaItem passed to create the PreCacheHelper.

contentLength: Long

The length of the content to be cached in bytes, or LENGTH_UNSET if unknown.

bytesDownloaded: Long

The number of bytes that have been downloaded.

percentageDownloaded: Float

The percentage of the content that has been downloaded, or PERCENTAGE_UNSET.

onPrepareError

fun onPrepareError(mediaItem: MediaItem!, error: IOException!): Unit

Called from PreCacheHelper when error occurs during the preparation.

Parameters
mediaItem: MediaItem!

The MediaItem passed to create the PreCacheHelper.

error: IOException!

The error.

onPrepared

fun onPrepared(originalMediaItem: MediaItem!, updatedMediaItem: MediaItem!): Unit

Called from PreCacheHelper when the MediaItem is prepared.

Parameters
originalMediaItem: MediaItem!

The original MediaItem passed to create the .

updatedMediaItem: MediaItem!

The updated MediaItem after preparation that should be passed to the ExoPlayer for making playback read from the cached data.