BBNativePlayer

fun BBNativePlayer(jsonUrl: String, modifier: Modifier = Modifier, options: BBPlayerOptions = BBPlayerOptions(), state: BBPlayerState = rememberBBPlayerState(), onReady: () -> Unit? = null, onError: (String?) -> Unit? = null, onEnded: () -> Unit? = null)

A Jetpack Compose wrapper for BBNativePlayerView.

Embeds the Blue Billywig native video player in a Compose layout using AndroidView. Observe the player's reactive state via state and control it with BBPlayerState methods.

Example

@Composable
fun VideoScreen(clipUrl: String) {
val playerState = rememberBBPlayerState()

BBNativePlayer(
jsonUrl = clipUrl,
modifier = Modifier.fillMaxWidth().aspectRatio(16f / 9f),
state = playerState,
options = BBPlayerOptions(autoPlay = false, noChromeCast = true),
)

Button(onClick = {
if (playerState.isPlaying) playerState.pause() else playerState.play()
}) {
Text(if (playerState.isPlaying) "Pause" else "Play")
}
}

Parameters

jsonUrl

The JSON embed URL for the player configuration.

modifier

Modifier for sizing and layout.

options

Type-safe player options. Defaults to empty (uses playout defaults).

state

Reactive state holder. Create with rememberBBPlayerState.

onReady

Called when the player has finished setup.

onError

Called when the player encounters an error.

onEnded

Called when playback ends.