|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
/* global $, $iq, config, connection, messageHandler, Strophe, toggleAudio */ |
|
|
|
|
/* global $, $iq, config, connection, focusJid, forceMuted, messageHandler, |
|
|
|
|
setAudioMuted, Strophe, toggleAudio */ |
|
|
|
|
/** |
|
|
|
|
* Moderate connection plugin. |
|
|
|
|
*/ |
|
|
|
@ -15,27 +16,39 @@ Strophe.addConnectionPlugin('moderate', { |
|
|
|
|
null); |
|
|
|
|
}, |
|
|
|
|
setMute: function (jid, mute) { |
|
|
|
|
var iq = $iq({to: jid, type: 'set'}) |
|
|
|
|
.c('mute', {xmlns: 'http://jitsi.org/jitmeet/audio'}) |
|
|
|
|
.t(mute.toString()) |
|
|
|
|
.up(); |
|
|
|
|
console.info("set mute", mute); |
|
|
|
|
var iqToFocus = $iq({to: focusJid, type: 'set'}) |
|
|
|
|
.c('mute', { |
|
|
|
|
xmlns: 'http://jitsi.org/jitmeet/audio', |
|
|
|
|
jid: jid |
|
|
|
|
}) |
|
|
|
|
.t(mute.toString()) |
|
|
|
|
.up(); |
|
|
|
|
|
|
|
|
|
this.connection.sendIQ( |
|
|
|
|
iq, |
|
|
|
|
function (result) { |
|
|
|
|
console.log('set mute', result); |
|
|
|
|
}, |
|
|
|
|
function (error) { |
|
|
|
|
console.log('set mute error', error); |
|
|
|
|
messageHandler.openReportDialog(null, 'Failed to mute ' + |
|
|
|
|
$("#participant_" + jid).find(".displayname").text() || |
|
|
|
|
"participant" + '.', error); |
|
|
|
|
}); |
|
|
|
|
iqToFocus, |
|
|
|
|
function (result) { |
|
|
|
|
console.log('set mute', result); |
|
|
|
|
}, |
|
|
|
|
function (error) { |
|
|
|
|
console.log('set mute error', error); |
|
|
|
|
// FIXME: this causes an exception
|
|
|
|
|
//messageHandler.openReportDialog(null, 'Failed to mute ' +
|
|
|
|
|
// $("#participant_" + jid).find(".displayname").text() ||
|
|
|
|
|
//"participant" + '.', error);
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onMute: function (iq) { |
|
|
|
|
var from = iq.getAttribute('from'); |
|
|
|
|
if (from !== focusJid) { |
|
|
|
|
console.warn("Ignored mute from non focus peer"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
var mute = $(iq).find('mute'); |
|
|
|
|
if (mute.length) { |
|
|
|
|
toggleAudio(); |
|
|
|
|
var doMuteAudio = mute.text() === "true"; |
|
|
|
|
setAudioMuted(doMuteAudio); |
|
|
|
|
forceMuted = doMuteAudio; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|