From 96b1a5f2965e6e39f58cf9c148fd2f202d7ed5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 14 Oct 2022 16:17:50 +0200 Subject: [PATCH] hideScreensharing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/UrlParams.ts | 3 +++ src/room/InCallView.tsx | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/UrlParams.ts b/src/UrlParams.ts index 84e2312..7090019 100644 --- a/src/UrlParams.ts +++ b/src/UrlParams.ts @@ -29,6 +29,8 @@ export interface UrlParams { preload: boolean; // Whether to hide the room header when in a call hideHeader: boolean; + // Whether to hide the screen-sharing button + hideScreensharing: boolean; // Whether to start a walkie-talkie call instead of a video call isPtt: boolean; // Whether to use end-to-end encryption @@ -84,6 +86,7 @@ export const getUrlParams = ( isEmbedded: hasParam("embed"), preload: hasParam("preload"), hideHeader: hasParam("hideHeader"), + hideScreensharing: hasParam("hideScreensharing"), isPtt: hasParam("ptt"), e2eEnabled: getParam("enableE2e") !== "false", // Defaults to true userId: getParam("userId"), diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 03c95fd..c1710e2 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -57,6 +57,7 @@ import { useFullscreen } from "../video-grid/useFullscreen"; import { AudioContainer } from "../video-grid/AudioContainer"; import { useAudioOutputDevice } from "../video-grid/useAudioOutputDevice"; import { widget, ElementWidgetActions } from "../widget"; +import { useUrlParams } from "../UrlParams"; const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); // There is currently a bug in Safari our our code with cloning and sending MediaStreams @@ -141,6 +142,8 @@ export function InCallView({ useAudioOutputDevice(audioRef, audioOutput); + const { hideScreensharing } = useUrlParams(); + useEffect(() => { widget?.api.transport.send( layout === "freedom" @@ -329,12 +332,15 @@ export function InCallView({
- {canScreenshare && !isSafari && !reducedControls && ( - - )} + {canScreenshare && + !hideScreensharing && + !isSafari && + !reducedControls && ( + + )} {!reducedControls && (