Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Fixes issues related to PR #452

hristoterezov089a9880b0fe
diff --git a/conference.js b/conference.js
index 9f2c608667..da04837dc4 100644
--- a/conference.js
+++ b/conference.js
@@ -111,13 +111,15 @@ class ConferenceConnector {
this._handleConferenceJoined.bind(this));
room.on(ConferenceEvents.CONFERENCE_FAILED,
this._onConferenceFailed.bind(this));
+ room.on(ConferenceEvents.CONFERENCE_ERROR,
+ this._onConferenceError.bind(this));
}
_handleConferenceFailed(err, msg) {
this._unsubscribe();
this._reject(err);
}
- _onConferenceFailed(err, msg = '') {
- console.error('CONFERENCE FAILED:', err, msg);
+ _onConferenceFailed(err, ...params) {
+ console.error('CONFERENCE FAILED:', err, params);
switch (err) {
// room is locked by the password
case ConferenceErrors.PASSWORD_REQUIRED:
@@ -128,7 +130,10 @@ class ConferenceConnector {
break;
case ConferenceErrors.CONNECTION_ERROR:
- APP.UI.notifyConnectionFailed(msg);
+ {
+ let [msg] = params;
+ APP.UI.notifyConnectionFailed(msg);
+ }
break;
case ConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE:
@@ -146,8 +151,50 @@ class ConferenceConnector {
AuthHandler.requireAuth(APP.conference.roomName);
break;
+ case ConferenceErrors.RESERVATION_ERROR:
+ {
+ let [code, msg] = params;
+ APP.UI.notifyReservationError(code, msg);
+ }
+ break;
+
+ case ConferenceErrors.GRACEFUL_SHUTDOWN:
+ APP.UI.notifyGracefulShudown();
+ break;
+
+ case ConferenceErrors.JINGLE_FATAL_ERROR:
+ APP.UI.notifyInternalError();
+ break;
+
+ case ConferenceErrors.CONFERENCE_DESTROYED:
+ {
+ let [reason] = params;
+ APP.UI.notifyConferenceDestroyed(reason);
+ }
+ break;
+
+ case ConferenceErrors.FOCUS_DISCONNECTED:
+ {
+ let [focus, retrySec] = params;
+ APP.UI.notifyFocusDisconnected(focus, retrySec);
+ }
+ break;
+
default:
- this._handleConferenceFailed(err, msg);
+ this._handleConferenceFailed(err, ...params);
+ }
+ }
+ _onConferenceError(err, ...params) {
+ console.error('CONFERENCE Error:', err, params);
+ switch (err) {
+ case ConferenceErrors.CHAT_ERROR:
+ {
+ let [code, msg] = params;
+ APP.UI.showChatError(code, msg);
+ }
+ break;
+ default:
+ console.error("Unknown error.");
}
}
_unsubscribe() {
@@ -513,6 +560,10 @@ export default {
APP.UI.updateRecordingState(status);
});
+ room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {
+ APP.UI.updateUserStatus(id, status);
+ });
+
room.on(ConferenceEvents.KICKED, () => {
APP.UI.notifyKicked();
// FIXME close
@@ -522,6 +573,10 @@ export default {
APP.UI.updateDTMFSupport(isDTMFSupported);
});
+ room.on(ConferenceEvents.FIREFOX_EXTENSION_NEEDED, function (url) {
+ APP.UI.notifyFirefoxExtensionRequired(url);
+ });
+
APP.UI.addListener(UIEvents.ROOM_LOCK_CLICKED, () => {
if (room.isModerator()) {
let promise = roomLocker.isLocked
@@ -657,6 +712,12 @@ export default {
);
});
+ room.on(
+ ConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) {
+ APP.UI.updateDevicesAvailability(id, devices);
+ }
+ );
+
// call hangup
APP.UI.addListener(UIEvents.HANGUP, () => {
APP.UI.requestFeedback().then(() => {
diff --git a/libs/lib-jitsi-meet.js b/libs/lib-jitsi-meet.js
index e41babff71..7998a27181 100644
--- a/libs/lib-jitsi-meet.js
+++ b/libs/lib-jitsi-meet.js
@@ -59,6 +59,10 @@ function JitsiConference(options) {
this.startAudioMuted = false;
this.startVideoMuted = false;
this.startMutedPolicy = {audio: false, video: false};
+ this.availableDevices = {
+ audio: undefined,
+ video: undefined
+ };
}
/**
@@ -817,6 +821,24 @@ function setupListeners(conference) {
conference.room.addListener(XMPPEvents.BRIDGE_DOWN, function () {
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
});
+ conference.room.addListener(XMPPEvents.RESERVATION_ERROR, function (code, msg) {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.RESERVATION_ERROR, code, msg);
+ });
+ conference.room.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
+ });
+ conference.room.addListener(XMPPEvents.JINGLE_FATAL_ERROR, function () {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.JINGLE_FATAL_ERROR);
+ });
+ conference.room.addListener(XMPPEvents.MUC_DESTROYED, function (reason) {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONFERENCE_DESTROYED, reason);
+ });
+ conference.room.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, function (err, msg) {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_ERROR, JitsiConferenceErrors.CHAT_ERROR, err, msg);
+ });
+ conference.room.addListener(XMPPEvents.FOCUS_DISCONNECTED, function (focus, retrySec) {
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.FOCUS_DISCONNECTED, focus, retrySec);
+ });
// FIXME
// conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
// conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
@@ -868,6 +890,16 @@ function setupListeners(conference) {
conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
});
+ conference.room.addListener(XMPPEvents.PRESENCE_STATUS, function (jid, status) {
+ var id = Strophe.getResourceFromJid(jid);
+ var participant = conference.getParticipantById(id);
+ if (!participant || participant._status === status) {
+ return;
+ }
+ participant._status = status;
+ conference.eventEmitter.emit(JitsiConferenceEvents.USER_STATUS_CHANGED, id, status);
+ });
+
conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
if(conference.lastDominantSpeaker !== id && conference.room) {
conference.lastDominantSpeaker = id;
@@ -945,6 +977,50 @@ function setupListeners(conference) {
}
});
+ conference.rtc.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
+ conference.room.updateDeviceAvailability(devices);
+ });
+ conference.room.addPresenceListener("devices", function (data, from) {
+ var isAudioAvailable = false;
+ var isVideoAvailable = false;
+ data.children.forEach(function (config) {
+ if (config.tagName === 'audio') {
+ isAudioAvailable = config.value === 'true';
+ }
+ if (config.tagName === 'video') {
+ isVideoAvailable = config.value === 'true';
+ }
+ });
+
+ var availableDevices;
+ if (conference.myUserId() === from) {
+ availableDevices = conference.availableDevices;
+ } else {
+ var participant = conference.getParticipantById(from);
+ if (!participant) {
+ return;
+ }
+
+ availableDevices = participant._availableDevices;
+ }
+
+ var updated = false;
+
+ if (availableDevices.audio !== isAudioAvailable) {
+ updated = true;
+ availableDevices.audio = isAudioAvailable;
+ }
+
+ if (availableDevices.video !== isVideoAvailable) {
+ updated = true;
+ availableDevices.video = isVideoAvailable;
+ }
+
+ if (updated) {
+ conference.eventEmitter.emit(JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, from, availableDevices);
+ }
+ });
+
if(conference.statistics) {
//FIXME: Maybe remove event should not be associated with the conference.
conference.statistics.addAudioLevelListener(function (ssrc, level) {
@@ -959,10 +1035,6 @@ function setupListeners(conference) {
function () {
conference.statistics.dispose();
});
- // FIXME: Maybe we should move this.
- // RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
- // conference.room.updateDeviceAvailability(devices);
- // });
conference.room.addListener(XMPPEvents.PEERCONNECTION_READY,
function (session) {
@@ -1045,7 +1117,31 @@ var JitsiConferenceErrors = {
/**
* Indicates that there is no available videobridge.
*/
- VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable"
+ VIDEOBRIDGE_NOT_AVAILABLE: "conference.videobridgeNotAvailable",
+ /**
+ * Indicates that reservation system returned error.
+ */
+ RESERVATION_ERROR: "conference.reservationError",
+ /**
+ * Indicates that graceful shutdown happened.
+ */
+ GRACEFUL_SHUTDOWN: "conference.gracefulShutdown",
+ /**
+ * Indicates that jingle fatal error happened.
+ */
+ JINGLE_FATAL_ERROR: "conference.jingleFatalError",
+ /**
+ * Indicates that conference has been destroyed.
+ */
+ CONFERENCE_DESTROYED: "conference.destroyed",
+ /**
+ * Indicates that chat error occurred.
+ */
+ CHAT_ERROR: "conference.chatError",
+ /**
+ * Indicates that focus error happened.
+ */
+ FOCUS_DISCONNECTED: "conference.focusDisconnected"
/**
* Many more errors TBD here.
*/
@@ -1083,6 +1179,10 @@ var JitsiConferenceEvents = {
* User role changed.
*/
USER_ROLE_CHANGED: "conference.roleChanged",
+ /**
+ * User status changed.
+ */
+ USER_STATUS_CHANGED: "conference.statusChanged",
/**
* New text message was received.
*/
@@ -1132,6 +1232,10 @@ var JitsiConferenceEvents = {
* Indicates that conference failed.
*/
CONFERENCE_FAILED: "conference.failed",
+ /**
+ * Indicates that an error occured.
+ */
+ CONFERENCE_ERROR: "conference.error",
/**
* Indicates that conference has been joined.
*/
@@ -1163,7 +1267,11 @@ var JitsiConferenceEvents = {
/**
* Indicates that phone number changed.
*/
- PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged"
+ PHONE_NUMBER_CHANGED: "conference.phoneNumberChanged",
+ /**
+ * Indicates that available devices changed.
+ */
+ AVAILABLE_DEVICES_CHANGED: "conference.availableDevicesChanged"
};
module.exports = JitsiConferenceEvents;
@@ -1460,6 +1568,11 @@ function JitsiParticipant(jid, conference, displayName){
this._supportsDTMF = false;
this._tracks = [];
this._role = 'none';
+ this._status = null;
+ this._availableDevices = {
+ audio: undefined,
+ video: undefined
+ };
}
/**
@@ -1497,6 +1610,13 @@ JitsiParticipant.prototype.getDisplayName = function() {
return this._displayName;
};
+/**
+ * @returns {String} The status of the participant.
+ */
+JitsiParticipant.prototype.getStatus = function () {
+ return this._status;
+};
+
/**
* @returns {Boolean} Whether this participant is a moderator or not.
*/
@@ -1892,7 +2012,6 @@ DataChannels.prototype._some = function (callback, thisArg) {
module.exports = DataChannels;
-
}).call(this,"/modules/RTC/DataChannels.js")
},{"../../service/RTC/RTCEvents":133,"jitsi-meet-logger":50}],13:[function(require,module,exports){
var JitsiTrack = require("./JitsiTrack");
@@ -2428,8 +2547,6 @@ var JitsiTrack = require("./JitsiTrack");
var JitsiLocalTrack = require("./JitsiLocalTrack.js");
var DataChannels = require("./DataChannels");
var JitsiRemoteTrack = require("./JitsiRemoteTrack.js");
-var DesktopSharingEventTypes
- = require("../../service/desktopsharing/DesktopSharingEventTypes");
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
var RTCEvents = require("../../service/RTC/RTCEvents.js");
@@ -2688,7 +2805,7 @@ RTC.prototype.setAudioLevel = function (jid, audioLevel) {
}
module.exports = RTC;
-},{"../../service/RTC/MediaStreamTypes":132,"../../service/RTC/RTCEvents.js":133,"../../service/desktopsharing/DesktopSharingEventTypes":136,"./DataChannels":12,"./JitsiLocalTrack.js":13,"./JitsiRemoteTrack.js":14,"./JitsiTrack":15,"./RTCBrowserType":17,"./RTCUtils.js":18,"events":46}],17:[function(require,module,exports){
+},{"../../service/RTC/MediaStreamTypes":132,"../../service/RTC/RTCEvents.js":133,"./DataChannels":12,"./JitsiLocalTrack.js":13,"./JitsiRemoteTrack.js":14,"./JitsiTrack":15,"./RTCBrowserType":17,"./RTCUtils.js":18,"events":46}],17:[function(require,module,exports){
var currentBrowser;
@@ -7646,12 +7763,9 @@ ChatRoom.prototype.onPresence = function (pres) {
}
}
- if(!member.isFocus)
- this.eventEmitter.emit(XMPPEvents.USER_ID_CHANGED, from, member.id);
-
// Trigger status message update
if (member.status) {
- this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member);
+ this.eventEmitter.emit(XMPPEvents.PRESENCE_STATUS, from, member.status);
}
if(jibri)
@@ -13093,9 +13207,6 @@ function initStrophePlugins(XMPP)
// broadcastLocalVideoType,
// StreamEventTypes.EVENT_TYPE_LOCAL_CHANGED
// );
-// RTC.addListener(RTCEvents.AVAILABLE_DEVICES_CHANGED, function (devices) {
-// XMPP.addToPresence("devices", devices);
-// });
//}
function XMPP(options) {
@@ -31558,11 +31669,6 @@ var XMPPEvents = {
CALL_INCOMING: "xmpp.callincoming.jingle",
// Designates an event indicating that we were kicked from the XMPP MUC.
KICKED: "xmpp.kicked",
- // Designates an event indicating that the userID for a specific JID has
- // changed.
- // Note: currently this event fires every time we receive presence from
- // someone (regardless of whether or not the "userID" changed).
- USER_ID_CHANGED: "xmpp.user_id_changed",
// Designates an event indicating that we have joined the XMPP MUC.
MUC_JOINED: "xmpp.muc_joined",
// Designates an event indicating that a participant joined the XMPP MUC.
@@ -31607,11 +31713,6 @@ var XMPPEvents = {
// Designates an event indicating that we should join the conference with
// audio and/or video muted.
START_MUTED_FROM_FOCUS: "xmpp.start_muted_from_focus",
- // Designates an event indicating that a remote participant's available
- // devices (whether he supports a audio and/or video) changed.
- // Note: currently this event fires every time we receive presence from
- // someone (regardless of whether or not the devices changed).
- DEVICE_AVAILABLE: "xmpp.device_available",
PEERCONNECTION_READY: "xmpp.peerconnection_ready",
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index c5c2d666d1..84fbf3aab9 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -157,13 +157,41 @@ UI.notifyKicked = function () {
messageHandler.openMessageDialog("dialog.sessTerminated", "dialog.kickMessage");
};
+/**
+ * Notify user that conference was destroyed.
+ * @param reason {string} the reason text
+ */
+UI.notifyConferenceDestroyed = function (reason) {
+ //FIXME: use Session Terminated from translation, but
+ // 'reason' text comes from XMPP packet and is not translated
+ var title = APP.translation.generateTranslationHTML("dialog.sessTerminated");
+ messageHandler.openDialog(
+ title, reason, true, {},
+ function (event, value, message, formVals) {
+ return false;
+ }
+ );
+};
+
/**
* Notify user that Jitsi Videobridge is not accessible.
*/
-UI.notifyBridgeDown = function () {
+ UI.notifyBridgeDown = function () {
messageHandler.showError("dialog.error", "dialog.bridgeUnavailable");
};
+/**
+ * Show chat error.
+ * @param err the Error
+ * @param msg
+ */
+UI.showChatError = function (err, msg) {
+ if (interfaceConfig.filmStripOnly) {
+ return;
+ }
+ Chat.chatAddError(err, msg);
+};
+
/**
* Change nickname for the user.
* @param {string} id user id
@@ -471,10 +499,9 @@ UI.removeUser = function (id, displayName) {
VideoLayout.removeParticipantContainer(id);
};
-//FIXME: NOT USED. Should start using the lib
-// function onMucPresenceStatus(jid, info) {
-// VideoLayout.setPresenceStatus(Strophe.getResourceFromJid(jid), info.status);
-// }
+UI.updateUserStatus = function (id, status) {
+ VideoLayout.setPresenceStatus(id, status);
+};
/**
* Update videotype for specified user.
@@ -706,7 +733,7 @@ UI.notifyFirefoxExtensionRequired = function (url) {
null,
null,
APP.translation.generateTranslationHTML(
- "dialog.firefoxExtensionPrompt", {url: url}
+ "dialog.firefoxExtensionPrompt", {url}
)
);
};
@@ -926,6 +953,18 @@ UI.notifyTokenAuthFailed = function () {
messageHandler.showError("dialog.error", "dialog.tokenAuthFailed");
};
+UI.notifyInternalError = function () {
+ UI.messageHandler.showError("dialog.sorry", "dialog.internalError");
+};
+
+UI.notifyFocusDisconnected = function (focus, retrySec) {
+ UI.messageHandler.notify(
+ null, "notify.focus",
+ 'disconnected', "notify.focusFail",
+ {component: focus, ms: retrySec}
+ );
+};
+
/**
* Updates auth info on the UI.
* @param {boolean} isAuthEnabled if authentication is enabled
@@ -988,4 +1027,8 @@ UI.showExtensionRequiredDialog = function (url) {
"dialog.firefoxExtensionPrompt", {url: url}));
};
+UI.updateDevicesAvailability = function (id, devices) {
+ VideoLayout.setDeviceAvailabilityIcons(id, devices);
+};
+
module.exports = UI;
diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js
index fe512895e3..703d73e078 100644
--- a/modules/UI/videolayout/LargeVideo.js
+++ b/modules/UI/videolayout/LargeVideo.js
@@ -165,6 +165,7 @@ class VideoContainer extends LargeContainer {
get id () {
return getStreamOwnerId(this.stream);
+ return getStreamId(this.stream);
}
constructor (onPlay) {
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index e5fbcc6e85..2067d6bb76 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -187,16 +187,18 @@ var VideoLayout = {
* @param resourceJid the jid of user
* @param devices available devices
*/
- setDeviceAvailabilityIcons (resourceJid, devices) {
- if(!devices)
+ setDeviceAvailabilityIcons (id, devices) {
+ if (APP.conference.isLocalId(id)) {
+ localVideoThumbnail.setDeviceAvailabilityIcons(devices);
return;
+ }
- if(!resourceJid) {
- localVideoThumbnail.setDeviceAvailabilityIcons(devices);
- } else {
- if(remoteVideos[resourceJid])
- remoteVideos[resourceJid].setDeviceAvailabilityIcons(devices);
+ let video = remoteVideos[id];
+ if (!video) {
+ return;
}
+
+ video.setDeviceAvailabilityIcons(devices);
},
/**
@@ -387,8 +389,8 @@ var VideoLayout = {
/**
* Shows the presence status message for the given video.
*/
- setPresenceStatus (resourceJid, statusMsg) {
- remoteVideos[resourceJid].setPresenceStatus(statusMsg);
+ setPresenceStatus (id, statusMsg) {
+ remoteVideos[id].setPresenceStatus(statusMsg);
},
/**