From fe2a6c2dfebb30bbaba3ba372648587b85f532c8 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 26 Jan 2019 11:40:39 +0100 Subject: [PATCH] Can hide local stream --- assets/css/components/calls/callWindow.css | 2 ++ assets/js/components/calls/callWindow.js | 38 +++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/assets/css/components/calls/callWindow.css b/assets/css/components/calls/callWindow.css index 6b905e5b..b84d2010 100644 --- a/assets/css/components/calls/callWindow.css +++ b/assets/css/components/calls/callWindow.css @@ -30,6 +30,7 @@ .call-window .call-window-body{ flex: 1; display: flex; + max-height: calc(100% - 62px); } @@ -85,6 +86,7 @@ .call-window .streams-target video { flex: 1; flex-shrink: 1; + max-height: 100%; } diff --git a/assets/js/components/calls/callWindow.js b/assets/js/components/calls/callWindow.js index c5016fa0..0c0444d3 100644 --- a/assets/js/components/calls/callWindow.js +++ b/assets/js/components/calls/callWindow.js @@ -37,6 +37,11 @@ ComunicWeb.components.calls.callWindow = { */ localStream: undefined, + /** + * @type {HTMLVideoElement} + */ + localStreamVideo: undefined, + /** * @type {SignalExchangerClient} */ @@ -118,6 +123,27 @@ ComunicWeb.components.calls.callWindow = { call.localStream.getVideoTracks()[0].enabled = enabled; } + /** + * Set local stream video visibility + * + * @param {Boolean} visible TRUE to make it visible / FALSE else + */ + call.setLocalStreamVisibility = function(visible){ + if(call.localStreamVideo) + call.localStreamVideo.style.display = visible ? "block" : "none"; + } + + /** + * Get local stream visibility + * + * @return {Boolean} TRUE if local stream is visible / FALSE else + */ + call.isLocalStreamVisible = function(){ + if(!call.localStreamVideo) + return true; + + return call.localStreamVideo.style.display !== "none"; + } /** @@ -280,6 +306,16 @@ ComunicWeb.components.calls.callWindow = { var buttonsList = [ + //Show current user camera + { + icon: "fa-eye", + selected: true, + onclick: function(btn){ + call.setLocalStreamVisibility(!call.isLocalStreamVisible()); + togglButtonSelectedStatus(btn, call.isLocalStreamVisible()); + } + }, + //Mute button { icon: "fa-microphone", @@ -434,7 +470,7 @@ ComunicWeb.components.calls.callWindow = { ComunicWeb.components.calls.callWindow.initializeConnectionToSignalingServer(call); //Add local stream to the list of visible stream - ComunicWeb.components.calls.callWindow.addVideoStream(call, true, stream); + call.localStreamVideo = ComunicWeb.components.calls.callWindow.addVideoStream(call, true, stream); //Mark as connecting call.setLoadingMessage("Connecting...");