(function() { var e = {}.hasOwnProperty, t = function(t, r) { function o() { this.constructor = t } for(var n in r) e.call(r, n) && (t[n] = r[n]); return o.prototype = r.prototype, t.prototype = new o, t.__super__ = r.prototype, t }; AV.WebSocketSource = function(e) { function r(e, t) { return this.serverUrl = e, this.fileName = t, "undefined" == typeof WebSocket || null === WebSocket ? this.emit("error", "This browser does not have WebSocket support.") : (this.socket = new WebSocket(this.serverUrl), null == this.socket.binaryType ? (this.socket.close(), this.emit("error", "This browser does not have binary WebSocket support.")) : (this.bytesLoaded = 0, this._setupSocket(), void 0)) } return t(r, e), r.prototype.start = function() { // return this._send(JSON.stringify({ // resume: !0 // })) }, r.prototype.pause = function() { return }, r.prototype.reset = function() { return this._send(JSON.stringify({ reset: !0 })) }, r.prototype._send = function(e) { return this.open ? this.socket.send(e) : this._bufferMessage = e }, r.prototype._setupSocket = function() { var e = this; return this.socket.binaryType = "arraybuffer", this.socket.onopen = function() { return e.open = !0, e.fileName && e.socket.send(JSON.stringify({ fileName: e.fileName })), e._bufferMessage ? (e.socket.send(e._bufferMessage), e._bufferMessage = null) : void 0 }, this.socket.onmessage = function(t) { var r, o; r = new AV.Buffer(new Uint8Array(o)) var se = t.data if(new Uint8Array(se)[0] == 0){ // var messageData = new Uint8Array(se) // player.decode(messageData); // console.log('黄飞5') return }else{ // console.log('黄飞6') // console.log('黄飞2',new Uint8Array(se)[0]) return o = t.data, "string" != typeof o ? (r = new AV.Buffer(new Uint8Array(o)), e.bytesLoaded += r.length, e.length && e.emit("progress", 100 * (e.bytesLoaded / e.length)), e.emit("data", r)) : (o = JSON.parse(o), null != o.fileSize ? e.length = o.fileSize : null != o.error ? e.emit("error", o.error) : o.end ? e.socket.close() : void 0) } }, this.socket.onclose = function(t) { console.log('黄飞5') return e.open = !1, t.wasClean ? e.emit("end") : e.emit("error", "WebSocket closed uncleanly with code " + t.code + ".") }, this.socket.onerror = function(t) { console.log('黄飞6') return e.emit("error", t) } }, r }(AV.EventEmitter), AV.Asset.fromWebSocket = function(e, t) { var r; console.log('黄飞1') return r = new AV.WebSocketSource(e, t), new AV.Asset(r) }, AV.Player.fromWebSocket = function(e, t) { var r; console.log('黄飞2') return r = AV.Asset.fromWebSocket(e, t), new AV.Player(r) } }).call(this);