PreloadMediaSource.PreloadControl


public interface PreloadMediaSource.PreloadControl


Controls preloading of PreloadMediaSource.

The methods are called on the Looper that is passed when constructing the .

Summary

Public methods

abstract boolean
onContinueLoadingRequested(
    PreloadMediaSource mediaSource,
    long bufferedDurationUs
)

Called from PreloadMediaSource when it requests to continue loading.

default void

Called from PreloadMediaSource when it has loaded to the end of source.

abstract void

Called from PreloadMediaSource when an error occurs.

abstract boolean

Called from PreloadMediaSource when it has completed preparation.

abstract boolean

Called from PreloadMediaSource when it has tracks selected.

abstract void

Called from PreloadMediaSource when the player starts using this source.

Public methods

onContinueLoadingRequested

abstract boolean onContinueLoadingRequested(
    PreloadMediaSource mediaSource,
    long bufferedDurationUs
)

Called from PreloadMediaSource when it requests to continue loading.

If fully loaded, then onLoadedToTheEndOfSource will be called instead.

Parameters
PreloadMediaSource mediaSource

The PreloadMediaSource that requests to continue loading.

long bufferedDurationUs

An estimate of the duration from the start position for which data is buffered, in microseconds.

onLoadedToTheEndOfSource

default void onLoadedToTheEndOfSource(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has loaded to the end of source.

The default implementation is a no-op.

Parameters
PreloadMediaSource mediaSource

The PreloadMediaSource that has loaded to the end of source.

onPreloadError

abstract void onPreloadError(PreloadException error, PreloadMediaSource mediaSource)

Called from PreloadMediaSource when an error occurs.

Parameters
PreloadException error

The error.

PreloadMediaSource mediaSource

The PreloadMediaSource that has the error occur.

onSourcePrepared

abstract boolean onSourcePrepared(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has completed preparation.

Parameters
PreloadMediaSource mediaSource

The PreloadMediaSource that has completed preparation.

Returns
boolean

True if the mediaSource should continue preloading, false otherwise.

onTracksSelected

abstract boolean onTracksSelected(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has tracks selected.

Parameters
PreloadMediaSource mediaSource

The PreloadMediaSource that has tracks selected.

Returns
boolean

True if the mediaSource should continue preloading, false otherwise.

onUsedByPlayer

abstract void onUsedByPlayer(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when the player starts using this source.

Parameters
PreloadMediaSource mediaSource

The PreloadMediaSource that the player starts using.