From afe2ac2ae6643d69f37c75643c0548478faea905 Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Wed, 15 Mar 2023 13:50:39 +0100 Subject: [PATCH] Add API params to mute audio and/or video in Jitsi calls by default (#24820) Signed-off-by: Dominik Henneke --- src/vector/jitsi/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 4281b908f3..ae1868e702 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -55,6 +55,8 @@ let roomId: string; let openIdToken: IOpenIDCredentials; let roomName: string; let startAudioOnly: boolean; +let startWithAudioMuted: boolean | undefined; +let startWithVideoMuted: boolean | undefined; let isVideoChannel: boolean; let supportsScreensharing: boolean; let language: string; @@ -80,6 +82,13 @@ const setupCompleted = (async (): Promise => { } return vals[0]; }; + const parseBooleanOrUndefined = (value: string | undefined): boolean | undefined => { + if (value === undefined) { + return undefined; + } + + return value === "true"; + }; // If we have these params, expect a widget API to be available (ie. to be in an iframe // inside a matrix client). Otherwise, assume we're on our own, eg. have been popped @@ -197,6 +206,8 @@ const setupCompleted = (async (): Promise => { roomId = qsParam("roomId", true); roomName = qsParam("roomName", true); startAudioOnly = qsParam("isAudioOnly", true) === "true"; + startWithAudioMuted = parseBooleanOrUndefined(qsParam("startWithAudioMuted", true)); + startWithVideoMuted = parseBooleanOrUndefined(qsParam("startWithVideoMuted", true)); isVideoChannel = qsParam("isVideoChannel", true) === "true"; supportsScreensharing = qsParam("supportsScreensharing", true) === "true"; @@ -388,8 +399,8 @@ function joinConference(audioInput?: string | null, videoInput?: string | null): configOverwrite: { subject: roomName, startAudioOnly, - startWithAudioMuted: audioInput === null, - startWithVideoMuted: videoInput === null, + startWithAudioMuted: audioInput === null ? true : startWithAudioMuted, + startWithVideoMuted: videoInput === null ? true : startWithVideoMuted, // Request some log levels for inclusion in rageshakes // Ideally we would capture all possible log levels, but this can // cause Jitsi Meet to try to post various circular data structures