Force to allow calls without video and audio in embedded mode (#1134)
* force to allow calls without video and audio in embedded mode
This commit is contained in:
@@ -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"),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user