Fix / prevent camera switch if no second camera

This commit is contained in:
Valere 2020-06-20 09:50:32 +02:00
parent 64a67b57b8
commit 6b806922ee
1 changed files with 3 additions and 2 deletions

View File

@ -736,6 +736,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
fun switchCamera() { fun switchCamera() {
Timber.v("## VOIP switchCamera") Timber.v("## VOIP switchCamera")
if (!canSwitchCamera()) return
if (currentCall != null && currentCall?.mxCall?.state is CallState.Connected && currentCall?.mxCall?.isVideoCall == true) { if (currentCall != null && currentCall?.mxCall?.state is CallState.Connected && currentCall?.mxCall?.isVideoCall == true) {
videoCapturer?.switchCamera(object : CameraVideoCapturer.CameraSwitchHandler { videoCapturer?.switchCamera(object : CameraVideoCapturer.CameraSwitchHandler {
// Invoked on success. |isFrontCamera| is true if the new camera is front facing. // Invoked on success. |isFrontCamera| is true if the new camera is front facing.