Browse Source

ref: Tweak logging logic for thumbnail display mode and tile view.

master
George Politis 6 years ago
parent
commit
fb1ed22c6c
1 changed files with 21 additions and 28 deletions
  1. 21
    28
      modules/UI/videolayout/SmallVideo.js

+ 21
- 28
modules/UI/videolayout/SmallVideo.js View File

@@ -520,40 +520,33 @@ SmallVideo.prototype.isVideoPlayable = function() {
520 520
  * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
521 521
  * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
522 522
  */
523
-SmallVideo.prototype.selectDisplayMode = function() {
524
-    const isAudioOnly = APP.conference.isAudioOnly();
525
-    const tileViewEnabled = shouldDisplayTileView(APP.store.getState());
526
-    const isVideoPlayable = this.isVideoPlayable();
527
-    const hasVideo = Boolean(this.selectVideoElement().length);
523
+SmallVideo.prototype.selectDisplayMode = function(input) {
528 524
 
529 525
     // Display name is always and only displayed when user is on the stage
530
-    if (this.isCurrentlyOnLargeVideo() && !tileViewEnabled) {
531
-        return isVideoPlayable && !isAudioOnly ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
532
-    } else if (isVideoPlayable && hasVideo && !isAudioOnly) {
526
+    if (input.isCurrentlyOnLargeVideo && !input.tileViewEnabled) {
527
+        return input.isVideoPlayable && !input.isAudioOnly ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
528
+    } else if (input.isVideoPlayable && input.hasVideo && !input.isAudioOnly) {
533 529
         // check hovering and change state to video with name
534
-        return this._isHovered() ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
530
+        return input.isHovered ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
535 531
     }
536 532
 
537 533
     // check hovering and change state to avatar with name
538
-    return this._isHovered() ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
534
+    return input.isHovered ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
539 535
 };
540 536
 
541 537
 /**
542
- * Prints information about the current display mode.
538
+ * Computes information that determine the display mode.
543 539
  *
544
- * @param {string} mode - The current mode.
545
- * @returns {void}
546
- */
547
-SmallVideo.prototype._printDisplayModeInfo = function(mode) {
548
-    const isAudioOnly = APP.conference.isAudioOnly();
549
-    const tileViewEnabled = shouldDisplayTileView(APP.store.getState());
550
-    const isVideoPlayable = this.isVideoPlayable();
551
-    const hasVideo = Boolean(this.selectVideoElement().length);
552
-    const displayModeInfo = {
553
-        isAudioOnly,
554
-        tileViewEnabled,
555
-        isVideoPlayable,
556
-        hasVideo,
540
+ * @returns {Object}
541
+ */
542
+SmallVideo.prototype.computeDisplayModeInput = function() {
543
+    return {
544
+        isCurrentlyOnLargeVideo: this.isCurrentlyOnLargeVideo(),
545
+        isHovered: this._isHovered(),
546
+        isAudioOnly: APP.conference.isAudioOnly(),
547
+        tileViewEnabled: shouldDisplayTileView(APP.store.getState()),
548
+        isVideoPlayable: this.isVideoPlayable(),
549
+        hasVideo: Boolean(this.selectVideoElement().length),
557 550
         connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
558 551
         mutedWhileDisconnected: this.mutedWhileDisconnected,
559 552
         wasVideoPlayed: this.wasVideoPlayed,
@@ -561,8 +554,6 @@ SmallVideo.prototype._printDisplayModeInfo = function(mode) {
561 554
         isVideoMuted: this.isVideoMuted,
562 555
         videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
563 556
     };
564
-
565
-    logger.debug(`Displaying ${mode} for ${this.id}, reason: [${JSON.stringify(displayModeInfo)}]`);
566 557
 };
567 558
 
568 559
 /**
@@ -596,8 +587,10 @@ SmallVideo.prototype.updateView = function() {
596 587
     const oldDisplayMode = this.displayMode;
597 588
     let displayModeString = '';
598 589
 
590
+    const displayModeInput = this.computeDisplayModeInput();
591
+
599 592
     // Determine whether video, avatar or blackness should be displayed
600
-    this.displayMode = this.selectDisplayMode();
593
+    this.displayMode = this.selectDisplayMode(displayModeInput);
601 594
 
602 595
     switch (this.displayMode) {
603 596
     case DISPLAY_AVATAR_WITH_NAME:
@@ -624,7 +617,7 @@ SmallVideo.prototype.updateView = function() {
624 617
     }
625 618
 
626 619
     if (this.displayMode !== oldDisplayMode) {
627
-        this._printDisplayModeInfo(displayModeString);
620
+        logger.debug(`Displaying ${displayModeString} for ${this.id}, reason: [${JSON.stringify(displayModeInput)}]`);
628 621
     }
629 622
 };
630 623
 

Loading…
Cancel
Save