PlayPauseButtonState

@UnstableApi
class PlayPauseButtonState


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

Summary

Public constructors

Public functions

suspend Nothing

Subscribes to updates from Player.Events and listens to

Unit

Handles the interaction with the PlayPause button according to the current state of the Player.

Public properties

Boolean

determined by isCommandAvailable(Player.COMMAND_PLAY_PAUSE) and having something in the Timeline to play

Boolean

determined by shouldShowPlayButton

Public constructors

PlayPauseButtonState

PlayPauseButtonState(player: Player)

Public functions

observe

suspend fun observe(): Nothing

Subscribes to updates from Player.Events and listens to

onClick

fun onClick(): Unit

Handles the interaction with the PlayPause button according to the current state of the Player.

The Player update that follows can take a form of Player.play, Player.pause, Player.prepare or Player.seekToDefaultPosition.

Public properties

isEnabled

val isEnabledBoolean

determined by isCommandAvailable(Player.COMMAND_PLAY_PAUSE) and having something in the Timeline to play

showPlay

val showPlayBoolean

determined by shouldShowPlayButton