public interface

PreloadMediaSource.PreloadControl

 androidx.media3.exoplayer.source.preload.PreloadMediaSource.PreloadControl

Overview

Controls preloading of PreloadMediaSource.

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

Summary

Methods
public booleanonContinueLoadingRequested(PreloadMediaSource mediaSource, long bufferedPositionUs)

Called from PreloadMediaSource when it requests to continue loading.

public voidonLoadedToTheEndOfSource(PreloadMediaSource mediaSource)

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

public voidonPreloadError(PreloadException error, PreloadMediaSource mediaSource)

Called from PreloadMediaSource when an error occurs.

public booleanonSourcePrepared(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has completed preparation.

public booleanonTracksSelected(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has tracks selected.

public voidonUsedByPlayer(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when the player starts using this source.

Methods

public boolean onSourcePrepared(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has completed preparation.

Parameters:

mediaSource: The PreloadMediaSource that has completed preparation.

Returns:

True if the mediaSource should continue preloading, false otherwise.

public boolean onTracksSelected(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when it has tracks selected.

Parameters:

mediaSource: The PreloadMediaSource that has tracks selected.

Returns:

True if the mediaSource should continue preloading, false otherwise.

public boolean onContinueLoadingRequested(PreloadMediaSource mediaSource, long bufferedPositionUs)

Called from PreloadMediaSource when it requests to continue loading.

If fully loaded, then PreloadMediaSource.PreloadControl.onLoadedToTheEndOfSource(PreloadMediaSource) will be called instead.

Parameters:

mediaSource: The PreloadMediaSource that requests to continue loading.
bufferedPositionUs: An estimate of the absolute position in microseconds up to which data is buffered.

public void onUsedByPlayer(PreloadMediaSource mediaSource)

Called from PreloadMediaSource when the player starts using this source.

Parameters:

mediaSource: The PreloadMediaSource that the player starts using.

public void onLoadedToTheEndOfSource(PreloadMediaSource mediaSource)

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

The default implementation is a no-op.

Parameters:

mediaSource: The PreloadMediaSource that has loaded to the end of source.

public void onPreloadError(PreloadException error, PreloadMediaSource mediaSource)

Called from PreloadMediaSource when an error occurs.

Parameters:

error: The error.
mediaSource: The PreloadMediaSource that has the error occur.