ParticipantLabel
fun BoxScope.ParticipantLabel(call: Call, participant: ParticipantState, labelPosition: Alignment = BottomStart, soundIndicatorContent: @Composable RowScope.() -> Unit = {
val audioEnabled by participant.audioEnabled.collectAsStateWithLifecycle()
val audioLevel by if (participant.isLocal) {
call.localMicrophoneAudioLevel.collectAsStateWithLifecycle()
} else {
participant.audioLevel.collectAsStateWithLifecycle()
}
SoundIndicator(
// we always draw the audio indicator for the local participant for lower delay
// and for now don't draw the indicator for other participants due to the lag
// (so we ingore participant.isSpeaking)
isSpeaking = participant.isLocal,
isAudioEnabled = audioEnabled,
audioLevel = audioLevel,
modifier = Modifier
.align(CenterVertically)
.padding(
vertical = VideoTheme.dimens.spacingXs,
horizontal = VideoTheme.dimens.spacingS,
),
)
})
fun BoxScope.ParticipantLabel(nameLabel: String, isPinned: Boolean = false, labelPosition: Alignment = BottomStart, hasAudio: Boolean = false, isSpeaking: Boolean = false, audioLevel: Float = 0.0f, soundIndicatorContent: @Composable RowScope.() -> Unit = {
SoundIndicator(
isSpeaking = isSpeaking,
isAudioEnabled = hasAudio,
audioLevel = audioLevel,
modifier = Modifier
.align(CenterVertically)
.padding(horizontal = VideoTheme.dimens.spacingS),
)
})