@UnstableApi
class NextButtonState


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

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

Summary

Public constructors

Public functions

suspend Unit

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 NextButton by seeking to the next MediaItem, if available, or to later position in the current MediaItem, if live.

Public properties

Boolean

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

Public constructors

NextButtonState

NextButtonState(player: Player?)

Public functions

observe

suspend fun observe(): Unit

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 NextButton by seeking to the next MediaItem, if available, or to later position in the current MediaItem, if live.

This method does nothing if Player.COMMAND_SEEK_TO_NEXT is not available.

Public properties

isEnabled

val isEnabledBoolean

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