From 0e7c1ed9a9f86a6516dabd281915a5f142d83da0 Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Mon, 28 Jul 2014 14:31:32 +0300 Subject: [PATCH] Fixes the local audio levels when the user is muted. --- app.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app.js b/app.js index 9cacb7b37..f7ac1bd53 100644 --- a/app.js +++ b/app.js @@ -455,6 +455,8 @@ function audioLevelUpdated(jid, audioLevel) if(jid === LocalStatsCollector.LOCAL_JID) { resourceJid = AudioLevels.LOCAL_LEVEL; + if(isAudioMuted()) + return; } else { @@ -901,6 +903,20 @@ function toggleAudio() { buttonClick("#mute", "icon-microphone icon-mic-disabled"); } +/** + * Checks whether the audio is muted or not. + * @returns {boolean} true if audio is muted and false if not. + */ +function isAudioMuted() +{ + var localAudio = connection.jingle.localAudio; + for (var idx = 0; idx < localAudio.getAudioTracks().length; idx++) { + if(localAudio.getAudioTracks()[idx].enabled === true) + return false; + } + return true; +} + // Starts or stops the recording for the conference. function toggleRecording() { if (focus === null || focus.confid === null) {