PlayerControl.js 235 KB

12345678910
  1. var PlayerControl=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=73)}([function(t,e,n){"use strict";t.exports={ATOM_MOOV:"moov",ATOM_MVHD:"mvhd",ATOM_TRAK:"trak",ATOM_TKHD:"tkhd",ATOM_MDIA:"mdia",ATOM_MDHD:"mdhd",ATOM_MINF:"minf",ATOM_HDLR:"hdlr",ATOM_VMHD:"vmhd",ATOM_SMHD:"smhd",ATOM_STBL:"stbl",ATOM_STSZ:"stsz",ATOM_STCO:"stco",ATOM_STSS:"stss",ATOM_STTS:"stts",ATOM_STSC:"stsc",ATOM_CO64:"co64",ATOM_STSD:"stsd",ATOM_CTTS:"ctts",ATOM_AVC1:"avc1",ATOM_AVCC:"avcC",ATOM_HEV1:"hev1",ATOM_HVC1:"hvc1",ATOM_HVCC:"hvcC",ATOM_MP4A:"mp4a",ATOM_ESDS:"esds",ATOM_MDAT:"mdat",ATOM_FTYP:"ftyp",TRACK_TYPE_VIDEO:"vide",TRACK_TYPE_AUDIO:"soun",COMPONENT_NAME_VIDEO:"VideoHandler",COMPONENT_NAME_AUDIO:"SoundHandler",COMPRESSOR_NAME:"NodeVideoLibrary",createAtom:function(t){return new(n(61)("./atom-"+t))}}},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"type",value:function(){}},{key:"parse",value:function(){}},{key:"build",value:function(){}},{key:"bufferSize",value:function(){}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";(function(t){
  2. /*!
  3. * The buffer module from node.js, for the browser.
  4. *
  5. * @author Feross Aboukhadijeh <http://feross.org>
  6. * @license MIT
  7. */
  8. var r=n(55),o=n(56),i=n(57);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=s.prototype:(null===t&&(t=new s(e)),t.length=e),t}function s(t,e,n){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);s.TYPED_ARRAY_SUPPORT?(t=e).__proto__=s.prototype:t=h(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(e,n),o=(t=u(t,r)).write(e,n);o!==r&&(t=t.slice(0,o));return t}(t,e,n):function(t,e){if(s.isBuffer(e)){var n=0|p(e.length);return 0===(t=u(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?u(t,0):h(t,e);if("Buffer"===e.type&&i(e.data))return h(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(f(e),t=u(t,e<0?0:0|p(e)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e){var n=e.length<0?0:0|p(e.length);t=u(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function y(t,e){if(s.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(t).length;default:if(r)return V(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return k(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function v(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=s.from(e,r)),s.isBuffer(e))return 0===e.length?-1:b(t,e,n,r,o);if("number"==typeof e)return e&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):b(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(t,e,n,r,o){var i,a=1,u=t.length,s=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,u/=2,s/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var f=-1;for(i=n;i<u;i++)if(c(t,i)===c(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===s)return f*a}else-1!==f&&(i-=i-f),f=-1}else for(n+s>u&&(n=u-s),i=n;i>=0;i--){for(var l=!0,h=0;h<s;h++)if(c(t,i+h)!==c(e,h)){l=!1;break}if(l)return i}return-1}function g(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a<r;++a){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))return a;t[n+a]=u}return a}function w(t,e,n,r){return N(V(e,t.length-n),t,n,r)}function S(t,e,n,r){return N(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function O(t,e,n,r){return S(t,e,n,r)}function _(t,e,n,r){return N(z(e),t,n,r)}function T(t,e,n,r){return N(function(t,e){for(var n,r,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function E(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,a,u,s,c=t[o],f=null,l=c>239?4:c>223?3:c>191?2:1;if(o+l<=n)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&c)<<6|63&i)>127&&(f=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(s=(15&c)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(f=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(f=s)}null===f?(f=65533,l=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=s,e.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},e.INSPECT_MAX_BYTES=50,s.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),s.poolSize=8192,s._augment=function(t){return t.__proto__=s.prototype,t},s.from=function(t,e,n){return c(null,t,e,n)},s.TYPED_ARRAY_SUPPORT&&(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0})),s.alloc=function(t,e,n){return function(t,e,n,r){return f(e),e<=0?u(t,e):void 0!==n?"string"==typeof r?u(t,e).fill(n,r):u(t,e).fill(n):u(t,e)}(null,t,e,n)},s.allocUnsafe=function(t){return l(null,t)},s.allocUnsafeSlow=function(t){return l(null,t)},s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=s.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var a=t[n];if(!s.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},s.byteLength=y,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},s.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?A(this,0,t):d.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},s.prototype.compare=function(t,e,n,r,o){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(i,a),c=this.slice(r,o),f=t.slice(e,n),l=0;l<u;++l)if(c[l]!==f[l]){i=c[l],a=f[l];break}return i<a?-1:a<i?1:0},s.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},s.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},s.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},s.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return S(this,t,e,n);case"latin1":case"binary":return O(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function k(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function P(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=F(t[i]);return o}function C(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function M(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function B(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function U(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(t,e,n,r,i){return i||U(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function j(t,e,n,r,i){return i||U(t,0,n,8),o.write(t,e,n,r,52,8),n+8}s.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),s.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=s.prototype;else{var o=e-t;n=new s(o,void 0);for(var i=0;i<o;++i)n[i]=this[i+t]}return n},s.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},s.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},s.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},s.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||I(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},s.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||x(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},s.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=0,a=1,u=0;for(this[e]=255&t;++i<n&&(a*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+n},s.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);x(this,t,e,n,o-1,-o)}var i=n-1,a=1,u=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/a>>0)-u&255;return e+n},s.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},s.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},s.prototype.writeDoubleLE=function(t,e,n){return j(this,t,e,!0,n)},s.prototype.writeDoubleBE=function(t,e,n){return j(this,t,e,!1,n)},s.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,i=r-n;if(this===t&&n<e&&e<r)for(o=i-1;o>=0;--o)t[o+e]=this[o+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+i),e);return i},s.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=s.isBuffer(t)?t:V(new s(t,r).toString()),u=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%u]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}).call(this,n(54))},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=f(t);if(e){var o=f(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=n(1),h=n(0),p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}(c,t);var e,n,r,i=s(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=i.call(this)).atoms=[],t}return e=c,(n=[{key:"availableAtoms",value:function(){return[]}},{key:"addAtom",value:function(t){this.atoms.push(t)}},{key:"createAtom",value:function(t){var e=h.createAtom(t);return this.addAtom(e),e}},{key:"getAtoms",value:function(t){var e,n=[],r=o(this.atoms);try{for(r.s();!(e=r.n()).done;){var i=e.value;i.type()===t&&n.push(i)}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"getAtom",value:function(t){var e,n=o(this.atoms);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.type()===t)return r}}catch(t){n.e(t)}finally{n.f()}return null}},{key:"parse",value:function(t){for(var e=t.length,n=0;n<e;){var r=t.readUInt32BE(n),o=t.toString("ascii",n+4,n+8);if(0===r)break;if(n+=8,-1!==this.availableAtoms().indexOf(o)){var i=h.createAtom(o);null!==i&&(i.parse(t.slice(n,n+r-8)),this.addAtom(i))}if(!(n+r-8<=e))break;n+=r-8}}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),e+=8;var n,r=o(this.atoms);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.build(t,e),e+=i.bufferSize()}}catch(t){r.e(t)}finally{r.f()}}},{key:"bufferSize",value:function(){return 8+this.atoms.reduce((function(t,e){return t+e.bufferSize()}),0)}}])&&a(e.prototype,n),r&&a(e,r),c}(l);t.exports=p},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var s=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(n,t);var e=i(n);function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=e.call(this)).compositionOffset=0,t.keyframe=!1,t}return n}(n(14));t.exports=s},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var s=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(n,t);var e=i(n);function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),e.call(this)}return n}(n(14));t.exports=s},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=4294967295,i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,i;return e=t,i=[{key:"readUInt64BE",value:function(t,e){var n=t.readUInt32BE(e),r=t.readUInt32BE(e+4);return n>0&&(r+=n*(o+1)),r}},{key:"writeUInt64BE",value:function(t,e,n){var r=0,i=e;e>o&&(r=e/(o+1)<<0,i=e%(o+1)),t.writeUInt32BE(r,n),t.writeUInt32BE(i,n+4)}}],(n=null)&&r(e.prototype,n),i&&r(e,i),t}();t.exports=i},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).entries=[],t}return e=s,(n=[{key:"countMultiplier",value:function(){return 1}},{key:"parse",value:function(t){var e=t.readUInt32BE(4);this.entries=new Array(e*this.countMultiplier());for(var n=0,r=this.entries.length;n<r;n++)this.entries[n]=t.readUInt32BE(8+4*n)}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(this.entries.length/this.countMultiplier()<<0,e+12);for(var n=0,r=this.entries.length;n<r;n++)t.writeUInt32BE(this.entries[n],e+16+4*n)}},{key:"bufferSize",value:function(){return 16+4*this.entries.length}}])&&o(e.prototype,n),r&&o(e,r),s}(n(1));t.exports=c},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function a(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var s=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(n,t);var e=i(n);function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=e.call(this)).channels=null,t.sampleRate=null,t.sampleSize=null,t}return n}(n(13));t.exports=s},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).width=0,t.height=0,t}return e=s,(n=[{key:"resolution",value:function(){return this.width&&this.height?"".concat(this.width,"x").concat(this.height):""}}])&&o(e.prototype,n),r&&o(e,r),s}(n(13));t.exports=c},function(t,e,n){"use strict";(function(e){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(16),i=n(58),a=n(59),u=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,u,s;return n=t,s=[{key:"create",value:function(t){return t instanceof o?t:t instanceof e?new a(t):new i(t)}}],(u=null)&&r(n.prototype,u),s&&r(n,s),t}();t.exports=u}).call(this,n(2).Buffer)},function(t,e,n){"use strict";t.exports={CODEC_AAC:"aac",CODEC_H264:"h264",CODEC_H265:"h265"}},function(t,e,n){"use strict";function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=n(8),u=n(9),s=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.duration=0,this.timescale=0,this.tracks=[]}var e,n,o;return e=t,(n=[{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}},{key:"resolution",value:function(){var t=this.videoTrack();return null!==t?t.resolution():""}},{key:"size",value:function(){return this.tracks.reduce((function(t,e){return t+e.size()}),0)}},{key:"addTrack",value:function(t){this.tracks.push(t)}},{key:"videoTrack",value:function(){var t,e=r(this.tracks);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(n instanceof u)return n}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"audioTrack",value:function(){var t,e=r(this.tracks);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(n instanceof a)return n}}catch(t){e.e(t)}finally{e.f()}return null}},{key:"samples",value:function(){return[this.videoTrack(),this.audioTrack()].filter((function(t){return null!==t})).map((function(t){return t.samples})).reduce((function(t,e){return t.concat(e)}),[]).sort((function(t,e){return t.timescale===e.timescale?t.timestamp-e.timestamp:t.timestamp*e.timescale-e.timestamp*t.timescale}))}},{key:"ensureDuration",value:function(){var t=this;return 0===this.duration&&(this.duration=this.tracks.reduce((function(e,n){return Math.max(e,t.timescale*n.relativeDuration())}),0)),this.duration}}])&&i(e.prototype,n),o&&i(e,o),t}();t.exports=s},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.duration=0,this.timescale=0,this.extraData=null,this.codec=null,this.samples=[]}var e,n,o;return e=t,(n=[{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}},{key:"size",value:function(){return this.samples.reduce((function(t,e){return t+e.size}),0)}},{key:"ensureDuration",value:function(){return 0===this.duration&&(this.duration=this.samples.reduce((function(t,e){return Math.max(t,e.duration)}),0)),this.duration}},{key:"sortSamples",value:function(){this.samples.sort((function(t,e){return t.timestamp-e.timestamp}))}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.timestamp=0,this.timescale=0,this.size=0,this.offset=0}var e,n,o;return e=t,(n=[{key:"relativeTimestamp",value:function(){return this.timescale?this.timestamp/this.timescale:this.timestamp}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.timestamp=0,this.duration=0,this.timescale=0,this.videoExtraData=null,this.audioExtraData=null,this.samples=[]}var e,n,o;return e=t,(n=[{key:"hasVideo",value:function(){return null!==this.videoExtraData}},{key:"hasAudio",value:function(){return null!==this.audioExtraData}},{key:"relativeTimestamp",value:function(){return this.timescale?this.timestamp/this.timescale:this.timestamp}},{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"size",value:function(){}},{key:"read",value:function(){}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).width=null,t.height=null,t.extraData=null,t}return e=s,(n=[{key:"extraType",value:function(){}},{key:"parse",value:function(t){var e=24;for(this.width=t.readUInt16BE(e),e+=2,this.height=t.readUInt16BE(e),e+=52;e<t.length-8;){var n=t.readUInt32BE(e);e+=4;var r=t.toString("ascii",e,e+4);if(e+=4,0===n)break;if(r===this.extraType()){this.extraData=t.slice(e-4,e+n-4);break}e+=n-8}}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt16BE(1,e+14),t.writeUInt32BE(1,e+20),t.writeUInt16BE(this.width,e+32),t.writeUInt16BE(this.height,e+34),t.writeUInt32BE(72<<16,e+36),t.writeUInt32BE(72<<16,e+40),t.writeUInt16BE(1,e+48),t.write(f.COMPRESSOR_NAME.substring(0,16),e+50),t.writeUInt16BE(24,e+82),t.writeUInt16BE(65535,e+84),t.writeUInt32BE(this.extraData.length+4,e+86),t.write(this.extraType(),e+90),this.extraData.copy(t,e+94,4)}},{key:"bufferSize",value:function(){return 90+this.extraData.length}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o={mp4a:n(63),avcC:n(64),hvcC:n(65)},i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,i;return e=t,i=[{key:"parse",value:function(t){var e=t.toString("ascii",0,4),n=o[e];if(n){var r=new n(t.slice(4,t.length));return r.parse(),r}throw new Error("Unknown codec name ".concat(e))}}],(n=null)&&r(e.prototype,n),i&&r(e,i),t}();t.exports=i},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,o;return e=t,(n=[{key:"type",value:function(){}},{key:"parse",value:function(){}},{key:"codec",value:function(){}}])&&r(e.prototype,n),o&&r(e,o),t}();t.exports=o},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(0),i=n(62),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,a;return e=t,a=[{key:"parse",value:function(t){return new i(t).parse()}},{key:"check",value:function(t){return t.readUInt32BE(0)>0&&-1!==[o.ATOM_FTYP,o.ATOM_MOOV,o.ATOM_MDAT].indexOf(t.toString("ascii",4,8))}}],(n=null)&&r(e.prototype,n),a&&r(e,a),t}();t.exports=a},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(17),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_AVC1}},{key:"extraType",value:function(){return l.ATOM_AVCC}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(6),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).entries=[],t}return e=s,(n=[{key:"type",value:function(){return l.ATOM_CO64}},{key:"parse",value:function(t){var e=t.readUInt32BE(4);this.entries=new Array(e);for(var n=0;n<e;n++)this.entries[n]=f.readUInt64BE(t,8+8*n)}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(this.entries.length,e+12);for(var n=0,r=this.entries.length;n<r;n++)f.writeUInt64BE(t,this.entries[n],e+16+8*n)}},{key:"bufferSize",value:function(){return 16+8*this.entries.length}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(7),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_CTTS}},{key:"countMultiplier",value:function(){return 2}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";(function(e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0);function l(t,e){var n,r=0;for(n=0;n<4;n++){var o=255&t[e+n];if(r<<=7,r|=127&o,0==(128&o))break}return{size:r,read:n+1}}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(c,t);var n,r,u,s=a(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=s.call(this)).streamId=null,t.extraData=null,t}return n=c,(r=[{key:"type",value:function(){return f.ATOM_ESDS}},{key:"parse",value:function(t){var n=5;n+=l(t,n).read,this.streamId=t.readUInt16BE(n),n+=2;var r=t[n++];for(1==(r>>7&1)&&(n+=2),1==(r>>6&1)&&(n+=t[n]+1),1==(r>>5&1)&&(n+=2);n<t.length;){var o=t[n++],i=l(t,n);if(n+=i.read,4===o){n+=13,i.size>13&&5===t[n++]&&(n+=(i=l(t,n)).read,this.extraData=e.allocUnsafe(i.size),t.copy(this.extraData,0,n,n+i.size));break}n+=i.size}}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),e+=8,e+=4,t[e++]=3,t[e++]=23+this.extraData.length,t.writeUInt16BE(this.streamId,e),e+=2,t[e++]=0,t[e++]=4,t[e++]=15+this.extraData.length,t[e++]=64,t[e++]=21,e+=11,t[e++]=5,t[e++]=this.extraData.length,this.extraData.copy(t,e),e+=this.extraData.length,t[e++]=6,t[e++]=1,t[e++]=2}},{key:"bufferSize",value:function(){return 37+this.extraData.length}}])&&o(n.prototype,r),u&&o(n,u),c}(c);t.exports=h}).call(this,n(2).Buffer)},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).majorBrand=null,t.minorVersion=0,t.compatibleBrands=[],t}return e=s,(n=[{key:"type",value:function(){return f.ATOM_FTYP}},{key:"parse",value:function(t){this.majorBrand=t.toString("ascii",0,4),this.minorVersion=t.readUInt32BE(4);for(var e=0;e<(t.length-8)/4;e++)this.compatibleBrands.push(t.toString("ascii",8+4*e,12+4*e))}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.write(this.majorBrand,e+8),t.writeUInt32BE(this.minorVersion,e+12);for(var n=0;n<this.compatibleBrands.length;n++)t.write(this.compatibleBrands[n],e+16+4*n)}},{key:"bufferSize",value:function(){return 16+4*this.compatibleBrands.length}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).handlerType=null,t.componentName=null,t}return e=s,(n=[{key:"type",value:function(){return f.ATOM_HDLR}},{key:"parse",value:function(t){this.handlerType=t.toString("ascii",8,12),this.componentName=t.toString("ascii",16)}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.write(this.handlerType.substring(0,4),e+16),t.write(this.componentName.substring(0,16),e+24)}},{key:"bufferSize",value:function(){return 48}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(17),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_HEV1}},{key:"extraType",value:function(){return l.ATOM_HVCC}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(17),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_HVC1}},{key:"extraType",value:function(){return l.ATOM_HVCC}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(1),l=n(0),h=n(6),p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_MDHD}},{key:"parse",value:function(t){1===t[0]?(this.timescale=t.readUInt32BE(20),this.duration=h.readUInt64BE(t,24)):(this.timescale=t.readUInt32BE(12),this.duration=t.readUInt32BE(16))}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(this.timescale,e+20),t.writeUInt32BE(this.duration,e+24)}},{key:"bufferSize",value:function(){return 32}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=p},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_MDIA}},{key:"availableAtoms",value:function(){return[l.ATOM_MDHD,l.ATOM_MINF,l.ATOM_HDLR]}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_MINF}},{key:"availableAtoms",value:function(){return[l.ATOM_VMHD,l.ATOM_SMHD,l.ATOM_STBL]}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_MOOV}},{key:"availableAtoms",value:function(){return[l.ATOM_MVHD,l.ATOM_TRAK]}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";(function(e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(c,t);var n,r,u,s=a(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=s.call(this)).channels=null,t.sampleSize=null,t.sampleRate=null,t.streamId=null,t.extraData=null,t}return n=c,(r=[{key:"type",value:function(){return f.ATOM_MP4A}},{key:"parse",value:function(t){var n=8,r=t.readUInt16BE(n);for(n+=8,this.channels=t.readUInt16BE(n),n+=2,this.sampleSize=t.readUInt16BE(n),n+=4,this.sampleRate=t.readUInt32BE(n),n+=6,r>0&&(n+=16);n<t.length-8;){var o=t.readUInt32BE(n),i=t.toString("ascii",n+4,n+8);if(0===o)break;if(n+=8,i===f.ATOM_ESDS){var a=f.createAtom(i);null!==a&&(a.parse(t.slice(n,n+o-8)),this.streamId=a.streamId,a.extraData&&(this.extraData=e.allocUnsafe(4+a.extraData.length),this.extraData.write(f.ATOM_MP4A),a.extraData.copy(this.extraData,4,0)));break}n+=o-8}}},{key:"build",value:function(t,n){t.writeUInt32BE(this.bufferSize(),n),t.write(this.type(),n+4),t.writeUInt16BE(1,n+14),t.writeUInt16BE(this.channels,n+24),t.writeUInt16BE(this.sampleSize,n+26),t.writeUInt32BE(this.sampleRate,n+30);var r=f.createAtom(f.ATOM_ESDS);r.streamId=this.streamId,r.extraData=e.allocUnsafe(this.extraData.length-4),this.extraData.copy(r.extraData,0,4),r.build(t,n+36)}},{key:"bufferSize",value:function(){return 73+this.extraData.length}}])&&o(n.prototype,r),u&&o(n,u),c}(c);t.exports=l}).call(this,n(2).Buffer)},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=n(6),h=[65536,0,0,0,65536,0,0,0,1073741824],p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).timescale=null,t.duration=null,t.nextTrackId=null,t}return e=s,(n=[{key:"type",value:function(){return f.ATOM_MVHD}},{key:"parse",value:function(t){1===t[0]?(this.timescale=t.readUInt32BE(20),this.duration=l.readUInt64BE(t,24),this.nextTrackId=t.readUInt32BE(104)):(this.timescale=t.readUInt32BE(12),this.duration=t.readUInt32BE(16),this.nextTrackId=t.readUInt32BE(96))}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(this.timescale,e+20),t.writeUInt32BE(this.duration,e+24),t.writeUInt32BE(65536,e+28),t.writeUInt16BE(256,e+32);for(var n=0;n<h.length;n++)t.writeUInt32BE(h[n],e+44+4*n);t.writeUInt32BE(this.nextTrackId,e+104)}},{key:"bufferSize",value:function(){return 108}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=p},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(1),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_SMHD}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4)}},{key:"bufferSize",value:function(){return 16}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_STBL}},{key:"availableAtoms",value:function(){return[l.ATOM_STSZ,l.ATOM_STCO,l.ATOM_STSS,l.ATOM_STTS,l.ATOM_STSC,l.ATOM_CO64,l.ATOM_STSD,l.ATOM_CTTS]}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(7),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_STCO}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(7),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_STSC}},{key:"countMultiplier",value:function(){return 3}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=h(t);if(e){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var p=n(3),y=n(0),d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(l,t);var e,n,r,i=f(l);function l(){return a(this,l),i.apply(this,arguments)}return e=l,(n=[{key:"type",value:function(){return y.ATOM_STSD}},{key:"availableAtoms",value:function(){return[y.ATOM_AVC1,y.ATOM_HEV1,y.ATOM_HVC1,y.ATOM_MP4A]}},{key:"getVideoAtom",value:function(){return this.getAtom(y.ATOM_AVC1)||this.getAtom(y.ATOM_HEV1)||this.getAtom(y.ATOM_HVC1)}},{key:"getAudioAtom",value:function(){return this.getAtom(y.ATOM_MP4A)}},{key:"parse",value:function(t){s(h(l.prototype),"parse",this).call(this,t.slice(8))}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(1,e+12),e+=16;var n,r=o(this.atoms);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.build(t,e),e+=i.bufferSize()}}catch(t){r.e(t)}finally{r.f()}}},{key:"bufferSize",value:function(){return 8+s(h(l.prototype),"bufferSize",this).call(this)}}])&&u(e.prototype,n),r&&u(e,r),l}(p);t.exports=d},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(7),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_STSS}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(0),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).entries=[],t}return e=s,(n=[{key:"type",value:function(){return f.ATOM_STSZ}},{key:"parse",value:function(t){var e=t.readUInt32BE(4),n=t.readUInt32BE(8);if(this.entries=new Array(n),0===e)for(var r=0;r<n;r++)this.entries[r]=t.readUInt32BE(12+4*r);else this.entries.fill(e)}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(this.entries.length,e+16);for(var n=0,r=this.entries.length;n<r;n++)t.writeUInt32BE(this.entries[n],e+20+4*n)}},{key:"bufferSize",value:function(){return 20+4*this.entries.length}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(7),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_STTS}},{key:"countMultiplier",value:function(){return 2}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(1),f=n(6),l=n(0),h=[65536,0,0,0,65536,0,0,0,1073741824],p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=u.call(this)).duration=null,t.trackId=null,t.width=null,t.height=null,t}return e=s,(n=[{key:"type",value:function(){return l.ATOM_TKHD}},{key:"parse",value:function(t){this.trackId=t.readUInt32BE(12),1===t[0]?(this.duration=f.readUInt64BE(t,28),this.width=t.readUInt16BE(88),this.height=t.readUInt16BE(92)):(this.duration=t.readUInt32BE(20),this.width=t.readUInt16BE(76),this.height=t.readUInt16BE(80))}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(3,e+8),t.writeUInt32BE(this.trackId,e+20),t.writeUInt32BE(this.duration,e+28),null===this.width||null===this.height?(t.writeUInt16BE(1,e+42),t.writeUInt16BE(256,e+44)):(t.writeUInt16BE(this.width,e+84),t.writeUInt16BE(this.height,e+88));for(var n=0;n<h.length;n++)t.writeUInt32BE(h[n],e+48+4*n)}},{key:"bufferSize",value:function(){return 92}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=p},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(3),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_TRAK}},{key:"availableAtoms",value:function(){return[l.ATOM_TKHD,l.ATOM_MDIA]}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=c(t);if(e){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(1),l=n(0),h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(c,t);var e,n,r,s=u(c);function c(){return o(this,c),s.apply(this,arguments)}return e=c,(n=[{key:"type",value:function(){return l.ATOM_VMHD}},{key:"build",value:function(t,e){t.writeUInt32BE(this.bufferSize(),e),t.write(this.type(),e+4),t.writeUInt32BE(1,e+8)}},{key:"bufferSize",value:function(){return 20}}])&&i(e.prototype,n),r&&i(e,r),c}(f);t.exports=h},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(47),i=n(66),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,a;return e=t,a=[{key:"parse",value:function(t){return new i(t).parse()}},{key:"check",value:function(t){return t.toString("ascii",0,3)===o.HEADER_PREFIX&&t[3]===o.HEADER_VERSION}}],(n=null)&&r(e.prototype,n),a&&r(e,a),t}();t.exports=a},function(t,e,n){"use strict";t.exports={MOVIE_TIMESCALE:1e3,HEADER_SIZE:9,HEADER_PREFIX:"FLV",HEADER_VERSION:1,TYPE_SCRIPT:18,TYPE_VIDEO:9,TYPE_AUDIO:8,AUDIO_FORMAT_AAC:10,VIDEO_FORMAT_H264:7}},function(t,e){t.exports=function(){return new Worker("./static/WSPlayer/videoWorker.worker.js")}},function(t,e){t.exports=function(){return new Worker("./static/WSPlayer/audioWorker.worker.js")}},function(t,e,n){"use strict";t.exports=n(51)},function(t,e,n){"use strict";var r=n(12),o=n(13),i=n(9),a=n(8),u=n(14),s=n(4),c=n(5),f=n(15),l=n(52),h=n(53),p=n(60),y=n(20),d=n(46),m=n(68);t.exports={Movie:r,Track:o,VideoTrack:i,AudioTrack:a,Sample:u,VideoSample:s,AudioSample:c,Fragment:f,FragmentList:l,FragmentReader:h,MovieParser:p,MP4Parser:y,FLVParser:d,HLSPacketizer:m}},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(15),i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.fragmentDuration=0,this.duration=0,this.timescale=0,this.video=null,this.audio=null,this.fragments=[]}var e,n,i;return e=t,(n=[{key:"createFragment",value:function(t){var e={timestamp:t,duration:0,samples:[]};return this.fragments.push(e),e}},{key:"chop",value:function(){this.fragments.length>0&&0===this.fragments[this.fragments.length-1].duration&&this.fragments.splice(this.fragments.length-2,1)}},{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}},{key:"size",value:function(){return[this.video,this.audio].filter((function(t){return null!==t})).reduce((function(t,e){return t+e.size}),0)}},{key:"count",value:function(){return this.fragments.length}},{key:"get",value:function(t){var e=this.fragments[t];if(e){var n=new o;return n.timestamp=e.timestamp,n.duration=e.duration,n.samples=e.samples,n.timescale=this.timescale,this.video&&(n.videoExtraData=this.video.extraData),this.audio&&(n.audioExtraData=this.audio.extraData),n}}}])&&r(e.prototype,n),i&&r(e,i),t}();t.exports=i},function(t,e,n){"use strict";(function(e){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(10),i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,i,a;return n=t,a=[{key:"readSamples",value:function(t,n){for(var r=t.samples.map((function(t,e){return{index:e,offset:t.offset,size:t.size,bufferIndex:0,bufferOffset:0}})).sort((function(t,e){return t.offset-e.offset})),i=[],a=null,u=0,s=r.length;u<s;u++){var c=r[u];a&&a.offset+a.size>=c.offset+c.size?(c.bufferIndex=i.length-1,c.bufferOffset=c.offset-a.offset):(a={offset:c.offset,size:1048576,buffer:e.allocUnsafe(1048576)},i.push(a),c.bufferIndex=i.length-1,c.bufferOffset=0)}for(var f=o.create(n),l=0,h=i.length;l<h;l++){var p=i[l];f.read(p.buffer,p.offset)}return r.sort((function(t,e){return t.index-e.index})),t.samples.map((function(t,e){var n=r[e];return i[n.bufferIndex].buffer.slice(n.bufferOffset,n.bufferOffset+n.size)}))}}],(i=null)&&r(n.prototype,i),a&&r(n,a),t}();t.exports=i}).call(this,n(2).Buffer)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),a=r[0],u=r[1],s=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,u)),f=0,l=u>0?a-4:a;for(n=0;n<l;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],s[f++]=e>>16&255,s[f++]=e>>8&255,s[f++]=255&e;2===u&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,s[f++]=255&e);1===u&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,s[f++]=e>>8&255,s[f++]=255&e);return s},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=0,u=n-o;a<u;a+=16383)i.push(f(t,a,a+16383>u?u:a+16383));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u<s;++u)r[u]=a[u],o[a.charCodeAt(u)]=u;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var o,i,a=[],u=e;u<n;u+=3)o=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
  9. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  10. e.read=function(t,e,n,r,o){var i,a,u=8*o-r-1,s=(1<<u)-1,c=s>>1,f=-7,l=n?o-1:0,h=n?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-f)-1,p>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=h,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=h,f-=8);if(0===i)i=1-c;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var a,u,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,y=r?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),(e+=a+l>=1?h/s:h*Math.pow(2,1-l))*s>=2&&(a++,s/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*s-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[n+p]=255&u,p+=y,u/=256,o-=8);for(a=a<<o|u,c+=o;c>0;t[n+p]=255&a,p+=y,a/=256,c-=8);t[n+p-y]|=128*d}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";(function(e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(c,t);var n,r,u,s=a(c);function c(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=s.call(this)).fd=t,e}return n=c,(r=[{key:"size",value:function(){return this.fd.byteLength}},{key:"read",value:function(t,e,n){n=n||0;var r=this.fd.slice(e,e+t.length-n);return this.toBuffer(r)}},{key:"toBuffer",value:function(t){for(var n=new e(t.byteLength),r=new Uint8Array(t),o=0;o<n.length;++o)n[o]=r[o];return n}}])&&o(n.prototype,r),u&&o(n,u),c}(n(16));t.exports=c}).call(this,n(2).Buffer)},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=u.call(this)).buffer=t,e}return e=s,(n=[{key:"size",value:function(){return this.buffer.length}},{key:"read",value:function(t,e,n){return n=n||0,this.buffer.copy(t,n,e,e+t.length-n)}}])&&o(e.prototype,n),r&&o(e,r),s}(n(16));t.exports=c},function(t,e,n){"use strict";(function(e){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(10),i=[n(20),n(46)],a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,a,u;return n=t,u=[{key:"parse",value:function(t){return o.create(t),e.allocUnsafe(8),i[0].parse(t)}}],(a=null)&&r(n.prototype,a),u&&r(n,u),t}();t.exports=a}).call(this,n(2).Buffer)},function(t,e,n){var r={"./atom-avc1":21,"./atom-avc1.js":21,"./atom-co64":22,"./atom-co64.js":22,"./atom-ctts":23,"./atom-ctts.js":23,"./atom-esds":24,"./atom-esds.js":24,"./atom-ftyp":25,"./atom-ftyp.js":25,"./atom-hdlr":26,"./atom-hdlr.js":26,"./atom-hev1":27,"./atom-hev1.js":27,"./atom-hvc1":28,"./atom-hvc1.js":28,"./atom-mdhd":29,"./atom-mdhd.js":29,"./atom-mdia":30,"./atom-mdia.js":30,"./atom-minf":31,"./atom-minf.js":31,"./atom-moov":32,"./atom-moov.js":32,"./atom-mp4a":33,"./atom-mp4a.js":33,"./atom-mvhd":34,"./atom-mvhd.js":34,"./atom-smhd":35,"./atom-smhd.js":35,"./atom-stbl":36,"./atom-stbl.js":36,"./atom-stco":37,"./atom-stco.js":37,"./atom-stsc":38,"./atom-stsc.js":38,"./atom-stsd":39,"./atom-stsd.js":39,"./atom-stss":40,"./atom-stss.js":40,"./atom-stsz":41,"./atom-stsz.js":41,"./atom-stts":42,"./atom-stts.js":42,"./atom-tkhd":43,"./atom-tkhd.js":43,"./atom-trak":44,"./atom-trak.js":44,"./atom-vmhd":45,"./atom-vmhd.js":45};function o(t){var e=i(t);return n(e)}function i(t){if(!n.o(r,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}o.keys=function(){return Object.keys(r)},o.resolve=i,t.exports=o,o.id=61},function(t,e,n){"use strict";(function(e){function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){s=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=n(0),u=n(12),s=n(8),c=n(9),f=n(5),l=n(4),h=n(10),p=n(18),y=n(6),d=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.source=e,this.isFullMoov=!1,this.reader=h.create(this.source)}var n,o,d;return n=t,d=[{key:"_getEntries",value:function(t,e){var n=[],r=t.getAtom(e);return null!==r&&(n=r.entries),n}}],(o=[{key:"parse",value:function(){if(this._findMoovAtom(),this.isFullMoov){this._createMovie();var t,e=r(this.moovAtom.getAtoms(a.ATOM_TRAK));try{for(e.s();!(t=e.n()).done;){var n=t.value;this._createTrack(n)}}catch(t){e.e(t)}finally{e.f()}this.movie.tracks.forEach((function(t){t.sortSamples(),t.ensureDuration()})),this.movie.ensureDuration()}return this.movie}},{key:"_findMoovAtom",value:function(){this.moovAtom=null;for(var t=0,n=this.reader.size(),r=e.allocUnsafe(8);t<n;){var o=8,i=(r=this.reader.read(r,t)).readUInt32BE(0),u=r.toString("ascii",4);if(0===i?i=n-t:1===i&&(r=this.reader.read(r,t+r.length),i=y.readUInt64BE(r,0),o+=8),a.ATOM_MOOV===u){var s=e.allocUnsafe(i-o);if((s=this.reader.read(s,t+o)).byteLength===s.length){try{this.moovAtom=a.createAtom(u),this.moovAtom.parse(s),this.isFullMoov=!0}catch(t){console.log("moov 不全")}break}}else t+=i}this.moovAtom||console.log("MOOV atom not found")}},{key:"_createMovie",value:function(){this.movie=new u;var t=this.moovAtom.getAtom(a.ATOM_MVHD);t&&(this.movie.timescale=t.timescale,this.movie.duration=t.duration)}},{key:"_createTrack",value:function(e){var n=e.getAtom(a.ATOM_MDIA);if(null!==n){var r=n.getAtom(a.ATOM_HDLR),o=n.getAtom(a.ATOM_MDHD),i=n.getAtom(a.ATOM_MINF);if(null!==r&&null!==o&&null!==i){var u=i.getAtom(a.ATOM_STBL);if(null!==u){var h=u.getAtom(a.ATOM_STSD),y=null,d=null;if(a.TRACK_TYPE_AUDIO===r.handlerType){var m=h.getAudioAtom();null!==m&&(y=new s,d=f.prototype,y.channels=m.channels,y.sampleRate=m.sampleRate,y.sampleSize=m.sampleSize,y.extraData=m.extraData)}else if(a.TRACK_TYPE_VIDEO===r.handlerType){var v=h.getVideoAtom();null!==v&&(y=new c,d=l.prototype,y.width=v.width,y.height=v.height,y.extraData=v.extraData)}if(null!==y){y.duration=o.duration,y.timescale=o.timescale;var b=p.parse(y.extraData);null!==b&&(y.codec=b.codec());var g=t._getEntries(u,a.ATOM_CTTS),w=t._getEntries(u,a.ATOM_STSZ),S=t._getEntries(u,a.ATOM_STSC),O=t._getEntries(u,a.ATOM_STSS),_=t._getEntries(u,a.ATOM_STTS),T=t._getEntries(u,a.ATOM_STCO);0===T.length&&(T=t._getEntries(u,a.ATOM_CO64));var E=0,A=0,R=0,k=0,P=0,C=0,I=0,x=0,M=0,B=0;S.length>0&&(P=S[0],B=S[1]);for(var U=new Array(w.length),D=0,j=0,L=_.length;j<L;j+=2)for(var F=_[j+1]||0,V=0;V<_[j];V++){var z=Object.create(d);if(z.timestamp=E,z.timescale=y.timescale,z.size=w[x],z.offset=T[A]+R,y instanceof c){z.width=y.width,z.height=y.height,z.type="video";var N=0;2*C+1<g.length&&(N=g[2*C+1]||0,++I>=g[2*C]&&(C++,I=0)),z.compositionOffset=N,M<O.length&&O[M]===x+1?(z.keyframe=!0,M++):z.keyframe=!1}else z.type="audio";z.size>0&&(U[D++]=z),++k<B?R+=w[x]:(k=0,R=0,A++,3*P+1<S.length&&A+1>=S[3*P]&&(B=S[3*P+1],P++)),E+=F,x++}D<U.length?y.samples=U.slice(0,D):y.samples=U,y.extraData&&y.samples.length>0&&this.movie.addTrack(y)}}}}}}])&&i(n.prototype,o),d&&i(n,d),t}();t.exports=d}).call(this,n(2).Buffer)},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(19),f=n(11),l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],h=[0,1,2,3,4,5,6,8],p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=u.call(this)).extraData=t,e.rateIndex=null,e.sampleRate=null,e.channelsIndex=null,e.channels=null,e.profileObjectType=null,e}return e=s,(n=[{key:"type",value:function(){return f.CODEC_AAC}},{key:"parse",value:function(){var t=this.extraData[0],e=this.extraData[1];this.profileObjectType=(248&t)>>3,this.rateIndex=((7&t)<<1)+((128&e)>>7&1),this.sampleRate=l[this.rateIndex]||null,this.channelsIndex=(127&e)>>3,this.channels=h[this.channelsIndex]||null}},{key:"codec",value:function(){return"mp4a.40.".concat(this.profileObjectType)}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=p},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(19),f=n(11);var l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=u.call(this)).extraData=t,e._units=[],e._pos=0,e}return e=s,(n=[{key:"type",value:function(){return f.CODEC_H264}},{key:"parse",value:function(){this._pos=5;for(var t=31&this.extraData[this._pos++],e=0;e<t;e++)this._units.push(this._readNalUnit());for(var n=this.extraData[this._pos++],r=0;r<n;r++)this._units.push(this._readNalUnit())}},{key:"units",value:function(){return this._units}},{key:"codec",value:function(){for(var t,e,n="",r=1;r<4;r++)n+=(t=this.extraData[r].toString(16),e=2,"0".repeat(Math.max(0,e-t.length))+t);return"avc1.".concat(n)}},{key:"_readNalUnit",value:function(){var t=this.extraData.readUInt16BE(this._pos);this._pos+=2;var e=this.extraData.slice(this._pos,this._pos+t);return this._pos+=t,e}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(19),f=n(11),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}(s,t);var e,n,r,u=a(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=u.call(this)).extraData=t,e._units=[],e._pos=0,e}return e=s,(n=[{key:"type",value:function(){return f.CODEC_H265}},{key:"parse",value:function(){this._pos=22;for(var t=this.extraData[this._pos++],e=0;e<t;e++){var n=63&this.extraData[this._pos++],r=this.extraData.readUInt16BE(this._pos);this._pos+=2;for(var o=0;o<r;o++){var i=this._readNalUnit();32!==n&&33!==n&&34!==n||this._units.push(i)}}}},{key:"units",value:function(){return this._units}},{key:"codec",value:function(){for(var t=this.extraData[1],e=1==(t>>5&1),n=this.extraData.readUInt32LE(2).toString(16).replace(/0+$/,""),r=this.extraData[12],o=[],i=6;i<12;i++)o.push(this.extraData[i]);for(var a=0,u=o.length-1;u>0;u--)if(o[u]>0){a=u;break}for(var s=["hvc1",(t>>6)+(31&t),n,"".concat(e?"H":"L").concat(r)],c=0;c<=a;c++)s.push(o[c].toString(16).replace(/0+$/,""));return s.join(".")}},{key:"_readNalUnit",value:function(){var t=this.extraData.readUInt16BE(this._pos);this._pos+=2;var e=this.extraData.slice(this._pos,this._pos+t);return this._pos+=t,e}}])&&o(e.prototype,n),r&&o(e,r),s}(c);t.exports=l},function(t,e,n){"use strict";(function(e){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(67),i=n(47),a=n(12),u=n(8),s=n(9),c=n(5),f=n(4),l=n(10),h=n(18),p=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.source=e,this.reader=l.create(this.source)}var n,p,y;return n=t,(p=[{key:"parse",value:function(){var t=this;return this._parseHeader(),this._createMovie(),this._parseBody(),[this.videoTrack,this.audioTrack].forEach((function(e){e.extraData&&e.samples.length>0&&(e.sortSamples(),e.ensureDuration(),t.movie.addTrack(e))})),this.movie.ensureDuration(),this.movie}},{key:"_parseHeader",value:function(){var t=e.allocUnsafe(i.HEADER_SIZE);if(this.reader.read(t,0),t.toString("ascii",0,3)!==i.HEADER_PREFIX||t[3]!==i.HEADER_VERSION)throw new Error("FLV header not found");this.pos=t[8]}},{key:"_createMovie",value:function(){this.movie=new a,this.movie.timescale=i.MOVIE_TIMESCALE,this.videoTrack=new s,this.videoTrack.timescale=i.MOVIE_TIMESCALE,this.audioTrack=new u,this.audioTrack.timescale=i.MOVIE_TIMESCALE}},{key:"_parseBody",value:function(){for(var t=e.allocUnsafe(15),n=this.reader.size();this.pos<n;){this.pos+=this.reader.read(t,this.pos);var r=t[4];if(void 0===r)break;var o=t.readUIntBE(5,3),a=(t[11]<<24)+t.readUIntBE(8,3);i.TYPE_SCRIPT===r?this._parseScript(o):i.TYPE_AUDIO===r?this._parseAudio(o,a):i.TYPE_VIDEO===r&&this._parseVideo(o,a),this.pos+=o}}},{key:"_parseScript",value:function(t){var n=e.allocUnsafe(t);this.reader.read(n,this.pos);var r=o.parse(n);if(r&&r.length>1){var a=r[1];if(void 0!==a.duration){var u=a.duration*i.MOVIE_TIMESCALE;this.movie.duration=u,this.videoTrack.duration=u,this.audioTrack.duration=u}void 0!==a.width&&(this.videoTrack.width=a.width),void 0!==a.height&&(this.videoTrack.height=a.height)}}},{key:"_parseAudio",value:function(t,n){var r=e.allocUnsafe(2);this.reader.read(r,this.pos);var o=r[0],a=1&o,u=(2&o)>>1,s=(12&o)>>2,f=(240&o)>>4;if(i.AUDIO_FORMAT_AAC===f)if(0===r[1]){this.audioTrack.channels=1===a?2:1,this.audioTrack.sampleRate=5512.5*(1<<s)<<0,this.audioTrack.sampleSize=1===u?16:8;var l=e.allocUnsafe(4+t-2);l.write("mp4a"),this.reader.read(l,this.pos+2,4),this.audioTrack.extraData=l,this.audioTrack.codec=h.parse(l).codec()}else{var p=Object.create(c.prototype);p.timestamp=n,p.timescale=this.audioTrack.timescale,p.size=t-2,p.offset=this.pos+2,0<p.size&&this.audioTrack.samples.push(p)}}},{key:"_parseVideo",value:function(t,n){var r=e.allocUnsafe(5);this.reader.read(r,this.pos);var o=r[0],a=15&o,u=(240&o)>>4,s=r.readUIntBE(2,3);if(i.VIDEO_FORMAT_H264===a)if(0===r[1]){var c=e.allocUnsafe(4+t-5);c.write("avcC"),this.reader.read(c,this.pos+5,4),this.videoTrack.extraData=c,this.videoTrack.codec=h.parse(c).codec()}else{var l=Object.create(f.prototype);l.timestamp=n,l.timescale=this.videoTrack.timescale,l.size=t-5,l.offset=this.pos+5,l.compositionOffset=s,l.keyframe=1===u,0<l.size&&this.videoTrack.samples.push(l)}}}])&&r(n.prototype,p),y&&r(n,y),t}();t.exports=p}).call(this,n(2).Buffer)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}var a=function(){function t(e){r(this,t),this.buffer=e,this.pos=0}return i(t,[{key:"read",value:function(){for(var t=[];this.pos<this.buffer.length;)t.push(this._readByType(this._readByte()));return t}},{key:"_readByType",value:function(t){switch(t){case 0:return this._readDouble();case 1:return this._readBoolean();case 2:return this._readString();case 3:return this._readObject();case 5:return null;case 6:return;case 13:return null;case 7:return this._readReference();case 8:return this._readEcmaArray();case 10:return this._readStrictArray();case 11:return this._readDate();case 12:return this._readLongString();case 15:return this._readXmlDocument()}}},{key:"_readByte",value:function(){return this.buffer[this.pos++]}},{key:"_readDouble",value:function(){var t=this.buffer.readDoubleBE(this.pos);return this.pos+=8,t}},{key:"_readBoolean",value:function(){return 0!==this._readByte()}},{key:"_readString",value:function(){var t=this.buffer.readUInt16BE(this.pos);this.pos+=2;var e=this.buffer.toString("utf8",this.pos,this.pos+t);return this.pos+=t,e}},{key:"_readObject",value:function(){var t,e,n={};do{t=this._readString(),9!==(e=this._readByte())&&(n[t]=this._readByType(e))}while(9!==e);return n}},{key:"_readReference",value:function(){var t=this.buffer.readUInt16BE(this.pos);return this.pos+=2,"Reference #".concat(t)}},{key:"_readEcmaArray",value:function(){return this.pos+=4,this._readObject()}},{key:"_readStrictArray",value:function(){var t=this.buffer.readUInt32BE(this.pos);this.pos+=4;for(var e=[],n=0;n<t;n++)e.push(this._readByType(this._readByte()));return e}},{key:"_readDate",value:function(){var t=this.buffer.readDoubleBE(this.pos+2);return this.pos+=10,t}},{key:"_readLongString",value:function(){var t=this.buffer.readUInt32BE(this.pos);this.pos+=4;var e=this.buffer.toString("utf8",this.pos,this.pos+t);return this.pos+=t,e}},{key:"_readXmlDocument",value:function(){return this._readLongString()}}]),t}(),u=function(){function t(){r(this,t)}return i(t,null,[{key:"parse",value:function(t){return new a(t).read()}}]),t}();t.exports=u},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(15),i=n(69),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,a;return e=t,a=[{key:"packetize",value:function(t,e){if(!(t instanceof o))throw new Error("Argument 1 should be instance of Fragment");return new i(t,e).packFragment()}}],(n=null)&&r(e.prototype,n),a&&r(e,a),t}();t.exports=a},function(t,e,n){"use strict";(function(e){var r;function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var a=n(70),u=n(71),s=n(4),c=n(5),f=n(18),l=n(11),h=(i(r={},l.CODEC_AAC,15),i(r,l.CODEC_H264,27),i(r,l.CODEC_H265,36),r),p=function(){function t(n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.fragment=n,this.sampleBuffers=r,this._counter=new u,this.fragment.hasAudio()?this._audioCodecInfo=f.parse(this.fragment.audioExtraData):this._audioCodecInfo=null,this.fragment.hasVideo()?(this._videoCodecInfo=f.parse(this.fragment.videoExtraData),this._videoConfig=this._buildVideoConfig()):(this._videoCodecInfo=null,this._videoConfig=e.allocUnsafe(0))}var n,r,i;return n=t,i=[{key:"_writeTime",value:function(t,e,n,r){return t[e+0]=n>>29&14|240&r|1,t[e+1]=n>>22,t[e+2]=n>>14|1,t[e+3]=n>>7,t[e+4]=n<<1|1,5}},{key:"_writePid",value:function(t,e,n){return t[e+0]=224+(n>>8&31),t[e+1]=255&n,t[e+2]=240,t[e+3]=0,4}}],(r=[{key:"packFragment",value:function(){var t=[],n=0,r=90*this.fragment.timescale,o=this._buildHeader();t.push(o),n+=o.length;for(var i=[],a=0,u=null,f=0,l=function(){var r=this._packAudioPayload(e.concat(i,a),u,f);t.push(r),n+=r.length,i=[],a=0}.bind(this),h=0,p=this.fragment.samples.length;h<p;h++){var y=this.fragment.samples[h],d=this.sampleBuffers[h],m=r*y.timestamp/y.timescale<<0;if(y instanceof c){var v=this._convertAudioSample(d);5===i.length&&l(),0===i.length&&(u=y,f=m),i.push(v),a+=v.length}else if(y instanceof s){i.length>0&&l();var b=m+(r*y.compositionOffset/y.timescale<<0),g=this._convertVideoSample(d,y.keyframe),w=this._packVideoPayload(g,y,b,m);t.push(w),n+=w.length}}return i.length>0&&l(),e.concat(t,n)}},{key:"_convertAudioSample",value:function(t){var n=7+t.length,r=e.allocUnsafe(n);return r[0]=255,r[1]=241,r[2]=((this._audioCodecInfo.profileObjectType-1&3)<<6)+(this._audioCodecInfo.rateIndex<<2&60)+(this._audioCodecInfo.channelsIndex>>2&1)&255,r[3]=(3&this._audioCodecInfo.channelsIndex)<<6&255,r[5]=5+((7&n)<<5)&255,n>>=3,r[4]=255&n,n>>=8,r[3]+=3&n,r[6]=4092,t.copy(r,7),r}},{key:"_convertVideoSample",value:function(t,n){var r=6+t.length+(n?this._videoConfig.length:0);this._videoCodecInfo.type()===l.CODEC_H265&&r++;var o=e.allocUnsafe(r),i=0;for(o.writeUInt32BE(1,i),i+=4,this._videoCodecInfo.type()===l.CODEC_H265?(o[i++]=70,o[i++]=1):o[i++]=9,o[i++]=16,n&&(this._videoConfig.copy(o,i),i+=this._videoConfig.length),t.copy(o,i);i<o.length;){var a=o.readInt32BE(i);o.writeUInt32BE(1,i),i+=4+a}return o}},{key:"_packAudioPayload",value:function(n,r,o){var i=e.allocUnsafe(14+n.length),a=0,u=8+n.length;return i[a++]=0,i[a++]=0,i[a++]=1,i[a++]=192,i[a++]=u>>8&255,i[a++]=255&u,i[a++]=128,i[a++]=128,i[a++]=5,a+=t._writeTime(i,a,o,32),n.copy(i,a),this._packPayload(i,r,257,o)}},{key:"_packVideoPayload",value:function(n,r,o,i){var a=e.allocUnsafe(19+n.length),u=0;return a[u++]=0,a[u++]=0,a[u++]=1,a[u++]=224,a[u++]=0,a[u++]=0,a[u++]=128,a[u++]=192,a[u++]=10,u+=t._writeTime(a,u,o,48),u+=t._writeTime(a,u,i,16),n.copy(a,u),this._packPayload(a,r,256,i)}},{key:"_packPayload",value:function(t,n,r,o){var i=Math.ceil(t.length/184);n instanceof s&&184*i-8<t.length&&i++;for(var a=e.allocUnsafe(188*i),u=0,c=0;c<i;c++){var f=t.length-u,l=!1;(0===c&&n instanceof s||f<184)&&(l=!0);var h=188*c;if(a[h++]=71,a[h++]=(0===c?64:0)+(r>>8&31),a[h++]=255&r,a[h++]=this._counter.next(n)+(l?48:16),l){var p=0;if(n instanceof s&&0===c&&(p=7),f<183&&(p=Math.max(p,183-f)),a[h++]=p,0<p){var y=1,d=0;n instanceof s&&0===c&&(d=n.keyframe?80:16,y+=6,a[h+1]=o>>25&255,a[h+2]=o>>17&255,a[h+3]=o>>9&255,a[h+4]=o>>1&255,a[h+5]=(1&o)<<7|126,a[h+6]=0),a[h]=d,h+=y,y<p&&(a.fill(-1,h,h+p-y),h+=p-y)}}var m=188*(c+1)-h;0<m&&(t.copy(a,h,u,u+m),u+=m)}return a}},{key:"_buildHeader",value:function(){var n=e.allocUnsafe(376),r=0;n[r++]=71,n[r++]=64,n[r++]=0,n[r++]=16,n[r++]=0;var o=13;n[r++]=0,n[r++]=176+(o>>8&15),n[r++]=255&o,n[r++]=0,n[r++]=1,n[r++]=193,n[r++]=0,n[r++]=0,n[r++]=0,n[r++]=1,n[r++]=239,n[r++]=255,n.writeInt32BE(a.checksum(n,r-o+1,r),r),(r+=4)<188&&(n.fill(-1,r,188),r+=188-r),n[r++]=71,n[r++]=79,n[r++]=255,n[r++]=16,n[r++]=0,o=13;var i=0;return this.fragment.hasAudio()&&(o+=5,i=257),this.fragment.hasVideo()&&(o+=5,i=256),n[r++]=2,n[r++]=176+(o>>8&15),n[r++]=255&o,n[r++]=0,n[r++]=1,n[r++]=193,n[r++]=0,n[r++]=0,r+=t._writePid(n,r,i),this.fragment.hasVideo()&&(n[r++]=h[this._videoCodecInfo.type()]||0,r+=t._writePid(n,r,256)),this.fragment.hasAudio()&&(n[r++]=h[this._audioCodecInfo.type()]||0,r+=t._writePid(n,r,257)),n.writeInt32BE(a.checksum(n,r-o+1,r),r),(r+=4)<376&&n.fill(-1,r),n}},{key:"_buildVideoConfig",value:function(){for(var t=this._videoCodecInfo.units(),n=e.allocUnsafe(4*t.length+t.reduce((function(t,e){return t+e.length}),0)),r=0,o=0,i=t.length;o<i;o++){var a=t[o];n.writeUInt32BE(1,r),a.copy(n,r+4),r+=a.length+4}return n}}])&&o(n.prototype,r),i&&o(n,i),t}();t.exports=p}).call(this,n(2).Buffer)},function(t,e,n){"use strict";var r=[0,3072180484,1849393673,3643163405,3698721811,1802224919,2991425050,89147166,3102541862,267438370,3604384303,1640713003,1687882805,3548826929,178294332,3183300408,1893405004,3351695432,518034245,2851951169,2897024351,464573531,3264649046,1972065874,3358988650,2133579886,2785909603,286284391,339746169,2740837501,2054922096,3446038132,3770033048,1470882460,2391646609,965763221,1019225995,2346575503,1392223618,3857081478,1482369982,4014402234,912304567,2172479667,2217553837,858844841,3927354788,1561029792,2423075540,661713872,4267094237,1229681113,1276851911,4211537859,572568782,2503833034,679492338,2677930998,1186707707,4054219263,4109778657,1139539941,2597174504,768638444,2003863092,3228387120,424346685,2924922169,2869330471,471548707,3309109294,1914749226,3483209234,2021674774,2712013851,381406495,334203393,2767604485,2110785544,3402483980,128685944,2964739708,1771050353,3733836917,3688731499,1824543343,3051753826,50057318,3209076574,140205658,3514637655,1717623891,1664129869,3559742025,218831172,3122059328,2546378156,551249064,4194117541,1323361953,1269866943,4239220923,629875638,2459361970,791391626,2553703566,1091579779,4128108167,4083001753,1145071773,2640718736,712764052,3877483744,1342207460,2300983017,1044117485,996913395,2356572663,1431319290,3796759550,1609612486,3907878338,835403471,2262237131,2206644437,882604497,3988601564,1520499672,4007660649,1509805421,2161872480,935743332,848693370,2240530814,1554877043,3954199415,1443693647,3775972683,943097414,2401978178,2323316828,1030144344,3829432917,1398621009,2654674213,690412577,4026572588,1193106984,1112348982,4115716146,745970495,2607503931,651564291,2446054407,1223530250,4293940750,4204794128,1304285204,2493223705,596005405,240529393,3108761333,1617800696,3614469372,3525323746,1698556646,3155929579,184969455,3065718743,27715283,3632309726,1872585946,1791828932,3721454272,83272141,3018547401,2123185853,3381723065,280411316,2813033904,2734373550,367459242,3435182247,2078112163,3328194203,1904080799,2824582290,524711318,437662344,2903241612,1949151361,3274731909,2576386653,781011801,4155181140,1085720912,1172737614,4076556106,735906887,2629881155,561873531,2522891135,1329987698,4166762870,4245390952,1242974060,2469397601,606979429,3914046225,1582717461,2272270616,812505116,893230850,2183159302,1527127307,3961248783,1369871159,3871035955,1067258174,2290143290,2379257636,986535456,3823834413,1425462313,2032576965,3459999937,387787724,2684414664,2773528022,307064018,3412799455,2088169179,3251347939,1993760999,2951750634,418243310,498968048,2862638324,1938171897,3298551549,167622793,3202382221,1741044352,3504077700,3582704794,1654029726,3148889747,212729751,2970661039,101544363,3744150182,1748431778,1835447484,3665524152,56440501,3024156593,1];t.exports={checksum:function(t,e,n){e=e||0,n=n||t.length;for(var o,i=-1,a=e;a<n;a++)o=255&(i^t[a]),i=r[o]^i>>8&16777215;return function(t){return t>>>24|t>>8&65280|t<<8&16711680|t<<24}(i)}}},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(5),i=n(4),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._audioCounter=0,this._videoCounter=0}var e,n,a;return e=t,(n=[{key:"next",value:function(t){var e=0;return t instanceof o?(e=this._audioCounter,this._audioCounter=this._audioCounter+1&15):t instanceof i&&(e=this._videoCounter,this._videoCounter=this._videoCounter+1&15),e}}])&&r(e.prototype,n),a&&r(e,a),t}();t.exports=a},,function(t,e,n){"use strict";n.r(e);var r={log:function(){},error:function(){},count:function(){},info:function(){}};function o(){var t=navigator.userAgent.toLowerCase(),e=navigator.appName,n=null;return"Microsoft Internet Explorer"===e||t.indexOf("trident")>-1||t.indexOf("edge/")>-1?(n="ie","Microsoft Internet Explorer"===e?(t=/msie ([0-9]{1,}[\.0-9]{0,})/.exec(t),n+=parseInt(t[1])):t.indexOf("trident")>-1?n+=11:t.indexOf("edge/")>-1&&(n="edge")):t.indexOf("safari")>-1?n=t.indexOf("chrome")>-1?"chrome":"safari":t.indexOf("firefox")>-1&&(n="firefox"),n}var i=function(){function t(){}return t.createFromElementId=function(e){for(var n=document.getElementById(e),r="",o=n.firstChild;o;)3===o.nodeType&&(r+=o.textContent),o=o.nextSibling;var i=new t;return i.type=n.type,i.source=r,i},t.createFromSource=function(e,n){var r=new t;return r.type=e,r.source=n,r},t}(),a=function(t,e){if("x-shader/x-fragment"===e.type)this.shader=t.createShader(t.FRAGMENT_SHADER);else{if("x-shader/x-vertex"!==e.type)return void error("Unknown shader type: "+e.type);this.shader=t.createShader(t.VERTEX_SHADER)}t.shaderSource(this.shader,e.source),t.compileShader(this.shader),t.getShaderParameter(this.shader,t.COMPILE_STATUS)||error("An error occurred compiling the shaders: "+t.getShaderInfoLog(this.shader))},u=function(){function t(t){this.gl=t,this.program=this.gl.createProgram()}return t.prototype={attach:function(t){this.gl.attachShader(this.program,t.shader)},link:function(){this.gl.linkProgram(this.program)},use:function(){this.gl.useProgram(this.program)},getAttributeLocation:function(t){return this.gl.getAttribLocation(this.program,t)},setMatrixUniform:function(t,e){var n=this.gl.getUniformLocation(this.program,t);this.gl.uniformMatrix4fv(n,!1,e)}},t}(),s=function(){var t=null;function e(t,e,n){this.gl=t,this.size=e,this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),this.format=n||t.LUMINANCE,t.texImage2D(t.TEXTURE_2D,0,this.format,e.w,e.h,0,this.format,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}return e.prototype={fill:function(t,e){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),e?n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.size.w,this.size.h,this.format,n.UNSIGNED_BYTE,t):n.texImage2D(n.TEXTURE_2D,0,this.format,this.size.w,this.size.h,0,this.format,n.UNSIGNED_BYTE,t)},bind:function(e,n,r){var o=this.gl;t||(t=[o.TEXTURE0,o.TEXTURE1,o.TEXTURE2]),o.activeTexture(t[e]),o.bindTexture(o.TEXTURE_2D,this.texture),o.uniform1i(o.getUniformLocation(n.program,r),e)}},e}();var c=1e-6;function f(){}function l(){}function h(){}function p(){}f.prototype={e:function(t){return t<1||t>this.elements.length?null:this.elements[t-1]},dimensions:function(){return this.elements.length},modulus:function(){return Math.sqrt(this.dot(this))},eql:function(t){var e=this.elements.length,n=t.elements||t;if(e!=n.length)return!1;do{if(Math.abs(this.elements[e-1]-n[e-1])>c)return!1}while(--e);return!0},dup:function(){return f.create(this.elements)},map:function(t){var e=[];return this.each((function(n,r){e.push(t(n,r))})),f.create(e)},each:function(t){var e,n=this.elements.length,r=n;do{e=r-n,t(this.elements[e],e+1)}while(--n)},toUnitVector:function(){var t=this.modulus();return 0===t?this.dup():this.map((function(e){return e/t}))},angleFrom:function(t){var e=t.elements||t,n=this.elements.length;if(n!=e.length)return null;var r=0,o=0,i=0;if(this.each((function(t,n){r+=t*e[n-1],o+=t*t,i+=e[n-1]*e[n-1]})),o=Math.sqrt(o),i=Math.sqrt(i),o*i==0)return null;var a=r/(o*i);return a<-1&&(a=-1),a>1&&(a=1),Math.acos(a)},isParallelTo:function(t){var e=this.angleFrom(t);return null===e?null:e<=c},isAntiparallelTo:function(t){var e=this.angleFrom(t);return null===e?null:Math.abs(e-Math.PI)<=c},isPerpendicularTo:function(t){var e=this.dot(t);return null===e?null:Math.abs(e)<=c},add:function(t){var e=t.elements||t;return this.elements.length!=e.length?null:this.map((function(t,n){return t+e[n-1]}))},subtract:function(t){var e=t.elements||t;return this.elements.length!=e.length?null:this.map((function(t,n){return t-e[n-1]}))},multiply:function(t){return this.map((function(e){return e*t}))},x:function(t){return this.multiply(t)},dot:function(t){var e=t.elements||t,n=0,r=this.elements.length;if(r!=e.length)return null;do{n+=this.elements[r-1]*e[r-1]}while(--r);return n},cross:function(t){var e=t.elements||t;if(3!=this.elements.length||3!=e.length)return null;var n=this.elements;return f.create([n[1]*e[2]-n[2]*e[1],n[2]*e[0]-n[0]*e[2],n[0]*e[1]-n[1]*e[0]])},max:function(){var t,e=0,n=this.elements.length,r=n;do{t=r-n,Math.abs(this.elements[t])>Math.abs(e)&&(e=this.elements[t])}while(--n);return e},indexOf:function(t){var e,n=null,r=this.elements.length,o=r;do{e=o-r,null===n&&this.elements[e]==t&&(n=e+1)}while(--r);return n},toDiagonalMatrix:function(){return l.Diagonal(this.elements)},round:function(){return this.map((function(t){return Math.round(t)}))},snapTo:function(t){return this.map((function(e){return Math.abs(e-t)<=c?t:e}))},distanceFrom:function(t){if(t.anchor)return t.distanceFrom(this);var e=t.elements||t;if(e.length!=this.elements.length)return null;var n,r=0;return this.each((function(t,o){n=t-e[o-1],r+=n*n})),Math.sqrt(r)},liesOn:function(t){return t.contains(this)},liesIn:function(t){return t.contains(this)},rotate:function(t,e){var n,r,o,i,a;switch(this.elements.length){case 2:return 2!=(n=e.elements||e).length?null:(r=l.Rotation(t).elements,o=this.elements[0]-n[0],i=this.elements[1]-n[1],f.create([n[0]+r[0][0]*o+r[0][1]*i,n[1]+r[1][0]*o+r[1][1]*i]));case 3:if(!e.direction)return null;var u=e.pointClosestTo(this).elements;return r=l.Rotation(t,e.direction).elements,o=this.elements[0]-u[0],i=this.elements[1]-u[1],a=this.elements[2]-u[2],f.create([u[0]+r[0][0]*o+r[0][1]*i+r[0][2]*a,u[1]+r[1][0]*o+r[1][1]*i+r[1][2]*a,u[2]+r[2][0]*o+r[2][1]*i+r[2][2]*a]);default:return null}},reflectionIn:function(t){if(t.anchor){var e=this.elements.slice(),n=t.pointClosestTo(e).elements;return f.create([n[0]+(n[0]-e[0]),n[1]+(n[1]-e[1]),n[2]+(n[2]-(e[2]||0))])}var r=t.elements||t;return this.elements.length!=r.length?null:this.map((function(t,e){return r[e-1]+(r[e-1]-t)}))},to3D:function(){var t=this.dup();switch(t.elements.length){case 3:break;case 2:t.elements.push(0);break;default:return null}return t},inspect:function(){return"["+this.elements.join(", ")+"]"},setElements:function(t){return this.elements=(t.elements||t).slice(),this}},f.create=function(t){return(new f).setElements(t)},f.i=f.create([1,0,0]),f.j=f.create([0,1,0]),f.k=f.create([0,0,1]),f.Random=function(t){var e=[];do{e.push(Math.random())}while(--t);return f.create(e)},f.Zero=function(t){var e=[];do{e.push(0)}while(--t);return f.create(e)},l.prototype={e:function(t,e){return t<1||t>this.elements.length||e<1||e>this.elements[0].length?null:this.elements[t-1][e-1]},row:function(t){return t>this.elements.length?null:f.create(this.elements[t-1])},col:function(t){if(t>this.elements[0].length)return null;var e,n=[],r=this.elements.length,o=r;do{e=o-r,n.push(this.elements[e][t-1])}while(--r);return f.create(n)},dimensions:function(){return{rows:this.elements.length,cols:this.elements[0].length}},rows:function(){return this.elements.length},cols:function(){return this.elements[0].length},eql:function(t){var e=t.elements||t;if(void 0===e[0][0]&&(e=l.create(e).elements),this.elements.length!=e.length||this.elements[0].length!=e[0].length)return!1;var n,r,o,i=this.elements.length,a=i,u=this.elements[0].length;do{n=a-i,r=u;do{if(o=u-r,Math.abs(this.elements[n][o]-e[n][o])>c)return!1}while(--r)}while(--i);return!0},dup:function(){return l.create(this.elements)},map:function(t){var e,n,r,o=[],i=this.elements.length,a=i,u=this.elements[0].length;do{n=u,o[e=a-i]=[];do{r=u-n,o[e][r]=t(this.elements[e][r],e+1,r+1)}while(--n)}while(--i);return l.create(o)},isSameSizeAs:function(t){var e=t.elements||t;return void 0===e[0][0]&&(e=l.create(e).elements),this.elements.length==e.length&&this.elements[0].length==e[0].length},add:function(t){var e=t.elements||t;return void 0===e[0][0]&&(e=l.create(e).elements),this.isSameSizeAs(e)?this.map((function(t,n,r){return t+e[n-1][r-1]})):null},subtract:function(t){var e=t.elements||t;return void 0===e[0][0]&&(e=l.create(e).elements),this.isSameSizeAs(e)?this.map((function(t,n,r){return t-e[n-1][r-1]})):null},canMultiplyFromLeft:function(t){var e=t.elements||t;return void 0===e[0][0]&&(e=l.create(e).elements),this.elements[0].length==e.length},multiply:function(t){if(!t.elements)return this.map((function(e){return e*t}));var e=!!t.modulus;if(void 0===(y=t.elements||t)[0][0]&&(y=l.create(y).elements),!this.canMultiplyFromLeft(y))return null;var n,r,o,i,a,u,s=this.elements.length,c=s,f=y[0].length,h=this.elements[0].length,p=[];do{p[n=c-s]=[],r=f;do{o=f-r,i=0,a=h;do{u=h-a,i+=this.elements[n][u]*y[u][o]}while(--a);p[n][o]=i}while(--r)}while(--s);var y=l.create(p);return e?y.col(1):y},x:function(t){return this.multiply(t)},minor:function(t,e,n,r){var o,i,a,u=[],s=n,c=this.elements.length,f=this.elements[0].length;do{u[o=n-s]=[],i=r;do{a=r-i,u[o][a]=this.elements[(t+o-1)%c][(e+a-1)%f]}while(--i)}while(--s);return l.create(u)},transpose:function(){var t,e,n,r=this.elements.length,o=this.elements[0].length,i=[],a=o;do{i[t=o-a]=[],e=r;do{n=r-e,i[t][n]=this.elements[n][t]}while(--e)}while(--a);return l.create(i)},isSquare:function(){return this.elements.length==this.elements[0].length},max:function(){var t,e,n,r=0,o=this.elements.length,i=o,a=this.elements[0].length;do{t=i-o,e=a;do{n=a-e,Math.abs(this.elements[t][n])>Math.abs(r)&&(r=this.elements[t][n])}while(--e)}while(--o);return r},indexOf:function(t){var e,n,r,o=this.elements.length,i=o,a=this.elements[0].length;do{e=i-o,n=a;do{if(r=a-n,this.elements[e][r]==t)return{i:e+1,j:r+1}}while(--n)}while(--o);return null},diagonal:function(){if(!this.isSquare)return null;var t,e=[],n=this.elements.length,r=n;do{t=r-n,e.push(this.elements[t][t])}while(--n);return f.create(e)},toRightTriangular:function(){var t,e,n,r,o=this.dup(),i=this.elements.length,a=i,u=this.elements[0].length;do{if(e=a-i,0==o.elements[e][e])for(j=e+1;j<a;j++)if(0!=o.elements[j][e]){t=[],n=u;do{r=u-n,t.push(o.elements[e][r]+o.elements[j][r])}while(--n);o.elements[e]=t;break}if(0!=o.elements[e][e])for(j=e+1;j<a;j++){var s=o.elements[j][e]/o.elements[e][e];t=[],n=u;do{r=u-n,t.push(r<=e?0:o.elements[j][r]-o.elements[e][r]*s)}while(--n);o.elements[j]=t}}while(--i);return o},toUpperTriangular:function(){return this.toRightTriangular()},determinant:function(){if(!this.isSquare())return null;var t,e=this.toRightTriangular(),n=e.elements[0][0],r=e.elements.length-1,o=r;do{t=o-r+1,n*=e.elements[t][t]}while(--r);return n},det:function(){return this.determinant()},isSingular:function(){return this.isSquare()&&0===this.determinant()},trace:function(){if(!this.isSquare())return null;var t,e=this.elements[0][0],n=this.elements.length-1,r=n;do{t=r-n+1,e+=this.elements[t][t]}while(--n);return e},tr:function(){return this.trace()},rank:function(){var t,e,n,r=this.toRightTriangular(),o=0,i=this.elements.length,a=i,u=this.elements[0].length;do{t=a-i,e=u;do{if(n=u-e,Math.abs(r.elements[t][n])>c){o++;break}}while(--e)}while(--i);return o},rk:function(){return this.rank()},augment:function(t){var e=t.elements||t;void 0===e[0][0]&&(e=l.create(e).elements);var n,r,o,i=this.dup(),a=i.elements[0].length,u=i.elements.length,s=u,c=e[0].length;if(u!=e.length)return null;do{n=s-u,r=c;do{o=c-r,i.elements[n][a+o]=e[n][o]}while(--r)}while(--u);return i},inverse:function(){if(!this.isSquare()||this.isSingular())return null;var t,e,n,r,o,i,a,u=this.elements.length,s=u,c=this.augment(l.I(u)).toRightTriangular(),f=c.elements[0].length,h=[];do{o=[],n=f,h[t=u-1]=[],i=c.elements[t][t];do{r=f-n,a=c.elements[t][r]/i,o.push(a),r>=s&&h[t].push(a)}while(--n);for(c.elements[t]=o,e=0;e<t;e++){o=[],n=f;do{r=f-n,o.push(c.elements[e][r]-c.elements[t][r]*c.elements[e][t])}while(--n);c.elements[e]=o}}while(--u);return l.create(h)},inv:function(){return this.inverse()},round:function(){return this.map((function(t){return Math.round(t)}))},snapTo:function(t){return this.map((function(e){return Math.abs(e-t)<=c?t:e}))},inspect:function(){var t,e=[],n=this.elements.length,r=n;do{t=r-n,e.push(f.create(this.elements[t]).inspect())}while(--n);return e.join("\n")},setElements:function(t){var e,n=t.elements||t;if(void 0!==n[0][0]){var r,o,i,a=n.length,u=a;this.elements=[];do{o=r=n[e=u-a].length,this.elements[e]=[];do{i=o-r,this.elements[e][i]=n[e][i]}while(--r)}while(--a);return this}var s=n.length,c=s;this.elements=[];do{e=c-s,this.elements.push([n[e]])}while(--s);return this}},l.create=function(t){return(new l).setElements(t)},l.I=function(t){var e,n,r,o=[],i=t;do{o[e=i-t]=[],n=i;do{r=i-n,o[e][r]=e==r?1:0}while(--n)}while(--t);return l.create(o)},l.Diagonal=function(t){var e,n=t.length,r=n,o=l.I(n);do{e=r-n,o.elements[e][e]=t[e]}while(--n);return o},l.Rotation=function(t,e){if(!e)return l.create([[Math.cos(t),-Math.sin(t)],[Math.sin(t),Math.cos(t)]]);var n=e.dup();if(3!=n.elements.length)return null;var r=n.modulus(),o=n.elements[0]/r,i=n.elements[1]/r,a=n.elements[2]/r,u=Math.sin(t),s=Math.cos(t),c=1-s;return l.create([[c*o*o+s,c*o*i-u*a,c*o*a+u*i],[c*o*i+u*a,c*i*i+s,c*i*a-u*o],[c*o*a-u*i,c*i*a+u*o,c*a*a+s]])},l.RotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return l.create([[1,0,0],[0,e,-n],[0,n,e]])},l.RotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return l.create([[e,0,n],[0,1,0],[-n,0,e]])},l.RotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return l.create([[e,-n,0],[n,e,0],[0,0,1]])},l.Random=function(t,e){return l.Zero(t,e).map((function(){return Math.random()}))},l.Zero=function(t,e){var n,r,o,i=[],a=t;do{i[n=t-a]=[],r=e;do{o=e-r,i[n][o]=0}while(--r)}while(--a);return l.create(i)},h.prototype={eql:function(t){return this.isParallelTo(t)&&this.contains(t.anchor)},dup:function(){return h.create(this.anchor,this.direction)},translate:function(t){var e=t.elements||t;return h.create([this.anchor.elements[0]+e[0],this.anchor.elements[1]+e[1],this.anchor.elements[2]+(e[2]||0)],this.direction)},isParallelTo:function(t){if(t.normal)return t.isParallelTo(this);var e=this.direction.angleFrom(t.direction);return Math.abs(e)<=c||Math.abs(e-Math.PI)<=c},distanceFrom:function(t){if(t.normal)return t.distanceFrom(this);if(t.direction){if(this.isParallelTo(t))return this.distanceFrom(t.anchor);var e=this.direction.cross(t.direction).toUnitVector().elements,n=this.anchor.elements,r=t.anchor.elements;return Math.abs((n[0]-r[0])*e[0]+(n[1]-r[1])*e[1]+(n[2]-r[2])*e[2])}var o=t.elements||t,i=(n=this.anchor.elements,this.direction.elements),a=o[0]-n[0],u=o[1]-n[1],s=(o[2]||0)-n[2],c=Math.sqrt(a*a+u*u+s*s);if(0===c)return 0;var f=(a*i[0]+u*i[1]+s*i[2])/c,l=1-f*f;return Math.abs(c*Math.sqrt(l<0?0:l))},contains:function(t){var e=this.distanceFrom(t);return null!==e&&e<=c},liesIn:function(t){return t.contains(this)},intersects:function(t){return t.normal?t.intersects(this):!this.isParallelTo(t)&&this.distanceFrom(t)<=c},intersectionWith:function(t){if(t.normal)return t.intersectionWith(this);if(!this.intersects(t))return null;var e=this.anchor.elements,n=this.direction.elements,r=t.anchor.elements,o=t.direction.elements,i=n[0],a=n[1],u=n[2],s=o[0],c=o[1],l=o[2],h=e[0]-r[0],p=e[1]-r[1],y=e[2]-r[2],d=s*s+c*c+l*l,m=i*s+a*c+u*l,v=((-i*h-a*p-u*y)*d/(i*i+a*a+u*u)+m*(s*h+c*p+l*y))/(d-m*m);return f.create([e[0]+v*i,e[1]+v*a,e[2]+v*u])},pointClosestTo:function(t){if(t.direction){if(this.intersects(t))return this.intersectionWith(t);if(this.isParallelTo(t))return null;var e=this.direction.elements,n=t.direction.elements,r=e[0],o=e[1],i=e[2],a=n[0],u=n[1],s=n[2],c=i*a-r*s,l=r*u-o*a,h=o*s-i*u,y=f.create([c*s-l*u,l*a-h*s,h*u-c*a]);return(d=p.create(t.anchor,y)).intersectionWith(this)}var d=t.elements||t;if(this.contains(d))return f.create(d);var m=this.anchor.elements,v=(r=(e=this.direction.elements)[0],o=e[1],i=e[2],m[0]),b=m[1],g=m[2],w=(c=r*(d[1]-b)-o*(d[0]-v),l=o*((d[2]||0)-g)-i*(d[1]-b),h=i*(d[0]-v)-r*((d[2]||0)-g),f.create([o*c-i*h,i*l-r*c,r*h-o*l])),S=this.distanceFrom(d)/w.modulus();return f.create([d[0]+w.elements[0]*S,d[1]+w.elements[1]*S,(d[2]||0)+w.elements[2]*S])},rotate:function(t,e){void 0===e.direction&&(e=h.create(e.to3D(),f.k));var n=l.Rotation(t,e.direction).elements,r=e.pointClosestTo(this.anchor).elements,o=this.anchor.elements,i=this.direction.elements,a=r[0],u=r[1],s=r[2],c=o[0]-a,p=o[1]-u,y=o[2]-s;return h.create([a+n[0][0]*c+n[0][1]*p+n[0][2]*y,u+n[1][0]*c+n[1][1]*p+n[1][2]*y,s+n[2][0]*c+n[2][1]*p+n[2][2]*y],[n[0][0]*i[0]+n[0][1]*i[1]+n[0][2]*i[2],n[1][0]*i[0]+n[1][1]*i[1]+n[1][2]*i[2],n[2][0]*i[0]+n[2][1]*i[1]+n[2][2]*i[2]])},reflectionIn:function(t){if(t.normal){var e=this.anchor.elements,n=this.direction.elements,r=e[0],o=e[1],i=e[2],a=n[0],u=n[1],s=n[2],c=this.anchor.reflectionIn(t).elements,f=r+a,l=o+u,p=i+s,y=t.pointClosestTo([f,l,p]).elements,d=[y[0]+(y[0]-f)-c[0],y[1]+(y[1]-l)-c[1],y[2]+(y[2]-p)-c[2]];return h.create(c,d)}if(t.direction)return this.rotate(Math.PI,t);var m=t.elements||t;return h.create(this.anchor.reflectionIn([m[0],m[1],m[2]||0]),this.direction)},setVectors:function(t,e){if(t=f.create(t),e=f.create(e),2==t.elements.length&&t.elements.push(0),2==e.elements.length&&e.elements.push(0),t.elements.length>3||e.elements.length>3)return null;var n=e.modulus();return 0===n?null:(this.anchor=t,this.direction=f.create([e.elements[0]/n,e.elements[1]/n,e.elements[2]/n]),this)}},h.create=function(t,e){return(new h).setVectors(t,e)},h.X=h.create(f.Zero(3),f.i),h.Y=h.create(f.Zero(3),f.j),h.Z=h.create(f.Zero(3),f.k),p.prototype={eql:function(t){return this.contains(t.anchor)&&this.isParallelTo(t)},dup:function(){return p.create(this.anchor,this.normal)},translate:function(t){var e=t.elements||t;return p.create([this.anchor.elements[0]+e[0],this.anchor.elements[1]+e[1],this.anchor.elements[2]+(e[2]||0)],this.normal)},isParallelTo:function(t){var e;return t.normal?(e=this.normal.angleFrom(t.normal),Math.abs(e)<=c||Math.abs(Math.PI-e)<=c):t.direction?this.normal.isPerpendicularTo(t.direction):null},isPerpendicularTo:function(t){var e=this.normal.angleFrom(t.normal);return Math.abs(Math.PI/2-e)<=c},distanceFrom:function(t){if(this.intersects(t)||this.contains(t))return 0;if(t.anchor){var e=this.anchor.elements,n=t.anchor.elements,r=this.normal.elements;return Math.abs((e[0]-n[0])*r[0]+(e[1]-n[1])*r[1]+(e[2]-n[2])*r[2])}var o=t.elements||t;e=this.anchor.elements,r=this.normal.elements;return Math.abs((e[0]-o[0])*r[0]+(e[1]-o[1])*r[1]+(e[2]-(o[2]||0))*r[2])},contains:function(t){if(t.normal)return null;if(t.direction)return this.contains(t.anchor)&&this.contains(t.anchor.add(t.direction));var e=t.elements||t,n=this.anchor.elements,r=this.normal.elements;return Math.abs(r[0]*(n[0]-e[0])+r[1]*(n[1]-e[1])+r[2]*(n[2]-(e[2]||0)))<=c},intersects:function(t){return void 0===t.direction&&void 0===t.normal?null:!this.isParallelTo(t)},intersectionWith:function(t){if(!this.intersects(t))return null;if(t.direction){var e=t.anchor.elements,n=t.direction.elements,r=this.anchor.elements,o=((a=this.normal.elements)[0]*(r[0]-e[0])+a[1]*(r[1]-e[1])+a[2]*(r[2]-e[2]))/(a[0]*n[0]+a[1]*n[1]+a[2]*n[2]);return f.create([e[0]+n[0]*o,e[1]+n[1]*o,e[2]+n[2]*o])}if(t.normal){for(var i=this.normal.cross(t.normal).toUnitVector(),a=this.normal.elements,u=(e=this.anchor.elements,t.normal.elements),s=t.anchor.elements,c=l.Zero(2,2),p=0;c.isSingular();)p++,c=l.create([[a[p%3],a[(p+1)%3]],[u[p%3],u[(p+1)%3]]]);for(var y=c.inverse().elements,d=a[0]*e[0]+a[1]*e[1]+a[2]*e[2],m=u[0]*s[0]+u[1]*s[1]+u[2]*s[2],v=[y[0][0]*d+y[0][1]*m,y[1][0]*d+y[1][1]*m],b=[],g=1;g<=3;g++)b.push(p==g?0:v[(g+(5-p)%3)%3]);return h.create(b,i)}},pointClosestTo:function(t){var e=t.elements||t,n=this.anchor.elements,r=this.normal.elements,o=(n[0]-e[0])*r[0]+(n[1]-e[1])*r[1]+(n[2]-(e[2]||0))*r[2];return f.create([e[0]+r[0]*o,e[1]+r[1]*o,(e[2]||0)+r[2]*o])},rotate:function(t,e){var n=l.Rotation(t,e.direction).elements,r=e.pointClosestTo(this.anchor).elements,o=this.anchor.elements,i=this.normal.elements,a=r[0],u=r[1],s=r[2],c=o[0]-a,f=o[1]-u,h=o[2]-s;return p.create([a+n[0][0]*c+n[0][1]*f+n[0][2]*h,u+n[1][0]*c+n[1][1]*f+n[1][2]*h,s+n[2][0]*c+n[2][1]*f+n[2][2]*h],[n[0][0]*i[0]+n[0][1]*i[1]+n[0][2]*i[2],n[1][0]*i[0]+n[1][1]*i[1]+n[1][2]*i[2],n[2][0]*i[0]+n[2][1]*i[1]+n[2][2]*i[2]])},reflectionIn:function(t){if(t.normal){var e=this.anchor.elements,n=this.normal.elements,r=e[0],o=e[1],i=e[2],a=n[0],u=n[1],s=n[2],c=this.anchor.reflectionIn(t).elements,f=r+a,l=o+u,h=i+s,y=t.pointClosestTo([f,l,h]).elements,d=[y[0]+(y[0]-f)-c[0],y[1]+(y[1]-l)-c[1],y[2]+(y[2]-h)-c[2]];return p.create(c,d)}if(t.direction)return this.rotate(Math.PI,t);var m=t.elements||t;return p.create(this.anchor.reflectionIn([m[0],m[1],m[2]||0]),this.normal)},setVectors:function(t,e,n){if(null===(t=(t=f.create(t)).to3D()))return null;if(null===(e=(e=f.create(e)).to3D()))return null;if(void 0===n)n=null;else if(null===(n=(n=f.create(n)).to3D()))return null;var r,o,i=t.elements[0],a=t.elements[1],u=t.elements[2],s=e.elements[0],c=e.elements[1],l=e.elements[2];if(null!==n){var h=n.elements[0],p=n.elements[1],y=n.elements[2];if(0===(o=(r=f.create([(c-a)*(y-u)-(l-u)*(p-a),(l-u)*(h-i)-(s-i)*(y-u),(s-i)*(p-a)-(c-a)*(h-i)])).modulus()))return null;r=f.create([r.elements[0]/o,r.elements[1]/o,r.elements[2]/o])}else{if(0===(o=Math.sqrt(s*s+c*c+l*l)))return null;r=f.create([e.elements[0]/o,e.elements[1]/o,e.elements[2]/o])}return this.anchor=t,this.normal=r,this}},l.Translation=function(t){var e;if(2===t.elements.length)return(e=l.I(3)).elements[2][0]=t.elements[0],e.elements[2][1]=t.elements[1],e;if(3===t.elements.length)return(e=l.I(4)).elements[0][3]=t.elements[0],e.elements[1][3]=t.elements[1],e.elements[2][3]=t.elements[2],e;throw"Invalid length for Translation"},l.prototype.flatten=function(){var t=[];if(0===this.elements.length)return[];for(var e=0;e<this.elements[0].length;e++)for(var n=0;n<this.elements.length;n++)t.push(this.elements[n][e]);return t},l.prototype.ensure4x4=function(){var t;if(4===this.elements.length&&4===this.elements[0].length)return this;if(this.elements.length>4||this.elements[0].length>4)return null;for(t=0;t<this.elements.length;t++)for(var e=this.elements[t].length;e<4;e++)t===e?this.elements[t].push(1):this.elements[t].push(0);for(t=this.elements.length;t<4;t++)0===t?this.elements.push([1,0,0,0]):1===t?this.elements.push([0,1,0,0]):2===t?this.elements.push([0,0,1,0]):3===t&&this.elements.push([0,0,0,1]);return this},l.prototype.make3x3=function(){return 4!==this.elements.length||4!==this.elements[0].length?null:l.create([[this.elements[0][0],this.elements[0][1],this.elements[0][2]],[this.elements[1][0],this.elements[1][1],this.elements[1][2]],[this.elements[2][0],this.elements[2][1],this.elements[2][2]]])},p.create=function(t,e,n){return(new p).setVectors(t,e,n)},p.XY=p.create(f.Zero(3),f.k),p.YZ=p.create(f.Zero(3),f.i),p.ZX=p.create(f.Zero(3),f.j),p.YX=p.XY,p.ZY=p.YZ,p.XZ=p.ZX;var y=f.create,d=l.create,m=(h.create,p.create,function(){function t(t,e,n){s.call(this,t,e,n)}return t.prototype=w(s,{fill:function(t,e){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),e?n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.size.w,this.size.h,this.format,n.UNSIGNED_BYTE,t):n.texImage2D(n.TEXTURE_2D,0,this.format,this.format,n.UNSIGNED_BYTE,t)}}),t}()),v=function(){var t=i.createFromSource("x-shader/x-vertex",S(["attribute vec3 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat4 uMVMatrix;","uniform mat4 uPMatrix;","varying highp vec2 vTextureCoord;","void main(void) {"," gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);"," vTextureCoord = aTextureCoord;","}"])),e=i.createFromSource("x-shader/x-fragment",S(["precision highp float;","varying highp vec2 vTextureCoord;","uniform sampler2D texture;","void main(void) {"," gl_FragColor = texture2D(texture, vTextureCoord);","}"])),n=[192,368,608,1088,1472,1952,3008];function o(t,e,r){this.canvas=t,this.size=e;var o=!0;for(var i in n)e.w===n[i]&&(o=!1);o?this.canvas.width=e.w:192===e.w?this.canvas.width=e.w-12:this.canvas.width=e.w-8,this.canvas.height=e.h,this.onInitWebGL(),this.onInitShaders(),f.call(this),r&&c.call(this),this.onInitTextures(),b.call(this)}function c(){var t=this.gl;this.framebuffer=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer),this.framebufferTexture=new s(this.gl,this.size,t.RGBA);var e=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,e),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,this.size.w,this.size.h),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.framebufferTexture.texture,0),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}function f(){var t=[1,1,0,-1,1,0,1,-1,0,-1,-1,0],e=this.gl;this.quadVPBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quadVPBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(t),e.STATIC_DRAW),this.quadVPBuffer.itemSize=3,this.quadVPBuffer.numItems=4;this.quadVTCBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.quadVTCBuffer),t=[1,0,0,0,1,1,0,1],e.bufferData(e.ARRAY_BUFFER,new Float32Array(t),e.STATIC_DRAW)}function h(){this.mvMatrix=l.I(4)}function p(t){this.mvMatrix=this.mvMatrix.x(t)}function m(t){p.call(this,l.Translation(y([t[0],t[1],t[2]])).ensure4x4())}function v(){this.program.setMatrixUniform("uPMatrix",new Float32Array(this.perspectiveMatrix.flatten())),this.program.setMatrixUniform("uMVMatrix",new Float32Array(this.mvMatrix.flatten()))}function b(){var t,e,n,r,o,i,a=this.gl;this.perspectiveMatrix=(t=45,e=1,r=100,o=(n=.1)*Math.tan(t*Math.PI/360),function(t,e,n,r,o,i){return d([[2*o/(e-t),0,(e+t)/(e-t),0],[0,2*o/(r-n),(r+n)/(r-n),0],[0,0,-(i+o)/(i-o),-2*i*o/(i-o)],[0,0,-1,0]])}((i=-o)*e,o*e,i,o,n,r)),h.call(this),m.call(this,[0,0,-2.415]),a.bindBuffer(a.ARRAY_BUFFER,this.quadVPBuffer),a.vertexAttribPointer(this.vertexPositionAttribute,3,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,this.quadVTCBuffer),a.vertexAttribPointer(this.textureCoordAttribute,2,a.FLOAT,!1,0,0),this.onInitSceneTextures(),v.call(this),this.framebuffer&&a.bindFramebuffer(a.FRAMEBUFFER,this.framebuffer)}return o.prototype={toString:function(){return"WebGLCanvas Size: "+this.size},checkLastError:function(t){var e=this.gl.getError();if(e!==this.gl.NO_ERROR){var n=this.glNames[e];n=void 0!==n?n+"("+e+")":"Unknown WebGL ENUM (0x"+value.toString(16)+")",t?r.log("WebGL Error: %s, %s",t,n):r.log("WebGL Error: %s",n),r.trace()}},onInitWebGL:function(){try{this.gl=this.canvas.getContext("experimental-webgl")}catch(t){r.log("inInitWebGL error = "+t)}if(this.gl||r.error("Unable to initialize WebGL. Your browser may not support it."),!this.glNames)for(var t in this.glNames={},this.gl)"number"==typeof this.gl[t]&&(this.glNames[this.gl[t]]=t)},onInitShaders:function(){this.program=new u(this.gl),this.program.attach(new a(this.gl,t)),this.program.attach(new a(this.gl,e)),this.program.link(),this.program.use(),this.vertexPositionAttribute=this.program.getAttributeLocation("aVertexPosition"),this.gl.enableVertexAttribArray(this.vertexPositionAttribute),this.textureCoordAttribute=this.program.getAttributeLocation("aTextureCoord"),this.gl.enableVertexAttribArray(this.textureCoordAttribute)},onInitTextures:function(){var t=this.gl;t.viewport(0,0,this.canvas.width,this.canvas.height),this.texture=new s(t,this.size,t.RGBA)},onInitSceneTextures:function(){this.texture.bind(0,this.program,"texture")},drawScene:function(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)},updateVertexArray:function(t){this.zoomScene(t)},readPixels:function(t){var e=this.gl;e.readPixels(0,0,this.size.w,this.size.h,e.RGBA,e.UNSIGNED_BYTE,t)},zoomScene:function(t){h.call(this),m.call(this,[t[0],t[1],t[2]]),v.call(this),this.drawScene()},setViewport:function(t,e){var n,o;r.log("toWidth="+t+",toHeight="+e),this.gl.drawingBufferWidth<t||this.gl.drawingBufferHeight<e?(n=this.gl.drawingBufferWidth,o=this.gl.drawingBufferHeight,this.canvas.width=n,this.canvas.height=o):(n=t,o=e),this.gl.viewport(0,0,n,o)},clearCanvas:function(){this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}},o}(),b=function(){function t(t,e){v.call(this,t,e)}return t.prototype=w(v,{drawCanvas:function(t){this.texture.fill(t),this.drawScene()},onInitTextures:function(){var t=this.gl;this.setViewport(this.canvas.width,this.canvas.height),this.texture=new m(t,this.size,t.RGBA)},initCanvas:function(){this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}}),t}(),g=function(){var t=i.createFromSource("x-shader/x-vertex",S(["attribute vec3 aVertexPosition;","attribute vec2 aTextureCoord;","uniform mat4 uMVMatrix;","uniform mat4 uPMatrix;","varying highp vec2 vTextureCoord;","void main(void) {"," gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);"," vTextureCoord = aTextureCoord;","}"])),e=i.createFromSource("x-shader/x-fragment",S(["precision highp float;","varying highp vec2 vTextureCoord;","uniform sampler2D YTexture;","uniform sampler2D UTexture;","uniform sampler2D VTexture;","const mat4 YUV2RGB = mat4","("," 1.16438, 0.00000, 1.59603, -.87079,"," 1.16438, -.39176, -.81297, .52959,"," 1.16438, 2.01723, 0, -1.08139,"," 0, 0, 0, 1",");","void main(void) {"," gl_FragColor = vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB;","}"]));function n(t,e){v.call(this,t,e)}return n.prototype=w(v,{onInitShaders:function(){this.program=new u(this.gl),this.program.attach(new a(this.gl,t)),this.program.attach(new a(this.gl,e)),this.program.link(),this.program.use(),this.vertexPositionAttribute=this.program.getAttributeLocation("aVertexPosition"),this.gl.enableVertexAttribArray(this.vertexPositionAttribute),this.textureCoordAttribute=this.program.getAttributeLocation("aTextureCoord"),this.gl.enableVertexAttribArray(this.textureCoordAttribute)},onInitTextures:function(){this.setViewport(this.size.w,this.size.h),this.YTexture=new s(this.gl,this.size),this.UTexture=new s(this.gl,this.size.getHalfSize()),this.VTexture=new s(this.gl,this.size.getHalfSize())},onInitSceneTextures:function(){this.YTexture.bind(0,this.program,"YTexture"),this.UTexture.bind(1,this.program,"UTexture"),this.VTexture.bind(2,this.program,"VTexture")},fillYUVTextures:function(t,e,n){this.YTexture.fill(t),this.UTexture.fill(e),this.VTexture.fill(n),this.drawScene()},drawCanvas:function(t,e){var n=new Uint8Array(t.buffer,t.byteOffset,e.ylen*e.height),r=new Uint8Array(t.buffer,t.byteOffset+e.ylen*e.height,e.ylen*e.height/4),o=new Uint8Array(t.buffer,t.byteOffset+e.ylen*e.height*1.25,e.ylen*e.height/4);this.YTexture.fill(n),this.UTexture.fill(r),this.VTexture.fill(o),this.drawScene()},updateVertexArray:function(t){this.zoomScene(t)},toString:function(){return"YUVCanvas Size: "+this.size},initCanvas:function(){this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}}),n}();function w(t,e){for(var n=Object.create(t.prototype),r=Object.keys(e),o=0;o<r.length;o++)n[r[o]]=e[r[o]];return n}function S(t){return t.join("\n")}function O(t){this.buffer=t,this.previous=null,this.next=null}var _=function(){this.metrics={},this._clearMetrics(),this._objpool=[]};function T(t,e){function n(t,e){n.prototype.w=t,n.prototype.h=e}return n.prototype={toString:function(){return"("+n.prototype.w+", "+n.prototype.h+")"},getHalfSize:function(){return new T(n.prototype.w>>>1,n.prototype.h>>>1)},length:function(){return n.prototype.w*n.prototype.h}},new n(t,e)}_.prototype.alloc=function(){var t=null;return 0===this._objpool.length?(t=new Image,this.metrics.totalalloc++):(t=this._objpool.pop(),this.metrics.totalfree--),t},_.prototype.free=function(t){t.length>0&&(r.log("It is not zero length = "+t.length),this._objpool.push(t),this.metrics.totalfree++)},_.prototype.collect=function(t){this._objpool=[];var e=this.metrics.totalalloc-this.metrics.totalfree;this._clearMetrics(e)},_.prototype._clearMetrics=function(t){this.metrics.totalalloc=t||0,this.metrics.totalfree=0};var E=function(t,e,n,o){var i=e,a=o,u=t,s=n,c=null,f=null,l=null,h=null,p=null,y=null,d=null,m=null,w=0,S=null,E=0,A=0,R=0,k=0,P=new _,C=null,I="",x=!1,M=!1,B=0,U=!1,D={},j=function(t,e,n,r,o,i,a,u){for(var s in O.call(this,t),this.width=e,this.height=n,this.codecType=r,this.frameType=o,this.timeStamp=i,this.frameIndex=a,this.option={},u)this.option[s]=u[s]},L=null;function F(){var t=a||15;function e(){this.first=null,this.size=0}return e.prototype={enqueue:function(e,n,r,o,i,a,u,s){this.size>=t&&this.clear();var c=new j(e,n,r,o,i,a,u,s);if(null===this.first)this.first=c;else{for(var f=this.first;null!==f.next;)f=f.next;f.next=c}return this.size+=1,c},dequeue:function(){var t=null;return null!==this.first&&(t=this.first,this.first=this.first.next,this.size-=1),t},clear:function(){r.log("BufferQueue clear!");for(var t=null;null!==this.first;)t=this.first,this.first=this.first.next,this.size-=1,t.buffer=null,t=null;this.size=0,this.first=null}},new e}function V(){h="rgb2d",y=null,L=new F,p=16.7,M=!1}var z=function(t,e){var n=new T(t,e);switch(h){case"RGB2d":c=new RGB2dCanvas(s,n);break;case"YUVWebGL":c=new g(s,n);break;case"ImageWebGL":c=new b(s,n);break;case"WebGL":c=new v(s,n)}};function N(t,e){for(var n=atob(t.substring("data:image/png;base64,".length)),r=new Uint8Array(n.length),o=0,i=n.length;o<i;++o)r[o]=n.charCodeAt(o);var a=new Blob([r.buffer],{type:"image/png"});nt(a,e+".png")}var H,Y,q,W,G,X,Z,K,J,Q,tt,et,nt=(H=window,Y=H.document,q=function(){return H.URL||H.webkitURL||H},W=Y.createElementNS("http://www.w3.org/1999/xhtml","a"),G="download"in W,X=/constructor/i.test(H.HTMLElement),Z=/CriOS\/[\d]+/.test(navigator.userAgent),K=function(t){(H.setImmediate||H.setTimeout)((function(){throw t}),0)},J=function(t){setTimeout((function(){"string"==typeof t?q().revokeObjectURL(t):t.remove()}),4e4)},Q=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},et=(tt=function(t,e,n){n||(t=Q(t));var r,o=this,i="application/octet-stream"===t.type,a=function(){!function(t,e,n){for(var r=(e=[].concat(e)).length;r--;){var o=t["on"+e[r]];if("function"==typeof o)try{o.call(t,n||t)}catch(t){K(t)}}}(o,"writestart progress write writeend".split(" "))};if(o.readyState=o.INIT,G)return r=q().createObjectURL(t),void setTimeout((function(){var t,n;W.href=r,W.download=e,t=W,n=new MouseEvent("click"),t.dispatchEvent(n),a(),J(r),o.readyState=o.DONE}));!function(){if((Z||i&&X)&&H.FileReader){var e=new FileReader;return e.onloadend=function(){var t=Z?e.result:e.result.replace(/^data:[^;]*;/,"data:attachment/file;");H.open(t,"_blank")||(H.location.href=t),t=void 0,o.readyState=o.DONE,a()},e.readAsDataURL(t),void(o.readyState=o.INIT)}r||(r=q().createObjectURL(t)),i?H.location.href=r:H.open(r,"_blank")||(H.location.href=r),o.readyState=o.DONE,a(),J(r)}()}).prototype,"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return e=e||t.name||"download",n||(t=Q(t)),navigator.msSaveOrOpenBlob(t,e)}:(et.readyState=et.INIT=0,et.WRITING=1,et.DONE=2,et.error=et.onwritestart=et.onprogress=et.onwrite=et.onabort=et.onerror=et.onwriteend=null,function(t,e,n){return new tt(t,e||t.name||"download",n)})),rt=function(t){if(0==L.size&&!0===U)return i.fileOverCallback(),void V.prototype.stopRendering();if(null!==(C=L.dequeue())&&null!==C.buffer&&("mjpeg"===C.codecType||C.buffer.length>0)){if(void 0!==f&&void 0!==l&&f===C.width&&l===C.height&&y===C.codecType||(h="h264"===C.codecType||"h265"===C.codecType?"YUVWebGL":"ImageWebGL",z(C.width,C.height),"undefined"!=f&&null!=f&&0!=f||d("PlayStart"),f=C.width,l=C.height,y=C.codecType),S=C.timeStamp,i.timeStamp(S),void 0!==c)return c.drawCanvas(C.buffer,C.option),s.updatedCanvas=!0,m(S),Math.abs(S.timestamp-E)>3&&i.waitingCallback(!1),M||((D=C).src=s.toDataURL()),E=S.timestamp,x&&(x=!1,N(s.toDataURL(),I)),"mjpeg"===C.codecType?P.free(C.buffer):(delete C.buffer,C.buffer=null),C.previous=null,C.next=null,C=null,!0;r.log("drawer is undefined in StreamDrawer!")}return!1},ot=function t(e){if(!0===M){if(0===w||e-w<200)return 0===w&&(w=e),void(null!==L&&window.requestAnimationFrame(t));(k+=e-A)>R&&rt()&&(R+=p),k>1e3&&(R=0,k=0),A=e,window.requestAnimationFrame(t)}};return V.prototype={getDrawingStrategy:function(){return h},reassignCanvas:function(){var t=$('canvas[kind-channel-id="'+u+'"]')[0];s!==t&&(f=0,l=0)},drawMJPEG:function(t,e,n,r,o,i,a,u){var s=P.alloc();s.width=e,s.height=n,s.codecType=r,s.frameType=o,s.frameIndex=a,s.time=i,s.onload=function(){null!==L&&L.enqueue(this,this.width,this.height,this.codecType,this.frameType,this.time,this.frameIndex,this.option)},s.setAttribute("src","data:image/jpeg;base64,"+function(t){for(var e="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(t),o=r.byteLength,i=o%3,a=o-i,u=0,s=0;s<a;s+=3)e+=n[(16515072&(u=r[s]<<16|r[s+1]<<8|r[s+2]))>>18]+n[(258048&u)>>12]+n[(4032&u)>>6]+n[63&u];return 1===i?e+=n[(252&(u=r[a]))>>2]+n[(3&u)<<4]+"==":2===i&&(e+=n[(64512&(u=r[a]<<8|r[a+1]))>>10]+n[(1008&u)>>4]+n[(15&u)<<2]+"="),e}(t))},draw:function(t,e,n,r,o,i,a,u){null!==L&&(document.hidden&&L.size>=15?L.clear():L.enqueue(t,e,n,r,o,i,a,u))},capture:function(t){I=t,x=!0},digitalZoom:function(t){null!=c&&c.updateVertexArray(t)},setResizeCallback:function(t){t},getCodecType:function(){return y},getFrameTimestamp:function(){return S},initStartTime:function(){0===w&&window.requestAnimationFrame(ot)},startRendering:function(){0===w&&(M=!0,window.requestAnimationFrame(ot))},pause:function(){M=!1},play:function(){M=!0},stopRendering:function(){M=!1,w=0},setFPS:function(t){void 0===t||0===t?(p=16.7,20):(p=1e3/t,1*t),B=p},setFrameInterval:function(t){p=t*B},getCanvas:function(){return s},renewCanvas:function(){z(f,l),null!=c&&c.initCanvas()},setBeginDrawCallback:function(t){d=t},setupdateCanvasCallback:function(t){m=t},terminate:function(){w=0,S=null,null!==L&&(L.clear(),L=null),c&&c.clearCanvas(),c=null,U=!1},setRtspOver:function(){U=!0},playNextFrame:rt,getVideoBufferQueueSize:function(){return L.size},getCurFrameInfo:function(){return D}},new V},A=n(48),R=n.n(A),k=n(49),P=n.n(k);var C=function(t){var e=null,n="",i=null,a=null,u=null,s=null,c=null,f=1,l={timestamp:0,timestamp_usec:0,timezone:0},h={timestamp:0,timestamp_usec:0,timezone:0},p=null,y=!1,d=null,m=null,v=null,b=!1,g=!0,w=0,S=t,O=!1,_=[],T=.5,E=null,A=null,R=null,k=0,P=0,C=!1,I=null,x=o(),M=null,B=0,U=0,D=0,j=null,L=!1,F=!1,V=[],z=[],N={};function H(){}function Y(){W()}function q(){var t=0;if(null!==d)for(t=0;t<d.length;t++)R.removeEventListener(d[t].type,d[t].function);if(null!==v)for(t=0;t<v.length;t++)A.removeEventListener(v[t].type,v[t].function);if(null!==m)for(t=0;t<m.length;t++)E.removeEventListener(m[t].type,m[t].function)}function W(){if(null===A||"ended"===A.readyState)return function(t){(v=[]).push({type:"sourceopen",function:Y}),v.push({type:"error",function:tt});for(var e=0;e<v.length;e++)t.addEventListener(v[e].type,v[e].function)}(A=new MediaSource),E.src=window.URL.createObjectURL(A),void r.log("videoMediaSource::appendInitSegment new MediaSource()");if(r.log("videoMediaSource::appendInitSegment start"),0===A.sourceBuffers.length){A.duration=0;var t='video/mp4;codecs="avc1.'+n+'"';if(!MediaSource.isTypeSupported(t))return r.log("not support"+t),void(j&&j({errorCode:101}));!function(t){(d=[]).push({type:"error",function:et}),d.push({type:"updateend",function:Q}),d.push({type:"update",function:$});for(var e=0;e<d.length;e++)t.addEventListener(d[e].type,d[e].function)}(R=A.addSourceBuffer(t))}var o=e();null!==o?(R.appendBuffer(o),r.log("videoMediaSource::appendInitSegment end, codecInfo = "+n)):A.endOfStream("network")}function G(t,e){var n;if(null!==R&&("closed"!==A.readyState&&"ended"!==A.readyState))try{if(_.length>0)return r.count("1.segmentWaitDecode.length: "+_.length),_.push(t),void r.count("2.segmentWaitDecode.length: "+_.length);R.updating?(r.log("updating.........."),_.push(t)):(R.appendBuffer(t),L&&(N.frameIndex=e,N.buffer=t,N.src=((n=document.createElement("canvas")).width=E.videoWidth,n.height=E.videoHeight,n.getContext("2d").drawImage(E,0,0,n.width,n.height),n.toDataURL())))}catch(t){r.log("videoMediaSource::appendNextMediaSegment error >> initVideo"),_.length=0,S.initVideo(!1),j&&j({errorCode:101})}}function X(){E.paused&&(a(),b||L||E.play())}function Z(){E.paused||g||(r.log("pause"),E.pause())}function K(){V.length&&G(V.shift(),z.shift())}function J(){if(null!==A)try{if(R&&R.buffered.length>0&&(function(){var t=1*R.buffered.start(R.buffered.length-1),e=1*R.buffered.end(R.buffered.length-1);e-t>60&&R.remove(t,e-10)}(),F&&!L||E.duration-E.currentTime>1.5&&(E.currentTime=(E.duration-1).toFixed(3)),E&&E.duration-E.currentTime>8&&j&&j({errorCode:101}),O&&!y)){var t=1*R.buffered.start(R.buffered.length-1),e=1*R.buffered.end(R.buffered.length-1);if((0===E.currentTime?e-t:e-E.currentTime)>=T+.1){if(r.log("跳秒"),R.updating)return;var n=e-T;E.currentTime=n.toFixed(3)}}}catch(t){r.log("sourceBuffer has been removed")}}function Q(){}function $(){_.length>0&&(r.count("1. onSourceUpdate .segmentWaitDecode.length: "+_.length),R.updating||(r.count("2. onSourceUpdate .appendBuffer: "+_.length+" "+_[0].length),R.appendBuffer(_[0]),_.shift()))}function tt(){r.log("videoMediaSource::onSourceError")}function et(){r.log("videoMediaSource::onSourceBufferErrormsg")}function nt(){r.log("videoMediaSource::onError"),Z(),j&&j({errorCode:101})}function rt(){b=!0,g=!1,F=!0,r.log("playing "),C||(C=!0,s("PlayStart"))}function ot(){b=!1,g=!0,r.log("暂停播放----------------------------------------------")}function it(){var t=parseInt(A.duration,10),e=parseInt(E.currentTime,10),n={timestamp:l.timestamp-f*(t-e+(1!==f?1:0)),timestamp_usec:0,timezone:l.timezone};0===e||isNaN(t)||(y&&S.waitingCallback(!1),!y&&Math.abs(t-e)>4&&1===f||E.paused||(null===p?(p=n,u(0,"currentTime")):(p.timestamp<=n.timestamp&&f>=1||p.timestamp>n.timestamp&&f<1)&&(y&&S.timeStamp(n),p=n,++w>4&&u(n.timestamp,"currentTime"))))}function at(){X(),J()}function ut(){a()}function st(){X()}function ct(){if(r.log("需要缓冲下一帧"),O=!1,y&&b&&S.waitingCallback(!0),0==P)k=Date.now(),P++;else{P++;var t=Date.now()-k;r.log("diffTime: "+t+" Count: "+P),P>=5&&t<6e4&&T<=1.8&&(T+=.1,P=0,k=0,r.log("delay + 0.1 = "+T))}}function ft(){r.log("Can play !")}function lt(){r.log("Can play without waiting"),O=!0}function ht(){r.log("loadedmetadata")}function pt(t,e){for(var n=atob(t.substring("data:image/png;base64,".length)),r=new Uint8Array(n.length),o=0,i=n.length;o<i;++o)r[o]=n.charCodeAt(o);var a=new Blob([r.buffer],{type:"image/png"});At(a,e+".png")}H.prototype={init:function(t){c=o(),r.log("videoMediaSource::init browserType = "+c),(E=t).autoplay="safari"!==c,E.controls=!1,E.preload="auto",function(t){(m=[]).push({type:"durationchange",function:at}),m.push({type:"playing",function:rt}),m.push({type:"error",function:nt}),m.push({type:"pause",function:ot}),m.push({type:"timeupdate",function:it}),m.push({type:"resize",function:ut}),m.push({type:"seeked",function:st}),m.push({type:"waiting",function:ct}),m.push({type:"canplaythrough",function:lt}),m.push({type:"canplay",function:ft}),m.push({type:"loadedmetadata",function:ht});for(var e=0;e<m.length;e++)t.addEventListener(m[e].type,m[e].function)}(E),W()},setInitSegmentFunc:function(t){e=t},getVideoElement:function(){return E},setCodecInfo:function(t){n=t},setMediaSegment:function(t,e){V.push(t),z.push(e),L||K()},capture:function(t){I&&clearInterval(I);var e=document.createElement("canvas");e.width=E.videoWidth,e.height=E.videoHeight,O||"edge"===x?(e.getContext("2d").drawImage(E,0,0,e.width,e.height),pt(e.toDataURL(),t)):I=setInterval((function(){O&&(e.getContext("2d").drawImage(E,0,0,e.width,e.height),pt(e.toDataURL(),t),clearInterval(I))}),200)},setInitSegment:function(){W()},setTimeStamp:function(t,e){i=t},setVideoSizeCallback:function(t){a=t},setAudioStartCallback:function(t){u=t},getPlaybackTimeStamp:function(){return i},setSpeedPlay:function(t){f=t},setvideoTimeStamp:function(t){var e=Math.abs(l.timestamp-t.timestamp)>3;0===h.timestamp&&S.timeStamp(t),!0===e&&(w=0,u((h=t).timestamp,"init"),0!==l.timestamp&&y&&(E.currentTime=A.duration-.1,S.waitingCallback(!1)),p=null),l=t},pause:function(){L=!0,Z()},play:function(){L=!1},setPlaybackFlag:function(t){y=t},setTimeStampInit:function(){p=null,h={timestamp:0,timestamp_usec:0,timezone:0}},close:function(){q(),Z()},setBeginDrawCallback:function(t){s=t},setErrorCallback:function(t){j=t},terminate:function(){null!==E&&(q(),"open"===A.readyState&&(R&&A.removeSourceBuffer(R),A.endOfStream()),R=null,R=null,A=null,E=null,I&&(clearInterval(I),I=null),M&&(clearInterval(M),M=null),D=0,U=0,B=0)},getDuration:function(){return E.duration-E.currentTime},setRtspOver:function(){parseInt(E.duration)===parseInt(E.currentTime)?(S.timeStamp(l),S.fileOverCallback()):(B=parseInt(E.currentTime),U=parseInt(E.duration),M=setInterval((function(){B===parseInt(E.currentTime)&&U===parseInt(E.duration)?D++>10&&(M&&clearInterval(M),M=null,S.timeStamp(l),S.fileOverCallback()):parseInt(E.currentTime)>=parseInt(E.duration)?(M&&clearInterval(M),M=null,S.timeStamp(l),S.fileOverCallback()):(B=parseInt(E.currentTime),U=parseInt(E.duration),D=0)}),150))},getVideoBufferQueueSize:function(){return V.length},playNextFrame:function(){K()},getCurFrameInfo:function(){return N}};var yt,dt,mt,vt,bt,gt,wt,St,Ot,_t,Tt,Et,At=(yt=window,dt=yt.document,mt=function(){return yt.URL||yt.webkitURL||yt},vt=dt.createElementNS("http://www.w3.org/1999/xhtml","a"),bt="download"in vt,gt=/constructor/i.test(yt.HTMLElement),wt=/CriOS\/[\d]+/.test(navigator.userAgent),St=function(t){(yt.setImmediate||yt.setTimeout)((function(){throw t}),0)},Ot=function(t){setTimeout((function(){"string"==typeof t?mt().revokeObjectURL(t):t.remove()}),4e4)},_t=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},Et=(Tt=function(t,e,n){n||(t=_t(t));var r,o=this,i="application/octet-stream"===t.type,a=function(){!function(t,e,n){for(var r=(e=[].concat(e)).length;r--;){var o=t["on"+e[r]];if("function"==typeof o)try{o.call(t,n||t)}catch(t){St(t)}}}(o,"writestart progress write writeend".split(" "))};if(o.readyState=o.INIT,bt)return r=mt().createObjectURL(t),void setTimeout((function(){var t,n;vt.href=r,vt.download=e,t=vt,n=new MouseEvent("click"),t.dispatchEvent(n),a(),Ot(r),o.readyState=o.DONE}));!function(){if((wt||i&&gt)&&yt.FileReader){var e=new FileReader;return e.onloadend=function(){var t=wt?e.result:e.result.replace(/^data:[^;]*;/,"data:attachment/file;");yt.open(t,"_blank")||(yt.location.href=t),t=void 0,o.readyState=o.DONE,a()},e.readAsDataURL(t),void(o.readyState=o.INIT)}r||(r=mt().createObjectURL(t)),i?yt.location.href=r:yt.open(r,"_blank")||(yt.location.href=r),o.readyState=o.DONE,a(),Ot(r)}()}).prototype,"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return e=e||t.name||"download",n||(t=_t(t)),navigator.msSaveOrOpenBlob(t,e)}:(Et.readyState=Et.INIT=0,Et.WRITING=1,Et.DONE=2,Et.error=Et.onwritestart=Et.onprogress=Et.onwrite=Et.onabort=Et.onerror=Et.onwriteend=null,function(t,e,n){return new Tt(t,e||t.name||"download",n)}));return new H},I=new function(){var t=[],e={};function n(){for(var n in t)t[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)];0,e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}t={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var o=function(t){for(var e=8,n=Array.prototype.slice.call(arguments,1),r=0;r<n.length;r++)e+=n[r].byteLength;var o=new Uint8Array(e),i=0;o[i++]=e>>>24&255,o[i++]=e>>>16&255,o[i++]=e>>>8&255,o[i++]=255&e,o.set(t,i),i+=4;for(r=0;r<n.length;r++)o.set(n[r],i),i+=n[r].byteLength;return o},i=function(e){return o(t.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),(n=e.config,r=n.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(n).concat([6,1,2])),o(t.esds,i)));var n,r,i},a=function(n){return"audio"===n.type?o(t.stsd,e.STSD_PREFIX,i(n)):o(t.stsd,e.STSD_PREFIX,function(e){var n=e.sps||[],r=e.pps||[],i=[],a=[],u=0;for(u=0;u<n.length;u++)i.push((65280&n[u].byteLength)>>>8),i.push(255&n[u].byteLength),i=i.concat(Array.prototype.slice.call(n[u]));for(u=0;u<r.length;u++)a.push((65280&r[u].byteLength)>>>8),a.push(255&r[u].byteLength),a=a.concat(Array.prototype.slice.call(r[u]));return o(t.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(t.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([n.length]).concat(i).concat([r.length]).concat(a))))}(n))},u=function(n){var r=null;return r="audio"===n.type?o(t.smhd,e.SMHD):o(t.vmhd,e.VMHD),o(t.minf,r,o(t.dinf,o(t.dref,e.DREF)),function(n){return o(t.stbl,a(n),o(t.stts,e.STTS),o(t.stsc,e.STSC),o(t.stsz,e.STSZ),o(t.stco,e.STCO))}(n))},s=function(n){return o(t.mdia,function(e){var n=e.timescale,r=e.duration;return o(t.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}(n),function(n){var r=null;return r="audio"===n.type?e.HDLR_AUDIO:e.HDLR_VIDEO,o(t.hdlr,r)}(n),u(n))},c=function(e){return o(t.trak,function(e){var n=e.id,r=e.duration,i=e.width,a=e.height;return o(t.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,a>>>8&255,255&a,0,0]))}(e),s(e))},f=function(e){return o(t.mvex,function(e){var n=e.id,r=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o(t.trex,r)}(e))},l=function(e){var n,i,a=(n=e.timescale,i=e.duration,r.log("mvhd: timescale: "+n+" duration: "+i),o(t.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))),u=c(e),s=f(e);return o(t.moov,a,u,s)},h=function(e,n){return"audio"===e.type?audioTrun(e,n):function(e,n){var r,i=null,a=null,u=0,s=n;if(null===(r=e.samples||[])[0].frameDuration)for(s+=24+4*r.length,i=trunHeader(r,s),u=0;u<r.length;u++)a=r[u],i=i.concat([(4278190080&a.size)>>>24,(16711680&a.size)>>>16,(65280&a.size)>>>8,255&a.size]);else for(i=function(t,e){return[0,0,3,5,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&e)>>>24,(16711680&e)>>>16,(65280&e)>>>8,255&e,0,0,0,0]}(r,s+=24+4*r.length+4*r.length),u=0;u<r.length;u++)a=r[u],i=i.concat([(4278190080&a.frameDuration)>>>24,(16711680&a.frameDuration)>>>16,(65280&a.frameDuration)>>>8,255&a.frameDuration,(4278190080&a.size)>>>24,(16711680&a.size)>>>16,(65280&a.size)>>>8,255&a.size]);return o(t.trun,new Uint8Array(i))}(e,n)},p=function(e,n){return o(t.moof,function(e){var n=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return o(t.mfhd,n)}(e),function(e){var n,r,i;return n=o(t.tfhd,new Uint8Array([0,2,0,0,0,0,0,1])),r=o(t.tfdt,new Uint8Array([0,0,0,0,e.baseMediaDecodeTime>>>24&255,e.baseMediaDecodeTime>>>16&255,e.baseMediaDecodeTime>>>8&255,255&e.baseMediaDecodeTime])),72,i=h(e,72),o(t.traf,n,r,i)}(n))};return n.prototype={initSegment:function(n){var i=o(t.ftyp,e.FTYP);r.log(n);var a=l(n),u=new Uint8Array(i.byteLength+a.byteLength);return u.set(i,0),u.set(a,i.byteLength),u},mediaSegment:function(e,n,r,i){var a=p(e,n),u=function(e){return o(t.mdat,e)}(r),s=null;return(s=new Uint8Array(a.byteLength+u.byteLength)).set(a),s.set(u,a.byteLength),s}},new n};function x(t){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var M=function(){var t={},e=null,n=a(),o=a();function i(t,e){this.data=t,this.timeStamp=e,this.next=null}function a(){function t(){this.first=null,this.size=0}return t.prototype={enqueue:function(t){if(null===this.first)this.first=t;else{for(var e=this.first;null!==e.next;)e=e.next;e.next=t}this.size+=1},dequeue:function(){var t=null;return null!==this.first&&(t=this.first,this.first=this.first.next,this.size-=1),t},clear:function(){this.size=0,this.first=null}},new t}function u(t,n){var r=n.first;if(r)if(t>r.timeStamp){for(;r&&t>r.timeStamp;)(r=n.dequeue())&&r.data&&2===r.data.type&&e&&e(r.data);r&&e&&e(r.data)}else t<r.timeStamp?r.data&&2!==r.data.type&&e&&e(r.data):(e&&e(r.data),n.dequeue())}function s(){}return s.prototype={draw:function(a,s,c,f){r.log("type:"+a.type+" jsondata:"+JSON.stringify(a.params));var l=a.params;if(l){var h={type:0,data:null,channel:f};if(l.hasOwnProperty("VideoAnalyseRule")&&(h.type=0,h.data=l.VideoAnalyseRule,e&&e(h)),l.hasOwnProperty("FocusStatus")&&(h.type=3,h.data=l.FocusStatus,e&&e(h)),l.hasOwnProperty("Event")&&(h.type=2,h.data=l.Event,o.enqueue(new i(JSON.parse(JSON.stringify(h)),c))),u(s,o),5===a.type)for(var p=l.object,y=l.coordinate,d=0;d<p.length;d++)!function(e){var n=p[e].classID+p[e].objectId;switch(p[e].operateType){case 1:t[n]={},t[n].show=!0,p[e].hasOwnProperty("track")&&(t[n].pos=p[e].track[0]),t[n].type=p[e].objectType,t[n].coordinate=y,t[n].timeout=setTimeout((function(){t[n].show=!1}),500);break;case 2:t.hasOwnProperty(n)||(t[n]={},t[n].coordinate=y),p[e].hasOwnProperty("track")&&(t[n].pos=p[e].track[0],t[n].show=!0),t[n].type=p[e].objectType,t[n].timeout&&clearTimeout(t[n].timeout),t[n].timeout=setTimeout((function(){t[n].show=!1}),500);break;case 3:t.hasOwnProperty(n)&&(t[n].timeout&&clearTimeout(t[n].timeout),delete t[n]);break;case 4:t.hasOwnProperty(n)&&(t[n].show=!1)}}(d);else if(14===a.type)for(var m=0;m<l.length;m++)for(y=l[m].coordinate,p=l[m].object&&l[m].object.commonObject||[],d=0;d<p.length;d++)!function(e){var n=l[m].classID+p[e].objectId;for(var r in p[e])if("object"===x(p[e][r]))switch(p[e].operateType){case 1:t[n]={},t[n].show=!0,t[n].pos=p[e][r][0].track[0],t[n].type=p[e].type,t[n].coordinate=y,t[n].timeout=setTimeout((function(){delete t[n]}),500);break;case 2:t.hasOwnProperty(n)||(t[n]={},t[n].coordinate=y),t[n].pos=p[e][r][0].track[0],t[n].show=!0,t[n].type=p[e].type,t[n].timeout&&clearTimeout(t[n].timeout),t[n].timeout=setTimeout((function(){delete t[n]}),500)}}(d);else if(20===a.type)for(d=0;d<l.length;d++){var v=l[d],b={show:!0,type:20},g=String("0x14_")+v.objectId;switch(t={},v.objectStatus){case 0:t[g]=b,t[g].data=v.params.object,t[g].timeout=setTimeout((function(){}),500);break;case 1:t.hasOwnProperty(g)&&(t[g].show=!1);break;case 2:t.hasOwnProperty(g)||(t[g]=b),t[g].data=v.params.object,t[g].timeout&&clearTimeout(t[g].timeout),t[g].timeout=setTimeout((function(){}),500);break;case 3:t.hasOwnProperty(g)&&(t[g].timeout,delete t[g])}}h.type=1,h.data=t,n.enqueue(new i(JSON.parse(JSON.stringify(h)),c)),u(s,n)}},setCallback:function(t){e||(e=t)}},new s};function B(){var t=null,e=null,n=null,o=null,i=0,a=new Uint8Array,u=0,s=0,c=null,f=!1,l=null,h=0,p=null;function y(t,e){var n=new Uint8Array(t.byteLength+e.byteLength);return n.set(new Uint8Array(t),0),n.set(new Uint8Array(e),t.byteLength),n}function d(t){switch(r.error(t),t.target.error.code){case t.target.error.MEDIA_ERR_ABORTED:r.error("audio tag error : You aborted the media playback.");break;case t.target.error.MEDIA_ERR_NETWORK:r.error("audio tag error : A network error caused the media download to fail.");break;case t.target.error.MEDIA_ERR_DECODE:r.error("audio tag error : The media playback was aborted due to a corruption problem or because the media used features your browser did not support.");break;case t.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:r.error("audio tag error : The media could not be loaded, either because the server or network failed or because the format is not supported.");break;default:r.error("audio tag error : An unknown media error occurred.")}}function m(){if(r.info("sourceopened"),null===o)try{(o=e.addSourceBuffer(t)).addEventListener("updateend",v)}catch(t){return void r.error("Exception calling addSourceBuffer : "+t)}}function v(){n.paused&&n.play()}function b(){r.info("sourceclose")}function g(){r.info("sourceended")}function w(){r.info("error")}function S(){r.info("abort")}function O(){}return O.prototype={audioInit:function(o){t=/Apple Computer/.test(navigator.vendor)&&/Safari/.test(navigator.userAgent)?"audio/x-aac":"audio/aac",n=document.createElement("audio"),document.body.appendChild(n),n.addEventListener("error",d),n.addEventListener("timeupdate",p.timeUpdate),n.addEventListener("ended",p.audioPlayEnd);var i=function(){var n=!1;return window.MediaSource?window.MediaSource.isTypeSupported(t)?((e=new MediaSource).addEventListener("sourceopen",m),e.addEventListener("sourceclose",b),e.addEventListener("sourceended",g),e.addEventListener("error",w),e.addEventListener("abort",S),n=!0):r.error("Unsupported MIME type or codec: ",t):r.error("MediaSource API is not supported!"),n}();return i&&null!==n&&(n.src=window.URL.createObjectURL(e),this.controlVolumn(o),n.play(),this.audioPlayBegin()),i},play:function(){this.controlVolumn(i),n.play()},stop:function(){n.volume=0,i=0,n.pause()},bufferAudio:function(t,e,r,i){if(i){if(a=y(a,t),null!==o&&!o.updating)try{o.appendBuffer(a),a=new Uint8Array}catch(t){}}else{var s=e-u;if((s>200||s<0)&&(a=new Uint8Array,l=new Array,f=!0),f&&(l.push(h),h+=t.length),u=e,a=y(a,t),null!==o&&!f&&!o.updating)try{null!==l?null!==c&&(parseInt(l.length/16)-parseInt(c)>=2&&(c+=1),(h=parseInt(16*c,10))<l.length?(o.appendBuffer(a.subarray(l[h],a.length)),o.buffered.length>0&&(n.currentTime=o.buffered.end(0))):o.buffered.length>0&&(n.currentTime=o.buffered.end(0)-.3)):o.appendBuffer(a),a=new Uint8Array,l=null,h=0}catch(t){}}},controlVolumn:function(t){i=t,null!==n&&(n.volume=t<=0?0:t>=1?1:t,i=t)},getVolume:function(){return i},terminate:function(){e.removeEventListener("sourceopen",m),e.removeEventListener("sourceclose",b),e.removeEventListener("sourceended",g),e.removeEventListener("error",w),e.removeEventListener("abort",S),o.removeEventListener("updateend",v),n.removeEventListener("error",d),"open"===e.readyState&&(e.removeSourceBuffer(o),e.endOfStream()),o=null,e=null,n.parentElement.removeChild(n),n=null},setBufferingFlag:function(t,e){"init"===e?s=t:f&&(0===t||null==t?c=null:(c=t-s,s=0),f=!1)},getBufferingFlag:function(){return f},setInitVideoTimeStamp:function(t){s=t},getInitVideoTimeStamp:function(){return s},setSamplingRate:function(t){},pause:function(){n.pause()},timeUpdate:function(){},setRtspOver:function(){!0,setTimeout((function(){e&&e.endOfStream()}),1e3)},audioPlayBegin:function(){},audioPlayEnd:function(){}},p=new O}function U(){var t=null,e=null,n=null,o=0,i={type:"G.711",samplingRate:8e3,bitrate:"8000"},a=0,u=!1,s=0,c=0,f=null,l=!1,h=new Float32Array(8e4),p=0,y=null,d=!1,m=[],v=!1,b=null,g=0,w=0;function S(e,r){var o=r-s;if((o>200||o<0)&&(a=0,p=0,l=!0,null!==y&&y.stop()),a-t.currentTime<0&&(a=0),s=r,h=function(t,e,n){var r=t;n+e.length>=r.length&&(r=new Float32Array(r.length+8e4)).set(r,0);return r.set(e,n),r}(h,e,p),p+=e.length,!l){var u=0;if(p/e.length>1&&(null!==f&&(u=8e3*f),u>=p||null===f))return void(p=0);var c=null;(c=t.createBuffer(1,p-u,i.samplingRate)).getChannelData(0).set(h.subarray(u,p)),p=0,(y=t.createBufferSource()).buffer=c,y.connect(n),a||(a=t.currentTime+.1),y.start(a),a+=c.duration}}function O(e){l||(d||5===m.length&&(d=!0,_(m.shift()),b.audioPlayBegin()),m.push(function(e,n){var r=t.createBuffer(1,e.length,n.samplingRate);return w=e.length/n.samplingRate,r.getChannelData(0).set(e),(y=t.createBufferSource()).buffer=r,y}(e,i)))}function _(t){t&&(t.connect(n),t.start(),t.onended=function(){t.disconnect(),g+=w,b.timeUpdate(g),v||(m.length?_(m.shift()):b.audioPlayEnd())})}function T(){}return T.prototype={audioInit:function(o){if(a=0,null!==t)r.info("Audio context already defined!");else try{return window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext,(t=new AudioContext).onstatechange=function(){r.info("Audio Context State changed :: "+t.state),"running"===t.state&&(u=!0)},e=t.createGain(),(n=t.createBiquadFilter()).connect(e),n.type="lowpass",n.frequency.value=4e3,n.gain.value=40,e.connect(t.destination),this.controlVolumn(o),!0}catch(t){return r.error("Web Audio API is not supported in this web browser! : "+t),!1}},play:function(){this.controlVolumn(o),v=!1,_(m.shift())},stop:function(){o=0,e.gain.value=0,a=0},bufferAudio:function(t,e,n,r){u&&(r?O(t):S(t,e))},controlVolumn:function(t){o=t;var n=t/1;n<=0?(e.gain.value=0,a=0):e.gain.value=n>=1?1:n},getVolume:function(){return o},terminate:function(){"closed"!==t.state&&(a=0,u=!1,t.close())},setBufferingFlag:function(t,e){"init"===e?c=t:l&&(0===t||null==t?f=null:(f=t-c,c=0),l=!1)},getBufferingFlag:function(){return l},setInitVideoTimeStamp:function(t){c=t},getInitVideoTimeStamp:function(){return c},setSamplingRate:function(t){i.samplingRate=t},pause:function(){v=!0},timeUpdate:function(){},setRtspOver:function(){!0},audioPlayBegin:function(){},audioPlayEnd:function(){}},b=new T}var D=function(){var t=null,e=null,n=null,i=null,a=null,u=null,s=null,c=null,f=null,l=null,h=null,p=null,y=null,d=null,m=null,v=null,b=null,g=null,w=null,S=null,O=null,_=o(),T=null,A=0,k=null,x=!1,D="",j=!0,L=null,F=null,V=!1,z=null,N=null,H=null,Y={id:1,samples:null,baseMediaDecodeTime:0},q=0,W=0,G=null,X=1,Z="",K=null,J=null,Q=1,$=4,tt=!1,et=0,nt=0,rt=0,ot=null,it=0,at=0,ut=0,st=null,ct=!1,ft=null,lt=0,ht={type:"live",codec:"",width:0,height:0,isLimitSpeed:null},pt=!1,yt=null,dt=null,mt=null,vt={5:"MJPEG",8:"H264",12:"H265"},bt={1:4e3,2:8e3,3:11025,4:16e3,5:2e4,6:22050,7:32e3,8:44100,9:48e3,10:96e3,11:128e3,12:192e3,13:64e3};function gt(){!0,i=this}function wt(){return N}function St(){null!==y&&y(!1)}gt.prototype={init:function(n,r,o,u,s){lt=o,L=n,K=r,i.channel=o,ct=s;window.navigator.userAgent;ct||((t=new R.a).onmessage=Ot,a=new E(lt,this,L,!0===u?500:15),O=M(),document.getElementById("count-fps"),document.getElementById("span-fps"));(e=new P.a).onmessage=_t},sendSdpInfo:function(o,i,a){var u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,c={type:"sdpInfo",data:{sdpInfo:o,aacCodecInfo:i,decodeMode:D,govLength:k,checkDelay:j,mp4Codec:u}};if(x=a,t&&t.postMessage(c),e.postMessage(c),x)try{window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext,(n=new Worker("./media/ump/Workers/audioTalkWorker.js")).onmessage=Tt,null===s&&((s=new Talk).init(),s.setSendAudioTalkBufferCallback(Et));var f=s.initAudioOut();n.postMessage(c),c={type:"sampleRate",data:f},n.postMessage(c)}catch(t){return x=!1,void r.error("Web Audio API is not supported in this web browser! : "+t)}ot=null,tt=!1,o},parseRTPData:function(n,o){var a=o[4],u={type:"MediaData",data:{rtspInterleave:n,payload:o},info:null,channel:i.channel},s={};if(253==a||254==a||252==a||251==a){if(function(){var t=o[22]+24;s.frameIndex=(o[11]<<24)+(o[10]<<16)+(o[9]<<8)+o[8];for(var e=24;e<t;)if(128==o[e]){if(e+4>t)return r.log("i: "+e),-1;s.width=o[e+2]<<3,s.height=o[e+3]<<3,e+=4}else if(129==o[e]){if(e+4>o.length)return r.log("i: "+e),-1;s.I_frame_interval=o[e+1],s.encode_type=o[e+2],s.frame_rate=o[e+3],e+=4}else if(130==o[e])s.width=(o[e+5]<<8)+o[e+4],s.height=(o[e+7]<<8)+o[e+6],e+=8;else if(131==o[e])e+=4;else if(136==o[e])e+=8;else if(132==o[e]){if(e+4>t)return r.log("i: "+e),-1;var n=(o[e+2]<<8)+o[e+3];e+=n}else if(148==o[e])s.h264_svc_flag=!0,s.svc=o[e+2],e+=4;else if(138==o[e])e+=8;else if(145==o[e])e+=8;else if(153==o[e]){var i=o[e+1],a=o[e+2];e+=8,e+=i*a*16}else if(154==o[e])e+=8;else if(155==o[e])e+=8;else if(146==o[e])e+=8;else if(147==o[e])e+=8;else if(149==o[e])e+=8;else if(160<=o[e]&&o[e]<176)s.timeStampmsw=(o[e+3]<<8)+o[e+2],e+=4;else if(176<=o[e]&&o[e]<255)e+=o[e+1];else if(133==o[e])e+=4;else if(137==o[e])e+=4;else if(139==o[e])e+=4;else if(144==o[e])e+=8;else if(151==o[e]){i=o[e+1];e+=8,e+=16*i}else if(152==o[e])e+=4;else{if(156!=o[e])return r.log("parseVideoInfo error ext_type:0x"+o[e]),r.log("i: "+e),-1;t=(o[e+5]<<8)+o[e+4];e+=8,e+=t}}(),null!=yt){if(yt!=s.encode_type&&void 0!==s.encode_type)return yt=s.encode_type,void b(vt[s.encode_type])}else yt=s.encode_type;t&&(u.info=s,t.postMessage(u))}else if(240==a){if(function(){s.ChannelCount=0;for(var t=o[22]+24,e=24;e<t;)if(128==o[e])e+=4;else if(129==o[e])e+=4;else if(130==o[e])e+=8;else if(131==o[e])e+=4;else if(140==o[e])e+=o[e+1];else if(136==o[e])e+=8;else if(132==o[e]){var n=o[e+2]<<8+o[e+3];e+=n}else if(150==o[e])s.ChannelCount=o[e+1],s.channel=o[e+2],e+=4;else if(149==o[e])e+=8;else{if(160!=o[e])return r.log("parseAudioInfo error ext_type:0x"+o[e]),r.log("i: "+e),-1;s.timeStampmsw=(o[e+3]<<8)+o[e+2],e+=4}0==s.ChannelCount&&(s.ChannelCount=1,s.channel=0);for(t=o[22]+24,e=24;e<t;)if(128==o[e])e+=4;else if(129==o[e])e+=4;else if(130==o[e])e+=8;else if(131==o[e])s.audio_type=o[e+2],s.samplingRate=bt[o[e+3]],e+=4;else if(140==o[e])e+=o[e+1];else if(136==o[e])e+=8;else if(132==o[e]){n=o[e+2]<<8+o[e+3];e+=n}else if(150==o[e])e+=4;else if(149==o[e])e+=8;else if(160==o[e])e+=4;else{if(152!=o[e])return r.log("parseAudioInfo error ext_type:0x"+o[e]),r.log("i: "+e),-1;e+=4}}(),null!=mt){if(mt!=s.audio_type)return mt=s.audio_type,void w("audioType")}else mt=s.audio_type;if(null!=dt){if(dt!=s.samplingRate)return dt=s.samplingRate,void w("samplingRate")}else dt=s.samplingRate;switch(s.audio_type+""){case"10":case"14":case"26":case"27":case"28":case"29":case"30":e&&(u.info=s,e.postMessage(u))}}else 241==a?t&&(u.info=s,t.postMessage(u)):r.log("mediaType: "+a)},setCallback:function(t,e){switch(t){case"timeStamp":e;break;case"ResolutionChanged":c=e,null!==a&&a.setResizeCallback(c);break;case"audioTalk":l=e;break;case"stepRequest":h=e;break;case"metaEvent":e;break;case"videoMode":p=e;break;case"loadingBar":y=e;break;case"Error":d=e;break;case"PlayStart":f=e,null!==a&&a.setBeginDrawCallback(f);break;case"DecodeStart":m=e;break;case"UpdateCanvas":v=e,null!==a&&a.setupdateCanvasCallback(v);break;case"FrameTypeChange":b=e;break;case"MSEResolutionChanged":g=e;break;case"audioChange":w=e;break;case"WorkerReady":st=e;break;case"IvsDraw":S=e;break;case"FileOver":this.fileOverCallback=e;break;case"Waiting":this.waitingCallback=e;break;case"UpdateTime":ft=e;break;default:r.log(t),r.log("workerManager::setCallback() : type is unknown")}},capture:function(t){"canvas"===D?a.capture(t):"video"===D&&z.capture(t)},setDeviceInfo:function(t){F=t.mode},setFPS:function(t){A=0===t?30:t,At(1!==Q)},setGovLength:function(t){k=t},setLiveMode:function(t){null!==p&&p(t),"video"===(D=null===t?"canvas":t)?null!==a&&a.renewCanvas():"canvas"===D&&At(!1)},setPlayMode:function(t){V=t},controlAudio:function(t,e){switch(r.log(t+" "+e),t){case"audioPlay":"start"===e?null!==u&&u.play():"stop"===e?(it=0,null!==u&&u.stop()):null!==u&&u.pause();break;case"volumn":it=e,null!==u&&u.controlVolumn(e);break;case"audioSamplingRate":null!==u&&u.setSamplingRate(e)}},controlAudioTalk:function(t,e){if(null!==s)switch(t){case"onOff":"on"===e||s.stopAudioOut();break;case"volumn":s.controlVolumnOut(e)}},reassignCanvas:function(){null!==a&&a.reassignCanvas()},digitalZoom:function(t){null!==a&&a.digitalZoom(t)},playbackSpeed:function(t){Q=t,a.setFrameInterval(Q)},timeStamp:function(t){v&&v(t)},initVideo:function(t){At(t)},setFpsFrame:function(t){t,0,ut=0},setCheckDelay:function(t){j=t},initStartTime:function(){ct||(t.postMessage({type:"initStartTime"}),a.stopRendering(),a.startRendering())},terminate:function(){"backup"!==F&&(t&&(t.terminate(),t=null),e&&(e.terminate(),e=null)),n&&n.terminate(),s&&(s.terminate(),s=null),a&&a.terminate(),u&&u.terminate(),z&&z.terminate(),st&&(st=null),a=null,!0},postRtspOver:function(){t&&t.postMessage({type:"end"}),u&&u.setRtspOver()},pause:function(){z&&z.pause(),t&&a.pause()},play:function(){z&&z.play(),t&&a.play()},playNextFrame:function(){z?z.playNextFrame():t&&a.playNextFrame()},getVideoBufferQueueSize:function(){return z?z.getVideoBufferQueueSize():t?a.getVideoBufferQueueSize():void 0},getCurFrameInfo:function(){return a.getCurFrameInfo()},sendBufferToAudioWorker:function(t){_t(t={type:"message",data:{codec:"AAC",data:t,type:"render"}})}};function Ot(e){var n,o,i=e.data;switch(i.type){case"WorkerReady":st&&st();break;case"canvasRender":kt(0,"currentTime"),n=i.data,o=i.option,null!==n&&null!==a&&("mjpeg"===T.codecType?a.drawMJPEG(n,T.width,T.height,T.codecType,T.frameType,T.timeStamp,T.frameIndex,o):a.draw(n,T.width,T.height,T.codecType,T.frameType,T.timeStamp,T.frameIndex,o));break;case"initSegment":N=i.data,Rt();break;case"mediaSample":null===Y.samples&&(Y.samples=new Array($)),null===i.data.frame_time_stamp&&(i.data.frameDuration=Math.round(1e3/A)),1!==Q&&(i.data.frameDuration=1e3/Math.abs(Q)),Y.samples[q++]=i.data,nt+=i.data.frameDuration,rt+=i.data.frameDuration,$;break;case"videoRender":var u=new Uint8Array(i.data.length+W);if(0!==W&&u.set(G),u.set(i.data,W),W=(G=u).length,q%$==0&&0!==q){if(null!==Y.samples[0].frameDuration?(Y.baseMediaDecodeTime=1===X?0:et,et=nt):Y.baseMediaDecodeTime=Math.round(1e3/A)*$*(X-1),"chrome"==_&&1===Q)for(var s=Y.samples.length,c=rt/$,f=0;f<s;f++)Y.samples[f].frameDuration=c;rt=0,H=I.mediaSegment(X,Y,G,Y.baseMediaDecodeTime),X++,q=0,G=null,W=0,null!==z?z.setMediaSegment(H,T.frameIndex):!1===tt&&(r.log("workerManager::videoMS error!! recreate videoMS"),Rt()),null!==a&&a.stopRendering()}break;case"mediasegmentData":z.setMediaSegment(i.data),!1===tt&&(r.log("videoMS error!! recreate videoMS"),Rt());break;case"videoInfo":T=i.data,0===ut&&(ut=performance.now(),"canvas"===D&&v(T.timeStamp));break;case"time":break;case"videoTimeStamp":J=i.data,null!==z&&null!==J&&z.setvideoTimeStamp(J);break;case"firstFrame":a&&(a.startRendering(),void 0!==a.setFPS&&a.setFPS(A));break;case"drop":break;case"codecInfo":Z=i.data,null!==z&&z.setCodecInfo(Z);break;case"stepPlay":switch(i.data){case"needBuffering":!0,h("request",null);break;case"BufferFull":if(!1,h("complete"),pt){t.postMessage({type:"stepPlay",data:"findIFrame"}),a.startRendering(),pt=!1}}break;case"setVideoTagMode":gt.prototype.setLiveMode(i.data);break;case"playbackFlag":!0===i.data?ht.type="playback":ht.type="live",null!==z&&z.setPlaybackFlag(i.data);break;case"error":null!==d&&d(i.data);break;case"MSEResolutionChanged":g(i.data);break;case"DecodeStart":var l=i.data.width-0,p=i.data.height-0;L.setAttribute("width",l),L.setAttribute("height",p),gt.prototype.setLiveMode(i.data.decodeMode),m(i.data);break;case"ivsDraw":var y=i.data.ivsDraw,b=i.data.channel;if("canvas"===D&&null==T)break;if("canvas"!==D&&null==J)break;var w="canvas"===D?T.timeStamp:J;w=1e3*w.timestamp+w.timestamp_usec;var E="canvas"===D?w:w-parseInt(1e3*z.getDuration());null!==S&&(O.setCallback(S),O.draw(y,E,w,b));break;case"end":z&&z.setRtspOver(),a&&a.setRtspOver();break;default:r.log("workerManager::videoWorker unknown data = "+i.data)}}function _t(t){var e=t.data;switch(e.type){case"WorkerReady":ct&&st&&st();break;case"render":0,ot!==e.codec&&(null!==u&&(it=u.getVolume(),at=u.getInitVideoTimeStamp(),u.terminate()),"AAC"===e.codec?"edge"===_||"firefox"===_?(u=null,null!==d&&d({errorCode:201})):(u=new B,ct&&(u.timeUpdate=function(t){ft&&ft(Math.round(t.target.currentTime))},u.audioPlayBegin=function(){f()},u.audioPlayEnd=function(){i.fileOverCallback()})):"safari"===_?(u=null,null!==d&&d({errorCode:201})):(u=new U,ct&&(u.timeUpdate=function(t){ft&&ft(Math.round(t))},u.audioPlayBegin=function(){f()},u.audioPlayEnd=function(){i.fileOverCallback()}),u.setSamplingRate(e.samplingRate)),null!==u&&(u.setInitVideoTimeStamp(at),u.audioInit(it)||(u=null)),ot=e.codec),null!==u&&(null==T?u.bufferAudio(e.data,e.rtpTimeStamp,null,ct):u.bufferAudio(e.data,e.rtpTimeStamp,T.codecType,ct))}}function Tt(t){var e=t.data;switch(e.type){case"rtpData":l(e.data)}}function Et(t){var e={type:"getRtpData",data:t};n.postMessage(e)}function At(t){null!==z&&(z.close(),z=null),$=!1===t?4:Math.abs(Q),Y.samples=new Array($),tt=!1,X=1,H=null,q=0,G=null,W=0}function Rt(){tt=!0,null===z?((z=C(i)).setCodecInfo(Z),z.setInitSegmentFunc(wt),z.setVideoSizeCallback(St),z.setBeginDrawCallback(f),z.init(K),z.setErrorCallback(d),z.setSpeedPlay(Q),z.setPlaybackFlag(V)):(z.getVideoElement(),z.setInitSegment()),z.setAudioStartCallback(kt)}function kt(t,e){null!==u&&u.setBufferingFlag(t,e)}return new gt};function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}if(void 0===F)var F={};F.MD5=function(t){function e(t){var e=(t>>>0).toString(16);return"00000000".substr(0,8-e.length)+e}function n(t,e,n){return t&e|~t&n}function r(t,e,n){return n&t|~n&e}function o(t,e,n){return t^e^n}function i(t,e,n){return e^(t|~n)}function a(t,e){return t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}function u(t){for(var e=[],n=0;n<t.length;n++)if(t.charCodeAt(n)<=127)e.push(t.charCodeAt(n));else for(var r=encodeURIComponent(t.charAt(n)).substr(1).split("%"),o=0;o<r.length;o++)e.push(parseInt(r[o],16));return e}function s(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return e}var c=null,f=null;function l(t,e){return 4294967295&t+e}return"string"==typeof t?c=u(t):t.constructor==Array?0===t.length?c=t:"string"==typeof t[0]?c=function(t){for(var e=[],n=0;n<t.length;n++)e=e.concat(u(t[n]));return e}(t):"number"==typeof t[0]?c=t:f=L(t[0]):"undefined"!=typeof ArrayBuffer?t instanceof ArrayBuffer?c=s(new Uint8Array(t)):t instanceof Uint8Array||t instanceof Int8Array?c=s(t):t instanceof Uint32Array||t instanceof Int32Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Float32Array||t instanceof Float64Array?c=s(new Uint8Array(t.buffer)):f=L(t):f=L(t),f&&alert("MD5 type mismatch, cannot process "+f),function(){function t(t,e,n,r){var o,i,a=g;g=b,b=v,v=l(v,(o=l(m,l(t,l(e,n))))<<(i=r)&4294967295|o>>>32-i),m=a}var u=c.length;c.push(128);var s=c.length%64;if(s>56){for(var f=0;f<64-s;f++)c.push(0);s=c.length%64}for(f=0;f<56-s;f++)c.push(0);c=c.concat(function(t){for(var e=[],n=0;n<8;n++)e.push(255&t),t>>>=8;return e}(8*u));var h=1732584193,p=4023233417,y=2562383102,d=271733878,m=0,v=0,b=0,g=0;for(f=0;f<c.length/64;f++){m=h;var w=64*f;t(n(v=p,b=y,g=d),3614090360,a(c,w),7),t(n(v,b,g),3905402710,a(c,w+4),12),t(n(v,b,g),606105819,a(c,w+8),17),t(n(v,b,g),3250441966,a(c,w+12),22),t(n(v,b,g),4118548399,a(c,w+16),7),t(n(v,b,g),1200080426,a(c,w+20),12),t(n(v,b,g),2821735955,a(c,w+24),17),t(n(v,b,g),4249261313,a(c,w+28),22),t(n(v,b,g),1770035416,a(c,w+32),7),t(n(v,b,g),2336552879,a(c,w+36),12),t(n(v,b,g),4294925233,a(c,w+40),17),t(n(v,b,g),2304563134,a(c,w+44),22),t(n(v,b,g),1804603682,a(c,w+48),7),t(n(v,b,g),4254626195,a(c,w+52),12),t(n(v,b,g),2792965006,a(c,w+56),17),t(n(v,b,g),1236535329,a(c,w+60),22),t(r(v,b,g),4129170786,a(c,w+4),5),t(r(v,b,g),3225465664,a(c,w+24),9),t(r(v,b,g),643717713,a(c,w+44),14),t(r(v,b,g),3921069994,a(c,w),20),t(r(v,b,g),3593408605,a(c,w+20),5),t(r(v,b,g),38016083,a(c,w+40),9),t(r(v,b,g),3634488961,a(c,w+60),14),t(r(v,b,g),3889429448,a(c,w+16),20),t(r(v,b,g),568446438,a(c,w+36),5),t(r(v,b,g),3275163606,a(c,w+56),9),t(r(v,b,g),4107603335,a(c,w+12),14),t(r(v,b,g),1163531501,a(c,w+32),20),t(r(v,b,g),2850285829,a(c,w+52),5),t(r(v,b,g),4243563512,a(c,w+8),9),t(r(v,b,g),1735328473,a(c,w+28),14),t(r(v,b,g),2368359562,a(c,w+48),20),t(o(v,b,g),4294588738,a(c,w+20),4),t(o(v,b,g),2272392833,a(c,w+32),11),t(o(v,b,g),1839030562,a(c,w+44),16),t(o(v,b,g),4259657740,a(c,w+56),23),t(o(v,b,g),2763975236,a(c,w+4),4),t(o(v,b,g),1272893353,a(c,w+16),11),t(o(v,b,g),4139469664,a(c,w+28),16),t(o(v,b,g),3200236656,a(c,w+40),23),t(o(v,b,g),681279174,a(c,w+52),4),t(o(v,b,g),3936430074,a(c,w),11),t(o(v,b,g),3572445317,a(c,w+12),16),t(o(v,b,g),76029189,a(c,w+24),23),t(o(v,b,g),3654602809,a(c,w+36),4),t(o(v,b,g),3873151461,a(c,w+48),11),t(o(v,b,g),530742520,a(c,w+60),16),t(o(v,b,g),3299628645,a(c,w+8),23),t(i(v,b,g),4096336452,a(c,w),6),t(i(v,b,g),1126891415,a(c,w+28),10),t(i(v,b,g),2878612391,a(c,w+56),15),t(i(v,b,g),4237533241,a(c,w+20),21),t(i(v,b,g),1700485571,a(c,w+48),6),t(i(v,b,g),2399980690,a(c,w+12),10),t(i(v,b,g),4293915773,a(c,w+40),15),t(i(v,b,g),2240044497,a(c,w+4),21),t(i(v,b,g),1873313359,a(c,w+32),6),t(i(v,b,g),4264355552,a(c,w+60),10),t(i(v,b,g),2734768916,a(c,w+24),15),t(i(v,b,g),1309151649,a(c,w+52),21),t(i(v,b,g),4149444226,a(c,w+16),6),t(i(v,b,g),3174756917,a(c,w+44),10),t(i(v,b,g),718787259,a(c,w+8),15),t(i(v,b,g),3951481745,a(c,w+36),21),h=l(h,m),p=l(p,v),y=l(y,b),d=l(d,g)}return function(t,n,r,o){for(var i="",a=0,u=0,s=3;s>=0;s--)a=255&(u=arguments[s]),a<<=8,a|=255&(u>>>=8),a<<=8,a|=255&(u>>>=8),a<<=8,i+=e(a|=u>>>=8);return i}(d,y,p,h).toUpperCase()}()};var V=function(t){return F.MD5(t)};function z(t){return function(t){if(Array.isArray(t))return N(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return N(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function H(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Y={4e3:1,8e3:2,11025:3,16e3:4,2e4:5,22050:6,32e3:7,44100:8,48e3:9,96e3:16,128e3:17,192e3:18,64e3:19};function q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=arguments.length>2?arguments[2]:void 0,r=[];if(!0===n)for(var o=0;o<e;o++)r[o]=t>>>8*(e-1-o)&255;else for(var i=0;i<e;i++)r[i]=t>>>8*i&255;return r}function W(t,e){for(var n=0,r=e;r<t.length;r++)n+=t[r];return n}function G(t,e){for(var n=0,r=0;r<e;r++)n+=t[r]<<r%4*8;return n}var X=function(){function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.RtpInterlevedID=e,this.timestamp=0,this.currTime=null,this.preTime=null,this.VideoCodec=n,this.AudioCodec=r,this.MAXFRAMEINTERVAL=65535,this.rtpDataHeadExtLength=12,this.rtpDataHeadLength=24+this.rtpDataHeadExtLength,this.rtpDataFootLength=8,this.rtpPacketHead=[36,e,0,0,0,0],this.DHAV=[68,72,65,86],this.dhav=[100,104,97,118],this.frameNum=245}var e,n,r;return e=t,(n=[{key:"getRTPPacket",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ArrayBuffer(0),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0;this.rtpDataHeadExtLength=8+("audio"===e.type?4:e.width>2048||e.height>2048?12:8),this.rtpDataHeadLength=24+this.rtpDataHeadExtLength;var r=new Uint8Array(this.rtpPacketHead.length+this.rtpDataHeadLength+t.byteLength+this.rtpDataFootLength);r.set([36,this.RtpInterlevedID],n),n+=2,r.set(q(this.rtpDataHeadLength+t.byteLength+this.rtpDataFootLength,4,!0),n),n+=4,r.set(this.DHAV,n),n+=4;var o="audio"===e.type?[240]:e.keyframe?[253]:[252];r.set(o,n),n+=1,r.set([0],n),n+=1,r.set([1],n),n+=1,r.set([0],n),n+=1,this.frameNum>65535&&(this.frameNum=240),r.set(q(this.frameNum),n),n+=4,this.frameNum++;var i=q(this.rtpDataHeadLength+t.byteLength+this.rtpDataFootLength);r.set(i,n),n+=4;var a=new Date("2000-01-01 00:00:00").getTime();this.timestamp=1e3*e.timestamp/e.timescale,this.timestamp>this.MAXFRAMEINTERVAL&&(this.timestamp=this.timestamp-this.MAXFRAMEINTERVAL),r.set(q(Math.floor((a+this.timestamp)/1e3)),n),n+=4,r.set(q(this.timestamp,2),n),n+=2,r.set([this.rtpDataHeadExtLength],n),n+=1;var u=W(r,6);r.set([u],n),n+=1;var s=[];s="video"===e.type?e.width>2048||e.height>2048?[130,0,0,0].concat(z(q(e.width,2)),z(q(e.height,2))):[128,0,e.width/8,e.height/8]:[131,1,26,Y[e.timescale]],r.set(s,n),n+=s.length,"video"===e.type&&(r.set([129,0,this.getHexByCodec(this.VideoCodec),50],n),n+=4);var c=G(t,t.byteLength);return r.set([136],n),n+=1,r.set(q(c),n),n+=4,r.set([0,0,0],n),n+=3,r.set(t,n),n+=t.byteLength,r.set(this.dhav,n),n+=4,r.set(i,n),r}},{key:"getHexByCodec",value:function(t){var e=8;switch(t){case"H264":e=8;break;case"H265":e=12}return e}}])&&H(e.prototype,n),r&&H(e,r),t}();function Z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var K=n(50),J=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.CodecCallback=function(){},this.TrackCallback=function(){}}var e,n,r;return e=t,(n=[{key:"init",value:function(t){this.MovieBuffer=new Uint8Array(0),this.currentFrame=0,this.currentDeleteLen=0,this.length=0,this.position=0,this.isMoov=0,this.isSeek=!1,this.track=this.concatArray(t.tracks[0].samples,t.tracks[1].samples),this.VideoCodec=this.getCodec(t.tracks[0].codec),this.AudioCodec=this.getCodec(t.tracks[1].codec),this.Framerate=this.getFPS(t.tracks[0].samples),this.clockFreq=t.tracks[1].samples[0].timescale,this.AudioCodecInfo={config:"1408",clockFreq:this.clockFreq,bitrate:void 0},this.packetDHAV=new X(0,this.VideoCodec,this.AudioCodec),this.CodecCallback({VideoCodec:this.VideoCodec,AudioCodec:this.AudioCodec,Framerate:this.Framerate,AudioCodecInfo:this.AudioCodecInfo})}},{key:"setMovieData",value:function(t){var e=t.subarray(0,20);if(this.isMoov=e[8],t=t.subarray(20,t.length),this.isMoov){var n=K.MovieParser.parse(t);n?(this.init(n),console.log(n)):console.log("moov不对")}else this.length=(e[7]<<24|e[6]<<16|e[5]<<8|e[4])-20,this.position=e[15]<<48|e[14]<<40|e[13]<<32|e[12]<<24|e[11]<<16|e[10]<<8|e[9],this.currentDeleteLen+this.MovieBuffer.length<this.position&&(this.isSeek=!0,this.currentDeleteLen=this.position,this.currentFrame=this.getCurrentSeekFrame(),this.MovieBuffer=new Uint8Array(0)),this.MovieBuffer=this.concatUint8Array(this.MovieBuffer,new Uint8Array(t)),this.getFrameData()}},{key:"getFrameData",value:function(){var t=this.track[this.currentFrame];if(this.MovieBuffer.length+this.currentDeleteLen>=t.offset+t.size){var e=null;if(t instanceof K.VideoSample){var n=this.set_nal_unit_type(this.MovieBuffer.subarray(t.offset-this.currentDeleteLen,t.offset+t.size-this.currentDeleteLen));e=this.packetDHAV.getRTPPacket(n,t)}else e=this.packetDHAV.getRTPPacket(this.MovieBuffer.subarray(t.offset-this.currentDeleteLen,t.offset+t.size-this.currentDeleteLen),t);(this.isSeek&&t.keyframe||!this.isSeek)&&(this.TrackCallback(e),this.isSeek=!1),this.MovieBuffer=this.MovieBuffer.subarray(t.offset+t.size-this.currentDeleteLen,this.MovieBuffer.length),this.currentDeleteLen=t.offset+t.size,this.currentFrame++,this.currentFrame<this.track.length&&this.getFrameData()}}},{key:"getCurrentSeekFrame",value:function(){var t=0,e=this.track.length-1,n=this.position;if(this.track[0].offset>=n)return 0;for(;t<=e;){var r=parseInt((e+t)/2),o=this.track[r];if(n===o.offset)return r;if(n>o.offset){if(n<o.offset+o.size)return r+1;t=r+1}else{if(!(n<o.offset))return-1;e=r-1}}}},{key:"set_nal_unit_type",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array,e=0,n=0,r=function(e,n){var r="";return t.slice(e,n).map((function(t){return r+=1===t.toString(16).length?"0"+t.toString(16):t.toString(16)})),parseInt(r,16)};t.length>4&&n<t.length;)e=r(n,n+4),t.set([0,0,0,1],n),n=n+e+4;return t}},{key:"concatUint8Array",value:function(){for(var t=0,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];t+=a.length}for(var u=new Uint8Array(t),s=0,c=0,f=n;c<f.length;c++){var l=f[c];u.set(l,s),s+=l.length}return u}},{key:"concatArray",value:function(t,e){return t.concat(e).sort((function(t,e){return t.offset-e.offset}))}},{key:"getCodec",value:function(t){var e="";return/hvc1/g.test(t)&&(e="H265"),/avc1/g.test(t)&&(e="H264"),/mp4a/g.test(t)&&(e="mpeg4-generic"),e}},{key:"getFPS",value:function(t){for(var e=60,n=0,r=t.length>=60?60:t.length;n<r;n++)if(t[n].timestamp<=t[n].timescale&&t[n+1].timestamp>t[n].timescale){e=n;break}return e}},{key:"parseToString",value:function(t){for(var e="",n=0,r=t.length;n<r;n++)e+=(1===t[n].toString(16).length?"0"+t[n].toString(16):t[n].toString(16))+((n+1)%16==0?"\n":(n+1)%8==0?" ":" ");return e}}])&&Z(e.prototype,n),r&&Z(e,r),t}(),Q=function(t,e){t=t;var n=null,o=null,i=null,a=0,u=0,s=!1,c=!1,f=-1!==e.search("&srctype=raw"),l=new J,h=new D,p=200,y=401,d=404,m=457,v=503,b="",g=[],w=1,S=null,O={},_="Options",T=null,E=null,A=!1,R=null,k={},P=e,C=null,I={},x="",M=!1,B=0,U=0;function j(){}function L(t,e,n,o){var i="";switch(t){case"OPTIONS":case"TEARDOWN":case"GET_PARAMETER":case"SET_PARAMETERS":case"DESCRIBE":i=t+" "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\n"+b+"\r\n";break;case"SETUP":r.log("trackID: "+e),i=t+" "+P+"/trackID="+e+" RTSP/1.0\r\nCSeq: "+w+"\r\n"+b+"Transport: DH/AVP/TCP;unicast;interleaved="+2*e+"-"+(2*e+1)+"\r\n",i+=0!=E?"Session: "+E+"\r\n\r\n":"\r\n";break;case"PLAY":i=t+" "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\nSession: "+E+"\r\n",null!=o&&0!=o?(i+="Range:".concat(f?"byte":"npt","=").concat(o,"-\r\n"),i+=b+"\r\n"):i+=b+"\r\n";break;case"PAUSE":i=t+" "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\nSession: "+E+"\r\n\r\n";break;case"SCALE":i="PLAY "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\nSession: "+E+"\r\n",i+="Scale: "+o+"\r\n",i+=b+"\r\n";break;case"SPEED":i="PLAY "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\nSession: "+E+"\r\n",i+="SPEED: "+o+"\r\n",i+=b+"\r\n"}return r.log(i),i}function F(t){r.log(t);var e,n=t.search("CSeq: ")+5;if(w=parseInt(t.slice(n,n+10))+1,(e=function(t){var e={},n=0,r=0,o=null,i=null;if(-1!==t.search("Content-Type: application/sdp")){var a=t.split("\r\n\r\n");i=a[0]}else i=t;var u=i.split("\r\n"),s=u[0].split(" ");s.length>2&&(e.ResponseCode=parseInt(s[1]),e.ResponseMessage=s[2]);if(e.ResponseCode===p){for(n=1;n<u.length;n++)if("Public"===(o=u[n].split(":"))[0])e.MethodsSupported=o[1].split(",");else if("CSeq"===o[0])e.CSeq=parseInt(o[1]);else if("Content-Type"===o[0])e.ContentType=o[1],-1!==e.ContentType.search("application/sdp")&&(e.SDPData=q(t));else if("Content-Length"===o[0])e.ContentLength=parseInt(o[1]);else if("Content-Base"===o[0]){var c=u[n].search("Content-Base:");-1!==c&&(e.ContentBase=u[n].substr(c+13))}else if("Session"===o[0]){var f=o[1].split(";");e.SessionID=parseInt(f[0])}else if("Transport"===o[0]){var l=o[1].split(";");for(r=0;r<l.length;r++){var h=l[r].search("interleaved=");if(-1!==h){var d=l[r].substr(h+12).split("-");d.length>1&&(e.RtpInterlevedID=parseInt(d[0]),e.RtcpInterlevedID=parseInt(d[1]))}}}else if("RTP-Info"===o[0]){o[1]=u[n].substr(9);var m=o[1].split(",");for(e.RTPInfoList=[],r=0;r<m.length;r++){var v=m[r].split(";"),b={},g=0;for(g=0;g<v.length;g++){var w=v[g].search("url=");-1!==w&&(b.URL=v[g].substr(w+4)),-1!==(w=v[g].search("seq="))&&(b.Seq=parseInt(v[g].substr(w+4)))}e.RTPInfoList.push(b)}}}else if(e.ResponseCode===y)for(n=1;n<u.length;n++)if("CSeq"===(o=u[n].split(":"))[0])e.CSeq=parseInt(o[1]);else if("WWW-Authenticate"===o[0]){var S=o[1].split(",");for(r=0;r<S.length;r++){var O=S[r].search("Digest realm=");if(-1!==O){var _=S[r].substr(O+13).split('"');e.Realm=_[1]}if(-1!==(O=S[r].search("nonce="))){var T=S[r].substr(O+6).split('"');e.Nonce=T[1]}}}return e}(t)).ResponseCode===y&&""===b)!function(t){var e,n,r=I.username,o=I.passWord;e={Method:_.toUpperCase(),Realm:t.Realm,Nonce:t.Nonce,Uri:P},n=function(t,e,n,r,o,i){var a,u;return a=V(t+":"+r+":"+e).toLowerCase(),u=V(i+":"+n).toLowerCase(),V(a+":"+o+":"+u).toLowerCase()}(r,o,e.Uri,e.Realm,e.Nonce,e.Method),b='Authorization: Digest username="'+r+'", realm="'+e.Realm+'",',b+=' nonce="'+e.Nonce+'", uri="'+e.Uri+'", response="'+n+'"',b+="\r\n",z(L("OPTIONS",null))}(e);else if(e.ResponseCode===p){if("Options"===_)return _="Describe",U=setTimeout((function(){S({errorCode:404})}),6e3),L("DESCRIBE",null);if("Describe"===_){U&&clearTimeout(U),U=0,A=!1,O=q(t),void 0!==e.ContentBase&&(O.ContentBase=e.ContentBase);var o=0;for(o=0;o<O.Sessions.length;o+=1){var i={};"JPEG"===O.Sessions[o].CodecMime||"H264"===O.Sessions[o].CodecMime||"H265"===O.Sessions[o].CodecMime||"H264-SVC"==O.Sessions[o].CodecMime||"RAW"==O.Sessions[o].CodecMime?(i.codecName=O.Sessions[o].CodecMime,"H264-SVC"===O.Sessions[o].CodecMime&&(i.codecName="H264"),"H265"!==O.Sessions[o].CodecMime&&"RAW"!==O.Sessions[o].CodecMime||j.prototype.setLiveMode("canvas"),i.trackID=O.Sessions[o].ControlURL,i.ClockFreq=O.Sessions[o].ClockFreq,i.Port=parseInt(O.Sessions[o].Port),void 0!==O.Sessions[o].Framerate&&(i.Framerate=parseInt(O.Sessions[o].Framerate),h.setFPS(i.Framerate),C(i.Framerate)),g.push(i)):"PCMU"===O.Sessions[o].CodecMime||-1!==O.Sessions[o].CodecMime.search("G726-16")||-1!==O.Sessions[o].CodecMime.search("G726-24")||-1!==O.Sessions[o].CodecMime.search("G726-32")||-1!==O.Sessions[o].CodecMime.search("G726-40")||"PCMA"===O.Sessions[o].CodecMime?("PCMU"===O.Sessions[o].CodecMime?i.codecName="G.711Mu":"G726-16"===O.Sessions[o].CodecMime?i.codecName="G.726-16":"G726-24"===O.Sessions[o].CodecMime?i.codecName="G.726-24":"G726-32"===O.Sessions[o].CodecMime?i.codecName="G.726-32":"G726-40"===O.Sessions[o].CodecMime?i.codecName="G.726-40":"PCMA"===O.Sessions[o].CodecMime&&(i.codecName="G.711A"),i.trackID=O.Sessions[o].ControlURL,i.ClockFreq=O.Sessions[o].ClockFreq,i.Port=parseInt(O.Sessions[o].Port),i.Bitrate=parseInt(O.Sessions[o].Bitrate),g.push(i)):"mpeg4-generic"===O.Sessions[o].CodecMime||"MPEG4-GENERIC"===O.Sessions[o].CodecMime?(i.codecName="mpeg4-generic",i.trackID=O.Sessions[o].ControlURL,i.ClockFreq=O.Sessions[o].ClockFreq,i.Port=parseInt(O.Sessions[o].Port),i.Bitrate=parseInt(O.Sessions[o].Bitrate),g.push(i)):"vnd.onvif.metadata"===O.Sessions[o].CodecMime?(i.codecName="MetaData",i.trackID=O.Sessions[o].ControlURL,i.ClockFreq=O.Sessions[o].ClockFreq,i.Port=parseInt(O.Sessions[o].Port),g.push(i)):"stream-assist-frame"===O.Sessions[o].CodecMime?(i.codecName="stream-assist-frame",i.trackID=O.Sessions[o].ControlURL,i.ClockFreq=O.Sessions[o].ClockFreq,i.Port=parseInt(O.Sessions[o].Port),g.push(i)):("audio"===O.Sessions[o].Type&&S({errorCode:201}),r.log("Unknown codec type:",O.Sessions[o].CodecMime,O.Sessions[o].ControlURL))}return T=0,_="Setup",r.log(g),L("SETUP",g[T].trackID.split("=")[1]-0)}if("Setup"===_){if(E=e.SessionID,T<g.length)return g[T].RtpInterlevedID=e.RtpInterlevedID,g[T].RtcpInterlevedID=e.RtcpInterlevedID,(T+=1)!==g.length?L("SETUP",g[T].trackID.split("=")[1]-0):(!f&&h.sendSdpInfo(g,k,A),_="Play",M?L("PLAY",null,0,B):L("PLAY",null));r.log("Unknown setup SDP index")}else if("Play"===_){E=e.SessionID,clearInterval(R),R=setInterval((function(){return z(L("GET_PARAMETER",null))}),4e4);0,_="Playing"}else"Playing"===_||r.log("unknown rtsp state:"+_)}else if(e.ResponseCode===v){if("Setup"===_&&-1!==g[T].trackID.search("trackID=t"))return g[T].RtpInterlevedID=-1,g[T].RtcpInterlevedID=-1,T+=1,A=!1,S({errorCode:"504",description:"Talk Service Unavilable",place:"RtspClient.js"}),T<g.length?L("SETUP",g[T].trackID):(_="Play",L("PLAY",null));S({errorCode:"503",description:"Service Unavilable"})}else if(e.ResponseCode===d){if("Describe"===_||"Options"===_)return void S({errorCode:404,description:"rtsp not found"})}else if(e.ResponseCode===m)return void r.log("RTP disconnection detect!!!")}function z(t){if(null!=t&&null!=t&&""!=t)if(n&&n.readyState===WebSocket.OPEN){if(!1===c)-1!==t.search("DESCRIBE")&&(s=!0,c=!0);null!=t&&n.send(N(t))}else r.log("ws未连接")}function N(t){for(var e=t.length,n=new Uint8Array(new ArrayBuffer(e)),r=0;r<e;r++)n[r]=t.charCodeAt(r);return n}function H(t){var e=new Uint8Array,r=new Uint8Array(t.data);for((e=new Uint8Array(r.length)).set(r,0),a=e.length;a>0;)if(36!==e[0]){var c=String.fromCharCode.apply(null,e),f=null;-1===c.indexOf("OffLine:File Over")&&-1===c.indexOf("OffLine:Internal Error")||(n.fileOver=!0,h.postRtspOver()),-1!==c.indexOf("OffLine:KmsUnavailable")&&S({errorCode:203}),!0===s?(f=c.lastIndexOf("\r\n"),s=!1):f=c.search("\r\n\r\n");var p=c.search("RTSP");if(-1===p)return void(e=new Uint8Array);if(-1===f)return void(a=e.length);o=e.subarray(p,f+6),e=e.subarray(f+6),z(F(String.fromCharCode.apply(null,o))),a=e.length}else{if("RAW"===g[0].codecName)return void(/.aac/.test(P)?h.sendBufferToAudioWorker(e.subarray(6,e.length)):l.setMovieData(e.subarray(6,e.length)));if(i=e.subarray(0,6),!((u=i[2]<<24|i[3]<<16|i[4]<<8|i[5])+6<=e.length))return void(a=e.length);var y=e.subarray(6,u+6);Y(i,y),e=e.subarray(u+6),a=e.length}}function Y(t,e){h.parseRTPData(t,e),!0}function q(t){var e={};e.Sessions=[];var n=null;-1!==t.search("Content-Type: application/sdp")?n=t.split("\r\n\r\n")[1]:n=t;var r=n.split("\r\n"),o=0,i=!1;for(o=0;o<r.length;o++){var a=r[o].split("=");if(a.length>0)switch(a[0]){case"a":var u=a[1].split(":");if(u.length>1)if("control"===u[0]){var s=r[o].search("control:");!0===i?-1!==s&&(e.Sessions[e.Sessions.length-1].ControlURL=r[o].substr(s+8)):-1!==s&&(e.BaseURL=r[o].substr(s+8))}else if("rtpmap"===u[0]){var c=u[1].split(" ");e.Sessions[e.Sessions.length-1].PayloadType=c[0];var f=c[1].split("/");e.Sessions[e.Sessions.length-1].CodecMime=f[0],f.length>1&&(e.Sessions[e.Sessions.length-1].ClockFreq=f[1])}else if("framesize"===u[0]){var l=u[1].split(" ");if(l.length>1){var h=l[1].split("-");e.Sessions[e.Sessions.length-1].Width=h[0],e.Sessions[e.Sessions.length-1].Height=h[1]}}else if("framerate"===u[0])e.Sessions[e.Sessions.length-1].Framerate=u[1];else if("fmtp"===u[0]){var p=r[o].split(" ");if(p.length<2)continue;for(var y=1;y<p.length;y++){var d=p[y].split(";"),m=0;for(m=0;m<d.length;m++){var v=d[m].search("mode=");if(-1!==v&&(e.Sessions[e.Sessions.length-1].mode=d[m].substr(v+5)),-1!==(v=d[m].search("config="))&&(e.Sessions[e.Sessions.length-1].config=d[m].substr(v+7),k.config=e.Sessions[e.Sessions.length-1].config,k.clockFreq=e.Sessions[e.Sessions.length-1].ClockFreq,k.bitrate=e.Sessions[e.Sessions.length-1].Bitrate),-1!==(v=d[m].search("sprop-vps="))&&(e.Sessions[e.Sessions.length-1].VPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-sps="))&&(e.Sessions[e.Sessions.length-1].SPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-pps="))&&(e.Sessions[e.Sessions.length-1].PPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-parameter-sets="))){var b=d[m].substr(v+21).split(",");b.length>1&&(e.Sessions[e.Sessions.length-1].SPS=b[0],e.Sessions[e.Sessions.length-1].PPS=b[1])}}}}break;case"m":var g=a[1].split(" "),w={};w.Type=g[0],w.Port=g[1],w.Payload=g[3],e.Sessions.push(w),i=!0;break;case"b":if(!0===i){var S=a[1].split(":");e.Sessions[e.Sessions.length-1].Bitrate=S[1]}}}return e}return j.prototype={init:function(t,e,n,r,o){h.init(t,e,n,r,o)},connect:function(){n||((n=new WebSocket(t)).binaryType="arraybuffer",n.fileOver=!1,n.addEventListener("message",H,!1),n.onopen=function(){var t=N("OPTIONS "+P+" RTSP/1.0\r\nCSeq: "+w+"\r\n\r\n");n.send(t)},n.onerror=function(t){S({errorCode:202,description:"Open WebSocket Error"})},n.onclose=function(t){n&&!n.fileOver&&S({errorCode:202,description:"Open WebSocket Error"})})},disconnect:function(){z(L("TEARDOWN",null,null)),clearInterval(R),R=null,n&&(n.close(),n=null,E=null),h.terminate(),U&&clearTimeout(U)},controlPlayer:function(t){var e="";switch(x=t.command,t.command){case"PLAY":if(_="Play",h.play(),null!=t.range){e=L("PLAY",null,null,t.range);break}e=L("PLAY",null,null),x&&h.initStartTime();break;case"PAUSE":if("PAUSE"===_)break;_="PAUSE",e=L("PAUSE",null,null),h.pause();break;case"SCALE":e=L("SCALE",null,null,t.data),h.playbackSpeed(t.data);break;case"SPEED":e=L("SPEED",null,null,t.data),h.playbackSpeed(t.data);break;case"TEARDOWN":e=L("TEARDOWN",null,null);break;case"audioPlay":if("start"===t.data)_="Play",e=L("PLAY",null,null,t.range);else if("stop"===t.data)e=L("TEARDOWN",null,null);else{if("PAUSE"===_)break;_="PAUSE",e=L("PAUSE",null,null)}h.controlAudio(t.command,t.data);break;case"volumn":case"audioSamplingRate":h.controlAudio(t.command,t.data);break;case"playNextFrame":h.getVideoBufferQueueSize()<5&&this.getNextFrameData(1e3),h.playNextFrame();break;default:r.log("未知指令: "+t.command)}""!=e&&z(e)},setLiveMode:function(t){h.setLiveMode(t)},setPlayMode:function(t,e){M=t,B=e,h.setPlayMode(t)},setRTSPURL:function(t){P=t},setCallback:function(t,e){"GetFrameRate"===t?C=e:h.setCallback(t,e),"Error"==t&&(S=e)},setUserInfo:function(t,e){I.username=t,I.passWord=e},capture:function(t){h.capture(t)},getNextFrameData:function(t){z(L("PLAY",null,null)),setTimeout((function(){z(L("PAUSE",null,null))}),t)}},l.CodecCallback=function(t){k=t.AudioCodecInfo,g[0].Framerate=t.Framerate,"H264"===k.VideoCodec&&j.prototype.setLiveMode("video"),h.sendSdpInfo(g,k,A,t)},l.TrackCallback=function(t){var e=new Uint8Array(t.subarray(6,t.length));Y(t.subarray(0,6),e)},new j},tt=function(t){this.wsURL=t.wsURL,this.rtspURL=t.rtspURL,this.isPlayback=t.playback||!1,this.playBackRange=t.range||!1,this.isAudioFlag=t.isAudioFlag||!1,this.audioState="stop",this.ws=null,this.decodeMode=t.decodeMode,this.events={ResolutionChanged:function(){},PlayStart:function(){},DecodeStart:function(){},UpdateCanvas:function(){},GetFrameRate:function(){},FrameTypeChange:function(){},Error:function(){},MSEResolutionChanged:function(){},audioChange:function(){},WorkerReady:function(){},IvsDraw:function(){},FileOver:function(){},Waiting:function(){},UpdateTime:function(){}},this.username=t.username,this.password=t.password};tt.prototype={init:function(t,e,n){for(var r in this.ws=new Q(this.wsURL,this.rtspURL),this.ws.init(t,e,n,this.isPlayback,this.isAudioFlag),this.ws.setLiveMode(this.decodeMode),this.ws.setUserInfo(this.username,this.password),this.ws.setPlayMode(this.isPlayback,this.playBackRange),this.events)this.ws.setCallback(r,this.events[r]);this.events=null},connect:function(){this.ws.connect(),this.audioState="play"},play:function(){this.controlPlayer("PLAY")},pause:function(){this.controlPlayer("PAUSE")},stop:function(){this.controlPlayer("TEARDOWN")},close:function(){this.ws.disconnect()},playByTime:function(t){this.controlPlayer("PLAY","video",t)},playFF:function(t){this.controlPlayer("PAUSE"),this.controlPlayer("SCALE",t)},playSpeed:function(t){this.controlPlayer("PAUSE"),this.controlPlayer("SPEED",t)},playRewind:function(){},playNextFrame:function(){this.controlPlayer("playNextFrame")},audioPlay:function(){this.controlPlayer("audioPlay","start"),this.audioState="play"},audioStop:function(){this.controlPlayer("audioPlay","stop")},audioPause:function(){this.controlPlayer("audioPlay","pause"),this.audioState="pause"},setAudioSamplingRate:function(t){this.controlPlayer("audioSamplingRate",t)},setAudioVolume:function(t){this.controlPlayer("volumn",t)},controlPlayer:function(t,e,n){var r;r="video"===e?{command:t,range:n||0}:"audioPlay"===t?{command:t,data:e,range:n||0}:{command:t,data:e},this.ws.controlPlayer(r)},setPlayMode:function(t){this.ws.setLiveMode(t)},setPlayPath:function(t){this.ws.setRTSPURL(t)},capture:function(t){this.ws.capture(t)},on:function(t,e){this.events[t]=e}};e.default=tt}]).default;