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
  * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
520
  * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
521
  * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
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
     // Display name is always and only displayed when user is on the stage
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
         // check hovering and change state to video with name
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
     // check hovering and change state to avatar with name
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
         connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
550
         connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
558
         mutedWhileDisconnected: this.mutedWhileDisconnected,
551
         mutedWhileDisconnected: this.mutedWhileDisconnected,
559
         wasVideoPlayed: this.wasVideoPlayed,
552
         wasVideoPlayed: this.wasVideoPlayed,
561
         isVideoMuted: this.isVideoMuted,
554
         isVideoMuted: this.isVideoMuted,
562
         videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
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
     const oldDisplayMode = this.displayMode;
587
     const oldDisplayMode = this.displayMode;
597
     let displayModeString = '';
588
     let displayModeString = '';
598
 
589
 
590
+    const displayModeInput = this.computeDisplayModeInput();
591
+
599
     // Determine whether video, avatar or blackness should be displayed
592
     // Determine whether video, avatar or blackness should be displayed
600
-    this.displayMode = this.selectDisplayMode();
593
+    this.displayMode = this.selectDisplayMode(displayModeInput);
601
 
594
 
602
     switch (this.displayMode) {
595
     switch (this.displayMode) {
603
     case DISPLAY_AVATAR_WITH_NAME:
596
     case DISPLAY_AVATAR_WITH_NAME:
624
     }
617
     }
625
 
618
 
626
     if (this.displayMode !== oldDisplayMode) {
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