MuteButton

Functions summary

Unit
@UnstableApi
@Composable
MuteButton(
    player: Player?,
    modifier: Modifier,
    imageVector: MuteButtonState.() -> ImageVector,
    contentDescription: @Composable MuteButtonState.() -> String,
    colors: IconButtonColors,
    tint: Color,
    onClick: MuteButtonState.() -> Unit
)

A Material3 IconButton that mutes or unmutes the player.

Unit
@UnstableApi
@Composable
MuteButton(
    player: Player?,
    modifier: Modifier,
    painter: @Composable MuteButtonState.() -> Painter,
    contentDescription: @Composable MuteButtonState.() -> String,
    colors: IconButtonColors,
    tint: Color,
    onClick: MuteButtonState.() -> Unit
)

A Material3 IconButton that mutes or unmutes the player.

Functions

@UnstableApi
@Composable
fun MuteButton(
    player: Player?,
    modifier: Modifier = Modifier,
    imageVector: MuteButtonState.() -> ImageVector,
    contentDescription: @Composable MuteButtonState.() -> String = defaultMuteContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: MuteButtonState.() -> Unit = MuteButtonState::onClick
): Unit

A Material3 IconButton that mutes or unmutes the player.

When clicked, it will mute the player if it's currently unmuted, and unmute it otherwise. The button's state (e.g., whether it's enabled and the current mute icon) is managed by a MuteButtonState instance derived from the provided player.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

imageVector: MuteButtonState.() -> ImageVector

The supplier for ImageVector used for the icon displayed on the button. This is a composable lambda with MuteButtonState as its receiver, allowing the icon to be updated based on the button's current state (e.g. MuteButtonState.showMuted).

contentDescription: @Composable MuteButtonState.() -> String = defaultMuteContentDescription

The content description for accessibility purposes.

colors: IconButtonColors = IconButtonDefaults.iconButtonColors()

IconButtonColors that will be used to resolve the colors used for this icon button in different states. See IconButtonDefaults.iconButtonColors.

tint: Color = Color.Unspecified

Tint to be applied to imageVector. If Color.Unspecified is provided, then no tint is applied.

onClick: MuteButtonState.() -> Unit = MuteButtonState::onClick

The action to be performed when the button is clicked. This lambda has MuteButtonState as its receiver, providing access to the button's current state (e.g., MuteButtonState.isEnabled). The default behavior is to call MuteButtonState.onClick, which toggles the player's mute state. Consumers can customize this behavior:

  • To add custom logic while still performing the default action, call this.onClick() within your lambda.

  • To completely override the default behavior, implement your custom logic without calling this.onClick().

@UnstableApi
@Composable
fun MuteButton(
    player: Player?,
    modifier: Modifier = Modifier,
    painter: @Composable MuteButtonState.() -> Painter = defaultMutePainterIcon,
    contentDescription: @Composable MuteButtonState.() -> String = defaultMuteContentDescription,
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: MuteButtonState.() -> Unit = MuteButtonState::onClick
): Unit

A Material3 IconButton that mutes or unmutes the player.

When clicked, it will mute the player if it's currently unmuted, and unmute it otherwise. The button's state (e.g., whether it's enabled and the current mute icon) is managed by a MuteButtonState instance derived from the provided player.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

painter: @Composable MuteButtonState.() -> Painter = defaultMutePainterIcon

The supplier for Painter used for the icon displayed on the button. This is a composable lambda with MuteButtonState as its receiver, allowing the icon to be updated based on the button's current state (e.g. MuteButtonState.showMuted).

contentDescription: @Composable MuteButtonState.() -> String = defaultMuteContentDescription

The content description for accessibility purposes.

colors: IconButtonColors = IconButtonDefaults.iconButtonColors()

IconButtonColors that will be used to resolve the colors used for this icon button in different states. See IconButtonDefaults.iconButtonColors.

tint: Color = Color.Unspecified

Tint to be applied to painter. If Color.Unspecified is provided, then no tint is applied.

onClick: MuteButtonState.() -> Unit = MuteButtonState::onClick

The action to be performed when the button is clicked. This lambda has MuteButtonState as its receiver, providing access to the button's current state (e.g., MuteButtonState.isEnabled). The default behavior is to call MuteButtonState.onClick, which toggles the player's mute state. Consumers can customize this behavior:

  • To add custom logic while still performing the default action, call this.onClick() within your lambda.

  • To completely override the default behavior, implement your custom logic without calling this.onClick().