Repository: JetBrains/compose-multiplatform
File: experimental/components/VideoPlayer/demo/src/jvmMain/kotlin/org/jetbrains/compose/videoplayer/demo/Main.kt (Kotlin)

Code before:
            isResumed = isResumed,
            isFullscreen = isFullscreen,
            onFinish = stopPlayback,
            modifier = Modifier
                .fillMaxWidth()
                .height(400.dp)
        )
        Slider(
            value = progress.fraction,
            onValueChange = { seek = it },
            modifier = Modifier.fillMaxWidth()
        )
        Row(
            horizontalArrangement = Arrangement.spacedBy(24.dp, Alignment.CenterHorizontally),
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier.fillMaxWidth()
        ) {
            Text("Timestamp: ${progress.time}", modifier = Modifier.width(140.dp))
            IconButton(onClick = toggleResume) {
                Icon(
                    painter = painterResource("${if (isResumed) "pause" else "play"}.svg"),
                    contentDescription = "Play/Pause"
                )
            }
            IconButton(onClick = toggleFullscreen) {
                Icon(
                    painter = painterResource("${if (isFullscreen) "exit" else "enter"}-fullscreen.svg"),
                    contentDescription = "Toggle fullscreen"
                )
            }
            OutlinedTextField(
                value = speed.toString(),
                maxLines = 1,
                leadingIcon = {
                    Icon(
                        painter = painterResource("speed.svg"),
                        contentDescription = "Speed",
                        modifier = Modifier.size(36.dp)
                    )
                },
                modifier = Modifier.width(104.dp),
                onValueChange = { speed = it.toFloat() }
            )
            Row {
                Icon(painter = painterResource("volume.svg"), contentDescription = "Volume")
                // TODO: Make the slider logarithmic
                //  See https://www.dr-lex.be/info-stuff/volumecontrols.html
                //  and https://ux.stackexchange.com/q/79672/117386
                //  and https://dcordero.me/posts/logarithmic_volume_control.html
                Slider(
                    value = volume,

Review comment (refactor):
How about a `VideoPlayerState` and a `rememberVideoPlayerState()` like it is done with `rememberScrollState()` and a bunch of Compose APIs. This would simplify alot the interaction with the VideoPlayer component.

Another API sample: https://github.com/google/accompanist/blob/main/web/src/main/java/com/google/accompanist/web/WebView.kt#L311


Code after:
        MaterialTheme {
            App()
        }
    }
}

@Composable
fun App() {
    val state = rememberVideoPlayerState()
    /*
     * Could not use a [Box] to overlay the controls on top of the video.
     * See https://github.com/JetBrains/compose-multiplatform/tree/master/tutorials/Swing_Integration
     * Related issues:
     * https://github.com/JetBrains/compose-multiplatform/issues/1521
     * https://github.com/JetBrains/compose-multiplatform/issues/2926
     */
    Column {
        VideoPlayer(
            url = VIDEO_URL,
            state = state,
            onFinish = state::stopPlayback,
            modifier = Modifier
                .fillMaxWidth()
                .height(400.dp)
        )
        Slider(
            value = state.progress.value.fraction,
            onValueChange = { state.seek = it },
            modifier = Modifier.fillMaxWidth()
        )
        Row(
            horizontalArrangement = Arrangement.spacedBy(24.dp, Alignment.CenterHorizontally),
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier.fillMaxWidth()
        ) {
            Text("Timestamp: ${state.progress.value.timeMillis} ms", modifier = Modifier.width(180.dp))
            IconButton(onClick = state::toggleResume) {
                Icon(
                    painter = painterResource("${if (state.isResumed) "pause" else "play"}.svg"),
                    contentDescription = "Play/Pause",
                    modifier = Modifier.size(32.dp)
                )
            }
            IconButton(onClick = state::toggleFullscreen) {
                Icon(
                    painter = painterResource("${if (state.isFullscreen) "exit" else "enter"}-fullscreen.svg"),
                    contentDescription = "Toggle fullscreen",
                    modifier = Modifier.size(32.dp)
                )
            }
            Speed(