LivePlaybackSpeedControl


@UnstableApi
public interface LivePlaybackSpeedControl

Known direct subclasses
DefaultLivePlaybackSpeedControl

A LivePlaybackSpeedControl that adjusts the playback speed using a proportional controller.


Controls the playback speed while playing live content in order to maintain a steady target live offset.

Summary

Public methods

abstract float
getAdjustedPlaybackSpeed(long liveOffsetUs, long bufferedDurationUs)

Returns the adjusted playback speed in order get closer towards the target live offset.

abstract long

Returns the current target live offset, in microseconds, or TIME_UNSET if no target live offset is defined for the current media.

abstract void

Notifies the live playback speed control that a rebuffer occurred.

abstract void

Sets the live configuration defined by the media.

abstract void
setTargetLiveOffsetOverrideUs(long liveOffsetUs)

Sets the target live offset in microseconds that overrides the live offset configured by the media.

Public methods

getAdjustedPlaybackSpeed

abstract float getAdjustedPlaybackSpeed(long liveOffsetUs, long bufferedDurationUs)

Returns the adjusted playback speed in order get closer towards the target live offset.

Parameters
long liveOffsetUs

The current live offset, in microseconds.

long bufferedDurationUs

The duration of media that's currently buffered, in microseconds.

Returns
float

The adjusted factor by which playback should be sped up.

getTargetLiveOffsetUs

abstract long getTargetLiveOffsetUs()

Returns the current target live offset, in microseconds, or TIME_UNSET if no target live offset is defined for the current media.

notifyRebuffer

abstract void notifyRebuffer()

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

abstract void setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)

Sets the live configuration defined by the media.

Parameters
MediaItem.LiveConfiguration liveConfiguration

The LiveConfiguration as defined by the media.

setTargetLiveOffsetOverrideUs

abstract void setTargetLiveOffsetOverrideUs(long liveOffsetUs)

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.