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