Back to Exoplayer

DefaultLivePlaybackSpeedControl (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/DefaultLivePlaybackSpeedControl.html

latest12.2 KB
Original Source

Package com.google.android.exoplayer2

Class DefaultLivePlaybackSpeedControl

  • java.lang.Object

    • com.google.android.exoplayer2.DefaultLivePlaybackSpeedControl
  • All Implemented Interfaces:LivePlaybackSpeedControl


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultLivePlaybackSpeedControlextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[LivePlaybackSpeedControl](LivePlaybackSpeedControl.html "interface in com.google.android.exoplayer2")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

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

The control mechanism calculates the adjusted speed as 1.0 + proportionalControlFactor x (currentLiveOffsetSec - targetLiveOffsetSec). Unit speed (1.0f) is used, if the currentLiveOffsetSec is closer to targetLiveOffsetSec than the value set with DefaultLivePlaybackSpeedControl.Builder.setMaxLiveOffsetErrorMsForUnitSpeed(long).

The resulting speed is clamped to a minimum and maximum speed defined by the media, the fallback values set with DefaultLivePlaybackSpeedControl.Builder.setFallbackMinPlaybackSpeed(float) and DefaultLivePlaybackSpeedControl.Builder.setFallbackMaxPlaybackSpeed(float) or the minimum and maximum fallback default values.

When the player rebuffers, the target live offset is increased to adjust to the reduced network capabilities. The live playback speed control also keeps track of the minimum possible live offset to decrease the target live offset again if conditions improve. The minimum possible live offset is derived from the current offset and the duration of buffered media.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | DefaultLivePlaybackSpeedControl.Builder | Deprecated.

Builder for a DefaultLivePlaybackSpeedControl. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static float | DEFAULT_FALLBACK_MAX_PLAYBACK_SPEED | Deprecated.

The default maximum factor by which playback can be sped up that should be used if no maximum playback speed is defined by the media. | | static float | DEFAULT_FALLBACK_MIN_PLAYBACK_SPEED | Deprecated.

The default minimum factor by which playback can be sped up that should be used if no minimum playback speed is defined by the media. | | static long | DEFAULT_MAX_LIVE_OFFSET_ERROR_MS_FOR_UNIT_SPEED | Deprecated.

The default maximum difference between the current live offset and the target live offset, in milliseconds, for which unit speed (1.0f) is used. | | static float | DEFAULT_MIN_POSSIBLE_LIVE_OFFSET_SMOOTHING_FACTOR | Deprecated.

The default smoothing factor when smoothing the minimum possible live offset that can be achieved during playback. | | static long | DEFAULT_MIN_UPDATE_INTERVAL_MS | Deprecated.

The default minimum interval between playback speed changes, in milliseconds. | | static float | DEFAULT_PROPORTIONAL_CONTROL_FACTOR | Deprecated.

The default proportional control factor used to adjust the playback speed. | | static long | DEFAULT_TARGET_LIVE_OFFSET_INCREMENT_ON_REBUFFER_MS | Deprecated.

The default increment applied to the target live offset each time the player is rebuffering, in milliseconds |

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | float | getAdjustedPlaybackSpeed​(long liveOffsetUs, long bufferedDurationUs) | Deprecated.

Returns the adjusted playback speed in order get closer towards the target live offset. | | long | getTargetLiveOffsetUs() | Deprecated.

Returns the current target live offset, in microseconds, or C.TIME_UNSET if no target live offset is defined for the current media. | | void | notifyRebuffer() | Deprecated.

Notifies the live playback speed control that a rebuffer occurred. | | void | setLiveConfiguration​(MediaItem.LiveConfiguration liveConfiguration) | Deprecated.

Sets the live configuration defined by the media. | | void | setTargetLiveOffsetOverrideUs​(long liveOffsetUs) | Deprecated.

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

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

DEFAULT_FALLBACK_MIN_PLAYBACK_SPEED

public static final float DEFAULT_FALLBACK_MIN_PLAYBACK_SPEED

Deprecated.

The default minimum factor by which playback can be sped up that should be used if no minimum playback speed is defined by the media. See Also:Constant Field Values

- 

DEFAULT_FALLBACK_MAX_PLAYBACK_SPEED

public static final float DEFAULT_FALLBACK_MAX_PLAYBACK_SPEED

Deprecated.

The default maximum factor by which playback can be sped up that should be used if no maximum playback speed is defined by the media. See Also:Constant Field Values

- 

DEFAULT_MIN_UPDATE_INTERVAL_MS

public static final long DEFAULT_MIN_UPDATE_INTERVAL_MS

Deprecated.

The default minimum interval between playback speed changes, in milliseconds. See Also:Constant Field Values

- 

DEFAULT_PROPORTIONAL_CONTROL_FACTOR

public static final float DEFAULT_PROPORTIONAL_CONTROL_FACTOR

Deprecated.

The default proportional control factor used to adjust the playback speed. See Also:Constant Field Values

- 

DEFAULT_TARGET_LIVE_OFFSET_INCREMENT_ON_REBUFFER_MS

public static final long DEFAULT_TARGET_LIVE_OFFSET_INCREMENT_ON_REBUFFER_MS

Deprecated.

The default increment applied to the target live offset each time the player is rebuffering, in milliseconds See Also:Constant Field Values

- 

DEFAULT_MIN_POSSIBLE_LIVE_OFFSET_SMOOTHING_FACTOR

public static final float DEFAULT_MIN_POSSIBLE_LIVE_OFFSET_SMOOTHING_FACTOR

Deprecated.

The default smoothing factor when smoothing the minimum possible live offset that can be achieved during playback. See Also:Constant Field Values

- 

DEFAULT_MAX_LIVE_OFFSET_ERROR_MS_FOR_UNIT_SPEED

public static final long DEFAULT_MAX_LIVE_OFFSET_ERROR_MS_FOR_UNIT_SPEED

Deprecated.

The default maximum difference between the current live offset and the target live offset, in milliseconds, for which unit speed (1.0f) is used. See Also:Constant Field Values

Method Detail

- 

setLiveConfiguration

public void setLiveConfiguration​([MediaItem.LiveConfiguration](MediaItem.LiveConfiguration.html "class in com.google.android.exoplayer2")liveConfiguration)

Deprecated.

Description copied from interface: LivePlaybackSpeedControl

Sets the live configuration defined by the media. Specified by:setLiveConfiguration in interface LivePlaybackSpeedControlParameters:liveConfiguration - The MediaItem.LiveConfiguration as defined by the media.

- 

setTargetLiveOffsetOverrideUs

public void setTargetLiveOffsetOverrideUs​(long liveOffsetUs)

Deprecated.

Description copied from interface: LivePlaybackSpeedControl

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 LivePlaybackSpeedControl.setLiveConfiguration(com.google.android.exoplayer2.MediaItem.LiveConfiguration), this override has no effect.

Specified by:setTargetLiveOffsetOverrideUs in interface LivePlaybackSpeedControl

- 

notifyRebuffer

public void notifyRebuffer()

Deprecated.

Description copied from interface: LivePlaybackSpeedControl

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.

Specified by:notifyRebuffer in interface LivePlaybackSpeedControl

- 

getAdjustedPlaybackSpeed

public float getAdjustedPlaybackSpeed​(long liveOffsetUs,
                                      long bufferedDurationUs)

Deprecated.

Description copied from interface: LivePlaybackSpeedControl

Returns the adjusted playback speed in order get closer towards the target live offset. Specified by:getAdjustedPlaybackSpeed in interface LivePlaybackSpeedControlParameters:liveOffsetUs - The current live offset, in microseconds.bufferedDurationUs - The duration of media that's currently buffered, in microseconds.Returns:The adjusted factor by which playback should be sped up.

- 

getTargetLiveOffsetUs

public long getTargetLiveOffsetUs()

Deprecated.

Description copied from interface: LivePlaybackSpeedControl

Returns the current target live offset, in microseconds, or C.TIME_UNSET if no target live offset is defined for the current media. Specified by:getTargetLiveOffsetUs in interface LivePlaybackSpeedControl