[lib.audio-manager].launch(room_id) tested + [lib.room-controller].nav('voice') always kills audio-manager before starting it

This commit is contained in:
xdrm-brackets 2018-04-11 16:20:09 +02:00
parent d205985305
commit 3f06b3dc39
2 changed files with 5 additions and 5 deletions

View File

@ -497,10 +497,10 @@ export default class AudioManager{
kill(){ kill(){
/* (1) Close websocket */ /* (1) Close websocket */
this.ws.close(); this.ws && this.ws.close();
/* (2) Stop recording */ /* (2) Stop recording */
this.recorder.stop(); this.recorder && this.recorder.stop();
} }

View File

@ -50,13 +50,13 @@ export default class RoomController{
if( type === 'text' && window.csock instanceof wscd ) if( type === 'text' && window.csock instanceof wscd )
csock.send({ buffer: { rid: room.id } }); csock.send({ buffer: { rid: room.id } });
/* (6) If 'voice' room -> launch audio */ /* (6) If 'voice' room -> toggle audio */
if( type === 'voice' ){ if( type === 'voice' ){
AudioManager.kill();
if( typeof this[type].current === 'number' ) if( typeof this[type].current === 'number' )
AudioManager.launch(this[type].current); AudioManager.launch(this[type].current);
else
AudioManager.kill();
} }