浏览代码

Fixes the local audio levels when the user is muted.

j8
hristoterezov 10 年前
父节点
当前提交
0e7c1ed9a9
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16
    0
      app.js

+ 16
- 0
app.js 查看文件

@@ -455,6 +455,8 @@ function audioLevelUpdated(jid, audioLevel)
455 455
     if(jid === LocalStatsCollector.LOCAL_JID)
456 456
     {
457 457
         resourceJid = AudioLevels.LOCAL_LEVEL;
458
+        if(isAudioMuted())
459
+            return;
458 460
     }
459 461
     else
460 462
     {
@@ -901,6 +903,20 @@ function toggleAudio() {
901 903
     buttonClick("#mute", "icon-microphone icon-mic-disabled");
902 904
 }
903 905
 
906
+/**
907
+ * Checks whether the audio is muted or not.
908
+ * @returns {boolean} true if audio is muted and false if not.
909
+ */
910
+function isAudioMuted()
911
+{
912
+    var localAudio = connection.jingle.localAudio;
913
+    for (var idx = 0; idx < localAudio.getAudioTracks().length; idx++) {
914
+        if(localAudio.getAudioTracks()[idx].enabled === true)
915
+            return false;
916
+    }
917
+    return true;
918
+}
919
+
904 920
 // Starts or stops the recording for the conference.
905 921
 function toggleRecording() {
906 922
     if (focus === null || focus.confid === null) {

正在加载...
取消
保存