PreviousButtonState

@UnstableApi
class PreviousButtonState


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

This button has no internal state to maintain, it can only be enabled or disabled.

Summary

Public constructors

Public functions

suspend Nothing

Subscribes to updates from Player.Events and listens to Player.EVENT_AVAILABLE_COMMANDS_CHANGED in order to determine whether the button should be enabled, i.e. respond to user input.

Unit

Handles the interaction with the PreviousButton by seeking to a later position in the current or next MediaItem (if available).

Public properties

Boolean

determined by isCommandAvailable(Player.COMMAND_SEEK_TO_PREVIOUS)

Public constructors

PreviousButtonState

PreviousButtonState(player: Player)

Public functions

observe

suspend fun observe(): Nothing

Subscribes to updates from Player.Events and listens to Player.EVENT_AVAILABLE_COMMANDS_CHANGED in order to determine whether the button should be enabled, i.e. respond to user input.

onClick

fun onClick(): Unit

Handles the interaction with the PreviousButton by seeking to a later position in the current or next MediaItem (if available).

This method must only be programmatically called if the state is enabled. However, it can be freely provided into containers that take care of skipping the onClick if a particular UI node is not enabled (see Compose Clickable Modifier).

Public properties

isEnabled

val isEnabledBoolean

determined by isCommandAvailable(Player.COMMAND_SEEK_TO_PREVIOUS)