Bläddra i källkod

fix(large-video): trigger update after timeout for 1-on-1 calls (#1599)

* fix(large-video): trigger update after timeout for 1-on-1 calls

Currently no video switch happens if a user joins audio and video
muted. For example, User A is in a call and User B joins with no
mic and camera. User A will keep seeing local video on large video.
The fix is to set a timeout, of a somewhat arbitrary 3 seconds, to
show User B on large video.

* SQUASH: wrap videoElement access in if

* SQUASH: split out remoteVideoActive logic
j8
virtuacoplenny 8 år sedan
förälder
incheckning
1da95d2e37
1 ändrade filer med 30 tillägg och 4 borttagningar
  1. 30
    4
      modules/UI/videolayout/VideoLayout.js

+ 30
- 4
modules/UI/videolayout/VideoLayout.js Visa fil

435
             remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
435
             remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);
436
         this._setRemoteControlProperties(user, remoteVideo);
436
         this._setRemoteControlProperties(user, remoteVideo);
437
         this.addRemoteVideoContainer(id, remoteVideo);
437
         this.addRemoteVideoContainer(id, remoteVideo);
438
+
439
+        const remoteVideosCount = Object.keys(remoteVideos).length;
440
+
441
+        if (remoteVideosCount === 1) {
442
+            window.setTimeout(() => {
443
+                const updatedRemoteVideosCount
444
+                    = Object.keys(remoteVideos).length;
445
+
446
+                if (updatedRemoteVideosCount === 1 && remoteVideos[id]) {
447
+                    this._maybePlaceParticipantOnLargeVideo(id);
448
+                }
449
+            }, 3000);
450
+        }
438
     },
451
     },
439
 
452
 
440
     /**
453
     /**
465
         logger.info(resourceJid + " video is now active", videoElement);
478
         logger.info(resourceJid + " video is now active", videoElement);
466
 
479
 
467
         VideoLayout.resizeThumbnails(
480
         VideoLayout.resizeThumbnails(
468
-            false, false, function() {$(videoElement).show();});
481
+            false, false, () => {
482
+                if (videoElement) {
483
+                    $(videoElement).show();
484
+                }
485
+            });
469
 
486
 
470
-        // Update the large video to the last added video only if there's no
471
-        // current dominant, focused speaker or update it to
472
-        // the current dominant speaker.
487
+        this._maybePlaceParticipantOnLargeVideo(resourceJid);
488
+    },
489
+
490
+    /**
491
+     * Update the large video to the last added video only if there's no current
492
+     * dominant, focused speaker or update it to the current dominant speaker.
493
+     *
494
+     * @params {string} resourceJid - The id of the user to maybe display on
495
+     * large video.
496
+     * @returns {void}
497
+     */
498
+    _maybePlaceParticipantOnLargeVideo(resourceJid) {
473
         if ((!pinnedId &&
499
         if ((!pinnedId &&
474
             !currentDominantSpeaker &&
500
             !currentDominantSpeaker &&
475
             this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE)) ||
501
             this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE)) ||

Laddar…
Avbryt
Spara