Show a lobby screen in video rooms (#21746)

* No longer skip the prejoin screen in video rooms

* Enable joining with specific devices

* Start widget API listeners earlier

so that they're instantly ready for use, rather than being stuck behind
the config loading

* Revert "Start widget API listeners earlier"

This reverts commit 2c1bb08832a77fe9f981a24f8349fd707214eb0a.

* Tell the client when the Jitsi wrapper is ready to receive events

* Fix video rooms getting stuck on Jitsi Meet's prejoin screen
This commit is contained in:
Robin 2022-04-20 11:03:28 -04:00 committed by GitHub
parent ff89eef01a
commit b41e215112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,7 +127,7 @@ const ack = (ev: CustomEvent<IWidgetApiRequest>) => widgetApi.transport.reply(ev
const instanceConfig = new SnakedObject<IConfigOptions>((await configPromise) ?? <IConfigOptions>{}); const instanceConfig = new SnakedObject<IConfigOptions>((await configPromise) ?? <IConfigOptions>{});
const jitsiConfig = instanceConfig.get("jitsi_widget") ?? {}; const jitsiConfig = instanceConfig.get("jitsi_widget") ?? {};
skipOurWelcomeScreen = (new SnakedObject<IConfigOptions["jitsi_widget"]>(jitsiConfig)) skipOurWelcomeScreen = (new SnakedObject<IConfigOptions["jitsi_widget"]>(jitsiConfig))
.get("skip_built_in_welcome_screen") || isVideoChannel; .get("skip_built_in_welcome_screen") ?? false;
// Either reveal the prejoin screen, or skip straight to Jitsi depending on the config. // Either reveal the prejoin screen, or skip straight to Jitsi depending on the config.
// We don't set up the call yet though as this might lead to failure without the widget API. // We don't set up the call yet though as this might lead to failure without the widget API.
@ -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);
}, },
); );
@ -211,6 +212,13 @@ const ack = (ev: CustomEvent<IWidgetApiRequest>) => widgetApi.transport.reply(ev
} }
enableJoinButton(); // always enable the button enableJoinButton(); // always enable the button
// Inform the client that we're ready to receive events
try {
await widgetApi?.transport.send(ElementWidgetActions.WidgetReady, {});
} catch (e) {
logger.error(e);
}
} catch (e) { } catch (e) {
logger.error("Error setting up Jitsi widget", e); logger.error("Error setting up Jitsi widget", e);
document.getElementById("widgetActionContainer").innerText = "Failed to load Jitsi widget"; document.getElementById("widgetActionContainer").innerText = "Failed to load Jitsi widget";
@ -293,7 +301,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 +327,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,15 +339,17 @@ function joinConference() { // event handler bound in HTML
}, },
configOverwrite: { configOverwrite: {
startAudioOnly, startAudioOnly,
startWithAudioMuted: !audioDevice,
startWithVideoMuted: !videoDevice,
} as any, } as any,
jwt: jwt, jwt: jwt,
}; };
// Video channel widgets need some more tailored config options // Video channel widgets need some more tailored config options
if (isVideoChannel) { if (isVideoChannel) {
// Ensure that we start on Jitsi Meet's native prejoin screen, for // Ensure that we skip Jitsi Meet's native prejoin screen, for
// deployments that skip straight to the conference by default // deployments that have it enabled
options.configOverwrite.prejoinConfig = { enabled: true }; options.configOverwrite.prejoinConfig = { enabled: false };
// Use a simplified set of toolbar buttons // Use a simplified set of toolbar buttons
options.configOverwrite.toolbarButtons = [ options.configOverwrite.toolbarButtons = [
"microphone", "camera", "desktop", "tileview", "hangup", "microphone", "camera", "desktop", "tileview", "hangup",