From 3f06b3dc39003f5062f49562feca875556392b30 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 11 Apr 2018 16:20:09 +0200 Subject: [PATCH] [lib.audio-manager].launch(room_id) tested + [lib.room-controller].nav('voice') always kills audio-manager before starting it --- parcel/lib/audio-manager.js | 4 ++-- parcel/lib/room-controller.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/parcel/lib/audio-manager.js b/parcel/lib/audio-manager.js index c2569f3..3739ab5 100644 --- a/parcel/lib/audio-manager.js +++ b/parcel/lib/audio-manager.js @@ -497,10 +497,10 @@ export default class AudioManager{ kill(){ /* (1) Close websocket */ - this.ws.close(); + this.ws && this.ws.close(); /* (2) Stop recording */ - this.recorder.stop(); + this.recorder && this.recorder.stop(); } diff --git a/parcel/lib/room-controller.js b/parcel/lib/room-controller.js index 935b98d..1f19a1f 100644 --- a/parcel/lib/room-controller.js +++ b/parcel/lib/room-controller.js @@ -50,13 +50,13 @@ export default class RoomController{ if( type === 'text' && window.csock instanceof wscd ) csock.send({ buffer: { rid: room.id } }); - /* (6) If 'voice' room -> launch audio */ + /* (6) If 'voice' room -> toggle audio */ if( type === 'voice' ){ + AudioManager.kill(); + if( typeof this[type].current === 'number' ) AudioManager.launch(this[type].current); - else - AudioManager.kill(); }