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.
This commit is contained in:
virtuacoplenny 2018-03-01 15:47:46 -08:00 committed by bbaldino
parent ce6e8472f0
commit 5a45b52881
3 changed files with 14 additions and 10 deletions

View File

@ -2645,6 +2645,7 @@ export default {
*/ */
hangup(requestFeedback = false) { hangup(requestFeedback = false) {
eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP); eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
APP.UI.removeLocalMedia();
let requestFeedbackPromise; let requestFeedbackPromise;

View File

@ -28,6 +28,7 @@ import {
participantPresenceChanged, participantPresenceChanged,
showParticipantJoinedNotification showParticipantJoinedNotification
} from '../../react/features/base/participants'; } from '../../react/features/base/participants';
import { destroyLocalTracks } from '../../react/features/base/tracks';
import { openDisplayNamePrompt } from '../../react/features/display-name'; import { openDisplayNamePrompt } from '../../react/features/display-name';
import { import {
setNotificationsEnabled, setNotificationsEnabled,
@ -376,15 +377,6 @@ UI.start = function() {
document.title = interfaceConfig.APP_NAME; 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. * Setup some UI event listeners.
*/ */
@ -1291,6 +1283,18 @@ UI.setLocalRemoteControlActiveChanged = function() {
VideoLayout.setLocalRemoteControlActiveChanged(); 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 // TODO: Export every function separately. For now there is no point of doing
// this because we are importing everything. // this because we are importing everything.
export default UI; export default UI;

View File

@ -87,7 +87,6 @@ class Conference extends Component<Props> {
* @inheritdoc * @inheritdoc
*/ */
componentWillUnmount() { componentWillUnmount() {
APP.UI.stopDaemons();
APP.UI.unregisterListeners(); APP.UI.unregisterListeners();
APP.UI.unbindEvents(); APP.UI.unbindEvents();