fix(lib-jitsi-meet): Use the exported constants

This commit is contained in:
hristoterezov 2017-10-10 18:31:40 -05:00 committed by yanas
parent f050e7026d
commit a3a871d4b3
14 changed files with 207 additions and 193 deletions

View File

@ -35,7 +35,15 @@ import {
import { updateDeviceList } from './react/features/base/devices'; import { updateDeviceList } from './react/features/base/devices';
import { import {
isAnalyticsEnabled, isAnalyticsEnabled,
isFatalJitsiConnectionError isFatalJitsiConnectionError,
JitsiConferenceErrors,
JitsiConferenceEvents,
JitsiConnectionErrors,
JitsiConnectionEvents,
JitsiMediaDevicesEvents,
JitsiParticipantConnectionStatus,
JitsiTrackErrors,
JitsiTrackEvents
} from './react/features/base/lib-jitsi-meet'; } from './react/features/base/lib-jitsi-meet';
import { import {
isVideoMutedByUser, isVideoMutedByUser,
@ -77,17 +85,6 @@ import {
showDesktopSharingButton showDesktopSharingButton
} from './react/features/toolbox'; } 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(); const eventEmitter = new EventEmitter();
let room; let room;
@ -123,7 +120,7 @@ const commands = {
function connect(roomName) { function connect(roomName) {
return openConnection({retry: true, roomName: roomName}) return openConnection({retry: true, roomName: roomName})
.catch(function (err) { .catch(function (err) {
if (err === ConnectionErrors.PASSWORD_REQUIRED) { if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {
APP.UI.notifyTokenAuthFailed(); APP.UI.notifyTokenAuthFailed();
} else { } else {
APP.UI.notifyConnectionFailed(err); APP.UI.notifyConnectionFailed(err);
@ -270,11 +267,11 @@ class ConferenceConnector {
this._resolve = resolve; this._resolve = resolve;
this._reject = reject; this._reject = reject;
this.reconnectTimeout = null; this.reconnectTimeout = null;
room.on(ConferenceEvents.CONFERENCE_JOINED, room.on(JitsiConferenceEvents.CONFERENCE_JOINED,
this._handleConferenceJoined.bind(this)); this._handleConferenceJoined.bind(this));
room.on(ConferenceEvents.CONFERENCE_FAILED, room.on(JitsiConferenceEvents.CONFERENCE_FAILED,
this._onConferenceFailed.bind(this)); this._onConferenceFailed.bind(this));
room.on(ConferenceEvents.CONFERENCE_ERROR, room.on(JitsiConferenceEvents.CONFERENCE_ERROR,
this._onConferenceError.bind(this)); this._onConferenceError.bind(this));
} }
_handleConferenceFailed(err) { _handleConferenceFailed(err) {
@ -286,20 +283,20 @@ class ConferenceConnector {
logger.error('CONFERENCE FAILED:', err, ...params); logger.error('CONFERENCE FAILED:', err, ...params);
switch (err) { switch (err) {
case ConferenceErrors.CONNECTION_ERROR: { case JitsiConferenceErrors.CONNECTION_ERROR: {
let [msg] = params; let [msg] = params;
APP.UI.notifyConnectionFailed(msg); APP.UI.notifyConnectionFailed(msg);
break; break;
} }
case ConferenceErrors.NOT_ALLOWED_ERROR: { case JitsiConferenceErrors.NOT_ALLOWED_ERROR: {
// let's show some auth not allowed page // let's show some auth not allowed page
assignWindowLocationPathname('static/authError.html'); assignWindowLocationPathname('static/authError.html');
break; break;
} }
// not enough rights to create conference // not enough rights to create conference
case ConferenceErrors.AUTHENTICATION_REQUIRED: { case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: {
// Schedule reconnect to check if someone else created the room. // Schedule reconnect to check if someone else created the room.
this.reconnectTimeout = setTimeout(() => room.join(), 5000); this.reconnectTimeout = setTimeout(() => room.join(), 5000);
@ -311,21 +308,21 @@ class ConferenceConnector {
break; break;
} }
case ConferenceErrors.RESERVATION_ERROR: { case JitsiConferenceErrors.RESERVATION_ERROR: {
let [code, msg] = params; let [code, msg] = params;
APP.UI.notifyReservationError(code, msg); APP.UI.notifyReservationError(code, msg);
break; break;
} }
case ConferenceErrors.GRACEFUL_SHUTDOWN: case JitsiConferenceErrors.GRACEFUL_SHUTDOWN:
APP.UI.notifyGracefulShutdown(); APP.UI.notifyGracefulShutdown();
break; break;
case ConferenceErrors.JINGLE_FATAL_ERROR: case JitsiConferenceErrors.JINGLE_FATAL_ERROR:
APP.UI.notifyInternalError(); APP.UI.notifyInternalError();
break; break;
case ConferenceErrors.CONFERENCE_DESTROYED: { case JitsiConferenceErrors.CONFERENCE_DESTROYED: {
let [reason] = params; let [reason] = params;
APP.UI.hideStats(); APP.UI.hideStats();
APP.UI.notifyConferenceDestroyed(reason); APP.UI.notifyConferenceDestroyed(reason);
@ -336,26 +333,26 @@ class ConferenceConnector {
// What really happens there is that the library is not ready yet, // 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 // because Jicofo is not available, but it is going to give it another
// try. // try.
case ConferenceErrors.FOCUS_DISCONNECTED: { case JitsiConferenceErrors.FOCUS_DISCONNECTED: {
let [focus, retrySec] = params; let [focus, retrySec] = params;
APP.UI.notifyFocusDisconnected(focus, retrySec); APP.UI.notifyFocusDisconnected(focus, retrySec);
break; break;
} }
case ConferenceErrors.FOCUS_LEFT: case JitsiConferenceErrors.FOCUS_LEFT:
case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE: case JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE:
// FIXME the conference should be stopped by the library and not by // FIXME the conference should be stopped by the library and not by
// the app. Both the errors above are unrecoverable from the library // the app. Both the errors above are unrecoverable from the library
// perspective. // perspective.
room.leave().then(() => connection.disconnect()); room.leave().then(() => connection.disconnect());
break; break;
case ConferenceErrors.CONFERENCE_MAX_USERS: case JitsiConferenceErrors.CONFERENCE_MAX_USERS:
connection.disconnect(); connection.disconnect();
APP.UI.notifyMaxUsersLimitReached(); APP.UI.notifyMaxUsersLimitReached();
break; break;
case ConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS: case JitsiConferenceErrors.INCOMPATIBLE_SERVER_VERSIONS:
reload(); reload();
break; break;
@ -366,7 +363,7 @@ class ConferenceConnector {
_onConferenceError(err, ...params) { _onConferenceError(err, ...params) {
logger.error('CONFERENCE Error:', err, params); logger.error('CONFERENCE Error:', err, params);
switch (err) { switch (err) {
case ConferenceErrors.CHAT_ERROR: case JitsiConferenceErrors.CHAT_ERROR:
logger.error("Chat error.", err); logger.error("Chat error.", err);
if (isButtonEnabled('chat')) { if (isButtonEnabled('chat')) {
let [code, msg] = params; let [code, msg] = params;
@ -379,9 +376,9 @@ class ConferenceConnector {
} }
_unsubscribe() { _unsubscribe() {
room.off( room.off(
ConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined); JitsiConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined);
room.off( room.off(
ConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed); JitsiConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed);
if (this.reconnectTimeout !== null) { if (this.reconnectTimeout !== null) {
clearTimeout(this.reconnectTimeout); clearTimeout(this.reconnectTimeout);
} }
@ -410,14 +407,14 @@ function disconnect() {
/** /**
* Handles CONNECTION_FAILED events from lib-jitsi-meet. * Handles CONNECTION_FAILED events from lib-jitsi-meet.
* *
* @param {JitsiMeetJS.connection.error} error - The reported error. * @param {JitsiConnectionError} error - The reported error.
* @returns {void} * @returns {void}
* @private * @private
*/ */
function _connectionFailedHandler(error) { function _connectionFailedHandler(error) {
if (isFatalJitsiConnectionError(error)) { if (isFatalJitsiConnectionError(error)) {
APP.connection.removeEventListener( APP.connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
_connectionFailedHandler); _connectionFailedHandler);
if (room) if (room)
room.leave(); room.leave();
@ -517,7 +514,7 @@ export default {
} }
JitsiMeetJS.mediaDevices.addEventListener( JitsiMeetJS.mediaDevices.addEventListener(
JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN, JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN,
browser => browser =>
APP.store.dispatch( APP.store.dispatch(
mediaPermissionPromptVisibilityChanged(true, browser)) mediaPermissionPromptVisibilityChanged(true, browser))
@ -686,7 +683,7 @@ export default {
logger.log('initialized with %s local tracks', tracks.length); logger.log('initialized with %s local tracks', tracks.length);
this._localTracksInitialized = true; this._localTracksInitialized = true;
con.addEventListener( con.addEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
_connectionFailedHandler); _connectionFailedHandler);
APP.connection = connection = con; APP.connection = connection = con;
@ -1446,7 +1443,7 @@ export default {
= this._turnScreenSharingOff = this._turnScreenSharingOff
.bind(this, didHaveVideo, wasVideoMuted); .bind(this, didHaveVideo, wasVideoMuted);
desktopStream.on( desktopStream.on(
TrackEvents.LOCAL_TRACK_STOPPED, JitsiTrackEvents.LOCAL_TRACK_STOPPED,
() => { () => {
// If the stream was stopped during screen sharing // If the stream was stopped during screen sharing
// session then we should switch back to video. // session then we should switch back to video.
@ -1526,13 +1523,13 @@ export default {
* @private * @private
*/ */
_handleScreenSharingError(error) { _handleScreenSharingError(error) {
if (error.name === TrackErrors.CHROME_EXTENSION_USER_CANCELED) { if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED) {
return; return;
} }
logger.error('failed to share local desktop', error); 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 start with screen sharing the extension will fail to install
// (if not found), because the request has been triggered by the // (if not found), because the request has been triggered by the
// script. Show a dialog which asks user to click "install" and try // script. Show a dialog which asks user to click "install" and try
@ -1544,7 +1541,7 @@ export default {
); );
return; return;
} else if (error.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) { } else if (error.name === JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED) {
APP.UI.showExtensionRequiredDialog( APP.UI.showExtensionRequiredDialog(
config.desktopSharingFirefoxExtensionURL config.desktopSharingFirefoxExtensionURL
); );
@ -1553,14 +1550,14 @@ export default {
} }
// Handling: // Handling:
// TrackErrors.PERMISSION_DENIED // JitsiTrackErrors.PERMISSION_DENIED
// TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR // JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
// TrackErrors.GENERAL // JitsiTrackErrors.GENERAL
// and any other // and any other
let dialogTxt; let dialogTxt;
let dialogTitleKey; let dialogTitleKey;
if (error.name === TrackErrors.PERMISSION_DENIED) { if (error.name === JitsiTrackErrors.PERMISSION_DENIED) {
dialogTxt = APP.translation.generateTranslationHTML( dialogTxt = APP.translation.generateTranslationHTML(
"dialog.screenSharingPermissionDeniedError"); "dialog.screenSharingPermissionDeniedError");
dialogTitleKey = "dialog.error"; dialogTitleKey = "dialog.error";
@ -1577,7 +1574,7 @@ export default {
*/ */
_setupListeners() { _setupListeners() {
// add local streams when joined to the conference // add local streams when joined to the conference
room.on(ConferenceEvents.CONFERENCE_JOINED, () => { room.on(JitsiConferenceEvents.CONFERENCE_JOINED, () => {
APP.store.dispatch(conferenceJoined(room)); APP.store.dispatch(conferenceJoined(room));
APP.UI.mucJoined(); APP.UI.mucJoined();
@ -1586,17 +1583,17 @@ export default {
}); });
room.on( room.on(
ConferenceEvents.CONFERENCE_LEFT, JitsiConferenceEvents.CONFERENCE_LEFT,
(...args) => APP.store.dispatch(conferenceLeft(room, ...args))); (...args) => APP.store.dispatch(conferenceLeft(room, ...args)));
room.on( room.on(
ConferenceEvents.AUTH_STATUS_CHANGED, JitsiConferenceEvents.AUTH_STATUS_CHANGED,
(authEnabled, authLogin) => (authEnabled, authLogin) =>
APP.UI.updateAuthInfo(authEnabled, authLogin)); APP.UI.updateAuthInfo(authEnabled, authLogin));
room.on(ConferenceEvents.PARTCIPANT_FEATURES_CHANGED, room.on(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED,
user => APP.UI.onUserFeaturesChanged(user)); user => APP.UI.onUserFeaturesChanged(user));
room.on(ConferenceEvents.USER_JOINED, (id, user) => { room.on(JitsiConferenceEvents.USER_JOINED, (id, user) => {
if (user.isHidden()) if (user.isHidden())
return; return;
@ -1614,7 +1611,7 @@ export default {
APP.UI.updateUserRole(user); APP.UI.updateUserRole(user);
}); });
room.on(ConferenceEvents.USER_LEFT, (id, user) => { room.on(JitsiConferenceEvents.USER_LEFT, (id, user) => {
APP.store.dispatch(participantLeft(id, user)); APP.store.dispatch(participantLeft(id, user));
logger.log('USER %s LEFT', id, user); logger.log('USER %s LEFT', id, user);
APP.API.notifyUserLeft(id); APP.API.notifyUserLeft(id);
@ -1622,7 +1619,7 @@ export default {
APP.UI.onSharedVideoStop(id); 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)); APP.store.dispatch(participantPresenceChanged(id, status));
let user = room.getParticipantById(id); 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)) { if (this.isLocalId(id)) {
logger.info(`My role changed, new role: ${role}`); 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()) if (!track || track.isLocal())
return; return;
APP.store.dispatch(trackAdded(track)); APP.store.dispatch(trackAdded(track));
}); });
room.on(ConferenceEvents.TRACK_REMOVED, (track) => { room.on(JitsiConferenceEvents.TRACK_REMOVED, (track) => {
if (!track || track.isLocal()) if (!track || track.isLocal())
return; return;
APP.store.dispatch(trackRemoved(track)); 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) if (this.isLocalId(id)
&& this.localAudio && this.localAudio.isMuted()) { && this.localAudio && this.localAudio.isMuted()) {
lvl = 0; lvl = 0;
@ -1680,7 +1677,7 @@ export default {
APP.UI.setAudioLevel(id, lvl); APP.UI.setAudioLevel(id, lvl);
}); });
room.on(ConferenceEvents.TALK_WHILE_MUTED, () => { room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
APP.UI.showToolbar(6000); APP.UI.showToolbar(6000);
APP.UI.showCustomToolbarPopup( APP.UI.showCustomToolbarPopup(
@ -1688,23 +1685,23 @@ export default {
}); });
room.on( room.on(
ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
(leavingIds, enteringIds) => (leavingIds, enteringIds) =>
APP.UI.handleLastNEndpoints(leavingIds, enteringIds)); APP.UI.handleLastNEndpoints(leavingIds, enteringIds));
room.on( room.on(
ConferenceEvents.P2P_STATUS, JitsiConferenceEvents.P2P_STATUS,
(jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p))); (jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p)));
room.on( room.on(
ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
(id, connectionStatus) => { (id, connectionStatus) => {
APP.store.dispatch(participantConnectionStatusChanged( APP.store.dispatch(participantConnectionStatusChanged(
id, connectionStatus)); id, connectionStatus));
APP.UI.participantConnectionStatusChanged(id); APP.UI.participantConnectionStatusChanged(id);
}); });
room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => { room.on(JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
APP.store.dispatch(dominantSpeakerChanged(id)); APP.store.dispatch(dominantSpeakerChanged(id));
if (this.isLocalId(id)) { if (this.isLocalId(id)) {
@ -1721,15 +1718,15 @@ export default {
}); });
if (!interfaceConfig.filmStripOnly) { if (!interfaceConfig.filmStripOnly) {
room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => { room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {
APP.UI.markVideoInterrupted(true); APP.UI.markVideoInterrupted(true);
}); });
room.on(ConferenceEvents.CONNECTION_RESTORED, () => { room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => {
APP.UI.markVideoInterrupted(false); APP.UI.markVideoInterrupted(false);
}); });
if (isButtonEnabled('chat')) { if (isButtonEnabled('chat')) {
room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => { room.on(JitsiConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
let nick = getDisplayName(id); let nick = getDisplayName(id);
APP.API.notifyReceivedChatMessage({ APP.API.notifyReceivedChatMessage({
id, id,
@ -1767,21 +1764,21 @@ export default {
() => this._displayAudioOnlyTooltip('videoMute')); () => this._displayAudioOnlyTooltip('videoMute'));
} }
room.on(ConferenceEvents.CONNECTION_INTERRUPTED, () => { room.on(JitsiConferenceEvents.CONNECTION_INTERRUPTED, () => {
APP.store.dispatch(localParticipantConnectionStatusChanged( APP.store.dispatch(localParticipantConnectionStatusChanged(
participantConnectionStatus.INTERRUPTED)); JitsiParticipantConnectionStatus.INTERRUPTED));
APP.UI.showLocalConnectionInterrupted(true); APP.UI.showLocalConnectionInterrupted(true);
}); });
room.on(ConferenceEvents.CONNECTION_RESTORED, () => { room.on(JitsiConferenceEvents.CONNECTION_RESTORED, () => {
APP.store.dispatch(localParticipantConnectionStatusChanged( APP.store.dispatch(localParticipantConnectionStatusChanged(
participantConnectionStatus.ACTIVE)); JitsiParticipantConnectionStatus.ACTIVE));
APP.UI.showLocalConnectionInterrupted(false); APP.UI.showLocalConnectionInterrupted(false);
}); });
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => { room.on(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
const formattedDisplayName const formattedDisplayName
= displayName.substr(0, MAX_DISPLAY_NAME_LENGTH); = displayName.substr(0, MAX_DISPLAY_NAME_LENGTH);
APP.store.dispatch(participantUpdated({ APP.store.dispatch(participantUpdated({
@ -1793,7 +1790,7 @@ export default {
}); });
room.on( room.on(
ConferenceEvents.LOCK_STATE_CHANGED, JitsiConferenceEvents.LOCK_STATE_CHANGED,
(...args) => APP.store.dispatch(lockStateChanged(room, ...args))); (...args) => APP.store.dispatch(lockStateChanged(room, ...args)));
APP.remoteControl.on(RemoteControlEvents.ACTIVE_CHANGED, isActive => { APP.remoteControl.on(RemoteControlEvents.ACTIVE_CHANGED, isActive => {
@ -1805,7 +1802,7 @@ export default {
}); });
room.on( room.on(
ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
(participant, name, oldValue, newValue) => { (participant, name, oldValue, newValue) => {
switch (name) { switch (name) {
case 'raisedHand': 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); logger.log("Received recorder status change: ", status, error);
APP.UI.updateRecordingState(status); APP.UI.updateRecordingState(status);
}); });
room.on(ConferenceEvents.KICKED, () => { room.on(JitsiConferenceEvents.KICKED, () => {
APP.UI.hideStats(); APP.UI.hideStats();
APP.UI.notifyKicked(); APP.UI.notifyKicked();
// FIXME close // FIXME close
}); });
room.on(ConferenceEvents.SUSPEND_DETECTED, () => { room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => {
APP.store.dispatch(suspendDetected()); APP.store.dispatch(suspendDetected());
// After wake up, we will be in a state where conference is left // After wake up, we will be in a state where conference is left
// there will be dialog shown to user. // there will be dialog shown to user.
@ -1843,7 +1840,7 @@ export default {
// on resume after suspending PC. // on resume after suspending PC.
if (this.deviceChangeListener) if (this.deviceChangeListener)
JitsiMeetJS.mediaDevices.removeEventListener( JitsiMeetJS.mediaDevices.removeEventListener(
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
this.deviceChangeListener); this.deviceChangeListener);
// stop local video // 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); APP.UI.updateDTMFSupport(isDTMFSupported);
}); });
@ -1921,24 +1918,24 @@ export default {
} }
); );
room.on( room.on(
ConferenceEvents.START_MUTED_POLICY_CHANGED, JitsiConferenceEvents.START_MUTED_POLICY_CHANGED,
({ audio, video }) => { ({ audio, video }) => {
APP.UI.onStartMutedChanged(audio, video); APP.UI.onStartMutedChanged(audio, video);
} }
); );
room.on(ConferenceEvents.STARTED_MUTED, () => { room.on(JitsiConferenceEvents.STARTED_MUTED, () => {
(room.isStartAudioMuted() || room.isStartVideoMuted()) (room.isStartAudioMuted() || room.isStartVideoMuted())
&& APP.UI.notifyInitiallyMuted(); && APP.UI.notifyInitiallyMuted();
}); });
room.on( room.on(
ConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) { JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) {
APP.UI.updateDevicesAvailability(id, devices); APP.UI.updateDevicesAvailability(id, devices);
} }
); );
room.on( room.on(
ConferenceEvents.DATA_CHANNEL_OPENED, () => { JitsiConferenceEvents.DATA_CHANNEL_OPENED, () => {
APP.store.dispatch(dataChannelOpened()); APP.store.dispatch(dataChannelOpened());
} }
); );
@ -1989,7 +1986,7 @@ export default {
APP.UI.addListener(UIEvents.SUBJECT_CHANGED, (topic) => { APP.UI.addListener(UIEvents.SUBJECT_CHANGED, (topic) => {
room.setSubject(topic); room.setSubject(topic);
}); });
room.on(ConferenceEvents.SUBJECT_CHANGED, function (subject) { room.on(JitsiConferenceEvents.SUBJECT_CHANGED, function (subject) {
APP.UI.setSubject(subject); APP.UI.setSubject(subject);
}); });
@ -2152,7 +2149,7 @@ export default {
}, },
/** /**
* Adds any room listener. * 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 * @param {Function} listener the function to be called when the event
* occurs * occurs
*/ */
@ -2162,7 +2159,7 @@ export default {
/** /**
* Removes any room listener. * 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. * @param {Function} listener the listener to be removed.
*/ */
removeConferenceListener(eventName, listener) { removeConferenceListener(eventName, listener) {
@ -2202,7 +2199,7 @@ export default {
window.setTimeout( window.setTimeout(
() => this._onDeviceListChanged(devices), 0); () => this._onDeviceListChanged(devices), 0);
JitsiMeetJS.mediaDevices.addEventListener( JitsiMeetJS.mediaDevices.addEventListener(
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,
this.deviceChangeListener); this.deviceChangeListener);
} }
}) })

View File

@ -8,11 +8,11 @@ import {
connectionFailed connectionFailed
} from './react/features/base/connection'; } from './react/features/base/connection';
import { import {
isFatalJitsiConnectionError isFatalJitsiConnectionError,
JitsiConnectionErrors,
JitsiConnectionEvents
} from './react/features/base/lib-jitsi-meet'; } 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); const logger = require("jitsi-meet-logger").getLogger(__filename);
/** /**
@ -74,13 +74,13 @@ function connect(id, password, roomName) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
connection.addEventListener( connection.addEventListener(
ConnectionEvents.CONNECTION_ESTABLISHED, JitsiConnectionEvents.CONNECTION_ESTABLISHED,
handleConnectionEstablished); handleConnectionEstablished);
connection.addEventListener( connection.addEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
handleConnectionFailed); handleConnectionFailed);
connection.addEventListener( connection.addEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
connectionFailedHandler); connectionFailedHandler);
function connectionFailedHandler(error, message, credentials) { function connectionFailedHandler(error, message, credentials) {
@ -89,17 +89,17 @@ function connect(id, password, roomName) {
if (isFatalJitsiConnectionError(error)) { if (isFatalJitsiConnectionError(error)) {
connection.removeEventListener( connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
connectionFailedHandler); connectionFailedHandler);
} }
} }
function unsubscribe() { function unsubscribe() {
connection.removeEventListener( connection.removeEventListener(
ConnectionEvents.CONNECTION_ESTABLISHED, JitsiConnectionEvents.CONNECTION_ESTABLISHED,
handleConnectionEstablished); handleConnectionEstablished);
connection.removeEventListener( connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, JitsiConnectionEvents.CONNECTION_FAILED,
handleConnectionFailed); handleConnectionFailed);
} }
@ -149,7 +149,7 @@ export function openConnection({id, password, retry, roomName}) {
if (retry) { if (retry) {
const { issuer, jwt } = APP.store.getState()['features/base/jwt']; const { issuer, jwt } = APP.store.getState()['features/base/jwt'];
if (err === ConnectionErrors.PASSWORD_REQUIRED if (err === JitsiConnectionErrors.PASSWORD_REQUIRED
&& (!jwt || issuer === 'anonymous')) { && (!jwt || issuer === 'anonymous')) {
return AuthHandler.requestAuth(roomName, connect); return AuthHandler.requestAuth(roomName, connect);
} }

View File

@ -1,4 +1,4 @@
/* global APP, JitsiMeetJS, $, config, interfaceConfig */ /* global APP, $, config, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename); 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 Settings from "./../settings/Settings";
import { updateDeviceList } from '../../react/features/base/devices'; import { updateDeviceList } from '../../react/features/base/devices';
import { JitsiTrackErrors } from '../../react/features/base/lib-jitsi-meet';
import { import {
openDeviceSelectionDialog openDeviceSelectionDialog
} from '../../react/features/device-selection'; } from '../../react/features/device-selection';
@ -54,35 +55,38 @@ let sharedVideoManager;
let followMeHandler; let followMeHandler;
const TrackErrors = JitsiMeetJS.errors.track;
const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = { const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {
microphone: {}, microphone: {},
camera: {} camera: {}
}; };
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.UNSUPPORTED_RESOLUTION] JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
= "dialog.cameraUnsupportedResolutionError"; .camera[JitsiTrackErrors.UNSUPPORTED_RESOLUTION]
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.GENERAL] = "dialog.cameraUnsupportedResolutionError";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.GENERAL]
= "dialog.cameraUnknownError"; = "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"; = "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"; = "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"; = "dialog.cameraConstraintFailedError";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[TrackErrors.NO_DATA_FROM_SOURCE] JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
= "dialog.cameraNotSendingData"; .camera[JitsiTrackErrors.NO_DATA_FROM_SOURCE]
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.GENERAL] = "dialog.cameraNotSendingData";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.GENERAL]
= "dialog.micUnknownError"; = "dialog.micUnknownError";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.PERMISSION_DENIED] JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
= "dialog.micPermissionDeniedError"; .microphone[JitsiTrackErrors.PERMISSION_DENIED]
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NOT_FOUND] = "dialog.micPermissionDeniedError";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.NOT_FOUND]
= "dialog.micNotFoundError"; = "dialog.micNotFoundError";
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.CONSTRAINT_FAILED] JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP
= "dialog.micConstraintFailedError"; .microphone[JitsiTrackErrors.CONSTRAINT_FAILED]
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[TrackErrors.NO_DATA_FROM_SOURCE] = "dialog.micConstraintFailedError";
= "dialog.micNotSendingData"; 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 * Toggles the application in and out of full screen mode
@ -1073,7 +1077,8 @@ UI.showMicErrorNotification = function (micError) {
const micJitsiTrackErrorMsg const micJitsiTrackErrorMsg
= JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[name]; = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[name];
const micErrorMsg = micJitsiTrackErrorMsg 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; const additionalMicErrorMsg = micJitsiTrackErrorMsg ? null : message;
APP.store.dispatch(maybeShowNotificationWithDoNotDisplay( APP.store.dispatch(maybeShowNotificationWithDoNotDisplay(
@ -1083,7 +1088,7 @@ UI.showMicErrorNotification = function (micError) {
messageKey: micErrorMsg, messageKey: micErrorMsg,
showToggle: Boolean(micJitsiTrackErrorMsg), showToggle: Boolean(micJitsiTrackErrorMsg),
subtitleKey: 'dialog.micErrorPresent', subtitleKey: 'dialog.micErrorPresent',
titleKey: name === TrackErrors.PERMISSION_DENIED titleKey: name === JitsiTrackErrors.PERMISSION_DENIED
? 'deviceError.microphonePermission' : 'dialog.error', ? 'deviceError.microphonePermission' : 'dialog.error',
toggleLabelKey: 'dialog.doNotShowWarningAgain' toggleLabelKey: 'dialog.doNotShowWarningAgain'
})); }));
@ -1108,7 +1113,8 @@ UI.showCameraErrorNotification = function (cameraError) {
const cameraJitsiTrackErrorMsg = const cameraJitsiTrackErrorMsg =
JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name]; JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name];
const cameraErrorMsg = cameraJitsiTrackErrorMsg 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; const additionalCameraErrorMsg = cameraJitsiTrackErrorMsg ? null : message;
APP.store.dispatch(maybeShowNotificationWithDoNotDisplay( APP.store.dispatch(maybeShowNotificationWithDoNotDisplay(
@ -1118,7 +1124,7 @@ UI.showCameraErrorNotification = function (cameraError) {
messageKey: cameraErrorMsg, messageKey: cameraErrorMsg,
showToggle: Boolean(cameraJitsiTrackErrorMsg), showToggle: Boolean(cameraJitsiTrackErrorMsg),
subtitleKey: 'dialog.cameraErrorPresent', subtitleKey: 'dialog.cameraErrorPresent',
titleKey: name === TrackErrors.PERMISSION_DENIED titleKey: name === JitsiTrackErrors.PERMISSION_DENIED
? 'deviceError.cameraPermission' : 'dialog.error', ? 'deviceError.cameraPermission' : 'dialog.error',
toggleLabelKey: 'dialog.doNotShowWarningAgain' toggleLabelKey: 'dialog.doNotShowWarningAgain'
})); }));

View File

@ -2,11 +2,13 @@
import { openConnection } from '../../../connection'; import { openConnection } from '../../../connection';
import { setJWT } from '../../../react/features/base/jwt'; import { setJWT } from '../../../react/features/base/jwt';
import {
JitsiConnectionErrors
} from '../../../react/features/base/lib-jitsi-meet';
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
import LoginDialog from './LoginDialog'; import LoginDialog from './LoginDialog';
const ConnectionErrors = JitsiMeetJS.errors.connection;
const logger = require("jitsi-meet-logger").getLogger(__filename); const logger = require("jitsi-meet-logger").getLogger(__filename);
let externalAuthWindow; let externalAuthWindow;
@ -247,7 +249,7 @@ function showXmppPasswordPrompt(roomName, connect) {
authDialog.close(); authDialog.close();
resolve(connection); resolve(connection);
}, function (err) { }, function (err) {
if (err === ConnectionErrors.PASSWORD_REQUIRED) { if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {
authDialog.displayError(err); authDialog.displayError(err);
} else { } else {
authDialog.close(); authDialog.close();
@ -266,7 +268,7 @@ function showXmppPasswordPrompt(roomName, connect) {
* @param {string} [roomName] name of the conference room * @param {string} [roomName] name of the conference room
* @param {function(id, password, roomName)} [connect] function that returns * @param {function(id, password, roomName)} [connect] function that returns
* a Promise which resolves with JitsiConnection or fails with one of * a Promise which resolves with JitsiConnection or fails with one of
* ConnectionErrors. * JitsiConnectionErrors.
* @returns {Promise<JitsiConnection>} * @returns {Promise<JitsiConnection>}
*/ */
function requestAuth(roomName, connect) { function requestAuth(roomName, connect) {

View File

@ -1,8 +1,9 @@
/* global $, APP, config, JitsiMeetJS */ /* global $, APP, config */
import { toJid } from '../../../react/features/base/connection'; import { toJid } from '../../../react/features/base/connection';
import {
const ConnectionErrors = JitsiMeetJS.errors.connection; JitsiConnectionErrors
} from '../../../react/features/base/lib-jitsi-meet';
/** /**
* Build html for "password required" dialog. * Build html for "password required" dialog.
@ -14,7 +15,7 @@ function getPasswordInputHtml() {
: "user@domain.net"; : "user@domain.net";
return ` return `
<input name="username" type="text" <input name="username" type="text"
class="input-control" class="input-control"
placeholder=${placeholder} autofocus> placeholder=${placeholder} autofocus>
<input name="password" type="password" <input name="password" type="password"
@ -121,7 +122,7 @@ function LoginDialog(successCallback, cancelCallback) {
let errorMessageElem = finishedState.find('#errorMessage'); let errorMessageElem = finishedState.find('#errorMessage');
let messageKey; let messageKey;
if (error === ConnectionErrors.PASSWORD_REQUIRED) { if (error === JitsiConnectionErrors.PASSWORD_REQUIRED) {
// this is a password required error, as login window was already // this is a password required error, as login window was already
// open once, this means username or password is wrong // open once, this means username or password is wrong
messageKey = 'dialog.incorrectPassword'; messageKey = 'dialog.incorrectPassword';

View File

@ -20,6 +20,9 @@ import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
import VideoLayout from '../videolayout/VideoLayout'; import VideoLayout from '../videolayout/VideoLayout';
import {
JitsiRecordingStatus
} from '../../../react/features/base/lib-jitsi-meet';
import { setToolboxEnabled } from '../../../react/features/toolbox'; import { setToolboxEnabled } from '../../../react/features/toolbox';
import { setNotificationsEnabled } from '../../../react/features/notifications'; import { setNotificationsEnabled } from '../../../react/features/notifications';
import { import {
@ -27,8 +30,6 @@ import {
updateRecordingState updateRecordingState
} from '../../../react/features/recording'; } from '../../../react/features/recording';
const Status = JitsiMeetJS.constants.recordingStatus;
/** /**
* Translation keys to use for display in the UI when recording the conference * Translation keys to use for display in the UI when recording the conference
* but not streaming live. * but not streaming live.
@ -240,11 +241,11 @@ function _showStopRecordingPrompt(recordingType) {
/** /**
* Checks whether if the given status is either PENDING or RETRYING * Checks whether if the given status is either PENDING or RETRYING
* @param status {Status} Jibri status to be checked * @param status {JitsiRecordingStatus} Jibri status to be checked
* @returns {boolean} true if the condition is met or false otherwise. * @returns {boolean} true if the condition is met or false otherwise.
*/ */
function isStartingStatus(status) { function isStartingStatus(status) {
return status === Status.PENDING || status === Status.RETRYING; return status === JitsiRecordingStatus.PENDING || status === JitsiRecordingStatus.RETRYING;
} }
/** /**
@ -340,12 +341,12 @@ var Recording = {
let labelDisplayConfiguration; let labelDisplayConfiguration;
switch (recordingState) { switch (recordingState) {
case Status.ON: case JitsiRecordingStatus.ON:
case Status.RETRYING: { case JitsiRecordingStatus.RETRYING: {
labelDisplayConfiguration = { labelDisplayConfiguration = {
centered: false, centered: false,
key: this.recordingOnKey, key: this.recordingOnKey,
showSpinner: recordingState === Status.RETRYING showSpinner: recordingState === JitsiRecordingStatus.RETRYING
}; };
this._setToolbarButtonToggled(true); this._setToolbarButtonToggled(true);
@ -353,14 +354,14 @@ var Recording = {
break; break;
} }
case Status.OFF: case JitsiRecordingStatus.OFF:
case Status.BUSY: case JitsiRecordingStatus.BUSY:
case Status.FAILED: case JitsiRecordingStatus.FAILED:
case Status.UNAVAILABLE: { case JitsiRecordingStatus.UNAVAILABLE: {
const wasInStartingStatus = isStartingStatus(oldState); const wasInStartingStatus = isStartingStatus(oldState);
// We don't want UI changes if this is an availability change. // We don't want UI changes if this is an availability change.
if (oldState !== Status.ON && !wasInStartingStatus) { if (oldState !== JitsiRecordingStatus.ON && !wasInStartingStatus) {
APP.store.dispatch(updateRecordingState({ recordingState })); APP.store.dispatch(updateRecordingState({ recordingState }));
return; return;
} }
@ -381,7 +382,7 @@ var Recording = {
break; break;
} }
case Status.PENDING: { case JitsiRecordingStatus.PENDING: {
labelDisplayConfiguration = { labelDisplayConfiguration = {
centered: true, centered: true,
key: this.recordingPendingKey key: this.recordingPendingKey
@ -392,7 +393,7 @@ var Recording = {
break; break;
} }
case Status.ERROR: { case JitsiRecordingStatus.ERROR: {
labelDisplayConfiguration = { labelDisplayConfiguration = {
centered: true, centered: true,
key: this.recordingErrorKey key: this.recordingErrorKey
@ -404,7 +405,7 @@ var Recording = {
} }
// Return an empty label display configuration to indicate no label // Return an empty label display configuration to indicate no label
// should be displayed. The Status.AVAIABLE case is handled here. // should be displayed. The JitsiRecordingStatus.AVAIABLE case is handled here.
default: { default: {
labelDisplayConfiguration = null; labelDisplayConfiguration = null;
} }
@ -438,9 +439,9 @@ var Recording = {
JitsiMeetJS.analytics.sendEvent('recording.clicked'); JitsiMeetJS.analytics.sendEvent('recording.clicked');
switch (this.currentState) { switch (this.currentState) {
case Status.ON: case JitsiRecordingStatus.ON:
case Status.RETRYING: case JitsiRecordingStatus.RETRYING:
case Status.PENDING: { case JitsiRecordingStatus.PENDING: {
_showStopRecordingPrompt(this.recordingType).then( _showStopRecordingPrompt(this.recordingType).then(
() => { () => {
this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED); this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED);
@ -449,8 +450,8 @@ var Recording = {
() => {}); () => {});
break; break;
} }
case Status.AVAILABLE: case JitsiRecordingStatus.AVAILABLE:
case Status.OFF: { case JitsiRecordingStatus.OFF: {
if (this.recordingType === 'jibri') if (this.recordingType === 'jibri')
_requestLiveStreamId().then(streamId => { _requestLiveStreamId().then(streamId => {
this.eventEmitter.emit( this.eventEmitter.emit(
@ -486,7 +487,7 @@ var Recording = {
} }
break; break;
} }
case Status.BUSY: { case JitsiRecordingStatus.BUSY: {
dialog = APP.UI.messageHandler.openMessageDialog( dialog = APP.UI.messageHandler.openMessageDialog(
this.recordingTitle, this.recordingTitle,
this.recordingBusy, this.recordingBusy,

View File

@ -9,6 +9,9 @@ import { PresenceLabel } from '../../../react/features/presence-status';
const logger = require("jitsi-meet-logger").getLogger(__filename); const logger = require("jitsi-meet-logger").getLogger(__filename);
import {
JitsiParticipantConnectionStatus
} from '../../../react/features/base/lib-jitsi-meet';
import { import {
updateKnownLargeVideoResolution updateKnownLargeVideoResolution
} from '../../../react/features/large-video'; } from '../../../react/features/large-video';
@ -21,8 +24,6 @@ import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";
import AudioLevels from "../audio_levels/AudioLevels"; import AudioLevels from "../audio_levels/AudioLevels";
const ParticipantConnectionStatus
= JitsiMeetJS.constants.participantConnectionStatus;
const DESKTOP_CONTAINER_TYPE = 'desktop'; const DESKTOP_CONTAINER_TYPE = 'desktop';
/** /**
* The time interval in milliseconds to check the video resolution of the video * The time interval in milliseconds to check the video resolution of the video
@ -211,7 +212,7 @@ export default class LargeVideoManager {
= !isVideoMuted = !isVideoMuted
&& (APP.conference.isLocalId(id) && (APP.conference.isLocalId(id)
|| connectionStatus || connectionStatus
=== ParticipantConnectionStatus.ACTIVE === JitsiParticipantConnectionStatus.ACTIVE
|| wasUsersImageCached); || wasUsersImageCached);
let showAvatar let showAvatar
@ -241,13 +242,13 @@ export default class LargeVideoManager {
const isConnectionInterrupted const isConnectionInterrupted
= APP.conference.getParticipantConnectionStatus(id) = APP.conference.getParticipantConnectionStatus(id)
=== ParticipantConnectionStatus.INTERRUPTED; === JitsiParticipantConnectionStatus.INTERRUPTED;
let messageKey = null; let messageKey = null;
if (isConnectionInterrupted) { if (isConnectionInterrupted) {
messageKey = "connection.USER_CONNECTION_INTERRUPTED"; messageKey = "connection.USER_CONNECTION_INTERRUPTED";
} else if (connectionStatus } else if (connectionStatus
=== ParticipantConnectionStatus.INACTIVE) { === JitsiParticipantConnectionStatus.INACTIVE) {
messageKey = "connection.LOW_BANDWIDTH"; messageKey = "connection.LOW_BANDWIDTH";
} }
@ -494,8 +495,9 @@ export default class LargeVideoManager {
= APP.conference.getParticipantConnectionStatus(this.id); = APP.conference.getParticipantConnectionStatus(this.id);
show = !APP.conference.isLocalId(this.id) show = !APP.conference.isLocalId(this.id)
&& (connStatus === ParticipantConnectionStatus.INTERRUPTED && (connStatus === JitsiParticipantConnectionStatus.INTERRUPTED
|| connStatus === ParticipantConnectionStatus.INACTIVE); || connStatus
=== JitsiParticipantConnectionStatus.INACTIVE);
} }
if (show) { if (show) {

View File

@ -1,10 +1,11 @@
/* global $, config, interfaceConfig, APP, JitsiMeetJS */ /* global $, config, interfaceConfig, APP */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import React, { Component } from 'react'; import React, { Component } from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { JitsiTrackEvents } from '../../../react/features/base/lib-jitsi-meet';
import { VideoTrack } from '../../../react/features/base/media'; import { VideoTrack } from '../../../react/features/base/media';
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
@ -13,8 +14,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIEvents from "../../../service/UI/UIEvents"; import UIEvents from "../../../service/UI/UIEvents";
import SmallVideo from "./SmallVideo"; import SmallVideo from "./SmallVideo";
const TrackEvents = JitsiMeetJS.events.track;
function LocalVideo(VideoLayout, emitter) { function LocalVideo(VideoLayout, emitter) {
this.videoSpanId = "localVideoContainer"; this.videoSpanId = "localVideoContainer";
@ -159,9 +158,9 @@ LocalVideo.prototype.changeVideo = function (stream) {
if (this.isCurrentlyOnLargeVideo()) { if (this.isCurrentlyOnLargeVideo()) {
this.VideoLayout.updateLargeVideo(this.id); 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);
}; };
/** /**

View File

@ -1,4 +1,4 @@
/* global $, APP, interfaceConfig, JitsiMeetJS */ /* global $, APP, interfaceConfig */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import React from 'react'; import React from 'react';
@ -7,6 +7,9 @@ import { Provider } from 'react-redux';
import { I18nextProvider } from 'react-i18next'; import { I18nextProvider } from 'react-i18next';
import { i18next } from '../../../react/features/base/i18n'; import { i18next } from '../../../react/features/base/i18n';
import {
JitsiParticipantConnectionStatus
} from '../../../react/features/base/lib-jitsi-meet';
import { PresenceLabel } from '../../../react/features/presence-status'; import { PresenceLabel } from '../../../react/features/presence-status';
import { import {
@ -21,9 +24,6 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);
import SmallVideo from "./SmallVideo"; import SmallVideo from "./SmallVideo";
import UIUtils from "../util/UIUtil"; import UIUtils from "../util/UIUtil";
const ParticipantConnectionStatus
= JitsiMeetJS.constants.participantConnectionStatus;
/** /**
* Creates new instance of the <tt>RemoteVideo</tt>. * Creates new instance of the <tt>RemoteVideo</tt>.
* @param user {JitsiParticipant} the user for whom remote video instance will * @param user {JitsiParticipant} the user for whom remote video instance will
@ -379,14 +379,14 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
*/ */
RemoteVideo.prototype.isConnectionActive = function() { RemoteVideo.prototype.isConnectionActive = function() {
return this.user.getConnectionStatus() return this.user.getConnectionStatus()
=== ParticipantConnectionStatus.ACTIVE; === JitsiParticipantConnectionStatus.ACTIVE;
}; };
/** /**
* The remote video is considered "playable" once the stream has started * The remote video is considered "playable" once the stream has started
* according to the {@link #hasVideoStarted} result. * according to the {@link #hasVideoStarted} result.
* It will be allowed to display video also in * 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 * 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 * 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. * "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) return SmallVideo.prototype.isVideoPlayable.call(this)
&& this.hasVideoStarted() && this.hasVideoStarted()
&& (connectionState === ParticipantConnectionStatus.ACTIVE && (connectionState === JitsiParticipantConnectionStatus.ACTIVE
|| (connectionState === ParticipantConnectionStatus.INTERRUPTED || (connectionState === JitsiParticipantConnectionStatus.INTERRUPTED
&& !this.mutedWhileDisconnected)); && !this.mutedWhileDisconnected));
}; };
@ -432,7 +432,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function () {
this.updateConnectionStatus(connectionStatus); this.updateConnectionStatus(connectionStatus);
const isInterrupted const isInterrupted
= connectionStatus === ParticipantConnectionStatus.INTERRUPTED; = connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED;
// Toggle thumbnail video problem filter // Toggle thumbnail video problem filter
this.selectVideoElement().toggleClass( this.selectVideoElement().toggleClass(
"videoThumbnailProblemFilter", isInterrupted); "videoThumbnailProblemFilter", isInterrupted);

View File

@ -1,6 +1,9 @@
/* global APP, $, interfaceConfig, JitsiMeetJS */ /* global APP, $, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename); const logger = require("jitsi-meet-logger").getLogger(__filename);
import {
JitsiParticipantConnectionStatus
} from '../../../react/features/base/lib-jitsi-meet';
import { import {
getPinnedParticipant, getPinnedParticipant,
pinParticipant pinParticipant
@ -15,9 +18,6 @@ import LargeVideoManager from "./LargeVideoManager";
import {VIDEO_CONTAINER_TYPE} from "./VideoContainer"; import {VIDEO_CONTAINER_TYPE} from "./VideoContainer";
import LocalVideo from "./LocalVideo"; import LocalVideo from "./LocalVideo";
const ParticipantConnectionStatus
= JitsiMeetJS.constants.participantConnectionStatus;
var remoteVideos = {}; var remoteVideos = {};
var localVideoThumbnail = null; var localVideoThumbnail = null;
@ -593,8 +593,8 @@ var VideoLayout = {
// states. // states.
const status const status
= isInterrupted = isInterrupted
? ParticipantConnectionStatus.INTERRUPTED ? JitsiParticipantConnectionStatus.INTERRUPTED
: ParticipantConnectionStatus.ACTIVE; : JitsiParticipantConnectionStatus.ACTIVE;
localVideoThumbnail.updateConnectionStatus(status); localVideoThumbnail.updateConnectionStatus(status);
}, },

View File

@ -2,6 +2,9 @@
import { getLogger } from 'jitsi-meet-logger'; import { getLogger } from 'jitsi-meet-logger';
import {
JitsiConferenceEvents
} from '../../react/features/base/lib-jitsi-meet';
import * as KeyCodes from '../keycode/keycode'; import * as KeyCodes from '../keycode/keycode';
import { import {
EVENTS, EVENTS,
@ -16,9 +19,7 @@ import RemoteControlParticipant from './RemoteControlParticipant';
declare var $: Function; declare var $: Function;
declare var APP: Object; declare var APP: Object;
declare var JitsiMeetJS: Object;
const ConferenceEvents = JitsiMeetJS.events.conference;
const logger = getLogger(__filename); const logger = getLogger(__filename);
/** /**
@ -122,10 +123,10 @@ export default class Controller extends RemoteControlParticipant {
const clearRequest = () => { const clearRequest = () => {
this._requestedParticipant = null; this._requestedParticipant = null;
APP.conference.removeConferenceListener( APP.conference.removeConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
permissionsReplyListener); permissionsReplyListener);
APP.conference.removeConferenceListener( APP.conference.removeConferenceListener(
ConferenceEvents.USER_LEFT, JitsiConferenceEvents.USER_LEFT,
onUserLeft); onUserLeft);
}; };
@ -156,9 +157,10 @@ export default class Controller extends RemoteControlParticipant {
}; };
APP.conference.addConferenceListener( APP.conference.addConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
permissionsReplyListener); permissionsReplyListener);
APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, APP.conference.addConferenceListener(
JitsiConferenceEvents.USER_LEFT,
onUserLeft); onUserLeft);
this._requestedParticipant = userId; this._requestedParticipant = userId;
this.sendRemoteControlEndpointMessage(userId, { this.sendRemoteControlEndpointMessage(userId, {
@ -240,9 +242,9 @@ export default class Controller extends RemoteControlParticipant {
APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED, APP.UI.addListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
this._largeVideoChangedListener); this._largeVideoChangedListener);
APP.conference.addConferenceListener( APP.conference.addConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener); this._stopListener);
APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT,
this._userLeftListener); this._userLeftListener);
this.resume(); this.resume();
} }
@ -325,9 +327,9 @@ export default class Controller extends RemoteControlParticipant {
APP.UI.removeListener(UIEvents.LARGE_VIDEO_ID_CHANGED, APP.UI.removeListener(UIEvents.LARGE_VIDEO_ID_CHANGED,
this._largeVideoChangedListener); this._largeVideoChangedListener);
APP.conference.removeConferenceListener( APP.conference.removeConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._stopListener); this._stopListener);
APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT, APP.conference.removeConferenceListener(JitsiConferenceEvents.USER_LEFT,
this._userLeftListener); this._userLeftListener);
this.pause(); this.pause();
this._controlledParticipant = null; this._controlledParticipant = null;

View File

@ -3,6 +3,9 @@
import { getLogger } from 'jitsi-meet-logger'; import { getLogger } from 'jitsi-meet-logger';
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents'; import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
import {
JitsiConferenceEvents
} from '../../react/features/base/lib-jitsi-meet';
import { import {
openRemoteControlAuthorizationDialog openRemoteControlAuthorizationDialog
} from '../../react/features/remote-control'; } from '../../react/features/remote-control';
@ -22,9 +25,7 @@ import RemoteControlParticipant from './RemoteControlParticipant';
declare var APP: Object; declare var APP: Object;
declare var config: Object; declare var config: Object;
declare var interfaceConfig: Object; declare var interfaceConfig: Object;
declare var JitsiMeetJS: Object;
const ConferenceEvents = JitsiMeetJS.events.conference;
const logger = getLogger(__filename); const logger = getLogger(__filename);
/** /**
@ -92,7 +93,7 @@ export default class Receiver extends RemoteControlParticipant {
// Announce remote control support. // Announce remote control support.
APP.connection.addFeature(DISCO_REMOTE_CONTROL_FEATURE, true); APP.connection.addFeature(DISCO_REMOTE_CONTROL_FEATURE, true);
APP.conference.addConferenceListener( APP.conference.addConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._remoteControlEventsListener); this._remoteControlEventsListener);
APP.conference.addListener(JitsiMeetConferenceEvents.BEFORE_HANGUP, APP.conference.addListener(JitsiMeetConferenceEvents.BEFORE_HANGUP,
this._hangupListener); this._hangupListener);
@ -101,7 +102,7 @@ export default class Receiver extends RemoteControlParticipant {
this._stop(true); this._stop(true);
APP.connection.removeFeature(DISCO_REMOTE_CONTROL_FEATURE); APP.connection.removeFeature(DISCO_REMOTE_CONTROL_FEATURE);
APP.conference.removeConferenceListener( APP.conference.removeConferenceListener(
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
this._remoteControlEventsListener); this._remoteControlEventsListener);
APP.conference.removeListener( APP.conference.removeListener(
JitsiMeetConferenceEvents.BEFORE_HANGUP, 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 * events. Sends stop message to the wrapper application. Optionally
* displays dialog for informing the user that remote control session * displays dialog for informing the user that remote control session
* ended. * ended.
@ -125,7 +126,8 @@ export default class Receiver extends RemoteControlParticipant {
} }
logger.log('Remote control receiver stop.'); logger.log('Remote control receiver stop.');
this._controller = null; this._controller = null;
APP.conference.removeConferenceListener(ConferenceEvents.USER_LEFT, APP.conference.removeConferenceListener(
JitsiConferenceEvents.USER_LEFT,
this._userLeftListener); this._userLeftListener);
transport.sendEvent({ transport.sendEvent({
name: REMOTE_CONTROL_MESSAGE_NAME, name: REMOTE_CONTROL_MESSAGE_NAME,
@ -216,7 +218,7 @@ export default class Receiver extends RemoteControlParticipant {
* @returns {void} * @returns {void}
*/ */
grant(userId: string) { grant(userId: string) {
APP.conference.addConferenceListener(ConferenceEvents.USER_LEFT, APP.conference.addConferenceListener(JitsiConferenceEvents.USER_LEFT,
this._userLeftListener); this._userLeftListener);
this._controller = userId; this._controller = userId;
logger.log(`Remote control permissions granted to: ${userId}`); logger.log(`Remote control permissions granted to: ${userId}`);

View File

@ -10,8 +10,12 @@ export const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
export const JitsiConferenceEvents = JitsiMeetJS.events.conference; export const JitsiConferenceEvents = JitsiMeetJS.events.conference;
export const JitsiConnectionErrors = JitsiMeetJS.errors.connection; export const JitsiConnectionErrors = JitsiMeetJS.errors.connection;
export const JitsiConnectionEvents = JitsiMeetJS.events.connection; export const JitsiConnectionEvents = JitsiMeetJS.events.connection;
export const JitsiConnectionQualityEvents
= JitsiMeetJS.events.connectionQuality;
export const JitsiMediaDevicesEvents = JitsiMeetJS.events.mediaDevices;
export const JitsiParticipantConnectionStatus export const JitsiParticipantConnectionStatus
= JitsiMeetJS.constants.participantConnectionStatus; = JitsiMeetJS.constants.participantConnectionStatus;
export const JitsiRecordingStatus = JitsiMeetJS.constants.recordingStatus;
export const JitsiTrackErrors = JitsiMeetJS.errors.track; export const JitsiTrackErrors = JitsiMeetJS.errors.track;
export const JitsiTrackEvents = JitsiMeetJS.events.track; export const JitsiTrackEvents = JitsiMeetJS.events.track;

View File

@ -2,7 +2,7 @@
import _ from 'lodash'; import _ from 'lodash';
import JitsiMeetJS from '../base/lib-jitsi-meet'; import { JitsiConnectionQualityEvents } from '../base/lib-jitsi-meet';
declare var APP: Object; declare var APP: Object;
@ -28,12 +28,10 @@ const statsEmitter = {
* @returns {void} * @returns {void}
*/ */
startListeningForStats(conference: Object) { startListeningForStats(conference: Object) {
const { connectionQuality } = JitsiMeetJS.events; conference.on(JitsiConnectionQualityEvents.LOCAL_STATS_UPDATED,
conference.on(connectionQuality.LOCAL_STATS_UPDATED,
stats => this._onStatsUpdated(conference.myUserId(), stats)); stats => this._onStatsUpdated(conference.myUserId(), stats));
conference.on(connectionQuality.REMOTE_STATS_UPDATED, conference.on(JitsiConnectionQualityEvents.REMOTE_STATS_UPDATED,
(id, stats) => this._emitStatsUpdate(id, stats)); (id, stats) => this._emitStatsUpdate(id, stats));
}, },