|
@@ -7,6 +7,11 @@ import UIUtils from "../util/UIUtil";
|
7
|
7
|
import UIEvents from '../../../service/UI/UIEvents';
|
8
|
8
|
import JitsiPopover from "../util/JitsiPopover";
|
9
|
9
|
|
|
10
|
+const MUTED_DIALOG_BUTTON_VALUES = {
|
|
11
|
+ cancel: 0,
|
|
12
|
+ muted: 1
|
|
13
|
+};
|
|
14
|
+
|
10
|
15
|
/**
|
11
|
16
|
* Creates new instance of the <tt>RemoteVideo</tt>.
|
12
|
17
|
* @param user {JitsiParticipant} the user for whom remote video instance will
|
|
@@ -130,15 +135,21 @@ RemoteVideo.prototype._generatePopupContent = function () {
|
130
|
135
|
}
|
131
|
136
|
|
132
|
137
|
// Delegate event to the document.
|
133
|
|
- $(document).on("click", "#mutelink_" + this.id, function(){
|
134
|
|
-
|
|
138
|
+ $(document).on("click", "#mutelink_" + this.id, () => {
|
135
|
139
|
if (this.isAudioMuted)
|
136
|
140
|
return;
|
137
|
141
|
|
138
|
|
- this.emitter.emit(UIEvents.REMOTE_AUDIO_MUTED, this.id);
|
|
142
|
+ RemoteVideo.showMuteParticipantDialog().then(reason => {
|
|
143
|
+ if(reason === MUTED_DIALOG_BUTTON_VALUES.muted) {
|
|
144
|
+ this.emitter.emit(UIEvents.REMOTE_AUDIO_MUTED, this.id);
|
|
145
|
+ }
|
|
146
|
+ }).catch(e => {
|
|
147
|
+ //currently shouldn't be called
|
|
148
|
+ console.error(e);
|
|
149
|
+ });
|
139
|
150
|
|
140
|
151
|
this.popover.forceHide();
|
141
|
|
- }.bind(this));
|
|
152
|
+ });
|
142
|
153
|
|
143
|
154
|
muteMenuItem.appendChild(muteLinkItem);
|
144
|
155
|
popupmenuElement.appendChild(muteMenuItem);
|
|
@@ -570,4 +581,47 @@ RemoteVideo.createContainer = function (spanId) {
|
570
|
581
|
return remotes.appendChild(container);
|
571
|
582
|
};
|
572
|
583
|
|
|
584
|
+/**
|
|
585
|
+ * Shows 2 button dialog for confirmation from the user for muting remote
|
|
586
|
+ * participant.
|
|
587
|
+ */
|
|
588
|
+RemoteVideo.showMuteParticipantDialog = function () {
|
|
589
|
+ //FIXME: don't show again checkbox is implemented very dirty. we should add
|
|
590
|
+ // this functionality to MessageHandler class.
|
|
591
|
+ if (window.localStorage
|
|
592
|
+ && window.localStorage.getItem(
|
|
593
|
+ "dontShowMuteParticipantDialog") === "true") {
|
|
594
|
+ return Promise.resolve(MUTED_DIALOG_BUTTON_VALUES.muted);
|
|
595
|
+ }
|
|
596
|
+ let msgString =
|
|
597
|
+ `<div data-i18n="dialog.muteParticipantBody"></div>
|
|
598
|
+ <br />
|
|
599
|
+ <label>
|
|
600
|
+ <input type='checkbox' checked id='doNotShowMessageAgain' />
|
|
601
|
+ <span data-i18n='dialog.doNotShowMessageAgain'></span>
|
|
602
|
+ </label>`;
|
|
603
|
+ return new Promise(resolve => {
|
|
604
|
+ APP.UI.messageHandler.openTwoButtonDialog({
|
|
605
|
+ titleKey : "dialog.muteParticipantTitle",
|
|
606
|
+ msgString,
|
|
607
|
+ leftButtonKey: 'dialog.muteParticipantButton',
|
|
608
|
+ submitFunction: () => {
|
|
609
|
+ if(window.localStorage) {
|
|
610
|
+ let form = $.prompt.getPrompt();
|
|
611
|
+ if (form) {
|
|
612
|
+ let input = form.find("#doNotShowMessageAgain");
|
|
613
|
+ if (input.length) {
|
|
614
|
+ window.localStorage.setItem(
|
|
615
|
+ "dontShowMuteParticipantDialog",
|
|
616
|
+ input.prop("checked"));
|
|
617
|
+ }
|
|
618
|
+ }
|
|
619
|
+ }
|
|
620
|
+ resolve(MUTED_DIALOG_BUTTON_VALUES.muted);
|
|
621
|
+ },
|
|
622
|
+ closeFunction: () => resolve(MUTED_DIALOG_BUTTON_VALUES.cancel)
|
|
623
|
+ });
|
|
624
|
+ });
|
|
625
|
+};
|
|
626
|
+
|
573
|
627
|
export default RemoteVideo;
|