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

A composable that displays the duration of the media.

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

A composable that displays the duration of the media.

Unit

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
)

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

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

A composable that displays the duration of the media.

Unit
@UnstableApi
@Composable
TimeText(
    player: Player?,
    modifier: Modifier,
    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,
    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.

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 = " / ",
    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.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

@UnstableApi
@Composable
fun PositionText(
    player: Player?,
    modifier: Modifier = Modifier,
    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.

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()
): 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.

@UnstableApi
@Composable
fun RemainingDurationText(
    player: Player?,
    modifier: Modifier = Modifier,
    showNegative: Boolean = false,
    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.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

@UnstableApi
@Composable
fun TimeText(
    player: Player?,
    modifier: Modifier = Modifier,
    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.

timeFormat: TimeFormat

The TimeFormat to use for displaying the time.

scope: CoroutineScope = rememberCoroutineScope()

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