From 6d117202b37f6d999c1d3208fc72a92a36e8677d Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Mon, 11 Apr 2022 13:10:55 -0400 Subject: [PATCH] Enable joining with specific devices --- src/vector/jitsi/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 3ac4d1d3fb..7a70421986 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -145,7 +145,8 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev widgetApi.on(`action:${ElementWidgetActions.JoinCall}`, (ev: CustomEvent) => { - joinConference(); + const { audioDevice, videoDevice } = ev.detail.data; + joinConference(audioDevice as string, videoDevice as string); ack(ev); }, ); @@ -293,7 +294,8 @@ async function notifyHangup() { } } -function joinConference() { // event handler bound in HTML +// event handler bound in HTML +function joinConference(audioDevice?: string, videoDevice?: string) { let jwt; if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) { if (!openIdToken?.access_token) { // eslint-disable-line camelcase @@ -318,6 +320,10 @@ function joinConference() { // event handler bound in HTML height: "100%", parentNode: document.querySelector("#jitsiContainer"), roomName: conferenceId, + devices: { + audioInput: audioDevice, + videoInput: videoDevice, + }, interfaceConfigOverwrite: { SHOW_JITSI_WATERMARK: false, SHOW_WATERMARK_FOR_GUESTS: false, @@ -326,6 +332,8 @@ function joinConference() { // event handler bound in HTML }, configOverwrite: { startAudioOnly, + startWithAudioMuted: !audioDevice, + startWithVideoMuted: !videoDevice, } as any, jwt: jwt, };