LiveButton

Functions summary

Unit
@UnstableApi
@Composable
LiveButton(
    player: Player?,
    modifier: Modifier,
    liveEdgeThresholdMs: Long,
    colors: ButtonColors,
    scope: CoroutineScope,
    content: @Composable ProgressStateWithTickInterval.() -> Unit
)

A Material3 TextButton that is only visible during live streams when seeking to the default position is available.

Functions

@UnstableApi
@Composable
fun LiveButton(
    player: Player?,
    modifier: Modifier = Modifier,
    liveEdgeThresholdMs: Long = DEFAULT_LIVE_EDGE_THRESHOLD_MS,
    colors: ButtonColors = LiveButtonDefaults.textButtonColors(),
    scope: CoroutineScope = rememberCoroutineScope(),
    content: @Composable ProgressStateWithTickInterval.() -> Unit = { Text(stringResource(R.string.live_button_text)) }
): Unit

A Material3 TextButton that is only visible during live streams when seeking to the default position is available. It indicates whether the playback is at the live edge and seeks to the default position (typically the live edge) when clicked while behind the live edge.

Parameters
player: Player?

The Player to control.

modifier: Modifier = Modifier

The Modifier to be applied to the button.

liveEdgeThresholdMs: Long = DEFAULT_LIVE_EDGE_THRESHOLD_MS

How far behind the target live offset, in milliseconds, playback can be while still being considered at the live edge. Without playback speed control the player typically settles a segment duration or more behind the target, so this should be larger than the expected segment duration. Defaults to 5000ms.

colors: ButtonColors = LiveButtonDefaults.textButtonColors()

ButtonColors that will be used to resolve the colors for this button in different states. Defaults to LiveButtonDefaults.textButtonColors.

scope: CoroutineScope = rememberCoroutineScope()

The CoroutineScope to use for listening to player progress updates.

content: @Composable ProgressStateWithTickInterval.() -> Unit = { Text(stringResource(R.string.live_button_text)) }

A composable lambda with ProgressStateWithTickInterval as its receiver, allowing the content of the button to be customized.