瀏覽代碼

feat: Add logging for thumbnail display mode and tile view.

master
Hristo Terezov 5 年之前
父節點
當前提交
c3e52f32f9
共有 2 個文件被更改,包括 57 次插入23 次删除
  1. 51
    22
      modules/UI/videolayout/SmallVideo.js
  2. 6
    1
      react/features/video-layout/components/TileViewButton.js

+ 51
- 22
modules/UI/videolayout/SmallVideo.js 查看文件

91
     this.VideoLayout = VideoLayout;
91
     this.VideoLayout = VideoLayout;
92
     this.videoIsHovered = false;
92
     this.videoIsHovered = false;
93
 
93
 
94
-    // we can stop updating the thumbnail
95
-    this.disableUpdateView = false;
96
-
97
     /**
94
     /**
98
      * The current state of the user's bridge connection. The value should be
95
      * The current state of the user's bridge connection. The value should be
99
      * a string as enumerated in the library's participantConnectionStatus
96
      * a string as enumerated in the library's participantConnectionStatus
513
  * or <tt>false</tt> otherwise.
510
  * or <tt>false</tt> otherwise.
514
  */
511
  */
515
 SmallVideo.prototype.isVideoPlayable = function() {
512
 SmallVideo.prototype.isVideoPlayable = function() {
516
-    return this.videoStream // Is there anything to display ?
517
-        && !this.isVideoMuted && !this.videoStream.isMuted(); // Muted ?
513
+    return this.videoStream && !this.isVideoMuted && !this.videoStream.isMuted();
518
 };
514
 };
519
 
515
 
520
 /**
516
 /**
524
  * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
520
  * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
525
  */
521
  */
526
 SmallVideo.prototype.selectDisplayMode = function() {
522
 SmallVideo.prototype.selectDisplayMode = function() {
523
+    const isAudioOnly = APP.conference.isAudioOnly();
524
+    const tileViewEnabled = shouldDisplayTileView(APP.store.getState());
525
+    const isVideoPlayable = this.isVideoPlayable();
526
+    const hasVideo = Boolean(this.selectVideoElement().length);
527
+
527
     // Display name is always and only displayed when user is on the stage
528
     // Display name is always and only displayed when user is on the stage
528
-    if (this.isCurrentlyOnLargeVideo()
529
-        && !shouldDisplayTileView(APP.store.getState())) {
530
-        return this.isVideoPlayable() && !APP.conference.isAudioOnly()
531
-            ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
532
-    } else if (this.isVideoPlayable()
533
-        && this.selectVideoElement().length
534
-        && !APP.conference.isAudioOnly()) {
529
+    if (this.isCurrentlyOnLargeVideo() && !tileViewEnabled) {
530
+        return isVideoPlayable && !isAudioOnly ? DISPLAY_BLACKNESS_WITH_NAME : DISPLAY_AVATAR_WITH_NAME;
531
+    } else if (isVideoPlayable && hasVideo && !isAudioOnly) {
535
         // check hovering and change state to video with name
532
         // check hovering and change state to video with name
536
-        return this._isHovered()
537
-            ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
533
+        return this._isHovered() ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
538
     }
534
     }
539
 
535
 
540
     // check hovering and change state to avatar with name
536
     // check hovering and change state to avatar with name
541
-    return this._isHovered()
542
-        ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
537
+    return this._isHovered() ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
538
+};
543
 
539
 
540
+/**
541
+ * Prints information about the current display mode.
542
+ *
543
+ * @param {string} mode - The current mode.
544
+ * @returns {void}
545
+ */
546
+SmallVideo.prototype._printDisplayModeInfo = function(mode) {
547
+    const isAudioOnly = APP.conference.isAudioOnly();
548
+    const tileViewEnabled = shouldDisplayTileView(APP.store.getState());
549
+    const isVideoPlayable = this.isVideoPlayable();
550
+    const hasVideo = Boolean(this.selectVideoElement().length);
551
+    const displayModeInfo = {
552
+        isAudioOnly,
553
+        tileViewEnabled,
554
+        isVideoPlayable,
555
+        hasVideo,
556
+        connectionStatus: APP.conference.getParticipantConnectionStatus(this.id),
557
+        mutedWhileDisconnected: this.mutedWhileDisconnected,
558
+        wasVideoPlayed: this.wasVideoPlayed,
559
+        videoStream: Boolean(this.videoStream),
560
+        isVideoMuted: this.isVideoMuted,
561
+        videoStreamMuted: this.videoStream ? this.videoStream.isMuted() : 'no stream'
562
+    };
563
+
564
+    logger.debug(`Displaying ${mode} for ${this.id}, reason: [${JSON.stringify(displayModeInfo)}]`);
544
 };
565
 };
