From 5a45b528817c07a192fd74584d36c7f4e0132c56 Mon Sep 17 00:00:00 2001 From: virtuacoplenny Date: Thu, 1 Mar 2018 15:47:46 -0800 Subject: [PATCH] fix(hangup): destroy local tracks on conference leave (#2546) The difference from this change and 88325ae is there is no attempt to do this in redux. This is the safer change in that the cleanup logic is known only to trigger on hangup. --- conference.js | 1 + modules/UI/UI.js | 22 +++++++++++-------- .../conference/components/Conference.web.js | 1 - 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/conference.js b/conference.js index a2d0c46b0..b04d49840 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 4dd50e059..c6f5ef4b1 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 0ecbbcc5e..6a117d35b 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 { * @inheritdoc */ componentWillUnmount() { - APP.UI.stopDaemons(); APP.UI.unregisterListeners(); APP.UI.unbindEvents();