Просмотр исходного кода

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

* Uses new peer connection statuses to check and show different user msgs.

Checks for interrupted state of peer connection and shows appropriate messages. In case of inactive or restoring state a message is show to user that video was stopped on purpose. Removes some unused parameters from the event handlers about peer connection status change.

* Removes isParticipantConnectionActive.
j8
Дамян Минков 8 лет назад
Родитель
Сommit
2248560699

+ 8
- 7
conference.js Просмотреть файл

@@ -790,16 +790,17 @@ export default {
790 790
         return room ? room.getParticipantById(id) : null;
791 791
     },
792 792
     /**
793
-     * Checks whether the user identified by given id is currently connected.
793
+     * Get participant connection status for the participant.
794 794
      *
795 795
      * @param {string} id participant's identifier(MUC nickname)
796 796
      *
797
-     * @returns {boolean|null} true if participant's connection is ok or false
798
-     * if the user is having connectivity issues.
797
+     * @returns {ParticipantConnectionStatus|null} the status of the participant
798
+     * or null if no such participant is found or participant is the local user.
799 799
      */
800
-    isParticipantConnectionActive (id) {
800
+    getParticipantConnectionStatus (id) {
801 801
         let participant = this.getParticipantById(id);
802
-        return participant ? participant.isConnectionActive() : null;
802
+        return participant
803
+            ? participant.getConnectionStatus() : null;
803 804
     },
804 805
     /**
805 806
      * Gets the display name foe the <tt>JitsiParticipant</tt> identified by
@@ -1306,8 +1307,8 @@ export default {
1306 1307
 
1307 1308
         room.on(
1308 1309
             ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
1309
-            (id, isActive) => {
1310
-                APP.UI.participantConnectionStatusChanged(id, isActive);
1310
+            id => {
1311
+                APP.UI.participantConnectionStatusChanged(id);
1311 1312
         });
1312 1313
         room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1313 1314
             if (this.isLocalId(id)) {

+ 2
- 4
modules/UI/UI.js Просмотреть файл

@@ -849,11 +849,9 @@ UI.handleLastNEndpoints = function (leavingIds, enteringIds) {
849 849
  * Will handle notification about participant's connectivity status change.
850 850
  *
851 851
  * @param {string} id the id of remote participant(MUC jid)
852
- * @param {boolean} isActive true if the connection is ok or false if the user
853
- * is having connectivity issues.
854 852
  */
855
-UI.participantConnectionStatusChanged = function (id, isActive) {
856
-    VideoLayout.onParticipantConnectionStatusChanged(id, isActive);
853
+UI.participantConnectionStatusChanged = function (id) {
854
+    VideoLayout.onParticipantConnectionStatusChanged(id);
857 855
 };
858 856
 
859 857
 /**

+ 33
- 8
modules/UI/videolayout/LargeVideoManager.js Просмотреть файл

@@ -1,4 +1,4 @@
1
-/* global $, APP */
1
+/* global $, APP, JitsiMeetJS */
2 2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 
4 4
 import Avatar from "../avatar/Avatar";
@@ -9,6 +9,9 @@ import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";
9 9
 
10 10
 import AudioLevels from "../audio_levels/AudioLevels";
11 11
 
12
+const ParticipantConnectionStatus
13
+    = JitsiMeetJS.constants.participantConnectionStatus;
14
+
12 15
 /**
13 16
  * Manager for all Large containers.
14 17
  */
@@ -114,7 +117,7 @@ export default class LargeVideoManager {
114 117
             // (camera or desktop) is a completely different thing than
115 118
             // the video container type (Etherpad, SharedVideo, VideoContainer).
116 119
             // ----------------------------------------------------------------
117
-            // If we the continer is VIDEO_CONTAINER_TYPE, we need to check
120
+            // If the container is VIDEO_CONTAINER_TYPE, we need to check
118 121
             // its stream whether exist and is muted to set isVideoMuted
119 122
             // in rest of the cases it is false
120 123
             let showAvatar
@@ -125,11 +128,10 @@ export default class LargeVideoManager {
125 128
             // displayed in case we have no video image cached. That is if
126 129
             // there was a user switch(image is lost on stream detach) or if
127 130
             // the video was not rendered, before the connection has failed.
128
-            const isHavingConnectivityIssues
129
-                = APP.conference.isParticipantConnectionActive(id) === false;
131
+            const isConnectionActive = this._isConnectionActive(id);
130 132
 
131 133
             if (videoType === VIDEO_CONTAINER_TYPE
132
-                    && isHavingConnectivityIssues
134
+                    && !isConnectionActive
133 135
                     && (isUserSwitch || !container.wasVideoRendered)) {
134 136
                 showAvatar = true;
135 137
             }
@@ -158,12 +160,19 @@ export default class LargeVideoManager {
158 160
             // Make sure no notification about remote failure is shown as
159 161
             // its UI conflicts with the one for local connection interrupted.
160 162
             const isConnected = APP.conference.isConnectionInterrupted()
161
-                                || !isHavingConnectivityIssues;
163
+                                || isConnectionActive;
164
+
165
+            // when isHavingConnectivityIssues, state can be inactive,
166
+            // interrupted or restoring. We show different message for
167
+            // interrupted and the rest.
168
+            const isConnectionInterrupted =
169
+                APP.conference.getParticipantConnectionStatus(id)
170
+                    === ParticipantConnectionStatus.INTERRUPTED;
162 171
 
163 172
             this.updateParticipantConnStatusIndication(
164 173
                     id,
165 174
                     isConnected,
166
-                    (isHavingConnectivityIssues)
175
+                    (isConnectionInterrupted)
167 176
                         ? "connection.USER_CONNECTION_INTERRUPTED"
168 177
                         : "connection.LOW_BANDWIDTH");
169 178
 
@@ -180,6 +189,22 @@ export default class LargeVideoManager {
180 189
         });
181 190
     }
182 191
 
192
+    /**
193
+     * Checks whether a participant's peer connection status is active.
194
+     * There is no JitsiParticipant for local id we skip checking local
195
+     * participant and report it as having no connectivity issues.
196
+     *
197
+     * @param {string} id the id of participant(MUC nickname)
198
+     * @returns {boolean} <tt>true</tt> when participant connection status is
199
+     * {@link ParticipantConnectionStatus.ACTIVE} and <tt>false</tt> otherwise.
200
+     * @private
201
+     */
202
+    _isConnectionActive(id) {
203
+        return APP.conference.isLocalId(id)
204
+                || APP.conference.getParticipantConnectionStatus(this.id)
205
+                    === ParticipantConnectionStatus.ACTIVE;
206
+    }
207
+
183 208
     /**
184 209
      * Shows/hides notification about participant's connectivity issues to be
185 210
      * shown on the large video area.
@@ -340,7 +365,7 @@ export default class LargeVideoManager {
340 365
      */
341 366
     showRemoteConnectionMessage (show) {
342 367
         if (typeof show !== 'boolean') {
343
-            show = !APP.conference.isParticipantConnectionActive(this.id);
368
+            show = !this._isConnectionActive(this.id);
344 369
         }
345 370
 
346 371
         if (show) {

+ 6
- 3
modules/UI/videolayout/RemoteVideo.js Просмотреть файл

@@ -1,4 +1,4 @@
1
-/* global $, APP, interfaceConfig */
1
+/* global $, APP, interfaceConfig, JitsiMeetJS */
2 2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 
4 4
 import ConnectionIndicator from './ConnectionIndicator';
@@ -12,6 +12,8 @@ const MUTED_DIALOG_BUTTON_VALUES = {
12 12
     cancel: 0,
13 13
     muted: 1
14 14
 };
15
+const ParticipantConnectionStatus
16
+    = JitsiMeetJS.constants.participantConnectionStatus;
15 17
 
16 18
 /**
17 19
  * Creates new instance of the <tt>RemoteVideo</tt>.
@@ -447,7 +449,7 @@ RemoteVideo.prototype.updateRemoteVideoMenu = function (isMuted, force) {
447 449
 RemoteVideo.prototype.setMutedView = function(isMuted) {
448 450
     SmallVideo.prototype.setMutedView.call(this, isMuted);
449 451
     // Update 'mutedWhileDisconnected' flag
450
-    this._figureOutMutedWhileDisconnected(this.isConnectionActive() === false);
452
+    this._figureOutMutedWhileDisconnected(this.isConnectionInterrupted());
451 453
 };
452 454
 
453 455
 /**
@@ -534,7 +536,8 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
534 536
  * <tt>false</tt> otherwise.
535 537
  */
536 538
 RemoteVideo.prototype.isConnectionActive = function() {
537
-    return this.user.isConnectionActive();
539
+    return this.user.getConnectionStatus()
540
+        === ParticipantConnectionStatus.ACTIVE;
538 541
 };
539 542
 
540 543
 /**

+ 8
- 4
modules/UI/videolayout/VideoLayout.js Просмотреть файл

@@ -658,14 +658,18 @@ var VideoLayout = {
658 658
      * Shows/hides warning about remote user's connectivity issues.
659 659
      *
660 660
      * @param {string} id the ID of the remote participant(MUC nickname)
661
-     * @param {boolean} isActive true if the connection is ok or false when
662
-     * the user is having connectivity issues.
663 661
      */
664 662
     // eslint-disable-next-line no-unused-vars
665
-    onParticipantConnectionStatusChanged (id, isActive) {
663
+    onParticipantConnectionStatusChanged (id) {
666 664
         // Show/hide warning on the large video
667 665
         if (this.isCurrentlyOnLarge(id)) {
668
-            if (largeVideo) {
666
+            // when pinning and we have lastN enabled, we have rapid connection
667
+            // status changed between inactive, restoring and active and
668
+            // if there was a large video update scheduled already it will
669
+            // reflect the current status and no need to schedule new one
670
+            // otherwise we end up scheduling updates for endpoints which are
671
+            // were on large while checking, but a change was already scheduled
672
+            if (largeVideo && !largeVideo.updateInProcess) {
669 673
                 // We have to trigger full large video update to transition from
670 674
                 // avatar to video on connectivity restored.
671 675
                 this.updateLargeVideo(id, true /* force update */);

Загрузка…
Отмена
Сохранить