diff --git a/src/UrlParams.ts b/src/UrlParams.ts index 27b99cce..3ce5ab29 100644 --- a/src/UrlParams.ts +++ b/src/UrlParams.ts @@ -84,6 +84,10 @@ export interface UrlParams { * user's homeserver doesn't provide any. */ allowIceFallback: boolean; + /** + * Whether the app is allowed screen share only mode + */ + allowVoipWithNoMedia: boolean; } /** @@ -141,6 +145,7 @@ export const getUrlParams = ( fontScale: Number.isNaN(fontScale) ? null : fontScale, analyticsID: getParam("analyticsID"), allowIceFallback: hasParam("allowIceFallback"), + allowVoipWithNoMedia: hasParam("allowVoipWithNoMedia"), }; }; diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index b0c93b7e..ac858a19 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -102,12 +102,17 @@ export function GroupCallView({ // Get the available devices so we can match the selected device // to its ID. This involves getting a media stream (see docs on // the function) so we only do it once and re-use the result. - const devices = await getNamedDevices(); + // + // But we only want to preload the devices if we get audio or video devices included in the widget request! + // By default, the device list is null! + let devices: MediaDeviceInfo[] | null = null; const { audioInput, videoInput } = ev.detail .data as unknown as JoinCallData; if (audioInput !== null) { + // we load the devices because w have an audio device in the widget request + devices = await getNamedDevices(); const deviceId = await findDeviceByName( audioInput, "audioinput", @@ -124,6 +129,11 @@ export function GroupCallView({ } if (videoInput !== null) { + // we only need to load the devices once time + if (devices === null) { + // we load the devices because w have a video device in the widget request + devices = await getNamedDevices(); + } const deviceId = await findDeviceByName( videoInput, "videoinput", diff --git a/src/widget.ts b/src/widget.ts index 0bee23f0..64822839 100644 --- a/src/widget.ts +++ b/src/widget.ts @@ -108,6 +108,7 @@ export const widget: WidgetHelpers | null = (() => { baseUrl, e2eEnabled, allowIceFallback, + allowVoipWithNoMedia, } = getUrlParams(); if (!roomId) throw new Error("Room ID must be supplied"); if (!userId) throw new Error("User ID must be supplied"); @@ -156,6 +157,7 @@ export const widget: WidgetHelpers | null = (() => { timelineSupport: true, useE2eForGroupCall: e2eEnabled, fallbackICEServerAllowed: allowIceFallback, + isVoipWithNoMediaAllowed: allowVoipWithNoMedia, } ); const clientPromise = client.startClient().then(() => client);