PreviousButton

Functions summary

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

A Material3 IconButton that seeks to the previous media item.

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

A Material3 IconButton that seeks to the previous media item.

Functions

@UnstableApi
@Composable
fun PreviousButton(
    player: Player?,
    modifier: Modifier = Modifier,
    imageVector: @Composable PreviousButtonState.() -> ImageVector,
    contentDescription: @Composable PreviousButtonState.() -> String = { stringResource(R.string.previous_button) },
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: PreviousButtonState.() -> Unit = PreviousButtonState::onClick
): Unit

A Material3 IconButton that seeks to the previous media item.

When clicked, it attempts to advance the player to the previous media item in its current playlist. The button's state (e.g., whether it's enabled) is managed by a PreviousButtonState 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: @Composable PreviousButtonState.() -> ImageVector

The supplier for ImageVector used for the icon displayed on the button.

contentDescription: @Composable PreviousButtonState.() -> String = { stringResource(R.string.previous_button) }

The content description for accessibility purposes. Defaults to R.string.previous_button.

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: PreviousButtonState.() -> Unit = PreviousButtonState::onClick

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

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

  • To completely override the default behavior, implement your custom logic without calling this.onClick(). Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where seeking is not possible.

@UnstableApi
@Composable
fun PreviousButton(
    player: Player?,
    modifier: Modifier = Modifier,
    painter: @Composable PreviousButtonState.() -> Painter = { painterResource(R.drawable.media3_icon_previous) },
    contentDescription: @Composable PreviousButtonState.() -> String = { stringResource(R.string.previous_button) },
    colors: IconButtonColors = IconButtonDefaults.iconButtonColors(),
    tint: Color = Color.Unspecified,
    onClick: PreviousButtonState.() -> Unit = PreviousButtonState::onClick
): Unit

A Material3 IconButton that seeks to the previous media item.

When clicked, it attempts to advance the player to the previous media item in its current playlist. The button's state (e.g., whether it's enabled) is managed by a PreviousButtonState 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 PreviousButtonState.() -> Painter = { painterResource(R.drawable.media3_icon_previous) }

The supplier for Painter used for the icon displayed on the button. Defaults to R.drawable.media3_icon_previous.

contentDescription: @Composable PreviousButtonState.() -> String = { stringResource(R.string.previous_button) }

The content description for accessibility purposes. Defaults to R.string.previous_button.

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: PreviousButtonState.() -> Unit = PreviousButtonState::onClick

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

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

  • To completely override the default behavior, implement your custom logic without calling this.onClick(). Note that in this case, the button might still be enabled based on the player state, so ensure your custom logic handles cases where seeking is not possible.