MuteButtonState
@UnstableApi
class MuteButtonState
State that holds all interactions to correctly deal with a UI component representing a Mute button.
Summary
Public constructors |
|---|
MuteButtonState(player: Player?) |
Public functions |
|
|---|---|
suspend Unit |
observe()Subscribes to updates from |
Unit |
onClick()Handles the interaction with the Mute button according to the current state of the |
Public properties |
|
|---|---|
Boolean |
true if |
Boolean |
true if |
Public constructors
Public functions
observe
suspend fun observe(): Unit
Subscribes to updates from Player.Events and listens to
-
Player.EVENT_VOLUME_CHANGEDin order to determine whether a mute button should show a mute or unmuted icon. -
Player.EVENT_AVAILABLE_COMMANDS_CHANGEDin order to determine whether the button should be enabled, i.e. respond to user input.
onClick
fun onClick(): Unit
Handles the interaction with the Mute button according to the current state of the Player. Toggled between a muted state (volume of the Player is 0) and non-muted. Does not influence the volume of the device.
This method does nothing if Player.COMMAND_SET_VOLUME is not available.
| See also | |
|---|---|
mute |
|
unmute |
|
COMMAND_GET_VOLUME |
|
COMMAND_SET_VOLUME |
Public properties
isEnabled
val isEnabled: Boolean
true if player is not null and commands Player.COMMAND_SET_VOLUME and Player.COMMAND_GET_VOLUME are available.