Skip to content

Conversation

jeanfbrito
Copy link
Collaborator

@jeanfbrito jeanfbrito commented May 23, 2025

Automatically close video call window when Jitsi call ends

This PR implements automatic detection of Jitsi call termination to close the video call window gracefully.

What it does:

  • Monitors URL navigation events in the video call webview
  • Detects when the URL contains "close" (indicating the call has ended)
  • Automatically triggers the video-call-window/close-requested IPC handler
  • Properly closes the video call window when Jitsi redirects to a "close" page

Technical implementation:

  • Adds a did-navigate event listener to the webview in videoCallWindow.tsx
  • Implements checkForClosePage() function that inspects navigation URLs
  • Leverages existing IPC infrastructure (video-call-window/close-requested) for clean window closure

Benefits:

  • Improves user experience by eliminating manually having to close the video call window
  • Prevents orphaned video call windows after Jitsi calls end
  • Uses Jitsi's standard redirect behavior to detect call termination
Screen.Recording.2025-05-23.at.4.52.33.PM.mov

Closes: #2649 #2631 #2633
Related: SUP-770

@jeanfbrito
Copy link
Collaborator Author

Here's a summary of the changes that were made to get the Jitsi call window to close automatically after a call ends:

  1. Enable the Close Page Feature in Jitsi Meet Configuration:

    • File Modified: /etc/jitsi/meet/jitsi.server.com-config.js (the main configuration file for your Jitsi domain).
    • Change Made: The setting enableClosePage was changed from its default (or commented out) state to true.
      // ... other configurations ...
      enableClosePage: true,
      // ... other configurations ...
    • Reason: This was the most critical step. This configuration tells the Jitsi Meet application to navigate to a specific HTML page (in this case, static/close2.html) when a conference ends, rather than redirecting to the main welcome page or handling the hangup differently. Without this, the custom "close page" logic wouldn't be triggered.
  2. Add window.close() to the Close Page JavaScript:

    • File Modified: /usr/share/jitsi-meet/static/close.js
    • Change Made: The window.close(); command was added to the end of the onLoad() function.
      // ... inside close.js ...
      function onLoad() {
          // ... original code to display messages ...
          insertTextMsg('hintMessage', getHint()); // Or similar last original line
          window.close(); // This line was added
      }
      window.onload = onLoad;
    • Reason: This JavaScript command is what actually instructs the browser to attempt to close the current window or tab. It's executed when the "close page" (close2.html) loads.
  3. Restart Jitsi Services:

    • Command Used: systemctl restart prosody jicofo jitsi-videobridge2
    • Reason: To ensure that all configuration changes (especially to jitsi.server.com-config.js) were loaded and applied by the Jitsi services.

The key was realizing that Jitsi Meet needed to be explicitly configured via enableClosePage: true to even use the close2.html page where the window.close() JavaScript was placed.

It was a bit of a deep dive, but we got there!

@jeanfbrito jeanfbrito marked this pull request as ready for review May 23, 2025 20:08
Copy link

Windows installer download

Copy link

Copy link

@jeanfbrito jeanfbrito merged commit af11ebe into master May 29, 2025
10 checks passed
@jeanfbrito jeanfbrito deleted the feat-close-video-call branch May 29, 2025 15:42
@moell9
Copy link

moell9 commented Jun 3, 2025

What does this feature mean ?
In both cases, will the sessions still only end completely after 24 hours? At least that would be the expectation that you can end the session completely and a join is then no longer possible.

@jeanfbrito
Copy link
Collaborator Author

What does this feature mean ? In both cases, will the sessions still only end completely after 24 hours? At least that would be the expectation that you can end the session completely and a join is then no longer possible.

What did you not understand? About session is up to the server administrator configure the Jitsi server. Its only the desktop app client behaviour that changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants