Skip to content

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

Uses new peer connection statuses to check and show different user msgs. (#1441)

Дамян Минков22485606996d
diff --git a/conference.js b/conference.js
index 7edfc93c1e..4509db3826 100644
--- a/conference.js
+++ b/conference.js
@@ -790,16 +790,17 @@ export default {
return room ? room.getParticipantById(id) : null;
},
/**
- * Checks whether the user identified by given id is currently connected.
+ * Get participant connection status for the participant.
*
* @param {string} id participant's identifier(MUC nickname)
*
- * @returns {boolean|null} true if participant's connection is ok or false
- * if the user is having connectivity issues.
+ * @returns {ParticipantConnectionStatus|null} the status of the participant
+ * or null if no such participant is found or participant is the local user.
*/
- isParticipantConnectionActive (id) {
+ getParticipantConnectionStatus (id) {
let participant = this.getParticipantById(id);
- return participant ? participant.isConnectionActive() : null;
+ return participant
+ ? participant.getConnectionStatus() : null;
},
/**
* Gets the display name foe the <tt>JitsiParticipant</tt> identified by
@@ -1306,8 +1307,8 @@ export default {
room.on(
ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
- (id, isActive) => {
- APP.UI.participantConnectionStatusChanged(id, isActive);
+ id => {
+ APP.UI.participantConnectionStatusChanged(id);
});
room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
if (this.isLocalId(id)) {
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index a59cfd6c6c..d5624c4bf1 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -849,11 +849,9 @@ UI.handleLastNEndpoints = function (leavingIds, enteringIds) {
* Will handle notification about participant's connectivity status change.
*
* @param {string} id the id of remote participant(MUC jid)
- * @param {boolean} isActive true if the connection is ok or false if the user
- * is having connectivity issues.
*/
-UI.participantConnectionStatusChanged = function (id, isActive) {
- VideoLayout.onParticipantConnectionStatusChanged(id, isActive);
+UI.participantConnectionStatusChanged = function (id) {
+ VideoLayout.onParticipantConnectionStatusChanged(id);
};
/**
diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js
index 29a74ea8ab..e594f8f89f 100644
--- a/modules/UI/videolayout/LargeVideoManager.js
+++ b/modules/UI/videolayout/LargeVideoManager.js
@@ -1,4 +1,4 @@
-/* global $, APP */
+/* global $, APP, JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import Avatar from "../avatar/Avatar";
@@ -9,6 +9,9 @@ import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";
import AudioLevels from "../audio_levels/AudioLevels";
+const ParticipantConnectionStatus
+ = JitsiMeetJS.constants.participantConnectionStatus;
+
/**
* Manager for all Large containers.
*/
@@ -114,7 +117,7 @@ export default class LargeVideoManager {
// (camera or desktop) is a completely different thing than
// the video container type (Etherpad, SharedVideo, VideoContainer).
// ----------------------------------------------------------------
- // If we the continer is VIDEO_CONTAINER_TYPE, we need to check
+ // If the container is VIDEO_CONTAINER_TYPE, we need to check
// its stream whether exist and is muted to set isVideoMuted
// in rest of the cases it is false
let showAvatar
@@ -125,11 +128,10 @@ export default class LargeVideoManager {
// displayed in case we have no video image cached. That is if
// there was a user switch(image is lost on stream detach) or if
// the video was not rendered, before the connection has failed.
- const isHavingConnectivityIssues
- = APP.conference.isParticipantConnectionActive(id) === false;
+ const isConnectionActive = this._isConnectionActive(id);
if (videoType === VIDEO_CONTAINER_TYPE
- && isHavingConnectivityIssues
+ && !isConnectionActive
&& (isUserSwitch || !container.wasVideoRendered)) {
showAvatar = true;
}
@@ -158,12 +160,19 @@ export default class LargeVideoManager {
// Make sure no notification about remote failure is shown as
// its UI conflicts with the one for local connection interrupted.
const isConnected = APP.conference.isConnectionInterrupted()
- || !isHavingConnectivityIssues;
+ || isConnectionActive;
+
+ // when isHavingConnectivityIssues, state can be inactive,
+ // interrupted or restoring. We show different message for
+ // interrupted and the rest.
+ const isConnectionInterrupted =
+ APP.conference.getParticipantConnectionStatus(id)
+ === ParticipantConnectionStatus.INTERRUPTED;
this.updateParticipantConnStatusIndication(
id,
isConnected,
- (isHavingConnectivityIssues)
+ (isConnectionInterrupted)
? "connection.USER_CONNECTION_INTERRUPTED"
: "connection.LOW_BANDWIDTH");
@@ -180,6 +189,22 @@ export default class LargeVideoManager {
});
}
+ /**
+ * Checks whether a participant's peer connection status is active.
+ * There is no JitsiParticipant for local id we skip checking local
+ * participant and report it as having no connectivity issues.
+ *
+ * @param {string} id the id of participant(MUC nickname)
+ * @returns {boolean} <tt>true</tt> when participant connection status is
+ * {@link ParticipantConnectionStatus.ACTIVE} and <tt>false</tt> otherwise.
+ * @private
+ */
+ _isConnectionActive(id) {
+ return APP.conference.isLocalId(id)
+ || APP.conference.getParticipantConnectionStatus(this.id)
+ === ParticipantConnectionStatus.ACTIVE;
+ }
+
/**
* Shows/hides notification about participant's connectivity issues to be
* shown on the large video area.
@@ -340,7 +365,7 @@ export default class LargeVideoManager {
*/
showRemoteConnectionMessage (show) {
if (typeof show !== 'boolean') {
- show = !APP.conference.isParticipantConnectionActive(this.id);
+ show = !this._isConnectionActive(this.id);
}
if (show) {
diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js
index db69a74041..dfdbc12551 100644
--- a/modules/UI/videolayout/RemoteVideo.js
+++ b/modules/UI/videolayout/RemoteVideo.js
@@ -1,4 +1,4 @@
-/* global $, APP, interfaceConfig */
+/* global $, APP, interfaceConfig, JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import ConnectionIndicator from './ConnectionIndicator';
@@ -12,6 +12,8 @@ const MUTED_DIALOG_BUTTON_VALUES = {
cancel: 0,
muted: 1
};
+const ParticipantConnectionStatus
+ = JitsiMeetJS.constants.participantConnectionStatus;
/**
* Creates new instance of the <tt>RemoteVideo</tt>.
@@ -447,7 +449,7 @@ RemoteVideo.prototype.updateRemoteVideoMenu = function (isMuted, force) {
RemoteVideo.prototype.setMutedView = function(isMuted) {
SmallVideo.prototype.setMutedView.call(this, isMuted);
// Update 'mutedWhileDisconnected' flag
- this._figureOutMutedWhileDisconnected(this.isConnectionActive() === false);
+ this._figureOutMutedWhileDisconnected(this.isConnectionInterrupted());
};
/**
@@ -534,7 +536,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
* <tt>false</tt> otherwise.
*/
RemoteVideo.prototype.isConnectionActive = function() {
- return this.user.isConnectionActive();
+ return this.user.getConnectionStatus()
+ === ParticipantConnectionStatus.ACTIVE;
};
/**
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 734a4ed701..5aa648072d 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -658,14 +658,18 @@ var VideoLayout = {
* Shows/hides warning about remote user's connectivity issues.
*
* @param {string} id the ID of the remote participant(MUC nickname)
- * @param {boolean} isActive true if the connection is ok or false when
- * the user is having connectivity issues.
*/
// eslint-disable-next-line no-unused-vars
- onParticipantConnectionStatusChanged (id, isActive) {
+ onParticipantConnectionStatusChanged (id) {
// Show/hide warning on the large video
if (this.isCurrentlyOnLarge(id)) {
- if (largeVideo) {
+ // when pinning and we have lastN enabled, we have rapid connection
+ // status changed between inactive, restoring and active and
+ // if there was a large video update scheduled already it will
+ // reflect the current status and no need to schedule new one
+ // otherwise we end up scheduling updates for endpoints which are
+ // were on large while checking, but a change was already scheduled
+ if (largeVideo && !largeVideo.updateInProcess) {
// We have to trigger full large video update to transition from
// avatar to video on connectivity restored.
this.updateLargeVideo(id, true /* force update */);