545
 
566
 
546
 /**
567
 /**
559
  * reflect it on this small video.
580
  * reflect it on this small video.
560
  */
581
  */
561
 SmallVideo.prototype.updateView = function() {
582
 SmallVideo.prototype.updateView = function() {
562
-    if (this.disableUpdateView) {
563
-        return;
564
-    }
565
-
566
     if (this.id) {
583
     if (this.id) {
567
         // Init / refresh avatar
584
         // Init / refresh avatar
568
         this.initializeAvatar();
585
         this.initializeAvatar();
575
     this.$container.removeClass((index, classNames) =>
592
     this.$container.removeClass((index, classNames) =>
576
         classNames.split(' ').filter(name => name.startsWith('display-')));
593
         classNames.split(' ').filter(name => name.startsWith('display-')));
577
 
594
 
595
+    const oldDisplayMode = this.displayMode;
596
+    let displayModeString = '';
597
+
578
     // Determine whether video, avatar or blackness should be displayed
598
     // Determine whether video, avatar or blackness should be displayed
579
-    const displayMode = this.selectDisplayMode();
599
+    this.displayMode = this.selectDisplayMode();
580
 
600
 
581
-    switch (displayMode) {
601
+    switch (this.displayMode) {
582
     case DISPLAY_AVATAR_WITH_NAME:
602
     case DISPLAY_AVATAR_WITH_NAME:
603
+        displayModeString = 'avatar-with-name';
583
         this.$container.addClass('display-avatar-with-name');
604
         this.$container.addClass('display-avatar-with-name');
584
         break;
605
         break;
585
     case DISPLAY_BLACKNESS_WITH_NAME:
606
     case DISPLAY_BLACKNESS_WITH_NAME:
607
+        displayModeString = 'blackness-with-name';
586
         this.$container.addClass('display-name-on-black');
608
         this.$container.addClass('display-name-on-black');
587
         break;
609
         break;
588
     case DISPLAY_VIDEO:
610
     case DISPLAY_VIDEO:
611
+        displayModeString = 'video';
589
         this.$container.addClass('display-video');
612
         this.$container.addClass('display-video');
590
         break;
613
         break;
591
     case DISPLAY_VIDEO_WITH_NAME:
614
     case DISPLAY_VIDEO_WITH_NAME:
615
+        displayModeString = 'video-with-name';
592
         this.$container.addClass('display-name-on-video');
616
         this.$container.addClass('display-name-on-video');
593
         break;
617
         break;
594
     case DISPLAY_AVATAR:
618
     case DISPLAY_AVATAR:
595
     default:
619
     default:
620
+        displayModeString = 'avatar';
596
         this.$container.addClass('display-avatar-only');
621
         this.$container.addClass('display-avatar-only');
597
         break;
622
         break;
598
     }
623
     }
624
+
625
+    if (this.displayMode !== oldDisplayMode) {
626
+        this._printDisplayModeInfo(displayModeString);
627
+    }
599
 };
628
 };
600
 
629
 
601
 /**
630
 /**

+ 6
- 1
react/features/video-layout/components/TileViewButton.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
+import Logger from 'jitsi-meet-logger';
3
 import type { Dispatch } from 'redux';
4
 import type { Dispatch } from 'redux';
4
 
5
 
5
 import {
6
 import {
15
 
16
 
16
 import { setTileView } from '../actions';
17
 import { setTileView } from '../actions';
17
 
18
 
19
+const logger = Logger.getLogger(__filename);
20
+
18
 /**
21
 /**
19
  * The type of the React {@code Component} props of {@link TileViewButton}.
22
  * The type of the React {@code Component} props of {@link TileViewButton}.
20
  */
23
  */
59
             {
62
             {
60
                 'is_enabled': _tileViewEnabled
63
                 'is_enabled': _tileViewEnabled
61
             }));
64
             }));
65
+        const value = !_tileViewEnabled;
62
 
66
 
63
-        dispatch(setTileView(!_tileViewEnabled));
67
+        logger.debug(`Tile view ${value ? 'enable' : 'disable'}`);
68
+        dispatch(setTileView(value));
64
     }
69
     }
65
 
70
 
66
     /**
71
     /**

Loading…
取消
儲存