NextButton

Functions summary

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

A Material3 IconButton that seeks to the next media item.

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

A Material3 IconButton that seeks to the next media item.

Functions

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

A Material3 IconButton that seeks to the next media item.

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

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

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

The content description for accessibility purposes. Defaults to R.string.next_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: NextButtonState.() -> Unit = NextButtonState::onClick

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

  • To add custom logic while still performing the default next 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 advancing is not possible.

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

A Material3 IconButton that seeks to the next media item.

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

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

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

The content description for accessibility purposes. Defaults to R.string.next_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: NextButtonState.() -> Unit = NextButtonState::onClick

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

  • To add custom logic while still performing the default next 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 advancing is not possible.