From f706b0174e139024805c3889cf4d572f7e716b6d Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 6 Jul 2022 16:37:26 +0200 Subject: [PATCH] Add jitsi_widget.force_always_on_screen --- docs/config.md | 15 ++++++++++----- src/vector/jitsi/index.ts | 9 +++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/config.md b/docs/config.md index 6bcb1b6f93..7564948819 100644 --- a/docs/config.md +++ b/docs/config.md @@ -261,15 +261,20 @@ The VoIP and Jitsi options are: } } ``` -2. `jitsi_widget`: Optional configuration for the built-in Jitsi widget. Currently can only contain a single `skip_built_in_welcome_screen` - value, denoting whether the "Join Conference" button should be shown. When `true` (default `false`), Jitsi calls will skip to - the call instead of having a screen with a single button on it. This is most useful if the Jitsi instance being used already - has a landing page for users to test audio and video before joining the call, otherwise users will automatically join the call. +2. `jitsi_widget`: Optional configuration for the built-in Jitsi widget. It supports the following `skip_built_in_welcome_screen` + customisations: `skip_built_in_welcome_screen` denoting whether the "Join Conference" button should be shown. + When `true` (default `false`), Jitsi calls will skip to the call instead of having a screen with a single button on it. + This is most useful if the Jitsi instance being used already has a landing page for users to test audio and video before + joining the call, otherwise users will automatically join the call. + `force_always_on_screen` whether the Jitsi widget should be displayed in picture-in-picture mode even if no conference + has been joined yet. This can be useful for environments that require authentication where users often click away before + entering their credentials. For example: ```json { "jitsi_widget": { - "skip_built_in_welcome_screen": true + "skip_built_in_welcome_screen": true, + "force_always_on_screen": true } } ``` diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 8af13ee255..b01f0d0548 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -56,6 +56,7 @@ let isVideoChannel: boolean; let widgetApi: WidgetApi; let meetApi: any; // JitsiMeetExternalAPI let skipOurWelcomeScreen = false; +let forceAlwaysOnScreen = false; const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev.detail, {}); @@ -126,8 +127,9 @@ const ack = (ev: CustomEvent) => widgetApi.transport.reply(ev // We've reached the point where we have to wait for the config, so do that then parse it. const instanceConfig = new SnakedObject((await configPromise) ?? {}); const jitsiConfig = instanceConfig.get("jitsi_widget") ?? {}; - skipOurWelcomeScreen = (new SnakedObject(jitsiConfig)) - .get("skip_built_in_welcome_screen") ?? false; + const jitsiWidgetConfig = (new SnakedObject(jitsiConfig)); + skipOurWelcomeScreen = jitsiWidgetConfig.get("skip_built_in_welcome_screen") ?? false; + forceAlwaysOnScreen = jitsiWidgetConfig.get("force_always_on_screen") ?? false; // 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. @@ -432,6 +434,9 @@ function joinConference(audioDevice?: string | null, videoDevice?: string | null // Patch logs into rageshakes meetApi.on("log", onLog); + if (forceAlwaysOnScreen) { + widgetApi.setAlwaysOnScreen(true); + } } const onVideoConferenceJoined = () => {