12 |
- !function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}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 i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));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=37)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(1)),a=o(n(7));function o(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.headSize=8,this.size=0,this.type="",this.subBox=[],this.start=-1}return r(e,[{key:"readHeader",value:function(e){if(this.start=e.position,this.size=e.readUint32(),this.type=String.fromCharCode(e.readUint8(),e.readUint8(),e.readUint8(),e.readUint8()),1===this.size)this.size=e.readUint64();else if(0===this.size&&"mdat"!==this.type)throw new a.default("parse","",{line:19,handle:"[Box] readHeader",msg:"parse mp4 mdat box failed"});if("uuid"===this.type)for(var t=[],n=0;n<16;n++)t.push(e.readUint8())}},{key:"readBody",value:function(t){var n=this.size-t.position+this.start,r=this.type;this.data=t.buffer.slice(t.position,t.position+n),t.position+=this.data.byteLength;var i=void 0;(i=e.containerBox.find(function(e){return e===r})?e.containerParser:e[r])&&i instanceof Function&&i.call(this)}},{key:"read",value:function(e){this.readHeader(e),this.readBody(e)}}],[{key:"containerParser",value:function(){for(var t=new i.default(this.data),n=t.buffer.byteLength;t.position<n;){var r=new e;r.readHeader(t),this.subBox.push(r),r.readBody(t)}delete this.data,t=null}}]),e}();u.containerBox=["moov","trak","edts","mdia","minf","dinf","stbl","mvex","moof","traf","mfra"],t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(7),o=(r=a)&&r.__esModule?r:{default:r};var u=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!(t instanceof ArrayBuffer))throw new o.default("parse","",{line:9,handle:"[Stream] constructor",msg:"data is valid"});this.buffer=t,this.dataview=new DataView(t),this.dataview.position=0}return i(e,[{key:"skip",value:function(t){for(var n=Math.floor(t/4),r=t%4,i=0;i<n;i++)e.readByte(this.dataview,4);r>0&&e.readByte(this.dataview,r)}},{key:"readUint8",value:function(){return e.readByte(this.dataview,1)}},{key:"readUint16",value:function(){return e.readByte(this.dataview,2)}},{key:"readUint32",value:function(){return e.readByte(this.dataview,4)}},{key:"readUint64",value:function(){return e.readByte(this.dataview,8)}},{key:"readInt8",value:function(){return e.readByte(this.dataview,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this.dataview,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this.dataview,4,!0)}},{key:"position",set:function(e){this.dataview.position=e},get:function(){return this.dataview.position}}],[{key:"readByte",value:function(e,t,n){var r=void 0;switch(t){case 1:r=n?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=n?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(n)throw"not supported for readByte 3";r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=n?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(n)throw new o.default("parse","",{line:73,handle:"[Stream] readByte",msg:"not supported for readBody 8"});r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,n){"use strict";var r=n(19)("wks"),i=n(20),a=n(2).Symbol,o="function"==typeof a;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";var r=e.exports={version:"2.6.5"};"number"==typeof __e&&(__e=r)},function(e,t,n){"use strict";var r=n(6);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var 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.exports=function(e){return"object"===(void 0===e?"undefined":r(e))?null!==e:"function"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(34),a=(r=i)&&r.__esModule?r:{default:r},o=n(80);var u=function(e){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r.version=o.version;var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return a.url=i,a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a.default.Errors),t}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(9);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";e.exports=!n(23)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t,n){"use strict";var r=n(5),i=n(40),a=n(41),o=Object.defineProperty;t.f=n(10)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r,i,a,o,u,s,f,d="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},c=n(63),l=n(77),h=Function.prototype.apply,v=Function.prototype.call,p=Object.create,m=Object.defineProperty,y=Object.defineProperties,b=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var n,i;return l(t),i=this,r.call(this,e,n=function(){a.call(i,e,n),h.call(t,this,arguments)}),n.__eeOnceListener__=t,this},u={on:r=function(e,t){var n;return l(t),b.call(this,"__ee__")?n=this.__ee__:(n=g.value=p(null),m(this,"__ee__",g),g.value=null),n[e]?"object"===d(n[e])?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:i,off:a=function(e,t){var n,r,i,a;if(l(t),!b.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"===(void 0===(r=n[e])?"undefined":d(r)))for(a=0;i=r[a];++a)i!==t&&i.__eeOnceListener__!==t||(2===r.length?n[e]=r[a?0:1]:r.splice(a,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:o=function(e){var t,n,r,i,a;if(b.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"===(void 0===i?"undefined":d(i))){for(n=arguments.length,a=new Array(n-1),t=1;t<n;++t)a[t-1]=arguments[t];for(i=i.slice(),t=0;r=i[t];++t)h.call(r,this,a)}else switch(arguments.length){case 1:v.call(i,this);break;case 2:v.call(i,this,arguments[1]);break;case 3:v.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,a=new Array(n-1),t=1;t<n;++t)a[t-1]=arguments[t];h.call(i,this,a)}}},s={on:c(r),once:c(i),off:c(a),emit:c(o)},f=y({},s),e.exports=t=function(e){return null==e?p(f):y(Object(e),s)},t.methods=u},function(e,t,n){"use strict";var r=n(70)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var 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=new Date;t.setFullYear(1904),t.setMonth(0),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),this.time=t}return r(e,[{key:"setTime",value:function(e){return this.time.setTime(this.time.getTime()+1*e),this.time.toLocaleString()}}]),e}();t.default=i,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(35),o=(r=a)&&r.__esModule?r:{default:r};var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.buffer=new Uint8Array(0)}return i(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){t?e.buffer=(0,o.default)(Uint8Array,e.buffer,t):window.console.error(t)})}}],[{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";e.exports=!1},function(e,t,n){"use strict";var r=n(11),i=n(3)("toStringTag"),a="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:a?r(t):"Object"==(o=r(t))&&"function"==typeof t.callee?"Arguments":o}},function(e,t,n){"use strict";var r=n(4),i=n(2),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(17)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,n){"use strict";var r=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+i).toString(36))}},function(e,t,n){"use strict";var r=n(2),i=n(4),a=n(22),o=n(25),u=n(8),s=function e(t,n,s){var f,d,c,l,h=t&e.F,v=t&e.G,p=t&e.P,m=t&e.B,y=v?r:t&e.S?r[n]||(r[n]={}):(r[n]||{}).prototype,b=v?i:i[n]||(i[n]={}),g=b.prototype||(b.prototype={});for(f in v&&(s=n),s)c=((d=!h&&y&&void 0!==y[f])?y:s)[f],l=m&&d?u(c,r):p&&"function"==typeof c?u(Function.call,c):c,y&&o(y,f,c,t&e.U),b[f]!=c&&a(b,f,l),p&&g[f]!=c&&(g[f]=c)};r.core=i,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,n){"use strict";var r=n(12),i=n(42);e.exports=n(10)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";var r=n(6),i=n(2).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){"use strict";var r=n(2),i=n(22),a=n(26),o=n(20)("src"),u=n(43),s=(""+u).split("toString");n(4).inspectSource=function(e){return u.call(e)},(e.exports=function(e,t,n,u){var f="function"==typeof n;f&&(a(n,"name")||i(n,"name",t)),e[t]!==n&&(f&&(a(n,o)||i(n,o,e[t]?""+e[t]:s.join(String(t)))),e===r?e[t]=n:u?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[o]||u.call(this)})},function(e,t,n){"use strict";var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";var r=n(29),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){"use strict";var r=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:r)(e)}},function(e,t,n){"use strict";var r,i,a,o=n(8),u=n(50),s=n(51),f=n(24),d=n(2),c=d.process,l=d.setImmediate,h=d.clearImmediate,v=d.MessageChannel,p=d.Dispatch,m=0,y={},b=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},g=function(e){b.call(e.data)};l&&h||(l=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return y[++m]=function(){u("function"==typeof e?e:Function(e),t)},r(m),m},h=function(e){delete y[e]},"process"==n(11)(c)?r=function(e){c.nextTick(o(b,e,1))}:p&&p.now?r=function(e){p.now(o(b,e,1))}:v?(a=(i=new v).port2,i.port1.onmessage=g,r=o(a.postMessage,a,1)):d.addEventListener&&"function"==typeof postMessage&&!d.importScripts?(r=function(e){d.postMessage(e+"","*")},d.addEventListener("message",g,!1)):r="onreadystatechange"in f("script")?function(e){s.appendChild(f("script")).onreadystatechange=function(){s.removeChild(this),b.call(e)}}:function(e){setTimeout(o(b,e,1),0)}),e.exports={set:l,clear:h}},function(e,t,n){"use strict";var r=n(9);function i(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}e.exports.f=function(e){return new i(e)}},function(e,t,n){"use strict";var r=n(2).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){"use strict";e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports=Player},function(e,t,n){"use strict";var r,i=n(81),a=(r=i)&&r.__esModule?r:{default:r};e.exports=a.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(13)),a=o(n(7));function o(e){return e&&e.__esModule?e:{default:e}}var u=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),(0,i.default)(this),this.url=t,this.range=n,this.id=n.join("-"),this.on=!1;var o=new window.XMLHttpRequest;o.target=this,o.responseType="arraybuffer",o.open("get",t),o.setRequestHeader("Range","bytes="+n[0]+"-"+n[1]),o.onload=function(){200!==o.status&&206!==o.status||r&&r instanceof Function&&r(o.response),o.target.remove()},o.onerror=function(e){o.target.emit("error",new a.default("network","",{line:25,handle:"[Task] constructor",msg:e.message,url:t})),o.target.remove()},o.onabort=function(){o.target.remove()},this.xhr=o,e.queue.push(this),this.update()}return r(e,[{key:"cancel",value:function(){this.xhr.abort()}},{key:"remove",value:function(){var t=this;e.queue.filter(function(n,r){return n.url===t.url&&n.id===t.id&&(e.queue.splice(r,1),!0)}),this.update()}},{key:"update",value:function(){var t=e.queue,n=t.filter(function(e){return e.on}),r=t.filter(function(e){return!e.on}),i=e.limit-n.length;r.forEach(function(e,t){t<i&&e.run()})}},{key:"run",value:function(){1===this.xhr.readyState?(this.on=!0,this.xhr.send()):this.remove()}}],[{key:"clear",value:function(){e.queue.forEach(function(e){e.on&&e.cancel()}),e.queue.length=0}}]),e}();u.queue=[],u.limit=2,window.Task=u,t.default=u,e.exports=t.default},function(e,t,n){e.exports=n(38)},function(e,t,n){"use strict";var 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};n(39),n(59);var i=f(n(34)),a=f(n(62)),o=f(n(125)),u=f(n(36)),s=f(n(16));function f(e){return e&&e.__esModule?e:{default:e}}i.default.install("mp4player",function(){var e=this,t=i.default.sniffer,n=i.default.util,f=i.default.Errors,d=void 0,c=void 0,l=e.config.preloadTime||15,h=void 0,v=e.config.url,p=e.config.pluginRule||function(){return!0};if(v){"String"===n.typeOf(v)?d=v:"Array"===n.typeOf(v)&&v.length&&(d=v[0].src,c=v[1].src),e.config._mainURL=d,e.config._backupURL=c;var m=function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.currentTime;e.timer&&clearTimeout(e.timer),r=Math.max(r,e.currentTime),e.timer=setTimeout(function(){e.mp4.seek(r+.1*n).then(function(t){if(t){var n=e.mse;n.updating=!0,n.appendBuffer(t),n.once("updateend",function(){n.updating=!1})}},function(){n<10&&setTimeout(function(){t(n+1)},2e3)})},50)},y=function(t){var n=new a.default(t),r=void 0;return new Promise(function(t,i){n.once("moovReady",function(){(r=new o.default).on("sourceopen",function(){r.appendBuffer(n.packMeta()),r.once("updateend",m.bind(e))}),r.on("error",function(e){i(e)}),t([n,r])}),n.on("error",function(e){i(e)})})};if(["chrome","firfox","safari"].some(function(e){return e===t.browser})&&o.default.isSupported('video/mp4; codecs="avc1.64001E, mp4a.40.5"')){if(e._start=e.start,!p.call(e))return!1;var b=function(e,t){t.vid=e.config.vid,t.url=e.src,t.errd&&"object"===r(t.errd)&&e.mp4&&(t.errd.url=e.mp4.url,t.url=e.mp4.url,e.mp4.canDownload=!1),e.emit("DATA_REPORT",t),u.default.clear(),e.mp4&&e.mp4.bufferCache&&e.mp4.bufferCache.clear(),e.currentTime&&(e._currentTime=e.currentTime),e._start&&(e.start=e._start,e._start=null),e.switchURL=null,e._replay=null,e.off("timeupdate",g),e.off("seeking",w),e.off("pause",_),e.off("playing",x),e.off("waiting",U),e.off("ended",k),e.off("destroy",S),"network"===t.errt&&e.config._backupURL?e.src=e.config._backupURL:e.src=e.config._mainURL,e.once("canplay",function(){e._currentTime&&(e.currentTime=e._currentTime),e.play()})};e.start=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d;y(n).then(function(t){var r=t[0],i=t[1];e._start(i.url),e.logParams.pluginSrc=n,e.mp4=r,e.mse=i,r.on("error",function(t){b(e,t)})},function(t){e._start(n),b(e,t)}),e.once("canplay",function(){if("safari"===t.browser&&e.buffered){var n=e.buffered.start(0);e.currentTime=n+.1}})},e.cut=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments[1],n=new s.default,r=new a.default(v);return new Promise(function(a,o){r.once("moovReady",function(){(!t||t<=e)&&(t=e+15),t>r.meta.duration&&(e=r.meta.duration-(t-e),t=r.meta.duration),r.cut(e,t).then(function(o){if(o){var u=i.default.util.deepCopy({duration:t-e,audioDuration:t-e,endTime:t-e},r.meta);u.duration=t-e,u.videoDuration=t-e,u.audioDuration=t-e,u.endTime=t-e,n.write(r.packMeta(u),o),a(new Blob([n.buffer],{type:'video/mp4; codecs="avc1.64001E, mp4a.40.5"'}))}})}),r.on("error",function(e){o(e)})})},e.switchURL=function(n){var r=new a.default(n),o=e.mp4;r.on("moovReady",function(){o.timeRage;var a=e.currentTime,u=o.timeRage.find(function(e){return e[0]-a>2})[0],s=e.getBufferedRange()[1];s-u>0&&"safari"!==t.browser&&e.mse.removeBuffer(u,s),i.default.util.hasClass(e.root,"xgplayer-ended")||e.emit("urlchange",JSON.parse(JSON.stringify(e.logParams))),e.logParams={bc:0,bu_acu_t:0,played:[{begin:e.video.currentTime,end:-1}],pt:(new Date).getTime(),vt:(new Date).getTime(),vd:0},e.mp4=r,e.mse.appendBuffer(r.packMeta()),e.logParams.pt=(new Date).getTime(),e.logParams.vt=(new Date).getTime(),e.logParams.vd=e.video.duration,e.logParams.pluginSrc=n}),r.on("error",function(t){b(e,t)})},e.playNext=function(t){var n=new a.default(t),r=e.mp4;n.on("moovReady",function(){var t=[0,0],i=e.video.buffered,a=e.video.currentTime,o=0;if(i)for(var u=0,s=i.length;u<s;u++)t[0]=i.start(u),t[1]=i.end(u),t[0]<=a&&t[1]<=a&&(o=t[1]>o?t[1]:o,e.mse.removeBuffer(t[0],t[1]));e.mp4=n,e.mse.appendBuffer(n.packMeta());var f=!0;e.on("timeupdate",function(){if(f&&r.meta.endTime-e.currentTime<2){var t=e.getBufferedRange();if(e.currentTime-t[1]<.1&&(f=!1,e.currentTime=0,i=e.video.buffered))for(var n=0,a=i.length;n<a;n++)t[0]=i.start(n),t[1]=i.end(n),t[0]>=o&&e.mse.removeBuffer(t[0],t[1])}})}),n.on("error",function(t){b(e,t)})};var g=function(){var t=e.mse,n=e.mp4;if(t&&!t.updating&&n.canDownload){var r=n.timeRage,i=e.getBufferedRange(),a=e.currentTime+l;if(i[1]-a>0)return;r.every(function(e,t){var r=(e[0]+e[1])/2;return 0!==i[1]&&(!(r>i[1]&&!n.bufferCache.has(t))||void m(0,r))}),function(e,t){if(t.meta.endTime-e.currentTime<2){var n=e.getBufferedRange();e.currentTime-n[1]<.1&&e.mse.endOfStream()}}(e,n)}};e.on("timeupdate",g);var w=function(){var t=e.buffered,n=!1,r=e.currentTime;if(u.default.clear(),t.length){for(var i=0,a=t.length;i<a;i++)if(r>=t.start(i)&&r<=t.end(i)){n=!0;break}n||m(0,r)}else m(0,e.currentTime)};e.on("seeking",w);var _=function(){u.default.clear()};e.on("pause",_);var x=function(){h&&clearTimeout(h)};e.on("playing",x);var U=function(){var t=e.mp4;if(t&&t.meta){var n=e.getBufferedRange(),r=t.meta.videoDuration;r-e.currentTime<.5&&r-n[1]<.5?e.mse.endOfStream():(m(0,n[1]+1),h=setTimeout(function(){for(var t=e.buffered,n=void 0,r=0,i=t.length;r<i;r++)if((n=t.start(r))>=e.currentTime){e.currentTime=n;break}},1500))}};e.on("waiting",U);var k=function(){e.off("waiting",U),e.off("timeupdate",g)};e.on("ended",k);var S=function(){u.default.clear(),e.timer&&clearTimeout(e.timer)};e.once("destroy",S),e._replay=function(){u.default.clear(),e.mp4.bufferCache.clear(),y(e.mp4.url).then(function(t){var n=t[0],r=t[1];e._start(r.url),e.mp4=n,e.mse=r,e.currentTime=0,e.play(),e.once("canplay",function(){e.on("waiting",U),e.on("timeupdate",g)})},function(t){b(e,t)})}}}else e.emit("error",new f("other",e.config.vid))})},function(e,t,n){"use strict";var r,i,a,o,u=n(17),s=n(2),f=n(8),d=n(18),c=n(21),l=n(6),h=n(9),v=n(44),p=n(45),m=n(49),y=n(30).set,b=n(52)(),g=n(31),w=n(53),_=n(32),x=n(54),U=s.TypeError,k=s.process,S=k&&k.versions,B=S&&S.v8||"",T=s.Promise,M="process"==d(k),O=function(){},C=i=g.f,j=!!function(){try{var e=T.resolve(1),t=(e.constructor={})[n(3)("species")]=function(e){e(O,O)};return(M||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==B.indexOf("6.6")&&-1===_.indexOf("Chrome/66")}catch(e){}}(),z=function(e){var t;return!(!l(e)||"function"!=typeof(t=e.then))&&t},P=function(e,t){if(!e._n){e._n=!0;var n=e._c;b(function(){for(var r=e._v,i=1==e._s,a=0,o=function(t){var n,a,o,u=i?t.ok:t.fail,s=t.resolve,f=t.reject,d=t.domain;try{u?(i||(2==e._h&&F(e),e._h=1),!0===u?n=r:(d&&d.enter(),n=u(r),d&&(d.exit(),o=!0)),n===t.promise?f(U("Promise-chain cycle")):(a=z(n))?a.call(n,s,f):s(n)):f(r)}catch(e){d&&!o&&d.exit(),f(e)}};n.length>a;)o(n[a++]);e._c=[],e._n=!1,t&&!e._h&&E(e)})}},E=function(e){y.call(s,function(){var t,n,r,i=e._v,a=A(e);if(a&&(t=w(function(){M?k.emit("unhandledRejection",i,e):(n=s.onunhandledrejection)?n({promise:e,reason:i}):(r=s.console)&&r.error&&r.error("Unhandled promise rejection",i)}),e._h=M||A(e)?2:1),e._a=void 0,a&&t.e)throw t.v})},A=function(e){return 1!==e._h&&0===(e._a||e._c).length},F=function(e){y.call(s,function(){var t;M?k.emit("rejectionHandled",e):(t=s.onrejectionhandled)&&t({promise:e,reason:e._v})})},D=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),P(t,!0))},L=function e(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw U("Promise can't be resolved itself");(n=z(t))?b(function(){var i={_w:r,_d:!1};try{n.call(t,f(e,i,1),f(D,i,1))}catch(e){D.call(i,e)}}):(r._v=t,r._s=1,P(r,!1))}catch(e){D.call({_w:r,_d:!1},e)}}};j||(T=function(e){v(this,T,"Promise","_h"),h(e),r.call(this);try{e(f(L,this,1),f(D,this,1))}catch(e){D.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(55)(T.prototype,{then:function(e,t){var n=C(m(this,T));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=M?k.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&P(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r;this.promise=e,this.resolve=f(L,e,1),this.reject=f(D,e,1)},g.f=C=function(e){return e===T||e===o?new a(e):i(e)}),c(c.G+c.W+c.F*!j,{Promise:T}),n(56)(T,"Promise"),n(57)("Promise"),o=n(4).Promise,c(c.S+c.F*!j,"Promise",{reject:function(e){var t=C(this);return(0,t.reject)(e),t.promise}}),c(c.S+c.F*(u||!j),"Promise",{resolve:function(e){return x(u&&this===o?T:this,e)}}),c(c.S+c.F*!(j&&n(58)(function(e){T.all(e).catch(O)})),"Promise",{all:function(e){var t=this,n=C(t),r=n.resolve,i=n.reject,a=w(function(){var n=[],a=0,o=1;p(e,!1,function(e){var u=a++,s=!1;n.push(void 0),o++,t.resolve(e).then(function(e){s||(s=!0,n[u]=e,--o||r(n))},i)}),--o||r(n)});return a.e&&i(a.v),n.promise},race:function(e){var t=this,n=C(t),r=n.reject,i=w(function(){p(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},function(e,t,n){"use strict";e.exports=!n(10)&&!n(23)(function(){return 7!=Object.defineProperty(n(24)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(6);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";e.exports=n(19)("native-function-to-string",Function.toString)},function(e,t,n){"use strict";e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r=n(8),i=n(46),a=n(47),o=n(5),u=n(28),s=n(48),f={},d={},c=e.exports=function(e,t,n,c,l){var h,v,p,m,y=l?function(){return e}:s(e),b=r(n,c,t?2:1),g=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(a(y)){for(h=u(e.length);h>g;g++)if((m=t?b(o(v=e[g])[0],v[1]):b(e[g]))===f||m===d)return m}else for(p=y.call(e);!(v=p.next()).done;)if((m=i(p,b,v.value,t))===f||m===d)return m};c.BREAK=f,c.RETURN=d},function(e,t,n){"use strict";var r=n(5);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var a=e.return;throw void 0!==a&&r(a.call(e)),t}}},function(e,t,n){"use strict";var r=n(27),i=n(3)("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[i]===e)}},function(e,t,n){"use strict";var r=n(18),i=n(3)("iterator"),a=n(27);e.exports=n(4).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||a[r(e)]}},function(e,t,n){"use strict";var r=n(5),i=n(9),a=n(3)("species");e.exports=function(e,t){var n,o=r(e).constructor;return void 0===o||null==(n=r(o)[a])?t:i(n)}},function(e,t,n){"use strict";e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){"use strict";var r=n(2).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(2),i=n(30).set,a=r.MutationObserver||r.WebKitMutationObserver,o=r.process,u=r.Promise,s="process"==n(11)(o);e.exports=function(){var e,t,n,f=function(){var r,i;for(s&&(r=o.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(s)n=function(){o.nextTick(f)};else if(!a||r.navigator&&r.navigator.standalone)if(u&&u.resolve){var d=u.resolve(void 0);n=function(){d.then(f)}}else n=function(){i.call(r,f)};else{var c=!0,l=document.createTextNode("");new a(f).observe(l,{characterData:!0}),n=function(){l.data=c=!c}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},function(e,t,n){"use strict";e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){"use strict";var r=n(5),i=n(6),a=n(31);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=a.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var r=n(25);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},function(e,t,n){"use strict";var r=n(12).f,i=n(26),a=n(3)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(2),i=n(12),a=n(10),o=n(3)("species");e.exports=function(e){var t=r[e];a&&t&&!t[o]&&i.f(t,o,{configurable:!0,get:function(){return this}})}},function(e,t,n){"use strict";var r=n(3)("iterator"),i=!1;try{var a=[7][r]();a.return=function(){i=!0},Array.from(a,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:n=!0}},a[r]=function(){return o},e(a)}catch(e){}return n}},function(e,t,n){"use strict";var r=n(21),i=n(60),a=n(32),o=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(a);r(r.P+r.F*o,"String",{padStart:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0,!0)}})},function(e,t,n){"use strict";var r=n(28),i=n(61),a=n(33);e.exports=function(e,t,n,o){var u=String(a(e)),s=u.length,f=void 0===n?" ":String(n),d=r(t);if(d<=s||""==f)return u;var c=d-s,l=i.call(f,Math.ceil(c/f.length));return l.length>c&&(l=l.slice(0,c)),o?l+u:u+l}},function(e,t,n){"use strict";var r=n(29),i=n(33);e.exports=function(e){var t=String(i(this)),n="",a=r(e);if(a<0||a==1/0)throw RangeError("Count can't be negative");for(;a>0;(a>>>=1)&&(t+=t))1&a&&(n+=t);return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=l(n(13)),a=l(n(78)),o=l(n(79)),u=l(n(16)),s=l(n(123)),f=l(n(36)),d=l(n(124)),c=l(n(7));function l(e){return e&&e.__esModule?e:{default:e}}var h=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.pow(25,4);!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,i.default)(this),this.url=t,this.CHUNK_SIZE=n,this.init(t),this.once("moovReady",this.moovParse.bind(this)),this.cache=new u.default,this.bufferCache=new Set,this.timeRage=[],this.canDownload=!0}return r(e,[{key:"getData",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t+this.CHUNK_SIZE,r=this;return new Promise(function(i,a){new f.default(e.url,[t,n],i).once("error",function(e){r.emit("error",e)})})}},{key:"moovParse",value:function(){var e=this,t=this,n=this.moovBox,r=d.default.findBox(n,"mvhd"),i=d.default.findBox(n,"trak"),o=void 0,u=void 0,s=void 0,f=void 0,l=void 0,h=void 0,v=void 0,p=void 0,m=void 0,y=void 0,b=void 0,g=void 0,w=void 0,_=void 0;i.forEach(function(e){var n=d.default.findBox(e,"hdlr"),r=d.default.findBox(e,"mdhd");if(n&&r){var i=d.default.findBox(e,"stsd").subBox[0];if("vide"===n.handleType){var a=d.default.findBox(e,"avcC"),x=d.default.findBox(e,"tkhd");o=e,l=r.timescale,a?(s=i.type+"."+d.default.toHex(a.profile,a.profileCompatibility,a.AVCLevelIndication).join(""),v=a.sequence&&a.sequence.map(function(e){return Number("0x"+e)}),p=a.pps&&a.pps.map(function(e){return Number("0x"+e)}),m=a.profile):s=""+i.type,x&&(y=x.width,b=x.height)}if("soun"===n.handleType){u=e;var U=d.default.findBox(e,"esds"),k=d.default.findBox(e,"mp4a"),S=d.default.findBox(e,5);h=r.timescale,f=U?i.type+"."+d.default.toHex(U.subBox[0].subBox[0].typeID)+"."+U.subBox[0].subBox[0].subBox[0].type:""+i.type,S&&S.EScode&&(_=S.EScode.map(function(e){return Number("0x"+e)})),k&&(g=k.channelCount,w=k.sampleRate)}}else t.emit("error",new c.default("parse","",{line:72,handle:"[MP4] moovParse",url:t.url}))}),this.videoTrak=(0,a.default)({},o),this.audioTrak=(0,a.default)({},u);var x=this._boxes.find(function(e){return"mdat"===e.type}),U=d.default.seekTrakDuration(o,l),k=d.default.seekTrakDuration(u,h);this.mdatStart=x.start;var S=this.videoKeyFrames,B=S.length-1;S.forEach(function(t,n){n<B?e.timeRage.push([t.time.time/l,S[n+1].time.time/l]):e.timeRage.push([t.time.time/l,-1])}),this.meta={videoCodec:s,audioCodec:f,createTime:r.createTime,modifyTime:r.modifyTime,duration:r.duration/r.timeScale,timeScale:r.timeScale,videoDuration:U,videoTimeScale:l,audioDuration:k,audioTimeScale:h,endTime:Math.min(U,k),sps:v,pps:p,width:y,height:b,profile:m,pixelRatio:[1,1],channelCount:g,sampleRate:w,audioConfig:_}}},{key:"init",value:function(){var e=this;e.getData().then(function(t){var n=void 0,r=0,i=void 0,a=void 0;try{n=new o.default(t)}catch(t){return e.emit("error",t.type?t:new c.default("parse","",{line:176,handle:"[MP4] init",msg:t.message})),!1}if(e._boxes=a=n.boxes,a.every(function(t){return r+=t.size,"moov"!==t.type||(i=t,e.moovBox=i,e.emit("moovReady",i),!1)}),!i){var u=n.nextBox;u?"moov"===u.type?e.getData(r,r+u.size+28).then(function(t){var n=new o.default(t);e._boxes=e._boxes.concat(n.boxes),(i=n.boxes.filter(function(e){return"moov"===e.type})).length?(e.moovBox=i[0],e.emit("moovReady",i)):e.emit("error",new c.default("parse","",{line:203,handle:"[MP4] init",msg:"not find moov box"}))}):e.emit("error",new c.default("parse","",{line:207,handle:"[MP4] init",msg:"not find moov box"})):e.getData(r,"").then(function(t){var n=new o.default(t);n?(e._boxes=e._boxes.concat(n.boxes),n.boxes.every(function(t){return"moov"!==t.type||(i=t,e.moovBox=i,e.emit("moovReady",i),!1)})):e.emit("error",new c.default("parse","",{line:225,handle:"[MP4] init",msg:"not find moov box"}))})}}).catch(function(){e.emit("error",new c.default("network","",{line:231,handle:"[MP4] getData",msg:"getData failed"}))})}},{key:"getSamplesByOrders",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"video",t=arguments[1],n=arguments[2],r="video"===e?this.videoTrak:this.audioTrak,i=d.default.findBox(r,"stsc"),a=d.default.findBox(r,"stsz"),o=d.default.findBox(r,"stts"),u=d.default.findBox(r,"stco"),s=d.default.findBox(r,"ctts"),f=this.mdatStart,c=[];if(n=void 0!==n?n:a.entries.length,t instanceof Array)t.forEach(function(e,t){c.push({idx:e,size:a.entries[e],time:d.default.seekSampleTime(o,s,e),offset:d.default.seekSampleOffset(i,u,a,e,f)})});else if(0!==n)for(var l=t;l<n;l++)c.push({idx:l,size:a.entries[l],time:d.default.seekSampleTime(o,s,l),offset:d.default.seekSampleOffset(i,u,a,l,f)});else c={idx:t,size:a.entries[t],time:d.default.seekSampleTime(o,s,t),offset:d.default.seekSampleOffset(i,u,a,t,f)};return c}},{key:"packMeta",value:function(){if(this.meta){var e=new u.default;return e.write(s.default.ftyp()),e.write(s.default.moov(this.meta)),this.cache.write(e.buffer),e.buffer}}},{key:"seek",value:function(e){var t=e*this.meta.videoTimeScale,n=void 0,r=this.videoKeyFrames,i=this.audioKeyFrames;return r.every(function(e,i){var a=e.time.time,o=r[i+1]?r[i+1].time.time:Number.MAX_SAFE_INTEGER;return!(a<=t&&t<o)||(n=i,!1)}),i.every(function(e,r){var a=e.startTime,o=i[r+1]?i[r+1].startTime:Number.MAX_SAFE_INTEGER;return!(a<=t&&t<o)||(n=Math.min(r,n),!1)}),this.bufferCache.has(n)?Promise.resolve(null):this.loadFragment(n)}},{key:"loadFragment",value:function(e){var t,n=void 0,r=this.videoKeyFrames[e],i=this.getSamplesByOrders("audio",this.audioKeyFrames[e].order,0);if(t=Math.min(r.offset,i.offset),e<this.videoKeyFrames.length-1){var a=this.videoKeyFrames[e+1],o=this.getSamplesByOrders("audio",this.audioKeyFrames[e+1].order,0);n=Math.max(a.offset,o.offset)}var u=this;return window.isNaN(t)||void 0!==n&&window.isNaN(n)?(u.emit("error",new c.default("parse","",{line:366,handle:"[MP4] loadFragment",url:u.url})),!1):this.bufferCache.has(e)?Promise.resolve(null):this.getData(t+u.mdatStart,n?u.mdatStart+n:"").then(function(n){return u.createFragment(new Uint8Array(n),t,e)})}},{key:"addFragment",value:function(e){var t=new u.default;return t.write(s.default.moof(e)),t.write(s.default.mdat(e)),this.cache.write(t.buffer),t.buffer}},{key:"createFragment",value:function(e,t,n){var r=[];this.bufferCache.add(n);var i=this.videoKeyFrames.map(function(e){return e.idx}),a=this.getSamplesByOrders("video",i[n],i[n+1]),o=a.map(function(n,r){return{size:n.size,duration:n.time.duration,offset:n.time.offset,buffer:new Uint8Array(e.slice(n.offset-t,n.offset-t+n.size)),key:0===r}});r.push(this.addFragment({id:1,time:a[0].time.time,firstFlags:33554432,flags:3841,samples:o}));var u=this.getSamplesByOrders("audio",this.audioKeyFrames[n].order,this.audioKeyFrames[n+1]?this.audioKeyFrames[n+1].order:void 0),s=u.map(function(n,r){return{size:n.size,duration:n.time.duration,offset:n.time.offset,buffer:new Uint8Array(e.slice(n.offset-t,n.offset-t+n.size)),key:0===r}});r.push(this.addFragment({id:2,time:u[0].time.time,firstFlags:0,flags:1793,samples:s}));var f=0;r.every(function(e){return f+=e.byteLength,!0});var d=new Uint8Array(f),c=0;return r.every(function(e){return d.set(e,c),c+=e.byteLength,!0}),Promise.resolve(d)}},{key:"download",value:function(){}},{key:"cut",value:function(e,t){this.bufferCache.clear();var n=e*this.meta.videoTimeScale,r=t*this.meta.videoTimeScale,i=void 0,a=void 0,o=this.videoKeyFrames,u=this.audioKeyFrames;return o.every(function(e,t){var u=e.time.time,s=o[t+1]?o[t+1].time.time:Number.MAX_SAFE_INTEGER;return u<=n&&n<s?(i=t,!0):!(u<=r&&r<s)||(a=t,!1)}),u.every(function(e,t){var o=e.startTime,s=u[t+1]?u[t+1].startTime:Number.MAX_SAFE_INTEGER;return o<=n&&n<s?(i=Math.min(t,i),!0):!(o<=r&&r<s)||(a=Math.min(t,a),!1)}),a||(a=o.length),this.loadFragmentForCut(i,a)}},{key:"loadFragmentForCut",value:function(e,t){var n,r,i=this.videoKeyFrames[e],a=this.getSamplesByOrders("audio",this.audioKeyFrames[e].order,0);n=Math.min(i.offset,a.offset);var o=this.videoKeyFrames[t],u=this.getSamplesByOrders("audio",this.audioKeyFrames[t].order,0);r=Math.max(o.offset,u.offset);var s=this;return window.isNaN(n)||void 0!==r&&window.isNaN(r)?(s.emit("error",new c.default("parse","",{line:366,handle:"[MP4] loadFragment",url:s.url})),!1):this.getData(n+s.mdatStart,r?s.mdatStart+r:"").then(function(i){return s.createFragmentForCut(new Uint8Array(i),n,e,r,t)})}},{key:"createFragmentForCut",value:function(e,t,n,r,i){var a=[],o=this.videoKeyFrames.map(function(e){return e.idx}),u=this.getSamplesByOrders("video",o[n],o[i]).map(function(n,r){return{size:n.size,duration:n.time.duration,offset:n.time.offset,buffer:new Uint8Array(e.slice(n.offset-t,n.offset-t+n.size)),key:0===r}});a.push(this.addFragment({id:1,time:0,firstFlags:33554432,flags:3841,samples:u}));var s=this.getSamplesByOrders("audio",this.audioKeyFrames[n].order,this.audioKeyFrames[i]?this.audioKeyFrames[i].order:void 0).map(function(n,r){return{size:n.size,duration:n.time.duration,offset:n.time.offset,buffer:new Uint8Array(e.slice(n.offset-t,n.offset-t+n.size)),key:0===r}});a.push(this.addFragment({id:2,time:0,firstFlags:0,flags:1793,samples:s}));var f=0;a.every(function(e){return f+=e.byteLength,!0});var d=new Uint8Array(f),c=0;return a.every(function(e){return d.set(e,c),c+=e.byteLength,!0}),Promise.resolve(d)}},{key:"videoKeyFrames",get:function(){if(this._videoFrames)return this._videoFrames;var e=this.videoTrak,t=d.default.findBox(e,"stss"),n=this.getSamplesByOrders("video",t.entries.map(function(e){return e-1}));return this._videoFrames=n,n}},{key:"audioKeyFrames",get:function(){if(this._audioFrames)return this._audioFrames;var e,t=d.default.findBox(this.videoTrak,"mdhd").timescale,n=d.default.findBox(this.audioTrak,"mdhd").timescale,r=d.default.findBox(this.audioTrak,"stts").entry;return e=this.videoKeyFrames.map(function(e){return d.default.seekOrderSampleByTime(r,n,e.time.time/t)}),this._audioFrames=e,this._audioFrames}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){"use strict";var r=n(64),i=n(72),a=n(73),o=n(74);(e.exports=function(e,t){var n,a,u,s,f;return arguments.length<2||"string"!=typeof e?(s=t,t=e,e=null):s=arguments[2],null==e?(n=u=!0,a=!1):(n=o.call(e,"c"),a=o.call(e,"e"),u=o.call(e,"w")),f={value:t,configurable:n,enumerable:a,writable:u},s?r(i(s),f):f}).gs=function(e,t,n){var u,s,f,d;return"string"!=typeof e?(f=n,n=t,t=e,e=null):f=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(f=n,n=void 0):(f=t,t=n=void 0),null==e?(u=!0,s=!1):(u=o.call(e,"c"),s=o.call(e,"e")),d={get:t,set:n,configurable:u,enumerable:s},f?r(i(f),d):d}},function(e,t,n){"use strict";e.exports=n(65)()?Object.assign:n(66)},function(e,t,n){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,n){"use strict";var r=n(67),i=n(71),a=Math.max;e.exports=function(e,t){var n,o,u,s=a(arguments.length,2);for(e=Object(i(e)),u=function(r){try{e[r]=t[r]}catch(e){n||(n=e)}},o=1;o<s;++o)t=arguments[o],r(t).forEach(u);if(void 0!==n)throw n;return e}},function(e,t,n){"use strict";e.exports=n(68)()?Object.keys:n(69)},function(e,t,n){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,n){"use strict";var r=n(14),i=Object.keys;e.exports=function(e){return i(r(e)?Object(e):e)}},function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";var r=n(14);e.exports=function(e){if(!r(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){"use strict";var r=n(14),i=Array.prototype.forEach,a=Object.create;e.exports=function(e){var t=a(null);return i.call(arguments,function(e){r(e)&&function(e,t){var n;for(n in e)t[n]=e[n]}(Object(e),t)}),t}},function(e,t,n){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,n){"use strict";e.exports=n(75)()?String.prototype.contains:n(76)},function(e,t,n){"use strict";var r="razdwatrzy";e.exports=function(){return"function"==typeof r.contains&&(!0===r.contains("dwa")&&!1===r.contains("foo"))}},function(e,t,n){"use strict";var r=String.prototype.indexOf;e.exports=function(e){return r.call(this,e,arguments[1])>-1}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var 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},i=function(e){return function(e){return!!e&&"object"===(void 0===e?"undefined":r(e))}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===a}(e)}(e)};var a="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function u(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function s(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||u,n.isMergeableObject=n.isMergeableObject||i;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):function(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){r[t]=o(e[t],n)}),Object.keys(t).forEach(function(i){n.isMergeableObject(t[i])&&e[i]?r[i]=s(e[i],t[i],n):r[i]=o(t[i],n)}),r}(e,t,n):o(t,n)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return s(e,n,t)},{})};var f=s;t.default=f,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=V(n(0)),i=V(n(35)),a=V(n(1)),o=V(n(82)),u=V(n(83)),s=V(n(84)),f=V(n(85)),d=V(n(86)),c=V(n(87)),l=V(n(88)),h=V(n(89)),v=V(n(90)),p=V(n(91)),m=V(n(92)),y=V(n(93)),b=V(n(94)),g=V(n(95)),w=V(n(96)),_=V(n(97)),x=V(n(98)),U=V(n(99)),k=V(n(100)),S=V(n(101)),B=V(n(102)),T=V(n(103)),M=V(n(104)),O=V(n(105)),C=V(n(106)),j=V(n(107)),z=V(n(108)),P=V(n(109)),E=V(n(110)),A=V(n(111)),F=V(n(112)),D=V(n(113)),L=V(n(114)),R=V(n(115)),I=V(n(116)),N=V(n(117)),K=V(n(118)),q=V(n(119)),H=V(n(120)),G=V(n(121));function V(e){return e&&e.__esModule?e:{default:e}}var X={};function W(e,t,n){var r=e;t.map(function(e,i){r[e]=i==t.length-1?n:r[e]||{},r=r[e]})}W(X,["box","avc1"],V(n(122)).default),W(X,["box","avcC"],G.default),W(X,["box","btrt"],H.default),W(X,["box","co64"],q.default),W(X,["box","ctts"],K.default),W(X,["box","dref"],N.default),W(X,["box","elst"],I.default),W(X,["box","esds"],R.default),W(X,["box","ftyp"],L.default),W(X,["box","hdlr"],D.default),W(X,["box","hmhd"],F.default),W(X,["box","iods"],A.default),W(X,["box","mdat"],E.default),W(X,["box","mdhd"],P.default),W(X,["box","mfhd"],z.default),W(X,["box","mp4a"],j.default),W(X,["box","MP4DecConfigDescrTag"],C.default),W(X,["box","MP4DecSpecificDescrTag"],O.default),W(X,["box","MP4ESDescrTag"],M.default),W(X,["box","mvhd"],T.default),W(X,["box","nmhd"],B.default),W(X,["box","pasp"],S.default),W(X,["box","sbgp"],k.default),W(X,["box","sdtp"],U.default),W(X,["box","SLConfigDescriptor"],x.default),W(X,["box","smhd"],_.default),W(X,["box","stco"],w.default),W(X,["box","stsc"],g.default),W(X,["box","stsd"],b.default),W(X,["box","stsh"],y.default),W(X,["box","stss"],m.default),W(X,["box","stsz"],p.default),W(X,["box","stts"],v.default),W(X,["box","stz2"],h.default),W(X,["box","tfhd"],l.default),W(X,["box","tkhd"],c.default),W(X,["box","traf"],d.default),W(X,["box","trun"],f.default),W(X,["box","udta"],s.default),W(X,["box","url"],u.default),W(X,["box","vmhd"],o.default);t.default=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.buffer=null,this.boxes=[],this.nextBox=null,this.start=0;this.buffer?(0,i.default)(Uint8Array,this.buffer,t):this.buffer=t;var n=t.byteLength;t.position=0;for(var o=new a.default(t);n-o.position>=8;){var u=new r.default;if(u.readHeader(o),u.size-8<=n-o.position)u.readBody(o),this.boxes.push(u);else{if("mdat"!==u.type){this.nextBox=u,o.position-=8;break}u.readBody(o),this.boxes.push(u)}}this.buffer=new Uint8Array(this.buffer.slice(o.position))},e.exports=t.default},function(e){e.exports={name:"xgplayer-mp4",version:"1.1.5",description:"xgplayer plugin for mp4 transform to fmp4",main:"./dist/index.js",scripts:{prepare:"npm run build",build:"webpack --progress --display-chunks -p",watch:"webpack --progress --display-chunks -p --watch",test:"karma start --single-run","test:watch":"karma start"},repository:{type:"git",url:"git@github.com:bytedance/xgplayer.git"},babel:{presets:["es2015"],plugins:["add-module-exports","babel-plugin-bulk-import"]},keywords:["mp4","fmp4","player","video"],author:"yinguohui@bytedance.com",license:"MIT",dependencies:{"concat-typed-array":"^1.0.2",deepmerge:"^2.0.1","event-emitter":"^0.3.5"},peerDependency:{xgplayer:"^0.1.0"},devDependencies:{"babel-core":"^6.26.3","babel-loader":"^7.1.4","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-bulk-import":"^1.0.2","babel-preset-es2015":"^6.24.1",chai:"^4.1.2","json-loader":"^0.5.7",karma:"^3.0.0","karma-mocha":"^1.3.0","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-chrome-launcher":"^2.2.0","karma-webpack":"^4.0.0-rc.1",mocha:"^5.2.0",webpack:"^4.11.0"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=0,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var a=!0,o=!1,u=void 0;try{for(var s,f=r[Symbol.iterator]();!(a=(s=f.next()).done);a=!0){t+=s.value.length}}catch(e){o=!0,u=e}finally{try{!a&&f.return&&f.return()}finally{if(o)throw u}}var d=new e(t),c=0,l=!0,h=!1,v=void 0;try{for(var p,m=r[Symbol.iterator]();!(l=(p=m.next()).done);l=!0){var y=p.value;d.set(y,c),c+=y.length}}catch(e){h=!0,v=e}finally{try{!l&&m.return&&m.return()}finally{if(h)throw v}}return d}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.vmhd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=[e.readUint8(),e.readUint8(),e.readUint8()],this.graphicsmode=e.readUint16(),this.opcolor=[e.readUint16(),e.readUint16(),e.readUint16()],delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default["url "]=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=[e.readUint8(),e.readUint8(),e.readUint8()];for(var t=[],n=e.buffer.byteLength;e.position<n;)t.push(e.readUint8());this.location=t,delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r,i=n(0);((r=i)&&r.__esModule?r:{default:r}).default.udta=function(){delete this.subBox}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=o(n(0)),i=o(n(1)),a=o(n(15));function o(e){return e&&e.__esModule?e:{default:e}}r.default.tkhd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3,0),1===this.version?(this.create=e.readUint64(),this.modify=e.readUint64(),this.createTime=(new a.default).setTime(1e3*this.create),this.modifyTime=(new a.default).setTime(1e3*this.modify),this.trackID=e.readUint32(),this.reserverd=e.readUint32(),this.duration=e.readUint64()):(this.create=e.readUint32(),this.modify=e.readUint32(),this.createTime=(new a.default).setTime(1e3*this.create),this.modifyTime=(new a.default).setTime(1e3*this.modify),this.trackID=e.readUint32(),this.reserverd=e.readUint32(),this.duration=e.readUint32()),e.readUint64(),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16();for(var t=[],n=0;n<9;n++)t.push(e.readUint16()+"."+e.readUint16());this.matrix=t,this.width=e.readUint16()+"."+e.readUint16(),this.height=e.readUint16()+"."+e.readUint16(),delete this.data,delete this.subBox,e=null}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stts=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.count=e.readUint32();for(var t=[],n=0,r=this.count;n<r;n++)t.push({sampleCount:e.readUint32(),sampleDuration:e.readUint32()});this.entry=t,delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stsz=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.sampleSize=e.readUint32(),this.count=e.readUint32();var t=[];this.entries=t;for(var n=0,r=this.count;n<r;n++)t.push(e.readUint32());delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stss=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.count=e.readUint32();var t=[];this.entries=t;for(var n=0,r=this.count;n<r;n++)t.push(e.readUint32());delete this.subBox,delete this.data,e=null}},function(e,t,n){},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stsd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.entryCount=e.readUint32();var t=new r.default;t.readHeader(e),this.subBox.push(t),t.readBody(e),delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stsc=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.count=e.readUint32();var t=[];this.entries=t;for(var n=0,r=this.count;n<r;n++)t.push({first_chunk:e.readUint32(),samples_per_chunk:e.readUint32(),sample_desc_index:e.readUint32()});for(var a,o,u=0,s=this.count;u<s-1;u++)a=t[u],o=t[u-1],a.chunk_count=t[u+1].first_chunk-a.first_chunk,a.first_sample=0===u?1:o.first_sample+o.chunk_count*o.samples_per_chunk;if(1===this.count){var f=t[0];f.first_sample=1,f.chunk_count=0}else if(this.count>1){var d=t[this.count-1],c=t[this.count-2];d.first_sample=c.first_sample+c.chunk_count*c.samples_per_chunk,d.chunk_count=0}delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.stco=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.count=e.readUint32();var t=[];this.entries=t;for(var n=0,r=this.count;n<r;n++)t.push(e.readUint32());delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.smhd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.balance=e.readInt8()+"."+e.readInt8(),delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r,i=n(0),a=(r=i)&&r.__esModule?r:{default:r};a.default.SLConfigDescriptor=function(e){var t=new a.default,n=void 0;return t.type=e.readUint8(),128===(n=e.readUint8())?(t.extend=!0,e.skip(2),n=e.readUint8()+5):n+=2,t.size=n,t.SL=e.readUint8(),delete t.subBox,t}},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.pasp=function(){var e=new i.default(this.data);this.content=e.buffer.slice(0,this.size-8),delete this.subBox,delete this.data,e=null}},function(e,t,n){},function(e,t,n){"use strict";var r=o(n(0)),i=o(n(1)),a=o(n(15));function o(e){return e&&e.__esModule?e:{default:e}}r.default.mvhd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.create=e.readUint32(),this.modify=e.readUint32(),this.createTime=(new a.default).setTime(1e3*this.create),this.modifyTime=(new a.default).setTime(1e3*this.modify),this.timeScale=e.readUint32(),this.duration=e.readUint32(),this.rate=e.readUint16()+"."+e.readUint16(),this.volume=e.readUint8()+"."+e.readUint8(),i.default.readByte(e.dataview,8),i.default.readByte(e.dataview,2);for(var t=[],n=0;n<9;n++)t.push(e.readUint16()+"."+e.readUint16());this.matrix=t,i.default.readByte(e.dataview,24),this.nextTrackID=e.readUint32(),delete this.subBox,delete this.data}},function(e,t,n){"use strict";var r,i=n(0),a=(r=i)&&r.__esModule?r:{default:r};a.default.MP4ESDescrTag=function(e){var t=new a.default,n=void 0;return t.type=e.readUint8(),128===(n=e.readUint8())?(t.extend=!0,e.skip(2),n=e.readUint8()+5):n+=2,t.size=n,t.esID=e.readUint16(),t.priority=e.readUint8(),t.subBox.push(a.default.MP4DecConfigDescrTag(e)),t.subBox.push(a.default.SLConfigDescriptor(e)),t}},function(e,t,n){"use strict";var r,i=n(0),a=(r=i)&&r.__esModule?r:{default:r};a.default.MP4DecSpecificDescrTag=function(e){var t=new a.default,n=void 0,r=void 0;t.type=e.readUint8(),128===(n=e.readUint8())?(t.extend=!0,e.skip(2),r=(n=e.readUint8()+5)-5):(r=n,n+=2),t.size=n;for(var i=[],o=0;o<r;o++)i.push(Number(e.readUint8()).toString(16).padStart(2,"0"));return t.EScode=i,delete t.subBox,t}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.MP4DecConfigDescrTag=function(e){var t=new r.default,n=void 0;return t.type=e.readUint8(),128===(n=e.readUint8())?(t.extend=!0,e.skip(2),n=e.readUint8()+5):n+=2,t.size=n,t.typeID=e.readUint8(),t.streamUint=e.readUint8(),t.bufferSize=i.default.readByte(e.dataview,3),t.maximum=e.readUint32(),t.average=e.readUint32(),t.subBox.push(r.default.MP4DecSpecificDescrTag(e)),t}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.mp4a=function(){var e=new i.default(this.data);e.skip(6),this.dataReferenceIndex=e.readUint16(),e.skip(8),this.channelCount=e.readUint16(),this.sampleSize=e.readUint16(),e.skip(4),this.sampleRate=e.readUint32()>>16;var t=new r.default;t.readHeader(e),this.subBox.push(t),t.readBody(e),delete this.data,e=null}},function(e,t,n){},function(e,t,n){"use strict";var r=o(n(0)),i=o(n(1)),a=o(n(15));function o(e){return e&&e.__esModule?e:{default:e}}r.default.mdhd=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),1===this.version?(this.create=e.readUint64(),this.modify=e.readUint64(),this.createTime=(new a.default).setTime(1e3*this.create),this.modifyTime=(new a.default).setTime(1e3*this.modify),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.create=e.readUint32(),this.modify=e.readUint32(),this.createTime=(new a.default).setTime(1e3*this.create),this.modifyTime=(new a.default).setTime(1e3*this.modify),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.language=e.readUint16(),e.readUint16(),delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r,i=n(0);((r=i)&&r.__esModule?r:{default:r}).default.mdat=function(){delete this.subBox}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.iods=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3);for(var t=[],n=e.buffer.byteLength;e.position<n;)t.push(e.readUint8());this.content=t,delete this.subBox,delete this.data,e=null}},function(e,t,n){},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.hdlr=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),e.skip(4),this.handleType=""+String.fromCharCode(e.readUint8())+String.fromCharCode(e.readUint8())+String.fromCharCode(e.readUint8())+String.fromCharCode(e.readUint8()),e.skip(12);for(var t=[];e.position<this.size-8;)t.push(String.fromCharCode(e.readUint8()));this.name=t.join(""),delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.ftyp=function(){var e=new i.default(this.data);this.major_brand=String.fromCharCode(e.readUint8(),e.readUint8(),e.readUint8(),e.readUint8()),this.minor_version=e.readUint32();for(var t=[],n=0,r=Math.floor((e.buffer.byteLength-8)/4);n<r;n++)t.push(String.fromCharCode(e.readUint8(),e.readUint8(),e.readUint8(),e.readUint8()));this.compatible_brands=t,e=null,delete this.subBox,delete this.data}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.esds=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3);var t=r.default.MP4ESDescrTag(e);this.subBox.push(t),delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.elst=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3);var t=[],n=e.readUint32();this.entries=t;for(var r=0;r<n;r++){var a={};t.push(a),1===this.version?(a.segment_duration=e.readUint64(),a.media_time=e.readUint64()):(a.segment_duration=e.readUint32(),a.media_time=e.readInt32()),a.media_rate_integer=e.readInt16(),a.media_rate_fraction=e.readInt16()}delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.dref=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3);var t=e.readUint32();this.entryCount=t;for(var n=0;n<t;n++){var a=new r.default;this.subBox.push(a),a.read(e)}delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.ctts=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.entryCount=e.readUint32();var t=[];this.entry=t;for(var n=0,r=this.entryCount;n<r;n++)t.push({count:e.readUint32(),offset:e.readUint32()});delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.co64=function(){var e=new i.default(this.data);this.version=e.readUint8(),this.flag=i.default.readByte(e.dataview,3),this.count=e.readUint32();var t=[];this.entries=t;for(var n=0,r=this.count;n<r;n++)t.push(e.readUint64());delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.btrt=function(){var e=new i.default(this.data);this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.avcC=function(){var e=new i.default(this.data);this.configVersion=e.readUint8(),this.profile=e.readUint8(),this.profileCompatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=1+(3&e.readUint8()),this.numOfSequenceParameterSets=31&e.readUint8();var t=e.readUint16();this.sequenceLength=t;for(var n=[],r=0;r<t;r++)n.push(Number(e.readUint8()).toString(16));this.ppsCount=e.readUint8();var a=e.readUint16();this.ppsLength=a;for(var o=[],u=0;u<a;u++)o.push(Number(e.readUint8()).toString(16));this.pps=o,this.sequence=n;for(var s=[],f=e.dataview.byteLength;e.position<f;)s.push(e.readUint8());this.last=s,delete this.subBox,delete this.data,e=null}},function(e,t,n){"use strict";var r=a(n(0)),i=a(n(1));function a(e){return e&&e.__esModule?e:{default:e}}r.default.avc1=function(){var e=new i.default(this.data);e.skip(6),this.dataReferenceIndex=e.readUint16(),e.skip(16),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.skip(4),this.frameCount=e.readUint16(),e.skip(1);for(var t=0;t<31;t++)String.fromCharCode(e.readUint8());for(this.depth=e.readUint16(),e.skip(2);e.position<e.buffer.byteLength;){var n=new r.default;n.readHeader(e),this.subBox.push(n),n.readBody(e)}delete this.data,e=null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(16),o=(r=a)&&r.__esModule?r:{default:r};var u=Math.pow(2,32)-1,s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"type",value:function(e){return new Uint8Array([e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)])}},{key:"size",value:function(e){return o.default.writeUint32(e)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"ftyp",value:function(){var t=new o.default;return t.write(e.size(24),e.type("ftyp"),new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49])),t.buffer}},{key:"moov",value:function(t){var n=new o.default,r=8,i=e.mvhd(t.duration,t.timeScale),a=e.videoTrak(t),u=e.audioTrak(t),s=e.mvex(t.duration,t.timeScale);return[i,a,u,s].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("moov"),i,a,u,s),n.buffer}},{key:"mvhd",value:function(t,n){var r=new o.default;t*=n;var i=Math.floor(t/(u+1)),a=Math.floor(t%(u+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,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]);return r.write(e.size(8+s.length),e.type("mvhd"),new Uint8Array(s)),r.buffer}},{key:"videoTrak",value:function(t){var n=new o.default,r=8,i=e.tkhd({id:1,duration:t.videoDuration,timescale:t.videoTimeScale,width:t.width,height:t.height,type:"video"}),a=e.mdia({type:"video",timescale:t.videoTimeScale,duration:t.videoDuration,sps:t.sps,pps:t.pps,pixelRatio:t.pixelRatio,width:t.width,height:t.height});return[i,a].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("trak"),i,a),n.buffer}},{key:"audioTrak",value:function(t){var n=new o.default,r=8,i=e.tkhd({id:2,duration:t.audioDuration,timescale:t.audioTimeScale,width:0,height:0,type:"audio"}),a=e.mdia({type:"audio",timescale:t.audioTimeScale,duration:t.audioDuration,channelCount:t.channelCount,samplerate:t.sampleRate,audioConfig:t.audioConfig});return[i,a].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("trak"),i,a),n.buffer}},{key:"tkhd",value:function(t){var n=new o.default,r=t.id,i=t.duration*t.timeScale,a=t.width,s=t.height,f=t.type,d=Math.floor(i/(u+1)),c=Math.floor(i%(u+1)),l=new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,d>>24,d>>16&255,d>>8&255,255&d,c>>24,c>>16&255,c>>8&255,255&c,0,0,0,0,0,0,0,0,0,0,0,"video"===f?1:0,"audio"===f?1: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,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]);return n.write(e.size(8+l.byteLength),e.type("tkhd"),l),n.buffer}},{key:"edts",value:function(t){var n=new o.default,r=t.duration,i=t.mediaTime;return n.write(e.size(36),e.type("edts")),n.write(e.size(28),e.type("elst")),n.write(new Uint8Array([0,0,0,1,r>>24&255,r>>16&255,r>>8&255,255&r,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,1])),n.buffer}},{key:"mdia",value:function(t){var n=new o.default,r=8,i=e.mdhd(t.timescale),a=e.hdlr(t.type),u=e.minf(t);return[i,a,u].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("mdia"),i,a,u),n.buffer}},{key:"mdhd",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=new o.default;n*=t;var i=Math.floor(n/(u+1)),a=Math.floor(n%(u+1)),s=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]);return r.write(e.size(12+s.byteLength),e.type("mdhd"),e.extension(1,0),s),r.buffer}},{key:"hdlr",value:function(t){var n=new o.default,r=[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];return"audio"===t&&(r.splice.apply(r,[8,4].concat([115,111,117,110])),r.splice.apply(r,[24,13].concat([83,111,117,110,100,72,97,110,100,108,101,114,0]))),n.write(e.size(8+r.length),e.type("hdlr"),new Uint8Array(r)),n.buffer}},{key:"minf",value:function(t){var n=new o.default,r=8,i="video"===t.type?e.vmhd():e.smhd(),a=e.dinf(),u=e.stbl(t);return[i,a,u].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("minf"),i,a,u),n.buffer}},{key:"vmhd",value:function(){var t=new o.default;return t.write(e.size(20),e.type("vmhd"),new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])),t.buffer}},{key:"smhd",value:function(){var t=new o.default;return t.write(e.size(16),e.type("smhd"),new Uint8Array([0,0,0,0,0,0,0,0])),t.buffer}},{key:"dinf",value:function(){var t=new o.default;return t.write(e.size(36),e.type("dinf"),e.size(28),e.type("dref"),new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])),t.buffer}},{key:"stbl",value:function(t){var n=new o.default,r=8,i=e.stsd(t),a=e.stts(),u=e.stsc(),s=e.stsz(),f=e.stco();return[i,a,u,s,f].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("stbl"),i,a,u,s,f),n.buffer}},{key:"stsd",value:function(t){var n=new o.default,r=void 0;return r="audio"===t.type?e.mp4a(t):e.avc1(t),n.write(e.size(16+r.byteLength),e.type("stsd"),e.extension(0,0),new Uint8Array([0,0,0,1]),r),n.buffer}},{key:"mp4a",value:function(t){var n=new o.default,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.samplerate>>8&255,255&t.samplerate,0,0]),i=e.esds(t.audioConfig);return n.write(e.size(8+r.byteLength+i.byteLength),e.type("mp4a"),r,i),n.buffer}},{key:"esds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[43,146,8,0],n=t.length,r=new o.default,i=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(t).concat([6,1,2]));return r.write(e.size(8+i.byteLength),e.type("esds"),i),r.buffer}},{key:"avc1",value:function(t){var n=new o.default,r=t.sps,i=t.pps,a=t.width,u=t.height,s=t.pixelRatio[0],f=t.pixelRatio[1],d=new Uint8Array([1,r[1],r[2],r[3],255,225].concat([r.length>>>8&255,255&r.length]).concat(r).concat(1).concat([i.length>>>8&255,255&i.length]).concat(i)),c=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,a>>8&255,255&a,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l=new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]),h=new Uint8Array([s>>24,s>>16&255,s>>8&255,255&s,f>>24,f>>16&255,f>>8&255,255&f]);return n.write(e.size(40+c.byteLength+d.byteLength+l.byteLength),e.type("avc1"),c,e.size(8+d.byteLength),e.type("avcC"),d,e.size(20),e.type("btrt"),l,e.size(16),e.type("pasp"),h),n.buffer}},{key:"stts",value:function(){var t=new o.default,n=new Uint8Array([0,0,0,0,0,0,0,0]);return t.write(e.size(16),e.type("stts"),n),t.buffer}},{key:"stsc",value:function(){var t=new o.default,n=new Uint8Array([0,0,0,0,0,0,0,0]);return t.write(e.size(16),e.type("stsc"),n),t.buffer}},{key:"stco",value:function(){var t=new o.default,n=new Uint8Array([0,0,0,0,0,0,0,0]);return t.write(e.size(16),e.type("stco"),n),t.buffer}},{key:"stsz",value:function(){var t=new o.default,n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);return t.write(e.size(20),e.type("stsz"),n),t.buffer}},{key:"mvex",value:function(t,n){var r=new o.default,i=o.default.writeUint32(t*n);return r.write(e.size(88),e.type("mvex"),e.size(16),e.type("mehd"),e.extension(0,0),i,e.trex(1),e.trex(2)),r.buffer}},{key:"trex",value:function(t){var n=new o.default,r=new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return n.write(e.size(8+r.byteLength),e.type("trex"),r),n.buffer}},{key:"moof",value:function(t){var n=new o.default,r=8,i=e.mfhd(),a=e.traf(t);return[i,a].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("moof"),i,a),n.buffer}},{key:"mfhd",value:function(){var t=new o.default,n=o.default.writeUint32(e.sequence);return e.sequence+=1,t.write(e.size(16),e.type("mfhd"),e.extension(0,0),n),t.buffer}},{key:"traf",value:function(t){var n=new o.default,r=8,i=e.tfhd(t.id),a=e.tfdt(t.time),u=e.sdtp(t),s=e.trun(t,u.byteLength);return[i,a,u,s].forEach(function(e){r+=e.byteLength}),n.write(e.size(r),e.type("traf"),i,a,u,s),n.buffer}},{key:"tfhd",value:function(t){var n=new o.default,r=o.default.writeUint32(t);return n.write(e.size(16),e.type("tfhd"),e.extension(0,0),r),n.buffer}},{key:"tfdt",value:function(t){var n=new o.default,r=Math.floor(t/(u+1)),i=Math.floor(t%(u+1));return n.write(e.size(20),e.type("tfdt"),e.extension(1,0),o.default.writeUint32(r),o.default.writeUint32(i)),n.buffer}},{key:"trun",value:function(t,n){var r=t.id,i=1===r?16:12,a=new o.default,u=o.default.writeUint32(t.samples.length),s=o.default.writeUint32(96+i*t.samples.length+n);return a.write(e.size(20+i*t.samples.length),e.type("trun"),e.extension(0,t.flags),u,s),t.samples.forEach(function(e,t){a.write(o.default.writeUint32(e.duration)),a.write(o.default.writeUint32(e.size)),1===r?(a.write(o.default.writeUint32(e.key?33554432:16842752)),a.write(o.default.writeUint32(e.offset))):a.write(o.default.writeUint32(16777216))}),a.buffer}},{key:"sdtp",value:function(t){var n=new o.default;return n.write(e.size(12+t.samples.length),e.type("sdtp"),e.extension(0,0)),t.samples.forEach(function(e){n.write(new Uint8Array(1===t.id?[e.key?32:16]:[16]))}),n.buffer}},{key:"mdat",value:function(t){var n=new o.default,r=8;return t.samples.forEach(function(e){r+=e.size}),n.write(e.size(r),e.type("mdat")),t.samples.forEach(function(e){n.write(e.buffer)}),n.buffer}}]),e}();s.sequence=1,t.default=s,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={findBox:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e.type!==t){if(e&&e.subBox){var i=e.subBox.filter(function(e){return e.type===t});i.length?i.forEach(function(e){return n.push(e)}):e.subBox.forEach(function(e){return r.findBox(e,t,n)})}}else n.push(e);return(n=[].concat(n)).length>1?n:n[0]},padStart:function(e,t,n){for(var r=String(n),i=t>>0,a=Math.ceil(i/r.length),o=[],u=String(e);a--;)o.push(r);return o.join("").substring(0,i-u.length)+u},toHex:function(){for(var e=[],t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){e.push(r.padStart(Number(t).toString(16),2,0))}),e},sum:function(){for(var e=0,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e+=t}),e},stscOffset:function(e,t){var n=e.entries.filter(function(e){return e.first_sample<=t&&t<e.first_sample+e.chunk_count*e.samples_per_chunk})[0];if(n){var r=Math.floor((t-n.first_sample)/n.samples_per_chunk),i=n.first_sample+r*n.samples_per_chunk;return{chunk_index:n.first_chunk+r,samples_offset:[i,t]}}var a=e.entries.pop();e.entries.push(a);var o=Math.floor((t-a.first_sample)/a.samples_per_chunk);return{chunk_index:a.first_chunk+o,samples_offset:[a.first_sample+a.samples_per_chunk*o,t]}},seekSampleOffset:function(e,t,n,i,a){var o=r.stscOffset(e,i+1),u=t.entries[o.chunk_index-1]+r.sum.apply(null,n.entries.slice(o.samples_offset[0]-1,o.samples_offset[1]-1))-a;if(void 0===u)throw"result="+u+",stco.length="+t.entries.length+",sum="+r.sum.apply(null,n.entries.slice(0,i));if(u<0)throw"result="+u+",stco.length="+t.entries.length+",sum="+r.sum.apply(null,n.entries.slice(0,i));return u},seekSampleTime:function(e,t,n){var r=void 0,i=void 0,a=0,o=0,u=0;if(e.entry.every(function(e){return i=e.sampleDuration,n<a+e.sampleCount?(r=o+(n-a)*e.sampleDuration,!1):(a+=e.sampleCount,o+=e.sampleCount*i,!0)}),t){var s=0;t.entry.every(function(e){return s+=e.count,!(n<s)||(u=e.offset,!1)})}return r||(r=o+(n-a)*i),{time:r,duration:i,offset:u}},seekOrderSampleByTime:function(e,t,n){var r=0,i=0,a=0,o=void 0;return e.every(function(e,u){return o=e.sampleCount*e.sampleDuration/t,n<=r+o?(i=a+Math.ceil((n-r)*t/e.sampleDuration),r+=Math.ceil((n-r)*t/e.sampleDuration)*e.sampleDuration/t,!1):(r+=o,a+=e.sampleCount,!0)}),{order:i,startTime:r}},seekTrakDuration:function(e,t){var n=r.findBox(e,"stts"),i=0;return n.entry.forEach(function(e){i+=e.sampleCount*e.sampleDuration}),Number(i/t).toFixed(4)}};t.default=r,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(13)),a=o(n(7));function o(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.64001E, mp4a.40.5"';!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=this;(0,i.default)(this),this.codecs=t,this.mediaSource=new window.MediaSource,this.url=window.URL.createObjectURL(this.mediaSource),this.queue=[],this.updating=!1,this.mediaSource.addEventListener("sourceopen",function(){n.sourceBuffer=n.mediaSource.addSourceBuffer(n.codecs),n.sourceBuffer.addEventListener("error",function(e){n.emit("error",new a.default("mse","",{line:16,handle:"[MSE] constructor sourceopen",msg:e.message}))}),n.sourceBuffer.addEventListener("updateend",function(e){n.emit("updateend");var t=n.queue.shift();t&&n.sourceBuffer&&!n.sourceBuffer.updating&&"open"===n.state&&n.sourceBuffer.appendBuffer(t)}),n.emit("sourceopen")}),this.mediaSource.addEventListener("sourceclose",function(){n.emit("sourceclose")})}return r(e,[{key:"appendBuffer",value:function(e){var t=this.sourceBuffer;return t&&!t.updating&&"open"===this.state?(t.appendBuffer(e),!0):(this.queue.push(e),!1)}},{key:"removeBuffer",value:function(e,t){this.sourceBuffer.remove(e,t)}},{key:"endOfStream",value:function(){"open"===this.state&&this.mediaSource.endOfStream()}},{key:"state",get:function(){return this.mediaSource.readyState}},{key:"duration",get:function(){return this.mediaSource.duration},set:function(e){this.mediaSource.duration=e}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),e}();t.default=u,e.exports=t.default}]);
- //# sourceMappingURL=index.js.map
|