androidx.media3.ui.compose.state

Classes

MuteButtonState

State that holds all interactions to correctly deal with a UI component representing a Mute button.

NextButtonState

State that holds all interactions to correctly deal with a UI component representing a seek-to-next button.

PlayPauseButtonState

State that converts the necessary information from the Player to correctly deal with a UI component representing a PlayPause button.

PlaybackSpeedState

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

PlayerStateObserver

Utility to observe Player states by listening to events.

PresentationState

State that holds information to correctly deal with UI components related to the rendering of frames to a surface.

PreviousButtonState

State that holds all interactions to correctly deal with a UI component representing a seek-to-previous button.

ProgressStateWithTickCount

State that aims to hold accurate progress information (position, bufferedPosition, duration) that is required for a UI component representing a non-textual progress indicator, e.g. circular or linear.

ProgressStateWithTickInterval

State that holds playback progress information of a Player.

RepeatButtonState

State that holds all interactions to correctly deal with a UI component representing a Repeat On/All/Off button.

SeekBackButtonState

State that holds all interactions to correctly deal with a UI component representing a seek back button.

SeekForwardButtonState

State that holds all interactions to correctly deal with a UI component representing a seek forward button.

ShuffleButtonState

State that holds all interactions to correctly deal with a UI component representing a Shuffle On/Off button.

Composables

rememberMuteButtonState

Remembers the value of MuteButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberNextButtonState

Remembers the value of NextButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberPlayPauseButtonState

Remembers the value of PlayPauseButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberPlaybackSpeedState

Remember the value of PlaybackSpeedState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberPresentationState

Remembers the value of PresentationState created based on the passed Player and launches a coroutine to listen to Player's changes.

rememberPreviousButtonState

Remembers the value of PreviousButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberProgressStateWithTickCount

Remember the value of ProgressStateWithTickCount created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberProgressStateWithTickInterval

Remember the value of ProgressStateWithTickInterval created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberRepeatButtonState

Remember the value of RepeatButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberSeekBackButtonState

Remembers the value of SeekBackButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberSeekForwardButtonState

Remembers the value of SeekForwardButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

rememberShuffleButtonState

Remember the value of ShuffleButtonState created based on the passed Player and launch a coroutine to listen to Player's changes.

Constants summary

Extension functions summary

PlayerStateObserver
@UnstableApi
Player.observeState(
    firstEvent: @Player.Event Int,
    vararg otherEvents: Int,
    stateUpdater: (Player) -> Unit
)

Utility to observe Player states by listening to events.

Constants

FALLBACK_UPDATE_INTERVAL_MS

@VisibleForTesting(otherwise = 2)
@UnstableApi
const val FALLBACK_UPDATE_INTERVAL_MS = 1000: Long

MIN_UPDATE_INTERVAL_MS

@UnstableApi
const val MIN_UPDATE_INTERVAL_MS = 8: Long

Extension functions

Player.observeState

@UnstableApi
fun Player.observeState(
    firstEvent: @Player.Event Int,
    vararg otherEvents: Int,
    stateUpdater: (Player) -> Unit
): PlayerStateObserver

Utility to observe Player states by listening to events.

Parameters
firstEvent: @Player.Event Int

The first Player.Event to listen to

vararg otherEvents: Int

Additional Player.Event types to listen to

stateUpdater: (Player) -> Unit

The operation to trigger initially and whenever one of the configured events happen