浏览代码

feat(RemoteVideo): show disconnected GSM bars for remotes

j8
paweldomas 8 年前
父节点
当前提交
9d1364b6fb
共有 4 个文件被更改,包括 75 次插入0 次删除
  1. 4
    0
      conference.js
  2. 11
    0
      modules/UI/UI.js
  3. 43
    0
      modules/UI/videolayout/RemoteVideo.js
  4. 17
    0
      modules/UI/videolayout/VideoLayout.js

+ 4
- 0
conference.js 查看文件

1197
             ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (ids, enteringIds) => {
1197
             ConferenceEvents.LAST_N_ENDPOINTS_CHANGED, (ids, enteringIds) => {
1198
             APP.UI.handleLastNEndpoints(ids, enteringIds);
1198
             APP.UI.handleLastNEndpoints(ids, enteringIds);
1199
         });
1199
         });
1200
+        room.on(
1201
+            ConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED, (id, isActive) => {
1202
+            APP.UI.participantConnectionStatusChanged(id, isActive);
1203
+        });
1200
         room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1204
         room.on(ConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {
1201
             if (this.isLocalId(id)) {
1205
             if (this.isLocalId(id)) {
1202
                 this.isDominantSpeaker = true;
1206
                 this.isDominantSpeaker = true;

+ 11
- 0
modules/UI/UI.js 查看文件

995
     VideoLayout.onLastNEndpointsChanged(ids, enteringIds);
995
     VideoLayout.onLastNEndpointsChanged(ids, enteringIds);
996
 };
996
 };
997
 
997
 
998
+/**
999
+ * Will handle notification about participant's connectivity status change.
1000
+ *
1001
+ * @param {string} id the id of remote participant(MUC jid)
1002
+ * @param {boolean} isActive true if the connection is ok or false if the user
1003
+ * is having connectivity issues.
1004
+ */
1005
+UI.participantConnectionStatusChanged = function (id, isActive) {
1006
+    VideoLayout.onParticipantConnectionStatusChanged(id, isActive);
1007
+};
1008
+
998
 /**
1009
 /**
999
  * Update audio level visualization for specified user.
1010
  * Update audio level visualization for specified user.
1000
  * @param {string} id user id
1011
  * @param {string} id user id

+ 43
- 0
modules/UI/videolayout/RemoteVideo.js 查看文件

227
         this.VideoLayout.updateLargeVideo(this.id);
227
         this.VideoLayout.updateLargeVideo(this.id);
228
 };
228
 };
229
 
229
 
230
+/**
231
+ * Checks whether the remote user associated with this <tt>RemoteVideo</tt>
232
+ * has connectivity issues.
233
+ *
234
+ * @return {boolean} <tt>true</tt> if the user's connection is fine or
235
+ * <tt>false</tt> otherwise.
236
+ */
237
+RemoteVideo.prototype.isConnectionActive = function() {
238
+    return this.user.isConnectionActive();
239
+};
240
+
241
+/**
242
+ * @inheritDoc
243
+ */
244
+RemoteVideo.prototype.updateView = function () {
245
+    SmallVideo.prototype.updateView.call(this);
246
+    this.updateConnectionStatusIndicator(
247
+        null /* will obtain the status from 'conference' */);
248
+};
249
+
250
+/**
251
+ * Updates the UI to reflect user's connectivity status.
252
+ * @param isActive {boolean|null} 'true' if user's connection is active or
253
+ * 'false' when the use is having some connectivity issues and a warning
254
+ * should be displayed. When 'null' is passed then the current value will be
255
+ * obtained from the conference instance.
256
+ */
257
+RemoteVideo.prototype.updateConnectionStatusIndicator = function (isActive) {
258
+    // Check for initial value if 'isActive' is not defined
259
+    if (typeof isActive !== "boolean") {
260
+        isActive = this.isConnectionActive();
261
+        if (isActive === null) {
262
+            // Cancel processing at this point - no update
263
+            return;
264
+        }
265
+    }
266
+
267
+    console.debug(this.id + " thumbnail is connection active ? " + isActive);
268
+
269
+    if(this.connectionIndicator)
270
+        this.connectionIndicator.updateConnectionStatusIndicator(isActive);
271
+};
272
+
230
 /**
273
 /**
231
  * Removes RemoteVideo from the page.
274
  * Removes RemoteVideo from the page.
232
  */
275
  */

+ 17
- 0
modules/UI/videolayout/VideoLayout.js 查看文件

423
         } else {
423
         } else {
424
             VideoLayout.resizeThumbnails(false, true);
424
             VideoLayout.resizeThumbnails(false, true);
425
         }
425
         }
426
+        // Initialize the view
427
+        remoteVideo.updateView();
426
     },
428
     },
427
 
429
 
428
     videoactive (videoelem, resourceJid) {
430
     videoactive (videoelem, resourceJid) {
640
         }
642
         }
641
     },
643
     },
642
 
644
 
645
+    /**
646
+     * Shows/hides warning about remote user's connectivity issues.
647
+     *
648
+     * @param {string} id the ID of the remote participant(MUC nickname)
649
+     * @param {boolean} isActive true if the connection is ok or false when
650
+     * the user is having connectivity issues.
651
+     */
652
+    onParticipantConnectionStatusChanged (id, isActive) {
653
+        // Show/hide warning on the thumbnail
654
+        let remoteVideo = remoteVideos[id];
655
+        if (remoteVideo) {
656
+            remoteVideo.updateConnectionStatusIndicator(isActive);
657
+        }
658
+    },
659
+
643
     /**
660
     /**
644
      * On last N change event.
661
      * On last N change event.
645
      *
662
      *

正在加载...
取消
保存