Bladeren bron

Makes decision what to show in avatar consistent (in updateView).

j8
damencho 8 jaren geleden
bovenliggende
commit
2807346bdf

+ 1
- 1
css/_videolayout_default.scss Bestand weergeven

85
     position: relative;
85
     position: relative;
86
     width: 100%;
86
     width: 100%;
87
     height: 100%;
87
     height: 100%;
88
-    display: none;
88
+    visibility: hidden;
89
     background: rgba(0,0,0,.6);
89
     background: rgba(0,0,0,.6);
90
     z-index: 2;
90
     z-index: 2;
91
 }
91
 }

+ 13
- 0
modules/UI/util/JitsiPopover.js Bestand weergeven

98
         var self = this;
98
         var self = this;
99
         $(".jitsipopover").on("mouseenter", function () {
99
         $(".jitsipopover").on("mouseenter", function () {
100
             self.popoverIsHovered = true;
100
             self.popoverIsHovered = true;
101
+            if(typeof self.onHoverPopover === "function") {
102
+                self.onHoverPopover(self.popoverIsHovered);
103
+            }
101
         }).on("mouseleave", function () {
104
         }).on("mouseleave", function () {
102
             self.popoverIsHovered = false;
105
             self.popoverIsHovered = false;
103
             self.hide();
106
             self.hide();
107
+            if(typeof self.onHoverPopover === "function") {
108
+                self.onHoverPopover(self.popoverIsHovered);
109
+            }
104
         });
110
         });
105
 
111
 
106
         this.refreshPosition();
112
         this.refreshPosition();
107
     };
113
     };
108
 
114
 
115
+    /**
116
+     * Adds a hover listener to the popover.
117
+     */
118
+    JitsiPopover.prototype.addOnHoverPopover = function (listener) {
119
+        this.onHoverPopover = listener;
120
+    };
121
+
109
     /**
122
     /**
110
      * Refreshes the position of the popover.
123
      * Refreshes the position of the popover.
111
      */
124
      */

+ 7
- 0
modules/UI/videolayout/ConnectionIndicator.js Bestand weergeven

439
     }
439
     }
440
 };
440
 };
441
 
441
 
442
+/**
443
+ * Adds a hover listener to the popover.
444
+ */
445
+ConnectionIndicator.prototype.addPopoverHoverListener = function (listener) {
446
+    this.popover.addOnHoverPopover(listener);
447
+};
448
+
442
 export default ConnectionIndicator;
449
 export default ConnectionIndicator;

+ 1
- 1
modules/UI/videolayout/LocalVideo.js Bestand weergeven

11
     this.videoSpanId = "localVideoContainer";
11
     this.videoSpanId = "localVideoContainer";
12
     this.container = $("#localVideoContainer").get(0);
12
     this.container = $("#localVideoContainer").get(0);
13
     this.localVideoId = null;
13
     this.localVideoId = null;
14
+    this.createConnectionIndicator();
14
     this.bindHoverHandler();
15
     this.bindHoverHandler();
15
     if(config.enableLocalVideoFlip)
16
     if(config.enableLocalVideoFlip)
16
         this._buildContextMenu();
17
         this._buildContextMenu();
28
     // Set default display name.
29
     // Set default display name.
29
     this.setDisplayName();
30
     this.setDisplayName();
30
 
31
 
31
-    this.createConnectionIndicator();
32
     this.addAudioLevelIndicator();
32
     this.addAudioLevelIndicator();
33
 }
33
 }
34
 
34
 

+ 62
- 24
modules/UI/videolayout/SmallVideo.js Bestand weergeven

21
 const DISPLAY_AVATAR = 1;
21
 const DISPLAY_AVATAR = 1;
22
 /**
22
 /**
23
  * Display mode constant used when neither video nor avatar is being displayed
23
  * Display mode constant used when neither video nor avatar is being displayed
24
- * on the small video.
24
+ * on the small video. And we just show the display name.
25
  * @type {number}
25
  * @type {number}
26
  * @constant
26
  * @constant
27
  */
27
  */
28
-const DISPLAY_BLACKNESS = 2;
28
+const DISPLAY_BLACKNESS_WITH_NAME = 2;
29
+
30
+/**
31
+ * Display mode constant used when video is displayed and display name
32
+ * at the same time.
33
+ * @type {number}
34
+ * @constant
35
+ */
36
+const DISPLAY_VIDEO_WITH_NAME = 3;
37
+
38
+/**
39
+ * Display mode constant used when neither video nor avatar is being displayed
40
+ * on the small video. And we just show the display name.
41
+ * @type {number}
42
+ * @constant
43
+ */
44
+const DISPLAY_AVATAR_WITH_NAME = 4;
29
 
45
 
30
 function SmallVideo(VideoLayout) {
46
 function SmallVideo(VideoLayout) {
31
     this.isAudioMuted = false;
47
     this.isAudioMuted = false;
34
     this.videoStream = null;
50
     this.videoStream = null;
35
     this.audioStream = null;
51
     this.audioStream = null;
36
     this.VideoLayout = VideoLayout;
52
     this.VideoLayout = VideoLayout;
53
+    this.videoIsHovered = false;
37
 }
54
 }
38
 
55
 
39
 /**
56
 /**
144
 };
161
 };
145
 
162
 
146
 /**
163
 /**
147
- * Configures hoverIn/hoverOut handlers.
164
+ * Configures hoverIn/hoverOut handlers. Depends on connection indicator.
148
  */
165
  */
