瀏覽代碼

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,9 +91,6 @@ function SmallVideo(VideoLayout) {
91 91
     this.VideoLayout = VideoLayout;
92 92
     this.videoIsHovered = false;
93 93
 
94
-    // we can stop updating the thumbnail
95
-    this.disableUpdateView = false;
96
-
97 94
     /**
98 95
      * The current state of the user's bridge connection. The value should be
99 96
      * a string as enumerated in the library's participantConnectionStatus
@@ -513,8 +510,7 @@ SmallVideo.prototype.isCurrentlyOnLargeVideo = function() {
513 510
  * or <tt>false</tt> otherwise.
514 511
  */
515 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,23 +520,48 @@ SmallVideo.prototype.isVideoPlayable = function() {
524 520
  * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
525 521
  */
526 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 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 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 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,10 +580,6 @@ SmallVideo.prototype._isHovered = function() {
559 580
  * reflect it on this small video.
560 581
  */
561 582
 SmallVideo.prototype.updateView = function() {
562
-    if (this.disableUpdateView) {
563
-        return;
564
-    }
565
-
566 583
     if (this.id) {
567 584
         // Init / refresh avatar
568 585
         this.initializeAvatar();
@@ -575,27 +592,39 @@ SmallVideo.prototype.updateView = function() {
575 592
     this.$container.removeClass((index, classNames) =>
576 593
         classNames.split(' ').filter(name => name.startsWith('display-')));
577 594
 
595
+    const oldDisplayMode = this.displayMode;
596
+    let displayModeString = '';
597
+
578 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 602
     case DISPLAY_AVATAR_WITH_NAME:
603
+        displayModeString = 'avatar-with-name';
583 604
         this.$container.addClass('display-avatar-with-name');
584 605
         break;
585 606
     case DISPLAY_BLACKNESS_WITH_NAME:
607
+        displayModeString = 'blackness-with-name';
586 608
         this.$container.addClass('display-name-on-black');
587 609
         break;
588 610
     case DISPLAY_VIDEO:
611
+        displayModeString = 'video';
589 612
         this.$container.addClass('display-video');
590 613
         break;
591 614
     case DISPLAY_VIDEO_WITH_NAME:
615
+        displayModeString = 'video-with-name';
592 616
         this.$container.addClass('display-name-on-video');
593 617
         break;
594 618
     case DISPLAY_AVATAR:
595 619
     default:
620
+        displayModeString = 'avatar';
596 621
         this.$container.addClass('display-avatar-only');
597 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,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import Logger from 'jitsi-meet-logger';
3 4
 import type { Dispatch } from 'redux';
4 5
 
5 6
 import {
@@ -15,6 +16,8 @@ import {
15 16
 
16 17
 import { setTileView } from '../actions';
17 18
 
19
+const logger = Logger.getLogger(__filename);
20
+
18 21
 /**
19 22
  * The type of the React {@code Component} props of {@link TileViewButton}.
20 23
  */
@@ -59,8 +62,10 @@ class TileViewButton<P: Props> extends AbstractButton<P, *> {
59 62
             {
60 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…
取消
儲存