1 |
- var PlayerControl=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=75)}([function(e,t,n){"use strict";e.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(e){return new(n(63)("./atom-"+e))}}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,o;return t=e,(n=[{key:"type",value:function(){}},{key:"parse",value:function(){}},{key:"build",value:function(){}},{key:"bufferSize",value:function(){}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t,n){"use strict";(function(e){var r=n(57),o=n(58),i=n(59);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!u.TYPED_ARRAY_SUPPORT&&!(this instanceof u))return new u(e,t,n);if("number"===typeof e){if("string"===typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,r){if("number"===typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,n,r):"string"===typeof t?function(e,t,n){"string"===typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(t,n),o=(e=s(e,r)).write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|p(t.length);return 0===(e=s(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!==typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!==typeof t.length||(r=t.length)!==r?s(e,0):h(e,t);if("Buffer"===t.type&&i(t.data))return h(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!==typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=s(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function h(e,t){var n=t.length<0?0:0|p(t.length);e=s(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return N(e).length;t=(""+t).toLowerCase(),r=!0}}function d(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.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:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"===typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"===typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;i<s;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(n+u>s&&(n=s-u),i=n;i>=0;i--){for(var f=!0,h=0;h<u;h++)if(c(e,i+h)!==c(t,h)){f=!1;break}if(f)return i}return-1}function g(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=t.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 s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function b(e,t,n,r){return V(N(t,e.length-n),e,n,r)}function w(e,t,n,r){return V(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return w(e,t,n,r)}function T(e,t,n,r){return V(z(t),e,n,r)}function O(e,t,n,r){return V(function(e,t){for(var n,r,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var i,a,s,u,c=e[o],l=null,f=c>239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128===(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],a=e[o+2],128===(192&i)&&128===(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128===(192&i)&&128===(192&a)&&128===(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=E));return n}(r)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"===typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=a(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,r){return l(t),t<=0?s(e,t):void 0!==n?"string"===typeof r?s(e,t).fill(n,r):s(e,t).fill(n):s(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).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}},u.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)d(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)d(this,t,t+3),d(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)d(this,t,t+7),d(this,t+1,t+6),d(this,t+2,t+5),d(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):function(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,r,o){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),c=this.slice(r,o),l=e.slice(t,n),f=0;f<s;++f)if(c[f]!==l[f]){i=c[f],a=l[f];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"===typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>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,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return T(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function R(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function A(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function C(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=t;i<n;++i)o+=F(e[i]);return o}function P(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function I(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,o,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function x(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o<i;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function U(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o<i;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,i){return i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var o=t-e;n=new u(o,void 0);for(var i=0;i<o;++i)n[i]=this[i+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},u.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=this[e],o=1,i=0;++i<t&&(o*=256);)r+=this[e+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||I(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):U(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);M(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);M(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):x(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):x(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):U(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):U(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<r-n&&(r=e.length-t+n);var o,i=r-n;if(this===e&&n<t&&t<r)for(o=i-1;o>=0;--o)e[o+t]=this[o+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},u.prototype.fill=function(e,t,n,r){if("string"===typeof e){if("string"===typeof t?(r=t,t=0,n=this.length):"string"===typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!==typeof r)throw new TypeError("encoding must be a string");if("string"===typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"===typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=u.isBuffer(e)?e:N(new u(e,r).toString()),s=a.length;for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function N(e,t){var n;t=t||1/0;for(var r=e.length,o=null,i=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(L,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function V(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(56))},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=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(e){return!1}}();return function(){var n,o=c(e);if(t){var i=c(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=n(1),f=n(0),h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(c,l);var t,n,r,i=u(c);function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=i.call(this)).atoms=[],e}return t=c,(n=[{key:"availableAtoms",value:function(){return[]}},{key:"addAtom",value:function(e){this.atoms.push(e)}},{key:"createAtom",value:function(e){var t=f.createAtom(e);return this.addAtom(t),t}},{key:"getAtoms",value:function(e){var t,n=[],r=o(this.atoms);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.type()===e&&n.push(i)}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"getAtom",value:function(e){var t,n=o(this.atoms);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.type()===e)return r}}catch(e){n.e(e)}finally{n.f()}return null}},{key:"parse",value:function(e){for(var t=e.length,n=0;n<t;){var r=e.readUInt32BE(n),o=e.toString("ascii",n+4,n+8);if(0===r)break;if(n+=8,-1!==this.availableAtoms().indexOf(o)){var i=f.createAtom(o);null!==i&&(i.parse(e.slice(n,n+r-8)),this.addAtom(i))}if(!(n+r-8<=t))break;n+=r-8}}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),t+=8;var n,r=o(this.atoms);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.build(e,t),t+=i.bufferSize()}}catch(e){r.e(e)}finally{r.f()}}},{key:"bufferSize",value:function(){return 8+this.atoms.reduce(function(e,t){return e+t.bufferSize()},0)}}])&&a(t.prototype,n),r&&a(t,r),c}();e.exports=h},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=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(e){return!1}}();return function(){var n,o=a(e);if(t){var i=a(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=n(14),u=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(n,s);var t=i(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.call(this)).compositionOffset=0,e.keyframe=!1,e}return n}();e.exports=u},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=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(e){return!1}}();return function(){var n,o=a(e);if(t){var i=a(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=n(14),u=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(n,s);var t=i(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.call(this)}return n}();e.exports=u},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=4294967295,i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,i;return t=e,i=[{key:"readUInt64BE",value:function(e,t){var n=e.readUInt32BE(t),r=e.readUInt32BE(t+4);return n>0&&(r+=n*(o+1)),r}},{key:"writeUInt64BE",value:function(e,t,n){var r=0,i=t;t>o&&(r=t/(o+1)<<0,i=t%(o+1)),e.writeUInt32BE(r,n),e.writeUInt32BE(i,n+4)}}],(n=null)&&r(t.prototype,n),i&&r(t,i),e}();e.exports=i},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(c,u);var t,n,r,s=a(c);function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=s.call(this)).entries=[],e}return t=c,(n=[{key:"countMultiplier",value:function(){return 1}},{key:"parse",value:function(e){var t=e.readUInt32BE(4);this.entries=new Array(t*this.countMultiplier());for(var n=0,r=this.entries.length;n<r;n++)this.entries[n]=e.readUInt32BE(8+4*n)}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(this.entries.length/this.countMultiplier()<<0,t+12);for(var n=0,r=this.entries.length;n<r;n++)e.writeUInt32BE(this.entries[n],t+16+4*n)}},{key:"bufferSize",value:function(){return 16+4*this.entries.length}}])&&o(t.prototype,n),r&&o(t,r),c}();e.exports=c},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=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(e){return!1}}();return function(){var n,o=a(e);if(t){var i=a(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=n(13),u=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(n,s);var t=i(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.call(this)).channels=null,e.sampleRate=null,e.sampleSize=null,e}return n}();e.exports=u},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(13),c=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(c,u);var t,n,r,s=a(c);function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=s.call(this)).width=0,e.height=0,e}return t=c,(n=[{key:"resolution",value:function(){return this.width&&this.height?"".concat(this.width,"x").concat(this.height):""}}])&&o(t.prototype,n),r&&o(t,r),c}();e.exports=c},function(e,t,n){"use strict";(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(16),i=n(60),a=n(61),s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,s,u;return n=e,u=[{key:"create",value:function(e){return e instanceof o?e:e instanceof t?new a(e):new i(e)}}],(s=null)&&r(n.prototype,s),u&&r(n,u),e}();e.exports=s}).call(this,n(2).Buffer)},function(e,t,n){"use strict";e.exports={CODEC_AAC:"aac",CODEC_H264:"h264",CODEC_H265:"h265"}},function(e,t,n){"use strict";function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(8),s=n(9),u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.duration=0,this.timescale=0,this.tracks=[]}var t,n,o;return t=e,(n=[{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}},{key:"resolution",value:function(){var e=this.videoTrack();return null!==e?e.resolution():""}},{key:"size",value:function(){return this.tracks.reduce(function(e,t){return e+t.size()},0)}},{key:"addTrack",value:function(e){this.tracks.push(e)}},{key:"videoTrack",value:function(){var e,t=r(this.tracks);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(n instanceof s)return n}}catch(e){t.e(e)}finally{t.f()}return null}},{key:"audioTrack",value:function(){var e,t=r(this.tracks);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(n instanceof a)return n}}catch(e){t.e(e)}finally{t.f()}return null}},{key:"samples",value:function(){return[this.videoTrack(),this.audioTrack()].filter(function(e){return null!==e}).map(function(e){return e.samples}).reduce(function(e,t){return e.concat(t)},[]).sort(function(e,t){return e.timescale===t.timescale?e.timestamp-t.timestamp:e.timestamp*t.timescale-t.timestamp*e.timescale})}},{key:"ensureDuration",value:function(){var e=this;return 0===this.duration&&(this.duration=this.tracks.reduce(function(t,n){return Math.max(t,e.timescale*n.relativeDuration())},0)),this.duration}}])&&i(t.prototype,n),o&&i(t,o),e}();e.exports=u},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.duration=0,this.timescale=0,this.extraData=null,this.codec=null,this.samples=[]}var t,n,o;return t=e,(n=[{key:"relativeDuration",value:function(){return this.timescale?this.duration/this.timescale:this.duration||0}},{key:"size",value:function(){return this.samples.reduce(function(e,t){return e+t.size},0)}},{key:"ensureDuration",value:function(){return 0===this.duration&&(this.duration=this.samples.reduce(function(e,t){return Math.max(e,t.duration)},0)),this.duration}},{key:"sortSamples",value:function(){this.samples.sort(function(e,t){return e.timestamp-t.timestamp})}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.timestamp=0,this.timescale=0,this.size=0,this.offset=0}var t,n,o;return t=e,(n=[{key:"relativeTimestamp",value:function(){return this.timescale?this.timestamp/this.timescale:this.timestamp}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.timestamp=0,this.duration=0,this.timescale=0,this.videoExtraData=null,this.audioExtraData=null,this.samples=[]}var t,n,o;return t=e,(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(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,o;return t=e,(n=[{key:"size",value:function(){}},{key:"read",value:function(){}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).width=null,e.height=null,e.extraData=null,e}return t=l,(n=[{key:"extraType",value:function(){}},{key:"parse",value:function(e){var t=24;for(this.width=e.readUInt16BE(t),t+=2,this.height=e.readUInt16BE(t),t+=52;t<e.length-8;){var n=e.readUInt32BE(t);t+=4;var r=e.toString("ascii",t,t+4);if(t+=4,0===n)break;if(r===this.extraType()){this.extraData=e.slice(t-4,t+n-4);break}t+=n-8}}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt16BE(1,t+14),e.writeUInt32BE(1,t+20),e.writeUInt16BE(this.width,t+32),e.writeUInt16BE(this.height,t+34),e.writeUInt32BE(72<<16,t+36),e.writeUInt32BE(72<<16,t+40),e.writeUInt16BE(1,t+48),e.write(c.COMPRESSOR_NAME.substring(0,16),t+50),e.writeUInt16BE(24,t+82),e.writeUInt16BE(65535,t+84),e.writeUInt32BE(this.extraData.length+4,t+86),e.write(this.extraType(),t+90),this.extraData.copy(e,t+94,4)}},{key:"bufferSize",value:function(){return 90+this.extraData.length}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o={mp4a:n(65),avcC:n(66),hvcC:n(67)},i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,i;return t=e,i=[{key:"parse",value:function(e){var t=e.toString("ascii",0,4),n=o[t];if(n){var r=new n(e.slice(4,e.length));return r.parse(),r}throw new Error("Unknown codec name ".concat(t))}}],(n=null)&&r(t.prototype,n),i&&r(t,i),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,o;return t=e,(n=[{key:"type",value:function(){}},{key:"parse",value:function(){}},{key:"codec",value:function(){}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=o},function(e,t){e.exports=function(){return new Worker("./module/audioWorker.worker.js")}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(0),i=n(64),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,a;return t=e,a=[{key:"parse",value:function(e){return new i(e).parse()}},{key:"check",value:function(e){return e.readUInt32BE(0)>0&&-1!==[o.ATOM_FTYP,o.ATOM_MOOV,o.ATOM_MDAT].indexOf(e.toString("ascii",4,8))}}],(n=null)&&r(t.prototype,n),a&&r(t,a),e}();e.exports=a},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(17),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_AVC1}},{key:"extraType",value:function(){return c.ATOM_AVCC}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(6),l=n(0),f=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(f,u);var t,n,r,s=a(f);function f(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(e=s.call(this)).entries=[],e}return t=f,(n=[{key:"type",value:function(){return l.ATOM_CO64}},{key:"parse",value:function(e){var t=e.readUInt32BE(4);this.entries=new Array(t);for(var n=0;n<t;n++)this.entries[n]=c.readUInt64BE(e,8+8*n)}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(this.entries.length,t+12);for(var n=0,r=this.entries.length;n<r;n++)c.writeUInt64BE(e,this.entries[n],t+16+8*n)}},{key:"bufferSize",value:function(){return 16+8*this.entries.length}}])&&o(t.prototype,n),r&&o(t,r),f}();e.exports=f},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(7),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_CTTS}},{key:"countMultiplier",value:function(){return 2}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";(function(t){function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0);function l(e,t){var n,r=0;for(n=0;n<4;n++){var o=255&e[t+n];if(r<<=7,r|=127&o,0===(128&o))break}return{size:r,read:n+1}}var f=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(h,u);var n,r,s,f=a(h);function h(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),(e=f.call(this)).streamId=null,e.extraData=null,e}return n=h,(r=[{key:"type",value:function(){return c.ATOM_ESDS}},{key:"parse",value:function(e){var n=5;n+=l(e,n).read,this.streamId=e.readUInt16BE(n),n+=2;var r=e[n++];for(1===(r>>7&1)&&(n+=2),1===(r>>6&1)&&(n+=e[n]+1),1===(r>>5&1)&&(n+=2);n<e.length;){var o=e[n++],i=l(e,n);if(n+=i.read,4===o){n+=13,i.size>13&&5===e[n++]&&(n+=(i=l(e,n)).read,this.extraData=t.allocUnsafe(i.size),e.copy(this.extraData,0,n,n+i.size));break}n+=i.size}}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),t+=8,t+=4,e[t++]=3,e[t++]=23+this.extraData.length,e.writeUInt16BE(this.streamId,t),t+=2,e[t++]=0,e[t++]=4,e[t++]=15+this.extraData.length,e[t++]=64,e[t++]=21,t+=11,e[t++]=5,e[t++]=this.extraData.length,this.extraData.copy(e,t),t+=this.extraData.length,e[t++]=6,e[t++]=1,e[t++]=2}},{key:"bufferSize",value:function(){return 37+this.extraData.length}}])&&o(n.prototype,r),s&&o(n,s),h}();e.exports=f}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).majorBrand=null,e.minorVersion=0,e.compatibleBrands=[],e}return t=l,(n=[{key:"type",value:function(){return c.ATOM_FTYP}},{key:"parse",value:function(e){this.majorBrand=e.toString("ascii",0,4),this.minorVersion=e.readUInt32BE(4);for(var t=0;t<(e.length-8)/4;t++)this.compatibleBrands.push(e.toString("ascii",8+4*t,12+4*t))}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.write(this.majorBrand,t+8),e.writeUInt32BE(this.minorVersion,t+12);for(var n=0;n<this.compatibleBrands.length;n++)e.write(this.compatibleBrands[n],t+16+4*n)}},{key:"bufferSize",value:function(){return 16+4*this.compatibleBrands.length}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).handlerType=null,e.componentName=null,e}return t=l,(n=[{key:"type",value:function(){return c.ATOM_HDLR}},{key:"parse",value:function(e){this.handlerType=e.toString("ascii",8,12),this.componentName=e.toString("ascii",16)}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.write(this.handlerType.substring(0,4),t+16),e.write(this.componentName.substring(0,16),t+24)}},{key:"bufferSize",value:function(){return 48}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(17),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_HEV1}},{key:"extraType",value:function(){return c.ATOM_HVCC}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(17),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_HVC1}},{key:"extraType",value:function(){return c.ATOM_HVCC}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=n(6),f=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(f,u);var t,n,r,s=a(f);function f(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),s.apply(this,arguments)}return t=f,(n=[{key:"type",value:function(){return c.ATOM_MDHD}},{key:"parse",value:function(e){1===e[0]?(this.timescale=e.readUInt32BE(20),this.duration=l.readUInt64BE(e,24)):(this.timescale=e.readUInt32BE(12),this.duration=e.readUInt32BE(16))}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(this.timescale,t+20),e.writeUInt32BE(this.duration,t+24)}},{key:"bufferSize",value:function(){return 32}}])&&o(t.prototype,n),r&&o(t,r),f}();e.exports=f},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(3),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_MDIA}},{key:"availableAtoms",value:function(){return[c.ATOM_MDHD,c.ATOM_MINF,c.ATOM_HDLR]}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(3),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_MINF}},{key:"availableAtoms",value:function(){return[c.ATOM_VMHD,c.ATOM_SMHD,c.ATOM_STBL]}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(3),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_MOOV}},{key:"availableAtoms",value:function(){return[c.ATOM_MVHD,c.ATOM_TRAK]}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";(function(t){function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(f,u);var n,r,s,l=a(f);function f(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(e=l.call(this)).channels=null,e.sampleSize=null,e.sampleRate=null,e.streamId=null,e.extraData=null,e}return n=f,(r=[{key:"type",value:function(){return c.ATOM_MP4A}},{key:"parse",value:function(e){var n=8,r=e.readUInt16BE(n);for(n+=8,this.channels=e.readUInt16BE(n),n+=2,this.sampleSize=e.readUInt16BE(n),n+=4,this.sampleRate=e.readUInt32BE(n),n+=6,r>0&&(n+=16);n<e.length-8;){var o=e.readUInt32BE(n),i=e.toString("ascii",n+4,n+8);if(0===o)break;if(n+=8,i===c.ATOM_ESDS){var a=c.createAtom(i);null!==a&&(a.parse(e.slice(n,n+o-8)),this.streamId=a.streamId,a.extraData&&(this.extraData=t.allocUnsafe(4+a.extraData.length),this.extraData.write(c.ATOM_MP4A),a.extraData.copy(this.extraData,4,0)));break}n+=o-8}}},{key:"build",value:function(e,n){e.writeUInt32BE(this.bufferSize(),n),e.write(this.type(),n+4),e.writeUInt16BE(1,n+14),e.writeUInt16BE(this.channels,n+24),e.writeUInt16BE(this.sampleSize,n+26),e.writeUInt32BE(this.sampleRate,n+30);var r=c.createAtom(c.ATOM_ESDS);r.streamId=this.streamId,r.extraData=t.allocUnsafe(this.extraData.length-4),this.extraData.copy(r.extraData,0,4),r.build(e,n+36)}},{key:"bufferSize",value:function(){return 73+this.extraData.length}}])&&o(n.prototype,r),s&&o(n,s),f}();e.exports=l}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=n(6),f=[65536,0,0,0,65536,0,0,0,1073741824],h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(h,u);var t,n,r,s=a(h);function h(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),(e=s.call(this)).timescale=null,e.duration=null,e.nextTrackId=null,e}return t=h,(n=[{key:"type",value:function(){return c.ATOM_MVHD}},{key:"parse",value:function(e){1===e[0]?(this.timescale=e.readUInt32BE(20),this.duration=l.readUInt64BE(e,24),this.nextTrackId=e.readUInt32BE(104)):(this.timescale=e.readUInt32BE(12),this.duration=e.readUInt32BE(16),this.nextTrackId=e.readUInt32BE(96))}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(this.timescale,t+20),e.writeUInt32BE(this.duration,t+24),e.writeUInt32BE(65536,t+28),e.writeUInt16BE(256,t+32);for(var n=0;n<f.length;n++)e.writeUInt32BE(f[n],t+44+4*n);e.writeUInt32BE(this.nextTrackId,t+104)}},{key:"bufferSize",value:function(){return 108}}])&&o(t.prototype,n),r&&o(t,r),h}();e.exports=h},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_SMHD}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4)}},{key:"bufferSize",value:function(){return 16}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(3),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STBL}},{key:"availableAtoms",value:function(){return[c.ATOM_STSZ,c.ATOM_STCO,c.ATOM_STSS,c.ATOM_STTS,c.ATOM_STSC,c.ATOM_CO64,c.ATOM_STSD,c.ATOM_CTTS]}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(7),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STCO}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(7),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STSC}},{key:"countMultiplier",value:function(){return 3}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return(s="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=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(e){return!1}}();return function(){var n,o=l(e);if(t){var i=l(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=n(3),h=n(0),p=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(p,f);var t,n,r,i=c(p);function p(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),i.apply(this,arguments)}return t=p,(n=[{key:"type",value:function(){return h.ATOM_STSD}},{key:"availableAtoms",value:function(){return[h.ATOM_AVC1,h.ATOM_HEV1,h.ATOM_HVC1,h.ATOM_MP4A]}},{key:"getVideoAtom",value:function(){return this.getAtom(h.ATOM_AVC1)||this.getAtom(h.ATOM_HEV1)||this.getAtom(h.ATOM_HVC1)}},{key:"getAudioAtom",value:function(){return this.getAtom(h.ATOM_MP4A)}},{key:"parse",value:function(e){s(l(p.prototype),"parse",this).call(this,e.slice(8))}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(1,t+12),t+=16;var n,r=o(this.atoms);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.build(e,t),t+=i.bufferSize()}}catch(e){r.e(e)}finally{r.f()}}},{key:"bufferSize",value:function(){return 8+s(l(p.prototype),"bufferSize",this).call(this)}}])&&a(t.prototype,n),r&&a(t,r),p}();e.exports=p},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(7),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STSS}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).entries=[],e}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STSZ}},{key:"parse",value:function(e){var t=e.readUInt32BE(4),n=e.readUInt32BE(8);if(this.entries=new Array(n),0===t)for(var r=0;r<n;r++)this.entries[r]=e.readUInt32BE(12+4*r);else this.entries.fill(t)}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(this.entries.length,t+16);for(var n=0,r=this.entries.length;n<r;n++)e.writeUInt32BE(this.entries[n],t+20+4*n)}},{key:"bufferSize",value:function(){return 20+4*this.entries.length}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(7),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_STTS}},{key:"countMultiplier",value:function(){return 2}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(6),l=n(0),f=[65536,0,0,0,65536,0,0,0,1073741824],h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(h,u);var t,n,r,s=a(h);function h(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),(e=s.call(this)).duration=null,e.trackId=null,e.width=null,e.height=null,e}return t=h,(n=[{key:"type",value:function(){return l.ATOM_TKHD}},{key:"parse",value:function(e){this.trackId=e.readUInt32BE(12),1===e[0]?(this.duration=c.readUInt64BE(e,28),this.width=e.readUInt16BE(88),this.height=e.readUInt16BE(92)):(this.duration=e.readUInt32BE(20),this.width=e.readUInt16BE(76),this.height=e.readUInt16BE(80))}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(3,t+8),e.writeUInt32BE(this.trackId,t+20),e.writeUInt32BE(this.duration,t+28),null===this.width||null===this.height?(e.writeUInt16BE(1,t+42),e.writeUInt16BE(256,t+44)):(e.writeUInt16BE(this.width,t+84),e.writeUInt16BE(this.height,t+88));for(var n=0;n<f.length;n++)e.writeUInt32BE(f[n],t+48+4*n)}},{key:"bufferSize",value:function(){return 92}}])&&o(t.prototype,n),r&&o(t,r),h}();e.exports=h},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(3),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_TRAK}},{key:"availableAtoms",value:function(){return[c.ATOM_TKHD,c.ATOM_MDIA]}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(1),c=n(0),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),s.apply(this,arguments)}return t=l,(n=[{key:"type",value:function(){return c.ATOM_VMHD}},{key:"build",value:function(e,t){e.writeUInt32BE(this.bufferSize(),t),e.write(this.type(),t+4),e.writeUInt32BE(1,t+8)}},{key:"bufferSize",value:function(){return 20}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(48),i=n(68),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,a;return t=e,a=[{key:"parse",value:function(e){return new i(e).parse()}},{key:"check",value:function(e){return e.toString("ascii",0,3)===o.HEADER_PREFIX&&e[3]===o.HEADER_VERSION}}],(n=null)&&r(t.prototype,n),a&&r(t,a),e}();e.exports=a},function(e,t,n){"use strict";e.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(e,t){e.exports=function(){return new Worker("./module/videoWorker.worker.js")}},function(e,t){e.exports=function(){return new Worker("./module/audioTalkWorker.worker.js")}},function(e,t){e.exports=function(){return new Worker("./module/videoWorkerTrain.worker.js")}},function(e,t,n){"use strict";e.exports=n(53)},function(e,t,n){"use strict";var r=n(12),o=n(13),i=n(9),a=n(8),s=n(14),u=n(4),c=n(5),l=n(15),f=n(54),h=n(55),p=n(62),y=n(21),d=n(47),m=n(70);e.exports={Movie:r,Track:o,VideoTrack:i,AudioTrack:a,Sample:s,VideoSample:u,AudioSample:c,Fragment:l,FragmentList:f,FragmentReader:h,MovieParser:p,MP4Parser:y,FLVParser:d,HLSPacketizer:m}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(15),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fragmentDuration=0,this.duration=0,this.timescale=0,this.video=null,this.audio=null,this.fragments=[]}var t,n,i;return t=e,(n=[{key:"createFragment",value:function(e){var t={timestamp:e,duration:0,samples:[]};return this.fragments.push(t),t}},{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(e){return null!==e}).reduce(function(e,t){return e+t.size},0)}},{key:"count",value:function(){return this.fragments.length}},{key:"get",value:function(e){var t=this.fragments[e];if(t){var n=new o;return n.timestamp=t.timestamp,n.duration=t.duration,n.samples=t.samples,n.timescale=this.timescale,this.video&&(n.videoExtraData=this.video.extraData),this.audio&&(n.audioExtraData=this.audio.extraData),n}}}])&&r(t.prototype,n),i&&r(t,i),e}();e.exports=i},function(e,t,n){"use strict";(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(10),i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,i,a;return n=e,a=[{key:"readSamples",value:function(e,n){for(var r=e.samples.map(function(e,t){return{index:t,offset:e.offset,size:e.size,bufferIndex:0,bufferOffset:0}}).sort(function(e,t){return e.offset-t.offset}),i=[],a=null,s=0,u=r.length;s<u;s++){var c=r[s];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:t.allocUnsafe(1048576)},i.push(a),c.bufferIndex=i.length-1,c.bufferOffset=0)}for(var l=o.create(n),f=0,h=i.length;f<h;f++){var p=i[f];l.read(p.buffer,p.offset)}return r.sort(function(e,t){return e.index-t.index}),e.samples.map(function(e,t){var n=r[t];return i[n.bufferIndex].buffer.slice(n.bufferOffset,n.bufferOffset+n.size)})}}],(i=null)&&r(n.prototype,i),a&&r(n,a),e}();e.exports=i}).call(this,n(2).Buffer)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"===typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=c(e),a=r[0],s=r[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n<f;n+=4)t=o[e.charCodeAt(n)]<<18|o[e.charCodeAt(n+1)]<<12|o[e.charCodeAt(n+2)]<<6|o[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=o[e.charCodeAt(n)]<<2|o[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===s&&(t=o[e.charCodeAt(n)]<<10|o[e.charCodeAt(n+1)]<<4|o[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;a<s;a+=16383)i.push(l(e,a,a+16383>s?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],o[a.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+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(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,u=(1<<s)-1,c=u>>1,l=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)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)},t.write=function(e,t,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<<c)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,y=r?1:-1,d=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=y,s/=256,o-=8);for(a=a<<o|s,c+=o;c>0;e[n+p]=255&a,p+=y,a/=256,c-=8);e[n+p-y]|=128*d}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(16),c=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var n,r,s,c=a(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=c.call(this)).fd=e,t}return n=l,(r=[{key:"size",value:function(){return this.fd.byteLength}},{key:"read",value:function(e,t,n){n=n||0;var r=this.fd.slice(t,t+e.length-n);return this.toBuffer(r)}},{key:"toBuffer",value:function(e){for(var n=new t(e.byteLength),r=new Uint8Array(e),o=0;o<n.length;++o)n[o]=r[o];return n}}])&&o(n.prototype,r),s&&o(n,s),l}();e.exports=c}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(16),c=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(c,u);var t,n,r,s=a(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=s.call(this)).buffer=e,t}return t=c,(n=[{key:"size",value:function(){return this.buffer.length}},{key:"read",value:function(e,t,n){return n=n||0,this.buffer.copy(e,n,t,t+e.length-n)}}])&&o(t.prototype,n),r&&o(t,r),c}();e.exports=c},function(e,t,n){"use strict";(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(10),i=[n(21),n(47)],a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,a,s;return n=e,s=[{key:"parse",value:function(e){o.create(e),t.allocUnsafe(8);return i[0].parse(e)}}],(a=null)&&r(n.prototype,a),s&&r(n,s),e}();e.exports=a}).call(this,n(2).Buffer)},function(e,t,n){var r={"./atom-avc1":22,"./atom-avc1.js":22,"./atom-co64":23,"./atom-co64.js":23,"./atom-ctts":24,"./atom-ctts.js":24,"./atom-esds":25,"./atom-esds.js":25,"./atom-ftyp":26,"./atom-ftyp.js":26,"./atom-hdlr":27,"./atom-hdlr.js":27,"./atom-hev1":28,"./atom-hev1.js":28,"./atom-hvc1":29,"./atom-hvc1.js":29,"./atom-mdhd":30,"./atom-mdhd.js":30,"./atom-mdia":31,"./atom-mdia.js":31,"./atom-minf":32,"./atom-minf.js":32,"./atom-moov":33,"./atom-moov.js":33,"./atom-mp4a":34,"./atom-mp4a.js":34,"./atom-mvhd":35,"./atom-mvhd.js":35,"./atom-smhd":36,"./atom-smhd.js":36,"./atom-stbl":37,"./atom-stbl.js":37,"./atom-stco":38,"./atom-stco.js":38,"./atom-stsc":39,"./atom-stsc.js":39,"./atom-stsd":40,"./atom-stsd.js":40,"./atom-stss":41,"./atom-stss.js":41,"./atom-stsz":42,"./atom-stsz.js":42,"./atom-stts":43,"./atom-stts.js":43,"./atom-tkhd":44,"./atom-tkhd.js":44,"./atom-trak":45,"./atom-trak.js":45,"./atom-vmhd":46,"./atom-vmhd.js":46};function o(e){var t=i(e);return n(t)}function i(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=i,e.exports=o,o.id=63},function(e,t,n){"use strict";(function(t){function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=n(0),s=n(12),u=n(8),c=n(9),l=n(5),f=n(4),h=n(10),p=n(18),y=n(6),d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=t,this.isFullMoov=!1,this.reader=h.create(this.source)}var n,o,d;return n=e,d=[{key:"_getEntries",value:function(e,t){var n=[],r=e.getAtom(t);return null!==r&&(n=r.entries),n}}],(o=[{key:"parse",value:function(){if(this._findMoovAtom(),this.isFullMoov){this._createMovie();var e,t=r(this.moovAtom.getAtoms(a.ATOM_TRAK));try{for(t.s();!(e=t.n()).done;){var n=e.value;this._createTrack(n)}}catch(e){t.e(e)}finally{t.f()}this.movie.tracks.forEach(function(e){e.sortSamples(),e.ensureDuration()}),this.movie.ensureDuration()}return this.movie}},{key:"_findMoovAtom",value:function(){this.moovAtom=null;for(var e=0,n=this.reader.size(),r=t.allocUnsafe(8);e<n;){var o=8,i=(r=this.reader.read(r,e)).readUInt32BE(0),s=r.toString("ascii",4);if(0===i?i=n-e:1===i&&(r=this.reader.read(r,e+r.length),i=y.readUInt64BE(r,0),o+=8),a.ATOM_MOOV===s){var u=t.allocUnsafe(i-o);if((u=this.reader.read(u,e+o)).byteLength===u.length){try{this.moovAtom=a.createAtom(s),this.moovAtom.parse(u),this.isFullMoov=!0}catch(e){}break}}else e+=i}this.moovAtom}},{key:"_createMovie",value:function(){this.movie=new s;var e=this.moovAtom.getAtom(a.ATOM_MVHD);e&&(this.movie.timescale=e.timescale,this.movie.duration=e.duration)}},{key:"_createTrack",value:function(t){var n=t.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 s=i.getAtom(a.ATOM_STBL);if(null!==s){var h=s.getAtom(a.ATOM_STSD),y=null,d=null;if(a.TRACK_TYPE_AUDIO===r.handlerType){var m=h.getAudioAtom();null!==m&&(y=new u,d=l.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=f.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 g=p.parse(y.extraData);null!==g&&(y.codec=g.codec());var b=e._getEntries(s,a.ATOM_CTTS),w=e._getEntries(s,a.ATOM_STSZ),S=e._getEntries(s,a.ATOM_STSC),T=e._getEntries(s,a.ATOM_STSS),O=e._getEntries(s,a.ATOM_STTS),_=e._getEntries(s,a.ATOM_STCO);0===_.length&&(_=e._getEntries(s,a.ATOM_CO64));var k=0,E=0,R=0,A=0,C=0,P=0,I=0,M=0,x=0,U=0;S.length>0&&(C=S[0],U=S[1]);for(var D=new Array(w.length),B=0,j=0,L=O.length;j<L;j+=2)for(var F=O[j+1]||0,N=0;N<O[j];N++){var z=Object.create(d);if(z.timestamp=k,z.timescale=y.timescale,z.size=w[M],z.offset=_[E]+R,y instanceof c){z.width=y.width,z.height=y.height,z.type="video";var V=0;2*P+1<b.length&&(V=b[2*P+1]||0,++I>=b[2*P]&&(P++,I=0)),z.compositionOffset=V,x<T.length&&T[x]===M+1?(z.keyframe=!0,x++):z.keyframe=!1}else z.type="audio";z.size>0&&(D[B++]=z),++A<U?R+=w[M]:(A=0,R=0,E++,3*C+1<S.length&&E+1>=S[3*C]&&(U=S[3*C+1],C++)),k+=F,M++}B<D.length?y.samples=D.slice(0,B):y.samples=D,y.extraData&&y.samples.length>0&&this.movie.addTrack(y)}}}}}}])&&i(n.prototype,o),d&&i(n,d),e}();e.exports=d}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(19),c=n(11),l=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],f=[0,1,2,3,4,5,6,8],h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(h,u);var t,n,r,s=a(h);function h(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),(t=s.call(this)).extraData=e,t.rateIndex=null,t.sampleRate=null,t.channelsIndex=null,t.channels=null,t.profileObjectType=null,t}return t=h,(n=[{key:"type",value:function(){return c.CODEC_AAC}},{key:"parse",value:function(){var e=this.extraData[0],t=this.extraData[1];this.profileObjectType=(248&e)>>3,this.rateIndex=((7&e)<<1)+((128&t)>>7&1),this.sampleRate=l[this.rateIndex]||null,this.channelsIndex=(127&t)>>3,this.channels=f[this.channelsIndex]||null}},{key:"codec",value:function(){return"mp4a.40.".concat(this.profileObjectType)}}])&&o(t.prototype,n),r&&o(t,r),h}();e.exports=h},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(19),c=n(11);var l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=s.call(this)).extraData=e,t._units=[],t._pos=0,t}return t=l,(n=[{key:"type",value:function(){return c.CODEC_H264}},{key:"parse",value:function(){this._pos=5;for(var e=31&this.extraData[this._pos++],t=0;t<e;t++)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 e,t,n="",r=1;r<4;r++)n+=(e=this.extraData[r].toString(16),t=2,"0".repeat(Math.max(0,t-e.length))+e);return"avc1.".concat(n)}},{key:"_readNalUnit",value:function(){var e=this.extraData.readUInt16BE(this._pos);this._pos+=2;var t=this.extraData.slice(this._pos,this._pos+e);return this._pos+=e,t}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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(e){return!1}}();return function(){var n,o=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=n(19),c=n(11),l=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(l,u);var t,n,r,s=a(l);function l(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(t=s.call(this)).extraData=e,t._units=[],t._pos=0,t}return t=l,(n=[{key:"type",value:function(){return c.CODEC_H265}},{key:"parse",value:function(){this._pos=22;for(var e=this.extraData[this._pos++],t=0;t<e;t++){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 e=this.extraData[1],t=1===(e>>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,s=o.length-1;s>0;s--)if(o[s]>0){a=s;break}for(var u=["hvc1",(e>>6)+(31&e),n,"".concat(t?"H":"L").concat(r)],c=0;c<=a;c++)u.push(o[c].toString(16).replace(/0+$/,""));return u.join(".")}},{key:"_readNalUnit",value:function(){var e=this.extraData.readUInt16BE(this._pos);this._pos+=2;var t=this.extraData.slice(this._pos,this._pos+e);return this._pos+=e,t}}])&&o(t.prototype,n),r&&o(t,r),l}();e.exports=l},function(e,t,n){"use strict";(function(t){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(69),i=n(48),a=n(12),s=n(8),u=n(9),c=n(5),l=n(4),f=n(10),h=n(18),p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=t,this.reader=f.create(this.source)}var n,p,y;return n=e,(p=[{key:"parse",value:function(){var e=this;return this._parseHeader(),this._createMovie(),this._parseBody(),[this.videoTrack,this.audioTrack].forEach(function(t){t.extraData&&t.samples.length>0&&(t.sortSamples(),t.ensureDuration(),e.movie.addTrack(t))}),this.movie.ensureDuration(),this.movie}},{key:"_parseHeader",value:function(){var e=t.allocUnsafe(i.HEADER_SIZE);if(this.reader.read(e,0),e.toString("ascii",0,3)!==i.HEADER_PREFIX||e[3]!==i.HEADER_VERSION)throw new Error("FLV header not found");this.pos=e[8]}},{key:"_createMovie",value:function(){this.movie=new a,this.movie.timescale=i.MOVIE_TIMESCALE,this.videoTrack=new u,this.videoTrack.timescale=i.MOVIE_TIMESCALE,this.audioTrack=new s,this.audioTrack.timescale=i.MOVIE_TIMESCALE}},{key:"_parseBody",value:function(){for(var e=t.allocUnsafe(15),n=this.reader.size();this.pos<n;){this.pos+=this.reader.read(e,this.pos);var r=e[4];if(void 0===r)break;var o=e.readUIntBE(5,3),a=(e[11]<<24)+e.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(e){var n=t.allocUnsafe(e);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 s=a.duration*i.MOVIE_TIMESCALE;this.movie.duration=s,this.videoTrack.duration=s,this.audioTrack.duration=s}void 0!==a.width&&(this.videoTrack.width=a.width),void 0!==a.height&&(this.videoTrack.height=a.height)}}},{key:"_parseAudio",value:function(e,n){var r=t.allocUnsafe(2);this.reader.read(r,this.pos);var o=r[0],a=1&o,s=(2&o)>>1,u=(12&o)>>2,l=(240&o)>>4;if(i.AUDIO_FORMAT_AAC===l)if(0===r[1]){this.audioTrack.channels=1===a?2:1,this.audioTrack.sampleRate=5512.5*(1<<u)<<0,this.audioTrack.sampleSize=1===s?16:8;var f=t.allocUnsafe(4+e-2);f.write("mp4a"),this.reader.read(f,this.pos+2,4),this.audioTrack.extraData=f,this.audioTrack.codec=h.parse(f).codec()}else{var p=Object.create(c.prototype);p.timestamp=n,p.timescale=this.audioTrack.timescale,p.size=e-2,p.offset=this.pos+2,0<p.size&&this.audioTrack.samples.push(p)}}},{key:"_parseVideo",value:function(e,n){var r=t.allocUnsafe(5);this.reader.read(r,this.pos);var o=r[0],a=15&o,s=(240&o)>>4,u=r.readUIntBE(2,3);if(i.VIDEO_FORMAT_H264===a)if(0===r[1]){var c=t.allocUnsafe(4+e-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 f=Object.create(l.prototype);f.timestamp=n,f.timescale=this.videoTrack.timescale,f.size=e-5,f.offset=this.pos+5,f.compositionOffset=u,f.keyframe=1===s,0<f.size&&this.videoTrack.samples.push(f)}}}])&&r(n.prototype,p),y&&r(n,y),e}();e.exports=p}).call(this,n(2).Buffer)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(t){r(this,e),this.buffer=t,this.pos=0}return i(e,[{key:"read",value:function(){for(var e=[];this.pos<this.buffer.length;)e.push(this._readByType(this._readByte()));return e}},{key:"_readByType",value:function(e){switch(e){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 e=this.buffer.readDoubleBE(this.pos);return this.pos+=8,e}},{key:"_readBoolean",value:function(){return 0!==this._readByte()}},{key:"_readString",value:function(){var e=this.buffer.readUInt16BE(this.pos);this.pos+=2;var t=this.buffer.toString("utf8",this.pos,this.pos+e);return this.pos+=e,t}},{key:"_readObject",value:function(){var e,t,n={};do{e=this._readString(),9!==(t=this._readByte())&&(n[e]=this._readByType(t))}while(9!==t);return n}},{key:"_readReference",value:function(){var e=this.buffer.readUInt16BE(this.pos);return this.pos+=2,"Reference #".concat(e)}},{key:"_readEcmaArray",value:function(){return this.pos+=4,this._readObject()}},{key:"_readStrictArray",value:function(){var e=this.buffer.readUInt32BE(this.pos);this.pos+=4;for(var t=[],n=0;n<e;n++)t.push(this._readByType(this._readByte()));return t}},{key:"_readDate",value:function(){var e=this.buffer.readDoubleBE(this.pos+2);return this.pos+=10,e}},{key:"_readLongString",value:function(){var e=this.buffer.readUInt32BE(this.pos);this.pos+=4;var t=this.buffer.toString("utf8",this.pos,this.pos+e);return this.pos+=e,t}},{key:"_readXmlDocument",value:function(){return this._readLongString()}}]),e}(),s=function(){function e(){r(this,e)}return i(e,null,[{key:"parse",value:function(e){return new a(e).read()}}]),e}();e.exports=s},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(15),i=n(71),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,a;return t=e,a=[{key:"packetize",value:function(e,t){if(!(e instanceof o))throw new Error("Argument 1 should be instance of Fragment");return new i(e,t).packFragment()}}],(n=null)&&r(t.prototype,n),a&&r(t,a),e}();e.exports=a},function(e,t,n){"use strict";(function(t){var r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(72),s=n(73),u=n(4),c=n(5),l=n(18),f=n(11),h=(i(r={},f.CODEC_AAC,15),i(r,f.CODEC_H264,27),i(r,f.CODEC_H265,36),r),p=function(){function e(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fragment=n,this.sampleBuffers=r,this._counter=new s,this.fragment.hasAudio()?this._audioCodecInfo=l.parse(this.fragment.audioExtraData):this._audioCodecInfo=null,this.fragment.hasVideo()?(this._videoCodecInfo=l.parse(this.fragment.videoExtraData),this._videoConfig=this._buildVideoConfig()):(this._videoCodecInfo=null,this._videoConfig=t.allocUnsafe(0))}var n,r,i;return n=e,i=[{key:"_writeTime",value:function(e,t,n,r){return e[t+0]=n>>29&14|240&r|1,e[t+1]=n>>22,e[t+2]=n>>14|1,e[t+3]=n>>7,e[t+4]=n<<1|1,5}},{key:"_writePid",value:function(e,t,n){return e[t+0]=224+(n>>8&31),e[t+1]=255&n,e[t+2]=240,e[t+3]=0,4}}],(r=[{key:"packFragment",value:function(){var e=[],n=0,r=90*this.fragment.timescale,o=this._buildHeader();e.push(o),n+=o.length;for(var i=[],a=0,s=null,l=0,f=function(){var r=this._packAudioPayload(t.concat(i,a),s,l);e.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&&f(),0===i.length&&(s=y,l=m),i.push(v),a+=v.length}else if(y instanceof u){i.length>0&&f();var g=m+(r*y.compositionOffset/y.timescale<<0),b=this._convertVideoSample(d,y.keyframe),w=this._packVideoPayload(b,y,g,m);e.push(w),n+=w.length}}return i.length>0&&f(),t.concat(e,n)}},{key:"_convertAudioSample",value:function(e){var n=7+e.length,r=t.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,e.copy(r,7),r}},{key:"_convertVideoSample",value:function(e,n){var r=6+e.length+(n?this._videoConfig.length:0);this._videoCodecInfo.type()===f.CODEC_H265&&r++;var o=t.allocUnsafe(r),i=0;for(o.writeUInt32BE(1,i),i+=4,this._videoCodecInfo.type()===f.CODEC_H265?(o[i++]=70,o[i++]=1):o[i++]=9,o[i++]=16,n&&(this._videoConfig.copy(o,i),i+=this._videoConfig.length),e.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=t.allocUnsafe(14+n.length),a=0,s=8+n.length;return i[a++]=0,i[a++]=0,i[a++]=1,i[a++]=192,i[a++]=s>>8&255,i[a++]=255&s,i[a++]=128,i[a++]=128,i[a++]=5,a+=e._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=t.allocUnsafe(19+n.length),s=0;return a[s++]=0,a[s++]=0,a[s++]=1,a[s++]=224,a[s++]=0,a[s++]=0,a[s++]=128,a[s++]=192,a[s++]=10,s+=e._writeTime(a,s,o,48),s+=e._writeTime(a,s,i,16),n.copy(a,s),this._packPayload(a,r,256,i)}},{key:"_packPayload",value:function(e,n,r,o){var i=Math.ceil(e.length/184);n instanceof u&&184*i-8<e.length&&i++;for(var a=t.allocUnsafe(188*i),s=0,c=0;c<i;c++){var l=e.length-s,f=!1;(0===c&&n instanceof u||l<184)&&(f=!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)+(f?48:16),f){var p=0;if(n instanceof u&&0===c&&(p=7),l<183&&(p=Math.max(p,183-l)),a[h++]=p,0<p){var y=1,d=0;n instanceof u&&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&&(e.copy(a,h,s,s+m),s+=m)}return a}},{key:"_buildHeader",value:function(){var n=t.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+=e._writePid(n,r,i),this.fragment.hasVideo()&&(n[r++]=h[this._videoCodecInfo.type()]||0,r+=e._writePid(n,r,256)),this.fragment.hasAudio()&&(n[r++]=h[this._audioCodecInfo.type()]||0,r+=e._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 e=this._videoCodecInfo.units(),n=t.allocUnsafe(4*e.length+e.reduce(function(e,t){return e+t.length},0)),r=0,o=0,i=e.length;o<i;o++){var a=e[o];n.writeUInt32BE(1,r),a.copy(n,r+4),r+=a.length+4}return n}}])&&o(n.prototype,r),i&&o(n,i),e}();e.exports=p}).call(this,n(2).Buffer)},function(e,t,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];e.exports={checksum:function(e,t,n){t=t||0,n=n||e.length;for(var o,i,a=-1,s=t;s<n;s++)o=255&(a^e[s]),a=r[o]^a>>8&16777215;return(i=a)>>>24|i>>8&65280|i<<8&16711680|i<<24}}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(5),i=n(4),a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._audioCounter=0,this._videoCounter=0}var t,n,a;return t=e,(n=[{key:"next",value:function(e){var t=0;return e instanceof o?(t=this._audioCounter,this._audioCounter=this._audioCounter+1&15):e instanceof i&&(t=this._videoCounter,this._videoCounter=this._videoCounter+1&15),t}}])&&r(t.prototype,n),a&&r(t,a),e}();e.exports=a},,function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}if(n.r(t),"undefined"==typeof o)var o={};o.MD5=function(e){function t(e){var t=(e>>>0).toString(16);return"00000000".substr(0,8-t.length)+t}function n(e,t,n){return e&t|~e&n}function o(e,t,n){return n&e|~n&t}function i(e,t,n){return e^t^n}function a(e,t,n){return t^(e|~n)}function s(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e){for(var t=[],n=0;n<e.length;n++)if(e.charCodeAt(n)<=127)t.push(e.charCodeAt(n));else for(var r=encodeURIComponent(e.charAt(n)).substr(1).split("%"),o=0;o<r.length;o++)t.push(parseInt(r[o],16));return t}function c(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}var l=null,f=null;function h(e,t){return 4294967295&e+t}return"string"==typeof e?l=u(e):e.constructor==Array?0===e.length?l=e:"string"==typeof e[0]?l=function(e){for(var t=[],n=0;n<e.length;n++)t=t.concat(u(e[n]));return t}(e):"number"==typeof e[0]?l=e:f=r(e[0]):"undefined"!=typeof ArrayBuffer?e instanceof ArrayBuffer?l=c(new Uint8Array(e)):e instanceof Uint8Array||e instanceof Int8Array?l=c(e):e instanceof Uint32Array||e instanceof Int32Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Float32Array||e instanceof Float64Array?l=c(new Uint8Array(e.buffer)):f=r(e):f=r(e),f&&alert("MD5 type mismatch, cannot process "+f),function(){function e(e,t,n,r){var o,i,a=b;b=g,g=v,v=h(v,(o=h(m,h(e,h(t,n))))<<(i=r)&4294967295|o>>>32-i),m=a}var r=l.length;l.push(128);var u=l.length%64;if(u>56){for(var c=0;c<64-u;c++)l.push(0);u=l.length%64}for(c=0;c<56-u;c++)l.push(0);l=l.concat(function(e){for(var t=[],n=0;n<8;n++)t.push(255&e),e>>>=8;return t}(8*r));var f=1732584193,p=4023233417,y=2562383102,d=271733878,m=0,v=0,g=0,b=0;for(c=0;c<l.length/64;c++){m=f;var w=64*c;e(n(v=p,g=y,b=d),3614090360,s(l,w),7),e(n(v,g,b),3905402710,s(l,w+4),12),e(n(v,g,b),606105819,s(l,w+8),17),e(n(v,g,b),3250441966,s(l,w+12),22),e(n(v,g,b),4118548399,s(l,w+16),7),e(n(v,g,b),1200080426,s(l,w+20),12),e(n(v,g,b),2821735955,s(l,w+24),17),e(n(v,g,b),4249261313,s(l,w+28),22),e(n(v,g,b),1770035416,s(l,w+32),7),e(n(v,g,b),2336552879,s(l,w+36),12),e(n(v,g,b),4294925233,s(l,w+40),17),e(n(v,g,b),2304563134,s(l,w+44),22),e(n(v,g,b),1804603682,s(l,w+48),7),e(n(v,g,b),4254626195,s(l,w+52),12),e(n(v,g,b),2792965006,s(l,w+56),17),e(n(v,g,b),1236535329,s(l,w+60),22),e(o(v,g,b),4129170786,s(l,w+4),5),e(o(v,g,b),3225465664,s(l,w+24),9),e(o(v,g,b),643717713,s(l,w+44),14),e(o(v,g,b),3921069994,s(l,w),20),e(o(v,g,b),3593408605,s(l,w+20),5),e(o(v,g,b),38016083,s(l,w+40),9),e(o(v,g,b),3634488961,s(l,w+60),14),e(o(v,g,b),3889429448,s(l,w+16),20),e(o(v,g,b),568446438,s(l,w+36),5),e(o(v,g,b),3275163606,s(l,w+56),9),e(o(v,g,b),4107603335,s(l,w+12),14),e(o(v,g,b),1163531501,s(l,w+32),20),e(o(v,g,b),2850285829,s(l,w+52),5),e(o(v,g,b),4243563512,s(l,w+8),9),e(o(v,g,b),1735328473,s(l,w+28),14),e(o(v,g,b),2368359562,s(l,w+48),20),e(i(v,g,b),4294588738,s(l,w+20),4),e(i(v,g,b),2272392833,s(l,w+32),11),e(i(v,g,b),1839030562,s(l,w+44),16),e(i(v,g,b),4259657740,s(l,w+56),23),e(i(v,g,b),2763975236,s(l,w+4),4),e(i(v,g,b),1272893353,s(l,w+16),11),e(i(v,g,b),4139469664,s(l,w+28),16),e(i(v,g,b),3200236656,s(l,w+40),23),e(i(v,g,b),681279174,s(l,w+52),4),e(i(v,g,b),3936430074,s(l,w),11),e(i(v,g,b),3572445317,s(l,w+12),16),e(i(v,g,b),76029189,s(l,w+24),23),e(i(v,g,b),3654602809,s(l,w+36),4),e(i(v,g,b),3873151461,s(l,w+48),11),e(i(v,g,b),530742520,s(l,w+60),16),e(i(v,g,b),3299628645,s(l,w+8),23),e(a(v,g,b),4096336452,s(l,w),6),e(a(v,g,b),1126891415,s(l,w+28),10),e(a(v,g,b),2878612391,s(l,w+56),15),e(a(v,g,b),4237533241,s(l,w+20),21),e(a(v,g,b),1700485571,s(l,w+48),6),e(a(v,g,b),2399980690,s(l,w+12),10),e(a(v,g,b),4293915773,s(l,w+40),15),e(a(v,g,b),2240044497,s(l,w+4),21),e(a(v,g,b),1873313359,s(l,w+32),6),e(a(v,g,b),4264355552,s(l,w+60),10),e(a(v,g,b),2734768916,s(l,w+24),15),e(a(v,g,b),1309151649,s(l,w+52),21),e(a(v,g,b),4149444226,s(l,w+16),6),e(a(v,g,b),3174756917,s(l,w+44),10),e(a(v,g,b),718787259,s(l,w+8),15),e(a(v,g,b),3951481745,s(l,w+36),21),f=h(f,m),p=h(p,v),y=h(y,g),d=h(d,b)}return function(e,n,r,o){for(var i="",a=0,s=0,u=3;u>=0;u--)a=255&(s=arguments[u]),a<<=8,a|=255&(s>>>=8),a<<=8,a|=255&(s>>>=8),a<<=8,i+=t(a|=s>>>=8);return i}(d,y,p,f).toUpperCase()}()};var i=function(e){return o.MD5(e)};var a={log:function(){},error:function(){},count:function(){},info:function(){}};function s(){var e=navigator.userAgent.toLowerCase(),t=navigator.appName,n=null;return"Microsoft Internet Explorer"===t||e.indexOf("trident")>-1||e.indexOf("edge/")>-1?(n="ie","Microsoft Internet Explorer"===t?(e=/msie ([0-9]{1,}[\.0-9]{0,})/.exec(e),n+=parseInt(e[1])):e.indexOf("trident")>-1?n+=11:e.indexOf("edge/")>-1&&(n="edge")):e.indexOf("safari")>-1?n=e.indexOf("chrome")>-1?"chrome":"safari":e.indexOf("firefox")>-1&&(n="firefox"),n}var u=function(){function e(){}return e.createFromElementId=function(t){for(var n=document.getElementById(t),r="",o=n.firstChild;o;)3===o.nodeType&&(r+=o.textContent),o=o.nextSibling;var i=new e;return i.type=n.type,i.source=r,i},e.createFromSource=function(t,n){var r=new e;return r.type=t,r.source=n,r},e}(),c=function(){return function(e,t){if("x-shader/x-fragment"===t.type)this.shader=e.createShader(e.FRAGMENT_SHADER);else{if("x-shader/x-vertex"!==t.type)return void error("Unknown shader type: "+t.type);this.shader=e.createShader(e.VERTEX_SHADER)}e.shaderSource(this.shader,t.source),e.compileShader(this.shader),e.getShaderParameter(this.shader,e.COMPILE_STATUS)||error("An error occurred compiling the shaders: "+e.getShaderInfoLog(this.shader))}}(),l=function(){function e(e){this.gl=e,this.program=this.gl.createProgram()}return e.prototype={attach:function(e){this.gl.attachShader(this.program,e.shader)},link:function(){this.gl.linkProgram(this.program)},use:function(){this.gl.useProgram(this.program)},getAttributeLocation:function(e){return this.gl.getAttribLocation(this.program,e)},setMatrixUniform:function(e,t){var n=this.gl.getUniformLocation(this.program,e);this.gl.uniformMatrix4fv(n,!1,t)}},e}(),f=function(){var e=null;function t(e,t,n){this.gl=e,this.size=t,this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),this.format=n||e.LUMINANCE,e.texImage2D(e.TEXTURE_2D,0,this.format,t.w,t.h,0,this.format,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}return t.prototype={fill:function(e,t){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),t?n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.size.w,this.size.h,this.format,n.UNSIGNED_BYTE,e):n.texImage2D(n.TEXTURE_2D,0,this.format,this.size.w,this.size.h,0,this.format,n.UNSIGNED_BYTE,e)},bind:function(t,n,r){var o=this.gl;e||(e=[o.TEXTURE0,o.TEXTURE1,o.TEXTURE2]),o.activeTexture(e[t]),o.bindTexture(o.TEXTURE_2D,this.texture),o.uniform1i(o.getUniformLocation(n.program,r),t)}},t}();function h(e){for(var t=e.length,n=new Uint8Array(new ArrayBuffer(t)),r=0;r<t;r++)n[r]=e.charCodeAt(r);return n}function p(e,t,n,r,o,a){var s,u;return s=i(e+":"+r+":"+t).toLowerCase(),u=i(a+":"+n).toLowerCase(),i(s+":"+o+":"+u).toLowerCase()}var y=1e-6;function d(){}function m(){}function v(){}function g(){}d.prototype={e:function(e){return e<1||e>this.elements.length?null:this.elements[e-1]},dimensions:function(){return this.elements.length},modulus:function(){return Math.sqrt(this.dot(this))},eql:function(e){var t=this.elements.length,n=e.elements||e;if(t!=n.length)return!1;do{if(Math.abs(this.elements[t-1]-n[t-1])>y)return!1}while(--t);return!0},dup:function(){return d.create(this.elements)},map:function(e){var t=[];return this.each(function(n,r){t.push(e(n,r))}),d.create(t)},each:function(e){var t,n=this.elements.length,r=n;do{t=r-n,e(this.elements[t],t+1)}while(--n)},toUnitVector:function(){var e=this.modulus();return 0===e?this.dup():this.map(function(t){return t/e})},angleFrom:function(e){var t=e.elements||e,n=this.elements.length;if(n!=t.length)return null;var r=0,o=0,i=0;if(this.each(function(e,n){r+=e*t[n-1],o+=e*e,i+=t[n-1]*t[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(e){var t=this.angleFrom(e);return null===t?null:t<=y},isAntiparallelTo:function(e){var t=this.angleFrom(e);return null===t?null:Math.abs(t-Math.PI)<=y},isPerpendicularTo:function(e){var t=this.dot(e);return null===t?null:Math.abs(t)<=y},add:function(e){var t=e.elements||e;return this.elements.length!=t.length?null:this.map(function(e,n){return e+t[n-1]})},subtract:function(e){var t=e.elements||e;return this.elements.length!=t.length?null:this.map(function(e,n){return e-t[n-1]})},multiply:function(e){return this.map(function(t){return t*e})},x:function(e){return this.multiply(e)},dot:function(e){var t=e.elements||e,n=0,r=this.elements.length;if(r!=t.length)return null;do{n+=this.elements[r-1]*t[r-1]}while(--r);return n},cross:function(e){var t=e.elements||e;if(3!=this.elements.length||3!=t.length)return null;var n=this.elements;return d.create([n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]])},max:function(){var e,t=0,n=this.elements.length,r=n;do{e=r-n,Math.abs(this.elements[e])>Math.abs(t)&&(t=this.elements[e])}while(--n);return t},indexOf:function(e){var t,n=null,r=this.elements.length,o=r;do{t=o-r,null===n&&this.elements[t]==e&&(n=t+1)}while(--r);return n},toDiagonalMatrix:function(){return m.Diagonal(this.elements)},round:function(){return this.map(function(e){return Math.round(e)})},snapTo:function(e){return this.map(function(t){return Math.abs(t-e)<=y?e:t})},distanceFrom:function(e){if(e.anchor)return e.distanceFrom(this);var t=e.elements||e;if(t.length!=this.elements.length)return null;var n,r=0;return this.each(function(e,o){n=e-t[o-1],r+=n*n}),Math.sqrt(r)},liesOn:function(e){return e.contains(this)},liesIn:function(e){return e.contains(this)},rotate:function(e,t){var n,r,o,i,a;switch(this.elements.length){case 2:return 2!=(n=t.elements||t).length?null:(r=m.Rotation(e).elements,o=this.elements[0]-n[0],i=this.elements[1]-n[1],d.create([n[0]+r[0][0]*o+r[0][1]*i,n[1]+r[1][0]*o+r[1][1]*i]));case 3:if(!t.direction)return null;var s=t.pointClosestTo(this).elements;return r=m.Rotation(e,t.direction).elements,o=this.elements[0]-s[0],i=this.elements[1]-s[1],a=this.elements[2]-s[2],d.create([s[0]+r[0][0]*o+r[0][1]*i+r[0][2]*a,s[1]+r[1][0]*o+r[1][1]*i+r[1][2]*a,s[2]+r[2][0]*o+r[2][1]*i+r[2][2]*a]);default:return null}},reflectionIn:function(e){if(e.anchor){var t=this.elements.slice(),n=e.pointClosestTo(t).elements;return d.create([n[0]+(n[0]-t[0]),n[1]+(n[1]-t[1]),n[2]+(n[2]-(t[2]||0))])}var r=e.elements||e;return this.elements.length!=r.length?null:this.map(function(e,t){return r[t-1]+(r[t-1]-e)})},to3D:function(){var e=this.dup();switch(e.elements.length){case 3:break;case 2:e.elements.push(0);break;default:return null}return e},inspect:function(){return"["+this.elements.join(", ")+"]"},setElements:function(e){return this.elements=(e.elements||e).slice(),this}},d.create=function(e){return(new d).setElements(e)},d.i=d.create([1,0,0]),d.j=d.create([0,1,0]),d.k=d.create([0,0,1]),d.Random=function(e){var t=[];do{t.push(Math.random())}while(--e);return d.create(t)},d.Zero=function(e){var t=[];do{t.push(0)}while(--e);return d.create(t)},m.prototype={e:function(e,t){return e<1||e>this.elements.length||t<1||t>this.elements[0].length?null:this.elements[e-1][t-1]},row:function(e){return e>this.elements.length?null:d.create(this.elements[e-1])},col:function(e){if(e>this.elements[0].length)return null;var t,n=[],r=this.elements.length,o=r;do{t=o-r,n.push(this.elements[t][e-1])}while(--r);return d.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(e){var t=e.elements||e;if("undefined"==typeof t[0][0]&&(t=m.create(t).elements),this.elements.length!=t.length||this.elements[0].length!=t[0].length)return!1;var n,r,o,i=this.elements.length,a=i,s=this.elements[0].length;do{n=a-i,r=s;do{if(o=s-r,Math.abs(this.elements[n][o]-t[n][o])>y)return!1}while(--r)}while(--i);return!0},dup:function(){return m.create(this.elements)},map:function(e){var t,n,r,o=[],i=this.elements.length,a=i,s=this.elements[0].length;do{n=s,o[t=a-i]=[];do{r=s-n,o[t][r]=e(this.elements[t][r],t+1,r+1)}while(--n)}while(--i);return m.create(o)},isSameSizeAs:function(e){var t=e.elements||e;return"undefined"==typeof t[0][0]&&(t=m.create(t).elements),this.elements.length==t.length&&this.elements[0].length==t[0].length},add:function(e){var t=e.elements||e;return"undefined"==typeof t[0][0]&&(t=m.create(t).elements),this.isSameSizeAs(t)?this.map(function(e,n,r){return e+t[n-1][r-1]}):null},subtract:function(e){var t=e.elements||e;return"undefined"==typeof t[0][0]&&(t=m.create(t).elements),this.isSameSizeAs(t)?this.map(function(e,n,r){return e-t[n-1][r-1]}):null},canMultiplyFromLeft:function(e){var t=e.elements||e;return"undefined"==typeof t[0][0]&&(t=m.create(t).elements),this.elements[0].length==t.length},multiply:function(e){if(!e.elements)return this.map(function(t){return t*e});var t=!!e.modulus;if("undefined"==typeof(p=e.elements||e)[0][0]&&(p=m.create(p).elements),!this.canMultiplyFromLeft(p))return null;var n,r,o,i,a,s,u=this.elements.length,c=u,l=p[0].length,f=this.elements[0].length,h=[];do{h[n=c-u]=[],r=l;do{o=l-r,i=0,a=f;do{s=f-a,i+=this.elements[n][s]*p[s][o]}while(--a);h[n][o]=i}while(--r)}while(--u);var p=m.create(h);return t?p.col(1):p},x:function(e){return this.multiply(e)},minor:function(e,t,n,r){var o,i,a,s=[],u=n,c=this.elements.length,l=this.elements[0].length;do{s[o=n-u]=[],i=r;do{a=r-i,s[o][a]=this.elements[(e+o-1)%c][(t+a-1)%l]}while(--i)}while(--u);return m.create(s)},transpose:function(){var e,t,n,r=this.elements.length,o=this.elements[0].length,i=[],a=o;do{i[e=o-a]=[],t=r;do{n=r-t,i[e][n]=this.elements[n][e]}while(--t)}while(--a);return m.create(i)},isSquare:function(){return this.elements.length==this.elements[0].length},max:function(){var e,t,n,r=0,o=this.elements.length,i=o,a=this.elements[0].length;do{e=i-o,t=a;do{n=a-t,Math.abs(this.elements[e][n])>Math.abs(r)&&(r=this.elements[e][n])}while(--t)}while(--o);return r},indexOf:function(e){var t,n,r,o=this.elements.length,i=o,a=this.elements[0].length;do{t=i-o,n=a;do{if(r=a-n,this.elements[t][r]==e)return{i:t+1,j:r+1}}while(--n)}while(--o);return null},diagonal:function(){if(!this.isSquare)return null;var e,t=[],n=this.elements.length,r=n;do{e=r-n,t.push(this.elements[e][e])}while(--n);return d.create(t)},toRightTriangular:function(){var e,t,n,r,o=this.dup(),i=this.elements.length,a=i,s=this.elements[0].length;do{if(t=a-i,0==o.elements[t][t])for(j=t+1;j<a;j++)if(0!=o.elements[j][t]){e=[],n=s;do{r=s-n,e.push(o.elements[t][r]+o.elements[j][r])}while(--n);o.elements[t]=e;break}if(0!=o.elements[t][t])for(j=t+1;j<a;j++){var u=o.elements[j][t]/o.elements[t][t];e=[],n=s;do{r=s-n,e.push(r<=t?0:o.elements[j][r]-o.elements[t][r]*u)}while(--n);o.elements[j]=e}}while(--i);return o},toUpperTriangular:function(){return this.toRightTriangular()},determinant:function(){if(!this.isSquare())return null;var e,t=this.toRightTriangular(),n=t.elements[0][0],r=t.elements.length-1,o=r;do{e=o-r+1,n*=t.elements[e][e]}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 e,t=this.elements[0][0],n=this.elements.length-1,r=n;do{e=r-n+1,t+=this.elements[e][e]}while(--n);return t},tr:function(){return this.trace()},rank:function(){var e,t,n,r=this.toRightTriangular(),o=0,i=this.elements.length,a=i,s=this.elements[0].length;do{e=a-i,t=s;do{if(n=s-t,Math.abs(r.elements[e][n])>y){o++;break}}while(--t)}while(--i);return o},rk:function(){return this.rank()},augment:function(e){var t=e.elements||e;"undefined"==typeof t[0][0]&&(t=m.create(t).elements);var n,r,o,i=this.dup(),a=i.elements[0].length,s=i.elements.length,u=s,c=t[0].length;if(s!=t.length)return null;do{n=u-s,r=c;do{o=c-r,i.elements[n][a+o]=t[n][o]}while(--r)}while(--s);return i},inverse:function(){if(!this.isSquare()||this.isSingular())return null;var e,t,n,r,o,i,a,s=this.elements.length,u=s,c=this.augment(m.I(s)).toRightTriangular(),l=c.elements[0].length,f=[];do{o=[],n=l,f[e=s-1]=[],i=c.elements[e][e];do{r=l-n,a=c.elements[e][r]/i,o.push(a),r>=u&&f[e].push(a)}while(--n);for(c.elements[e]=o,t=0;t<e;t++){o=[],n=l;do{r=l-n,o.push(c.elements[t][r]-c.elements[e][r]*c.elements[t][e])}while(--n);c.elements[t]=o}}while(--s);return m.create(f)},inv:function(){return this.inverse()},round:function(){return this.map(function(e){return Math.round(e)})},snapTo:function(e){return this.map(function(t){return Math.abs(t-e)<=y?e:t})},inspect:function(){var e,t=[],n=this.elements.length,r=n;do{e=r-n,t.push(d.create(this.elements[e]).inspect())}while(--n);return t.join("\n")},setElements:function(e){var t,n=e.elements||e;if("undefined"!=typeof n[0][0]){var r,o,i,a=n.length,s=a;this.elements=[];do{o=r=n[t=s-a].length,this.elements[t]=[];do{i=o-r,this.elements[t][i]=n[t][i]}while(--r)}while(--a);return this}var u=n.length,c=u;this.elements=[];do{t=c-u,this.elements.push([n[t]])}while(--u);return this}},m.create=function(e){return(new m).setElements(e)},m.I=function(e){var t,n,r,o=[],i=e;do{o[t=i-e]=[],n=i;do{r=i-n,o[t][r]=t==r?1:0}while(--n)}while(--e);return m.create(o)},m.Diagonal=function(e){var t,n=e.length,r=n,o=m.I(n);do{t=r-n,o.elements[t][t]=e[t]}while(--n);return o},m.Rotation=function(e,t){if(!t)return m.create([[Math.cos(e),-Math.sin(e)],[Math.sin(e),Math.cos(e)]]);var n=t.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,s=Math.sin(e),u=Math.cos(e),c=1-u;return m.create([[c*o*o+u,c*o*i-s*a,c*o*a+s*i],[c*o*i+s*a,c*i*i+u,c*i*a-s*o],[c*o*a-s*i,c*i*a+s*o,c*a*a+u]])},m.RotationX=function(e){var t=Math.cos(e),n=Math.sin(e);return m.create([[1,0,0],[0,t,-n],[0,n,t]])},m.RotationY=function(e){var t=Math.cos(e),n=Math.sin(e);return m.create([[t,0,n],[0,1,0],[-n,0,t]])},m.RotationZ=function(e){var t=Math.cos(e),n=Math.sin(e);return m.create([[t,-n,0],[n,t,0],[0,0,1]])},m.Random=function(e,t){return m.Zero(e,t).map(function(){return Math.random()})},m.Zero=function(e,t){var n,r,o,i=[],a=e;do{i[n=e-a]=[],r=t;do{o=t-r,i[n][o]=0}while(--r)}while(--a);return m.create(i)},v.prototype={eql:function(e){return this.isParallelTo(e)&&this.contains(e.anchor)},dup:function(){return v.create(this.anchor,this.direction)},translate:function(e){var t=e.elements||e;return v.create([this.anchor.elements[0]+t[0],this.anchor.elements[1]+t[1],this.anchor.elements[2]+(t[2]||0)],this.direction)},isParallelTo:function(e){if(e.normal)return e.isParallelTo(this);var t=this.direction.angleFrom(e.direction);return Math.abs(t)<=y||Math.abs(t-Math.PI)<=y},distanceFrom:function(e){if(e.normal)return e.distanceFrom(this);if(e.direction){if(this.isParallelTo(e))return this.distanceFrom(e.anchor);var t=this.direction.cross(e.direction).toUnitVector().elements,n=this.anchor.elements,r=e.anchor.elements;return Math.abs((n[0]-r[0])*t[0]+(n[1]-r[1])*t[1]+(n[2]-r[2])*t[2])}var o=e.elements||e,i=(n=this.anchor.elements,this.direction.elements),a=o[0]-n[0],s=o[1]-n[1],u=(o[2]||0)-n[2],c=Math.sqrt(a*a+s*s+u*u);if(0===c)return 0;var l=(a*i[0]+s*i[1]+u*i[2])/c,f=1-l*l;return Math.abs(c*Math.sqrt(f<0?0:f))},contains:function(e){var t=this.distanceFrom(e);return null!==t&&t<=y},liesIn:function(e){return e.contains(this)},intersects:function(e){return e.normal?e.intersects(this):!this.isParallelTo(e)&&this.distanceFrom(e)<=y},intersectionWith:function(e){if(e.normal)return e.intersectionWith(this);if(!this.intersects(e))return null;var t=this.anchor.elements,n=this.direction.elements,r=e.anchor.elements,o=e.direction.elements,i=n[0],a=n[1],s=n[2],u=o[0],c=o[1],l=o[2],f=t[0]-r[0],h=t[1]-r[1],p=t[2]-r[2],y=u*u+c*c+l*l,m=i*u+a*c+s*l,v=((-i*f-a*h-s*p)*y/(i*i+a*a+s*s)+m*(u*f+c*h+l*p))/(y-m*m);return d.create([t[0]+v*i,t[1]+v*a,t[2]+v*s])},pointClosestTo:function(e){if(e.direction){if(this.intersects(e))return this.intersectionWith(e);if(this.isParallelTo(e))return null;var t=this.direction.elements,n=e.direction.elements,r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],u=n[2],c=i*a-r*u,l=r*s-o*a,f=o*u-i*s,h=d.create([c*u-l*s,l*a-f*u,f*s-c*a]);return(p=g.create(e.anchor,h)).intersectionWith(this)}var p=e.elements||e;if(this.contains(p))return d.create(p);var y=this.anchor.elements,m=(r=(t=this.direction.elements)[0],o=t[1],i=t[2],y[0]),v=y[1],b=y[2],w=(c=r*(p[1]-v)-o*(p[0]-m),l=o*((p[2]||0)-b)-i*(p[1]-v),f=i*(p[0]-m)-r*((p[2]||0)-b),d.create([o*c-i*f,i*l-r*c,r*f-o*l])),S=this.distanceFrom(p)/w.modulus();return d.create([p[0]+w.elements[0]*S,p[1]+w.elements[1]*S,(p[2]||0)+w.elements[2]*S])},rotate:function(e,t){"undefined"==typeof t.direction&&(t=v.create(t.to3D(),d.k));var n=m.Rotation(e,t.direction).elements,r=t.pointClosestTo(this.anchor).elements,o=this.anchor.elements,i=this.direction.elements,a=r[0],s=r[1],u=r[2],c=o[0]-a,l=o[1]-s,f=o[2]-u;return v.create([a+n[0][0]*c+n[0][1]*l+n[0][2]*f,s+n[1][0]*c+n[1][1]*l+n[1][2]*f,u+n[2][0]*c+n[2][1]*l+n[2][2]*f],[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(e){if(e.normal){var t=this.anchor.elements,n=this.direction.elements,r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],u=n[2],c=this.anchor.reflectionIn(e).elements,l=r+a,f=o+s,h=i+u,p=e.pointClosestTo([l,f,h]).elements,y=[p[0]+(p[0]-l)-c[0],p[1]+(p[1]-f)-c[1],p[2]+(p[2]-h)-c[2]];return v.create(c,y)}if(e.direction)return this.rotate(Math.PI,e);var d=e.elements||e;return v.create(this.anchor.reflectionIn([d[0],d[1],d[2]||0]),this.direction)},setVectors:function(e,t){if(e=d.create(e),t=d.create(t),2==e.elements.length&&e.elements.push(0),2==t.elements.length&&t.elements.push(0),e.elements.length>3||t.elements.length>3)return null;var n=t.modulus();return 0===n?null:(this.anchor=e,this.direction=d.create([t.elements[0]/n,t.elements[1]/n,t.elements[2]/n]),this)}},v.create=function(e,t){return(new v).setVectors(e,t)},v.X=v.create(d.Zero(3),d.i),v.Y=v.create(d.Zero(3),d.j),v.Z=v.create(d.Zero(3),d.k),g.prototype={eql:function(e){return this.contains(e.anchor)&&this.isParallelTo(e)},dup:function(){return g.create(this.anchor,this.normal)},translate:function(e){var t=e.elements||e;return g.create([this.anchor.elements[0]+t[0],this.anchor.elements[1]+t[1],this.anchor.elements[2]+(t[2]||0)],this.normal)},isParallelTo:function(e){var t;return e.normal?(t=this.normal.angleFrom(e.normal),Math.abs(t)<=y||Math.abs(Math.PI-t)<=y):e.direction?this.normal.isPerpendicularTo(e.direction):null},isPerpendicularTo:function(e){var t=this.normal.angleFrom(e.normal);return Math.abs(Math.PI/2-t)<=y},distanceFrom:function(e){if(this.intersects(e)||this.contains(e))return 0;if(e.anchor){var t=this.anchor.elements,n=e.anchor.elements,r=this.normal.elements;return Math.abs((t[0]-n[0])*r[0]+(t[1]-n[1])*r[1]+(t[2]-n[2])*r[2])}var o=e.elements||e;t=this.anchor.elements,r=this.normal.elements;return Math.abs((t[0]-o[0])*r[0]+(t[1]-o[1])*r[1]+(t[2]-(o[2]||0))*r[2])},contains:function(e){if(e.normal)return null;if(e.direction)return this.contains(e.anchor)&&this.contains(e.anchor.add(e.direction));var t=e.elements||e,n=this.anchor.elements,r=this.normal.elements;return Math.abs(r[0]*(n[0]-t[0])+r[1]*(n[1]-t[1])+r[2]*(n[2]-(t[2]||0)))<=y},intersects:function(e){return"undefined"==typeof e.direction&&"undefined"==typeof e.normal?null:!this.isParallelTo(e)},intersectionWith:function(e){if(!this.intersects(e))return null;if(e.direction){var t=e.anchor.elements,n=e.direction.elements,r=this.anchor.elements,o=((a=this.normal.elements)[0]*(r[0]-t[0])+a[1]*(r[1]-t[1])+a[2]*(r[2]-t[2]))/(a[0]*n[0]+a[1]*n[1]+a[2]*n[2]);return d.create([t[0]+n[0]*o,t[1]+n[1]*o,t[2]+n[2]*o])}if(e.normal){for(var i=this.normal.cross(e.normal).toUnitVector(),a=this.normal.elements,s=(t=this.anchor.elements,e.normal.elements),u=e.anchor.elements,c=m.Zero(2,2),l=0;c.isSingular();)l++,c=m.create([[a[l%3],a[(l+1)%3]],[s[l%3],s[(l+1)%3]]]);for(var f=c.inverse().elements,h=a[0]*t[0]+a[1]*t[1]+a[2]*t[2],p=s[0]*u[0]+s[1]*u[1]+s[2]*u[2],y=[f[0][0]*h+f[0][1]*p,f[1][0]*h+f[1][1]*p],g=[],b=1;b<=3;b++)g.push(l==b?0:y[(b+(5-l)%3)%3]);return v.create(g,i)}},pointClosestTo:function(e){var t=e.elements||e,n=this.anchor.elements,r=this.normal.elements,o=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-(t[2]||0))*r[2];return d.create([t[0]+r[0]*o,t[1]+r[1]*o,(t[2]||0)+r[2]*o])},rotate:function(e,t){var n=m.Rotation(e,t.direction).elements,r=t.pointClosestTo(this.anchor).elements,o=this.anchor.elements,i=this.normal.elements,a=r[0],s=r[1],u=r[2],c=o[0]-a,l=o[1]-s,f=o[2]-u;return g.create([a+n[0][0]*c+n[0][1]*l+n[0][2]*f,s+n[1][0]*c+n[1][1]*l+n[1][2]*f,u+n[2][0]*c+n[2][1]*l+n[2][2]*f],[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(e){if(e.normal){var t=this.anchor.elements,n=this.normal.elements,r=t[0],o=t[1],i=t[2],a=n[0],s=n[1],u=n[2],c=this.anchor.reflectionIn(e).elements,l=r+a,f=o+s,h=i+u,p=e.pointClosestTo([l,f,h]).elements,y=[p[0]+(p[0]-l)-c[0],p[1]+(p[1]-f)-c[1],p[2]+(p[2]-h)-c[2]];return g.create(c,y)}if(e.direction)return this.rotate(Math.PI,e);var d=e.elements||e;return g.create(this.anchor.reflectionIn([d[0],d[1],d[2]||0]),this.normal)},setVectors:function(e,t,n){if(null===(e=(e=d.create(e)).to3D()))return null;if(null===(t=(t=d.create(t)).to3D()))return null;if("undefined"==typeof n)n=null;else if(null===(n=(n=d.create(n)).to3D()))return null;var r,o,i=e.elements[0],a=e.elements[1],s=e.elements[2],u=t.elements[0],c=t.elements[1],l=t.elements[2];if(null!==n){var f=n.elements[0],h=n.elements[1],p=n.elements[2];if(0===(o=(r=d.create([(c-a)*(p-s)-(l-s)*(h-a),(l-s)*(f-i)-(u-i)*(p-s),(u-i)*(h-a)-(c-a)*(f-i)])).modulus()))return null;r=d.create([r.elements[0]/o,r.elements[1]/o,r.elements[2]/o])}else{if(0===(o=Math.sqrt(u*u+c*c+l*l)))return null;r=d.create([t.elements[0]/o,t.elements[1]/o,t.elements[2]/o])}return this.anchor=e,this.normal=r,this}},m.Translation=function(e){var t;if(2===e.elements.length)return(t=m.I(3)).elements[2][0]=e.elements[0],t.elements[2][1]=e.elements[1],t;if(3===e.elements.length)return(t=m.I(4)).elements[0][3]=e.elements[0],t.elements[1][3]=e.elements[1],t.elements[2][3]=e.elements[2],t;throw"Invalid length for Translation"},m.prototype.flatten=function(){var e=[];if(0===this.elements.length)return[];for(var t=0;t<this.elements[0].length;t++)for(var n=0;n<this.elements.length;n++)e.push(this.elements[n][t]);return e},m.prototype.ensure4x4=function(){var e;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(e=0;e<this.elements.length;e++)for(var t=this.elements[e].length;t<4;t++)e===t?this.elements[e].push(1):this.elements[e].push(0);for(e=this.elements.length;e<4;e++)0===e?this.elements.push([1,0,0,0]):1===e?this.elements.push([0,1,0,0]):2===e?this.elements.push([0,0,1,0]):3===e&&this.elements.push([0,0,0,1]);return this},m.prototype.make3x3=function(){return 4!==this.elements.length||4!==this.elements[0].length?null:m.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]]])},g.create=function(e,t,n){return(new g).setVectors(e,t,n)},g.XY=g.create(d.Zero(3),d.k),g.YZ=g.create(d.Zero(3),d.i),g.ZX=g.create(d.Zero(3),d.j),g.YX=g.XY,g.ZY=g.YZ,g.XZ=g.ZX;var b=d.create,w=m.create,S=(v.create,g.create,function(){function e(e,t,n){f.call(this,e,t,n)}return e.prototype=k(f,{fill:function(e,t){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),t?n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.size.w,this.size.h,this.format,n.UNSIGNED_BYTE,e):n.texImage2D(n.TEXTURE_2D,0,this.format,this.format,n.UNSIGNED_BYTE,e)}}),e}()),T=function(){var e=u.createFromSource("x-shader/x-vertex",E(["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;","}"])),t=u.createFromSource("x-shader/x-fragment",E(["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 r(e,t,r){this.canvas=e,this.size=t;var a=!0;for(var u in n)t.w===n[u]&&(a=!1);a?this.canvas.width=t.w:192===t.w?this.canvas.width=t.w-12:this.canvas.width=t.w-8,this.canvas.height=t.h,this.onInitWebGL(),this.onInitShaders(),function(){var e=[1,1,0,-1,1,0,1,-1,0,-1,-1,0],t=this.gl;this.quadVPBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.quadVPBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW),this.quadVPBuffer.itemSize=3,this.quadVPBuffer.numItems=4;this.quadVTCBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this.quadVTCBuffer),e=[1,0,0,0,1,1,0,1],t.bufferData(t.ARRAY_BUFFER,new Float32Array(e),t.STATIC_DRAW)}.call(this),r&&function(){var e=this.gl;this.framebuffer=e.createFramebuffer(),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this.framebufferTexture=new f(this.gl,this.size,e.RGBA);var t=e.createRenderbuffer();e.bindRenderbuffer(e.RENDERBUFFER,t),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,this.size.w,this.size.h),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.framebufferTexture.texture,0),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}.call(this),this.onInitTextures(),function(){var e=this.gl;this.perspectiveMatrix=function(e,t,n,r){var o=n*Math.tan(e*Math.PI/360),i=-o;return function(e,t,n,r,o,i){return w([[2*o/(t-e),0,(t+e)/(t-e),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*t,o*t,i,o,n,r)}(45,1,.1,100),o.call(this),i.call(this,[0,0,-2.415]),e.bindBuffer(e.ARRAY_BUFFER,this.quadVPBuffer),e.vertexAttribPointer(this.vertexPositionAttribute,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,this.quadVTCBuffer),e.vertexAttribPointer(this.textureCoordAttribute,2,e.FLOAT,!1,0,0),this.onInitSceneTextures(),s.call(this),this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer)}.call(this)}function o(){this.mvMatrix=m.I(4)}function i(e){(function(e){this.mvMatrix=this.mvMatrix.x(e)}).call(this,m.Translation(b([e[0],e[1],e[2]])).ensure4x4())}function s(){this.program.setMatrixUniform("uPMatrix",new Float32Array(this.perspectiveMatrix.flatten())),this.program.setMatrixUniform("uMVMatrix",new Float32Array(this.mvMatrix.flatten()))}return r.prototype={toString:function(){return"WebGLCanvas Size: "+this.size},checkLastError:function(e){var t=this.gl.getError();if(t!==this.gl.NO_ERROR){var n=this.glNames[t];n="undefined"!==typeof n?n+"("+t+")":"Unknown WebGL ENUM (0x"+value.toString(16)+")",e?a.log("WebGL Error: %s, %s",e,n):a.log("WebGL Error: %s",n),a.trace()}},onInitWebGL:function(){try{this.gl=this.canvas.getContext("experimental-webgl")}catch(e){a.log("inInitWebGL error = "+e)}if(this.gl||a.error("Unable to initialize WebGL. Your browser may not support it."),!this.glNames)for(var e in this.glNames={},this.gl)"number"===typeof this.gl[e]&&(this.glNames[this.gl[e]]=e)},onInitShaders:function(){this.program=new l(this.gl),this.program.attach(new c(this.gl,e)),this.program.attach(new c(this.gl,t)),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 e=this.gl;e.viewport(0,0,this.canvas.width,this.canvas.height),this.texture=new f(e,this.size,e.RGBA)},onInitSceneTextures:function(){this.texture.bind(0,this.program,"texture")},drawScene:function(){this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)},updateVertexArray:function(e){this.zoomScene(e)},readPixels:function(e){var t=this.gl;t.readPixels(0,0,this.size.w,this.size.h,t.RGBA,t.UNSIGNED_BYTE,e)},zoomScene:function(e){o.call(this),i.call(this,[e[0],e[1],e[2]]),s.call(this),this.drawScene()},setViewport:function(e,t){var n,r;a.log("toWidth="+e+",toHeight="+t),this.gl.drawingBufferWidth<e||this.gl.drawingBufferHeight<t?(n=this.gl.drawingBufferWidth,r=this.gl.drawingBufferHeight,this.canvas.width=n,this.canvas.height=r):(n=e,r=t),this.gl.viewport(0,0,n,r)},clearCanvas:function(){this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}},r}(),O=function(){function e(e,t){T.call(this,e,t)}return e.prototype=k(T,{drawCanvas:function(e){this.texture.fill(e),this.drawScene()},onInitTextures:function(){var e=this.gl;this.setViewport(this.canvas.width,this.canvas.height),this.texture=new S(e,this.size,e.RGBA)},initCanvas:function(){this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}}),e}(),_=function(){var e=u.createFromSource("x-shader/x-vertex",E(["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;","}"])),t=u.createFromSource("x-shader/x-fragment",E(["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(e,t){T.call(this,e,t)}return n.prototype=k(T,{onInitShaders:function(){this.program=new l(this.gl),this.program.attach(new c(this.gl,e)),this.program.attach(new c(this.gl,t)),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 f(this.gl,this.size),this.UTexture=new f(this.gl,this.size.getHalfSize()),this.VTexture=new f(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(e,t,n){this.YTexture.fill(e),this.UTexture.fill(t),this.VTexture.fill(n),this.drawScene()},drawCanvas:function(e,t){var n=new Uint8Array(e.buffer,e.byteOffset,t.ylen*t.height),r=new Uint8Array(e.buffer,e.byteOffset+t.ylen*t.height,t.ylen*t.height/4),o=new Uint8Array(e.buffer,e.byteOffset+t.ylen*t.height*1.25,t.ylen*t.height/4);this.YTexture.fill(n),this.UTexture.fill(r),this.VTexture.fill(o),this.drawScene()},updateVertexArray:function(e){this.zoomScene(e)},toString:function(){return"YUVCanvas Size: "+this.size},initCanvas:function(){this.gl.clear(this.gl.DEPTH_BUFFER_BIT|this.gl.COLOR_BUFFER_BIT)}}),n}();function k(e,t){for(var n=Object.create(e.prototype),r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=t[r[o]];return n}function E(e){return e.join("\n")}var R=function(){this.metrics={},this._clearMetrics(),this._objpool=[]};function A(e,t){function n(e,t){n.prototype.w=e,n.prototype.h=t}return n.prototype={toString:function(){return"("+n.prototype.w+", "+n.prototype.h+")"},getHalfSize:function(){return new A(n.prototype.w>>>1,n.prototype.h>>>1)},length:function(){return n.prototype.w*n.prototype.h}},new n(e,t)}R.prototype.alloc=function(){var e=null;return 0===this._objpool.length?(e=new Image,this.metrics.totalalloc++):(e=this._objpool.pop(),this.metrics.totalfree--),e},R.prototype.free=function(e){e.length>0&&(a.log("It is not zero length = "+e.length),this._objpool.push(e),this.metrics.totalfree++)},R.prototype.collect=function(e){this._objpool=[];var t=this.metrics.totalalloc-this.metrics.totalfree;this._clearMetrics(t)},R.prototype._clearMetrics=function(e){this.metrics.totalalloc=e||0,this.metrics.totalfree=0};var C=function(e,t,n,r){var o=t,i=r,s=e,u=n,c=null,l=null,f=null,h=null,p=null,y=null,d=null,m=null,v=0,g=null,b=0,w=0,S=0,k=0,E=new R,C=null,P="",I=!1,M=!1,x=16.7,U=0,D=!1,B={},j=[],L="png",F=1,N=function(e,t,n,r,o,i,a,s){for(var u in function(e){this.buffer=e,this.previous=null,this.next=null}.call(this,e),this.width=t,this.height=n,this.codecType=r,this.frameType=o,this.timeStamp=i,this.frameIndex=a,this.option={},s)this.option[u]=s[u]},z=null;function V(){var e=i||15;function t(){this.first=null,this.size=0}return t.prototype={enqueue:function(t,n,r,o,i,a,s,u){this.size>=e&&this.clear();var c=new N(t,n,r,o,i,a,s,u);if(null===this.first)this.first=c;else{for(var l=this.first;null!==l.next;)l=l.next;l.next=c}return this.size+=1,c},dequeue:function(){var e=null;return null!==this.first&&(e=this.first,this.first=this.first.next,this.size-=1),e},clear:function(){a.log("BufferQueue clear!");for(var e=null;null!==this.first;)e=this.first,this.first=this.first.next,this.size-=1,e.buffer=null,e=null;this.size=0,this.first=null}},new t}function H(){h="rgb2d",y=null,z=new V,p=x,M=!1}var Y=function(e,t){var n=new A(e,t);switch(h){case"RGB2d":c=new RGB2dCanvas(u,n);break;case"YUVWebGL":c=new _(u,n);break;case"ImageWebGL":c=new O(u,n);break;case"WebGL":c=new T(u,n)}};function G(e,t){var n=u.width,r=u.height,o=document.createElement("canvas");o.width=n,o.height=r;for(var i=o.getContext("2d"),a=0;a<e.length;a++)i.drawImage(e[a],0,0,n,r);for(var s=o.toDataURL(),c=atob(s.substring("data:image/png;base64,".length)),l=new Uint8Array(c.length),f=0,h=c.length;f<h;++f)l[f]=c.charCodeAt(f);var p=new Blob([l.buffer],{type:"image/png"});q(p,t+".png")}var q=function(e){var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,i=/constructor/i.test(e.HTMLElement),a=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},u=function(e){setTimeout(function(){"string"===typeof e?n().revokeObjectURL(e):e.remove()},4e4)},c=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},l=function(t,l,f){f||(t=c(t));var h,p=this,y="application/octet-stream"===t.type,d=function(){!function(e,t,n){for(var r=(t=[].concat(t)).length;r--;){var o=e["on"+t[r]];if("function"===typeof o)try{o.call(e,n||e)}catch(e){s(e)}}}(p,"writestart progress write writeend".split(" "))};if(p.readyState=p.INIT,o)return h=n().createObjectURL(t),void setTimeout(function(){r.href=h,r.download=l,function(e){var t=new MouseEvent("click");e.dispatchEvent(t)}(r),d(),u(h),p.readyState=p.DONE});!function(){if((a||y&&i)&&e.FileReader){var r=new FileReader;return r.onloadend=function(){var t=a?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,p.readyState=p.DONE,d()},r.readAsDataURL(t),void(p.readyState=p.INIT)}h||(h=n().createObjectURL(t)),y?e.location.href=h:e.open(h,"_blank")||(e.location.href=h),p.readyState=p.DONE,d(),u(h)}()},f=l.prototype;return"undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return t=t||e.name||"download",n||(e=c(e)),navigator.msSaveOrOpenBlob(e,t)}:(f.readyState=f.INIT=0,f.WRITING=1,f.DONE=2,f.error=f.onwritestart=f.onprogress=f.onwrite=f.onabort=f.onerror=f.onwriteend=null,function(e,t,n){return new l(e,t||e.name||"download",n)})}(window),W=function(e){if(0==z.size&&!0===D)return o.fileOverCallback(),void H.prototype.stopRendering();if(null!==(C=z.dequeue())&&null!==C.buffer&&("mjpeg"===C.codecType||C.buffer.length>0)){if("undefined"!==typeof l&&"undefined"!==typeof f&&l===C.width&&f===C.height&&y===C.codecType||(h="h264"===C.codecType||"h265"===C.codecType?"YUVWebGL":"ImageWebGL",Y(C.width,C.height),"undefined"!=l&&null!=l&&0!=l||d("PlayStart"),l=C.width,f=C.height,y=C.codecType),g=C.timeStamp,o.timeStamp(g),"undefined"!==typeof c)return c.drawCanvas(C.buffer,C.option),u.updatedCanvas=!0,m(g),Math.abs(g.timestamp-b)>3&&o.waitingCallback(!1),M||((B=C).src=u.toDataURL("image/"+L,F)),b=g.timestamp,I&&(I=!1,G([u].concat(j),P)),"mjpeg"===C.codecType?E.free(C.buffer):(delete C.buffer,C.buffer=null),C.previous=null,C.next=null,C=null,!0;a.log("drawer is undefined in StreamDrawer!")}return!1},X=function e(t){if(!0===M){if(0===v||t-v<200)return 0===v&&(v=t),void(null!==z&&window.requestAnimationFrame(e));(k+=t-w)>S&&W()&&(S+=p),k>1e3&&(S=0,k=0),w=t,window.requestAnimationFrame(e)}};return H.prototype={getDrawingStrategy:function(){return h},reassignCanvas:function(){var e=$('canvas[kind-channel-id="'+s+'"]')[0];u!==e&&(l=0,f=0)},drawMJPEG:function(e,t,n,r,o,i,a,s){var u=E.alloc();u.width=t,u.height=n,u.codecType=r,u.frameType=o,u.frameIndex=a,u.time=i,u.onload=function(){null!==z&&z.enqueue(this,this.width,this.height,this.codecType,this.frameType,this.time,this.frameIndex,this.option)},u.setAttribute("src","data:image/jpeg;base64,"+function(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(e),o=r.byteLength,i=o%3,a=o-i,s=0,u=0;u<a;u+=3)t+=n[(16515072&(s=r[u]<<16|r[u+1]<<8|r[u+2]))>>18]+n[(258048&s)>>12]+n[(4032&s)>>6]+n[63&s];return 1===i?t+=n[(252&(s=r[a]))>>2]+n[(3&s)<<4]+"==":2===i&&(t+=n[(64512&(s=r[a]<<8|r[a+1]))>>10]+n[(1008&s)>>4]+n[(15&s)<<2]+"="),t}(e))},draw:function(e,t,n,r,o,i,a,s){null!==z&&(document.hidden&&z.size>=15?z.clear():z.enqueue(e,t,n,r,o,i,a,s))},capture:function(e,t){P=e,I=!0,j=t.ivsCanvasArr},getCapture:function(e,t,n){return F=n||1,L="png","jpg"!==t&&"jpeg"!==t||(L="jpeg"),W()?B.src:""},digitalZoom:function(e){"undefined"!==typeof c&&null!==c&&c.updateVertexArray(e)},setResizeCallback:function(e){},getCodecType:function(){return y},getFrameTimestamp:function(){return g},initStartTime:function(){0===v&&window.requestAnimationFrame(X)},startRendering:function(){0===v&&(M=!0,window.requestAnimationFrame(X))},pause:function(){M=!1},play:function(){M=!0},stopRendering:function(){M=!1,v=0},setFPS:function(e){"undefined"===typeof e?p=x:0===e?p=x:p=1e3/e,U=p},setFrameInterval:function(e){p=e*U},getCanvas:function(){return u},renewCanvas:function(){Y(l,f),"undefined"!==typeof c&&null!==c&&c.initCanvas()},setBeginDrawCallback:function(e){d=e},setupdateCanvasCallback:function(e){m=e},terminate:function(){v=0,g=null,null!==z&&(z.clear(),z=null),c&&c.clearCanvas(),c=null,D=!1},setRtspOver:function(){D=!0},playNextFrame:W,getVideoBufferQueueSize:function(){return z.size},getCurFrameInfo:function(){return B}},new H},P=n(49),I=n.n(P),M=n(20),x=n.n(M);var U=function(e){var t=null,n="",r=null,o=null,i=null,u=null,c=null,l=1,f={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,g=!1,b=!0,w=0,S=e,T=!1,O=[],_=.5,k=null,E=null,R=null,A=0,C=0,P=!1,I=null,M="png",x=1,U=s(),D=null,B=0,j=0,L=0,F=8,N=null,z=!1,V=!1,H=[],Y=[],G={},q=25,W=.5;function X(){}function Z(){J()}function K(){var e=0;if(null!==d)for(e=0;e<d.length;e++)R.removeEventListener(d[e].type,d[e].function);if(null!==v)for(e=0;e<v.length;e++)E.removeEventListener(v[e].type,v[e].function);if(null!==m)for(e=0;e<m.length;e++)k.removeEventListener(m[e].type,m[e].function)}function J(){if(null===E||"ended"===E.readyState)return function(e){(v=[]).push({type:"sourceopen",function:Z}),v.push({type:"error",function:oe});for(var t=0;t<v.length;t++)e.addEventListener(v[t].type,v[t].function)}(E=new MediaSource),k.src=window.URL.createObjectURL(E),void a.log("videoMediaSource::appendInitSegment new MediaSource()");if(a.log("videoMediaSource::appendInitSegment start"),0===E.sourceBuffers.length){E.duration=0;var e='video/mp4;codecs="avc1.'+n+'"';if(!MediaSource.isTypeSupported(e))return a.log("not support"+e),void(N&&N({errorCode:101}));!function(e){(d=[]).push({type:"error",function:ie}),d.push({type:"updateend",function:ne}),d.push({type:"update",function:re});for(var t=0;t<d.length;t++)e.addEventListener(d[t].type,d[t].function)}(R=E.addSourceBuffer(e))}var r=t();null!==r?(R.appendBuffer(r),a.log("videoMediaSource::appendInitSegment end, codecInfo = "+n)):E.endOfStream("network")}function Q(){k.paused&&(o(),g||z||k.play())}function $(){k.paused||b||(a.log("pause"),k.pause())}function ee(){H.length&&function(e,t){if(null!==R&&"closed"!==E.readyState&&"ended"!==E.readyState)try{if(O.length>0)return a.count("1.segmentWaitDecode.length: "+O.length),O.push(e),void a.count("2.segmentWaitDecode.length: "+O.length);R.updating?(a.log("updating.........."),O.push(e)):(R.appendBuffer(e),z&&(G.frameIndex=t,G.buffer=e))}catch(e){a.log("videoMediaSource::appendNextMediaSegment error >> initVideo"),O.length=0,S.initVideo(!1),N&&N({errorCode:101})}}(H.shift(),Y.shift())}function te(){if(null!==E)try{if(R&&R.buffered.length>0&&(function(){var e=1*R.buffered.start(R.buffered.length-1),t=1*R.buffered.end(R.buffered.length-1);t-e>60&&R.remove(e,t-10)}(),V&&!z||k.duration>W&&(k.currentTime=(k.duration-W).toFixed(3),W+=q<10?.5:.1),k&&k.duration-k.currentTime>F&&N&&N({errorCode:101}),T&&!y)){var e=1*R.buffered.start(R.buffered.length-1),t=1*R.buffered.end(R.buffered.length-1);if((0===k.currentTime?t-e:t-k.currentTime)>=_+.1){if(a.log("\u8df3\u79d2"),R.updating)return;var n=t-_;k.currentTime=n.toFixed(3)}}}catch(e){a.log("sourceBuffer has been removed")}}function ne(){}function re(){O.length>0&&(a.count("1. onSourceUpdate .segmentWaitDecode.length: "+O.length),R.updating||(a.count("2. onSourceUpdate .appendBuffer: "+O.length+" "+O[0].length),R.appendBuffer(O[0]),O.shift()))}function oe(){a.log("videoMediaSource::onSourceError")}function ie(){a.log("videoMediaSource::onSourceBufferErrormsg")}function ae(){a.log("videoMediaSource::onError"),$(),N&&N({errorCode:101})}function se(){g=!0,b=!1,V=!0,a.log("playing "),P||(P=!0,u("PlayStart"))}function ue(){g=!1,b=!0,a.log("\u6682\u505c\u64ad\u653e----------------------------------------------")}function ce(){var e=parseInt(E.duration,10),t=parseInt(k.currentTime,10),n={timestamp:f.timestamp-l*(e-t+(1!==l?1:0)),timestamp_usec:0,timezone:f.timezone};0===t||isNaN(e)||(y&&S.waitingCallback(!1),!y&&Math.abs(e-t)>4&&1===l||k.paused||(null===p?(p=n,i(0,"currentTime")):(p.timestamp<=n.timestamp&&l>=1||p.timestamp>n.timestamp&&l<1)&&(y&&S.timeStamp(n),p=n,++w>4&&i(n.timestamp,"currentTime"))))}function le(){Q(),te()}function fe(){o()}function he(){Q()}function pe(){if(a.log("\u9700\u8981\u7f13\u51b2\u4e0b\u4e00\u5e27"),T=!1,y&&g&&S.waitingCallback(!0),0==C)A=Date.now(),C++;else{C++;var e=Date.now()-A;a.log("diffTime: "+e+" Count: "+C),C>=5&&e<6e4&&_<=1.8&&(_+=.1,C=0,A=0,a.log("delay + 0.1 = "+_))}}function ye(){a.log("Can play !")}function de(){a.log("Can play without waiting"),T=!0}function me(){a.log("loadedmetadata")}function ve(e,t,n){for(var r=e.width,o=e.height,i=e.getContext("2d"),a=0;a<t.length;a++)i.drawImage(t[a],0,0,r,o);for(var s=e.toDataURL(),u=atob(s.substring("data:image/png;base64,".length)),c=new Uint8Array(u.length),l=0,f=u.length;l<f;++l)c[l]=u.charCodeAt(l);var h=new Blob([c.buffer],{type:"image/png"});ge(h,n+".png")}X.prototype={init:function(e){c=s(),a.log("videoMediaSource::init browserType = "+c),(k=e).autoplay="safari"!==c,k.controls=!1,k.preload="auto",function(e){(m=[]).push({type:"durationchange",function:le}),m.push({type:"playing",function:se}),m.push({type:"error",function:ae}),m.push({type:"pause",function:ue}),m.push({type:"timeupdate",function:ce}),m.push({type:"resize",function:fe}),m.push({type:"seeked",function:he}),m.push({type:"waiting",function:pe}),m.push({type:"canplaythrough",function:de}),m.push({type:"canplay",function:ye}),m.push({type:"loadedmetadata",function:me});for(var t=0;t<m.length;t++)e.addEventListener(m[t].type,m[t].function)}(k),J()},setInitSegmentFunc:function(e){t=e},getVideoElement:function(){return k},setCodecInfo:function(e){n=e},setMediaSegment:function(e,t){H.push(e),Y.push(t),z||ee()},capture:function(e,t){I&&clearInterval(I);var n=document.createElement("canvas");n.width=k.videoWidth,n.height=k.videoHeight;var r=t.ivsCanvasArr;T||"edge"===U?(n.getContext("2d").drawImage(k,0,0,n.width,n.height),ve(n,r,e)):I=setInterval(function(){T&&(n.getContext("2d").drawImage(k,0,0,n.width,n.height),ve(n,r,e),clearInterval(I))},200)},getCapture:function(e,t,n){I&&clearInterval(I),x=n||1,M="png","jpg"!==t&&"jpeg"!==t||(M="jpeg");var r=document.createElement("canvas"),o=null;return r.width=k.videoWidth,r.height=k.videoHeight,T||"edge"===U?(r.getContext("2d").drawImage(k,0,0,r.width,r.height),o=r.toDataURL("image/"+M,x)):T&&(r.getContext("2d").drawImage(k,0,0,r.width,r.height),o=r.toDataURL("image/"+M,x)),o},setInitSegment:function(){J()},setTimeStamp:function(e,t){r=e},setVideoSizeCallback:function(e){o=e},setAudioStartCallback:function(e){i=e},getPlaybackTimeStamp:function(){return r},setSpeedPlay:function(e){l=e},setvideoTimeStamp:function(e){var t=Math.abs(f.timestamp-e.timestamp)>3;0===h.timestamp&&S.timeStamp(e),!0===t&&(w=0,i((h=e).timestamp,"init"),0!==f.timestamp&&y&&(k.currentTime=E.duration-.1,S.waitingCallback(!1)),p=null),f=e},pause:function(){z=!0,$()},play:function(){z=!1},setPlaybackFlag:function(e){y=e},setTimeStampInit:function(){p=null,h={timestamp:0,timestamp_usec:0,timezone:0}},close:function(){K(),$()},setBeginDrawCallback:function(e){u=e},setErrorCallback:function(e){N=e},terminate:function(){null!==k&&(K(),"open"===E.readyState&&(R&&E.removeSourceBuffer(R),E.endOfStream()),R=null,R=null,E=null,k=null,I&&(clearInterval(I),I=null),D&&(clearInterval(D),D=null),L=0,j=0,B=0)},getDuration:function(){return k.duration-k.currentTime},setFPS:function(e){e&&(q=e)},setRtspOver:function(){k.duration.toFixed(4)-0===k.currentTime.toFixed(4)-0?(S.timeStamp(f),S.fileOverCallback()):(B=parseInt(k.currentTime),j=parseInt(k.duration),D=setInterval(function(){B===parseInt(k.currentTime)&&j===parseInt(k.duration)?L++>10&&(D&&clearInterval(D),D=null,S.timeStamp(f),S.fileOverCallback()):parseInt(k.currentTime)>=parseInt(k.duration)?(D&&clearInterval(D),D=null,S.timeStamp(f),S.fileOverCallback()):(B=parseInt(k.currentTime),j=parseInt(k.duration),L=0)},150))},getVideoBufferQueueSize:function(){return H.length},playNextFrame:function(){ee()},getCurFrameInfo:function(){return G.src=function(){var e=document.createElement("canvas");return e.width=k.videoWidth,e.height=k.videoHeight,e.getContext("2d").drawImage(k,0,0,e.width,e.height),e.toDataURL()}(),G}};var ge=function(e){var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,i=/constructor/i.test(e.HTMLElement),a=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},u=function(e){setTimeout(function(){"string"===typeof e?n().revokeObjectURL(e):e.remove()},4e4)},c=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},l=function(t,l,f){f||(t=c(t));var h,p=this,y="application/octet-stream"===t.type,d=function(){!function(e,t,n){for(var r=(t=[].concat(t)).length;r--;){var o=e["on"+t[r]];if("function"===typeof o)try{o.call(e,n||e)}catch(e){s(e)}}}(p,"writestart progress write writeend".split(" "))};if(p.readyState=p.INIT,o)return h=n().createObjectURL(t),void setTimeout(function(){r.href=h,r.download=l,function(e){var t=new MouseEvent("click");e.dispatchEvent(t)}(r),d(),u(h),p.readyState=p.DONE});!function(){if((a||y&&i)&&e.FileReader){var r=new FileReader;return r.onloadend=function(){var t=a?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,p.readyState=p.DONE,d()},r.readAsDataURL(t),void(p.readyState=p.INIT)}h||(h=n().createObjectURL(t)),y?e.location.href=h:e.open(h,"_blank")||(e.location.href=h),p.readyState=p.DONE,d(),u(h)}()},f=l.prototype;return"undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return t=t||e.name||"download",n||(e=c(e)),navigator.msSaveOrOpenBlob(e,t)}:(f.readyState=f.INIT=0,f.WRITING=1,f.DONE=2,f.error=f.onwritestart=f.onprogress=f.onwrite=f.onabort=f.onerror=f.onwriteend=null,function(e,t,n){return new l(e,t||e.name||"download",n)})}(window);return new X},D=new function(){var e=[],t={};function n(){for(var n in e)e[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)];t.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.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]),t.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]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}e={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 r=function(e){for(var t=8,n=Array.prototype.slice.call(arguments,1),r=0;r<n.length;r++)t+=n[r].byteLength;var o=new Uint8Array(t),i=0;for(o[i++]=t>>>24&255,o[i++]=t>>>16&255,o[i++]=t>>>8&255,o[i++]=255&t,o.set(e,i),i+=4,r=0;r<n.length;r++)o.set(n[r],i),i+=n[r].byteLength;return o},o=function(t){return r(e.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),function(t){var n=t.config,o=n.length,i=new Uint8Array([0,0,0,0,3,23+o,0,1,0,4,15+o,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([o]).concat(n).concat([6,1,2]));return r(e.esds,i)}(t))},i=function(n){return"audio"===n.type?r(e.stsd,t.STSD_PREFIX,o(n)):r(e.stsd,t.STSD_PREFIX,function(t){var n=t.sps||[],o=t.pps||[],i=[],a=[],s=0;for(s=0;s<n.length;s++)i.push((65280&n[s].byteLength)>>>8),i.push(255&n[s].byteLength),i=i.concat(Array.prototype.slice.call(n[s]));for(s=0;s<o.length;s++)a.push((65280&o[s].byteLength)>>>8),a.push(255&o[s].byteLength),a=a.concat(Array.prototype.slice.call(o[s]));return r(e.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&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.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]),r(e.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([n.length]).concat(i).concat([o.length]).concat(a))))}(n))},s=function(n){var o=null;return o="audio"===n.type?r(e.smhd,t.SMHD):r(e.vmhd,t.VMHD),r(e.minf,o,r(e.dinf,r(e.dref,t.DREF)),function(n){return r(e.stbl,i(n),r(e.stts,t.STTS),r(e.stsc,t.STSC),r(e.stsz,t.STSZ),r(e.stco,t.STCO))}(n))},u=function(n){return r(e.mdia,function(t){var n=t.timescale,o=t.duration;return r(e.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,o>>>24&255,o>>>16&255,o>>>8&255,255&o,85,196,0,0]))}(n),function(n){var o=null;return o="audio"===n.type?t.HDLR_AUDIO:t.HDLR_VIDEO,r(e.hdlr,o)}(n),s(n))},c=function(t){return r(e.trak,function(t){var n=t.id,o=t.duration,i=t.width,a=t.height;return r(e.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,o>>>24&255,o>>>16&255,o>>>8&255,255&o,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]))}(t),u(t))},l=function(t){return r(e.mvex,function(t){var n=t.id,o=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 r(e.trex,o)}(t))},f=function(t){var n,o,i=(n=t.timescale,o=t.duration,a.log("mvhd: timescale: "+n+" duration: "+o),r(e.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,o>>>24&255,o>>>16&255,o>>>8&255,255&o,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]))),s=c(t),u=l(t);return r(e.moov,i,s,u)},h=function(t,n){return"audio"===t.type?audioTrun(t,n):function(t,n){var o,i=null,a=null,s=0,u=n;if(null===(o=t.samples||[])[0].frameDuration)for(u+=24+4*o.length,i=trunHeader(o,u),s=0;s<o.length;s++)a=o[s],i=i.concat([(4278190080&a.size)>>>24,(16711680&a.size)>>>16,(65280&a.size)>>>8,255&a.size]);else for(i=function(e,t){return[0,0,3,5,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t,0,0,0,0]}(o,u+=24+4*o.length+4*o.length),s=0;s<o.length;s++)a=o[s],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 r(e.trun,new Uint8Array(i))}(t,n)},p=function(t,n){return r(e.moof,function(t){var n=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return r(e.mfhd,n)}(t),function(t){var n,o,i;return n=r(e.tfhd,new Uint8Array([0,2,0,0,0,0,0,1])),o=r(e.tfdt,new Uint8Array([0,0,0,0,t.baseMediaDecodeTime>>>24&255,t.baseMediaDecodeTime>>>16&255,t.baseMediaDecodeTime>>>8&255,255&t.baseMediaDecodeTime])),i=h(t,72),r(e.traf,n,o,i)}(n))};return n.prototype={initSegment:function(n){var o=r(e.ftyp,t.FTYP);a.log(n);var i=f(n),s=new Uint8Array(o.byteLength+i.byteLength);return s.set(o,0),s.set(i,o.byteLength),s},mediaSegment:function(t,n,o,i){var a=p(t,n),s=function(t){return r(e.mdat,t)}(o),u=null;return(u=new Uint8Array(a.byteLength+s.byteLength)).set(a),u.set(s,a.byteLength),u}},new n};function B(e){return(B="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var L=function(){var e={},t=null,n=i(),r=i();function o(e,t){this.data=e,this.timeStamp=t,this.next=null}function i(){function e(){this.first=null,this.size=0}return e.prototype={enqueue:function(e){if(null===this.first)this.first=e;else{for(var t=this.first;null!==t.next;)t=t.next;t.next=e}this.size+=1},dequeue:function(){var e=null;return null!==this.first&&(e=this.first,this.first=this.first.next,this.size-=1),e},clear:function(){this.size=0,this.first=null}},new e}function s(e,n){var r=n.first;if(r)if(e>r.timeStamp){for(;r&&e>r.timeStamp;)(r=n.dequeue())&&r.data&&2===r.data.type&&t&&t(r.data);r&&t&&t(r.data)}else e<r.timeStamp?r.data&&2!==r.data.type&&t&&t(r.data):(t&&t(r.data),n.dequeue())}function u(){}return u.prototype={draw:function(i,u,c,l){a.log("type:"+i.type+" jsondata:"+JSON.stringify(i.params));var f=i.params;if(f){var h={type:0,data:null,channel:l};if(f.hasOwnProperty("VideoAnalyseRule")&&(h.type=0,h.data=f.VideoAnalyseRule,t&&t(h)),f.hasOwnProperty("FocusStatus")&&(h.type=3,h.data=f.FocusStatus,t&&t(h)),f.hasOwnProperty("Event")&&(h.type=2,h.data=f.Event,r.enqueue(new o(JSON.parse(JSON.stringify(h)),c))),s(u,r),5===i.type)for(var p=f.object,y=f.coordinate,d=0;d<p.length;d++)!function(t){var n=p[t].classID+p[t].objectId;switch(p[t].operateType){case 1:e[n]={},e[n].show=!0,p[t].hasOwnProperty("track")&&(e[n].pos=p[t].track[0]),e[n].type=p[t].objectType,e[n].coordinate=y,e[n].timeout=setTimeout(function(){e[n].show=!1},500);break;case 2:e.hasOwnProperty(n)||(e[n]={},e[n].coordinate=y),p[t].hasOwnProperty("track")&&(e[n].pos=p[t].track[0],e[n].show=!0),e[n].type=p[t].objectType,e[n].timeout&&clearTimeout(e[n].timeout),e[n].timeout=setTimeout(function(){e[n].show=!1},500);break;case 3:e.hasOwnProperty(n)&&(e[n].timeout&&clearTimeout(e[n].timeout),delete e[n]);break;case 4:e.hasOwnProperty(n)&&(e[n].show=!1)}}(d);else if(14===i.type)for(var m=function(n){return setTimeout(function(){var r={};h.type=1,h.data=r,r[n]={type:14,show:!1},t&&t(JSON.parse(JSON.stringify(h))),delete e[n]},500)},v=0;v<f.length;v++){if(y=f[v].coordinate,p=[],f[v].object)for(var g in f[v].object)"commonObject"!==g&&"vehicleObject"!==g||(p=p.concat(f[v].object[g]));for(d=0;d<p.length;d++)!function(t){var n=f[v].classID+p[t].objectId;for(var r in p[t])if("object"===B(p[t][r]))switch(p[t].operateType){case 1:e[n]||(e[n]={}),e[n].show=!0,p[t].hasOwnProperty("track")?e[n].pos=p[t].track[0]:e[n].pos=p[t][r][0].track[0],e[n].type=p[t].type,e[n].coordinate=y,clearTimeout(e[n].timeout),e[n].timeout=m(n);break;case 2:e.hasOwnProperty(n)||(e[n]={},e[n].coordinate=y),p[t].hasOwnProperty("track")?e[n].pos=p[t].track[0]:e[n].pos=p[t][r][0].track[0],e[n].show=!0,e[n].type=p[t].type,clearTimeout(e[n].timeout),e[n].timeout=m(n)}}(d)}else if(20===i.type)for(d=0;d<f.length;d++){var b=f[d],w={show:!0,type:20},S=String("0x14_")+b.objectId;switch(e={},b.objectStatus){case 0:e[S]=w,e[S].data=b.params.object,e[S].timeout=setTimeout(function(){},500);break;case 1:e.hasOwnProperty(S)&&(e[S].show=!1);break;case 2:e.hasOwnProperty(S)||(e[S]=w),e[S].data=b.params.object,e[S].timeout&&clearTimeout(e[S].timeout),e[S].timeout=setTimeout(function(){},500);break;case 3:e.hasOwnProperty(S)&&(e[S].timeout,delete e[S])}}h.type=1,h.data=e,n.enqueue(new o(JSON.parse(JSON.stringify(h)),c)),s(u,n)}},setCallback:function(e){t||(t=e)}},new u};function F(){var e=200,t=8e3,n=null,r=null,o=null,i=0,s={type:"G.711",samplingRate:t,bitrate:"8000"},u=0,c=!1,l=0,f=0,h=null,p=!1,y=new Float32Array(8e4),d=0,m=null,v=!1,g=[],b=!1,w=null,S=0,T=0;function O(r,i){var a=i-l;if((a>e||a<0)&&(u=0,d=0,p=!0,null!==m&&m.stop()),u-n.currentTime<0&&(u=0),l=i,y=function(e,t,n){var r=e;n+t.length>=r.length&&(r=new Float32Array(r.length+8e4)).set(r,0);return r.set(t,n),r}(y,r,d),d+=r.length,!p){var c=0;if(d/r.length>1&&(null!==h&&(c=h*t),c>=d||null===h))return void(d=0);var f=null;if(/Apple Computer/.test(navigator.vendor))if(s.samplingRate<32e3){8e3==s.samplingRate?y=function(e){for(var t=0,n=0,r=0,o=0,i=(1-Math.cos(.2*Math.PI))/2,a=new Float32Array(4*e.length),s=0,u=0;s<e.length;s++)u=4*s,t=e[s],n=s<e.length-1?e[s+1]:t,r=s<e.length-2?e[s+2]:t,o=s<e.length-3?e[s+3]:t,o=(r=(n=t*(1-i)+n*i)*(1-i)+r*i)*(1-i)+o*i,a[u]=t,a[u+1]=n,a[u+2]=r,a[u+3]=o;return a}(y.subarray(c,d)):16e3==s.samplingRate&&(y=function(e){for(var t=0,n=0,r=new Float32Array(2*e.length),o=0,i=0;o<e.length;o++)i=2*o,t=e[o],n=o<e.length-1?e[o+1]:t,r[i]=t,r[i+1]=(t+n)/2;return r}(y.subarray(c,d)));(f=n.createBuffer(1,y.length,32e3)).getChannelData(0).set(y)}else(f=n.createBuffer(1,d-c,s.samplingRate)).getChannelData(0).set(y.subarray(c,d));else(f=n.createBuffer(1,d-c,s.samplingRate)).getChannelData(0).set(y.subarray(c,d));d=0,(m=n.createBufferSource()).buffer=f,m.connect(o),u||(u=n.currentTime+.1),m.start(u),u+=f.duration}}function _(e){p||(v||5===g.length&&(v=!0,k(g.shift()),w.audioPlayBegin()),g.push(function(e,t){var r=n.createBuffer(1,e.length,t.samplingRate);return T=e.length/t.samplingRate,r.getChannelData(0).set(e),(m=n.createBufferSource()).buffer=r,m}(e,s)))}function k(e){e&&(e.connect(o),e.start(),e.onended=function(){e.disconnect(),S+=T,w.timeUpdate(S),b||(g.length?k(g.shift()):w.audioPlayEnd())})}function E(){}return E.prototype={audioInit:function(e){if(u=0,null!==n&&c)a.info("Audio context already defined!");else try{return n&&!c&&/Apple Computer/.test(navigator.vendor)&&n.close(),window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext,(n=new AudioContext).onstatechange=function(){a.info("Audio Context State changed :: "+n.state),"running"===n.state&&(c=!0)},r=n.createGain(),(o=n.createBiquadFilter()).connect(r),o.type="lowpass",o.frequency.value=4e3,o.gain.value=40,r.connect(n.destination),this.controlVolumn(e),this.getVolume(),!0}catch(e){return a.error("Web Audio API is not supported in this web browser! : "+e),!1}},play:function(){this.controlVolumn(i),this.getVolume(),b=!1,k(g.shift())},stop:function(){i=0,r.gain.value=0,u=0},bufferAudio:function(e,t,n,r){c&&(r?_(e):O(e,t))},controlVolumn:function(e,t){t&&/Apple Computer/.test(navigator.vendor)&&this.audioInit(1),i=e;var n=e/1;n<=0?(r.gain.value=0,u=0):r.gain.value=n>=1?1:n},getVolume:function(){return i},terminate:function(){n&&"closed"!==n.state&&(u=0,c=!1,n.close())},setBufferingFlag:function(e,t){"init"===t?f=e:p&&(0===e||"undefined"===typeof e||null===e?h=null:(h=e-f,f=0),p=!1)},getBufferingFlag:function(){return p},setInitVideoTimeStamp:function(e){f=e},getInitVideoTimeStamp:function(){return f},setSamplingRate:function(e){s.samplingRate=e},pause:function(){b=!0},timeUpdate:function(){},setRtspOver:function(){!0},audioPlayBegin:function(){},audioPlayEnd:function(){}},w=new E}var N=function(){var e=null,t=null,n=null,r=null,o=!1,i=null,s={audio:!0,video:!1},u=null;function c(){}return c.prototype={init:function(){if(void 0===e||null===e)try{window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext,(e=new AudioContext).onstatechange=function(){a.info("Audio Context State changed :: "+e.state)}}catch(e){return void a.error("Web Audio API is not supported in this web browser! : "+e)}},initAudioOut:function(){if(null!==t&&null!==n||(t=e.createGain(),(n=e.createScriptProcessor(4096,1,1)).onaudioprocess=function(e){if(null!==i){var t=e.inputBuffer.getChannelData(0);null!==u&&!0===o&&u(t)}},t.connect(n),n.connect(e.destination),r=e.sampleRate,t.gain.value=1),void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(e,t,n){var r=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return r?new Promise(function(t,n){r.call(navigator,e,t,n)}):(n(),Promise.reject(new Error("getUserMedia is not implemented in this browser")))}),navigator.mediaDevices.getUserMedia)return navigator.mediaDevices.getUserMedia(s).then(function(n){i=n,e.createMediaStreamSource(n).connect(t)}).catch(function(e){a.error(e)}),o=!0,r;a.error("Cannot open local media stream! :: navigator.mediaDevices.getUserMedia is not defined!")},controlVolumnOut:function(e){var n=e/20*2;t.gain.value=n<=0?0:n>=10?10:n},stopAudioOut:function(){if(null!==i&&o)try{for(var e=i.getAudioTracks(),t=0,n=e.length;t<n;t++)e[t].stop();o=!1,i=null}catch(e){a.log(e)}},terminate:function(){this.stopAudioOut(),e.close(),t=null,n=null},setSendAudioTalkBufferCallback:function(e){u=e}},new c},z=n(50),V=n.n(z),H=function(){var e=null,t=null,n=null,r=null,o=null,i=null,u=null,c=null,l=null,f=null,h=null,p=null,y=null,d=null,m=null,v=null,g=null,b=null,w=null,S=null,T=null,O=s(),_=null,k=0,E=null,R=!1,A="",P=!0,M=null,B=null,j=null,z=!1,H=!1,Y=null,G=null,q=null,W={id:1,samples:null,baseMediaDecodeTime:0},X=0,Z=0,K=null,J=1,Q="",$=null,ee=null,te=4,ne=1,re=te,oe=!1,ie=0,ae=0,se=0,ue=1e3,ce=null,le=0,fe=0,he=0,pe=null,ye=!1,de=0,me={type:"live",codec:"",width:0,height:0,isLimitSpeed:null},ve=!1,ge=null,be=null,we=null,Se=!1,Te=0,Oe={5:"MJPEG",8:"H264",12:"H265"},_e={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 ke(){r=this}function Ee(){return G}function Re(){null!==y&&y(!1)}ke.prototype={init:function(n,i,a,s,u){de=a,M=n,$=i,r.channel=a,ye=u,window.navigator.userAgent,ye||((e=new I.a).onmessage=Ae,o=new C(de,this,M,!0===s?50:25),T=L(),document.getElementById("count-fps"),document.getElementById("span-fps")),(t=new x.a).onmessage=Ce},talkInit:function(){R=!0,(t=new x.a).onmessage=Ce},sendSdpInfo:function(r,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s={type:"sdpInfo",data:{sdpInfo:r,aacCodecInfo:o,decodeMode:A,govLength:E,checkDelay:P,lessRateCanvas:Se,mp4Codec:i}};if(R){t.postMessage(s);try{window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.oAudioContext||window.msAudioContext,(n=new V.a).onmessage=Pe,null===u&&((u=new N).init(),u.setSendAudioTalkBufferCallback(Ie)),n.postMessage(s),s={type:"sampleRate",data:u.initAudioOut()},n.postMessage(s)}catch(e){return void a.error("Web Audio API is not supported in this web browser! : "+e)}}else e.postMessage(s),t.postMessage(s);ce=null,oe=!1},parseRTPData:function(n,o){var i=o[4],s=128,u=129,c=130,l=131,f=132,h=133,p=136,y=137,d=138,m=139,v=140,b=144,S=145,T=146,O=147,_=148,k=149,E=150,R=151,A=152,C=153,P=154,I=155,M=156,x=160,U=176,D=255,B={type:"MediaData",data:{rtspInterleave:n,payload:o},info:null,channel:r.channel},j={};if(253==i||254==i||252==i||251==i){if(function(){var e=o[22]+24;j.frameIndex=(o[11]<<24)+(o[10]<<16)+(o[9]<<8)+o[8];for(var t=24;t<e;)if(s==o[t]){if(t+4>e)return a.log("i: "+t),-1;j.width=o[t+2]<<3,j.height=o[t+3]<<3,t+=4}else if(u==o[t]){if(t+4>o.length)return a.log("i: "+t),-1;j.I_frame_interval=o[t+1],j.encode_type=o[t+2],j.frame_rate=o[t+3],t+=4}else if(c==o[t])j.width=(o[t+5]<<8)+o[t+4],j.height=(o[t+7]<<8)+o[t+6],t+=8;else if(l==o[t])t+=4;else if(p==o[t])t+=8;else if(f==o[t]){if(t+4>e)return a.log("i: "+t),-1;var n=(o[t+2]<<8)+o[t+3];t+=n}else if(_==o[t])j.h264_svc_flag=!0,j.svc=o[t+2],t+=4;else if(d==o[t])t+=8;else if(S==o[t])t+=8;else if(C==o[t]){var r=o[t+1],i=o[t+2];t+=8,t+=r*i*16}else if(P==o[t])t+=8;else if(I==o[t])t+=8;else if(T==o[t])t+=8;else if(O==o[t])t+=8;else if(k==o[t])t+=8;else if(x<=o[t]&&o[t]<U)j.timeStampmsw=(o[t+3]<<8)+o[t+2],t+=4;else if(U<=o[t]&&o[t]<D)t+=o[t+1];else if(h==o[t])t+=4;else if(y==o[t])t+=4;else if(m==o[t])t+=4;else if(b==o[t])t+=8;else if(R==o[t]){var r=o[t+1];t+=8,t+=16*r}else if(A==o[t])t+=4;else{if(M!=o[t])return a.log("parseVideoInfo error ext_type:0x"+o[t]),a.log("i: "+t),-1;var e=(o[t+5]<<8)+o[t+4];t+=8,t+=e}}(),null!=ge){if(ge!=j.encode_type&&void 0!==j.encode_type)return ge=j.encode_type,void g(Oe[j.encode_type])}else ge=j.encode_type;e&&(B.info=j,e.postMessage(B))}else if(240==i){if(function(){j.ChannelCount=0;for(var e=o[22]+24,t=24;t<e;)if(s==o[t])t+=4;else if(u==o[t])t+=4;else if(c==o[t])t+=8;else if(l==o[t])t+=4;else if(v==o[t])t+=o[t+1];else if(p==o[t])t+=8;else if(f==o[t]){var n=o[t+2]<<8+o[t+3];t+=n}else if(E==o[t])j.ChannelCount=o[t+1],j.channel=o[t+2],t+=4;else if(k==o[t])t+=8;else{if(x!=o[t])return a.log("parseAudioInfo error ext_type:0x"+o[t]),a.log("i: "+t),-1;j.timeStampmsw=(o[t+3]<<8)+o[t+2],t+=4}0==j.ChannelCount&&(j.ChannelCount=1,j.channel=0);for(var e=o[22]+24,t=24;t<e;)if(o[t]==s)t+=4;else if(o[t]==u)t+=4;else if(o[t]==c)t+=8;else if(o[t]==l)j.audio_type=o[t+2],j.samplingRate=_e[o[t+3]],t+=4;else if(o[t]==v)t+=o[t+1];else if(o[t]==p)t+=8;else if(o[t]==f){var n=o[t+2]<<8+o[t+3];t+=n}else if(o[t]==E)t+=4;else if(o[t]==k)t+=8;else if(x==o[t])t+=4;else{if(A!=o[t])return a.log("parseAudioInfo error ext_type:0x"+o[t]),a.log("i: "+t),-1;t+=4}}(),null!=we){if(we!=j.audio_type)return we=j.audio_type,void w("audioType")}else we=j.audio_type;if(null!=be){if(be!=j.samplingRate)return be=j.samplingRate,void w("samplingRate")}else be=j.samplingRate;switch(j.audio_type+""){case"8":case"10":case"14":case"16":case"25":case"26":case"27":case"28":case"29":case"30":case"31":t&&(B.info=j,t.postMessage(B))}}else 241==i?e&&(B.info=j,e.postMessage(B)):a.log("mediaType: "+i)},setCallback:function(e,t){switch(e){case"timeStamp":break;case"ResolutionChanged":c=t,null!==o&&o.setResizeCallback(c);break;case"audioTalk":f=t;break;case"stepRequest":h=t;break;case"metaEvent":break;case"videoMode":p=t;break;case"loadingBar":y=t;break;case"Error":d=t;break;case"PlayStart":l=t,null!==o&&o.setBeginDrawCallback(l);break;case"DecodeStart":m=t;break;case"UpdateCanvas":v=t,null!==o&&o.setupdateCanvasCallback(v);break;case"FrameTypeChange":g=t;break;case"MSEResolutionChanged":b=t;break;case"audioChange":w=t;break;case"WorkerReady":pe=t;break;case"IvsDraw":S=t;break;case"FileOver":this.fileOverCallback=t;break;case"Waiting":this.waitingCallback=t;break;case"UpdateTime":break;default:a.log(e),a.log("workerManager::setCallback() : type is unknown")}},capture:function(e,t){"canvas"===A?o.capture(e,t):"video"===A&&Y.capture(e,t)},getCapture:function(e,t,n){return"video"===A?Y.getCapture(e,t,n):o.getCapture(e,t,n)},setDeviceInfo:function(e){j=e.mode},setFPS:function(e){k=0===e?30:e,Me(1!==ne)},setGovLength:function(e){E=e},setLiveMode:function(e){null!==p&&p(e),"video"===(A=null===e?"canvas":e)?null!==o&&o.renewCanvas():"canvas"===A&&Me(!1)},setPlayMode:function(e){H=e},controlAudio:function(e,t){switch(a.log(e+" "+t),e){case"audioPlay":"start"===t?null!==i&&i.play():"stop"===t?(le=0,null!==i&&i.stop()):null!==i&&i.pause();break;case"volumn":le=t,null!==i&&i.controlVolumn(t,!0);break;case"audioSamplingRate":null!==i&&i.setSamplingRate(t)}},controlAudioTalk:function(e,t){if(null!==u)switch(e){case"onOff":"on"===t||u.stopAudioOut();break;case"volumn":u.controlVolumnOut(t)}},reassignCanvas:function(){null!==o&&o.reassignCanvas()},digitalZoom:function(e){null!==o&&o.digitalZoom(e)},playbackSpeed:function(e){ne=e,o.setFrameInterval(ne)},timeStamp:function(e){v&&v(e)},initVideo:function(e){Me(e)},setFpsFrame:function(e){he=0},setCheckDelay:function(e){P=e},initStartTime:function(){ye||(e.postMessage({type:"initStartTime"}),o.stopRendering(),o.startRendering())},terminate:function(){"backup"!==j&&(e&&(e.terminate(),e=null),t&&(t.terminate(),t=null)),n&&n.terminate(),u&&(u.terminate(),u=null),o&&o.terminate(),i&&i.terminate(),Y&&Y.terminate(),pe&&(pe=null),o=null},postRtspOver:function(){e&&e.postMessage({type:"end"}),i&&i.setRtspOver()},pause:function(){Y&&Y.pause(),e&&o.pause()},play:function(){Y&&Y.play(),e&&o.play()},setLessRate:function(e){Se=e},playNextFrame:function(){Y?Y.playNextFrame():e&&o.playNextFrame()},getVideoBufferQueueSize:function(){return Y?Y.getVideoBufferQueueSize():e?o.getVideoBufferQueueSize():void 0},getCurFrameInfo:function(){return Y?Y.getCurFrameInfo():e?o.getCurFrameInfo():void 0},sendBufferToAudioWorker:function(e){Ce(e={type:"message",data:{codec:"AAC",data:e,type:"render"}})}};function Ae(t){var n,r,i=t.data;switch(i.type){case"WorkerReady":++Te>=2&&pe&&pe();break;case"canvasRender":Ue(0,"currentTime"),n=i.data,r=i.option,null!==n&&null!==o&&("mjpeg"===_.codecType?o.drawMJPEG(n,_.width,_.height,_.codecType,_.frameType,_.timeStamp,_.frameIndex,r):o.draw(n,_.width,_.height,_.codecType,_.frameType,_.timeStamp,_.frameIndex,r));break;case"initSegment":G=i.data,xe();break;case"mediaSample":null===W.samples&&(W.samples=new Array(re)),null===i.data.frame_time_stamp&&(i.data.frameDuration=Math.round(ue/k)),1!==ne&&(i.data.frameDuration=ue/Math.abs(ne)),W.samples[X++]=i.data,ae+=i.data.frameDuration,se+=i.data.frameDuration;break;case"videoRender":var s=new Uint8Array(i.data.length+Z);if(0!==Z&&s.set(K),s.set(i.data,Z),Z=(K=s).length,X%re===0&&0!==X){if(null!==W.samples[0].frameDuration?(W.baseMediaDecodeTime=1===J?0:ie,ie=ae):W.baseMediaDecodeTime=Math.round(ue/k)*re*(J-1),"chrome"==O&&1===ne)for(var u=W.samples.length,c=se/re,l=0;l<u;l++)W.samples[l].frameDuration=c;se=0,q=D.mediaSegment(J,W,K,W.baseMediaDecodeTime),J++,X=0,K=null,Z=0,null!==Y?Y.setMediaSegment(q,_.frameIndex):!1===oe&&(a.log("workerManager::videoMS error!! recreate videoMS"),xe()),null!==o&&o.stopRendering()}break;case"mediasegmentData":Y.setMediaSegment(i.data),!1===oe&&(a.log("videoMS error!! recreate videoMS"),xe());break;case"videoInfo":_=i.data,0===he&&(he=performance.now(),"canvas"===A&&v(_.timeStamp));break;case"time":break;case"videoTimeStamp":ee=i.data,null!==Y&&null!==ee&&Y.setvideoTimeStamp(ee);break;case"firstFrame":o&&(o.startRendering(),"undefined"!==typeof o.setFPS&&o.setFPS(k));break;case"drop":break;case"codecInfo":Q=i.data,null!==Y&&Y.setCodecInfo(Q);break;case"stepPlay":switch(i.data){case"needBuffering":h("request",B);break;case"BufferFull":h("complete"),ve&&(e.postMessage({type:"stepPlay",data:"findIFrame"}),o.startRendering(),ve=!1)}break;case"setVideoTagMode":ke.prototype.setLiveMode(i.data);break;case"playbackFlag":!0===i.data?me.type="playback":me.type="live",null!==Y&&Y.setPlaybackFlag(i.data);break;case"error":null!==d&&d(i.data);break;case"MSEResolutionChanged":b(i.data);break;case"DecodeStart":var f=i.data.width-0,p=i.data.height-0;M.setAttribute("width",f),M.setAttribute("height",p),ke.prototype.setLiveMode(i.data.decodeMode),m(i.data);break;case"ivsDraw":var y=i.data.ivsDraw,g=i.data.channel;if("canvas"===A&&(void 0===_||null===_))break;if("canvas"!==A&&(void 0===ee||null===ee))break;var w="canvas"===A?_.timeStamp:ee;w=1e3*w.timestamp+w.timestamp_usec;var E="canvas"===A?w:w-parseInt(1e3*Y.getDuration());null!==S&&(T.setCallback(S),T.draw(y,E,w,g));break;case"end":Y&&Y.setRtspOver(),o&&o.setRtspOver();break;default:a.log("workerManager::videoWorker unknown data = "+i.data)}}function Ce(e){var t=e.data;switch(t.type){case"WorkerReady":++Te>=2&&pe&&pe();break;case"render":if(!0===z)break;ce!==t.codec&&(null!==i&&(le=i.getVolume(),fe=i.getInitVideoTimeStamp(),i.terminate()),31===t.audio_type&&"edge"===O?(i=null,null!==d&&d({errorCode:201})):(i=new F).setSamplingRate(t.samplingRate),null!==i&&(i.setInitVideoTimeStamp(fe),!0===R&&(le=1),i.audioInit(le)||(i=null)),ce=t.codec),null!==i&&(!0===R&&i.setBufferingFlag(),null===_||"undefined"===typeof _?i.bufferAudio(t.data,t.rtpTimeStamp,null):i.bufferAudio(t.data,t.rtpTimeStamp,_.codecType))}}function Pe(e){var t=e.data;switch(t.type){case"rtpData":f(t.data)}}function Ie(e){var t={type:"getRtpData",data:e};n.postMessage(t)}function Me(e){null!==Y&&(Y.close(),Y=null),re=!1===e?te:Math.abs(ne),W.samples=new Array(re),oe=!1,J=1,q=null,X=0,K=null,Z=0}function xe(){oe=!0,null===Y?((Y=U(r)).setCodecInfo(Q),Y.setInitSegmentFunc(Ee),Y.setVideoSizeCallback(Re),Y.setBeginDrawCallback(l),Y.init($),Y.setErrorCallback(d),Y.setSpeedPlay(ne),Y.setPlaybackFlag(H),Y.setFPS(k)):(Y.getVideoElement(),Y.setInitSegment()),Y.setAudioStartCallback(Ue)}function Ue(e,t){null!==i&&i.setBufferingFlag(e,t)}return new ke},Y=n(51),G=n.n(Y);function q(e,t){function n(e,t){n.prototype.w=e,n.prototype.h=t}return n.prototype={toString:function(){return"("+n.prototype.w+", "+n.prototype.h+")"},getHalfSize:function(){return new q(n.prototype.w>>>1,n.prototype.h>>>1)},length:function(){return n.prototype.w*n.prototype.h}},new n(e,t)}var W=function(){var e=null,t=null,n=null,r=!0,o=0,i=new Map,s=new Map,u=this,c=null;function l(){}function f(r){var u=r.data;switch(u.type){case"WorkerReady":t&&t();break;case"canvasRender":!function(t,r){if(null!=t){if(null===n){var a=new q(r.ylen,r.height);n=new _(e,a)}var u=Math.floor((h(r.time).getTime()-o)/1e3),c=r.frameNo,l={frameData:t,option:r};i.size>600&&i.clear(),!1===i.has(u)&&i.set(u,l),s.size>15e3&&s.clear(),!1===s.has(c)&&s.set(c,l)}}(u.data,u.option);break;default:a.log("workerManager::videoWorker unknown data = "+u.data)}}function h(e){var t=2e3+(e>>26),n=e>>22&15,r=e>>17&31,o=e>>12&31,i=e>>6&63,a=63&e,s=new Date;return s.setFullYear(t,n-1,r),s.setHours(o,i,a,0),s}return l.prototype={init:function(t,n){e=t,u.channel=n,(c=new G.a).onmessage=f},parseRTPData:function(e,t){!0===r&&(o=h(o=(t[19]<<24)+(t[18]<<16)+(t[17]<<8)+t[16]>>>0).getTime()),r=!1;var n=t[4],i={type:"MediaData",data:{rtspInterleave:e,payload:t},info:null,channel:u.channel};253!=n&&254!=n&&252!=n&&251!=n||c.postMessage(i)},setCallback:function(e,n){switch(e){case"WorkerReady":t=n;break;case"FileOver":this.fileOverCallback=n;break;default:a.log(e),a.log("workerManager::setCallback() : type is unknown")}},terminate:function(){c&&(c.terminate(),c=null),i&&(i=null),s&&(s=null)},play:function(){},initStartTime:function(){},pause:function(){},setLiveMode:function(){},setPlayMode:function(){},setFPS:function(){},sendSdpInfo:function(){},postRtspOver:function(){},gotoSecond:function(t,r){if(t=(t=t<0?0:t)>r?r:t,!0===i.has(t)){var o=i.get(t);return n.drawCanvas(o.frameData,o.option),{pngData:e.toDataURL(),option:o.option}}return!1},gotoFrame:function(t){if(!0===s.has(t)){var r=s.get(t);return n.drawCanvas(r.frameData,r.option),{pngData:e.toDataURL(),option:r.option}}return!1},checkLeftSize:function(e,t,n,r){var o=!1;if("next"===t)for(var a=1;a<=r;a++){var s=e+a>n?n:e+a;if(!1===(o=i.has(s)))break}else if("pre"===t)for(a=1;a<=r&&(s=e-a<1?1:e-a,!1!==(o=i.has(s)));a++);return o},clearMap:function(){i.clear(),s.clear()}},new l},X=0;function Z(e){return J(K(Q(e)))}function K(e){return te(ne(ee(e),8*e.length))}function J(e){for(var t,n=X?"0123456789ABCDEF":"0123456789abcdef",r="",o=0;o<e.length;o++)t=e.charCodeAt(o),r+=n.charAt(t>>>4&15)+n.charAt(15&t);return r}function Q(e){for(var t,n,r="",o=-1;++o<e.length;)t=e.charCodeAt(o),n=o+1<e.length?e.charCodeAt(o+1):0,55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t=65536+((1023&t)<<10)+(1023&n),o++),t<=127?r+=String.fromCharCode(t):t<=2047?r+=String.fromCharCode(192|t>>>6&31,128|63&t):t<=65535?r+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(r+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return r}function ee(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function te(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}function ne(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n=Array(80),r=1732584193,o=-271733879,i=-1732584194,a=271733878,s=-1009589776,u=0;u<e.length;u+=16){for(var c=r,l=o,f=i,h=a,p=s,y=0;y<80;y++){n[y]=y<16?e[u+y]:ae(n[y-3]^n[y-8]^n[y-14]^n[y-16],1);var d=ie(ie(ae(r,5),re(y,o,i,a)),ie(ie(s,n[y]),oe(y)));s=a,a=i,i=ae(o,30),o=r,r=d}r=ie(r,c),o=ie(o,l),i=ie(i,f),a=ie(a,h),s=ie(s,p)}return Array(r,o,i,a,s)}function re(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function oe(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function ie(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function ae(e,t){return e<<t|e>>>32-t}var se=Z;function ue(e){return function(e){if(Array.isArray(e))return ce(e)}(e)||function(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"===typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e)||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 ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function le(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var fe={4000:1,8000:2,11025:3,16000:4,20000:5,22050:6,32000:7,44100:8,48000:9,96000:16,128000:17,192000:18,64000:19};function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=[];if(!0===(arguments.length>2?arguments[2]:void 0))for(var r=0;r<t;r++)n[r]=e>>>8*(t-1-r)&255;else for(var o=0;o<t;o++)n[o]=e>>>8*o&255;return n}var pe=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.RtpInterlevedID=t,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,t,0,0,0,0],this.DHAV=[68,72,65,86],this.dhav=[100,104,97,118],this.frameNum=245}var t,n,r;return t=e,(n=[{key:"getRTPPacket",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ArrayBuffer(0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0;this.rtpDataHeadExtLength=8+("audio"===t.type?4:t.width>2048||t.height>2048?12:8),this.rtpDataHeadLength=24+this.rtpDataHeadExtLength;var r=new Uint8Array(this.rtpPacketHead.length+this.rtpDataHeadLength+e.byteLength+this.rtpDataFootLength);r.set([36,this.RtpInterlevedID],n),n+=2,r.set(he(this.rtpDataHeadLength+e.byteLength+this.rtpDataFootLength,4,!0),n),n+=4,r.set(this.DHAV,n),n+=4;var o="audio"===t.type?[240]:t.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(he(this.frameNum),n),n+=4,this.frameNum++;var i=he(this.rtpDataHeadLength+e.byteLength+this.rtpDataFootLength);r.set(i,n),n+=4;var a=new Date("2000-01-01 00:00:00").getTime();this.timestamp=1e3*t.timestamp/t.timescale,this.timestamp>this.MAXFRAMEINTERVAL&&(this.timestamp=this.timestamp-this.MAXFRAMEINTERVAL),r.set(he(Math.floor((a+this.timestamp)/1e3)),n),n+=4,r.set(he(this.timestamp,2),n),n+=2,r.set([this.rtpDataHeadExtLength],n),n+=1;var s=function(e,t){for(var n=0,r=t;r<e.length;r++)n+=e[r];return n}(r,6);r.set([s],n),n+=1;var u=[];u="video"===t.type?t.width>2048||t.height>2048?[130,0,0,0].concat(ue(he(t.width,2)),ue(he(t.height,2))):[128,0,t.width/8,t.height/8]:[131,1,26,fe[t.timescale]],r.set(u,n),n+=u.length,"video"===t.type&&(r.set([129,0,this.getHexByCodec(this.VideoCodec),50],n),n+=4);var c=function(e,t){for(var n=0,r=0;r<t;r++)n+=e[r]<<r%4*8;return n}(e,e.byteLength);return r.set([136],n),n+=1,r.set(he(c),n),n+=4,r.set([0,0,0],n),n+=3,r.set(e,n),n+=e.byteLength,r.set(this.dhav,n),n+=4,r.set(i,n),r}},{key:"getHexByCodec",value:function(e){var t=8;switch(e){case"H264":t=8;break;case"H265":t=12}return t}}])&&le(t.prototype,n),r&&le(t,r),e}();function ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var de=n(52),me=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.CodecCallback=function(){},this.TrackCallback=function(){}}var t,n,r;return t=e,(n=[{key:"init",value:function(e){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(e.tracks[0].samples,e.tracks[1].samples),this.VideoCodec=this.getCodec(e.tracks[0].codec),this.AudioCodec=this.getCodec(e.tracks[1].codec),this.Framerate=this.getFPS(e.tracks[0].samples),this.clockFreq=e.tracks[1].samples[0].timescale,this.AudioCodecInfo={config:"1408",clockFreq:this.clockFreq,bitrate:void 0},this.packetDHAV=new pe(0,this.VideoCodec,this.AudioCodec),this.CodecCallback({VideoCodec:this.VideoCodec,AudioCodec:this.AudioCodec,Framerate:this.Framerate,AudioCodecInfo:this.AudioCodecInfo})}},{key:"setMovieData",value:function(e){var t=e.subarray(0,20);if(this.isMoov=t[8],e=e.subarray(20,e.length),this.isMoov){var n=de.MovieParser.parse(e);n&&this.init(n)}else this.length=(t[7]<<24|t[6]<<16|t[5]<<8|t[4])-20,this.position=t[15]<<48|t[14]<<40|t[13]<<32|t[12]<<24|t[11]<<16|t[10]<<8|t[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(e)),this.getFrameData()}},{key:"getFrameData",value:function(){var e=this.track[this.currentFrame];if(this.MovieBuffer.length+this.currentDeleteLen>=e.offset+e.size){var t=null;if(e instanceof de.VideoSample){var n=this.set_nal_unit_type(this.MovieBuffer.subarray(e.offset-this.currentDeleteLen,e.offset+e.size-this.currentDeleteLen));t=this.packetDHAV.getRTPPacket(n,e)}else t=this.packetDHAV.getRTPPacket(this.MovieBuffer.subarray(e.offset-this.currentDeleteLen,e.offset+e.size-this.currentDeleteLen),e);(this.isSeek&&e.keyframe||!this.isSeek)&&(this.TrackCallback(t),this.isSeek=!1),this.MovieBuffer=this.MovieBuffer.subarray(e.offset+e.size-this.currentDeleteLen,this.MovieBuffer.length),this.currentDeleteLen=e.offset+e.size,this.currentFrame++,this.currentFrame<this.track.length&&this.getFrameData()}}},{key:"getCurrentSeekFrame",value:function(){var e=0,t=this.track.length-1,n=this.position;if(this.track[0].offset>=n)return 0;for(;e<=t;){var r=parseInt((t+e)/2),o=this.track[r];if(n===o.offset)return r;if(n>o.offset){if(n<o.offset+o.size)return r+1;e=r+1}else{if(!(n<o.offset))return-1;t=r-1}}}},{key:"set_nal_unit_type",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array,t=0,n=0,r=function(t,n){var r="";return e.slice(t,n).map(function(e){return r+=1===e.toString(16).length?"0"+e.toString(16):e.toString(16)}),parseInt(r,16)};e.length>4&&n<e.length;)t=r(n,n+4),e.set([0,0,0,1],n),n=n+t+4;return e}},{key:"concatUint8Array",value:function(){for(var e=0,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){e+=i[o].length}for(var a=new Uint8Array(e),s=0,u=0,c=n;u<c.length;u++){var l=c[u];a.set(l,s),s+=l.length}return a}},{key:"concatArray",value:function(e,t){return e.concat(t).sort(function(e,t){return e.offset-t.offset})}},{key:"getCodec",value:function(e){var t="";return/hvc1/g.test(e)&&(t="H265"),/avc1/g.test(e)&&(t="H264"),/mp4a/g.test(e)&&(t="mpeg4-generic"),t}},{key:"getFPS",value:function(e){for(var t=60,n=0,r=e.length>=60?60:e.length;n<r;n++)if(e[n].timestamp<=e[n].timescale&&e[n+1].timestamp>e[n].timescale){t=n;break}return t}},{key:"parseToString",value:function(e){for(var t="",n=0,r=e.length;n<r;n++)t+=(1===e[n].toString(16).length?"0"+e[n].toString(16):e[n].toString(16))+((n+1)%16===0?"\n":(n+1)%8===0?" ":" ");return t}}])&&ye(t.prototype,n),r&&ye(t,r),e}();function ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(n),!0).forEach(function(t){be(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ve(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){return t=(t=t.toLowerCase())[0].toUpperCase()+t.substr(1),Object.prototype.toString.call(e)==="[object "+t+"]"}function Se(e,t,n){if(void 0===n&&(n=2),void 0===t&&(t=0),(e=e.toString()).length>=n)return e;var r=n-e.length;return new Array(r).fill(String(t)).join("")+e}function Te(e,t){return void 0!==e&&e?(t=t||new Date,e=(e=(e=(e=(e=(e=e.replace(/y/gi,Se(t.getFullYear()),0)).replace(/m/gi,Se(t.getMonth()+1),0)).replace(/d/gi,Se(t.getDate()),0)).replace(/h/gi,Se(t.getHours()),0)).replace(/i/gi,Se(t.getMinutes()),0)).replace(/s/gi,Se(t.getSeconds()),0)):""}function Oe(e,t){var n=(e=e||{}).nameFormat||["ymd_his"];t=t||new Date;var r="";if(we(n,"string"))n=[n,{}];else{if(!we(n,"array"))return void function(e){throw new Error(e)}("name format must be string or array");we(n[0],"string")||(n[0]="ymd_his"),we(n[1],"object")||(n[1]={})}var o=n[0].split(/\{(?:[^{}]+)\}/),i=n[1];n[0].replace(/\{([^{}]*)\}/g,function(e,t,n){o.shift();r+=Te(),r+=t in i?i[t]:e});var a=o.shift();return r+=Te(a,t)}function _e(e,t){this.name=e,this.allowUpDateName=!0,this.byteLength=0,this.options=t,this.startTime=(new Date).toLocaleString()}_e.prototype.setEndTime=function(){this.endTime=(new Date).toLocaleString()},_e.prototype.updateNameByStream=function(e,t){if(this.allowUpDateName){var n=new Uint8Array(t),r=(n[19]<<24)+(n[18]<<16)+(n[17]<<8)+n[16]>>>0,o="20"+(r>>26)+"/"+(r>>22&15)+"/"+(r>>17&31)+" "+(r>>12&31)+":"+(r>>6&63)+":"+(63&r);this.name=Oe(e,new Date(o)),this.allowUpDateName=!1,n=null}t=null};var ke=new function(){var e={count:0,total:0,group:[]},t=function(){};return t.prototype.add=function(t){e.count++,e.total+=t.byteLength,e.group.push(t)},t.prototype.get=function(t){return t in e?e[t]:e},new t};var Ee=function(){var e=1048576,t=null,n=null,r=0,o=void 0,i=null;function a(){this.onMessage=function(){},this.postMessage=function(e){this.__onMessage(e)},this.__postMessage=function(e){this.onMessage(e)}}return a.prototype.__onMessage=function(e){var t=e;switch(t.type){case"init":this.init(t.options);break;case"addBuffer":this.addBuffer(t);break;case"close":this.close()}},a.prototype.init=function(t){this.fullSize=t.fullSize||1/0,this.singleSize=t.singleSize+20*e||520*e,o="init",this.limitOptions=Object.assign({limitBy:"fullSize"},t.limitOptions),this.nameOptions=Object.assign({namedBy:"date",nameFormat:["ymd_his",{}]},t.nameOptions)},a.prototype._malloc=function(e){t&&n&&(n=null,t=null),t=new ArrayBuffer(e),n=new DataView(t);var r=this.nameOptions,o="";switch(this.nameOptions.namedBy.toLowerCase()){case"date":o=Oe(r);break;default:o=Oe()}i=new _e(o)},a.prototype._initVideoMem=function(){!t&&this.singleSize&&this._malloc(this.singleSize)},a.prototype.appendVideoBuf=function(t){var o=t.byteLength,i=r+o;if(i>this.singleSize-20*e)this.inNodePlace(),this.addBuffer({buffer:t});else{for(var a=r;a<i;a++)n.setUint8(a,t[a-r]);r=i,this.__postMessage({type:"pendding",size:r,total:this.singleSize})}},a.prototype.addBuffer=function(e){if("closed"!==o){var t=e.buffer;this._initVideoMem(),o="addBuffer";var n=t.length,i=r+n;ke.get("total")+i>this.fullSize?this.close():this.appendVideoBuf(t)}},a.prototype.inNodePlace=function(){if("addBuffer"===o){o="download",i.updateNameByStream(this.nameOptions,t.slice(0,20)),i.byteLength=r,i.setEndTime(),ke.add(i);var e=t.slice(0,r);if(this.reset(),this.__postMessage({type:"download",data:ge(ge({},i),{},{buffer:e})}),e=null,"count"===this.limitOptions.limitBy){var n=this.limitOptions.count;n&&n===ke.get("count")&&this.close()}}},a.prototype.reset=function(){r=0,this._malloc(this.singleSize)},a.prototype.close=function(){this.inNodePlace(),"closed"!==o&&void 0!==o&&(o="closed",this.__postMessage({type:"closed",message:"record was closed"}),t=null,n=null)},new a},Re=function(e){var t=e.wsURL,n=e.rtspURL,r=null,o=e.isTalkService,s=e.realm,u=6,c=null,l=null,f=0,y=0,d='Authorization: WSSE profile="UsernameToken"',m=-1!==n.search("&srctype=raw"),v=new me,g=e.RTSP_STATE,b=e.workerManager,w=new Ee,S=!1,T=new Function,O=4e4,_=null,k=[],E=0,R=function(){},A={},C="UnAuthorized",P=null,I={},M=null,x=null,U=!0,D={},B="",j=!1,L=0,F=!1,N={PLAY:0,PAUSE:1,KEEP_LIVE:2,STOP:3};e.isRecord&&(["init","sendSdpInfo","parseRTPData","setCallback"].forEach(function(e,t){b[e]=function(){}}),w.postMessage({type:"init",options:{singleSize:524288e3,nameOptions:{namedBy:"date",nameFormat:["ymd_his"]},limitOptions:{limitBy:"count",count:10}}}),w.onMessage=function(e){switch(e.type){case"pendding":T(e);break;case"download":!function(e,t){e=(e=(e||Date.now())+"").toLowerCase().split(".dav")[0];var n=new Blob([t]),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=e+".dav",r.click(),setTimeout(function(){URL.revokeObjectURL(r.href),r=null},100),t=null}(e.data.name,e.data.buffer);break;case"closed":T(e),S=!1}});function z(){}function V(e,r){var u="",c="",l=i(D.username+":"+s+":"+D.password),f=t.split("://")[1].split("/")[0].split(":")[0]+":8086";switch(e){case 0:var h=function(){for(var e=[],t=0;t<32;t++)e.push(String.fromCharCode(256*Math.random()|0));return i(e.join(""))}(),p=function(){var e=new Date,t=e.getTimezoneOffset(),n=e.getTime()+60*t*1e3,r=new Date(n),o=r.getFullYear(),i=r.getMonth()+1,a=r.getDate(),s=r.getHours(),u=r.getMinutes(),c=r.getSeconds(),l=function(e){return e<10?"0"+e:e};return o+"-"+l(i)+"-"+l(a)+"T"+l(s)+":"+l(u)+":"+l(c)+"Z"}(),y=function(e){for(var t,n,r,o,i,a,s,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",l=0;l<e.length;)t=e[l++],n=e[l++],r=e[l++],o=t>>2,i=(3&t)<<4|n>>4,a=(15&n)<<2|r>>6,s=63&r,isNaN(n)?a=s=64:isNaN(r)&&(s=64),c=c+u.charAt(o)+u.charAt(i)+u.charAt(a)+u.charAt(s);return c}(function(e){var t,n=e.trim(),r="0x"===n.substr(0,2).toLowerCase()?n.substr(2):n,o=r.length;if(o%2!==0)return"";for(var i=[],a=0;a<o;a+=2)t=parseInt(r.substr(a,2),16),i.push(t);return i}(se(h+p+l.toUpperCase())));u="GET "+n+(j?"?":"&")+"method="+e+" HTTP/1.1\r\n",u+="Accept-Sdp: Private\r\n",u+=_+"\r\n",u+="Connection: keep-alive\r\nCseq: "+E+"\r\nHost: "+f+"\r\n",r?u+="Range: npt="+r+"-\r\n":"ContinuePlay"!==C&&(u+="Range: npt=0.000000-\r\n"),!0===o&&(c+="v=0\r\n",c+="o=- 2208989105 2208989105 IN IP4 0.0.0.0\r\n",c+="s=Media Server\r\n",c+="c=IN IP4 0.0.0.0\r\n",c+="t=0 0\r\n",c+="a=control:*\r\n",c+="a=packetization-supported:DH\r\n",c+="a=rtppayload-supported:DH\r\n",c+="a=range:npt=now-\r\n",c+="m=audio 0 RTP/AVP 8\r\n",c+="a=control:trackID=5\r\n",c+="a=rtpmap:8 PCMA/16000\r\n",u+="Private-Length: "+(c+="a=sendonly\r\n").length+"\r\n",u+="Private-Type: application/sdp\r\n"),u+=_===d?'WSSE: UsernameToken Username="'+D.username+'", PasswordDigest="'+y+'", Nonce="'+h+'", Created="'+p+'"\r\n\r\n':"\r\n",u+=c;break;case 1:u="GET "+n+"?method="+e+" HTTP/1.1\r\n",u+="Connection: keep-alive\r\nCseq: "+E+"\r\nHost: "+f+"\r\n\r\n";break;case 2:case 3:u="GET "+n+(j?"?":"&")+"method="+e+" HTTP/1.1\r\n",u+="Connection: keep-alive\r\nCseq: "+E+"\r\nHost: "+f+"\r\n\r\n"}return a.log(u),u}function H(e){a.log(e);var t,r=e.search("Cseq: ")+5;if(E=parseInt(e.slice(r,r+10))+1,isNaN(E)&&(E=1),(t=function(e){var t={},n=0,r=0,o=null,i=null;if(-1!==e.search("Private-Type: application/sdp")){var a=e.split("\r\n\r\n");i=a[0]}else i=e;var s=i.split("\r\n"),u=s[0].split(" ");if(u.length>2&&(t.ResponseCode=parseInt(u[1]),t.ResponseMessage=u[2]),t.ResponseCode===g.OK){for(n=1;n<s.length;n++)if("Cseq"===(o=s[n].split(":"))[0])t.Cseq=parseInt(o[1]);else if("Private-Type"===o[0])t.ContentType=o[1],-1!==t.ContentType.search("application/sdp")&&(t.SDPData=W(e));else if("Private-Length"===o[0])t.ContentLength=parseInt(o[1]);else if("Session-Id"===o[0]){var c=o[1].split(";");t.SessionID=parseInt(c[0])}}else if(t.ResponseCode===g.UNAUTHORIZED)for(n=1;n<s.length;n++)if("Cseq"===(o=s[n].split(":"))[0])t.Cseq=parseInt(o[1]);else if("WWW-Authenticate"===o[0]){var l=o[1].split(",");for(r=0;r<l.length;r++){var f=l[r].search("Digest realm=");if(-1!==f){var h=l[r].substr(f+13).split('"');t.Realm=h[1]}if(-1!==(f=l[r].search("nonce="))){var p=l[r].substr(f+6).split('"');t.Nonce=p[1]}}}return t}(e)).ResponseCode===g.UNAUTHORIZED&&_===d)!function(e){var t=D.username,r=D.passWord,o={Method:null,Realm:null,Nonce:null,Uri:null},i=null;o={Method:"GET",Realm:e.Realm,Nonce:e.Nonce,Uri:n},i=p(t,r,o.Uri,o.Realm,o.Nonce,o.Method),_='Authorization: Digest username="'+t+'", realm="'+o.Realm+'",',_+=' nonce="'+o.Nonce+'", uri="'+o.Uri+'", response="'+i+'"',Y(V(N.PLAY,L))}(t);else if(t.ResponseCode===g.OK)if("UnAuthorized"===C){A=W(e);var i=0;for(i=0;i<A.Sessions.length;i+=1){var s={};"JPEG"===A.Sessions[i].CodecMime||"H264"===A.Sessions[i].CodecMime||"H265"===A.Sessions[i].CodecMime||"H264-SVC"==A.Sessions[i].CodecMime||"RAW"==A.Sessions[i].CodecMime?(s.codecName=A.Sessions[i].CodecMime,"H264-SVC"===A.Sessions[i].CodecMime&&(s.codecName="H264"),"H265"!==A.Sessions[i].CodecMime&&"RAW"!==A.Sessions[i].CodecMime||z.prototype.setLiveMode("canvas"),s.trackID=A.Sessions[i].ControlURL,s.ClockFreq=A.Sessions[i].ClockFreq,s.Port=parseInt(A.Sessions[i].Port),"undefined"!==typeof A.Sessions[i].Framerate&&(s.Framerate=parseInt(A.Sessions[i].Framerate),b.setFPS(s.Framerate),M(s.Framerate)),k.push(s)):"PCMU"===A.Sessions[i].CodecMime||-1!==A.Sessions[i].CodecMime.search("G726-16")||-1!==A.Sessions[i].CodecMime.search("G726-24")||-1!==A.Sessions[i].CodecMime.search("G726-32")||-1!==A.Sessions[i].CodecMime.search("G726-40")||"PCMA"===A.Sessions[i].CodecMime||-1!==A.Sessions[i].CodecMime.search("G723.1")||-1!==A.Sessions[i].CodecMime.search("G729")||-1!==A.Sessions[i].CodecMime.search("MPA")||-1!==A.Sessions[i].CodecMime.search("L16")?("PCMU"===A.Sessions[i].CodecMime?s.codecName="G.711Mu":"G726-16"===A.Sessions[i].CodecMime?s.codecName="G.726-16":"G726-24"===A.Sessions[i].CodecMime?s.codecName="G.726-24":"G726-32"===A.Sessions[i].CodecMime?s.codecName="G.726-32":"G726-40"===A.Sessions[i].CodecMime?s.codecName="G.726-40":"PCMA"===A.Sessions[i].CodecMime?s.codecName="G.711A":"G723.1"===A.Sessions[i].CodecMime?s.codecName="G.723":"G729"===A.Sessions[i].CodecMime?s.codecName="G.729":"MPA"===A.Sessions[i].CodecMime?s.codecName="mpeg2":"L16"===A.Sessions[i].CodecMime&&(s.codecName="PCM"),s.trackID=A.Sessions[i].ControlURL,s.ClockFreq=A.Sessions[i].ClockFreq,s.Port=parseInt(A.Sessions[i].Port),s.Bitrate=parseInt(A.Sessions[i].Bitrate),s.TalkTransType=A.Sessions[i].TalkTransType,k.push(s)):"mpeg4-generic"===A.Sessions[i].CodecMime||"MPEG4-GENERIC"===A.Sessions[i].CodecMime?(s.codecName="mpeg4-generic",s.trackID=A.Sessions[i].ControlURL,s.ClockFreq=A.Sessions[i].ClockFreq,s.Port=parseInt(A.Sessions[i].Port),s.Bitrate=parseInt(A.Sessions[i].Bitrate),s.TalkTransType=A.Sessions[i].TalkTransType,k.push(s)):"vnd.onvif.metadata"===A.Sessions[i].CodecMime?(s.codecName="MetaData",s.trackID=A.Sessions[i].ControlURL,s.ClockFreq=A.Sessions[i].ClockFreq,s.Port=parseInt(A.Sessions[i].Port),k.push(s)):"stream-assist-frame"===A.Sessions[i].CodecMime?(s.codecName="stream-assist-frame",s.trackID=A.Sessions[i].ControlURL,s.ClockFreq=A.Sessions[i].ClockFreq,s.Port=parseInt(A.Sessions[i].Port),k.push(s)):("audio"===A.Sessions[i].Type&&R({errorCode:201}),a.log("Unknown codec type:",A.Sessions[i].CodecMime,A.Sessions[i].ControlURL))}if(!1===o)return void R({errorCode:404,description:"rtsp not found"});for(var u=0;u<k.length;u++)k[u].RtpInterlevedID=2*(k[u].trackID.split("=")[1]-0);!m&&b.sendSdpInfo(k,I),!0===o&&b.setCallback("audioTalk",G),clearInterval(P),P=setInterval(function(){return Y(V(N.KEEP_LIVE,null))},O),C="Playing"}else"ContinuePlay"===C?C="Playing":"Playing"===C||a.log("unknown rtsp state:"+C);else{if(t.ResponseCode===g.NOTSERVICE)return!0===o?void R({errorCode:504,description:"Talk Service Unavilable",place:"RtspClient.js"}):void R({errorCode:503,description:"Service Unavilable"});if(t.ResponseCode===g.NOTFOUND)return void R({errorCode:404,description:"rtsp not found"});if(t.ResponseCode===g.INTERNALSERVERERROR)return void R({errorCode:500,description:"Internal Server Error"})}}function Y(e){void 0!=e&&null!=e&&""!=e&&(r&&r.readyState===WebSocket.OPEN?void 0!=e&&r.send(h(e)):a.log("ws\u672a\u8fde\u63a5"))}function G(e){!0===o&&function(e){null!==r&&r.readyState===WebSocket.OPEN?r.send(e):a.log("SendRtpData - Websocket does not exist")}(e)}function q(e){var t=new Uint8Array,n=new Uint8Array(e.data);for((t=new Uint8Array(n.length)).set(n,0),f=t.length;f>0;)if(36!==t[0]){var o=String.fromCharCode.apply(null,t),i=null;if(-1!==o.indexOf("OffLine:File Over")&&(r.fileOver=!0,b.postRtspOver()),-1!==o.indexOf("OffLine: KmsUnavailable"))return void R({errorCode:203});if(-1!==o.indexOf("OffLine: CheckChannelAuthFailed"))return void R({errorCode:204});if(-1!==o.indexOf("OffLine: PasswdUnitFailed"))return void R({errorCode:205});if(-1!==o.indexOf("OffLine: OverFlowMaxConnect"))return void R({errorCode:206});if(-1!==o.indexOf("OffLine: StreamSourceStartFailed"))return void R({errorCode:404});!1===F&&-1!==o.indexOf("200 OK")?(i=o.lastIndexOf("\r\n"),F=!0):i=o.search("\r\n\r\n");var a=o.search("HTTP");if(-1===a)return void(t=new Uint8Array);if(-1===i)return void(f=t.length);c=t.subarray(a,i+u),t=t.subarray(i+u),H(String.fromCharCode.apply(null,c)),f=t.length}else{if("RAW"===k[0].codecName)return void(/.aac/.test(rtspUrl)?b.sendBufferToAudioWorker(t.subarray(u,t.length)):v.setMovieData(t.subarray(u,t.length)));if(!0===U&&x&&x(),U=!1,l=t.subarray(0,u),!((y=l[2]<<24|l[3]<<16|l[4]<<8|l[5])+u<=t.length))return void(f=t.length);var s=t.subarray(u,y+u);S&&w.postMessage({type:"addBuffer",buffer:s}),b.parseRTPData(l,s),t=t.subarray(y+u),f=t.length}}function W(e){var t={Sessions:[]},n=(-1!==e.search("Private-Type: application/sdp")?e.split("\r\n\r\n")[1]:e).split("\r\n"),r=0,i=!1;for(r=0;r<n.length;r++){var a=n[r].split("=");if(a.length>0)switch(a[0]){case"a":var s=a[1].split(":");if(s.length>1){if("control"===s[0]){var u=n[r].search("control:");!0===i?-1!==u&&(t.Sessions[t.Sessions.length-1].ControlURL=n[r].substr(u+8)):-1!==u&&(t.BaseURL=n[r].substr(u+8))}else if("rtpmap"===s[0]){var c=s[1].split(" ");t.Sessions[t.Sessions.length-1].PayloadType=c[0];var l=c[1].split("/");t.Sessions[t.Sessions.length-1].CodecMime=l[0],l.length>1&&(t.Sessions[t.Sessions.length-1].ClockFreq=l[1])}else if("framesize"===s[0]){var f=s[1].split(" ");if(f.length>1){var h=f[1].split("-");t.Sessions[t.Sessions.length-1].Width=h[0],t.Sessions[t.Sessions.length-1].Height=h[1]}}else if("framerate"===s[0])t.Sessions[t.Sessions.length-1].Framerate=s[1];else if("fmtp"===s[0]){var p=n[r].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&&(t.Sessions[t.Sessions.length-1].mode=d[m].substr(v+5)),-1!==(v=d[m].search("config="))&&(t.Sessions[t.Sessions.length-1].config=d[m].substr(v+7),I.config=t.Sessions[t.Sessions.length-1].config,I.clockFreq=t.Sessions[t.Sessions.length-1].ClockFreq,I.bitrate=t.Sessions[t.Sessions.length-1].Bitrate),-1!==(v=d[m].search("sprop-vps="))&&(t.Sessions[t.Sessions.length-1].VPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-sps="))&&(t.Sessions[t.Sessions.length-1].SPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-pps="))&&(t.Sessions[t.Sessions.length-1].PPS=d[m].substr(v+10)),-1!==(v=d[m].search("sprop-parameter-sets="))){var g=d[m].substr(v+21).split(",");g.length>1&&(t.Sessions[t.Sessions.length-1].SPS=g[0],t.Sessions[t.Sessions.length-1].PPS=g[1])}}}}}else 1===s.length&&("recvonly"===s[0]?t.Sessions[t.Sessions.length-1].TalkTransType="recvonly":"sendonly"===s[0]&&(t.Sessions[t.Sessions.length-1].TalkTransType="sendonly"));break;case"m":var b=a[1].split(" "),w={};w.Type=b[0],w.Port=b[1],w.Payload=b[3],t.Sessions.push(w),i=!0;break;case"b":if(!0===i){var S=a[1].split(":");t.Sessions[t.Sessions.length-1].Bitrate=S[1]}}}if(!0===o)for(var T=0;T<t.Sessions.length;T+=1)"1"!==t.Sessions[T].ControlURL.split("=")[1]&&"2"!==t.Sessions[T].ControlURL.split("=")[1]||t.Sessions.splice(T,1);return t}return z.prototype={connect:function(){r||((r=new WebSocket(t)).binaryType="arraybuffer",r.fileOver=!1,r.addEventListener("message",q,!1),r.onopen=function(){_=d,Y(V(N.PLAY,L))},r.onerror=function(e){R({errorCode:202,description:"Open WebSocket Error"})},r.onclose=function(e){r&&!r.fileOver&&R({errorCode:202,description:"Open WebSocket Error"})})},disconnect:function(){Y(V(N.STOP,null)),clearInterval(P),P=null,r&&(r.onerror=null,r.close(),r=null),b.terminate()},controlPlayer:function(e){var t="",n=null;switch(B=e.command,e.command){case"PLAY":if(b.play(),"Pause"===C&&(C="ContinuePlay"),null!==e.range&&void 0!==e.range){t=V(N.PLAY,e.range);break}t=V(N.PLAY,null),B&&b.initStartTime();break;case"PAUSE":if("PAUSE"===C)break;C="PAUSE",t=V(N.PAUSE,null),b.pause();break;case"TEARDOWN":t=V(N.STOP,null);break;case"audioPlay":if("start"===e.data)C="Playing",t=V("PLAY",e.range);else if("stop"===e.data)t=V("TEARDOWN",null);else{if("PAUSE"===C)break;C="PAUSE",t=V("PAUSE",null)}b.controlAudio(e.command,e.data);break;case"volumn":case"audioSamplingRate":b.controlAudio(e.command,e.data);break;case"playNextFrame":b.getVideoBufferQueueSize()<5&&this.getNextFrameData(1e3),b.playNextFrame();break;case"getCurFrameInfo":n=b.getCurFrameInfo();break;case"getCapture":b.getCapture();break;case"startRecod":(S=e.data)||w.postMessage({type:"close"});break;default:a.log("\u672a\u77e5\u6307\u4ee4: "+e.command)}if(""!=t&&Y(t),n)return n},setLiveMode:function(e){b.setLiveMode(e)},setPlayMode:function(e,t){j=e,L=t,b.setPlayMode(e)},setSignalURL:function(e){n=e},setCallback:function(e,t){"GetFrameRate"===e?M=t:"GetFirstFrame"===e?x=t:"recordChanged"===e?T=t:b.setCallback(e,t),"Error"==e&&(R=t)},setUserInfo:function(e,t){D.username=e,D.passWord=t},getNextFrameData:function(e){Y(V("PLAY",null)),setTimeout(function(){Y(V("PAUSE",null))},e)}},v.CodecCallback=function(e){I=e.AudioCodecInfo,k[0].Framerate=e.Framerate,"H264"===I.VideoCodec&&z.prototype.setLiveMode("video"),b.sendSdpInfo(k,I,e)},v.TrackCallback=function(e){var t=new Uint8Array(e.subarray(6,e.length));b.parseRTPData(e.subarray(0,6),t)},new z},Ae=function(e){var t=e.wsURL,n=e.rtspURL,r=null,o=e.isTalkService,i=6,s=null,u=null,c=0,l=0,f=!1,y=!1,d=e.RTSP_STATE,m=-1!==n.search("&srctype=raw"),v=new me,g=e.workerManager,b=4e4,w="",S=[],T=1,O=function(){},_={},k="Options",E=null,R=null,A="",C=null,P={},I=null,M=null,x=!0,U={},D="",B=!1,j=0,L=0,F=new Ee,N=!1,z=new Function;e.isRecord&&(["init","sendSdpInfo","parseRTPData","setCallback"].forEach(function(e,t){g[e]=function(){}}),F.postMessage({type:"init",options:{singleSize:524288e3,nameOptions:{namedBy:"date",nameFormat:["ymd_his"]},limitOptions:{limitBy:"count",count:10}}}),F.onMessage=function(e){switch(e.type){case"pendding":z(e);break;case"download":!function(e,t){e=(e=(e||Date.now())+"").toLowerCase().split(".dav")[0];var n=new Blob([t]),r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=e+".dav",r.click(),setTimeout(function(){URL.revokeObjectURL(r.href),r=null},100),t=null}(e.data.name,e.data.buffer);break;case"closed":z(e),N=!1}});function V(){}function H(e,t,r,i){var s="";switch(e){case"OPTIONS":case"TEARDOWN":case"GET_PARAMETER":case"SET_PARAMETERS":s=e+" "+n+" RTSP/1.0\r\nCSeq: "+T+"\r\n"+w+"\r\n";break;case"DESCRIBE":s=e+" "+n+" RTSP/1.0\r\nCSeq: "+T,!0===o&&(s+="\r\nRequire: www.onvif.org/ver20/backchannel"),s=s+"\r\n"+w+"\r\n";break;case"SETUP":a.log("trackID: "+t),s=e+" "+n+"/trackID="+t+" RTSP/1.0\r\nCSeq: "+T+"\r\n"+w+"Transport: DH/AVP/TCP;unicast;interleaved="+2*t+"-"+(2*t+1)+"\r\n",s+=0!=R?"Session: "+R+"\r\n\r\n":"\r\n";break;case"PLAY":s=e+" "+n+" RTSP/1.0\r\nCSeq: "+T+"\r\nSession: "+R+"\r\n",void 0!=i&&0!=i?(s+="Range:".concat(m?"byte":"npt","=").concat(i,"-\r\n"),s+=w+"\r\n"):s+=w+"\r\n";break;case"PAUSE":s=e+" "+n+" RTSP/1.0\r\nCSeq: "+T+"\r\nSession: "+R+"\r\n\r\n";break;case"SCALE":s="PLAY "+n+" RTSP/1.0\r\nCSeq: "+T+"\r\nSession: "+R+"\r\n",s+="Scale: "+i+"\r\n",s+=w+"\r\n"}return a.log(s),s}function Y(e){a.log(e);var t,r=e.search("CSeq: ")+5;if(T=parseInt(e.slice(r,r+10))+1,(t=function(e){var t={},n=0,r=0,o=null,i=null;if(-1!==e.search("Content-Type: application/sdp")){var a=e.split("\r\n\r\n");i=a[0]}else i=e;var s=i.split("\r\n"),u=s[0].split(" ");if(u.length>2&&(t.ResponseCode=parseInt(u[1]),t.ResponseMessage=u[2]),t.ResponseCode===d.OK){for(n=1;n<s.length;n++)if("Public"===(o=s[n].split(":"))[0])t.MethodsSupported=o[1].split(",");else if("CSeq"===o[0])t.CSeq=parseInt(o[1]);else if("Content-Type"===o[0])t.ContentType=o[1],-1!==t.ContentType.search("application/sdp")&&(t.SDPData=X(e));else if("Content-Length"===o[0])t.ContentLength=parseInt(o[1]);else if("Content-Base"===o[0]){var c=s[n].search("Content-Base:");-1!==c&&(t.ContentBase=s[n].substr(c+13))}else if("Session"===o[0]){var l=o[1].split(";");t.SessionID=parseInt(l[0])}else if("Transport"===o[0]){var f=o[1].split(";");for(r=0;r<f.length;r++){var h=f[r].search("interleaved=");if(-1!==h){var p=f[r].substr(h+12),y=p.split("-");y.length>1&&(t.RtpInterlevedID=parseInt(y[0]),t.RtcpInterlevedID=parseInt(y[1]))}}}else if("RTP-Info"===o[0]){o[1]=s[n].substr(9);var m=o[1].split(",");for(t.RTPInfoList=[],r=0;r<m.length;r++){var v=m[r].split(";"),g={},b=0;for(b=0;b<v.length;b++){var w=v[b].search("url=");-1!==w&&(g.URL=v[b].substr(w+4)),-1!==(w=v[b].search("seq="))&&(g.Seq=parseInt(v[b].substr(w+4)))}t.RTPInfoList.push(g)}}}else if(t.ResponseCode===d.UNAUTHORIZED)for(n=1;n<s.length;n++)if("CSeq"===(o=s[n].split(":"))[0])t.CSeq=parseInt(o[1]);else if("WWW-Authenticate"===o[0]){var S=o[1].split(",");for(r=0;r<S.length;r++){var T=S[r].search("Digest realm=");if(-1!==T){var O=S[r].substr(T+13).split('"');t.Realm=O[1]}if(-1!==(T=S[r].search("nonce="))){var _=S[r].substr(T+6).split('"');t.Nonce=_[1]}}}return t}(e)).ResponseCode===d.UNAUTHORIZED&&""===w)!function(e){var t=U.username,r=U.passWord,o={Method:null,Realm:null,Nonce:null,Uri:null},i=null;o={Method:k.toUpperCase(),Realm:e.Realm,Nonce:e.Nonce,Uri:n},i=p(t,r,o.Uri,o.Realm,o.Nonce,o.Method),w='Authorization: Digest username="'+t+'", realm="'+o.Realm+'",',w+=' nonce="'+o.Nonce+'", uri="'+o.Uri+'", response="'+i+'"',w+="\r\n",q(H("OPTIONS",null))}(t);else if(t.ResponseCode===d.OK){if("Options"===k)return k="Describe",L=setTimeout(function(){O({errorCode:404})},6e3),H("DESCRIBE",null);if("Describe"===k){L&&clearTimeout(L),L=0,_=X(e),"undefined"!==typeof t.ContentBase&&(_.ContentBase=t.ContentBase);var i=0;for(i=0;i<_.Sessions.length;i+=1){var s={};"JPEG"===_.Sessions[i].CodecMime||"H264"===_.Sessions[i].CodecMime||"H265"===_.Sessions[i].CodecMime||"H264-SVC"==_.Sessions[i].CodecMime||"RAW"==_.Sessions[i].CodecMime?(s.codecName=_.Sessions[i].CodecMime,"H264-SVC"===_.Sessions[i].CodecMime&&(s.codecName="H264"),"H265"!==_.Sessions[i].CodecMime&&"RAW"!==_.Sessions[i].CodecMime||V.prototype.setLiveMode("canvas"),s.trackID=_.Sessions[i].ControlURL,s.ClockFreq=_.Sessions[i].ClockFreq,s.Port=parseInt(_.Sessions[i].Port),"undefined"!==typeof _.Sessions[i].Framerate&&(s.Framerate=parseInt(_.Sessions[i].Framerate),g.setFPS(s.Framerate),I(s.Framerate)),S.push(s)):"PCMU"===_.Sessions[i].CodecMime||-1!==_.Sessions[i].CodecMime.search("G726-16")||-1!==_.Sessions[i].CodecMime.search("G726-24")||-1!==_.Sessions[i].CodecMime.search("G726-32")||-1!==_.Sessions[i].CodecMime.search("G726-40")||"PCMA"===_.Sessions[i].CodecMime||-1!==_.Sessions[i].CodecMime.search("G723.1")||-1!==_.Sessions[i].CodecMime.search("G729")||-1!==_.Sessions[i].CodecMime.search("MPA")||-1!==_.Sessions[i].CodecMime.search("L16")?("PCMU"===_.Sessions[i].CodecMime?s.codecName="G.711Mu":"G726-16"===_.Sessions[i].CodecMime?s.codecName="G.726-16":"G726-24"===_.Sessions[i].CodecMime?s.codecName="G.726-24":"G726-32"===_.Sessions[i].CodecMime?s.codecName="G.726-32":"G726-40"===_.Sessions[i].CodecMime?s.codecName="G.726-40":"PCMA"===_.Sessions[i].CodecMime?s.codecName="G.711A":"G723.1"===_.Sessions[i].CodecMime?s.codecName="G.723":"G729"===_.Sessions[i].CodecMime?s.codecName="G.729":"MPA"===_.Sessions[i].CodecMime?s.codecName="mpeg2":"L16"===_.Sessions[i].CodecMime&&(s.codecName="PCM"),s.trackID=_.Sessions[i].ControlURL,s.ClockFreq=_.Sessions[i].ClockFreq,s.Port=parseInt(_.Sessions[i].Port),s.Bitrate=parseInt(_.Sessions[i].Bitrate),s.TalkTransType=_.Sessions[i].TalkTransType,S.push(s)):"mpeg4-generic"===_.Sessions[i].CodecMime||"MPEG4-GENERIC"===_.Sessions[i].CodecMime?(s.codecName="mpeg4-generic",s.trackID=_.Sessions[i].ControlURL,s.ClockFreq=_.Sessions[i].ClockFreq,s.Port=parseInt(_.Sessions[i].Port),s.Bitrate=parseInt(_.Sessions[i].Bitrate),s.TalkTransType=_.Sessions[i].TalkTransType,S.push(s)):"vnd.onvif.metadata"===_.Sessions[i].CodecMime?(s.codecName="MetaData",s.trackID=_.Sessions[i].ControlURL,s.ClockFreq=_.Sessions[i].ClockFreq,s.Port=parseInt(_.Sessions[i].Port),S.push(s)):"stream-assist-frame"===_.Sessions[i].CodecMime?(s.codecName="stream-assist-frame",s.trackID=_.Sessions[i].ControlURL,s.ClockFreq=_.Sessions[i].ClockFreq,s.Port=parseInt(_.Sessions[i].Port),S.push(s)):("audio"===_.Sessions[i].Type&&O({errorCode:201}),a.log("Unknown codec type:",_.Sessions[i].CodecMime,_.Sessions[i].ControlURL))}return!1===o?void O({errorCode:404,description:"rtsp not found"}):(E=0,k="Setup",a.log(S),H("SETUP",S[E].trackID.split("=")[1]-0))}if("Setup"===k){if(R=t.SessionID,E<S.length)return S[E].RtpInterlevedID=t.RtpInterlevedID,S[E].RtcpInterlevedID=t.RtcpInterlevedID,(E+=1)!==S.length?H("SETUP",S[E].trackID.split("=")[1]-0):(!m&&g.sendSdpInfo(S,P),!0===o&&g.setCallback("audioTalk",G),k="Play",B?H("PLAY",null,0,j):H("PLAY",null));a.log("Unknown setup SDP index")}else"Play"===k?(R=t.SessionID,clearInterval(C),C=setInterval(function(){return q(H("GET_PARAMETER",null))},b),k="Playing"):"Playing"===k||a.log("unknown rtsp state:"+k)}else if(t.ResponseCode===d.NOTSERVICE){if("Setup"===k&&"sendonly"===S[E].TalkTransType)return S[E].RtpInterlevedID=-1,S[E].RtcpInterlevedID=-1,E+=1,o=!1,O({errorCode:"504",description:"Talk Service Unavilable",place:"RtspClient.js"}),E<S.length?H("SETUP",S[E].trackID):(k="Play",H("PLAY",null));O({errorCode:"503",description:"Service Unavilable"})}else if(t.ResponseCode===d.NOTFOUND){if("Describe"===k||"Options"===k)return void O({errorCode:404,description:"rtsp not found"})}else if(t.ResponseCode===d.INVALID_RANGE)return"backup"!==A&&"playback"!==A||O({errorCode:"457",description:"Invalid range"}),void a.log("RTP disconnection detect!!!")}function G(e){!0===o&&function(e){null!==r&&r.readyState===WebSocket.OPEN?r.send(e):a.log("SendRtpData - Websocket does not exist")}(e)}function q(e){void 0!=e&&null!=e&&""!=e&&(r&&r.readyState===WebSocket.OPEN?(!1===y&&-1!==e.search("DESCRIBE")&&(f=!0,y=!0),void 0!=e&&r.send(h(e))):a.log("ws\u672a\u8fde\u63a5"))}function W(e){var t=new Uint8Array,o=new Uint8Array(e.data);for((t=new Uint8Array(o.length)).set(o,0),c=t.length;c>0;)if(36!==t[0]){var a=String.fromCharCode.apply(null,t),h=null;-1===a.indexOf("OffLine:File Over")&&-1===a.indexOf("OffLine:Internal Error")||(r.fileOver=!0,g.postRtspOver()),-1!==a.indexOf("OffLine:KmsUnavailable")&&O({errorCode:203}),!0===f?(h=a.lastIndexOf("\r\n"),f=!1):h=a.search("\r\n\r\n");var p=a.search("RTSP");if(-1===p)return void(t=new Uint8Array);if(-1===h)return void(c=t.length);s=t.subarray(p,h+i),t=t.subarray(h+i),q(Y(String.fromCharCode.apply(null,s))),c=t.length}else{if("RAW"===S[0].codecName)return void(/.aac/.test(n)?g.sendBufferToAudioWorker(t.subarray(i,t.length)):v.setMovieData(t.subarray(i,t.length)));if(!0===x&&M&&M(),x=!1,u=t.subarray(0,i),!((l=u[2]<<24|u[3]<<16|u[4]<<8|u[5])+i<=t.length))return void(c=t.length);var y=t.subarray(i,l+i);N&&F.postMessage({type:"addBuffer",buffer:y}),g.parseRTPData(u,y),t=t.subarray(l+i),c=t.length}}function X(e){var t={Sessions:[]},n=(-1!==e.search("Content-Type: application/sdp")?e.split("\r\n\r\n")[1]:e).split("\r\n"),r=0,o=!1;for(r=0;r<n.length;r++){var i=n[r].split("=");if(i.length>0)switch(i[0]){case"a":var a=i[1].split(":");if(a.length>1){if("control"===a[0]){var s=n[r].search("control:");!0===o?-1!==s&&(t.Sessions[t.Sessions.length-1].ControlURL=n[r].substr(s+8)):-1!==s&&(t.BaseURL=n[r].substr(s+8))}else if("rtpmap"===a[0]){var u=a[1].split(" ");t.Sessions[t.Sessions.length-1].PayloadType=u[0];var c=u[1].split("/");t.Sessions[t.Sessions.length-1].CodecMime=c[0],c.length>1&&(t.Sessions[t.Sessions.length-1].ClockFreq=c[1])}else if("framesize"===a[0]){var l=a[1].split(" ");if(l.length>1){var f=l[1].split("-");t.Sessions[t.Sessions.length-1].Width=f[0],t.Sessions[t.Sessions.length-1].Height=f[1]}}else if("framerate"===a[0])t.Sessions[t.Sessions.length-1].Framerate=a[1];else if("fmtp"===a[0]){var h=n[r].split(" ");if(h.length<2)continue;for(var p=1;p<h.length;p++){var y=h[p].split(";"),d=0;for(d=0;d<y.length;d++){var m=y[d].search("mode=");if(-1!==m&&(t.Sessions[t.Sessions.length-1].mode=y[d].substr(m+5)),-1!==(m=y[d].search("config="))&&(t.Sessions[t.Sessions.length-1].config=y[d].substr(m+7),P.config=t.Sessions[t.Sessions.length-1].config,P.clockFreq=t.Sessions[t.Sessions.length-1].ClockFreq,P.bitrate=t.Sessions[t.Sessions.length-1].Bitrate),-1!==(m=y[d].search("sprop-vps="))&&(t.Sessions[t.Sessions.length-1].VPS=y[d].substr(m+10)),-1!==(m=y[d].search("sprop-sps="))&&(t.Sessions[t.Sessions.length-1].SPS=y[d].substr(m+10)),-1!==(m=y[d].search("sprop-pps="))&&(t.Sessions[t.Sessions.length-1].PPS=y[d].substr(m+10)),-1!==(m=y[d].search("sprop-parameter-sets="))){var v=y[d].substr(m+21).split(",");v.length>1&&(t.Sessions[t.Sessions.length-1].SPS=v[0],t.Sessions[t.Sessions.length-1].PPS=v[1])}}}}}else 1===a.length&&("recvonly"===a[0]?t.Sessions[t.Sessions.length-1].TalkTransType="recvonly":"sendonly"===a[0]&&(t.Sessions[t.Sessions.length-1].TalkTransType="sendonly"));break;case"m":var g=i[1].split(" "),b={};b.Type=g[0],b.Port=g[1],b.Payload=g[3],t.Sessions.push(b),o=!0;break;case"b":if(!0===o){var w=i[1].split(":");t.Sessions[t.Sessions.length-1].Bitrate=w[1]}}}return t}return V.prototype={connect:function(){r||((r=new WebSocket(t)).binaryType="arraybuffer",r.fileOver=!1,r.addEventListener("message",W,!1),r.onopen=function(){var e=h("OPTIONS "+n+" RTSP/1.0\r\nCSeq: "+T+"\r\n\r\n");r.send(e)},r.onerror=function(e){O({errorCode:202,description:"Open WebSocket Error"})},r.onclose=function(e){r&&!r.fileOver&&O({errorCode:202,description:"Open WebSocket Error"})})},disconnect:function(){q(H("TEARDOWN",null)),clearInterval(C),C=null,r&&(r.close(),r=null,R=null),g.terminate(),L&&clearTimeout(L)},controlPlayer:function(e){var t="",n=null;switch(D=e.command,e.command){case"PLAY":if(k="Play",g.play(),null!=e.range){t=H("PLAY",null,0,e.range);break}t=H("PLAY",null),D&&g.initStartTime();break;case"PAUSE":if("PAUSE"===k)break;k="PAUSE",t=H("PAUSE",null),g.pause();break;case"SCALE":t=H("SCALE",null,0,e.data),g.playbackSpeed(e.data);break;case"TEARDOWN":t=H("TEARDOWN",null);break;case"audioPlay":if("start"===e.data)k="Play",t=H("PLAY",null,0,e.range);else if("stop"===e.data)t=H("TEARDOWN",null);else{if("PAUSE"===k)break;k="PAUSE",t=H("PAUSE",null)}g.controlAudio(e.command,e.data);break;case"volumn":case"audioSamplingRate":g.controlAudio(e.command,e.data);break;case"playNextFrame":g.getVideoBufferQueueSize()<5&&this.getNextFrameData(1e3),g.playNextFrame();break;case"getCurFrameInfo":n=g.getCurFrameInfo();break;case"getCapture":g.getCapture();break;case"startRecod":(N=e.data)||F.postMessage({type:"close"});break;default:a.log("\u672a\u77e5\u6307\u4ee4: "+e.command)}if(""!=t&&q(t),n)return n},setLiveMode:function(e){g.setLiveMode(e)},setPlayMode:function(e,t){B=e,j=t,g.setPlayMode(e)},setSignalURL:function(e){n=e},setCallback:function(e,t){"GetFrameRate"===e?I=t:"GetFirstFrame"===e?M=t:"recordChanged"===e?z=t:g.setCallback(e,t),"Error"==e&&(O=t)},setUserInfo:function(e,t){U.username=e,U.passWord=t},getNextFrameData:function(e){q(H("PLAY",null)),setTimeout(function(){q(H("PAUSE",null))},e)}},v.CodecCallback=function(e){P=e.AudioCodecInfo,S[0].Framerate=e.Framerate,"H264"===P.VideoCodec&&V.prototype.setLiveMode("video"),g.sendSdpInfo(S,P,e)},v.TrackCallback=function(e){var t=new Uint8Array(e.subarray(6,e.length));g.parseRTPData(e.subarray(0,6),t)},new V},Ce=function(e,t,n){var r=n.dType,o=n.isPrivateProtocol,i=null,a=null,s={wsURL:e,rtspURL:t,workerManager:a="Train"===r?new W:new H,RTSP_STATE:{OK:200,UNAUTHORIZED:401,NOTFOUND:404,INVALID_RANGE:457,NOTSERVICE:503,DISCONNECT:999,BADREQUEST:400,FORBIDDEN:403,INTERNALSERVERERROR:500,SERVICEUNAVAILABLE:503}},u=Object.assign(s,n);function c(){}return i=!0===o?new Re(u):new Ae(u),c.prototype={init:function(e,t,n,o,i){"Train"===r?a.init(e,n):a.init(e,t,n,o,i)},talkInit:function(){a.talkInit()},connect:function(){i.connect()},disconnect:function(){i.disconnect()},controlPlayer:function(e){return i.controlPlayer(e)},setLiveMode:function(e){a.setLiveMode(e)},setPlayMode:function(e,t){i.setPlayMode(e,t)},setRTSPURL:function(e){i.setSignalURL(e)},setCallback:function(e,t){i.setCallback(e,t)},setUserInfo:function(e,t){i.setUserInfo(e,t)},capture:function(e,t){a.capture(e,t)},setLessRate:function(e){a.setLessRate&&a.setLessRate(e)},gotoSecond:function(e){return a.gotoSecond(e)},gotoFrame:function(e){return a.gotoFrame(e)},checkLeftSize:function(e,t){return a.checkLeftSize(e,t)},clearMap:function(){a.clearMap()},getCapture:function(e,t,n){return a.getCapture(e,t,n)}},new c},Pe=function(e){this.wsURL=e.wsURL,this.rtspURL=e.rtspURL,this.isTalkService=e.isTalkService,this.isPlayback=e.playback||!1,this.playBackRange=e.range||!1,this.isPrivateProtocol=e.isPrivateProtocol||!1,this.isAudioFlag=e.isAudioFlag||!1,this.lessRateCanvas=e.lessRateCanvas||!1,this.audioState="stop",this.realm=e.realm||"",this.ws=null,this.decodeMode=e.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(){},recordChanged:function(){},GetFirstFrame:function(){}},this.username=e.username,this.password=e.password,this.deployType=e.deployType,this.duration=e.duration};Pe.prototype={init:function(e,t,n){for(var r in this.ws=new Ce(this.wsURL,this.rtspURL,{dType:this.deployType,isPrivateProtocol:this.isPrivateProtocol,realm:this.realm}),this.ws.init(e,t,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.ws.setLessRate(this.lessRateCanvas),this.events)this.ws.setCallback(r,this.events[r]);this.events=null},startRecod:function(e){if(e){if(this.ws)return;for(var t in this.ws=new Ce(this.wsURL,this.rtspURL,{isRecord:!0,isPrivateProtocol:this.isPrivateProtocol,realm:this.realm}),this.ws.setUserInfo(this.username,this.password),this.events)this.ws.setCallback(t,this.events[t]);this.controlPlayer("startRecod",!0),this.connect()}else this.ws&&(this.controlPlayer("startRecod",!1),this.ws.disconnect(),this.ws=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(e){e=e<0?0:e,this.duration>0&&e>this.duration&&(e=this.duration),this.controlPlayer("PLAY","video",e)},playFF:function(e){this.controlPlayer("PAUSE"),this.controlPlayer("SCALE",e)},playRewind:function(){},playNextFrame:function(){this.controlPlayer("playNextFrame")},getCurFrameInfo:function(){return this.controlPlayer("getCurFrameInfo")},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(e){this.controlPlayer("audioSamplingRate",e)},setAudioVolume:function(e){this.controlPlayer("volumn",e)},gotoSecond:function(e){var t=this;window.clearInterval(t.checkRsPre),window.clearInterval(t.checkRsNext),window.clearInterval(t.checkRsGoto),t.ws.clearMap(),!0===t.running&&(t.pause(),t.running=!1),t.playByTime(e-5),t.running=!0,t.checkRsGoto=window.setTimeout(function(){t.pause(),t.running=!1},12e3)},nextFrame:function(e,t,n){var r=this,o=e>Math.pow(2,32)?0:e,i=r.ws.gotoFrame(o);!1===i?r.nextSecond(t,function(t){n(r.ws.gotoFrame(e))}):n(i)},preFrame:function(e,t,n){var r=this,o=r.ws.gotoFrame(e);!1===o?r.preSecond(t,function(t){n(r.ws.gotoFrame(e))}):n(o)},nextSecond:function(e,t){var n=this,r=n.ws.gotoSecond(e);!1===r?(!1===n.running&&(n.playByTime(e),n.running=!0),n.checkRsNext=window.setInterval(function(){!1!==(r=n.ws.gotoSecond(e))&&(window.clearInterval(n.checkRsNext),window.setTimeout(function(){n.running=!1,n.pause()},9e3),t(r))},2e3)):(n.ws.checkLeftSize(e,"next")<=2&&!1===n.running&&(n.playByTime(e+1),n.running=!0,window.setTimeout(function(){n.pause(),n.running=!1},9e3)),t(r))},preSecond:function(e,t){var n=this,r=n.ws.gotoSecond(e);!1===r?(!1===n.running&&(n.playByTime(e-5),n.running=!0),n.checkRsPre=window.setInterval(function(){!1!==(r=n.ws.gotoSecond(e))&&(window.clearInterval(n.checkRsPre),window.setTimeout(function(){n.running=!1,n.pause()},9e3),t(r))},2e3)):(n.ws.checkLeftSize(e,"pre")<=2&&!1===n.running&&(n.playByTime(e-5),n.running=!0,window.setTimeout(function(){n.pause(),n.running=!1},9e3)),t(r))},controlPlayer:function(e,t,n){var r;return r="video"===t?{command:e,range:n||0}:"audioPlay"===e?{command:e,data:t,range:n||0}:{command:e,data:t},this.ws.controlPlayer(r)},setPlayMode:function(e){this.ws.setLiveMode(e)},setPlayPath:function(e){this.ws.setRTSPURL(e)},capture:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ivsCanvasArr:[]};this.ws.capture(e,t)},getCapture:function(e,t,n){return this.ws.getCapture(e,t,n)},talk:function(e){if("on"===e){for(var t in this.ws=new Ce(this.wsURL,this.rtspURL,{isTalkService:this.isTalkService,isPrivateProtocol:this.isPrivateProtocol,realm:this.realm}),this.ws.talkInit(),this.ws.setUserInfo(this.username,this.password),this.events)this.ws.setCallback(t,this.events[t]);this.ws.connect()}else this.ws.disconnect()},on:function(e,t){this.events[e]=t}};t.default=Pe}]).default;
|