diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index 4b09c335d40268cc0333cd162b5b5d417bc2c78c..2944f40b0c6933e7e12fcf8003e16006cf6e0e7a 100644 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -33,15 +33,6 @@ class AudioManager { error: null, outputDeviceId: null, }); - - const query = VoiceUsers.find({ intId: Auth.userID }); - - query.observeChanges({ // keep track of mute/unmute in case of Flash changing it - changed: (id, fields) => { - if (fields.muted === this.isMuted) return; - this.isMuted = fields.muted; - }, - }); } init(userData, messages) { @@ -128,15 +119,24 @@ class AudioManager { } toggleMuteMicrophone() { - makeCall('toggleSelfVoice').then(() => { - this.onToggleMicrophoneMute(); - }); + makeCall('toggleSelfVoice'); } onAudioJoin() { this.isConnecting = false; this.isConnected = true; + // listen to the VoiceUsers changes and update the flag + if(!this.muteHandle) { + const query = VoiceUsers.find({ intId: Auth.userID }); + this.muteHandle = query.observeChanges({ // keep track of mute/unmute in case of Flash changing it + changed: (id, fields) => { + if (fields.muted === this.isMuted) return; + this.isMuted = fields.muted; + }, + }); + } + if (!this.isEchoTest) { this.notify(this.messages.info.JOINED_AUDIO); } @@ -147,10 +147,6 @@ class AudioManager { this.isConnecting = true; } - onToggleMicrophoneMute() { - this.isMuted = !this.isMuted; - } - onAudioExit() { this.isConnected = false; this.isConnecting = false;