Enable joining with specific devices

pull/21746/head
Robin Townsend 2022-04-11 13:10:55 -04:00
parent d0c5730b9b
commit 6d117202b3
1 changed files with 10 additions and 2 deletions

View File

@ -145,7 +145,8 @@ const ack = (ev: CustomEvent<IWidgetApiRequest>) => widgetApi.transport.reply(ev
widgetApi.on(`action:${ElementWidgetActions.JoinCall}`, widgetApi.on(`action:${ElementWidgetActions.JoinCall}`,
(ev: CustomEvent<IWidgetApiRequest>) => { (ev: CustomEvent<IWidgetApiRequest>) => {
joinConference(); const { audioDevice, videoDevice } = ev.detail.data;
joinConference(audioDevice as string, videoDevice as string);
ack(ev); 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; let jwt;
if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) { if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) {
if (!openIdToken?.access_token) { // eslint-disable-line camelcase if (!openIdToken?.access_token) { // eslint-disable-line camelcase
@ -318,6 +320,10 @@ function joinConference() { // event handler bound in HTML
height: "100%", height: "100%",
parentNode: document.querySelector("#jitsiContainer"), parentNode: document.querySelector("#jitsiContainer"),
roomName: conferenceId, roomName: conferenceId,
devices: {
audioInput: audioDevice,
videoInput: videoDevice,
},
interfaceConfigOverwrite: { interfaceConfigOverwrite: {
SHOW_JITSI_WATERMARK: false, SHOW_JITSI_WATERMARK: false,
SHOW_WATERMARK_FOR_GUESTS: false, SHOW_WATERMARK_FOR_GUESTS: false,
@ -326,6 +332,8 @@ function joinConference() { // event handler bound in HTML
}, },
configOverwrite: { configOverwrite: {
startAudioOnly, startAudioOnly,
startWithAudioMuted: !audioDevice,
startWithVideoMuted: !videoDevice,
} as any, } as any,
jwt: jwt, jwt: jwt,
}; };