Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created February 23, 2023 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/4609707e2e9755310192c1b66d2a4497 to your computer and use it in GitHub Desktop.
Save skydoves/4609707e2e9755310192c1b66d2a4497 to your computer and use it in GitHub Desktop.
video_controls
// Copyright 2023 Stream.IO, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
VideoCallControls(
modifier = Modifier
.fillMaxWidth()
.align(Alignment.BottomCenter),
callMediaState = callMediaState,
onCallAction = {
when (it) {
is CallAction.ToggleMicroPhone -> {
val enabled = callMediaState.isMicrophoneEnabled.not()
callMediaState = callMediaState.copy(isMicrophoneEnabled = enabled)
sessionManager.enableMicrophone(enabled)
}
is CallAction.ToggleCamera -> {
val enabled = callMediaState.isCameraEnabled.not()
callMediaState = callMediaState.copy(isCameraEnabled = enabled)
sessionManager.enableCamera(enabled)
}
CallAction.FlipCamera -> sessionManager.flipCamera()
CallAction.LeaveCall -> {
sessionManager.disconnect()
activity?.finish()
}
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment