public final class DefaultLoadControl extends java.lang.Object implements LoadControl
LoadControl implementation.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
The default duration of media that must be buffered for playback to resume after a rebuffer,
in milliseconds.
|
static int |
DEFAULT_BUFFER_FOR_PLAYBACK_MS
The default duration of media that must be buffered for playback to start or resume following a
user action such as a seek, in milliseconds.
|
static int |
DEFAULT_MAX_BUFFER_MS
The default maximum duration of media that the player will attempt to buffer, in milliseconds.
|
static int |
DEFAULT_MIN_BUFFER_MS
The default minimum duration of media that the player will attempt to ensure is buffered at all
times, in milliseconds.
|
| Constructor and Description |
|---|
DefaultLoadControl()
Constructs a new instance, using the
DEFAULT_* constants defined in this class. |
DefaultLoadControl(DefaultAllocator allocator)
Constructs a new instance, using the
DEFAULT_* constants defined in this class. |
DefaultLoadControl(DefaultAllocator allocator,
int minBufferMs,
int maxBufferMs,
long bufferForPlaybackMs,
long bufferForPlaybackAfterRebufferMs)
Constructs a new instance.
|
DefaultLoadControl(DefaultAllocator allocator,
int minBufferMs,
int maxBufferMs,
long bufferForPlaybackMs,
long bufferForPlaybackAfterRebufferMs,
PriorityTaskManager priorityTaskManager)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Allocator |
getAllocator()
Returns the
Allocator that should be used to obtain media buffer allocations. |
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 |
shouldContinueLoading(long bufferedDurationUs)
Called by the player to determine whether it should continue to load the source.
|
boolean |
shouldStartPlayback(long bufferedDurationUs,
boolean rebuffering)
Called by the player to determine whether sufficient media is buffered for playback to be
started or resumed.
|
public static final int DEFAULT_MIN_BUFFER_MS
public static final int DEFAULT_MAX_BUFFER_MS
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_MS
public static final int DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS
public DefaultLoadControl()
DEFAULT_* constants defined in this class.public DefaultLoadControl(DefaultAllocator allocator)
DEFAULT_* constants defined in this class.allocator - The DefaultAllocator used by the loader.public DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs)
allocator - The DefaultAllocator used by the loader.minBufferMs - The minimum duration of media that the player will attempt to ensure is
buffered at all times, in milliseconds.maxBufferMs - The maximum duration of media that the player will attempt buffer, in
milliseconds.bufferForPlaybackMs - The duration of media that must be buffered for playback to start or
resume following a user action such as a seek, in milliseconds.bufferForPlaybackAfterRebufferMs - The default duration of media that must be buffered for
playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by
buffer depletion rather than a user action.public DefaultLoadControl(DefaultAllocator allocator, int minBufferMs, int maxBufferMs, long bufferForPlaybackMs, long bufferForPlaybackAfterRebufferMs, PriorityTaskManager priorityTaskManager)
allocator - The DefaultAllocator used by the loader.minBufferMs - The minimum duration of media that the player will attempt to ensure is
buffered at all times, in milliseconds.maxBufferMs - The maximum duration of media that the player will attempt buffer, in
milliseconds.bufferForPlaybackMs - The duration of media that must be buffered for playback to start or
resume following a user action such as a seek, in milliseconds.bufferForPlaybackAfterRebufferMs - The default duration of media that must be buffered for
playback to resume after a rebuffer, in milliseconds. A rebuffer is defined to be caused by
buffer depletion rather than a user action.priorityTaskManager - If not null, registers itself as a task with priority
C.PRIORITY_PLAYBACK during loading periods, and unregisters itself during draining
periods.public void onPrepared()
LoadControlonPrepared in interface LoadControlpublic void onTracksSelected(Renderer[] renderers, TrackGroupArray trackGroups, TrackSelectionArray trackSelections)
LoadControlonTracksSelected in interface LoadControlrenderers - The renderers.trackGroups - The TrackGroups from which the selection was made.trackSelections - The track selections that were made.public void onStopped()
LoadControlonStopped in interface LoadControlpublic void onReleased()
LoadControlonReleased in interface LoadControlpublic Allocator getAllocator()
LoadControlAllocator that should be used to obtain media buffer allocations.getAllocator in interface LoadControlpublic boolean shouldStartPlayback(long bufferedDurationUs,
boolean rebuffering)
LoadControlshouldStartPlayback in interface LoadControlbufferedDurationUs - The duration of media that's currently buffered.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.public boolean shouldContinueLoading(long bufferedDurationUs)
LoadControlshouldContinueLoading in interface LoadControlbufferedDurationUs - The duration of media that's currently buffered.