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

This commit is contained in:
Jonas Herzig 2017-09-19 17:41:01 +02:00
parent 90b73796a5
commit 6b1d613d0e
2 changed files with 6 additions and 2 deletions

View file

@ -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()
}

View file

@ -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"
}
}