PlaybackSpeedState

@UnstableApi
class PlaybackSpeedState


State that holds all interactions to correctly deal with a UI component representing a playback speed controller.

In most cases, this will be created via rememberPlaybackSpeedState.

Summary

Public constructors

Public functions

suspend Unit

Subscribes to updates from Player.Events and listens to

Unit

Updates the playback speed of the Player backing this state.

Public properties

Boolean

true if player is not null and Player.COMMAND_SET_SPEED_AND_PITCH is available.

Float

determined by Player.playbackParameters.speed.

Public constructors

PlaybackSpeedState

PlaybackSpeedState(player: Player?)
Parameters
player: Player?

Player object that operates as a state provider.

Public functions

observe

suspend fun observe(): Unit

Subscribes to updates from Player.Events and listens to

updatePlaybackSpeed

fun updatePlaybackSpeed(speed: Float): Unit

Updates the playback speed of the Player backing this state.

This method must only be programmatically called if the state is enabled.

Public properties

isEnabled

val isEnabledBoolean

true if player is not null and Player.COMMAND_SET_SPEED_AND_PITCH is available.

playbackSpeed

val playbackSpeedFloat

determined by Player.playbackParameters.speed. Defaults to 1f if the player is null.