1234567891011121314151617181920212223242526272829303132333435 |
- self.importScripts("helper.js");
- // self.importScripts("pcm-player.js");
- // self.importScripts("pcm-player.min.js");
- var socketURL = "ws://192.168.198.11:9101";
- // var socketURL = "ws://14.215.128.98:14102"
- // socketURL = "ws://127.0.0.1:8081"
- var ws = new WebSocket(socketURL);
- ws.binaryType = 'arraybuffer';
- ws.addEventListener('open', function(event) {
- console.log("发送配置帧");
- // ws.send(ConfigChannel("RK3923C1201900139"));
- });
- self.addEventListener('message', function(e) {
- console.log("收到数据", e.data);
- ws.send(e.data);
- console.log('ws', ws)
- }, false);
- ws.addEventListener('message', function(event) {
- //var objData = {type:0, data:input};
- var input = new Uint8Array(event.data);
- if (input[0] == 0xff) {
- // console.log("1111111")
- // decodeAAC(input);
- } else {
- self.postMessage(input);
- }
- });
|