PlaybackSpeedToggleButton

Functions summary

Unit
@UnstableApi
@Composable
PlaybackSpeedToggleButton(
    player: Player?,
    modifier: Modifier,
    colors: ButtonColors,
    interactionSource: MutableInteractionSource?,
    speedSelection: List<Float>
)

A Material3 TextButton that toggles the playback speed of the player.

Functions

PlaybackSpeedToggleButton

@UnstableApi
@Composable
fun PlaybackSpeedToggleButton(
    player: Player?,
    modifier: Modifier = Modifier,
    colors: ButtonColors = ButtonDefaults.textButtonColors(),
    interactionSource: MutableInteractionSource? = null,
    speedSelection: List<Float> = listOf(0.5f, 0.75f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f)
): Unit

A Material3 TextButton that toggles the playback speed of the player.

When clicked, it cycles through the available playback speeds in the order defined by speedSelection. If the current playback speed is not among the ones in the list, a click will toggle the speed to the next value that is greater than the current speed. If all speeds in speedSelection are smaller than the current speed, it will cycle back to the first speed in the list.

The button's state (e.g., whether it's enabled and the current playback speed) is managed by a PlaybackSpeedState instance derived from the provided player.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

colors: ButtonColors = ButtonDefaults.textButtonColors()

ButtonColors to be used for the button.

interactionSource: MutableInteractionSource? = null

The MutableInteractionSource for the button.

speedSelection: List<Float> = listOf(0.5f, 0.75f, 1.0f, 1.25f, 1.5f, 1.75f, 2.0f)

The sequence of speeds to cycle through when the button is clicked.