LoadControl
@UnstableApi
interface LoadControl
DefaultLoadControl |
The default |
Controls buffering of media.
Summary
Nested types |
|---|
class LoadControl.ParametersInformation about the current playback context and the |
Constants |
|
|---|---|
const MediaSource.MediaPeriodId! |
This property is deprecated. Used as a placeholder when MediaPeriodId is unknown. |
Public functions |
|
|---|---|
Allocator! |
getAllocator(playerId: PlayerId!)Returns the |
Long |
This function is deprecated. Implements |
Long |
getBackBufferDurationUs(playerId: PlayerId!)Returns the duration of media to retain in the buffer prior to the current playback position, for fast backward seeking. |
Unit |
This function is deprecated. Use |
Unit |
onPrepared(playerId: PlayerId!)Called by the player when prepared with a new source. |
Unit |
This function is deprecated. Implement |
Unit |
onReleased(playerId: PlayerId!)Called by the player when released. |
Unit |
This function is deprecated. Implement |
Unit |
Called by the player when stopped. |
Unit |
onTracksSelected(Called by the player when a track selection occurs. |
Unit |
This function is deprecated. Implement |
Unit |
This function is deprecated. Implement |
Unit |
This function is deprecated. Implement |
Boolean |
This function is deprecated. Implements |
Boolean |
retainBackBufferFromKeyframe(playerId: PlayerId!)Returns whether media should be retained from the keyframe before the current playback position minus |
Boolean |
shouldContinueLoading(parameters: LoadControl.Parameters!)Called by the player to determine whether it should continue to load the source. |
Boolean |
This function is deprecated. Implement |
Boolean |
shouldContinuePreloading(Called to determine whether preloading should be continued. |
Boolean |
shouldStartPlayback(parameters: LoadControl.Parameters!)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. |
Boolean |
This function is deprecated. Implement |
Boolean |
This function is deprecated. Implement |
Constants
Public functions
getAllocator
fun getAllocator(playerId: PlayerId!): Allocator!
Returns the Allocator that should be used to obtain media buffer allocations for the specified PlayerId.
getBackBufferDurationUs
fun getBackBufferDurationUs(playerId: PlayerId!): Long
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.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
| Returns | |
|---|---|
Long |
The duration of media to retain in the buffer prior to the current playback position, in microseconds. |
onPrepared
fun onPrepared(playerId: PlayerId!): Unit
Called by the player when prepared with a new source.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
onReleased
fun onReleased(playerId: PlayerId!): Unit
Called by the player when released.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
onStopped
fun onStopped(playerId: PlayerId!): Unit
Called by the player when stopped.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
onTracksSelected
fun onTracksSelected(
parameters: LoadControl.Parameters!,
trackGroups: TrackGroupArray!,
@NullableType trackSelections: Array<@NullableType ExoTrackSelection!>!
): Unit
Called by the player when a track selection occurs.
| Parameters | |
|---|---|
parameters: LoadControl.Parameters! |
containing the |
trackGroups: TrackGroupArray! |
The |
@NullableType trackSelections: Array<@NullableType ExoTrackSelection!>! |
The track selections that were made. |
onTracksSelected
funonTracksSelected(
renderers: Array<Renderer!>!,
trackGroups: TrackGroupArray!,
@NullableType trackSelections: Array<@NullableType ExoTrackSelection!>!
): Unit
onTracksSelected
funonTracksSelected(
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!,
renderers: Array<Renderer!>!,
trackGroups: TrackGroupArray!,
@NullableType trackSelections: Array<@NullableType ExoTrackSelection!>!
): Unit
onTracksSelected
funonTracksSelected(
playerId: PlayerId!,
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!,
renderers: Array<Renderer!>!,
trackGroups: TrackGroupArray!,
@NullableType trackSelections: Array<@NullableType ExoTrackSelection!>!
): Unit
retainBackBufferFromKeyframe
fun retainBackBufferFromKeyframe(playerId: PlayerId!): Boolean
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.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
| Returns | |
|---|---|
Boolean |
Whether media should be retained from the keyframe before the current playback position minus |
shouldContinueLoading
fun shouldContinueLoading(parameters: LoadControl.Parameters!): Boolean
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 call will continue being loaded.
| Parameters | |
|---|---|
parameters: LoadControl.Parameters! |
Information about the playback context and the |
| Returns | |
|---|---|
Boolean |
Whether the loading should continue. |
shouldContinueLoading
funshouldContinueLoading(
playbackPositionUs: Long,
bufferedDurationUs: Long,
playbackSpeed: Float
): Boolean
shouldContinuePreloading
fun shouldContinuePreloading(
playerId: PlayerId!,
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!,
bufferedDurationUs: Long
): Boolean
Called to determine whether preloading should be continued. If this method returns true, the presented period will continue to load media.
| Parameters | |
|---|---|
playerId: PlayerId! |
The |
timeline: Timeline! |
The Timeline containing the preload period that can be looked up with MediaPeriodId.periodUid. |
mediaPeriodId: MediaSource.MediaPeriodId! |
The MediaPeriodId of the preloading period. |
bufferedDurationUs: Long |
The duration of media currently buffered by the preload period. |
| Returns | |
|---|---|
Boolean |
Whether the preloading should continue for the given period. |
shouldStartPlayback
fun shouldStartPlayback(parameters: LoadControl.Parameters!): Boolean
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 | |
|---|---|
parameters: LoadControl.Parameters! |
Information about the playback context and the |
| Returns | |
|---|---|
Boolean |
Whether playback should be allowed to start or resume. |
shouldStartPlayback
funshouldStartPlayback(
bufferedDurationUs: Long,
playbackSpeed: Float,
rebuffering: Boolean,
targetLiveOffsetUs: Long
): Boolean
shouldStartPlayback
funshouldStartPlayback(
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!,
bufferedDurationUs: Long,
playbackSpeed: Float,
rebuffering: Boolean,
targetLiveOffsetUs: Long
): Boolean