androidx.media3.ui.compose.material3.indicator

Classes

TimeFormat

A class for specifying the format of the time to be displayed by TimeText.

Top-level functions summary

Unit
@UnstableApi
@Composable
DurationText(
    player: Player?,
    modifier: Modifier,
    color: Color,
    scope: CoroutineScope
)

A composable that displays the duration of the media.

Unit
@UnstableApi
@Composable
PositionAndDurationText(
    player: Player?,
    modifier: Modifier,
    separator: String,
    color: Color,
    scope: CoroutineScope
)

A composable that displays the duration of the media.

Unit
@UnstableApi
@Composable
PositionText(
    player: Player?,
    modifier: Modifier,
    color: Color,
    scope: CoroutineScope
)

A composable that displays the current position of the player.

Unit
@UnstableApi
@Composable
ProgressSlider(
    player: Player?,
    modifier: Modifier,
    onValueChange: ((Float) -> Unit)?,
    onValueChangeFinished: (() -> Unit)?,
    scope: CoroutineScope,
    colors: SliderColors,
    interactionSource: MutableInteractionSource
)

A Material3 Slider that displays the current position of the player.

Unit
@UnstableApi
@Composable
RemainingDurationText(
    player: Player?,
    modifier: Modifier,
    showNegative: Boolean,
    color: Color,
    scope: CoroutineScope
)

A composable that displays the duration of the media.

Unit
@UnstableApi
@Composable
TimeText(
    player: Player?,
    modifier: Modifier,
    color: Color,
    timeFormat: TimeFormat,
    scope: CoroutineScope
)

Progress indicator that represents the Player's progress state in textual form.

Top-level functions

@UnstableApi
@Composable
fun DurationText(
    player: Player?,
    modifier: Modifier = Modifier,
    color: Color = Color.Unspecified,
    scope: CoroutineScope = rememberCoroutineScope()
): Unit

A composable that displays the duration of the media.

Parameters
player: Player?

The Player to get the duration from.

modifier: Modifier = Modifier

The Modifier to be applied to the text.

color: Color = Color.Unspecified

The Color to be applied to the text. If Color.Unspecified, the color will be inherited from the theme.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

PositionAndDurationText

@UnstableApi
@Composable
fun PositionAndDurationText(
    player: Player?,
    modifier: Modifier = Modifier,
    separator: String = " / ",
    color: Color = Color.Unspecified,
    scope: CoroutineScope = rememberCoroutineScope()
): Unit

A composable that displays the duration of the media.

Parameters
player: Player?

The Player to get the duration from.

modifier: Modifier = Modifier

The Modifier to be applied to the text.

separator: String = " / "

The separator string to be used between the current position and duration.

color: Color = Color.Unspecified

The Color to be applied to the text. If Color.Unspecified, the color will be inherited from the theme.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

@UnstableApi
@Composable
fun PositionText(
    player: Player?,
    modifier: Modifier = Modifier,
    color: Color = Color.Unspecified,
    scope: CoroutineScope = rememberCoroutineScope()
): Unit

A composable that displays the current position of the player.

Parameters
player: Player?

The Player to get the position from.

modifier: Modifier = Modifier

The Modifier to be applied to the text.

color: Color = Color.Unspecified

The Color to be applied to the text. If Color.Unspecified, the color will be inherited from the theme.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

@UnstableApi
@Composable
fun ProgressSlider(
    player: Player?,
    modifier: Modifier = Modifier,
    onValueChange: ((Float) -> Unit)? = null,
    onValueChangeFinished: (() -> Unit)? = null,
    scope: CoroutineScope = rememberCoroutineScope(),
    colors: SliderColors = SliderDefaults.colors(),
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
): Unit

A Material3 Slider that displays the current position of the player.

Parameters
player: Player?

The Player to get the progress from.

modifier: Modifier = Modifier

The Modifier to be applied to the slider.

onValueChange: ((Float) -> Unit)? = null

An optional callback that is invoked continuously as the user drags the slider thumb. The lambda receives a Float representing the new progress value (from 0.0 to 1.0). This can be used to display a preview of the seek position. You should not use this callback to update the slider's value, as this is handled internally.

onValueChangeFinished: (() -> Unit)? = null

An optional callback that is invoked when the user has finished their interaction (by lifting their finger or tapping). The underlying Player.seekTo operation is performed internally just before this callback is invoked.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

colors: SliderColors = SliderDefaults.colors()

SliderColors that will be used to resolve the colors used for this slider in different states. See SliderDefaults.colors.

interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }

the MutableInteractionSource representing the stream of Interactions for this slider. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this slider in different states.

@UnstableApi
@Composable
fun RemainingDurationText(
    player: Player?,
    modifier: Modifier = Modifier,
    showNegative: Boolean = false,
    color: Color = Color.Unspecified,
    scope: CoroutineScope = rememberCoroutineScope()
): Unit

A composable that displays the duration of the media.

Parameters
player: Player?

The Player to get the duration from.

modifier: Modifier = Modifier

The Modifier to be applied to the text.

showNegative: Boolean = false

Whether to display the remaining time with a minus sign.

color: Color = Color.Unspecified

The Color to be applied to the text. If Color.Unspecified, the color will be inherited from the theme.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

@UnstableApi
@Composable
fun TimeText(
    player: Player?,
    modifier: Modifier = Modifier,
    color: Color = Color.Unspecified,
    timeFormat: TimeFormat,
    scope: CoroutineScope = rememberCoroutineScope()
): Unit

Progress indicator that represents the Player's progress state in textual form.

It displays the up-to-date current position and duration of the media, formatted by getStringForTime.

Parameters
player: Player?

The Player to get the progress from.

modifier: Modifier = Modifier

The Modifier to be applied to the text.

color: Color = Color.Unspecified

The Color to be applied to the text. If Color.Unspecified, the color will be inherited from the theme.

timeFormat: TimeFormat

The TimeFormat to use for displaying the time.

scope: CoroutineScope = rememberCoroutineScope()

Coroutine scope to listen to the progress updates from the player.