unknown fix

This commit is contained in:
xdrm-brackets 2018-04-06 01:20:34 +02:00
parent 1334d37805
commit f412d395d9
1 changed files with 8 additions and 9 deletions

View File

@ -32,18 +32,17 @@ export default class AudioManager{
/* (7) Create websocket connection */
this.ws = new WebSocket('wss://ws.douscord.xdrm.io/audio/2');
let self = this;
/* (8) Manage websocket requests */
this._ws = {
stack: [],
send(_data){
if( self.ws.readyState !== 1 ) // not connected -> stack
return self._ws.stack.push(_data);
send: function(_data){
if( this.ws.readyState !== 1 ) // not connected -> stack
return this._ws.stack.push(_data);
console.warn(`send buffer[${_data.length}]`);
self.ws.send(_data);
},
this.ws.send(_data);
}.bind(this)
};
/* (9) Manage websocket message stack */
@ -65,9 +64,9 @@ export default class AudioManager{
let fr = new FileReader();
fr.onload = function(){
let buf16 = new Int16Array(this.result);
self.receive(buf16).bind(self);
};
let buf16 = new Int16Array(fr.result);
this.receive(buf16).bind(this);
}.bind(this);
fr.readAsArrayBuffer(_msg.data);