|
@@ -26,6 +26,24 @@ export default class SharedVideoManager {
|
26
|
26
|
this.emitter = emitter;
|
27
|
27
|
this.isSharedVideoShown = false;
|
28
|
28
|
this.isPlayerAPILoaded = false;
|
|
29
|
+ this.mutedWithUserInteraction = false;
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ /**
|
|
33
|
+ * Indicates if the player volume is currently on.
|
|
34
|
+ *
|
|
35
|
+ * @returns {*|player|boolean}
|
|
36
|
+ */
|
|
37
|
+ isSharedVideoVolumeOn() {
|
|
38
|
+ return (this.player && this.player.getVolume() > 0);
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ /**
|
|
42
|
+ * Indicates if the local user is the owner of the shared video.
|
|
43
|
+ * @returns {*|boolean}
|
|
44
|
+ */
|
|
45
|
+ isSharedVideoOwner() {
|
|
46
|
+ return this.from && APP.conference.isLocalId(this.from);
|
29
|
47
|
}
|
30
|
48
|
|
31
|
49
|
/**
|
|
@@ -169,10 +187,15 @@ export default class SharedVideoManager {
|
169
|
187
|
|
170
|
188
|
// let's check, if player is not muted lets mute locally
|
171
|
189
|
if(event.data.volume > 0 && !event.data.muted
|
172
|
|
- && !APP.conference.isLocalAudioMuted()){
|
173
|
|
- self.emitter.emit(UIEvents.AUDIO_MUTED, true);
|
|
190
|
+ && !APP.conference.isLocalAudioMuted()) {
|
|
191
|
+ self.emitter.emit(UIEvents.AUDIO_MUTED, true, false);
|
174
|
192
|
self.showMicMutedPopup(true);
|
175
|
193
|
}
|
|
194
|
+ else if (!self.mutedWithUserInteraction
|
|
195
|
+ && (event.data.volume <=0 || event.data.muted)
|
|
196
|
+ && APP.conference.isLocalAudioMuted()) {
|
|
197
|
+ self.emitter.emit(UIEvents.AUDIO_MUTED, false, false);
|
|
198
|
+ }
|
176
|
199
|
};
|
177
|
200
|
|
178
|
201
|
window.onPlayerReady = function(event) {
|
|
@@ -231,9 +254,11 @@ export default class SharedVideoManager {
|
231
|
254
|
this.processTime(player, attributes, playerPaused);
|
232
|
255
|
|
233
|
256
|
// lets check the volume
|
234
|
|
- if (attributes.volume !== undefined &&
|
235
|
|
- player.getVolume() != attributes.volume
|
236
|
|
- && APP.conference.isLocalAudioMuted()) {
|
|
257
|
+ if (attributes.volume !== undefined
|
|
258
|
+ && player.getVolume() != attributes.volume
|
|
259
|
+ && (APP.conference.isLocalAudioMuted()
|
|
260
|
+ || !this.mutedWithUserInteraction)) {
|
|
261
|
+
|
237
|
262
|
player.setVolume(attributes.volume);
|
238
|
263
|
console.info("Player change of volume:" + attributes.volume);
|
239
|
264
|
this.showSharedVideoMutedPopup(false);
|
|
@@ -393,17 +418,21 @@ export default class SharedVideoManager {
|
393
|
418
|
/**
|
394
|
419
|
* Receives events for local audio mute/unmute by local user.
|
395
|
420
|
* @param muted boolena whether it is muted or not.
|
|
421
|
+ * @param {boolean} indicates if this mute was a result of user interaction,
|
|
422
|
+ * i.e. pressing the mute button or it was programatically triggerred
|
396
|
423
|
*/
|
397
|
|
- localAudioMuted (muted) {
|
|
424
|
+ localAudioMuted (muted, userInteraction) {
|
398
|
425
|
if(!this.player)
|
399
|
426
|
return;
|
400
|
427
|
|
401
|
|
- if(muted)
|
|
428
|
+ if (muted) {
|
|
429
|
+ this.mutedWithUserInteraction = userInteraction;
|
402
|
430
|
return;
|
|
431
|
+ }
|
403
|
432
|
|
404
|
433
|
// if we are un-muting and player is not muted, lets muted
|
405
|
434
|
// to not pollute the conference
|
406
|
|
- if(this.player.getVolume() > 0 || !this.player.isMuted()){
|
|
435
|
+ if (this.player.getVolume() > 0 || !this.player.isMuted()) {
|
407
|
436
|
this.player.setVolume(0);
|
408
|
437
|
this.showSharedVideoMutedPopup(true);
|
409
|
438
|
}
|
|
@@ -415,30 +444,10 @@ export default class SharedVideoManager {
|
415
|
444
|
* @param show boolean, show or hide the notification
|
416
|
445
|
*/
|
417
|
446
|
showMicMutedPopup (show) {
|
418
|
|
- var micMutedPopupSelector = $("#micMutedPopup");
|
419
|
|
- if(show) {
|
|
447
|
+ if(show)
|
420
|
448
|
this.showSharedVideoMutedPopup(false);
|
421
|
449
|
|
422
|
|
- if (!micMutedPopupSelector.is(":visible"))
|
423
|
|
- micMutedPopupSelector.css("display", "inline-block");
|
424
|
|
-
|
425
|
|
- // FIXME: we need an utility method for that.
|
426
|
|
- micMutedPopupSelector.fadeIn(300,
|
427
|
|
- () => {micMutedPopupSelector.css({opacity: 1});}
|
428
|
|
- );
|
429
|
|
-
|
430
|
|
- setTimeout(
|
431
|
|
- function () {
|
432
|
|
- micMutedPopupSelector.fadeOut(300,
|
433
|
|
- () => {micMutedPopupSelector.css({opacity: 0});}
|
434
|
|
- );
|
435
|
|
- }, 5000);
|
436
|
|
- }
|
437
|
|
- else {
|
438
|
|
- micMutedPopupSelector.fadeOut(300,
|
439
|
|
- () => {micMutedPopupSelector.css({opacity: 0});}
|
440
|
|
- );
|
441
|
|
- }
|
|
450
|
+ UIUtil.animateShowElement($("#micMutedPopup"), show, 5000);
|
442
|
451
|
}
|
443
|
452
|
|
444
|
453
|
/**
|
|
@@ -448,30 +457,10 @@ export default class SharedVideoManager {
|
448
|
457
|
* @param show boolean, show or hide the notification
|
449
|
458
|
*/
|
450
|
459
|
showSharedVideoMutedPopup (show) {
|
451
|
|
- var sharedVideoMutedPopupSelector = $("#sharedVideoMutedPopup");
|
452
|
|
- if(show) {
|
|
460
|
+ if(show)
|
453
|
461
|
this.showMicMutedPopup(false);
|
454
|
462
|
|
455
|
|
- if (!sharedVideoMutedPopupSelector.is(":visible"))
|
456
|
|
- sharedVideoMutedPopupSelector.css("display", "inline-block");
|
457
|
|
-
|
458
|
|
- // FIXME: we need an utility method for that.
|
459
|
|
- sharedVideoMutedPopupSelector.fadeIn(300,
|
460
|
|
- () => {sharedVideoMutedPopupSelector.css({opacity: 1});}
|
461
|
|
- );
|
462
|
|
-
|
463
|
|
- setTimeout(
|
464
|
|
- function () {
|
465
|
|
- sharedVideoMutedPopupSelector.fadeOut(300,
|
466
|
|
- () => {sharedVideoMutedPopupSelector.css({opacity: 0});}
|
467
|
|
- );
|
468
|
|
- }, 5000);
|
469
|
|
- }
|
470
|
|
- else {
|
471
|
|
- sharedVideoMutedPopupSelector.fadeOut(300,
|
472
|
|
- () => {sharedVideoMutedPopupSelector.css({opacity: 0});}
|
473
|
|
- );
|
474
|
|
- }
|
|
463
|
+ UIUtil.animateShowElement($("#sharedVideoMutedPopup"), show, 5000);
|
475
|
464
|
}
|
476
|
465
|
}
|
477
|
466
|
|