From 3961e794912255f2fd660ffb0861c26037ccf417 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 13 Apr 2020 10:31:21 +0200 Subject: [PATCH] Invert condition --- assets/js/components/calls/window.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 3b739bfd..b9924414 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -109,10 +109,11 @@ class CallWindow extends CustomEvents { // Display the list of buttons const buttonsList = [ - // Toggle current user camera + // Toggle current user camera visibility { icon: "fa-eye", - selected: true, + selected: false, + label: "toggle-camera-visibility", onclick: (btn) => { setButtonSelected(btn, this.toggleMainStreamVisibility()) } @@ -205,6 +206,9 @@ class CallWindow extends CustomEvents { ) } + this.on("localVideo", () => { + setButtonSelected(bottomArea.querySelector("[data-label=\"toggle-camera-visibility\"]"), true) + }) @@ -493,7 +497,7 @@ class CallWindow extends CustomEvents { const el = this.videoEls.get(userID()) if(!el || el.nodeName !== "VIDEO") - return true; + return false; // Show again element if(el.parentNode.style.display == "none") { @@ -542,11 +546,16 @@ class CallWindow extends CustomEvents { this.videoEls.set(peerID, videoEl) - // Show user name if(isVideo) { + // Show user name const userName = (await user(peerID)).fullName videoEl.title = userName } + + if(isVideo && peerID == userID()) { + // Emit an event + this.emitEvent("localVideo") + } } /**