Skip to content

Commit afe2ac2

Browse files
authored
Add API params to mute audio and/or video in Jitsi calls by default (#24820)
Signed-off-by: Dominik Henneke <[email protected]>
1 parent 4a18ab6 commit afe2ac2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/vector/jitsi/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ let roomId: string;
5555
let openIdToken: IOpenIDCredentials;
5656
let roomName: string;
5757
let startAudioOnly: boolean;
58+
let startWithAudioMuted: boolean | undefined;
59+
let startWithVideoMuted: boolean | undefined;
5860
let isVideoChannel: boolean;
5961
let supportsScreensharing: boolean;
6062
let language: string;
@@ -80,6 +82,13 @@ const setupCompleted = (async (): Promise<string | void> => {
8082
}
8183
return vals[0];
8284
};
85+
const parseBooleanOrUndefined = (value: string | undefined): boolean | undefined => {
86+
if (value === undefined) {
87+
return undefined;
88+
}
89+
90+
return value === "true";
91+
};
8392

8493
// If we have these params, expect a widget API to be available (ie. to be in an iframe
8594
// inside a matrix client). Otherwise, assume we're on our own, eg. have been popped
@@ -197,6 +206,8 @@ const setupCompleted = (async (): Promise<string | void> => {
197206
roomId = qsParam("roomId", true);
198207
roomName = qsParam("roomName", true);
199208
startAudioOnly = qsParam("isAudioOnly", true) === "true";
209+
startWithAudioMuted = parseBooleanOrUndefined(qsParam("startWithAudioMuted", true));
210+
startWithVideoMuted = parseBooleanOrUndefined(qsParam("startWithVideoMuted", true));
200211
isVideoChannel = qsParam("isVideoChannel", true) === "true";
201212
supportsScreensharing = qsParam("supportsScreensharing", true) === "true";
202213

@@ -388,8 +399,8 @@ function joinConference(audioInput?: string | null, videoInput?: string | null):
388399
configOverwrite: {
389400
subject: roomName,
390401
startAudioOnly,
391-
startWithAudioMuted: audioInput === null,
392-
startWithVideoMuted: videoInput === null,
402+
startWithAudioMuted: audioInput === null ? true : startWithAudioMuted,
403+
startWithVideoMuted: videoInput === null ? true : startWithVideoMuted,
393404
// Request some log levels for inclusion in rageshakes
394405
// Ideally we would capture all possible log levels, but this can
395406
// cause Jitsi Meet to try to post various circular data structures

0 commit comments

Comments
 (0)