LivePlaybackSpeedControl
@UnstableApi
interface LivePlaybackSpeedControl
DefaultLivePlaybackSpeedControl |
A |
Controls the playback speed while playing live content in order to maintain a steady target live offset.
Summary
Public functions |
|
|---|---|
Float |
getAdjustedPlaybackSpeed(liveOffsetUs: Long, bufferedDurationUs: Long)Returns the adjusted playback speed in order get closer towards the |
Long |
Returns the current target live offset, in microseconds, or |
Unit |
Notifies the live playback speed control that a rebuffer occurred. |
Unit |
setLiveConfiguration(liveConfiguration: MediaItem.LiveConfiguration!)Sets the live configuration defined by the media. |
Unit |
setTargetLiveOffsetOverrideUs(liveOffsetUs: Long)Sets the target live offset in microseconds that overrides the live offset |
Public functions
getAdjustedPlaybackSpeed
fun getAdjustedPlaybackSpeed(liveOffsetUs: Long, bufferedDurationUs: Long): Float
Returns the adjusted playback speed in order get closer towards the target live offset.
| Parameters | |
|---|---|
liveOffsetUs: Long |
The current live offset, in microseconds. |
bufferedDurationUs: Long |
The duration of media that's currently buffered, in microseconds. |
| Returns | |
|---|---|
Float |
The adjusted factor by which playback should be sped up. |
getTargetLiveOffsetUs
fun getTargetLiveOffsetUs(): Long
Returns the current target live offset, in microseconds, or TIME_UNSET if no target live offset is defined for the current media.
notifyRebuffer
fun notifyRebuffer(): Unit
Notifies the live playback speed control that a rebuffer occurred.
A rebuffer is defined to be caused by buffer depletion rather than a user action. Hence this method is not called during initial buffering or when buffering as a result of a seek operation.
setLiveConfiguration
fun setLiveConfiguration(liveConfiguration: MediaItem.LiveConfiguration!): Unit
Sets the live configuration defined by the media.
| Parameters | |
|---|---|
liveConfiguration: MediaItem.LiveConfiguration! |
The |
setTargetLiveOffsetOverrideUs
fun setTargetLiveOffsetOverrideUs(liveOffsetUs: Long): Unit
Sets the target live offset in microseconds that overrides the live offset configured by the media. Passing C.TIME_UNSET deletes a previous override.
If no target live offset is configured by setLiveConfiguration, this override has no effect.