149
 SmallVideo.prototype.bindHoverHandler = function () {
166
 SmallVideo.prototype.bindHoverHandler = function () {
150
     // Add hover handler
167
     // Add hover handler
151
     $(this.container).hover(
168
     $(this.container).hover(
152
         () => {
169
         () => {
153
-            if (!this.VideoLayout.isCurrentlyOnLarge(this.id)) {
154
-                $('#' + this.videoSpanId + ' .videocontainer__overlay')
155
-                    .removeClass("hide")
156
-                    .addClass("show-inline");
157
-                UIUtil.setVisibility(this.$displayName(), true);
158
-            }
170
+            this.videoIsHovered = true;
171
+            this.updateView();
159
         },
172
         },
160
         () => {
173
         () => {
161
-            $('#' + this.videoSpanId + ' .videocontainer__overlay')
162
-                .removeClass("show-inline")
163
-                .addClass("hide");
164
-            // If the video has been "pinned" by the user we want to
165
-            // keep the display name on place.
166
-            if (!this.VideoLayout.isLargeVideoVisible() ||
167
-                !this.VideoLayout.isCurrentlyOnLarge(this.id))
168
-                UIUtil.setVisibility(this.$displayName(), false);
174
+            this.videoIsHovered = false;
175
+            this.updateView();
169
         }
176
         }
170
     );
177
     );
178
+    if (this.connectionIndicator) {
179
+        this.connectionIndicator.addPopoverHoverListener(
180
+            () => {
181
+                this.updateView();
182
+            });
183
+    }
171
 };
184
 };
172
 
185
 
173
 /**
186
 /**
433
  * Determines what should be display on the thumbnail.
446
  * Determines what should be display on the thumbnail.
434
  *
447
  *
435
  * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
448
  * @return {number} one of <tt>DISPLAY_VIDEO</tt>,<tt>DISPLAY_AVATAR</tt>
436
- * or <tt>DISPLAY_BLACKNESS</tt>.
449
+ * or <tt>DISPLAY_BLACKNESS_WITH_NAME</tt>.
437
  */
450
  */
438
 SmallVideo.prototype.selectDisplayMode = function() {
451
 SmallVideo.prototype.selectDisplayMode = function() {
439
     // Display name is always and only displayed when user is on the stage
452
     // Display name is always and only displayed when user is on the stage
440
     if (this.isCurrentlyOnLargeVideo()) {
453
     if (this.isCurrentlyOnLargeVideo()) {
441
-        return DISPLAY_BLACKNESS;
454
+        return DISPLAY_BLACKNESS_WITH_NAME;
442
     } else if (this.isVideoPlayable() && this.selectVideoElement().length) {
455
     } else if (this.isVideoPlayable() && this.selectVideoElement().length) {
443
-        return DISPLAY_VIDEO;
456
+        // check hovering and change state to video with name
457
+        return this._isHovered() ?
458
+            DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;
444
     } else {
459
     } else {
445
-        return DISPLAY_AVATAR;
460
+        // check hovering and change state to avatar with name
461
+        return this._isHovered() ?
462
+            DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;
446
     }
463
     }
447
 };
464
 };
448
 
465
 
466
+/**
467
+ * Checks whether current video is considered hovered. Currently it is hovered
468
+ * if the mouse is over the video, or if the connection
469
+ * indicator is shown(hovered).
470
+ * @private
471
+ */
472
+SmallVideo.prototype._isHovered = function () {
473
+    return this.videoIsHovered
474
+        || this.connectionIndicator.popover.popoverIsHovered;
475
+};
476
+
449
 /**
477
 /**
450
  * Hides or shows the user's avatar.
478
  * Hides or shows the user's avatar.
451
  * This update assumes that large video had been updated and we will
479
  * This update assumes that large video had been updated and we will
469
     let displayMode = this.selectDisplayMode();
497
     let displayMode = this.selectDisplayMode();
470
     // Show/hide video.
498
     // Show/hide video.
471
     UIUtil.setVisibility(   this.selectVideoElement(),
499
     UIUtil.setVisibility(   this.selectVideoElement(),
472
-                            displayMode === DISPLAY_VIDEO);
500
+                            (displayMode === DISPLAY_VIDEO
501
+                                || displayMode === DISPLAY_VIDEO_WITH_NAME));
473
     // Show/hide the avatar.
502
     // Show/hide the avatar.
474
     UIUtil.setVisibility(   this.$avatar(),
503
     UIUtil.setVisibility(   this.$avatar(),
475
-                            displayMode === DISPLAY_AVATAR);
504
+                            (displayMode === DISPLAY_AVATAR
505
+                                || displayMode === DISPLAY_AVATAR_WITH_NAME));
476
     // Show/hide the display name.
506
     // Show/hide the display name.
477
     UIUtil.setVisibility(   this.$displayName(),
507
     UIUtil.setVisibility(   this.$displayName(),
478
-                            displayMode === DISPLAY_BLACKNESS);
508
+                            (displayMode === DISPLAY_BLACKNESS_WITH_NAME
509
+                                || displayMode === DISPLAY_VIDEO_WITH_NAME
510
+                                || displayMode === DISPLAY_AVATAR_WITH_NAME));
511
+    // show hide overlay when there is a video or avatar under
512
+    // the display name
513
+    UIUtil.setVisibility(   $('#' + this.videoSpanId
514
+                                + ' .videocontainer__overlay'),
515
+                            (displayMode === DISPLAY_AVATAR_WITH_NAME
516
+                                || displayMode === DISPLAY_VIDEO_WITH_NAME));
479
 };
517
 };
480
 
518
 
481
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
519
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {

Laden…
Annuleren
Opslaan