# LiveButton

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/LiveButton.composable#LiveButton(androidx.media3.common.Player,androidx.compose.ui.Modifier,kotlin.Long,androidx.compose.material3.ButtonColors,kotlinx.coroutines.CoroutineScope,kotlin.Function1)( player: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, liveEdgeThresholdMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/ButtonColors, scope: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/ProgressStateWithTickInterval.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` A Material3 `https://developer.android.com/reference/kotlin/androidx/compose/material3/TextButton.composable#TextButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)` that is only visible during live streams when seeking to the default position is available. |

## Functions

### LiveButton

Artifact: [androidx.media3:media3-ui-compose-material3](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/compose/material3/buttons/LiveButton.kt+function:LiveButton)

```
@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 `https://developer.android.com/reference/kotlin/androidx/compose/material3/TextButton.composable#TextButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)` 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: https://developer.android.com/reference/kotlin/androidx/media3/common/Player?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Player` to control. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | The `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to the button. |
| `liveEdgeThresholdMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 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: https://developer.android.com/reference/kotlin/androidx/compose/material3/ButtonColors = LiveButtonDefaults.textButtonColors()` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/ButtonColors` that will be used to resolve the colors for this button in different states. Defaults to `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/material3/buttons/LiveButtonDefaults#textButtonColors(androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color)`. |
| `scope: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html = rememberCoroutineScope()` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` to use for listening to player progress updates. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/ProgressStateWithTickInterval.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html = { Text(stringResource(R.string.live_button_text)) }` | A composable lambda with `https://developer.android.com/reference/kotlin/androidx/media3/ui/compose/state/ProgressStateWithTickInterval` as its receiver, allowing the content of the button to be customized. |