diff --git a/conference.js b/conference.js index 808a6b806..1657f3332 100644 --- a/conference.js +++ b/conference.js @@ -1702,11 +1702,7 @@ export default { _setupListeners() { // add local streams when joined to the conference room.on(JitsiConferenceEvents.CONFERENCE_JOINED, () => { - APP.store.dispatch(conferenceJoined(room)); - - APP.UI.mucJoined(); - APP.API.notifyConferenceJoined(APP.conference.roomName); - APP.UI.markVideoInterrupted(false); + this._onConferenceJoined(); }); room.on( @@ -2334,6 +2330,62 @@ export default { }); }, + /** + * Callback invoked when the conference has been successfully joined. + * Initializes the UI and various other features. + * + * @private + * @returns {void} + */ + _onConferenceJoined() { + if (APP.logCollector) { + // Start the LogCollector's periodic "store logs" task + APP.logCollector.start(); + APP.logCollectorStarted = true; + + // Make an attempt to flush in case a lot of logs have been + // cached, before the collector was started. + APP.logCollector.flush(); + + // This event listener will flush the logs, before + // the statistics module (CallStats) is stopped. + // + // NOTE The LogCollector is not stopped, because this event can + // be triggered multiple times during single conference + // (whenever statistics module is stopped). That includes + // the case when Jicofo terminates the single person left in the + // room. It will then restart the media session when someone + // eventually join the room which will start the stats again. + APP.conference.addConferenceListener( + JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED, + () => { + if (APP.logCollector) { + APP.logCollector.flush(); + } + } + ); + } + + APP.UI.initConference(); + + APP.UI.addListener( + UIEvents.LANG_CHANGED, + language => APP.translation.setLanguage(language)); + + APP.keyboardshortcut.init(); + + if (config.requireDisplayName + && !APP.conference.getLocalDisplayName()) { + APP.UI.promptDisplayName(); + } + + APP.store.dispatch(conferenceJoined(room)); + + APP.UI.mucJoined(); + APP.API.notifyConferenceJoined(APP.conference.roomName); + APP.UI.markVideoInterrupted(false); + }, + /** * Adds any room listener. * @param {string} eventName one of the JitsiConferenceEvents diff --git a/react/features/base/connection/actions.web.js b/react/features/base/connection/actions.web.js index 6afd213f7..7635391e9 100644 --- a/react/features/base/connection/actions.web.js +++ b/react/features/base/connection/actions.web.js @@ -3,12 +3,10 @@ import type { Dispatch } from 'redux'; import { - JitsiConferenceEvents, libInitError, WEBRTC_NOT_READY, WEBRTC_NOT_SUPPORTED } from '../lib-jitsi-meet'; -import UIEvents from '../../../../service/UI/UIEvents'; declare var APP: Object; declare var config: Object; @@ -35,48 +33,7 @@ export function connect() { // XXX For web based version we use conference initialization logic // from the old app (at the moment of writing). - return APP.conference.init({ roomName: room }).then(() => { - if (APP.logCollector) { - // Start the LogCollector's periodic "store logs" task - APP.logCollector.start(); - APP.logCollectorStarted = true; - - // Make an attempt to flush in case a lot of logs have been - // cached, before the collector was started. - APP.logCollector.flush(); - - // This event listener will flush the logs, before - // the statistics module (CallStats) is stopped. - // - // NOTE The LogCollector is not stopped, because this event can - // be triggered multiple times during single conference - // (whenever statistics module is stopped). That includes - // the case when Jicofo terminates the single person left in the - // room. It will then restart the media session when someone - // eventually join the room which will start the stats again. - APP.conference.addConferenceListener( - JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED, - () => { - if (APP.logCollector) { - APP.logCollector.flush(); - } - } - ); - } - - APP.UI.initConference(); - - APP.UI.addListener( - UIEvents.LANG_CHANGED, - language => APP.translation.setLanguage(language)); - - APP.keyboardshortcut.init(); - - if (config.requireDisplayName - && !APP.conference.getLocalDisplayName()) { - APP.UI.promptDisplayName(); - } - }) + return APP.conference.init({ roomName: room }) .catch(error => { APP.API.notifyConferenceLeft(APP.conference.roomName); logger.error(error);