xgplayer-streaming-shared
Advanced tools
Comparing version 3.0.5-alpha.0 to 3.0.5-alpha.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.json.stringify.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/esnext.typed-array.at.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/esnext.typed-array.find-last.js"),require("core-js/modules/esnext.typed-array.find-last-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.subarray.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.number.is-nan.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.set.js")):"function"==typeof define&&define.amd?define(["core-js/modules/es.object.assign.js","core-js/modules/es.object.to-string.js","core-js/modules/es.promise.js","core-js/modules/es.array.iterator.js","core-js/modules/es.string.iterator.js","core-js/modules/web.dom-collections.iterator.js","core-js/modules/web.url.js","core-js/modules/web.url-search-params.js","core-js/modules/web.dom-collections.for-each.js","core-js/modules/es.object.keys.js","core-js/modules/es.array.slice.js","core-js/modules/es.array.splice.js","core-js/modules/es.regexp.exec.js","core-js/modules/es.function.name.js","core-js/modules/es.array.concat.js","core-js/modules/es.array.map.js","core-js/modules/es.json.stringify.js","core-js/modules/es.array.join.js","core-js/modules/es.array.includes.js","core-js/modules/es.promise.finally.js","core-js/modules/es.array.filter.js","core-js/modules/es.typed-array.uint8-array.js","core-js/modules/esnext.typed-array.at.js","core-js/modules/es.typed-array.copy-within.js","core-js/modules/es.typed-array.every.js","core-js/modules/es.typed-array.fill.js","core-js/modules/es.typed-array.filter.js","core-js/modules/es.typed-array.find.js","core-js/modules/es.typed-array.find-index.js","core-js/modules/esnext.typed-array.find-last.js","core-js/modules/esnext.typed-array.find-last-index.js","core-js/modules/es.typed-array.for-each.js","core-js/modules/es.typed-array.includes.js","core-js/modules/es.typed-array.index-of.js","core-js/modules/es.typed-array.iterator.js","core-js/modules/es.typed-array.join.js","core-js/modules/es.typed-array.last-index-of.js","core-js/modules/es.typed-array.map.js","core-js/modules/es.typed-array.reduce.js","core-js/modules/es.typed-array.reduce-right.js","core-js/modules/es.typed-array.reverse.js","core-js/modules/es.typed-array.set.js","core-js/modules/es.typed-array.slice.js","core-js/modules/es.typed-array.some.js","core-js/modules/es.typed-array.sort.js","core-js/modules/es.typed-array.subarray.js","core-js/modules/es.typed-array.to-locale-string.js","core-js/modules/es.typed-array.to-string.js","core-js/modules/es.string.replace.js","core-js/modules/es.number.is-nan.js","core-js/modules/es.number.constructor.js","core-js/modules/es.object.get-prototype-of.js","core-js/modules/es.symbol.js","core-js/modules/es.string.trim.js","core-js/modules/es.set.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).XGPlayerStreamingShared=t()}(this,(function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(){r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(k){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof f?t:f,s=Object.create(o.prototype),a=new x(n||[]);return i(s,"_invoke",{value:j(e,r,a)}),s}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(k){return{type:"throw",arg:k}}}e.wrap=l;var h={};function f(){}function p(){}function _(){}var v={};c(v,s,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(R([])));g&&g!==t&&n.call(g,s)&&(v=g);var m=_.prototype=f.prototype=Object.create(v);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(i,o,s,a){var u=d(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,a)}),(function(e){r("throw",e,s,a)})):t.resolve(l).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function j(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=T(s,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=d(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function R(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=_,i(m,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:p,configurable:!0}),p.displayName=c(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,c(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},E(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new b(l(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(m),c(m,u,"Generator"),c(m,s,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function n(e){return(n="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 i(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(c){return void r(c)}a.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var s=e.apply(t,r);function a(e){i(s,n,o,a,u,"next",e)}function u(e){i(s,n,o,a,u,"throw",e)}a(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S(n.key),n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function f(){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}}function p(e,t,r){return(p=f()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&h(i,r.prototype),i}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return _=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return p(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)},_(e)}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function m(e){var t=f();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return g(this,r)}}function E(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=E(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function O(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function x(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var R,w=function(){function e(){s(this,e)}return u(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(t){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var o=r.length;if(o&&t){var s=r[o-1],a=s[1];if(e.start(n)-a<=t){var u=e.end(n);u>a&&(s[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,s=0,a=0,u=0,c=0,l=0,d=e.buffers(t,n),h=0,f=d.length;h<f;h++){var p=d[h];if(r+n>=p[0]&&r<p[1])i=p[0],o=p[1],s=h;else{if(r+n<p[0]){a=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:s,buffers:d,nextStart:a,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:o?o-r:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),k=Object.freeze(Object.defineProperty({__proto__:null,Buffer:w},Symbol.toStringTag,{value:"Module"})),A={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},L=(c(R={},A.MANIFEST,{HLS:1100,DASH:1200}),c(R,A.NETWORK,2100),c(R,A.NETWORK_TIMEOUT,2101),c(R,A.NETWORK_FORBIDDEN,2103),c(R,A.NETWROK_RANGE_NOT_SATISFIABLE,2116),c(R,A.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),c(R,A.REMUX,{FMP4:4100,MP4:4200}),c(R,A.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),c(R,A.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),c(R,A.OTHER,8e3),c(R,A.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002}),R),D=function(e){l(r,e);var t=m(r);function r(e,n,i,o,a){var u;return s(this,r),(u=t.call(this,a||(null==i?void 0:i.message))).errorType=e===A.NETWORK_TIMEOUT?A.NETWORK:e,u.originError=i,u.ext=o,u.errorCode=L[e][n]||L[e],u.errorMessage=u.message,u.errorCode||(u.errorType=A.OTHER,u.errorCode=L[u.errorType]),u}return u(r,null,[{key:"create",value:function(e,t,n,i,o){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=A.OTHER),new r(e,t,n,i,o))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?A.NETWORK_TIMEOUT:A.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),r}(_(Error)),P=Object.freeze(Object.defineProperty({__proto__:null,ERR:A,ERR_CODE:L,StreamingError:D},Symbol.toStringTag,{value:"Module"})),C="undefined"!=typeof window,M={DEBUG:1,LOG:2,WARN:3,ERROR:4},I=["Boolean","Number","String","Undefined","Null","Date","Object"],F=function(){function e(t,r){s(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==r?void 0:r.disabled)||!0,this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return u(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,q()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,q()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,q()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,q()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return N(e)}));t=this._prefix+q()+JSON.stringify(o)}catch(a){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var s=this.logTextArray.shift();this.logSize-=s.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function q(){return(new Date).toLocaleString()}function B(e){if("object"!==n(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function N(e,t,r){r||(r=1),t||(t=2);var i={};if(!e||"object"!==n(e))return e;var o=Object.prototype.toString.call(e).slice(8,-1);if(!I.includes(o))return o;if(!(r>t)){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r===t?i[s]=B(e[s]):"object"===n(e[s])?i[s]=N(e[s],t,r+1):i[s]=e[s]);return i}}c(F,"disabled",!0);var U=function(){try{return C?window.MediaSource:null}catch(e){}}(),H="appendBuffer",G="removeBuffer",K=function(e){l(r,e);var t=m(r);function r(e,n){var i;return s(this,r),(i=t.call(this,n||e)).type=e,i.msg=n,i}return u(r)}(_(Error)),V=function(){function e(t,r){var n=this;s(this,e),c(this,"media",null),c(this,"mediaSource",null),c(this,"_openPromise",O()),c(this,"_queue",Object.create(null)),c(this,"_sourceBuffer",Object.create(null)),c(this,"_mseFullFlag",{}),c(this,"_st",0),c(this,"_opst",0),c(this,"_logger",null),c(this,"_config",null),c(this,"_url",null),c(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t.shift();if(r){var i=x()-n._opst;n._logger.debug("UpdateEnd",r.opName,i,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:i}),n._startQueue(e)}}})),c(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new F("MSE"),this._config.openLog&&F.enable()}var t,n,i;return u(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this;return this.mediaSource&&this.mediaSource.duration>e?Promise.resolve():this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),"updateDuration")}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=x()-e._st;e._logger.debug("MSE OPEN",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=O()}return this._openPromise}},{key:"bindMedia",value:(i=o(r().mark((function e(t){var n,i,o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&U){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new U,this._st=x(),i=function e(){var r=x()-o._st;o._logger.debug("MSE OPEN"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),o._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",i),this._url=URL.createObjectURL(n),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"unbindMedia",value:(n=o(r().mark((function e(){var t,n,i,o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=o._queue[e];t&&t.forEach((function(e){return e.promise.resolve}))})),n=!!this.media&&this.media.readyState>=1,i="open"===t.readyState,n&&i)try{t.endOfStream()}catch(r){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(o._sourceBuffer[e])}catch(r){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(r){}this.media=null}this.mediaSource=null,this._openPromise=O(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(n){throw new D(A.MEDIA,A.SUB_TYPES.MSE_ADD_SB,n)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t&&"function"==typeof n.changeType?this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)})):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&(n._logger.debug("MSE APPEND START",r),n._opst=x(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),H,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var o=i._sourceBuffer[e];t>=r||!o?i._onSBUpdateEnd(e):(i._opst=x(),i._logger.debug("MSE REMOVE START",e,t,r,n),o.remove(t,r))}}),G,n,o)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n._enqueueOp(i,(function(){if(n.mediaSource){var r=n._sourceBuffer[i];n._logger.debug("MSE clearBuffer START",i,e,t),r.remove(e,t)}}))})),r}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){e=t._enqueueOp(r,(function(){if(t.mediaSource){var e=t._sourceBuffer[r];t._logger.debug("MSE clearAllBuffer START",r),e.remove(0,w.end(w.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e){var t;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(r&&r[e]&&!(r.length<5)){var n=[];r.forEach((function(e){e.context&&e.context.isinit&&n.push(e)})),this._queue[e]=r.slice(0,2),n.length>0&&(t=this._queue[e]).push.apply(t,n)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return w.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return w.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return w.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var o=this;if(!this.mediaSource)return Promise.resolve();var s=this._queue[e]=this._queue[e]||[],a={exec:t,promise:O(),opName:r,context:n};return i?(s.splice(0,0,a),this._mseFullFlag[e]=!1,this._startQueue(e)):s.push(a),this.isOpened?1===s.length&&this._startQueue(e):this._openPromise.then((function(){1===s.length&&o._startQueue(e)})),a.promise}},{key:"_enqueueBlockingOp",value:(t=o(r().mark((function e(t,n){var i,o,s=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=s._queue[e],r=O();o.push(r),t.push({exec:function(){return r.resolve()},promise:r,opName:n}),1===t.length&&s._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=s._queue[e],r=s._sourceBuffer[e];null==t||t.shift(),r&&r.updating||s._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!U)return!1;try{return U.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();c(V,"VIDEO","video"),c(V,"AUDIO","audio");var z=Object.freeze(Object.defineProperty({__proto__:null,MSEErrorType:{UPDATE_ERROR:"updateError"},MSEError:K,MSE:V},Symbol.toStringTag,{value:"Module"})),X={FETCH:"fetch",XHR:"xhr"},W={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},Y=function(e){l(r,e);var t=m(r);function r(e,n,i,o){var a;return s(this,r),c(y(a=t.call(this,o)),"retryCount",0),c(y(a),"isTimeout",!1),c(y(a),"loaderType",X.FETCH),c(y(a),"startTime",0),c(y(a),"endTime",0),c(y(a),"options",{}),a.url=e,a.request=n,a.response=i,a}return u(r)}(_(Error)),Q=Object.prototype.toString;function J(e){if("[object Object]"!==Q.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function $(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function Z(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ee(e,t){if(e){if(!t)return e;var r,i=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===Q.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===n(e)}(t)&&(t=JSON.stringify(t)),"".concat(Z(e),"=").concat(Z(t))})).join("&")})).filter(Boolean).join("&");if(i){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}}function te(e,t,r,n,i,o,s,a,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:a,contentLength:n,age:i,startTime:o,firstByteTime:s,endTime:Date.now(),priOptions:l},response:r}}function re(e,t){return Math.round(8*e*1e3/t/1024)}var ne={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},ie=Object.freeze(Object.defineProperty({__proto__:null,EVENT:ne},Symbol.toStringTag,{value:"Module"})),oe={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var u,c,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,s),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var u=0,c=[],l=a.length;u<l;u++)(a[u].fn!==t||i&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(oe);var se=oe.exports,ae=2097152,ue=function(e){l(i,e);var t,n=m(i);function i(){var e;return s(this,i),c(y(e=n.call(this)),"_abortController",null),c(y(e),"_timeoutTimer",null),c(y(e),"_reader",null),c(y(e),"_response",null),c(y(e),"_aborted",!1),c(y(e),"_index",-1),c(y(e),"_range",null),c(y(e),"_receivedLength",0),c(y(e),"_running",!1),c(y(e),"_logger",null),c(y(e),"_vid",""),c(y(e),"_onProcessMinLen",0),c(y(e),"_onCancel",null),c(y(e),"_priOptions",null),e}return u(i,[{key:"load",value:function(e){var t,n=this,i=e.url,s=e.vid,a=e.timeout,u=e.responseType,c=e.onProgress,l=e.index,d=e.onTimeout,h=e.onCancel,f=e.range,p=e.transformResponse,_=e.request,v=e.params,y=e.logger,g=e.method,m=e.headers,E=e.body,b=e.mode,j=e.credentials,T=e.cache,S=e.redirect,O=e.referrer,x=e.referrerPolicy,R=e.onProcessMinLen,w=e.priOptions;this._logger=y,this._aborted=!1,this._onProcessMinLen=R,this._onCancel=h,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=l,this._range=f||[0,0],this._vid=s||i,this._priOptions=w||{};var k={method:g,headers:m,body:E,mode:b,credentials:j,cache:T,redirect:S,referrer:O,referrerPolicy:x,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},A=!1;clearTimeout(this._timeoutTimer),i=ee(i,v);var L=$(f);L&&(m=_?_.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&m instanceof Headers?m.append("Range",L):m.Range=L),a&&(this._timeoutTimer=setTimeout((function(){if(A=!0,n.cancel(),d){var e=new Y(i,k,null,"timeout");e.isTimeout=!0,d(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),a));var D=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",f),new Promise((function(e,t){fetch(_||i,_?void 0:k).then(function(){var s=o(r().mark((function o(s){var a,d,h,_;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=s,!n._aborted&&n._running){r.next=4;break}return r.abrupt("return");case 4:if(p&&(s=p(s,i)||s),s.ok){r.next=7;break}throw new Y(i,k,s,"bad network response");case 7:if(a=Date.now(),u!==W.TEXT){r.next=15;break}return r.next=11,s.text();case 11:d=r.sent,n._running=!1,r.next=37;break;case 15:if(u!==W.JSON){r.next=22;break}return r.next=18,s.json();case 18:d=r.sent,n._running=!1,r.next=37;break;case 22:if(!c){r.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(s,c,D,a),r.abrupt("return");case 29:return r.next=31,s.arrayBuffer();case 31:d=r.sent,d=new Uint8Array(d),n._running=!1,h=Date.now()-D,_=re(d.byteLength,h),n.emit(ne.REAL_TIME_SPEED,{speed:_,len:d.byteLength,time:h,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",f),e(te(d,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),D,a,l,f,n._vid,n._priOptions));case 39:case"end":return r.stop()}}),o)})));return function(e){return s.apply(this,arguments)}}()).catch((function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!A||((e=e instanceof Y?e:new Y(i,k,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=D,e.endTime=Date.now(),e.isTimeout=A,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=o(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(t){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,i){var s=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new Y(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(ae),this._writeIdx=0);var u,c,l,d=this._reader=e.body.getReader(),h=function(){var a=o(r().mark((function o(){var a,f,p,_,v,y,g,m;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return c=Date.now(),r.prev=1,r.next=4,d.read();case 4:u=r.sent,l=Date.now(),r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(1),l=Date.now(),s._aborted||(s._running=!1,r.t0.options={index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions},s.reject(r.t0)),r.abrupt("return");case 13:if(f=(null===(a=s._range)||void 0===a?void 0:a.length)>0?s._range[0]:0,p=f+s._receivedLength,!s._aborted){r.next=19;break}return s._running=!1,t(void 0,!1,{range:[p,p],vid:s._vid,index:s._index,startTime:c,endTime:l,st:n,firstByteTime:i,priOptions:s._priOptions},e),r.abrupt("return");case 19:_=u.value?u.value.byteLength:0,s._receivedLength+=_,s._logger.debug("【fetchLoader,onProgress call】,task,",s._range,", start,",p,", end,",f+s._receivedLength,", done,",u.done),s._onProcessMinLen>0?s._writeIdx+_>=s._onProcessMinLen||u.done?((v=new Uint8Array(s._writeIdx+_)).set(s._cache.slice(0,s._writeIdx),0),_>0&&v.set(u.value,s._writeIdx),s._writeIdx=0,s._logger.debug("【fetchLoader,onProgress enough】,done,",u.done,",len,",v.byteLength,", writeIdx,",s._writeIdx)):_>0&&s._writeIdx+_<ae?(s._cache.set(u.value,s._writeIdx),s._writeIdx+=_,s._logger.debug("【fetchLoader,onProgress cache】,len,",_,", writeIdx,",s._writeIdx)):_>0&&(y=new Uint8Array(s._writeIdx+_+2048),s._logger.debug("【fetchLoader,onProgress extra start】,size,",s._writeIdx+_+2048,", datalen,",_,", writeIdx,",s._writeIdx),y.set(s._cache.slice(0,s._writeIdx),0),_>0&&y.set(u.value,s._writeIdx),s._writeIdx+=_,delete s._cache,s._cache=y,s._logger.debug("【fetchLoader,onProgress extra end】,len,",_,", writeIdx,",s._writeIdx)):v=u.value,(v&&v.byteLength>0||u.done)&&t(v,u.done,{range:[s._range[0]+s._receivedLength-(v?v.byteLength:0),s._range[0]+s._receivedLength],vid:s._vid,index:s._index,startTime:c,endTime:l,st:n,firstByteTime:i,priOptions:s._priOptions},e),u.done?(g=Date.now()-n,m=re(s._receivedLength,g),s.emit(ne.REAL_TIME_SPEED,{speed:m,len:s._receivedLength,time:g,vid:s._vid,index:s._index,range:s._range,priOptions:s._priOptions}),s._running=!1,s._logger.debug("[fetchLoader onProgress end],task,",s._range,",done,",u.done),s.resolve(te(u,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,i,s._index,s._range,s._vid,s._priOptions))):h();case 25:case"end":return r.stop()}}),o,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();h()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),i}(se);var ce=function(e){l(n,e);var r=m(n);function n(){var e;return s(this,n),c(y(e=r.call(this)),"_xhr",null),c(y(e),"_aborted",!1),c(y(e),"_timeoutTimer",null),c(y(e),"_range",null),c(y(e),"_receivedLength",0),c(y(e),"_url",null),c(y(e),"_onProgress",null),c(y(e),"_index",-1),c(y(e),"_headers",null),c(y(e),"_currentChunkSizeKB",384),c(y(e),"_timeout",null),c(y(e),"_xhr",null),c(y(e),"_withCredentials",null),c(y(e),"_startTime",-1),c(y(e),"_loadCompleteResolve",null),c(y(e),"_loadCompleteReject",null),c(y(e),"_runing",!1),c(y(e),"_logger",!1),c(y(e),"_vid",""),c(y(e),"_responseType",void 0),c(y(e),"_credentials",void 0),c(y(e),"_method",void 0),c(y(e),"_transformResponse",void 0),c(y(e),"_firstRtt",void 0),c(y(e),"_onCancel",null),c(y(e),"_priOptions",null),e}return u(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=ee(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Y?e:new Y(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===W.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var o=new Y(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},r.ontimeout=function(e){t.cancel();var r=new Y(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=$(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var r,n=e.target.status;if(n<200||n>299){var i=new Y(this._url,null,t(t({},e.target.response),{},{status:n}),"bad response,status:"+n);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var o,s=null,a=!1,u=(null===(r=this._range)||void 0===r?void 0:r.length)>0?this._range[0]:0;if(this._responseType===W.ARRAY_BUFFER){var c,l=new Uint8Array(e.target.response);if(o=u+this._receivedLength,l&&l.byteLength>0){this._receivedLength+=l.byteLength;var d=Date.now()-this._startTime,h=re(this._receivedLength,d);this.emit(ne.REAL_TIME_SPEED,{speed:h,len:this._receivedLength,time:d,vid:this._vid,index:this._index,range:[o,u+this._receivedLength],priOptions:this._priOptions})}s=l,a=!((null===(c=this._range)||void 0===c?void 0:c.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",o,"end ",u+this._receivedLength,",dataLen,",l?l.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,s=e.target.response;var f={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(f=this._transformResponse(f,this._url)||f),this._onProgress&&this._onProgress(s,a,{index:this._index,vid:this._vid,range:[o,u+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},f),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(te(this._onProgress?null:s,a,f,f.headers["content-length"],f.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,b(d(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=T(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){n.e(o)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(se),le=["retry","retryDelay","onRetryError","transformError"],de=function(){function e(t,r){s(this,e),this.promise=O(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new F("Loader")),this._loaderType=t,this._loader=t===X.FETCH&&window.fetch?new ue:new ce,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return u(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,i=t.retryDelay,s=t.onRetryError,a=t.transformError,u=v(t,le),c=function(){var t=o(r().mark((function t(){var o,l,d;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(u);case 3:o=t.sent,e.promise.resolve(o),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,l=t.t0,a&&(l=a(l)||l),s&&e._retryCount>0&&s(l,e._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),e._retryCount++,d=!0,e._retryCheckFunc&&(d=e._retryCheckFunc(t.t0)),!(d&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",u.range),e._retryTimer=setTimeout(c,i),t.abrupt("return");case 26:e.promise.reject(l);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return c(),this.promise}},{key:"cancel",value:(t=o(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function he(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var fe=Object.freeze(Object.defineProperty({__proto__:null,isMediaPlaying:function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState},getVideoPlaybackQuality:function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}},concatUint8Array:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n},sleep:he},Symbol.toStringTag,{value:"Module"})),pe=function(e){l(a,e);var n,i=m(a);function a(e){var r;return s(this,a),c(y(r=i.call(this,e)),"type",X.FETCH),c(y(r),"_queue",[]),c(y(r),"_alive",[]),c(y(r),"_currentTask",null),c(y(r),"_config",void 0),r._config=function(e){return t({loaderType:X.FETCH,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:W.TEXT,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),r._config.loaderType!==X.XHR&&ue.isSupported()||(r.type=X.XHR),r.log=e.logger,r}return u(a,[{key:"isFetch",value:function(){return this.type===X.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&J(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&J(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new de(this.type,r);return n.loader.on(ne.REAL_TIME_SPEED,(function(e){t.emit(ne.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(n=o(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,he();case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return ue.isSupported()}}]),a}(se),_e=Object.freeze(Object.defineProperty({__proto__:null,LoaderType:X,ResponseType:W,NetLoader:pe},Symbol.toStringTag,{value:"Module"})),ve=function(){function e(){s(this,e),c(this,"_prevCurrentTime",0)}return u(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,o=0;if(this._prevCurrentTime===i){var s=w.info(w.get(e),i);if(!s.buffers.length)return;r&&s.nextStart||s.nextStart&&s.nextStart-i<t?o=s.nextStart+.1:s.end&&s.end-i>n&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}}}]),e}(),ye=function(){function e(t){var r=this;s(this,e),c(this,"_seiSet",new Set),this.emitter=t,t.on(ne.SEI,(function(e){e&&r._seiSet.add(e)}))}return u(e,[{key:"throw",value:function(e){var t=this;if(null!=e&&this._seiSet.size){var r=e-.2,n=e+.2,i=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=n&&i.push(e)})),i.forEach((function(e){t._seiSet.delete(e),t.emitter.emit(ne.SEI_IN_TIME,e)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),ge=function(){function e(){s(this,e),c(this,"_chunkSpeeds",[]),c(this,"_speeds",[])}return u(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}},{key:"getAvgSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length:this._chunkSpeeds.reduce((function(e,t){return e+t}))/this._chunkSpeeds.length:0}},{key:"getLatestSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}},{key:"reset",value:function(){this._chunkSpeeds=[],this._speeds=[]}}]),e}(),me=function(){function e(t){s(this,e),c(this,"encodeType",""),c(this,"audioCodec",""),c(this,"videoCodec",""),c(this,"domain",""),c(this,"fps",0),c(this,"bitrate",0),c(this,"width",0),c(this,"height",0),c(this,"samplerate",0),c(this,"channelCount",0),c(this,"gop",0),c(this,"_bitsAccumulateSize",0),c(this,"_bitsAccumulateDuration",0),this._timescale=t}return u(e,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var t,r=e.data,n=null==r||null===(t=r.onMetaData)||void 0===t?void 0:t.framerate;n&&n>0&&n<100&&(this.fps=n)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if((!this.fps||this.fps>=100)&&e.length){var r=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/r)}e.forEach((function(e){1===e.gopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),Ee=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;s(this,e),c(this,"_core",null),c(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new me(r),this._bindEvents()}return u(e,[{key:"getStats",value:function(){var e,r,n,i,o,s,a,u=(null===(e=this._core)||void 0===e?void 0:e.media)||{},c=u.currentTime,l=void 0===c?0:c,d=u.decodeFps,h=void 0===d?0:d;return t(t({},this._stats.getStats()),{},{downloadSpeed:(null===(r=this._core)||void 0===r||null===(n=r.speedInfo)||void 0===n?void 0:n.call(r).speed)||0,avgSpeed:(null===(i=this._core)||void 0===i||null===(o=i.speedInfo)||void 0===o?void 0:o.call(i).avgSpeed)||0,currentTime:l,bufferEnd:(null===(s=this._core)||void 0===s||null===(a=s.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:h})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(ne.DEMUXED_TRACK,(function(t){var r=t.videoTrack;return e._stats.updateBitrate(r.samples)})),this._core.on(ne.FLV_SCRIPT_DATA,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(ne.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(ne.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new me(this._timescale)}}]),e}(),be=Object.freeze(Object.defineProperty({__proto__:null,GapService:ve,SeiService:ye,BandwidthService:ge,MediaStatsService:Ee},Symbol.toStringTag,{value:"Module"}));return t(t(t(t(t(t(t(t({},z),k),_e),P),ie),be),fe),{},{Logger:F})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.json.stringify.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/esnext.typed-array.at.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/esnext.typed-array.find-last.js"),require("core-js/modules/esnext.typed-array.find-last-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.subarray.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.number.is-nan.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.set.js")):"function"==typeof define&&define.amd?define(["core-js/modules/es.object.assign.js","core-js/modules/es.object.to-string.js","core-js/modules/es.promise.js","core-js/modules/es.array.iterator.js","core-js/modules/es.string.iterator.js","core-js/modules/web.dom-collections.iterator.js","core-js/modules/web.url.js","core-js/modules/web.url-search-params.js","core-js/modules/web.dom-collections.for-each.js","core-js/modules/es.object.keys.js","core-js/modules/es.array.slice.js","core-js/modules/es.array.splice.js","core-js/modules/es.regexp.exec.js","core-js/modules/es.function.name.js","core-js/modules/es.array.concat.js","core-js/modules/es.array.map.js","core-js/modules/es.json.stringify.js","core-js/modules/es.array.join.js","core-js/modules/es.array.includes.js","core-js/modules/es.promise.finally.js","core-js/modules/es.array.filter.js","core-js/modules/es.typed-array.uint8-array.js","core-js/modules/esnext.typed-array.at.js","core-js/modules/es.typed-array.copy-within.js","core-js/modules/es.typed-array.every.js","core-js/modules/es.typed-array.fill.js","core-js/modules/es.typed-array.filter.js","core-js/modules/es.typed-array.find.js","core-js/modules/es.typed-array.find-index.js","core-js/modules/esnext.typed-array.find-last.js","core-js/modules/esnext.typed-array.find-last-index.js","core-js/modules/es.typed-array.for-each.js","core-js/modules/es.typed-array.includes.js","core-js/modules/es.typed-array.index-of.js","core-js/modules/es.typed-array.iterator.js","core-js/modules/es.typed-array.join.js","core-js/modules/es.typed-array.last-index-of.js","core-js/modules/es.typed-array.map.js","core-js/modules/es.typed-array.reduce.js","core-js/modules/es.typed-array.reduce-right.js","core-js/modules/es.typed-array.reverse.js","core-js/modules/es.typed-array.set.js","core-js/modules/es.typed-array.slice.js","core-js/modules/es.typed-array.some.js","core-js/modules/es.typed-array.sort.js","core-js/modules/es.typed-array.subarray.js","core-js/modules/es.typed-array.to-locale-string.js","core-js/modules/es.typed-array.to-string.js","core-js/modules/es.string.replace.js","core-js/modules/es.number.is-nan.js","core-js/modules/es.number.constructor.js","core-js/modules/es.object.get-prototype-of.js","core-js/modules/es.symbol.js","core-js/modules/es.string.trim.js","core-js/modules/es.set.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).XGPlayerStreamingShared=t()}(this,(function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(){r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(k){c=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof f?t:f,s=Object.create(o.prototype),a=new x(n||[]);return i(s,"_invoke",{value:j(e,r,a)}),s}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(k){return{type:"throw",arg:k}}}e.wrap=l;var h={};function f(){}function p(){}function _(){}var v={};c(v,s,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(R([])));g&&g!==t&&n.call(g,s)&&(v=g);var m=_.prototype=f.prototype=Object.create(v);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(i,o,s,a){var u=d(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,a)}),(function(e){r("throw",e,s,a)})):t.resolve(l).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function j(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=T(s,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=d(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function R(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=_,i(m,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:p,configurable:!0}),p.displayName=c(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,c(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},E(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new b(l(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},E(m),c(m,u,"Generator"),c(m,s,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function n(e){return(n="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 i(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(c){return void r(c)}a.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var s=e.apply(t,r);function a(e){i(s,n,o,a,u,"next",e)}function u(e){i(s,n,o,a,u,"throw",e)}a(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S(n.key),n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function f(){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}}function p(e,t,r){return(p=f()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&h(i,r.prototype),i}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return _=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return p(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)},_(e)}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function m(e){var t=f();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return g(this,r)}}function E(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=E(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return j(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function O(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function x(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var R,w=function(){function e(){s(this,e)}return u(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(t){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var o=r.length;if(o&&t){var s=r[o-1],a=s[1];if(e.start(n)-a<=t){var u=e.end(n);u>a&&(s[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,o=0,s=0,a=0,u=0,c=0,l=0,d=e.buffers(t,n),h=0,f=d.length;h<f;h++){var p=d[h];if(r+n>=p[0]&&r<p[1])i=p[0],o=p[1],s=h;else{if(r+n<p[0]){a=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:o,index:s,buffers:d,nextStart:a,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:o?o-r:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),k=Object.freeze(Object.defineProperty({__proto__:null,Buffer:w},Symbol.toStringTag,{value:"Module"})),A={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},L=(c(R={},A.MANIFEST,{HLS:1100,DASH:1200}),c(R,A.NETWORK,2100),c(R,A.NETWORK_TIMEOUT,2101),c(R,A.NETWORK_FORBIDDEN,2103),c(R,A.NETWROK_RANGE_NOT_SATISFIABLE,2116),c(R,A.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),c(R,A.REMUX,{FMP4:4100,MP4:4200}),c(R,A.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),c(R,A.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),c(R,A.OTHER,8e3),c(R,A.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002}),R),D=function(e){l(r,e);var t=m(r);function r(e,n,i,o,a){var u;return s(this,r),(u=t.call(this,a||(null==i?void 0:i.message))).errorType=e===A.NETWORK_TIMEOUT?A.NETWORK:e,u.originError=i,u.ext=o,u.errorCode=L[e][n]||L[e],u.errorMessage=u.message,u.errorCode||(u.errorType=A.OTHER,u.errorCode=L[u.errorType]),u}return u(r,null,[{key:"create",value:function(e,t,n,i,o){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=A.OTHER),new r(e,t,n,i,o))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?A.NETWORK_TIMEOUT:A.NETWORK,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}]),r}(_(Error)),P=Object.freeze(Object.defineProperty({__proto__:null,ERR:A,ERR_CODE:L,StreamingError:D},Symbol.toStringTag,{value:"Module"})),C="undefined"!=typeof window,M={DEBUG:1,LOG:2,WARN:3,ERROR:4},I=["Boolean","Number","String","Undefined","Null","Date","Object"],F=function(){function e(t,r){s(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==r?void 0:r.disabled)||!0,this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[]}return u(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,q()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,q()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,q()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[M.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,q()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var o=n.map((function(e){return N(e)}));t=this._prefix+q()+JSON.stringify(o)}catch(a){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var s=this.logTextArray.shift();this.logSize-=s.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function q(){return(new Date).toLocaleString()}function B(e){if("object"!==n(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function N(e,t,r){r||(r=1),t||(t=2);var i={};if(!e||"object"!==n(e))return e;var o=Object.prototype.toString.call(e).slice(8,-1);if(!I.includes(o))return o;if(!(r>t)){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r===t?i[s]=B(e[s]):"object"===n(e[s])?i[s]=N(e[s],t,r+1):i[s]=e[s]);return i}}c(F,"disabled",!0);var U=function(){try{return C?window.MediaSource:null}catch(e){}}(),H="appendBuffer",G="removeBuffer",K=function(e){l(r,e);var t=m(r);function r(e,n){var i;return s(this,r),(i=t.call(this,n||e)).type=e,i.msg=n,i}return u(r)}(_(Error)),V=function(){function e(t,r){var n=this;s(this,e),c(this,"media",null),c(this,"mediaSource",null),c(this,"_openPromise",O()),c(this,"_queue",Object.create(null)),c(this,"_sourceBuffer",Object.create(null)),c(this,"_mseFullFlag",{}),c(this,"_st",0),c(this,"_opst",0),c(this,"_logger",null),c(this,"_config",null),c(this,"_url",null),c(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t.shift();if(r){var i=x()-n._opst;n._logger.debug("UpdateEnd",r.opName,i,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:i}),n._startQueue(e)}}})),c(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new F("MSE"),this._config.openLog&&F.enable()}var t,n,i;return u(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this;return this.mediaSource&&this.mediaSource.duration>e?Promise.resolve():this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),"updateDuration")}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=x()-e._st;e._logger.debug("MSE OPEN",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=O()}return this._openPromise}},{key:"bindMedia",value:(i=o(r().mark((function e(t){var n,i,o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&U){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,n=this.mediaSource=new U,this._st=x(),i=function e(){var r=x()-o._st;o._logger.debug("MSE OPEN"),n.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),o._openPromise.resolve({costtime:r})},n.addEventListener("sourceopen",i),this._url=URL.createObjectURL(n),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"unbindMedia",value:(n=o(r().mark((function e(){var t,n,i,o=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=o._queue[e];t&&t.forEach((function(e){return e.promise.resolve}))})),n=!!this.media&&this.media.readyState>=1,i="open"===t.readyState,n&&i)try{t.endOfStream()}catch(r){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(o._sourceBuffer[e])}catch(r){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(r){}this.media=null}this.mediaSource=null,this._openPromise=O(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(n){throw new D(A.MEDIA,A.SUB_TYPES.MSE_ADD_SB,n)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t?"function"!=typeof n.changeType?Promise.reject():this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)})):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&(n._logger.debug("MSE APPEND START",r),n._opst=x(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),H,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,o=!1;return this._mseFullFlag[e]&&(o=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var o=i._sourceBuffer[e];t>=r||!o?i._onSBUpdateEnd(e):(i._opst=x(),i._logger.debug("MSE REMOVE START",e,t,r,n),o.remove(t,r))}}),G,n,o)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n._enqueueOp(i,(function(){if(n.mediaSource){var r=n._sourceBuffer[i];n._logger.debug("MSE clearBuffer START",i,e,t),r.remove(e,t)}}))})),r}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){e=t._enqueueOp(r,(function(){if(t.mediaSource){var e=t._sourceBuffer[r];t._logger.debug("MSE clearAllBuffer START",r),e.remove(0,w.end(w.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e){var t;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(r&&r[e]&&!(r.length<5)){var n=[];r.forEach((function(e){e.context&&e.context.isinit&&n.push(e)})),this._queue[e]=r.slice(0,2),n.length>0&&(t=this._queue[e]).push.apply(t,n)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return w.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return w.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return w.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var o=this;if(!this.mediaSource)return Promise.resolve();var s=this._queue[e]=this._queue[e]||[],a={exec:t,promise:O(),opName:r,context:n};return i?(s.splice(0,0,a),this._mseFullFlag[e]=!1,this._startQueue(e)):s.push(a),this.isOpened?1===s.length&&this._startQueue(e):this._openPromise.then((function(){1===s.length&&o._startQueue(e)})),a.promise}},{key:"_enqueueBlockingOp",value:(t=o(r().mark((function e(t,n){var i,o,s=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((i=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return o=[],i.forEach((function(e){var t=s._queue[e],r=O();o.push(r),t.push({exec:function(){return r.resolve()},promise:r,opName:n}),1===t.length&&s._startQueue(e)})),e.abrupt("return",Promise.all(o).then((function(){try{return t()}finally{i.forEach((function(e){var t=s._queue[e],r=s._sourceBuffer[e];null==t||t.shift(),r&&r.updating||s._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new D(A.MEDIA,A.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!U)return!1;try{return U.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();c(V,"VIDEO","video"),c(V,"AUDIO","audio");var z=Object.freeze(Object.defineProperty({__proto__:null,MSEErrorType:{UPDATE_ERROR:"updateError"},MSEError:K,MSE:V},Symbol.toStringTag,{value:"Module"})),X={FETCH:"fetch",XHR:"xhr"},W={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},Y=function(e){l(r,e);var t=m(r);function r(e,n,i,o){var a;return s(this,r),c(y(a=t.call(this,o)),"retryCount",0),c(y(a),"isTimeout",!1),c(y(a),"loaderType",X.FETCH),c(y(a),"startTime",0),c(y(a),"endTime",0),c(y(a),"options",{}),a.url=e,a.request=n,a.response=i,a}return u(r)}(_(Error)),Q=Object.prototype.toString;function J(e){if("[object Object]"!==Q.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function $(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function Z(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ee(e,t){if(e){if(!t)return e;var r,i=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===Q.call(r)?t=t.toISOString():function(e){return null!==e&&"object"===n(e)}(t)&&(t=JSON.stringify(t)),"".concat(Z(e),"=").concat(Z(t))})).join("&")})).filter(Boolean).join("&");if(i){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}}function te(e,t,r,n,i,o,s,a,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:a,contentLength:n,age:i,startTime:o,firstByteTime:s,endTime:Date.now(),priOptions:l},response:r}}function re(e,t){return Math.round(8*e*1e3/t/1024)}var ne={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},ie=Object.freeze(Object.defineProperty({__proto__:null,EVENT:ne},Symbol.toStringTag,{value:"Module"})),oe={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var u,c,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,s),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var u=0,c=[],l=a.length;u<l;u++)(a[u].fn!==t||i&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[o]=1===c.length?c[0]:c:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a}(oe);var se=oe.exports,ae=2097152,ue=function(e){l(i,e);var t,n=m(i);function i(){var e;return s(this,i),c(y(e=n.call(this)),"_abortController",null),c(y(e),"_timeoutTimer",null),c(y(e),"_reader",null),c(y(e),"_response",null),c(y(e),"_aborted",!1),c(y(e),"_index",-1),c(y(e),"_range",null),c(y(e),"_receivedLength",0),c(y(e),"_running",!1),c(y(e),"_logger",null),c(y(e),"_vid",""),c(y(e),"_onProcessMinLen",0),c(y(e),"_onCancel",null),c(y(e),"_priOptions",null),e}return u(i,[{key:"load",value:function(e){var t,n=this,i=e.url,s=e.vid,a=e.timeout,u=e.responseType,c=e.onProgress,l=e.index,d=e.onTimeout,h=e.onCancel,f=e.range,p=e.transformResponse,_=e.request,v=e.params,y=e.logger,g=e.method,m=e.headers,E=e.body,b=e.mode,j=e.credentials,T=e.cache,S=e.redirect,O=e.referrer,x=e.referrerPolicy,R=e.onProcessMinLen,w=e.priOptions;this._logger=y,this._aborted=!1,this._onProcessMinLen=R,this._onCancel=h,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=l,this._range=f||[0,0],this._vid=s||i,this._priOptions=w||{};var k={method:g,headers:m,body:E,mode:b,credentials:j,cache:T,redirect:S,referrer:O,referrerPolicy:x,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},A=!1;clearTimeout(this._timeoutTimer),i=ee(i,v);var L=$(f);L&&(m=_?_.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&m instanceof Headers?m.append("Range",L):m.Range=L),a&&(this._timeoutTimer=setTimeout((function(){if(A=!0,n.cancel(),d){var e=new Y(i,k,null,"timeout");e.isTimeout=!0,d(e,{index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions})}}),a));var D=Date.now();return this._logger.debug("[fetch load start], index,",l,",range,",f),new Promise((function(e,t){fetch(_||i,_?void 0:k).then(function(){var s=o(r().mark((function o(s){var a,d,h,_;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(clearTimeout(n._timeoutTimer),n._response=s,!n._aborted&&n._running){r.next=4;break}return r.abrupt("return");case 4:if(p&&(s=p(s,i)||s),s.ok){r.next=7;break}throw new Y(i,k,s,"bad network response");case 7:if(a=Date.now(),u!==W.TEXT){r.next=15;break}return r.next=11,s.text();case 11:d=r.sent,n._running=!1,r.next=37;break;case 15:if(u!==W.JSON){r.next=22;break}return r.next=18,s.json();case 18:d=r.sent,n._running=!1,r.next=37;break;case 22:if(!c){r.next=29;break}return n.resolve=e,n.reject=t,n._loadChunk(s,c,D,a),r.abrupt("return");case 29:return r.next=31,s.arrayBuffer();case 31:d=r.sent,d=new Uint8Array(d),n._running=!1,h=Date.now()-D,_=re(d.byteLength,h),n.emit(ne.REAL_TIME_SPEED,{speed:_,len:d.byteLength,time:h,vid:n._vid,index:n._index,range:n._range,priOptions:n._priOptions});case 37:n._logger.debug("[fetch load end], index,",l,",range,",f),e(te(d,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),D,a,l,f,n._vid,n._priOptions));case 39:case"end":return r.stop()}}),o)})));return function(e){return s.apply(this,arguments)}}()).catch((function(e){var r;clearTimeout(n._timeoutTimer),n._running=!1,n._aborted&&!A||((e=e instanceof Y?e:new Y(i,k,null,null===(r=e)||void 0===r?void 0:r.message)).startTime=D,e.endTime=Date.now(),e.isTimeout=A,e.options={index:n._index,range:n._range,vid:n._vid,priOptions:n._priOptions},t(e))}))}))}},{key:"cancel",value:(t=o(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(t){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,n,i){var s=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new Y(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(ae),this._writeIdx=0);var u,c,l,d=this._reader=e.body.getReader(),h=function(){var a=o(r().mark((function o(){var a,f,p,_,v,y,g,m;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return c=Date.now(),r.prev=1,r.next=4,d.read();case 4:u=r.sent,l=Date.now(),r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(1),l=Date.now(),s._aborted||(s._running=!1,r.t0.options={index:s._index,range:s._range,vid:s._vid,priOptions:s._priOptions},s.reject(r.t0)),r.abrupt("return");case 13:if(f=(null===(a=s._range)||void 0===a?void 0:a.length)>0?s._range[0]:0,p=f+s._receivedLength,!s._aborted){r.next=19;break}return s._running=!1,t(void 0,!1,{range:[p,p],vid:s._vid,index:s._index,startTime:c,endTime:l,st:n,firstByteTime:i,priOptions:s._priOptions},e),r.abrupt("return");case 19:_=u.value?u.value.byteLength:0,s._receivedLength+=_,s._logger.debug("【fetchLoader,onProgress call】,task,",s._range,", start,",p,", end,",f+s._receivedLength,", done,",u.done),s._onProcessMinLen>0?s._writeIdx+_>=s._onProcessMinLen||u.done?((v=new Uint8Array(s._writeIdx+_)).set(s._cache.slice(0,s._writeIdx),0),_>0&&v.set(u.value,s._writeIdx),s._writeIdx=0,s._logger.debug("【fetchLoader,onProgress enough】,done,",u.done,",len,",v.byteLength,", writeIdx,",s._writeIdx)):_>0&&s._writeIdx+_<ae?(s._cache.set(u.value,s._writeIdx),s._writeIdx+=_,s._logger.debug("【fetchLoader,onProgress cache】,len,",_,", writeIdx,",s._writeIdx)):_>0&&(y=new Uint8Array(s._writeIdx+_+2048),s._logger.debug("【fetchLoader,onProgress extra start】,size,",s._writeIdx+_+2048,", datalen,",_,", writeIdx,",s._writeIdx),y.set(s._cache.slice(0,s._writeIdx),0),_>0&&y.set(u.value,s._writeIdx),s._writeIdx+=_,delete s._cache,s._cache=y,s._logger.debug("【fetchLoader,onProgress extra end】,len,",_,", writeIdx,",s._writeIdx)):v=u.value,(v&&v.byteLength>0||u.done)&&t(v,u.done,{range:[s._range[0]+s._receivedLength-(v?v.byteLength:0),s._range[0]+s._receivedLength],vid:s._vid,index:s._index,startTime:c,endTime:l,st:n,firstByteTime:i,priOptions:s._priOptions},e),u.done?(g=Date.now()-n,m=re(s._receivedLength,g),s.emit(ne.REAL_TIME_SPEED,{speed:m,len:s._receivedLength,time:g,vid:s._vid,index:s._index,range:s._range,priOptions:s._priOptions}),s._running=!1,s._logger.debug("[fetchLoader onProgress end],task,",s._range,",done,",u.done),s.resolve(te(u,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),n,i,s._index,s._range,s._vid,s._priOptions))):h();case 25:case"end":return r.stop()}}),o,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();h()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),i}(se);var ce=function(e){l(n,e);var r=m(n);function n(){var e;return s(this,n),c(y(e=r.call(this)),"_xhr",null),c(y(e),"_aborted",!1),c(y(e),"_timeoutTimer",null),c(y(e),"_range",null),c(y(e),"_receivedLength",0),c(y(e),"_url",null),c(y(e),"_onProgress",null),c(y(e),"_index",-1),c(y(e),"_headers",null),c(y(e),"_currentChunkSizeKB",384),c(y(e),"_timeout",null),c(y(e),"_xhr",null),c(y(e),"_withCredentials",null),c(y(e),"_startTime",-1),c(y(e),"_loadCompleteResolve",null),c(y(e),"_loadCompleteReject",null),c(y(e),"_runing",!1),c(y(e),"_logger",!1),c(y(e),"_vid",""),c(y(e),"_responseType",void 0),c(y(e),"_credentials",void 0),c(y(e),"_method",void 0),c(y(e),"_transformResponse",void 0),c(y(e),"_firstRtt",void 0),c(y(e),"_onCancel",null),c(y(e),"_priOptions",null),e}return u(n,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=ee(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Y?e:new Y(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===W.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var o=new Y(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));o.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(o)},r.ontimeout=function(e){t.cancel();var r=new Y(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=$(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(o){o.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(o)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var r,n=e.target.status;if(n<200||n>299){var i=new Y(this._url,null,t(t({},e.target.response),{},{status:n}),"bad response,status:"+n);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var o,s=null,a=!1,u=(null===(r=this._range)||void 0===r?void 0:r.length)>0?this._range[0]:0;if(this._responseType===W.ARRAY_BUFFER){var c,l=new Uint8Array(e.target.response);if(o=u+this._receivedLength,l&&l.byteLength>0){this._receivedLength+=l.byteLength;var d=Date.now()-this._startTime,h=re(this._receivedLength,d);this.emit(ne.REAL_TIME_SPEED,{speed:h,len:this._receivedLength,time:d,vid:this._vid,index:this._index,range:[o,u+this._receivedLength],priOptions:this._priOptions})}s=l,a=!((null===(c=this._range)||void 0===c?void 0:c.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",o,"end ",u+this._receivedLength,",dataLen,",l?l.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,s=e.target.response;var f={ok:n>=200&&n<300,status:n,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(f=this._transformResponse(f,this._url)||f),this._onProgress&&this._onProgress(s,a,{index:this._index,vid:this._vid,range:[o,u+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},f),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(te(this._onProgress?null:s,a,f,f.headers["content-length"],f.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,b(d(n.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=T(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(o){n.e(o)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),n}(se),le=["retry","retryDelay","onRetryError","transformError"],de=function(){function e(t,r){s(this,e),this.promise=O(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new F("Loader")),this._loaderType=t,this._loader=t===X.FETCH&&window.fetch?new ue:new ce,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return u(e,[{key:"exec",value:function(){var e=this,t=this._config,n=t.retry,i=t.retryDelay,s=t.onRetryError,a=t.transformError,u=v(t,le),c=function(){var t=o(r().mark((function t(){var o,l,d;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(u);case 3:o=t.sent,e.promise.resolve(o),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,l=t.t0,a&&(l=a(l)||l),s&&e._retryCount>0&&s(l,e._retryCount,{index:u.index,vid:u.vid,range:u.range,priOptions:u.priOptions}),e._retryCount++,d=!0,e._retryCheckFunc&&(d=e._retryCheckFunc(t.t0)),!(d&&e._retryCount<=n)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",u.range),e._retryTimer=setTimeout(c,i),t.abrupt("return");case 26:e.promise.reject(l);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return c(),this.promise}},{key:"cancel",value:(t=o(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function he(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var fe=Object.freeze(Object.defineProperty({__proto__:null,isMediaPlaying:function(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState},getVideoPlaybackQuality:function(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}},concatUint8Array:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n},sleep:he},Symbol.toStringTag,{value:"Module"})),pe=function(e){l(a,e);var n,i=m(a);function a(e){var r;return s(this,a),c(y(r=i.call(this,e)),"type",X.FETCH),c(y(r),"_queue",[]),c(y(r),"_alive",[]),c(y(r),"_currentTask",null),c(y(r),"_config",void 0),r._config=function(e){return t({loaderType:X.FETCH,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:W.TEXT,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),r._config.loaderType!==X.XHR&&ue.isSupported()||(r.type=X.XHR),r.log=e.logger,r}return u(a,[{key:"isFetch",value:function(){return this.type===X.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&J(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&J(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new de(this.type,r);return n.loader.on(ne.REAL_TIME_SPEED,(function(e){t.emit(ne.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(n=o(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,he();case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return ue.isSupported()}}]),a}(se),_e=Object.freeze(Object.defineProperty({__proto__:null,LoaderType:X,ResponseType:W,NetLoader:pe},Symbol.toStringTag,{value:"Module"})),ve=function(){function e(){s(this,e),c(this,"_prevCurrentTime",0)}return u(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,o=0;if(this._prevCurrentTime===i){var s=w.info(w.get(e),i);if(!s.buffers.length)return;r&&s.nextStart||s.nextStart&&s.nextStart-i<t?o=s.nextStart+.1:s.end&&s.end-i>n&&!e.seeking&&(o=i+.1)}this._prevCurrentTime=i,o&&i!==o&&(e.currentTime=o)}}}]),e}(),ye=function(){function e(t){var r=this;s(this,e),c(this,"_seiSet",new Set),this.emitter=t,t.on(ne.SEI,(function(e){e&&r._seiSet.add(e)}))}return u(e,[{key:"throw",value:function(e){var t=this;if(null!=e&&this._seiSet.size){var r=e-.2,n=e+.2,i=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=n&&i.push(e)})),i.forEach((function(e){t._seiSet.delete(e),t.emitter.emit(ne.SEI_IN_TIME,e)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),ge=function(){function e(){s(this,e),c(this,"_chunkSpeeds",[]),c(this,"_speeds",[])}return u(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}},{key:"getAvgSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length:this._chunkSpeeds.reduce((function(e,t){return e+t}))/this._chunkSpeeds.length:0}},{key:"getLatestSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}},{key:"reset",value:function(){this._chunkSpeeds=[],this._speeds=[]}}]),e}(),me=function(){function e(t){s(this,e),c(this,"encodeType",""),c(this,"audioCodec",""),c(this,"videoCodec",""),c(this,"domain",""),c(this,"fps",0),c(this,"bitrate",0),c(this,"width",0),c(this,"height",0),c(this,"samplerate",0),c(this,"channelCount",0),c(this,"gop",0),c(this,"_bitsAccumulateSize",0),c(this,"_bitsAccumulateDuration",0),this._timescale=t}return u(e,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var t,r=e.data,n=null==r||null===(t=r.onMetaData)||void 0===t?void 0:t.framerate;n&&n>0&&n<100&&(this.fps=n)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if((!this.fps||this.fps>=100)&&e.length){var r=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/r)}e.forEach((function(e){1===e.gopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),Ee=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;s(this,e),c(this,"_core",null),c(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new me(r),this._bindEvents()}return u(e,[{key:"getStats",value:function(){var e,r,n,i,o,s,a,u=(null===(e=this._core)||void 0===e?void 0:e.media)||{},c=u.currentTime,l=void 0===c?0:c,d=u.decodeFps,h=void 0===d?0:d;return t(t({},this._stats.getStats()),{},{downloadSpeed:(null===(r=this._core)||void 0===r||null===(n=r.speedInfo)||void 0===n?void 0:n.call(r).speed)||0,avgSpeed:(null===(i=this._core)||void 0===i||null===(o=i.speedInfo)||void 0===o?void 0:o.call(i).avgSpeed)||0,currentTime:l,bufferEnd:(null===(s=this._core)||void 0===s||null===(a=s.bufferInfo())||void 0===a?void 0:a.remaining)||0,decodeFps:h})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(ne.DEMUXED_TRACK,(function(t){var r=t.videoTrack;return e._stats.updateBitrate(r.samples)})),this._core.on(ne.FLV_SCRIPT_DATA,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(ne.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(ne.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new me(this._timescale)}}]),e}(),be=Object.freeze(Object.defineProperty({__proto__:null,GapService:ve,SeiService:ye,BandwidthService:ge,MediaStatsService:Ee},Symbol.toStringTag,{value:"Module"}));return t(t(t(t(t(t(t(t({},z),k),_e),P),ie),be),fe),{},{Logger:F})})); | ||
//# sourceMappingURL=index.min.js.map |
@@ -277,4 +277,6 @@ import { defineProperty as _defineProperty, inherits as _inherits, createSuper as _createSuper, createClass as _createClass, classCallCheck as _classCallCheck, wrapNativeSuper as _wrapNativeSuper, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from "./_virtual/_rollupPluginBabelHelpers.js"; | ||
var sb = this._sourceBuffer[type]; | ||
if (!this.mediaSource || !sb || sb.mimeType === mimeType || typeof sb.changeType !== "function") | ||
if (!this.mediaSource || !sb || sb.mimeType === mimeType) | ||
return Promise.resolve(); | ||
if (typeof sb.changeType !== "function") | ||
return Promise.reject(); | ||
return this._enqueueOp(type, function() { | ||
@@ -281,0 +283,0 @@ sb.changeType(mimeType); |
{ | ||
"name": "xgplayer-streaming-shared", | ||
"version": "3.0.5-alpha.0", | ||
"version": "3.0.5-alpha.1", | ||
"main": "dist/index.min.js", | ||
@@ -5,0 +5,0 @@ "module": "es/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349270
4557