|
@@ -21,11 +21,27 @@ const DISPLAY_VIDEO = 0;
|
21
|
21
|
const DISPLAY_AVATAR = 1;
|
22
|
22
|
/**
|
23
|
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
|
25
|
* @type {number}
|
26
|
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
|
46
|
function SmallVideo(VideoLayout) {
|
31
|
47
|
this.isAudioMuted = false;
|
|
@@ -34,6 +50,7 @@ function SmallVideo(VideoLayout) {
|
34
|
50
|
this.videoStream = null;
|
35
|
51
|
this.audioStream = null;
|
36
|
52
|
this.VideoLayout = VideoLayout;
|
|
53
|
+ this.videoIsHovered = false;
|
37
|
54
|
}
|
38
|
55
|
|
39
|
56
|
/**
|
|
@@ -144,30 +161,26 @@ SmallVideo.getStreamElementID = function (stream) {
|
144
|
161
|
};
|
145
|
162
|
|
146
|
163
|
/**
|
147
|
|
- * Configures hoverIn/hoverOut handlers.
|
|
164
|
+ * Configures hoverIn/hoverOut handlers. Depends on connection indicator.
|
148
|
165
|
*/
|
149
|
166
|
SmallVideo.prototype.bindHoverHandler = function () {
|
150
|
167
|
// Add hover handler
|
151
|
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,19 +446,34 @@ SmallVideo.prototype.isVideoPlayable = function() {
|
433
|
446
|
* Determines what should be display on the thumbnail.
|
434
|
447
|
*
|
435
|
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
|
451
|
SmallVideo.prototype.selectDisplayMode = function() {
|
439
|
452
|
// Display name is always and only displayed when user is on the stage
|
440
|
453
|
if (this.isCurrentlyOnLargeVideo()) {
|
441
|
|
- return DISPLAY_BLACKNESS;
|
|
454
|
+ return DISPLAY_BLACKNESS_WITH_NAME;
|
442
|
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
|
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
|
478
|
* Hides or shows the user's avatar.
|
451
|
479
|
* This update assumes that large video had been updated and we will
|
|
@@ -469,13 +497,23 @@ SmallVideo.prototype.updateView = function () {
|
469
|
497
|
let displayMode = this.selectDisplayMode();
|
470
|
498
|
// Show/hide video.
|
471
|
499
|
UIUtil.setVisibility( this.selectVideoElement(),
|
472
|
|
- displayMode === DISPLAY_VIDEO);
|
|
500
|
+ (displayMode === DISPLAY_VIDEO
|
|
501
|
+ || displayMode === DISPLAY_VIDEO_WITH_NAME));
|
473
|
502
|
// Show/hide the avatar.
|
474
|
503
|
UIUtil.setVisibility( this.$avatar(),
|
475
|
|
- displayMode === DISPLAY_AVATAR);
|
|
504
|
+ (displayMode === DISPLAY_AVATAR
|
|
505
|
+ || displayMode === DISPLAY_AVATAR_WITH_NAME));
|
476
|
506
|
// Show/hide the display name.
|
477
|
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
|
519
|
SmallVideo.prototype.avatarChanged = function (avatarUrl) {
|