diff --git a/conference.js b/conference.js index 9f53cb2aa..f3824129e 100644 --- a/conference.js +++ b/conference.js @@ -35,7 +35,15 @@ import { import { updateDeviceList } from './react/features/base/devices'; import { isAnalyticsEnabled, - isFatalJitsiConnectionError + isFatalJitsiConnectionError, + JitsiConferenceErrors, + JitsiConferenceEvents, + JitsiConnectionErrors, + JitsiConnectionEvents, + JitsiMediaDevicesEvents, + JitsiParticipantConnectionStatus, + JitsiTrackErrors, + JitsiTrackEvents } from './react/features/base/lib-jitsi-meet'; import { isVideoMutedByUser, @@ -77,17 +85,6 @@ import { showDesktopSharingButton } from './react/features/toolbox'; -const { participantConnectionStatus } = JitsiMeetJS.constants; - -const ConnectionEvents = JitsiMeetJS.events.connection; -const ConnectionErrors = JitsiMeetJS.errors.connection; - -const ConferenceEvents = JitsiMeetJS.events.conference; -const ConferenceErrors = JitsiMeetJS.errors.conference; - -const TrackEvents = JitsiMeetJS.events.track; -const TrackErrors = JitsiMeetJS.errors.track; - const eventEmitter = new EventEmitter(); let room; @@ -123,7 +120,7 @@ const commands = { function connect(roomName) { return openConnection({retry: true, roomName: roomName}) .catch(function (err) { - if (err === ConnectionErrors.PASSWORD_REQUIRED) { + if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) { APP.UI.notifyTokenAuthFailed(); } else { APP.UI.notifyConnectionFailed(err); @@ -270,11 +267,11 @@ class ConferenceConnector { this._resolve = resolve; this._reject = reject; this.reconnectTimeout = null; - room.on(ConferenceEvents.CONFERENCE_JOINED, + room.on(JitsiConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined.bind(this)); - room.on(ConferenceEvents.CONFERENCE_FAILED, + room.on(JitsiConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed.bind(this)); - room.on(ConferenceEvents.CONFERENCE_ERROR, + room.on(JitsiConferenceEvents.CONFERENCE_ERROR, this._onConferenceError.bind(this)); } _handleConferenceFailed(err) { @@ -286,20 +283,20 @@ class ConferenceConnector { logger.error('CONFERENCE FAILED:', err, ...params); switch (err) { - case ConferenceErrors.CONNECTION_ERROR: { + case JitsiConferenceErrors.CONNECTION_ERROR: { let [msg] = params; APP.UI.notifyConnectionFailed(msg); break; } - case ConferenceErrors.NOT_ALLOWED_ERROR: { + case JitsiConferenceErrors.NOT_ALLOWED_ERROR: { // let's show some auth not allowed page assignWindowLocationPathname('static/authError.html'); break; } // not enough rights to create conference - case ConferenceErrors.AUTHENTICATION_REQUIRED: { + case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: { // Schedule reconnect to check if someone else created the room. this.reconnectTimeout = setTimeout(() => room.join(), 5000); @@ -311,21 +308,21 @@ class ConferenceConnector { break; } - case ConferenceErrors.RESERVATION_ERROR: { + case JitsiConferenceErrors.RESERVATION_ERROR: { let [code, msg] = params; APP.UI.notifyReservationError(code, msg); break; } - case ConferenceErrors.GRACEFUL_SHUTDOWN: + case JitsiConferenceErrors.GRACEFUL_SHUTDOWN: APP.UI.notifyGracefulShutdown(); break; - case ConferenceErrors.JINGLE_FATAL_ERROR: + case JitsiConferenceErrors.JINGLE_FATAL_ERROR: APP.UI.notifyInternalError(); break; - case ConferenceErrors.CONFERENCE_DESTROYED: { + case JitsiConferenceErrors.CONFERENCE_DESTROYED: { let [reason] = params; APP.UI.hideStats(); APP.UI.notifyConferenceDestroyed(reason); @@ -336,26 +333,26 @@ class ConferenceConnector { // What really happens there is that the library is not ready yet, // because Jicofo is not available, but it is going to give it another // try. - case ConferenceErrors.FOCUS_DISCONNECTED: { + case JitsiConferenceErrors.FOCUS_DISCONNECTED: { let [focus, retrySec] = params; APP.UI.notifyFocusDisconnected(focus, retrySec); break; } - case ConferenceErrors.FOCUS_LEFT: - case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: + case JitsiConferenceErrors.FOCUS_LEFT: + case JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: // FIXME the conference should be stopped by the library and not by // the app. Both the errors above are unrecoverable from the library // perspective. room.leave().then(() => connection.disconnect()); break; - case ConferenceErrors.CONFERENCE_MAX_USERS: + case JitsiConferenceErrors.CONFERENCE_MAX_USERS: connection.disconnect(); APP.UI.notifyMaxUsersLimitReached(); break; - case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS: + case JitsiConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS: reload(); break; @@ -366,7 +363,7 @@ class ConferenceConnector { _onConferenceError(err, ...params) { logger.error('CONFERENCE Error:', err, params); switch (err) { - case ConferenceErrors.CHAT_ERROR: + case JitsiConferenceErrors.CHAT_ERROR: logger.error("Chat error.", err); if (isButtonEnabled('chat')) { let [code, msg] = params; @@ -379,9 +376,9 @@ class ConferenceConnector { } _unsubscribe() { room.off( - ConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined); + JitsiConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined); room.off( - ConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed); + JitsiConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed); if (this.reconnectTimeout !== null) { clearTimeout(this.reconnectTimeout); } @@ -410,14 +407,14 @@ function disconnect() { /** * Handles CONNECTION_FAILED events from lib-jitsi-meet. * - * @param {JitsiMeetJS.connection.error} error - The reported error. + * @param {JitsiConnectionError} error - The reported error. * @returns {void} * @private */ function _connectionFailedHandler(error) { if (isFatalJitsiConnectionError(error)) { APP.connection.removeEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, _connectionFailedHandler); if (room) room.leave(); @@ -517,7 +514,7 @@ export default { } JitsiMeetJS.mediaDevices.addEventListener( - JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN, + JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN, browser => APP.store.dispatch( mediaPermissionPromptVisibilityChanged(true, browser)) @@ -686,7 +683,7 @@ export default { logger.log('initialized with %s local tracks', tracks.length); this._localTracksInitialized = true; con.addEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, _connectionFailedHandler); APP.connection = connection = con; @@ -1446,7 +1443,7 @@ export default { = this._turnScreenSharingOff .bind(this, didHaveVideo, wasVideoMuted); desktopStream.on( - TrackEvents.LOCAL_TRACK_STOPPED, + JitsiTrackEvents.LOCAL_TRACK_STOPPED, () => { // If the stream was stopped during screen sharing // session then we should switch back to video. @@ -1526,13 +1523,13 @@ export default { * @private */ _handleScreenSharingError(error) { - if (error.name === TrackErrors.CHROME_EXTENSION_USER_CANCELED) { + if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED) { return; } logger.error('failed to share local desktop', error); - if (error.name === TrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) { + if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) { // If start with screen sharing the extension will fail to install // (if not found), because the request has been triggered by the // script. Show a dialog which asks user to click "install" and try @@ -1544,7 +1541,7 @@ export default { ); return; - } else if (error.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) { + } else if (error.name === JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED) { APP.UI.showExtensionRequiredDialog( config.desktopSharingFirefoxExtensionURL ); @@ -1553,14 +1550,14 @@ export default { } // Handling: - // TrackErrors.PERMISSION_DENIED - // TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR - // TrackErrors.GENERAL + // JitsiTrackErrors.PERMISSION_DENIED + // JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR + // JitsiTrackErrors.GENERAL // and any other let dialogTxt; let dialogTitleKey; - if (error.name === TrackErrors.PERMISSION_DENIED) { + if (error.name === JitsiTrackErrors.PERMISSION_DENIED) { dialogTxt = APP.translation.generateTranslationHTML( "dialog.screenSharingPermissionDeniedError"); dialogTitleKey = "dialog.error"; @@ -1577,7 +1574,7 @@ export default { */ _setupListeners() { // add local streams when joined to the conference - room.on(ConferenceEvents.CONFERENCE_JOINED, () => { + room.on(JitsiConferenceEvents.CONFERENCE_JOINED, () => { APP.store.dispatch(conferenceJoined(room)); APP.UI.mucJoined(); @@ -1586,17 +1583,17 @@ export default { }); room.on( - ConferenceEvents.CONFERENCE_LEFT, + JitsiConferenceEvents.CONFERENCE_LEFT, (...args) => APP.store.dispatch(conferenceLeft(room, ...args))); room.on( - ConferenceEvents.AUTH_STATUS_CHANGED, + JitsiConferenceEvents.AUTH_STATUS_CHANGED, (authEnabled, authLogin) => APP.UI.updateAuthInfo(authEnabled, authLogin)); - room.on(ConferenceEvents.PARTCIPANT_FEATURES_CHANGED, + room.on(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED, user => APP.UI.onUserFeaturesChanged(user)); - room.on(ConferenceEvents.USER_JOINED, (id, user) => { + room.on(JitsiConferenceEvents.USER_JOINED, (id, user) => { if (user.isHidden()) return; @@ -1614,7 +1611,7 @@ export default { APP.UI.updateUserRole(user); }); - room.on(ConferenceEvents.USER_LEFT, (id, user) => { + room.on(JitsiConferenceEvents.USER_LEFT, (id, user) => { APP.store.dispatch(participantLeft(id, user)); logger.log('USER %s LEFT', id, user); APP.API.notifyUserLeft(id); @@ -1622,7 +1619,7 @@ export default { APP.UI.onSharedVideoStop(id); }); - room.on(ConferenceEvents.USER_STATUS_CHANGED, (id, status) => { + room.on(JitsiConferenceEvents.USER_STATUS_CHANGED, (id, status) => { APP.store.dispatch(participantPresenceChanged(id, status)); let user = room.getParticipantById(id); @@ -1631,7 +1628,7 @@ export default { } }); - room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => { + room.on(JitsiConferenceEvents.USER_ROLE_CHANGED, (id, role) => { if (this.isLocalId(id)) { logger.info(`My role changed, new role: ${role}`); @@ -1651,21 +1648,21 @@ export default { } }); - room.on(ConferenceEvents.TRACK_ADDED, (track) => { + room.on(JitsiConferenceEvents.TRACK_ADDED, (track) => { if (!track || track.isLocal()) return; APP.store.dispatch(trackAdded(track)); }); - room.on(ConferenceEvents.TRACK_REMOVED, (track) => { + room.on(JitsiConferenceEvents.TRACK_REMOVED, (track) => { if (!track || track.isLocal()) return; APP.store.dispatch(trackRemoved(track)); }); - room.on(ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => { + room.on(JitsiConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => { if (this.isLocalId(id) && this.localAudio && this.localAudio.isMuted()) { lvl = 0; @@ -1680,7 +1677,7 @@ export default { APP.UI.setAudioLevel(id, lvl); }); - room.on(ConferenceEvents.TALK_WHILE_MUTED, () => { + room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => { APP.UI.showToolbar(6000); APP.UI.showCustomToolbarPopup( @@ -1688,23 +1685,23 @@ export default { }); room.on( - ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, + JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (leavingIds, enteringIds) => APP.UI.handleLastNEndpoints(leavingIds, enteringIds)); room.on( - ConferenceEvents.P2P_STATUS, + JitsiConferenceEvents.P2P_STATUS, (jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p))); room.on( - ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, + JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, (id, connectionStatus) => { APP.store.dispatch(participantConnectionStatusChanged( id, connectionStatus)); APP.UI.participantConnectionStatusChanged(id); }); - room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => { + room.on(JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => { APP.store.dispatch(dominantSpeakerChanged(id)); if (this.isLocalId(id)) { @@ -1721,15 +1718,15 @@ export default { }); if (!interfaceConfig.filmStripOnly) { - room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => { + room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => { APP.UI.markVideoInterrupted(true); }); - room.on(ConferenceEvents.CONNECTION_RESTORED, () => { + room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => { APP.UI.markVideoInterrupted(false); }); if (isButtonEnabled('chat')) { - room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => { + room.on(JitsiConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => { let nick = getDisplayName(id); APP.API.notifyReceivedChatMessage({ id, @@ -1767,21 +1764,21 @@ export default { () => this._displayAudioOnlyTooltip('videoMute')); } - room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => { + room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => { APP.store.dispatch(localParticipantConnectionStatusChanged( - participantConnectionStatus.INTERRUPTED)); + JitsiParticipantConnectionStatus.INTERRUPTED)); APP.UI.showLocalConnectionInterrupted(true); }); - room.on(ConferenceEvents.CONNECTION_RESTORED, () => { + room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => { APP.store.dispatch(localParticipantConnectionStatusChanged( - participantConnectionStatus.ACTIVE)); + JitsiParticipantConnectionStatus.ACTIVE)); APP.UI.showLocalConnectionInterrupted(false); }); - room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => { + room.on(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => { const formattedDisplayName = displayName.substr(0, MAX_DISPLAY_NAME_LENGTH); APP.store.dispatch(participantUpdated({ @@ -1793,7 +1790,7 @@ export default { }); room.on( - ConferenceEvents.LOCK_STATE_CHANGED, + JitsiConferenceEvents.LOCK_STATE_CHANGED, (...args) => APP.store.dispatch(lockStateChanged(room, ...args))); APP.remoteControl.on(RemoteControlEvents.ACTIVE_CHANGED, isActive => { @@ -1805,7 +1802,7 @@ export default { }); room.on( - ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, + JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, (participant, name, oldValue, newValue) => { switch (name) { case 'raisedHand': @@ -1821,18 +1818,18 @@ export default { } }); - room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => { + room.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => { logger.log("Received recorder status change: ", status, error); APP.UI.updateRecordingState(status); }); - room.on(ConferenceEvents.KICKED, () => { + room.on(JitsiConferenceEvents.KICKED, () => { APP.UI.hideStats(); APP.UI.notifyKicked(); // FIXME close }); - room.on(ConferenceEvents.SUSPEND_DETECTED, () => { + room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => { APP.store.dispatch(suspendDetected()); // After wake up, we will be in a state where conference is left // there will be dialog shown to user. @@ -1843,7 +1840,7 @@ export default { // on resume after suspending PC. if (this.deviceChangeListener) JitsiMeetJS.mediaDevices.removeEventListener( - JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, + JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED, this.deviceChangeListener); // stop local video @@ -1858,7 +1855,7 @@ export default { } }); - room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => { + room.on(JitsiConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => { APP.UI.updateDTMFSupport(isDTMFSupported); }); @@ -1921,24 +1918,24 @@ export default { } ); room.on( - ConferenceEvents.START_MUTED_POLICY_CHANGED, + JitsiConferenceEvents.START_MUTED_POLICY_CHANGED, ({ audio, video }) => { APP.UI.onStartMutedChanged(audio, video); } ); - room.on(ConferenceEvents.STARTED_MUTED, () => { + room.on(JitsiConferenceEvents.STARTED_MUTED, () => { (room.isStartAudioMuted() || room.isStartVideoMuted()) && APP.UI.notifyInitiallyMuted(); }); room.on( - ConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) { + JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) { APP.UI.updateDevicesAvailability(id, devices); } ); room.on( - ConferenceEvents.DATA_CHANNEL_OPENED, () => { + JitsiConferenceEvents.DATA_CHANNEL_OPENED, () => { APP.store.dispatch(dataChannelOpened()); } ); @@ -1989,7 +1986,7 @@ export default { APP.UI.addListener(UIEvents.SUBJECT_CHANGED, (topic) => { room.setSubject(topic); }); - room.on(ConferenceEvents.SUBJECT_CHANGED, function (subject) { + room.on(JitsiConferenceEvents.SUBJECT_CHANGED, function (subject) { APP.UI.setSubject(subject); }); @@ -2152,7 +2149,7 @@ export default { }, /** * Adds any room listener. - * @param {string} eventName one of the ConferenceEvents + * @param {string} eventName one of the JitsiConferenceEvents * @param {Function} listener the function to be called when the event * occurs */ @@ -2162,7 +2159,7 @@ export default { /** * Removes any room listener. - * @param {string} eventName one of the ConferenceEvents + * @param {string} eventName one of the JitsiConferenceEvents * @param {Function} listener the listener to be removed. */ removeConferenceListener(eventName, listener) { @@ -2202,7 +2199,7 @@ export default { window.setTimeout( () => this._onDeviceListChanged(devices), 0); JitsiMeetJS.mediaDevices.addEventListener( - JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, + JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED, this.deviceChangeListener); } }) diff --git a/connection.js b/connection.js index d54a425ee..5c7f6e5de 100644 --- a/connection.js +++ b/connection.js @@ -8,11 +8,11 @@ import { connectionFailed } from './react/features/base/connection'; import { - isFatalJitsiConnectionError + isFatalJitsiConnectionError, + JitsiConnectionErrors, + JitsiConnectionEvents } from './react/features/base/lib-jitsi-meet'; -const ConnectionEvents = JitsiMeetJS.events.connection; -const ConnectionErrors = JitsiMeetJS.errors.connection; const logger = require("jitsi-meet-logger").getLogger(__filename); /** @@ -74,13 +74,13 @@ function connect(id, password, roomName) { return new Promise(function (resolve, reject) { connection.addEventListener( - ConnectionEvents.CONNECTION_ESTABLISHED, + JitsiConnectionEvents.CONNECTION_ESTABLISHED, handleConnectionEstablished); connection.addEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, handleConnectionFailed); connection.addEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, connectionFailedHandler); function connectionFailedHandler(error, message, credentials) { @@ -89,17 +89,17 @@ function connect(id, password, roomName) { if (isFatalJitsiConnectionError(error)) { connection.removeEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, connectionFailedHandler); } } function unsubscribe() { connection.removeEventListener( - ConnectionEvents.CONNECTION_ESTABLISHED, + JitsiConnectionEvents.CONNECTION_ESTABLISHED, handleConnectionEstablished); connection.removeEventListener( - ConnectionEvents.CONNECTION_FAILED, + JitsiConnectionEvents.CONNECTION_FAILED, handleConnectionFailed); } @@ -149,7 +149,7 @@ export function openConnection({id, password, retry, roomName}) { if (retry) { const { issuer, jwt } = APP.store.getState()['features/base/jwt']; - if (err === ConnectionErrors.PASSWORD_REQUIRED + if (err === JitsiConnectionErrors.PASSWORD_REQUIRED && (!jwt || issuer === 'anonymous')) { return AuthHandler.requestAuth(roomName, connect); } diff --git a/modules/UI/UI.js b/modules/UI/UI.js index bf4af9e68..9b9852464 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1,4 +1,4 @@ -/* global APP, JitsiMeetJS, $, config, interfaceConfig */ +/* global APP, $, config, interfaceConfig */ const logger = require("jitsi-meet-logger").getLogger(__filename); @@ -22,6 +22,7 @@ import Profile from "./side_pannels/profile/Profile"; import Settings from "./../settings/Settings"; import { updateDeviceList } from '../../react/features/base/devices'; +import { JitsiTrackErrors } from '../../react/features/base/lib-jitsi-meet'; import { openDeviceSelectionDialog } from '../../react/features/device-selection'; @@ -54,35 +55,38 @@ let sharedVideoManager; let followMeHandler; -const TrackErrors = JitsiMeetJS.errors.track; - const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = { microphone: {}, camera: {} }; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.UNSUPPORTED_RESOLUTION] - = "dialog.cameraUnsupportedResolutionError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .camera[JitsiTrackErrors.UNSUPPORTED_RESOLUTION] + = "dialog.cameraUnsupportedResolutionError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.GENERAL] = "dialog.cameraUnknownError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.PERMISSION_DENIED] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.PERMISSION_DENIED] = "dialog.cameraPermissionDeniedError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NOT_FOUND] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.NOT_FOUND] = "dialog.cameraNotFoundError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.CONSTRAINT_FAILED] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.CONSTRAINT_FAILED] = "dialog.cameraConstraintFailedError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NO_DATA_FROM_SOURCE] - = "dialog.cameraNotSendingData"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .camera[JitsiTrackErrors.NO_DATA_FROM_SOURCE] + = "dialog.cameraNotSendingData"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.GENERAL] = "dialog.micUnknownError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.PERMISSION_DENIED] - = "dialog.micPermissionDeniedError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NOT_FOUND] +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .microphone[JitsiTrackErrors.PERMISSION_DENIED] + = "dialog.micPermissionDeniedError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.NOT_FOUND] = "dialog.micNotFoundError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED] - = "dialog.micConstraintFailedError"; -JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE] - = "dialog.micNotSendingData"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .microphone[JitsiTrackErrors.CONSTRAINT_FAILED] + = "dialog.micConstraintFailedError"; +JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .microphone[JitsiTrackErrors.NO_DATA_FROM_SOURCE] + = "dialog.micNotSendingData"; /** * Toggles the application in and out of full screen mode @@ -1073,7 +1077,8 @@ UI.showMicErrorNotification = function (micError) { const micJitsiTrackErrorMsg = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[name]; const micErrorMsg = micJitsiTrackErrorMsg - || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL]; + || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .microphone[JitsiTrackErrors.GENERAL]; const additionalMicErrorMsg = micJitsiTrackErrorMsg ? null : message; APP.store.dispatch(maybeShowNotificationWithDoNotDisplay( @@ -1083,7 +1088,7 @@ UI.showMicErrorNotification = function (micError) { messageKey: micErrorMsg, showToggle: Boolean(micJitsiTrackErrorMsg), subtitleKey: 'dialog.micErrorPresent', - titleKey: name === TrackErrors.PERMISSION_DENIED + titleKey: name === JitsiTrackErrors.PERMISSION_DENIED ? 'deviceError.microphonePermission' : 'dialog.error', toggleLabelKey: 'dialog.doNotShowWarningAgain' })); @@ -1108,7 +1113,8 @@ UI.showCameraErrorNotification = function (cameraError) { const cameraJitsiTrackErrorMsg = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name]; const cameraErrorMsg = cameraJitsiTrackErrorMsg - || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL]; + || JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP + .camera[JitsiTrackErrors.GENERAL]; const additionalCameraErrorMsg = cameraJitsiTrackErrorMsg ? null : message; APP.store.dispatch(maybeShowNotificationWithDoNotDisplay( @@ -1118,7 +1124,7 @@ UI.showCameraErrorNotification = function (cameraError) { messageKey: cameraErrorMsg, showToggle: Boolean(cameraJitsiTrackErrorMsg), subtitleKey: 'dialog.cameraErrorPresent', - titleKey: name === TrackErrors.PERMISSION_DENIED + titleKey: name === JitsiTrackErrors.PERMISSION_DENIED ? 'deviceError.cameraPermission' : 'dialog.error', toggleLabelKey: 'dialog.doNotShowWarningAgain' })); diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.js index 75e34c0e2..a9a5c8b8d 100644 --- a/modules/UI/authentication/AuthHandler.js +++ b/modules/UI/authentication/AuthHandler.js @@ -2,11 +2,13 @@ import { openConnection } from '../../../connection'; import { setJWT } from '../../../react/features/base/jwt'; +import { + JitsiConnectionErrors +} from '../../../react/features/base/lib-jitsi-meet'; import UIUtil from '../util/UIUtil'; import LoginDialog from './LoginDialog'; -const ConnectionErrors = JitsiMeetJS.errors.connection; const logger = require("jitsi-meet-logger").getLogger(__filename); let externalAuthWindow; @@ -247,7 +249,7 @@ function showXmppPasswordPrompt(roomName, connect) { authDialog.close(); resolve(connection); }, function (err) { - if (err === ConnectionErrors.PASSWORD_REQUIRED) { + if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) { authDialog.displayError(err); } else { authDialog.close(); @@ -266,7 +268,7 @@ function showXmppPasswordPrompt(roomName, connect) { * @param {string} [roomName] name of the conference room * @param {function(id, password, roomName)} [connect] function that returns * a Promise which resolves with JitsiConnection or fails with one of - * ConnectionErrors. + * JitsiConnectionErrors. * @returns {Promise} */ function requestAuth(roomName, connect) { diff --git a/modules/UI/authentication/LoginDialog.js b/modules/UI/authentication/LoginDialog.js index 63fabb327..0ee3a3db7 100644 --- a/modules/UI/authentication/LoginDialog.js +++ b/modules/UI/authentication/LoginDialog.js @@ -1,8 +1,9 @@ -/* global $, APP, config, JitsiMeetJS */ +/* global $, APP, config */ import { toJid } from '../../../react/features/base/connection'; - -const ConnectionErrors = JitsiMeetJS.errors.connection; +import { + JitsiConnectionErrors +} from '../../../react/features/base/lib-jitsi-meet'; /** * Build html for "password required" dialog. @@ -14,7 +15,7 @@ function getPasswordInputHtml() { : "user@domain.net"; return ` - { this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED); @@ -449,8 +450,8 @@ var Recording = { () => {}); break; } - case Status.AVAILABLE: - case Status.OFF: { + case JitsiRecordingStatus.AVAILABLE: + case JitsiRecordingStatus.OFF: { if (this.recordingType === 'jibri') _requestLiveStreamId().then(streamId => { this.eventEmitter.emit( @@ -486,7 +487,7 @@ var Recording = { } break; } - case Status.BUSY: { + case JitsiRecordingStatus.BUSY: { dialog = APP.UI.messageHandler.openMessageDialog( this.recordingTitle, this.recordingBusy, diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js index 958cc6078..5bea2db56 100644 --- a/modules/UI/videolayout/LargeVideoManager.js +++ b/modules/UI/videolayout/LargeVideoManager.js @@ -9,6 +9,9 @@ import { PresenceLabel } from '../../../react/features/presence-status'; const logger = require("jitsi-meet-logger").getLogger(__filename); +import { + JitsiParticipantConnectionStatus +} from '../../../react/features/base/lib-jitsi-meet'; import { updateKnownLargeVideoResolution } from '../../../react/features/large-video'; @@ -21,8 +24,6 @@ import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer"; import AudioLevels from "../audio_levels/AudioLevels"; -const ParticipantConnectionStatus - = JitsiMeetJS.constants.participantConnectionStatus; const DESKTOP_CONTAINER_TYPE = 'desktop'; /** * The time interval in milliseconds to check the video resolution of the video @@ -211,7 +212,7 @@ export default class LargeVideoManager { = !isVideoMuted && (APP.conference.isLocalId(id) || connectionStatus - === ParticipantConnectionStatus.ACTIVE + === JitsiParticipantConnectionStatus.ACTIVE || wasUsersImageCached); let showAvatar @@ -241,13 +242,13 @@ export default class LargeVideoManager { const isConnectionInterrupted = APP.conference.getParticipantConnectionStatus(id) - === ParticipantConnectionStatus.INTERRUPTED; + === JitsiParticipantConnectionStatus.INTERRUPTED; let messageKey = null; if (isConnectionInterrupted) { messageKey = "connection.USER_CONNECTION_INTERRUPTED"; } else if (connectionStatus - === ParticipantConnectionStatus.INACTIVE) { + === JitsiParticipantConnectionStatus.INACTIVE) { messageKey = "connection.LOW_BANDWIDTH"; } @@ -494,8 +495,9 @@ export default class LargeVideoManager { = APP.conference.getParticipantConnectionStatus(this.id); show = !APP.conference.isLocalId(this.id) - && (connStatus === ParticipantConnectionStatus.INTERRUPTED - || connStatus === ParticipantConnectionStatus.INACTIVE); + && (connStatus === JitsiParticipantConnectionStatus.INTERRUPTED + || connStatus + === JitsiParticipantConnectionStatus.INACTIVE); } if (show) { diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index feb3cbae7..8fa998272 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -1,10 +1,11 @@ -/* global $, config, interfaceConfig, APP, JitsiMeetJS */ +/* global $, config, interfaceConfig, APP */ /* eslint-disable no-unused-vars */ import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; +import { JitsiTrackEvents } from '../../../react/features/base/lib-jitsi-meet'; import { VideoTrack } from '../../../react/features/base/media'; /* eslint-enable no-unused-vars */ @@ -13,8 +14,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename); import UIEvents from "../../../service/UI/UIEvents"; import SmallVideo from "./SmallVideo"; -const TrackEvents = JitsiMeetJS.events.track; - function LocalVideo(VideoLayout, emitter) { this.videoSpanId = "localVideoContainer"; @@ -159,9 +158,9 @@ LocalVideo.prototype.changeVideo = function (stream) { if (this.isCurrentlyOnLargeVideo()) { this.VideoLayout.updateLargeVideo(this.id); } - stream.off(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); + stream.off(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler); }; - stream.on(TrackEvents.LOCAL_TRACK_STOPPED, endedHandler); + stream.on(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler); }; /** diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 3889fcfe5..50a3e8917 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -1,4 +1,4 @@ -/* global $, APP, interfaceConfig, JitsiMeetJS */ +/* global $, APP, interfaceConfig */ /* eslint-disable no-unused-vars */ import React from 'react'; @@ -7,6 +7,9 @@ import { Provider } from 'react-redux'; import { I18nextProvider } from 'react-i18next'; import { i18next } from '../../../react/features/base/i18n'; +import { + JitsiParticipantConnectionStatus +} from '../../../react/features/base/lib-jitsi-meet'; import { PresenceLabel } from '../../../react/features/presence-status'; import { @@ -21,9 +24,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename); import SmallVideo from "./SmallVideo"; import UIUtils from "../util/UIUtil"; -const ParticipantConnectionStatus - = JitsiMeetJS.constants.participantConnectionStatus; - /** * Creates new instance of the RemoteVideo. * @param user {JitsiParticipant} the user for whom remote video instance will @@ -379,14 +379,14 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) { */ RemoteVideo.prototype.isConnectionActive = function() { return this.user.getConnectionStatus() - === ParticipantConnectionStatus.ACTIVE; + === JitsiParticipantConnectionStatus.ACTIVE; }; /** * The remote video is considered "playable" once the stream has started * according to the {@link #hasVideoStarted} result. * It will be allowed to display video also in - * {@link ParticipantConnectionStatus.INTERRUPTED} if the video was ever played + * {@link JitsiParticipantConnectionStatus.INTERRUPTED} if the video was ever played * and was not muted while not in ACTIVE state. This basically means that there * is stalled video image cached that could be displayed. It's used to show * "grey video image" in user's thumbnail when there are connectivity issues. @@ -400,8 +400,8 @@ RemoteVideo.prototype.isVideoPlayable = function () { return SmallVideo.prototype.isVideoPlayable.call(this) && this.hasVideoStarted() - && (connectionState === ParticipantConnectionStatus.ACTIVE - || (connectionState === ParticipantConnectionStatus.INTERRUPTED + && (connectionState === JitsiParticipantConnectionStatus.ACTIVE + || (connectionState === JitsiParticipantConnectionStatus.INTERRUPTED && !this.mutedWhileDisconnected)); }; @@ -432,7 +432,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function () { this.updateConnectionStatus(connectionStatus); const isInterrupted - = connectionStatus === ParticipantConnectionStatus.INTERRUPTED; + = connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED; // Toggle thumbnail video problem filter this.selectVideoElement().toggleClass( "videoThumbnailProblemFilter", isInterrupted); diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 476418c2c..b6c9d67f8 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -1,6 +1,9 @@ -/* global APP, $, interfaceConfig, JitsiMeetJS */ +/* global APP, $, interfaceConfig */ const logger = require("jitsi-meet-logger").getLogger(__filename); +import { + JitsiParticipantConnectionStatus +} from '../../../react/features/base/lib-jitsi-meet'; import { getPinnedParticipant, pinParticipant @@ -15,9 +18,6 @@ import LargeVideoManager from "./LargeVideoManager"; import {VIDEO_CONTAINER_TYPE} from "./VideoContainer"; import LocalVideo from "./LocalVideo"; -const ParticipantConnectionStatus - = JitsiMeetJS.constants.participantConnectionStatus; - var remoteVideos = {}; var localVideoThumbnail = null; @@ -593,8 +593,8 @@ var VideoLayout = { // states. const status = isInterrupted - ? ParticipantConnectionStatus.INTERRUPTED - : ParticipantConnectionStatus.ACTIVE; + ? JitsiParticipantConnectionStatus.INTERRUPTED + : JitsiParticipantConnectionStatus.ACTIVE; localVideoThumbnail.updateConnectionStatus(status); }, diff --git a/modules/remotecontrol/Controller.js b/modules/remotecontrol/Controller.js index 11f4f2142..516b1fbed 100644 --- a/modules/remotecontrol/Controller.js +++ b/modules/remotecontrol/Controller.js @@ -2,6 +2,9 @@ import { getLogger } from 'jitsi-meet-logger'; +import { + JitsiConferenceEvents +} from '../../react/features/base/lib-jitsi-meet'; import * as KeyCodes from '../keycode/keycode'; import { EVENTS, @@ -16,9 +19,7 @@ import RemoteControlParticipant from './RemoteControlParticipant'; declare var $: Function; declare var APP: Object; -declare var JitsiMeetJS: Object; -const ConferenceEvents = JitsiMeetJS.events.conference; const logger = getLogger(__filename); /** @@ -122,10 +123,10 @@ export default class Controller extends RemoteControlParticipant { const clearRequest = () => { this._requestedParticipant = null; APP.conference.removeConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, permissionsReplyListener); APP.conference.removeConferenceListener( - ConferenceEvents.USER_LEFT, + JitsiConferenceEvents.USER_LEFT, onUserLeft); }; @@ -156,9 +157,10 @@ export default class Controller extends RemoteControlParticipant { }; APP.conference.addConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, permissionsReplyListener); - APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, + APP.conference.addConferenceListener( + JitsiConferenceEvents.USER_LEFT, onUserLeft); this._requestedParticipant = userId; this.sendRemoteControlEndpointMessage(userId, { @@ -240,9 +242,9 @@ export default class Controller extends RemoteControlParticipant { APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED, this._largeVideoChangedListener); APP.conference.addConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, this._stopListener); - APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, + APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT, this._userLeftListener); this.resume(); } @@ -325,9 +327,9 @@ export default class Controller extends RemoteControlParticipant { APP.UI.removeListener(UIEvents.LARGE_VIDEO_ID_CHANGED, this._largeVideoChangedListener); APP.conference.removeConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, this._stopListener); - APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT, + APP.conference.removeConferenceListener(JitsiConferenceEvents.USER_LEFT, this._userLeftListener); this.pause(); this._controlledParticipant = null; diff --git a/modules/remotecontrol/Receiver.js b/modules/remotecontrol/Receiver.js index 55e83a52d..d0a8165e8 100644 --- a/modules/remotecontrol/Receiver.js +++ b/modules/remotecontrol/Receiver.js @@ -3,6 +3,9 @@ import { getLogger } from 'jitsi-meet-logger'; import * as JitsiMeetConferenceEvents from '../../ConferenceEvents'; +import { + JitsiConferenceEvents +} from '../../react/features/base/lib-jitsi-meet'; import { openRemoteControlAuthorizationDialog } from '../../react/features/remote-control'; @@ -22,9 +25,7 @@ import RemoteControlParticipant from './RemoteControlParticipant'; declare var APP: Object; declare var config: Object; declare var interfaceConfig: Object; -declare var JitsiMeetJS: Object; -const ConferenceEvents = JitsiMeetJS.events.conference; const logger = getLogger(__filename); /** @@ -92,7 +93,7 @@ export default class Receiver extends RemoteControlParticipant { // Announce remote control support. APP.connection.addFeature(DISCO_REMOTE_CONTROL_FEATURE, true); APP.conference.addConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, this._remoteControlEventsListener); APP.conference.addListener(JitsiMeetConferenceEvents.BEFORE_HANGUP, this._hangupListener); @@ -101,7 +102,7 @@ export default class Receiver extends RemoteControlParticipant { this._stop(true); APP.connection.removeFeature(DISCO_REMOTE_CONTROL_FEATURE); APP.conference.removeConferenceListener( - ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, + JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, this._remoteControlEventsListener); APP.conference.removeListener( JitsiMeetConferenceEvents.BEFORE_HANGUP, @@ -110,7 +111,7 @@ export default class Receiver extends RemoteControlParticipant { } /** - * Removes the listener for ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED + * Removes the listener for JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED * events. Sends stop message to the wrapper application. Optionally * displays dialog for informing the user that remote control session * ended. @@ -125,7 +126,8 @@ export default class Receiver extends RemoteControlParticipant { } logger.log('Remote control receiver stop.'); this._controller = null; - APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT, + APP.conference.removeConferenceListener( + JitsiConferenceEvents.USER_LEFT, this._userLeftListener); transport.sendEvent({ name: REMOTE_CONTROL_MESSAGE_NAME, @@ -216,7 +218,7 @@ export default class Receiver extends RemoteControlParticipant { * @returns {void} */ grant(userId: string) { - APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, + APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT, this._userLeftListener); this._controller = userId; logger.log(`Remote control permissions granted to: ${userId}`); diff --git a/react/features/base/lib-jitsi-meet/index.js b/react/features/base/lib-jitsi-meet/index.js index 323cff76b..b83f29806 100644 --- a/react/features/base/lib-jitsi-meet/index.js +++ b/react/features/base/lib-jitsi-meet/index.js @@ -10,8 +10,12 @@ export const JitsiConferenceErrors = JitsiMeetJS.errors.conference; export const JitsiConferenceEvents = JitsiMeetJS.events.conference; export const JitsiConnectionErrors = JitsiMeetJS.errors.connection; export const JitsiConnectionEvents = JitsiMeetJS.events.connection; +export const JitsiConnectionQualityEvents + = JitsiMeetJS.events.connectionQuality; +export const JitsiMediaDevicesEvents = JitsiMeetJS.events.mediaDevices; export const JitsiParticipantConnectionStatus = JitsiMeetJS.constants.participantConnectionStatus; +export const JitsiRecordingStatus = JitsiMeetJS.constants.recordingStatus; export const JitsiTrackErrors = JitsiMeetJS.errors.track; export const JitsiTrackEvents = JitsiMeetJS.events.track; diff --git a/react/features/connection-indicator/statsEmitter.js b/react/features/connection-indicator/statsEmitter.js index 35626a7d9..409875a7c 100644 --- a/react/features/connection-indicator/statsEmitter.js +++ b/react/features/connection-indicator/statsEmitter.js @@ -2,7 +2,7 @@ import _ from 'lodash'; -import JitsiMeetJS from '../base/lib-jitsi-meet'; +import { JitsiConnectionQualityEvents } from '../base/lib-jitsi-meet'; declare var APP: Object; @@ -28,12 +28,10 @@ const statsEmitter = { * @returns {void} */ startListeningForStats(conference: Object) { - const { connectionQuality } = JitsiMeetJS.events; - - conference.on(connectionQuality.LOCAL_STATS_UPDATED, + conference.on(JitsiConnectionQualityEvents.LOCAL_STATS_UPDATED, stats => this._onStatsUpdated(conference.myUserId(), stats)); - conference.on(connectionQuality.REMOTE_STATS_UPDATED, + conference.on(JitsiConnectionQualityEvents.REMOTE_STATS_UPDATED, (id, stats) => this._emitStatsUpdate(id, stats)); },