text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Player=e():(t.ZCC=t.ZCC||{},t.ZCC.Player=e())}(window,function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=41)}({40:function(t,e,i){"use strict";function n(t,e){this.init(t,e)}n.prototype.init=function(t,e){this.options=Object.assign({},{encoding:"16bitInt",channels:1,sampleRate:8e3,flushingTime:1e3,gain:1},t),void 0===this.options.gain||this.isValidGain(this.options.gain)||(this.options.gain=1),this.samples=new Float32Array([]),this.flush=this.flush.bind(this),this.interval=setInterval(this.flush,this.options.flushingTime),this.maxValue=this.getMaxValue(),this.typedArray=this.getTypedArray(),this.onendedCallback=e,this.feedCounter=0,this.createContext()},n.prototype.webAudioTouchUnlock=function(t){return new Promise(function(e,i){if("suspended"===t.state&&"ontouchstart"in window){var n=function n(){t.resume().then(function(){document.body.removeEventListener("touchstart",n),document.body.removeEventListener("touchend",n),e(!0)},function(t){i(t)})};document.body.addEventListener("touchstart",n,!1),document.body.addEventListener("touchend",n,!1)}else e(!1)})},n.prototype.isValidGain=function(t){return isFinite(t)&&t<=1&&t>=0},n.prototype.getMaxValue=function(){var t={"8bitInt":128,"16bitInt":32768,"32bitInt":2147483648,"32bitFloat":1};return t[this.options.encoding]?t[this.options.encoding]:t["16bitInt"]},n.prototype.getTypedArray=function(){var t={"8bitInt":Int8Array,"16bitInt":Int16Array,"32bitInt":Int32Array,"32bitFloat":Float32Array};return t[this.options.encoding]?t[this.options.encoding]:t["16bitInt"]},n.prototype.createContext=function(){this.audioCtx=new(window.AudioContext||window.webkitAudioContext),this.webAudioTouchUnlock(this.audioCtx).then(function(){this.gainNode=this.audioCtx.createGain(),this.gainNode.gain.value=this.options.gain,this.gainNode.connect(this.audioCtx.destination),this.startTime=this.audioCtx.currentTime}.bind(this),function(t){console.error(t)})},n.prototype.isTypedArray=function(t){return t.byteLength&&t.buffer&&t.buffer.constructor===ArrayBuffer},n.prototype.feed=function(t){if(!this.muted&&this.isTypedArray(t)){t=this.getFormattedValue(t);var e=new Float32Array(this.samples.length+t.length);e.set(this.samples,0),e.set(t,this.samples.length),this.samples=e,this.feedCounter++}},n.prototype.getFormattedValue=function(t){for(var e=new this.typedArray(t.buffer),i=new Float32Array(e.length),n=0;n<e.length;n++)i[n]=e[n]/this.maxValue;return i},n.prototype.setGain=function(t){if(!this.isValidGain(t))return!1;this.options.gain=t,this.gainNode.gain.value=t},n.prototype.destroy=function(){this.interval&&clearInterval(this.interval),this.samples=new Float32Array([]),this.feedCounter=0,this.audioCtx.close(),this.audioCtx=null},n.prototype.flush=function(){if(this.samples.length){var t=this.audioCtx.createBufferSource(),e=this.samples.length/this.options.channels,i=this.audioCtx.createBuffer(this.options.channels,e,this.options.sampleRate),n=void 0,o=void 0,s=void 0,r=void 0,a=void 0;for(o=0;o<this.options.channels;o++)for(n=i.getChannelData(o),s=o,a=50,r=0;r<e;r++)n[r]=this.samples[s],r<50&&(n[r]=n[r]*r/50),r>=e-51&&(n[r]=n[r]*a--/50),s+=this.options.channels;this.startTime<this.audioCtx.currentTime&&(this.startTime=this.audioCtx.currentTime),t.buffer=i,t.connect(this.gainNode),t.start(this.startTime);var u=this.feedCounter,h=this.onendedCallback;h&&(t.onended=function(){return h(u)}),this.startTime+=i.duration,this.samples=new Float32Array([]),this.feedCounter=0}},n.prototype.mute=function(t){this.muted=t},n.prototype.setSampleRate=function(t){this.options.sampleRate=t},t.exports=n},41:function(t,e,i){"use strict";var n=i(40);t.exports=n}})});