ソースを参照

Fix error handling and crash in case of unsupported codecs (fixes #10)

Jonas Herzig 6 年 前
コミット
6b1d613d0e
2 ファイル変更6 行追加2 行削除
  1. 5 2
      app/index.js
  2. 1 0
      package.json

+ 5 - 2
app/index.js

@@ -97,7 +97,7 @@ class GlobalBindings {
 
         this.client = client
         // Prepare for connection errors
-        client.on('error', function (err) {
+        client.on('error', (err) => {
           log('Connection error:', err)
           this.resetClient()
         })
@@ -279,7 +279,7 @@ class GlobalBindings {
         this.client.disconnect()
       }
       this.client = null
-      this.thisUser(null).root(null).selected(null)
+      this.selected(null).root(null).thisUser(null)
     }
 
     this.connected = () => this.thisUser() != null
@@ -502,6 +502,9 @@ var resampler = new Resampler({
 
 var voiceStream
 resampler.pipe(chunker(4 * 480)).on('data', function (data) {
+  if (!ui.client) {
+    voiceStream = null
+  }
   if (!voiceStream && ui.client) {
     voiceStream = ui.client.createVoiceStream()
   }

+ 1 - 0
package.json

@@ -43,6 +43,7 @@
     "libsamplerate.js": "^1.0.0",
     "mumble-client-codecs-browser": "^1.0.1",
     "mumble-client-websocket": "^1.0.0",
+    "mumble-client": "^1.1.0",
     "web-audio-buffer-queue": "^1.0.0"
   }
 }