docs/doc/reference/com/google/android/exoplayer2/LoadControl.html
Package com.google.android.exoplayer2
DefaultLoadControl[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceLoadControl
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Controls buffering of media.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static MediaPeriodId | EMPTY_MEDIA_PERIOD_ID |
Deprecated.
Used as a placeholder when MediaPeriodId is unknown.
|
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| Allocator | getAllocator() |
Deprecated.
Returns the Allocator that should be used to obtain media buffer allocations.
|
| long | getBackBufferDurationUs() |
Deprecated.
Returns the duration of media to retain in the buffer prior to the current playback position, for fast backward seeking.
|
| void | onPrepared() |
Deprecated.
Called by the player when prepared with a new source.
|
| void | onReleased() |
Deprecated.
Called by the player when released.
|
| void | onStopped() |
Deprecated.
Called by the player when stopped.
|
| default void | onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, ExoTrackSelection[] trackSelections) |
Deprecated.
Implement onTracksSelected(Timeline, MediaPeriodId, Renderer[], TrackGroupArray, ExoTrackSelection[]) instead.
|
| default void | onTracksSelected(Timeline timeline, MediaPeriodId mediaPeriodId, Renderer[] renderers, TrackGroupArray trackGroups, ExoTrackSelection[] trackSelections) |
Deprecated.
Called by the player when a track selection occurs.
|
| boolean | retainBackBufferFromKeyframe() |
Deprecated.
Returns whether media should be retained from the keyframe before the current playback position minus getBackBufferDurationUs(), rather than any sample before or at that position.
|
| boolean | shouldContinueLoading(long playbackPositionUs, long bufferedDurationUs, float playbackSpeed) |
Deprecated.
Called by the player to determine whether it should continue to load the source.
|
| default boolean | shouldStartPlayback(long bufferedDurationUs, float playbackSpeed, boolean rebuffering, long targetLiveOffsetUs) |
Deprecated.
Implement shouldStartPlayback(Timeline, MediaPeriodId, long, float, boolean, long) instead.
|
| default boolean | shouldStartPlayback(Timeline timeline, MediaPeriodId mediaPeriodId, long bufferedDurationUs, float playbackSpeed, boolean rebuffering, long targetLiveOffsetUs) |
Deprecated.
Called repeatedly by the player when it's loading the source, has yet to start playback, and has the minimum amount of data necessary for playback to be started. |
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")static final[MediaPeriodId](source/MediaPeriodId.html "class in com.google.android.exoplayer2.source")EMPTY_MEDIA_PERIOD_ID
Deprecated.
Used as a placeholder when MediaPeriodId is unknown. Only used when the deprecated methods onTracksSelected(Renderer[], TrackGroupArray, ExoTrackSelection[]) or shouldStartPlayback(long, float, boolean, long) are called.
-
void onPrepared()
Deprecated.
Called by the player when prepared with a new source.
-
default void onTracksSelected([Timeline](Timeline.html "class in com.google.android.exoplayer2")timeline,[MediaPeriodId](source/MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId,[Renderer](Renderer.html "interface in com.google.android.exoplayer2")[] renderers,[TrackGroupArray](source/TrackGroupArray.html "class in com.google.android.exoplayer2.source")trackGroups,[ExoTrackSelection](trackselection/ExoTrackSelection.html "interface in com.google.android.exoplayer2.trackselection")[] trackSelections)
Deprecated.
Called by the player when a track selection occurs.
Parameters:timeline - The current Timeline in ExoPlayer. Can be Timeline.EMPTY only when the deprecated onTracksSelected(Renderer[], TrackGroupArray, ExoTrackSelection[]) was called.mediaPeriodId - Identifies (in the current timeline) the MediaPeriod for which the selection was made. Will be EMPTY_MEDIA_PERIOD_ID when timeline is empty.renderers - The renderers.trackGroups - The TrackGroups from which the selection was made.trackSelections - The track selections that were made.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")default void onTracksSelected([Renderer](Renderer.html "interface in com.google.android.exoplayer2")[] renderers,[TrackGroupArray](source/TrackGroupArray.html "class in com.google.android.exoplayer2.source")trackGroups,[ExoTrackSelection](trackselection/ExoTrackSelection.html "interface in com.google.android.exoplayer2.trackselection")[] trackSelections)
Deprecated.
Implement onTracksSelected(Timeline, MediaPeriodId, Renderer[], TrackGroupArray, ExoTrackSelection[]) instead.
-
void onStopped()
Deprecated.
Called by the player when stopped.
-
void onReleased()
Deprecated.
Called by the player when released.
-
[Allocator](upstream/Allocator.html "interface in com.google.android.exoplayer2.upstream")getAllocator()
Deprecated.
Returns the Allocator that should be used to obtain media buffer allocations.
-
long getBackBufferDurationUs()
Deprecated.
Returns the duration of media to retain in the buffer prior to the current playback position, for fast backward seeking.
Note: If retainBackBufferFromKeyframe() is false then seeking in the back-buffer will only be fast if the back-buffer contains a keyframe prior to the seek position.
Note: Implementations should return a single value. Dynamic changes to the back-buffer are not currently supported.
Returns:The duration of media to retain in the buffer prior to the current playback position, in microseconds.
-
boolean retainBackBufferFromKeyframe()
Deprecated.
Returns whether media should be retained from the keyframe before the current playback position minus getBackBufferDurationUs(), rather than any sample before or at that position.
Warning: Returning true will cause the back-buffer size to depend on the spacing of keyframes in the media being played. Returning true is not recommended unless you control the media and are comfortable with the back-buffer size exceeding getBackBufferDurationUs() by as much as the maximum duration between adjacent keyframes in the media.
Note: Implementations should return a single value. Dynamic changes to the back-buffer are not currently supported.
Returns:Whether media should be retained from the keyframe before the current playback position minus getBackBufferDurationUs(), rather than any sample before or at that position.
-
boolean shouldContinueLoading(long playbackPositionUs,
long bufferedDurationUs,
float playbackSpeed)
Deprecated.
Called by the player to determine whether it should continue to load the source. If this method returns true, the MediaPeriod identified in the most recent onTracksSelected(com.google.android.exoplayer2.Timeline, com.google.android.exoplayer2.source.MediaPeriodId, com.google.android.exoplayer2.Renderer[], com.google.android.exoplayer2.source.TrackGroupArray, com.google.android.exoplayer2.trackselection.ExoTrackSelection[]) call will continue being loaded.
Parameters:playbackPositionUs - The current playback position in microseconds, relative to the start of the period that will continue to be loaded if this method returns true. If playback of this period has not yet started, the value will be negative and equal in magnitude to the duration of any media in previous periods still to be played.bufferedDurationUs - The duration of media that's currently buffered.playbackSpeed - The current factor by which playback is sped up.Returns:Whether the loading should continue.
-
default boolean shouldStartPlayback([Timeline](Timeline.html "class in com.google.android.exoplayer2")timeline,[MediaPeriodId](source/MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId,
long bufferedDurationUs,
float playbackSpeed,
boolean rebuffering,
long targetLiveOffsetUs)
Deprecated.
Called repeatedly by the player when it's loading the source, has yet to start playback, and has the minimum amount of data necessary for playback to be started. The value returned determines whether playback is actually started. The load control may opt to return false until some condition has been met (e.g. a certain amount of media is buffered).
Parameters:timeline - The current Timeline in ExoPlayer. Can be Timeline.EMPTY only when the deprecated shouldStartPlayback(long, float, boolean, long) was called.mediaPeriodId - Identifies (in the current timeline) the MediaPeriod for which playback will start. Will be EMPTY_MEDIA_PERIOD_ID when timeline is empty.bufferedDurationUs - The duration of media that's currently buffered.playbackSpeed - The current factor by which playback is sped up.rebuffering - Whether the player is rebuffering. A rebuffer is defined to be caused by buffer depletion rather than a user action. Hence this parameter is false during initial buffering and when buffering as a result of a seek operation.targetLiveOffsetUs - The desired playback position offset to the live edge in microseconds, or C.TIME_UNSET if the media is not a live stream or no offset is configured.Returns:Whether playback should be allowed to start or resume.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")default boolean shouldStartPlayback(long bufferedDurationUs,
float playbackSpeed,
boolean rebuffering,
long targetLiveOffsetUs)
Deprecated.
Implement shouldStartPlayback(Timeline, MediaPeriodId, long, float, boolean, long) instead.