public interface LoadControl
Modifier and Type | Method and Description |
---|---|
Allocator |
getAllocator()
Returns the
Allocator that should be used to obtain media buffer allocations. |
long |
getBackBufferDurationUs()
Returns the duration of media to retain in the buffer prior to the current playback position,
for fast backward seeking.
|
void |
onPrepared()
Called by the player when prepared with a new source.
|
void |
onReleased()
Called by the player when released.
|
void |
onStopped()
Called by the player when stopped.
|
void |
onTracksSelected(Renderer[] renderers,
TrackGroupArray trackGroups,
TrackSelectionArray trackSelections)
Called by the player when a track selection occurs.
|
boolean |
retainBackBufferFromKeyframe()
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 bufferedDurationUs,
float playbackSpeed)
Called by the player to determine whether it should continue to load the source.
|
boolean |
shouldStartPlayback(long bufferedDurationUs,
float playbackSpeed,
boolean rebuffering)
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.
|
void onPrepared()
void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelectionArray trackSelections)
renderers
- The renderers.trackGroups
- The TrackGroup
s from which the selection was made.trackSelections
- The track selections that were made.void onStopped()
void onReleased()
Allocator getAllocator()
Allocator
that should be used to obtain media buffer allocations.long getBackBufferDurationUs()
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.
boolean retainBackBufferFromKeyframe()
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.
getBackBufferDurationUs()
, rather than any sample before or at that position.boolean shouldContinueLoading(long bufferedDurationUs, float playbackSpeed)
bufferedDurationUs
- The duration of media that's currently buffered.playbackSpeed
- The current playback speed.boolean shouldStartPlayback(long bufferedDurationUs, float playbackSpeed, boolean rebuffering)
false
until some condition has been met (e.g. a certain amount of media is buffered).bufferedDurationUs
- The duration of media that's currently buffered.playbackSpeed
- The current playback speed.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.