Fixes the local audio levels when the user is muted.

This commit is contained in:
hristoterezov 2014-07-28 14:31:32 +03:00
parent 83b4ee96d3
commit 0e7c1ed9a9
1 changed files with 16 additions and 0 deletions

16
app.js
View File

@ -455,6 +455,8 @@ function audioLevelUpdated(jid, audioLevel)
if(jid === LocalStatsCollector.LOCAL_JID) if(jid === LocalStatsCollector.LOCAL_JID)
{ {
resourceJid = AudioLevels.LOCAL_LEVEL; resourceJid = AudioLevels.LOCAL_LEVEL;
if(isAudioMuted())
return;
} }
else else
{ {
@ -901,6 +903,20 @@ function toggleAudio() {
buttonClick("#mute", "icon-microphone icon-mic-disabled"); 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. // Starts or stops the recording for the conference.
function toggleRecording() { function toggleRecording() {
if (focus === null || focus.confid === null) { if (focus === null || focus.confid === null) {