Add jitsi_widget.force_always_on_screen

weeman1337/force_jitsi_on_screen
Michael Weimann 2022-07-06 16:37:26 +02:00
parent 2032668e3a
commit f706b0174e
No known key found for this signature in database
GPG Key ID: 53F535A266BB9584
2 changed files with 17 additions and 7 deletions

View File

@ -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
}
}
```

View File

@ -56,6 +56,7 @@ let isVideoChannel: boolean;
let widgetApi: WidgetApi;
let meetApi: any; // JitsiMeetExternalAPI
let skipOurWelcomeScreen = false;
let forceAlwaysOnScreen = false;
const ack = (ev: CustomEvent<IWidgetApiRequest>) => widgetApi.transport.reply(ev.detail, {});
@ -126,8 +127,9 @@ const ack = (ev: CustomEvent<IWidgetApiRequest>) => 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<IConfigOptions>((await configPromise) ?? <IConfigOptions>{});
const jitsiConfig = instanceConfig.get("jitsi_widget") ?? {};
skipOurWelcomeScreen = (new SnakedObject<IConfigOptions["jitsi_widget"]>(jitsiConfig))
.get("skip_built_in_welcome_screen") ?? false;
const jitsiWidgetConfig = (new SnakedObject<IConfigOptions["jitsi_widget"]>(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 = () => {