Skip to content

Commit

Permalink
Fully close Jitsi conferences on errors (#22060)
Browse files Browse the repository at this point in the history
By not closing Jitsi fully when an error occurs, it could get stuck in
PiP mode with no way to dismiss.
  • Loading branch information
robintown authored May 5, 2022
1 parent abb31c9 commit 9cb0185
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/vector/jitsi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
});

Expand Down

0 comments on commit 9cb0185

Please sign in to comment.