From 9cb0185ec2d086b5063a12105e8ba3f58d20123c Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 5 May 2022 05:51:00 -0400 Subject: [PATCH] Fully close Jitsi conferences on errors (#22060) By not closing Jitsi fully when an error occurs, it could get stuck in PiP mode with no way to dismiss. --- src/vector/jitsi/index.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 42d4fa7480..fc3f78e20e 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -301,6 +301,15 @@ async function notifyHangup() { } } +function closeConference() { + switchVisibleContainers(); + document.getElementById("jitsiContainer").innerHTML = ""; + + if (skipOurWelcomeScreen) { + skipToJitsiSplashScreen(); + } +} + // event handler bound in HTML function joinConference(audioDevice?: string, videoDevice?: string) { let jwt; @@ -386,20 +395,15 @@ function joinConference(audioDevice?: string, videoDevice?: string) { meetApi = null; }); - meetApi.on("readyToClose", () => { - switchVisibleContainers(); - document.getElementById("jitsiContainer").innerHTML = ""; - - if (skipOurWelcomeScreen) { - skipToJitsiSplashScreen(); - } - }); + meetApi.on("readyToClose", closeConference); meetApi.on("errorOccurred", ({ error }) => { if (error.isFatal) { // We got disconnected. Since Jitsi Meet might send us back to the // prejoin screen, we're forced to act as if we hung up entirely. notifyHangup(); + meetApi = null; + closeConference(); } });