From 3b97741afb8f6b072181c8da8e8a2417a6eb37be Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Mon, 20 Dec 2021 15:05:17 -0500
Subject: [PATCH] videoview: don't close the device when a video call is
 present

Gitlab: #627
Change-Id: I5d892fc49b1605984481c810dcd43994258c845d
---
 src/commoncomponents/PhotoboothView.qml     |  2 +-
 src/mainview/components/OngoingCallPage.qml | 16 ++++------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/commoncomponents/PhotoboothView.qml b/src/commoncomponents/PhotoboothView.qml
index bee3ea5cc..28599ecb6 100644
--- a/src/commoncomponents/PhotoboothView.qml
+++ b/src/commoncomponents/PhotoboothView.qml
@@ -46,7 +46,7 @@ Item {
 
     function stopBooth(){
         if (!AccountAdapter.hasVideoCall()) {
-        VideoDevices.stopDevice(preview.deviceId)
+            VideoDevices.stopDevice(preview.deviceId)
         }
         isPreviewing = false
     }
diff --git a/src/mainview/components/OngoingCallPage.qml b/src/mainview/components/OngoingCallPage.qml
index 1c9f9547f..b0c6d8b8f 100644
--- a/src/mainview/components/OngoingCallPage.qml
+++ b/src/mainview/components/OngoingCallPage.qml
@@ -33,7 +33,7 @@ Rectangle {
     id: root
 
     property var accountPeerPair: ["", ""]
-    property variant clickPos: "1,1"
+    property string clickPos: "1,1"
     property int previewMargin: 15
     property int previewMarginYTop: previewMargin + 42
     property int previewMarginYBottom: previewMargin + 84
@@ -44,14 +44,6 @@ Rectangle {
     property var linkedWebview: null
     property string callPreviewId: ""
 
-    onCallPreviewIdChanged: {
-        testLog("\n\n CHANGING CALLPREVIEWID" + root.callPreviewId + " " + previewRenderer.rendererId + " \n\n")
-    }
-
-    function testLog(txt) {
-        console.log(this, txt)
-    }
-
     color: "black"
 
     onAccountPeerPairChanged: {
@@ -194,7 +186,7 @@ Rectangle {
                     rendererId: root.callPreviewId
 
                     onVisibleChanged: {
-                        if (!visible) {
+                        if (!visible && !AccountAdapter.hasVideoCall()) {
                             VideoDevices.stopDevice(rendererId, true)
                         }
                     }
@@ -291,8 +283,8 @@ Rectangle {
 
                         function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted, isVideoMuted,
                                                  isSIP, isConferenceCall, isGrid, previewId) {
-                            if (previewId != "") {
-                                if (root.callPreviewId != previewId)
+                            if (previewId !== "") {
+                                if (root.callPreviewId !== previewId)
                                     VideoDevices.stopDevice(root.callPreviewId, true)
                                 VideoDevices.startDevice(previewId)
                             } else {
-- 
GitLab