Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(hangup): destroy local tracks on conference leave (#2546)

virtuacoplenny5a45b528817c
diff --git a/conference.js b/conference.js
index a2d0c46b00..b04d498401 100644
--- a/conference.js
+++ b/conference.js
@@ -2645,6 +2645,7 @@ export default {
*/
hangup(requestFeedback = false) {
eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
+ APP.UI.removeLocalMedia();
let requestFeedbackPromise;
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 4dd50e0598..c6f5ef4b16 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -28,6 +28,7 @@ import {
participantPresenceChanged,
showParticipantJoinedNotification
} from '../../react/features/base/participants';
+import { destroyLocalTracks } from '../../react/features/base/tracks';
import { openDisplayNamePrompt } from '../../react/features/display-name';
import {
setNotificationsEnabled,
@@ -376,15 +377,6 @@ UI.start = function() {
document.title = interfaceConfig.APP_NAME;
};
-/**
- * Invokes cleanup of any deferred execution within relevant UI modules.
- *
- * @returns {void}
- */
-UI.stopDaemons = () => {
- VideoLayout.resetLargeVideo();
-};
-
/**
* Setup some UI event listeners.
*/
@@ -1291,6 +1283,18 @@ UI.setLocalRemoteControlActiveChanged = function() {
VideoLayout.setLocalRemoteControlActiveChanged();
};
+/**
+ * Remove media tracks and UI elements so the user no longer sees media in the
+ * UI. The intent is to provide a feeling that the meeting has ended.
+ *
+ * @returns {void}
+ */
+UI.removeLocalMedia = function() {
+ APP.store.dispatch(destroyLocalTracks());
+ VideoLayout.resetLargeVideo();
+ $('#videospace').hide();
+};
+
// TODO: Export every function separately. For now there is no point of doing
// this because we are importing everything.
export default UI;
diff --git a/react/features/conference/components/Conference.web.js b/react/features/conference/components/Conference.web.js
index 0ecbbcc5e8..6a117d35b7 100644
--- a/react/features/conference/components/Conference.web.js
+++ b/react/features/conference/components/Conference.web.js
@@ -87,7 +87,6 @@ class Conference extends Component<Props> {
* @inheritdoc
*/
componentWillUnmount() {
- APP.UI.stopDaemons();
APP.UI.unregisterListeners();
APP.UI.unbindEvents();