fun LivestreamPlayer(modifier: Modifier = Modifier, call: Call, enablePausing: Boolean = true, onPausedPlayer: (isPaused: Boolean) -> Unit? = {}, backstageContent: @Composable BoxScope.(Call) -> Unit = {
LivestreamBackStage(call)
}, videoRendererConfig: VideoRendererConfig = videoRenderConfig(), livestreamFlow: Flow<ParticipantState.Video?> = call.state.participants.flatMapLatest { participants: List<ParticipantState> ->
// For each participant, create a small Flow that watches videoEnabled.
val participantVideoFlows = participants.map { participant ->
participant.videoEnabled.map { enabled -> participant to enabled }
}
// Combine these Flows: whenever a participant’s videoEnabled changes,
// we re-calculate which participants have video.
combine(participantVideoFlows) { participantEnabledPairs ->
participantEnabledPairs
.filter { (_, isEnabled) -> isEnabled }
.map { (participant, _) -> participant }
}
}.flatMapLatest { participantWithVideo ->
participantWithVideo.firstOrNull()?.video ?: flow { emit(null) }
}, rendererContent: @Composable BoxScope.(Call) -> Unit = defaultRenderer, overlayContent: @Composable BoxScope.(Call) -> Unit = defaultLivestreamPlayerOverlay, liveStreamEndedContent: @Composable BoxScope.(Call) -> Unit = {
LivestreamEndedUi(call)
}, liveStreamHostVideoNotAvailableContent: @Composable BoxScope.(Call) -> Unit = {
HostVideoNotAvailableUi(call)
}, liveStreamErrorContent: @Composable BoxScope.(Call, () -> Unit) -> Unit = { _, retryJoin ->
LivestreamErrorUi(call, retryJoin)
}, onRetryJoin: () -> Unit = {}) Renders a livestream video player UI based on the current state of the provided call.
This composable adapts its content based on the livestreamState, displaying backstage, live, ended, or error views accordingly. It supports pause/resume controls, retry logic, and customizable UI slots for various livestream stages.
Parameters
Modifier used to style the livestream container.
The call instance providing state and media tracks for rendering.
Whether the livestream video can be paused and resumed by the viewer.
Callback to observe pause/resume interactions.
UI shown when the host hasn't started the livestream.
Configuration for how the video is rendered internally.
A Flow emitting the video track of the host or primary speaker.
UI responsible for rendering the host’s video stream.
UI layered on top of the video for participant counts, controls, etc.
UI shown when the livestream has ended.
liveStreamHostVideoNotAvailableContent
UI shown when the host has no video available.
UI shown in case of an error joining or rendering the livestream.
Callback triggered when retrying to join the livestream after a failure.