summaryrefslogtreecommitdiff
path: root/localwebsite
diff options
context:
space:
mode:
Diffstat (limited to 'localwebsite')
-rw-r--r--localwebsite/config.php1
-rw-r--r--localwebsite/htdocs/assets/h265webjs-dist/h265webjs-v20221106.js38868
2 files changed, 38441 insertions, 428 deletions
diff --git a/localwebsite/config.php b/localwebsite/config.php
index 6115d7e..6efc0ea 100644
--- a/localwebsite/config.php
+++ b/localwebsite/config.php
@@ -54,6 +54,7 @@ return [
'polyfills.js' => 1,
'modem.js' => 2,
'inverter.js' => 2,
+ 'h265webjs-dist/h265webjs-v20221106.js' => 3,
],
'cam_hls_access_key' => '',
diff --git a/localwebsite/htdocs/assets/h265webjs-dist/h265webjs-v20221106.js b/localwebsite/htdocs/assets/h265webjs-dist/h265webjs-v20221106.js
index 3dd4880..41123a3 100644
--- a/localwebsite/htdocs/assets/h265webjs-dist/h265webjs-v20221106.js
+++ b/localwebsite/htdocs/assets/h265webjs-dist/h265webjs-v20221106.js
@@ -1,428 +1,38440 @@
-!function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var h=i[s]={exports:{}};t[s][0].call(h.exports,(function(e){return r(t[s][1][e]||e)}),h,h.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){t.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},{}],2:[function(e,t,i){var n=e("./setPrototypeOf"),r=e("./isNativeReflectConstruct");function a(e,i,s){return r()?t.exports=a=Reflect.construct:t.exports=a=function(e,t,i){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return i&&n(a,i.prototype),a},a.apply(null,arguments)}t.exports=a},{"./isNativeReflectConstruct":7,"./setPrototypeOf":8}],3:[function(e,t,i){function n(){return t.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},n.apply(this,arguments)}t.exports=n},{}],4:[function(e,t,i){var n=e("./setPrototypeOf");t.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},{"./setPrototypeOf":8}],5:[function(e,t,i){t.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},{}],6:[function(e,t,i){t.exports=function(e){return e&&e.__esModule?e:{default:e}}},{}],7:[function(e,t,i){t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},{}],8:[function(e,t,i){function n(e,i){return t.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,i)}t.exports=n},{}],9:[function(e,t,i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.reverseBytes=i.sliceBytes=i.bytesMatch=i.concatTypedArrays=i.stringToBytes=i.bytesToString=i.numberToBytes=i.bytesToNumber=i.IS_LITTLE_ENDIAN=i.IS_BIG_ENDIAN=i.ENDIANNESS=i.toBinaryString=i.toHexString=i.toUint8=i.isTypedArray=i.padStart=i.countBytes=i.countBits=void 0;var r=n(e("global/window")),a=function(e){return e.toString(2).length};i.countBits=a;var s=function(e){return Math.ceil(a(e)/8)};i.countBytes=s;var o=function(e,t,i){return void 0===i&&(i=" "),(function(e,t){for(var i="";t--;)i+=e;return i}(i,t)+e.toString()).slice(-t)};i.padStart=o;var u=function(e){return ArrayBuffer.isView(e)};i.isTypedArray=u;var l=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||u(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))};i.toUint8=l;i.toHexString=function(e){e=l(e);for(var t="",i=0;i<e.length;i++)t+=o(e[i].toString(16),2,"0");return t};i.toBinaryString=function(e){e=l(e);for(var t="",i=0;i<e.length;i++)t+=o(e[i].toString(2),8,"0");return t};var h,d,c=r.default.BigInt||Number,f=[c("0x1"),c("0x100"),c("0x10000"),c("0x1000000"),c("0x100000000"),c("0x10000000000"),c("0x1000000000000"),c("0x100000000000000"),c("0x10000000000000000")],p=(h=new Uint16Array([65484]),255===(d=new Uint8Array(h.buffer,h.byteOffset,h.byteLength))[0]?"big":204===d[0]?"little":"unknown");i.ENDIANNESS=p;var m="big"===p;i.IS_BIG_ENDIAN=m;var _="little"===p;i.IS_LITTLE_ENDIAN=_;i.bytesToNumber=function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,a=i.le,s=void 0!==a&&a;e=l(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+c(i)*f[r]}),c(0));if(r){var h=f[e.length]/c(2)-c(1);(u=c(u))>h&&(u-=h,u-=h,u-=c(2))}return Number(u)};i.numberToBytes=function(e,t){var i=(void 0===t?{}:t).le,n=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=c(e);for(var r=s(e),a=new Uint8Array(new ArrayBuffer(r)),o=0;o<r;o++){var u=n?o:Math.abs(o+1-a.length);a[u]=Number(e/f[o]&c(255)),e<0&&(a[u]=Math.abs(~a[u]),a[u]-=0===o?1:2)}return a};i.bytesToString=function(e){if(!e)return"";e=Array.prototype.slice.call(e);var t=String.fromCharCode.apply(null,l(e));try{return decodeURIComponent(escape(t))}catch(e){}return t};i.stringToBytes=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i};i.concatTypedArrays=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if((t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}))).length<=1)return l(t[0]);var n=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(n),a=0;return t.forEach((function(e){e=l(e),r.set(e,a),a+=e.byteLength})),r};i.bytesMatch=function(e,t,i){var n=void 0===i?{}:i,r=n.offset,a=void 0===r?0:r,s=n.mask,o=void 0===s?[]:s;e=l(e);var u=(t=l(t)).every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&u.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))};i.sliceBytes=function(e,t,i){return Uint8Array.prototype.slice?Uint8Array.prototype.slice.call(e,t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))};i.reverseBytes=function(e){return e.reverse?e.reverse():Array.prototype.reverse.call(e)}},{"@babel/runtime/helpers/interopRequireDefault":6,"global/window":34}],10:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.getHvcCodec=i.getAvcCodec=i.getAv1Codec=void 0;var n=e("./byte-helpers.js");i.getAv1Codec=function(e){var t,i="",r=e[1]>>>3,a=31&e[1],s=e[2]>>>7,o=(64&e[2])>>6,u=(32&e[2])>>5,l=(16&e[2])>>4,h=(8&e[2])>>3,d=(4&e[2])>>2,c=3&e[2];return i+=r+"."+(0,n.padStart)(a,2,"0"),0===s?i+="M":1===s&&(i+="H"),t=2===r&&o?u?12:10:o?10:8,i+="."+(0,n.padStart)(t,2,"0"),i+="."+l,i+="."+h+d+c};i.getAvcCodec=function(e){return""+(0,n.toHexString)(e[1])+(0,n.toHexString)(252&e[2])+(0,n.toHexString)(e[3])};i.getHvcCodec=function(e){var t="",i=e[1]>>6,r=31&e[1],a=(32&e[1])>>5,s=e.subarray(2,6),o=e.subarray(6,12),u=e[12];1===i?t+="A":2===i?t+="B":3===i&&(t+="C"),t+=r+".";var l=parseInt((0,n.toBinaryString)(s).split("").reverse().join(""),2);l>255&&(l=parseInt((0,n.toBinaryString)(s),2)),t+=l.toString(16)+".",t+=0===a?"L":"H",t+=u;for(var h="",d=0;d<o.length;d++){var c=o[d];c&&(h&&(h+="."),h+=c.toString(16))}return h&&(t+="."+h),t}},{"./byte-helpers.js":9}],11:[function(e,t,i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_VIDEO_CODEC=i.DEFAULT_AUDIO_CODEC=i.muxerSupportsCodec=i.browserSupportsCodec=i.getMimeForCodec=i.isTextCodec=i.isAudioCodec=i.isVideoCodec=i.codecsFromDefault=i.parseCodecs=i.mapLegacyAvcCodecs=i.translateLegacyCodecs=i.translateLegacyCodec=void 0;var r=n(e("global/window")),a={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},s=["video","audio","text"],o=["Video","Audio","Text"],u=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e};i.translateLegacyCodec=u;var l=function(e){return e.map(u)};i.translateLegacyCodecs=l;i.mapLegacyAvcCodecs=function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e){return l([e])[0]}))};var h=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),s.forEach((function(n){var r=a[n].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=n;var s=e.substring(0,r[1].length),o=e.replace(s,"");i.push({type:s,details:o,mediaType:n})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i};i.parseCodecs=h;i.codecsFromDefault=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return h(r.playlists[0].attributes.CODECS)}return null};i.isVideoCodec=function(e){return void 0===e&&(e=""),a.video.test(e.trim().toLowerCase())};var d=function(e){return void 0===e&&(e=""),a.audio.test(e.trim().toLowerCase())};i.isAudioCodec=d;var c=function(e){return void 0===e&&(e=""),a.text.test(e.trim().toLowerCase())};i.isTextCodec=c;var f=function(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map((function(e){return u(e.trim())})),i="video";1===t.length&&d(t[0])?i="audio":1===t.length&&c(t[0])&&(i="application");var n="mp4";return t.every((function(e){return a.mp4.test(e)}))?n="mp4":t.every((function(e){return a.webm.test(e)}))?n="webm":t.every((function(e){return a.ogg.test(e)}))&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'}};i.getMimeForCodec=f;i.browserSupportsCodec=function(e){return void 0===e&&(e=""),r.default.MediaSource&&r.default.MediaSource.isTypeSupported&&r.default.MediaSource.isTypeSupported(f(e))||!1};i.muxerSupportsCodec=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<o.length;t++){if(a["muxer"+o[t]].test(e))return!0}return!1}))};i.DEFAULT_AUDIO_CODEC="mp4a.40.2";i.DEFAULT_VIDEO_CODEC="avc1.4d400d"},{"@babel/runtime/helpers/interopRequireDefault":6,"global/window":34}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.isLikelyFmp4MediaSegment=i.detectContainerForBytes=i.isLikely=void 0;var n=e("./byte-helpers.js"),r=e("./mp4-helpers.js"),a=e("./ebml-helpers.js"),s=e("./id3-helpers.js"),o=e("./nal-helpers.js"),u={webm:(0,n.toUint8)([119,101,98,109]),matroska:(0,n.toUint8)([109,97,116,114,111,115,107,97]),flac:(0,n.toUint8)([102,76,97,67]),ogg:(0,n.toUint8)([79,103,103,83]),ac3:(0,n.toUint8)([11,119]),riff:(0,n.toUint8)([82,73,70,70]),avi:(0,n.toUint8)([65,86,73]),wav:(0,n.toUint8)([87,65,86,69]),"3gp":(0,n.toUint8)([102,116,121,112,51,103]),mp4:(0,n.toUint8)([102,116,121,112]),fmp4:(0,n.toUint8)([115,116,121,112]),mov:(0,n.toUint8)([102,116,121,112,113,116]),moov:(0,n.toUint8)([109,111,111,118]),moof:(0,n.toUint8)([109,111,111,102])},l={aac:function(e){var t=(0,s.getId3Offset)(e);return(0,n.bytesMatch)(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=(0,s.getId3Offset)(e);return(0,n.bytesMatch)(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=(0,a.findEbml)(e,[a.EBML_TAGS.EBML,a.EBML_TAGS.DocType])[0];return(0,n.bytesMatch)(t,u.webm)},mkv:function(e){var t=(0,a.findEbml)(e,[a.EBML_TAGS.EBML,a.EBML_TAGS.DocType])[0];return(0,n.bytesMatch)(t,u.matroska)},mp4:function(e){return!l["3gp"](e)&&!l.mov(e)&&(!(!(0,n.bytesMatch)(e,u.mp4,{offset:4})&&!(0,n.bytesMatch)(e,u.fmp4,{offset:4}))||(!(!(0,n.bytesMatch)(e,u.moof,{offset:4})&&!(0,n.bytesMatch)(e,u.moov,{offset:4}))||void 0))},mov:function(e){return(0,n.bytesMatch)(e,u.mov,{offset:4})},"3gp":function(e){return(0,n.bytesMatch)(e,u["3gp"],{offset:4})},ac3:function(e){var t=(0,s.getId3Offset)(e);return(0,n.bytesMatch)(e,u.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=(0,s.getId3Offset)(e);return(0,n.bytesMatch)(e,u.flac,{offset:t})},ogg:function(e){return(0,n.bytesMatch)(e,u.ogg)},avi:function(e){return(0,n.bytesMatch)(e,u.riff)&&(0,n.bytesMatch)(e,u.avi,{offset:8})},wav:function(e){return(0,n.bytesMatch)(e,u.riff)&&(0,n.bytesMatch)(e,u.wav,{offset:8})},h264:function(e){return(0,o.findH264Nal)(e,7,3).length},h265:function(e){return(0,o.findH265Nal)(e,[32,33],3).length}},h=Object.keys(l).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);h.forEach((function(e){var t=l[e];l[e]=function(e){return t((0,n.toUint8)(e))}}));var d=l;i.isLikely=d;i.detectContainerForBytes=function(e){e=(0,n.toUint8)(e);for(var t=0;t<h.length;t++){var i=h[t];if(d[i](e))return i}return""};i.isLikelyFmp4MediaSegment=function(e){return(0,r.findBox)(e,["moof"]).length>0}},{"./byte-helpers.js":9,"./ebml-helpers.js":14,"./id3-helpers.js":15,"./mp4-helpers.js":17,"./nal-helpers.js":18}],13:[function(e,t,i){(function(n){"use strict";var r=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.default=function(e){for(var t=(s=e,a.default.atob?a.default.atob(s):n.from(s,"base64").toString("binary")),i=new Uint8Array(t.length),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);var s;return i};var a=r(e("global/window"));t.exports=i.default}).call(this,e("buffer").Buffer)},{"@babel/runtime/helpers/interopRequireDefault":6,buffer:32,"global/window":34}],14:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.parseData=i.parseTracks=i.decodeBlock=i.findEbml=i.EBML_TAGS=void 0;var n=e("./byte-helpers"),r=e("./codec-helpers.js"),a={EBML:(0,n.toUint8)([26,69,223,163]),DocType:(0,n.toUint8)([66,130]),Segment:(0,n.toUint8)([24,83,128,103]),SegmentInfo:(0,n.toUint8)([21,73,169,102]),Tracks:(0,n.toUint8)([22,84,174,107]),Track:(0,n.toUint8)([174]),TrackNumber:(0,n.toUint8)([215]),DefaultDuration:(0,n.toUint8)([35,227,131]),TrackEntry:(0,n.toUint8)([174]),TrackType:(0,n.toUint8)([131]),FlagDefault:(0,n.toUint8)([136]),CodecID:(0,n.toUint8)([134]),CodecPrivate:(0,n.toUint8)([99,162]),VideoTrack:(0,n.toUint8)([224]),AudioTrack:(0,n.toUint8)([225]),Cluster:(0,n.toUint8)([31,67,182,117]),Timestamp:(0,n.toUint8)([231]),TimestampScale:(0,n.toUint8)([42,215,177]),BlockGroup:(0,n.toUint8)([160]),BlockDuration:(0,n.toUint8)([155]),Block:(0,n.toUint8)([161]),SimpleBlock:(0,n.toUint8)([163])};i.EBML_TAGS=a;var s=[128,64,32,16,8,4,2,1],o=function(e,t,i,r){void 0===i&&(i=!0),void 0===r&&(r=!1);var a=function(e){for(var t=1,i=0;i<s.length&&!(e&s[i]);i++)t++;return t}(e[t]),o=e.subarray(t,t+a);return i&&((o=Array.prototype.slice.call(e,t,t+a))[0]^=s[a-1]),{length:a,value:(0,n.bytesToNumber)(o,{signed:r}),bytes:o}},u=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map((function(t){return e(t)})):"number"==typeof t?(0,n.numberToBytes)(t):t},l=function e(t,i,r){if(r>=i.length)return i.length;var a=o(i,r,!1);if((0,n.bytesMatch)(t.bytes,a.bytes))return r;var s=o(i,r+a.length);return e(t,i,r+s.length+s.value+a.length)},h=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return u(e)})):[u(e)]}(i),t=(0,n.toUint8)(t);var r=[];if(!i.length)return r;for(var a=0;a<t.length;){var s=o(t,a,!1),h=o(t,a+s.length),d=a+s.length+h.length;127===h.value&&(h.value=l(s,t,d),h.value!==t.length&&(h.value-=d));var c=d+h.value>t.length?t.length:d+h.value,f=t.subarray(d,c);(0,n.bytesMatch)(i[0],s.bytes)&&(1===i.length?r.push(f):r=r.concat(e(f,i.slice(1)))),a+=s.length+h.length+f.length}return r};i.findEbml=h;var d=function(e,t,i,r){var s;"group"===t&&((s=h(e,[a.BlockDuration])[0])&&(s=1/i*(s=(0,n.bytesToNumber)(s))*i/1e3),e=h(e,[a.Block])[0],t="block");var u=new DataView(e.buffer,e.byteOffset,e.byteLength),l=o(e,0),d=u.getInt16(l.length,!1),c=e[l.length+2],f=e.subarray(l.length+3),p=1/i*(r+d)*i/1e3,m={duration:s,trackNumber:l.value,keyframe:"simple"===t&&c>>7==1,invisible:(8&c)>>3==1,lacing:(6&c)>>1,discardable:"simple"===t&&1==(1&c),frames:[],pts:p,dts:p,timestamp:d};if(!m.lacing)return m.frames.push(f),m;var _=f[0]+1,g=[],v=1;if(2===m.lacing)for(var y=(f.length-v)/_,b=0;b<_;b++)g.push(y);if(1===m.lacing)for(var S=0;S<_-1;S++){var T=0;do{T+=f[v],v++}while(255===f[v-1]);g.push(T)}if(3===m.lacing)for(var E=0,w=0;w<_-1;w++){var A=0===w?o(f,v):o(f,v,!0,!0);E+=A.value,g.push(E),v+=A.length}return g.forEach((function(e){m.frames.push(f.subarray(v,v+e)),v+=e})),m};i.decodeBlock=d;var c=function(e){e=(0,n.toUint8)(e);var t=[],i=h(e,[a.Segment,a.Tracks,a.Track]);return i.length||(i=h(e,[a.Tracks,a.Track])),i.length||(i=h(e,[a.Track])),i.length?(i.forEach((function(e){var i=h(e,a.TrackType)[0];if(i&&i.length){if(1===i[0])i="video";else if(2===i[0])i="audio";else{if(17!==i[0])return;i="subtitle"}var s={rawCodec:(0,n.bytesToString)(h(e,[a.CodecID])[0]),type:i,codecPrivate:h(e,[a.CodecPrivate])[0],number:(0,n.bytesToNumber)(h(e,[a.TrackNumber])[0]),defaultDuration:(0,n.bytesToNumber)(h(e,[a.DefaultDuration])[0]),default:h(e,[a.FlagDefault])[0],rawData:e},o="";if(/V_MPEG4\/ISO\/AVC/.test(s.rawCodec))o="avc1."+(0,r.getAvcCodec)(s.codecPrivate);else if(/V_MPEGH\/ISO\/HEVC/.test(s.rawCodec))o="hev1."+(0,r.getHvcCodec)(s.codecPrivate);else if(/V_MPEG4\/ISO\/ASP/.test(s.rawCodec))o=s.codecPrivate?"mp4v.20."+s.codecPrivate[4].toString():"mp4v.20.9";else if(/^V_THEORA/.test(s.rawCodec))o="theora";else if(/^V_VP8/.test(s.rawCodec))o="vp8";else if(/^V_VP9/.test(s.rawCodec))if(s.codecPrivate){var u=function(e){for(var t=0,i={};t<e.length;){var n=127&e[t],r=e[t+1],a=void 0;a=1===r?e[t+2]:e.subarray(t+2,t+2+r),1===n?i.profile=a:2===n?i.level=a:3===n?i.bitDepth=a:4===n?i.chromaSubsampling=a:i[n]=a,t+=2+r}return i}(s.codecPrivate),l=u.profile,d=u.level,c=u.bitDepth,f=u.chromaSubsampling;o="vp09.",o+=(0,n.padStart)(l,2,"0")+".",o+=(0,n.padStart)(d,2,"0")+".",o+=(0,n.padStart)(c,2,"0")+".",o+=""+(0,n.padStart)(f,2,"0");var p=h(e,[224,[85,176],[85,177]])[0]||[],m=h(e,[224,[85,176],[85,185]])[0]||[],_=h(e,[224,[85,176],[85,186]])[0]||[],g=h(e,[224,[85,176],[85,187]])[0]||[];(p.length||m.length||_.length||g.length)&&(o+="."+(0,n.padStart)(g[0],2,"0"),o+="."+(0,n.padStart)(_[0],2,"0"),o+="."+(0,n.padStart)(p[0],2,"0"),o+="."+(0,n.padStart)(m[0],2,"0"))}else o="vp9";else/^V_AV1/.test(s.rawCodec)?o="av01."+(0,r.getAv1Codec)(s.codecPrivate):/A_ALAC/.test(s.rawCodec)?o="alac":/A_MPEG\/L2/.test(s.rawCodec)?o="mp2":/A_MPEG\/L3/.test(s.rawCodec)?o="mp3":/^A_AAC/.test(s.rawCodec)?o=s.codecPrivate?"mp4a.40."+(s.codecPrivate[0]>>>3).toString():"mp4a.40.2":/^A_AC3/.test(s.rawCodec)?o="ac-3":/^A_PCM/.test(s.rawCodec)?o="pcm":/^A_MS\/ACM/.test(s.rawCodec)?o="speex":/^A_EAC3/.test(s.rawCodec)?o="ec-3":/^A_VORBIS/.test(s.rawCodec)?o="vorbis":/^A_FLAC/.test(s.rawCodec)?o="flac":/^A_OPUS/.test(s.rawCodec)&&(o="opus");s.codec=o,t.push(s)}})),t.sort((function(e,t){return e.number-t.number}))):t};i.parseTracks=c;i.parseData=function(e,t){var i=[],r=h(e,[a.Segment])[0],s=h(r,[a.SegmentInfo,a.TimestampScale])[0];s=s&&s.length?(0,n.bytesToNumber)(s):1e6;var o=h(r,[a.Cluster]);return t||(t=c(r)),o.forEach((function(e,t){var r=h(e,[a.SimpleBlock]).map((function(e){return{type:"simple",data:e}})),o=h(e,[a.BlockGroup]).map((function(e){return{type:"group",data:e}})),u=h(e,[a.Timestamp])[0]||0;u&&u.length&&(u=(0,n.bytesToNumber)(u)),r.concat(o).sort((function(e,t){return e.data.byteOffset-t.data.byteOffset})).forEach((function(e,t){var n=d(e.data,e.type,s,u);i.push(n)}))})),{tracks:t,blocks:i}}},{"./byte-helpers":9,"./codec-helpers.js":10}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.getId3Offset=i.getId3Size=void 0;var n=e("./byte-helpers.js"),r=(0,n.toUint8)([73,68,51]),a=function(e,t){void 0===t&&(t=0);var i=(e=(0,n.toUint8)(e))[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?r+20:r+10};i.getId3Size=a;i.getId3Offset=function e(t,i){return void 0===i&&(i=0),(t=(0,n.toUint8)(t)).length-i<10||!(0,n.bytesMatch)(t,r,{offset:i})?i:e(t,i+=a(t,i))}},{"./byte-helpers.js":9}],16:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.simpleTypeFromSourceType=void 0;var n=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,r=/^application\/dash\+xml/i;i.simpleTypeFromSourceType=function(e){return n.test(e)?"hls":r.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}},{}],17:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.parseMediaInfo=i.parseTracks=i.addSampleDescription=i.buildFrameTable=i.findNamedBox=i.findBox=i.parseDescriptors=void 0;var n,r=e("./byte-helpers.js"),a=e("./codec-helpers.js"),s=e("./opus-helpers.js"),o=function(e){return"string"==typeof e?(0,r.stringToBytes)(e):e},u=function(e){e=(0,r.toUint8)(e);for(var t=[],i=0;e.length>i;){var a=e[i],s=0,o=0,u=e[++o];for(o++;128&u;)s=(127&u)<<7,u=e[o],o++;s+=127&u;for(var l=0;l<n.length;l++){var h=n[l],d=h.id,c=h.parser;if(a===d){t.push(c(e.subarray(o,o+s)));break}}i+=s+o}return t};i.parseDescriptors=u,n=[{id:3,parser:function(e){var t={tag:3,id:e[0]<<8|e[1],flags:e[2],size:3,dependsOnEsId:0,ocrEsId:0,descriptors:[],url:""};if(128&t.flags&&(t.dependsOnEsId=e[t.size]<<8|e[t.size+1],t.size+=2),64&t.flags){var i=e[t.size];t.url=(0,r.bytesToString)(e.subarray(t.size+1,t.size+1+i)),t.size+=i}return 32&t.flags&&(t.ocrEsId=e[t.size]<<8|e[t.size+1],t.size+=2),t.descriptors=u(e.subarray(t.size))||[],t}},{id:4,parser:function(e){return{tag:4,oti:e[0],streamType:e[1],bufferSize:e[2]<<16|e[3]<<8|e[4],maxBitrate:e[5]<<24|e[6]<<16|e[7]<<8|e[8],avgBitrate:e[9]<<24|e[10]<<16|e[11]<<8|e[12],descriptors:u(e.subarray(13))}}},{id:5,parser:function(e){return{tag:5,bytes:e}}},{id:6,parser:function(e){return{tag:6,bytes:e}}}];var l=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return o(e)})):[o(e)]}(i),t=(0,r.toUint8)(t);var a=[];if(!i.length)return a;for(var s=0;s<t.length;){var u=(t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3])>>>0,l=t.subarray(s+4,s+8);if(0===u)break;var h=s+u;if(h>t.length){if(n)break;h=t.length}var d=t.subarray(s+8,h);(0,r.bytesMatch)(l,i[0])&&(1===i.length?a.push(d):a.push.apply(a,e(d,i.slice(1),n))),s=h}return a};i.findBox=l;var h=function(e,t){if(!(t=o(t)).length)return e.subarray(e.length);for(var i=0;i<e.length;){if((0,r.bytesMatch)(e.subarray(i,i+t.length),t)){var n=(e[i-4]<<24|e[i-3]<<16|e[i-2]<<8|e[i-1])>>>0,a=n>1?i+n:e.byteLength;return e.subarray(i+4,a)}i++}return e.subarray(e.length)};i.findNamedBox=h;var d=function(e,t,i){void 0===t&&(t=4),void 0===i&&(i=function(e){return(0,r.bytesToNumber)(e)});var n=[];if(!e||!e.length)return n;for(var a=(0,r.bytesToNumber)(e.subarray(4,8)),s=8;a;s+=t,a--)n.push(i(e.subarray(s,s+t)));return n},c=function(e,t){for(var i=d(l(e,["stss"])[0]),n=d(l(e,["stco"])[0]),a=d(l(e,["stts"])[0],8,(function(e){return{sampleCount:(0,r.bytesToNumber)(e.subarray(0,4)),sampleDelta:(0,r.bytesToNumber)(e.subarray(4,8))}})),s=d(l(e,["stsc"])[0],12,(function(e){return{firstChunk:(0,r.bytesToNumber)(e.subarray(0,4)),samplesPerChunk:(0,r.bytesToNumber)(e.subarray(4,8)),sampleDescriptionIndex:(0,r.bytesToNumber)(e.subarray(8,12))}})),o=l(e,["stsz"])[0],u=d(o&&o.length&&o.subarray(4)||null),h=[],c=0;c<n.length;c++){for(var f=void 0,p=0;p<s.length;p++){var m=s[p];if(c+1>=m.firstChunk&&(p+1>=s.length||c+1<s[p+1].firstChunk)){f=m.samplesPerChunk;break}}for(var _=n[c],g=0;g<f;g++){var v=u[h.length],y=!i.length;i.length&&-1!==i.indexOf(h.length+1)&&(y=!0);for(var b={keyframe:y,start:_,end:_+v},S=0;S<a.length;S++){var T=a[S],E=T.sampleCount,w=T.sampleDelta;if(h.length<=E){var A=h.length?h[h.length-1].timestamp:0;b.timestamp=A+w/t*1e3,b.duration=w;break}}h.push(b),_+=v}}return h};i.buildFrameTable=c;var f=function(e,t){var i=(0,r.bytesToString)(t.subarray(0,4));if("video"===e.type?(e.info=e.info||{},e.info.width=t[28]<<8|t[29],e.info.height=t[30]<<8|t[31]):"audio"===e.type&&(e.info=e.info||{},e.info.channels=t[20]<<8|t[21],e.info.bitDepth=t[22]<<8|t[23],e.info.sampleRate=t[28]<<8|t[29]),"avc1"===i){var n=h(t,"avcC");i+="."+(0,a.getAvcCodec)(n),e.info.avcC=n}else if("hvc1"===i||"hev1"===i)i+="."+(0,a.getHvcCodec)(h(t,"hvcC"));else if("mp4a"===i||"mp4v"===i){var o=h(t,"esds"),l=u(o.subarray(4))[0],d=l&&l.descriptors.filter((function(e){return 4===e.tag}))[0];d?(i+="."+(0,r.toHexString)(d.oti),64===d.oti?i+="."+(d.descriptors[0].bytes[0]>>3).toString():32===d.oti?i+="."+d.descriptors[0].bytes[4].toString():221===d.oti&&(i="vorbis")):"audio"===e.type?i+=".40.2":i+=".20.9"}else if("av01"===i)i+="."+(0,a.getAv1Codec)(h(t,"av1C"));else if("vp09"===i){var c=h(t,"vpcC"),f=c[0],p=c[1],m=c[2]>>4,_=(15&c[2])>>1,g=(15&c[2])>>3,v=c[3],y=c[4],b=c[5];i+="."+(0,r.padStart)(f,2,"0"),i+="."+(0,r.padStart)(p,2,"0"),i+="."+(0,r.padStart)(m,2,"0"),i+="."+(0,r.padStart)(_,2,"0"),i+="."+(0,r.padStart)(v,2,"0"),i+="."+(0,r.padStart)(y,2,"0"),i+="."+(0,r.padStart)(b,2,"0"),i+="."+(0,r.padStart)(g,2,"0")}else if("theo"===i)i="theora";else if("spex"===i)i="speex";else if(".mp3"===i)i="mp4a.40.34";else if("msVo"===i)i="vorbis";else if("Opus"===i){i="opus";var S=h(t,"dOps");e.info.opus=(0,s.parseOpusHead)(S),e.info.codecDelay=65e5}else i=i.toLowerCase();e.codec=i};i.addSampleDescription=f;i.parseTracks=function(e,t){void 0===t&&(t=!0),e=(0,r.toUint8)(e);var i=l(e,["moov","trak"],!0),n=[];return i.forEach((function(e){var i={bytes:e},a=l(e,["mdia"])[0],s=l(a,["hdlr"])[0],o=(0,r.bytesToString)(s.subarray(8,12));i.type="soun"===o?"audio":"vide"===o?"video":o;var u=l(e,["tkhd"])[0];if(u){var h=new DataView(u.buffer,u.byteOffset,u.byteLength),d=h.getUint8(0);i.number=0===d?h.getUint32(12):h.getUint32(20)}var p=l(a,["mdhd"])[0];if(p){var m=0===p[0]?12:20;i.timescale=(p[m]<<24|p[m+1]<<16|p[m+2]<<8|p[m+3])>>>0}for(var _=l(a,["minf","stbl"])[0],g=l(_,["stsd"])[0],v=(0,r.bytesToNumber)(g.subarray(4,8)),y=8;v--;){var b=(0,r.bytesToNumber)(g.subarray(y,y+4)),S=g.subarray(y+4,y+4+b);f(i,S),y+=4+b}t&&(i.frameTable=c(_,i.timescale)),n.push(i)})),n};i.parseMediaInfo=function(e){var t=l(e,["moov","mvhd"],!0)[0];if(t&&t.length){var i={};return 1===t[0]?(i.timestampScale=(0,r.bytesToNumber)(t.subarray(20,24)),i.duration=(0,r.bytesToNumber)(t.subarray(24,32))):(i.timestampScale=(0,r.bytesToNumber)(t.subarray(12,16)),i.duration=(0,r.bytesToNumber)(t.subarray(16,20))),i.bytes=t,i}}},{"./byte-helpers.js":9,"./codec-helpers.js":10,"./opus-helpers.js":19}],18:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.findH265Nal=i.findH264Nal=i.findNal=i.discardEmulationPreventionBytes=i.EMULATION_PREVENTION=i.NAL_TYPE_TWO=i.NAL_TYPE_ONE=void 0;var n=e("./byte-helpers.js"),r=(0,n.toUint8)([0,0,0,1]);i.NAL_TYPE_ONE=r;var a=(0,n.toUint8)([0,0,1]);i.NAL_TYPE_TWO=a;var s=(0,n.toUint8)([0,0,3]);i.EMULATION_PREVENTION=s;var o=function(e){for(var t=[],i=1;i<e.length-2;)(0,n.bytesMatch)(e.subarray(i,i+3),s)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var r=e.length-t.length,a=new Uint8Array(r),o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),a[i]=e[o];return a};i.discardEmulationPreventionBytes=o;var u=function(e,t,i,s){void 0===s&&(s=1/0),e=(0,n.toUint8)(e),i=[].concat(i);for(var u,l=0,h=0;l<e.length&&(h<s||u);){var d=void 0;if((0,n.bytesMatch)(e.subarray(l),r)?d=4:(0,n.bytesMatch)(e.subarray(l),a)&&(d=3),d){if(h++,u)return o(e.subarray(u,l));var c=void 0;"h264"===t?c=31&e[l+d]:"h265"===t&&(c=e[l+d]>>1&63),-1!==i.indexOf(c)&&(u=l+d),l+=d+("h264"===t?1:2)}else l++}return e.subarray(0,0)};i.findNal=u;i.findH264Nal=function(e,t,i){return u(e,"h264",t,i)};i.findH265Nal=function(e,t,i){return u(e,"h265",t,i)}},{"./byte-helpers.js":9}],19:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.setOpusHead=i.parseOpusHead=i.OPUS_HEAD=void 0;var n=new Uint8Array([79,112,117,115,72,101,97,100]);i.OPUS_HEAD=n;i.parseOpusHead=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getUint8(0),n=0!==i,r={version:i,channels:t.getUint8(1),preSkip:t.getUint16(2,n),sampleRate:t.getUint32(4,n),outputGain:t.getUint16(8,n),channelMappingFamily:t.getUint8(10)};if(r.channelMappingFamily>0&&e.length>10){r.streamCount=t.getUint8(11),r.twoChannelStreamCount=t.getUint8(12),r.channelMapping=[];for(var a=0;a<r.channels;a++)r.channelMapping.push(t.getUint8(13+a))}return r};i.setOpusHead=function(e){var t=e.channelMappingFamily<=0?11:12+e.channels,i=new DataView(new ArrayBuffer(t)),n=0!==e.version;return i.setUint8(0,e.version),i.setUint8(1,e.channels),i.setUint16(2,e.preSkip,n),i.setUint32(4,e.sampleRate,n),i.setUint16(8,e.outputGain,n),i.setUint8(10,e.channelMappingFamily),e.channelMappingFamily>0&&(i.setUint8(11,e.streamCount),e.channelMapping.foreach((function(e,t){i.setUint8(12+t,e)}))),new Uint8Array(i.buffer)}},{}],20:[function(e,t,i){"use strict";var n=e("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var r=n(e("url-toolkit")),a=n(e("global/window")),s=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=a.default.location&&a.default.location.href||"");var i="function"==typeof a.default.URL,n=/^\/\//.test(e),s=!a.default.location&&!/\/\//i.test(e);if(i?e=new a.default.URL(e,a.default.location||"http://example.com"):/\/\//i.test(e)||(e=r.default.buildAbsoluteURL(a.default.location&&a.default.location.href||"",e)),i){var o=new URL(t,e);return s?o.href.slice("http://example.com".length):n?o.href.slice(o.protocol.length):o.href}return r.default.buildAbsoluteURL(e,t)};i.default=s,t.exports=i.default},{"@babel/runtime/helpers/interopRequireDefault":6,"global/window":34,"url-toolkit":46}],21:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var n=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();i.default=n,t.exports=i.default},{}],22:[function(e,t,i){"use strict";var n=e("global/window");t.exports=function(e,t){return void 0===t&&(t=!1),function(i,r,a){if(i)e(i);else if(r.statusCode>=400&&r.statusCode<=599){var s=a;if(t)if(n.TextDecoder){var o=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),n=i[0],r=i[1];return"charset"===n.trim()?r.trim():e}),"utf-8")}(r.headers&&r.headers["content-type"]);try{s=new TextDecoder(o).decode(a)}catch(e){}}else s=String.fromCharCode.apply(null,new Uint8Array(a));e({cause:s})}else e(null,a)}}},{"global/window":34}],23:[function(e,t,i){"use strict";var n=e("global/window"),r=e("@babel/runtime/helpers/extends"),a=e("is-function");o.httpHandler=e("./http-handler.js");function s(e,t,i){var n=e;return a(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=r({},t,{uri:e}),n.callback=i,n}function o(e,t,i){return u(t=s(e,t,i))}function u(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=l.response?l.response:l.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(l),_)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(h),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function a(){if(!u){var t;clearTimeout(h),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var r=g,a=null;return 0!==t?(r={body:n(),statusCode:t,method:c,headers:{},url:d,rawRequest:l},l.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(l.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),i(a,r,r.body)}}var s,u,l=e.xhr||null;l||(l=e.cors||e.useXDR?new o.XDomainRequest:new o.XMLHttpRequest);var h,d=l.url=e.uri||e.url,c=l.method=e.method||"GET",f=e.body||e.data,p=l.headers=e.headers||{},m=!!e.sync,_=!1,g={body:void 0,headers:{},statusCode:0,method:c,url:d,rawRequest:l};if("json"in e&&!1!==e.json&&(_=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),f=JSON.stringify(!0===e.json?f:e.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(a,0)},l.onload=a,l.onerror=r,l.onprogress=function(){},l.onabort=function(){u=!0},l.ontimeout=r,l.open(c,d,!m,e.username,e.password),m||(l.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(h=setTimeout((function(){if(!u){u=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),l.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&l.setRequestHeader(s,p[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(f||null),l}t.exports=o,t.exports.default=o,o.XMLHttpRequest=n.XMLHttpRequest||function(){},o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:n.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){o["delete"===e?"del":e]=function(t,i,n){return(i=s(t,i,n)).method=e.toUpperCase(),u(i)}}))},{"./http-handler.js":22,"@babel/runtime/helpers/extends":3,"global/window":34,"is-function":36}],24:[function(e,t,i){"use strict";function n(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var r=n({HTML:"text/html",isHTML:function(e){return e===r.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=n({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});i.freeze=n,i.MIME_TYPE=r,i.NAMESPACE=a},{}],25:[function(e,t,i){var n=e("./conventions"),r=e("./dom"),a=e("./entities"),s=e("./sax"),o=r.DOMImplementation,u=n.NAMESPACE,l=s.ParseError,h=s.XMLReader;function d(e){this.options=e||{locator:{}}}function c(){this.cdata=!1}function f(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function p(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function m(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function _(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}d.prototype.parseFromString=function(e,t){var i=this.options,n=new h,r=i.domBuilder||new c,s=i.errorHandler,o=i.locator,l=i.xmlns||{},d=/\/x?html?$/.test(t),f=d?a.HTML_ENTITIES:a.XML_ENTITIES;return o&&r.setDocumentLocator(o),n.errorHandler=function(e,t,i){if(!e){if(t instanceof c)return t;e=t}var n={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(i){e(t,i)}:e),n[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+p(i))}||function(){}}return i=i||{},a("warning"),a("error"),a("fatalError"),n}(s,r,o),n.domBuilder=i.domBuilder||r,d&&(l[""]=u.HTML),l.xml=l.xml||u.XML,e&&"string"==typeof e?n.parse(e,l,f):n.errorHandler.error("invalid doc source"),r.doc},c.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;_(this,a),this.currentElement=a,this.locator&&f(this.locator,a);for(var o=0;o<s;o++){e=n.getURI(o);var u=n.getValue(o),l=(i=n.getQName(o),r.createAttributeNS(e,i));this.locator&&f(n.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&f(this.locator,i),_(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=m.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&f(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=m.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&f(this.locator,n),_(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(e,t,i);this.locator&&f(this.locator,r),_(this,r),this.doc.doctype=r}},warning:function(e){p(this.locator)},error:function(e){console.error("[xmldom error]\t"+e,p(this.locator))},fatalError:function(e){throw new l(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){c.prototype[e]=function(){return null}})),i.__DOMHandler=c,i.DOMParser=d,i.DOMImplementation=r.DOMImplementation,i.XMLSerializer=r.XMLSerializer},{"./conventions":24,"./dom":26,"./entities":27,"./sax":29}],26:[function(e,t,i){var n=e("./conventions").NAMESPACE;function r(e){return""!==e}function a(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function s(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(r):[]}(e);return Object.keys(t.reduce(a,{}))}function o(e,t){for(var i in e)t[i]=e[i]}function u(e,t){var i=e.prototype;if(!(i instanceof t)){function n(){}n.prototype=t.prototype,o(i,n=new n),e.prototype=i=n}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var l={},h=l.ELEMENT_NODE=1,d=l.ATTRIBUTE_NODE=2,c=l.TEXT_NODE=3,f=l.CDATA_SECTION_NODE=4,p=l.ENTITY_REFERENCE_NODE=5,m=l.ENTITY_NODE=6,_=l.PROCESSING_INSTRUCTION_NODE=7,g=l.COMMENT_NODE=8,v=l.DOCUMENT_NODE=9,y=l.DOCUMENT_TYPE_NODE=10,b=l.DOCUMENT_FRAGMENT_NODE=11,S=l.NOTATION_NODE=12,T={},E={},w=(T.INDEX_SIZE_ERR=(E[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2),T.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3)),A=(T.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7),T.NOT_FOUND_ERR=(E[8]="Not found",8)),C=(T.NOT_SUPPORTED_ERR=(E[9]="Not supported",9),T.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10));T.INVALID_STATE_ERR=(E[11]="Invalid state",11),T.SYNTAX_ERR=(E[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13),T.NAMESPACE_ERR=(E[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function k(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,E[e]),this.message=E[e],Error.captureStackTrace&&Error.captureStackTrace(this,k);return i.code=e,t&&(this.message=this.message+": "+t),i}function P(){}function I(e,t){this._node=e,this._refresh=t,L(this)}function L(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var i=e._refresh(e._node);oe(e,"length",i.length),o(i,e),e._inc=t}}function x(){}function R(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function D(e,t,i,r){if(r?t[R(t,r)]=i:t[t.length++]=i,e){i.ownerElement=e;var a=e.ownerDocument;a&&(r&&j(a,e,r),function(e,t,i){e&&e._inc++,i.namespaceURI===n.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(a,e,i))}}function O(e,t,i){var n=R(t,i);if(!(n>=0))throw k(A,new Error(e.tagName+"@"+i));for(var r=t.length-1;n<r;)t[n]=t[++n];if(t.length=r,e){var a=e.ownerDocument;a&&(j(a,e,i),i.ownerElement=null)}}function U(){}function M(){}function F(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function B(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(B(e,t))return!0}while(e=e.nextSibling)}function N(){}function j(e,t,i,r){e&&e._inc++,i.namespaceURI===n.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function V(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)n[a++]=r,r=r.nextSibling;n.length=a}}}function H(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,V(e.ownerDocument,e),t}function z(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===b){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;var s=i?i.previousSibling:e.lastChild;r.previousSibling=s,a.nextSibling=i,s?s.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;do{r.parentNode=e}while(r!==a&&(r=r.nextSibling));return V(e.ownerDocument||e,e),t.nodeType==b&&(t.firstChild=t.lastChild=null),t}function G(){this._nsMap={}}function W(){}function Y(){}function q(){}function K(){}function X(){}function Q(){}function $(){}function J(){}function Z(){}function ee(){}function te(){}function ie(){}function ne(e,t){var i=[],n=9==this.nodeType&&this.documentElement||this,r=n.prefix,a=n.namespaceURI;if(a&&null==r&&null==(r=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return se(this,i,e,t,s),i.join("")}function re(e,t,i){var r=e.prefix||"",a=e.namespaceURI;if(!a)return!1;if("xml"===r&&a===n.XML||a===n.XMLNS)return!1;for(var s=i.length;s--;){var o=i[s];if(o.prefix===r)return o.namespace!==a}return!0}function ae(e,t,i){e.push(" ",t,'="',i.replace(/[<&"]/g,F),'"')}function se(e,t,i,r,a){if(a||(a=[]),r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var s=e.attributes,o=s.length,u=e.firstChild,l=e.tagName,m=l;if(!(i=n.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var S,T=0;T<s.length;T++)if("xmlns"===s.item(T).name){S=s.item(T).value;break}if(!S)for(var E=a.length-1;E>=0;E--){if(""===(w=a[E]).prefix&&w.namespace===e.namespaceURI){S=w.namespace;break}}if(S!==e.namespaceURI)for(E=a.length-1;E>=0;E--){var w;if((w=a[E]).namespace===e.namespaceURI){w.prefix&&(m=w.prefix+":"+l);break}}}t.push("<",m);for(var A=0;A<o;A++){"xmlns"==(C=s.item(A)).prefix?a.push({prefix:C.localName,namespace:C.value}):"xmlns"==C.nodeName&&a.push({prefix:"",namespace:C.value})}for(A=0;A<o;A++){var C,k,P;if(re(C=s.item(A),0,a))ae(t,(k=C.prefix||"")?"xmlns:"+k:"xmlns",P=C.namespaceURI),a.push({prefix:k,namespace:P});se(C,t,i,r,a)}if(l===m&&re(e,0,a))ae(t,(k=e.prefix||"")?"xmlns:"+k:"xmlns",P=e.namespaceURI),a.push({prefix:k,namespace:P});if(u||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),i&&/^script$/i.test(l))for(;u;)u.data?t.push(u.data):se(u,t,i,r,a.slice()),u=u.nextSibling;else for(;u;)se(u,t,i,r,a.slice()),u=u.nextSibling;t.push("</",m,">")}else t.push("/>");return;case v:case b:for(u=e.firstChild;u;)se(u,t,i,r,a.slice()),u=u.nextSibling;return;case d:return ae(t,e.name,e.value);case c:return t.push(e.data.replace(/[<&]/g,F).replace(/]]>/g,"]]&gt;"));case f:return t.push("<![CDATA[",e.data,"]]>");case g:return t.push("\x3c!--",e.data,"--\x3e");case y:var I=e.publicId,L=e.systemId;if(t.push("<!DOCTYPE ",e.name),I)t.push(" PUBLIC ",I),L&&"."!=L&&t.push(" ",L),t.push(">");else if(L&&"."!=L)t.push(" SYSTEM ",L,">");else{var x=e.internalSubset;x&&t.push(" [",x,"]"),t.push(">")}return;case _:return t.push("<?",e.target," ",e.data,"?>");case p:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function oe(e,t,i){e[t]=i}k.prototype=Error.prototype,o(T,k),P.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)se(this[n],i,e,t);return i.join("")}},I.prototype.item=function(e){return L(this),this[e]},u(I,P),x.prototype={length:0,item:P.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new k(C);var i=this.getNamedItem(e.nodeName);return D(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new k(C);return t=this.getNamedItemNS(e.namespaceURI,e.localName),D(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return O(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return O(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},U.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new N;if(n.implementation=this,n.childNodes=new P,n.doctype=i||null,i&&n.appendChild(i),t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,i){var n=new Q;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},M.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return z(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return H(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,n){var r=new i.constructor;for(var a in i){var s=i[a];"object"!=typeof s&&s!=r[a]&&(r[a]=s)}i.childNodes&&(r.childNodes=new P);switch(r.ownerDocument=t,r.nodeType){case h:var o=i.attributes,u=r.attributes=new x,l=o.length;u._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(e(t,o.item(c),!0));break;case d:n=!0}if(n)for(var f=i.firstChild;f;)r.appendChild(e(t,f,n)),f=f.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==c&&e.nodeType==c?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(i[n]==e)return n;t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i)return i[e];t=t.nodeType==d?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},o(l,M),o(l,M.prototype),N.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==b){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return null==this.documentElement&&e.nodeType==h&&(this.documentElement=e),z(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),H(this,e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case h:(r=i.cloneNode(!1)).ownerDocument=t;case b:break;case d:n=!0}r||(r=i.cloneNode(!1));if(r.ownerDocument=t,r.parentNode=null,n)for(var a=i.firstChild;a;)r.appendChild(e(t,a,n)),a=a.nextSibling;return r}(this,e,t)},getElementById:function(e){var t=null;return B(this.documentElement,(function(i){if(i.nodeType==h&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=s(e);return new I(this,(function(i){var n=[];return t.length>0&&B(i.documentElement,(function(r){if(r!==i&&r.nodeType===h){var a=r.getAttribute("class");if(a){var o=e===a;if(!o){var u=s(a);o=t.every((l=u,function(e){return l&&-1!==l.indexOf(e)}))}o&&n.push(r)}}var l})),n}))},createElement:function(e){var t=new G;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new P,(t.attributes=new x)._ownerElement=t,t},createDocumentFragment:function(){var e=new ee;return e.ownerDocument=this,e.childNodes=new P,e},createTextNode:function(e){var t=new q;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new K;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new te;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new W;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new G,n=t.split(":"),r=i.attributes=new x;return i.childNodes=new P,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new W,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},u(N,M),G.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===b?this.insertBefore(e,null):function(e,t){var i=t.parentNode;if(i){var n=e.lastChild;i.removeChild(t);n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,V(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new I(this,(function(t){var i=[];return B(t,(function(n){n===t||n.nodeType!=h||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new I(this,(function(i){var n=[];return B(i,(function(r){r===i||r.nodeType!==h||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},N.prototype.getElementsByTagName=G.prototype.getElementsByTagName,N.prototype.getElementsByTagNameNS=G.prototype.getElementsByTagNameNS,u(G,M),W.prototype.nodeType=d,u(W,M),Y.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(E[w])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},u(Y,M),q.prototype={nodeName:"#text",nodeType:c,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},u(q,Y),K.prototype={nodeName:"#comment",nodeType:g},u(K,Y),X.prototype={nodeName:"#cdata-section",nodeType:f},u(X,Y),Q.prototype.nodeType=y,u(Q,M),$.prototype.nodeType=S,u($,M),J.prototype.nodeType=m,u(J,M),Z.prototype.nodeType=p,u(Z,M),ee.prototype.nodeName="#document-fragment",ee.prototype.nodeType=b,u(ee,M),te.prototype.nodeType=_,u(te,M),ie.prototype.serializeToString=function(e,t,i){return ne.call(e,t,i)},M.prototype.toString=ne;try{if(Object.defineProperty){Object.defineProperty(I.prototype,"length",{get:function(){return L(this),this.$$length}}),Object.defineProperty(M.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case h:case b:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case h:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),oe=function(e,t,i){e["$$"+t]=i}}}catch(e){}i.DocumentType=Q,i.DOMException=k,i.DOMImplementation=U,i.Element=G,i.Node=M,i.NodeList=P,i.XMLSerializer=ie},{"./conventions":24}],27:[function(e,t,i){var n=e("./conventions").freeze;i.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),i.entityMap=i.HTML_ENTITIES},{"./conventions":24}],28:[function(e,t,i){var n=e("./dom");i.DOMImplementation=n.DOMImplementation,i.XMLSerializer=n.XMLSerializer,i.DOMParser=e("./dom-parser").DOMParser},{"./dom":26,"./dom-parser":25}],29:[function(e,t,i){var n=e("./conventions").NAMESPACE,r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,a=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),s=new RegExp("^"+r.source+a.source+"*(?::"+r.source+a.source+"*)?$");function o(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function u(){}function l(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function h(e,t,i,r,a,s){function o(e,t,n){i.attributeNames.hasOwnProperty(e)&&s.fatalError("Attribute "+e+" redefined"),i.addValue(e,t,n)}for(var u,l=++t,h=0;;){var d=e.charAt(l);switch(d){case"=":if(1===h)u=e.slice(t,l),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(s.warning('attribute value must after "="'),u=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");o(u,c=e.slice(t,l).replace(/&#?\w+;/g,a),t-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');o(u,c=e.slice(t,l).replace(/&#?\w+;/g,a),t),s.warning('attribute "'+u+'" missed start quot('+d+")!!"),t=l+1,h=5}break;case"/":switch(h){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:h=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==h&&i.setTagName(e.slice(t,l)),l;case">":switch(h){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(c=e.slice(t,l)).slice(-1)&&(i.closed=!0,c=c.slice(0,-1));case 2:2===h&&(c=u),4==h?(s.warning('attribute "'+c+'" missed quot(")!'),o(u,c.replace(/&#?\w+;/g,a),t)):(n.isHTML(r[""])&&c.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(h){case 0:i.setTagName(e.slice(t,l)),h=6;break;case 1:u=e.slice(t,l),h=2;break;case 4:var c=e.slice(t,l).replace(/&#?\w+;/g,a);s.warning('attribute "'+c+'" missed quot(")!!'),o(u,c,t);case 5:h=6}else switch(h){case 2:i.tagName;n.isHTML(r[""])&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),o(u,u,t),t=l,h=1;break;case 5:s.warning('attribute space is required"'+u+'"!!');case 6:h=1,t=l;break;case 3:h=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function d(e,t,i){for(var r=e.tagName,a=null,s=e.length;s--;){var o=e[s],u=o.qName,l=o.value;if((f=u.indexOf(":"))>0)var h=o.prefix=u.slice(0,f),d=u.slice(f+1),c="xmlns"===h&&d;else d=u,h=null,c="xmlns"===u&&"";o.localName=d,!1!==c&&(null==a&&(a={},p(i,i={})),i[c]=a[c]=l,o.uri=n.XMLNS,t.startPrefixMapping(c,l))}for(s=e.length;s--;){(h=(o=e[s]).prefix)&&("xml"===h&&(o.uri=n.XML),"xmlns"!==h&&(o.uri=i[h||""]))}var f;(f=r.indexOf(":"))>0?(h=e.prefix=r.slice(0,f),d=e.localName=r.slice(f+1)):(h=null,d=e.localName=r);var m=e.uri=i[h||""];if(t.startElement(m,d,r,e),!e.closed)return e.currentNSMap=i,e.localNSMap=a,!0;if(t.endElement(m,d,r),a)for(h in a)t.endPrefixMapping(h)}function c(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("</"+i+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(i)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,n),r.characters(s,0,s.length),a)}return t+1}function f(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}function p(e,t){for(var i in e)t[i]=e[i]}function m(e,t,i,n){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var h=a[s-1];return i.startDTD(o,u,l),i.endDTD(),h.index+h[0].length}}return-1}function _(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(r){r[0].length;return i.processingInstruction(r[1],r[2]),n+2}return-1}return-1}function g(){this.attributeNames={}}o.prototype=new Error,o.prototype.name=o.name,u.prototype={parse:function(e,t,i){var r=this.domBuilder;r.startDocument(),p(t,t={}),function(e,t,i,r,a){function s(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(a.error("entity not found:"+e),e)}function u(t){if(t>w){var i=e.substring(w,t).replace(/&#?\w+;/g,s);S&&p(w),r.characters(i,0,t-w),w=t}}function p(t,i){for(;t>=y&&(i=b.exec(e));)v=i.index,y=v+i[0].length,S.lineNumber++;S.columnNumber=t-v+1}var v=0,y=0,b=/.*(?:\r\n?|\n)|.*$/g,S=r.locator,T=[{currentNSMap:t}],E={},w=0;for(;;){try{var A=e.indexOf("<",w);if(A<0){if(!e.substr(w).match(/^\s*$/)){var C=r.doc,k=C.createTextNode(e.substr(w));C.appendChild(k),r.currentElement=k}return}switch(A>w&&u(A),e.charAt(A+1)){case"/":var P=e.indexOf(">",A+3),I=e.substring(A+2,P).replace(/[ \t\n\r]+$/g,""),L=T.pop();P<0?(I=e.substring(A+2).replace(/[\s<].*/,""),a.error("end tag name: "+I+" is not complete:"+L.tagName),P=A+1+I.length):I.match(/\s</)&&(I=I.replace(/[\s<].*/,""),a.error("end tag name: "+I+" maybe not complete"),P=A+1+I.length);var x=L.localNSMap,R=L.tagName==I;if(R||L.tagName&&L.tagName.toLowerCase()==I.toLowerCase()){if(r.endElement(L.uri,L.localName,I),x)for(var D in x)r.endPrefixMapping(D);R||a.fatalError("end tag name: "+I+" is not match the current start tagName:"+L.tagName)}else T.push(L);P++;break;case"?":S&&p(A),P=_(e,A,r);break;case"!":S&&p(A),P=m(e,A,r,a);break;default:S&&p(A);var O=new g,U=T[T.length-1].currentNSMap,M=(P=h(e,A,O,U,s,a),O.length);if(!O.closed&&f(e,P,O.tagName,E)&&(O.closed=!0,i.nbsp||a.warning("unclosed xml attribute")),S&&M){for(var F=l(S,{}),B=0;B<M;B++){var N=O[B];p(N.offset),N.locator=l(S,{})}r.locator=F,d(O,r,U)&&T.push(O),r.locator=S}else d(O,r,U)&&T.push(O);n.isHTML(O.uri)&&!O.closed?P=c(e,P,O.tagName,s,r):P++}}catch(e){if(e instanceof o)throw e;a.error("element parse error: "+e),P=-1}P>w?w=P:u(Math.max(A,w)+1)}}(e,t,i,r,this.errorHandler),r.endDocument()}},g.prototype={setTagName:function(e){if(!s.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!s.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},i.XMLReader=u,i.ParseError=o},{"./conventions":24}],30:[function(e,t,i){"use strict";i.byteLength=function(e){var t=l(e),i=t[0],n=t[1];return 3*(i+n)/4-n},i.toByteArray=function(e){var t,i,n=l(e),s=n[0],o=n[1],u=new a(function(e,t,i){return 3*(t+i)/4-i}(0,s,o)),h=0,d=o>0?s-4:s;for(i=0;i<d;i+=4)t=r[e.charCodeAt(i)]<<18|r[e.charCodeAt(i+1)]<<12|r[e.charCodeAt(i+2)]<<6|r[e.charCodeAt(i+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;2===o&&(t=r[e.charCodeAt(i)]<<2|r[e.charCodeAt(i+1)]>>4,u[h++]=255&t);1===o&&(t=r[e.charCodeAt(i)]<<10|r[e.charCodeAt(i+1)]<<4|r[e.charCodeAt(i+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t);return u},i.fromByteArray=function(e){for(var t,i=e.length,r=i%3,a=[],s=0,o=i-r;s<o;s+=16383)a.push(h(e,s,s+16383>o?o:s+16383));1===r?(t=e[i-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],r=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o<u;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function h(e,t,i){for(var r,a,s=[],o=t;o<i;o+=3)r=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[(a=r)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],31:[function(e,t,i){},{}],32:[function(e,t,i){(function(t){
-/*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
-"use strict";var n=e("base64-js"),r=e("ieee754");i.Buffer=t,i.SlowBuffer=function(e){+e!=e&&(e=0);return t.alloc(+e)},i.INSPECT_MAX_BYTES=50;function a(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=new Uint8Array(e);return i.__proto__=t.prototype,i}function t(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return s(e,t,i)}function s(e,i,n){if("string"==typeof e)return function(e,i){"string"==typeof i&&""!==i||(i="utf8");if(!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i);var n=0|d(e,i),r=a(n),s=r.write(e,i);s!==n&&(r=r.slice(0,s));return r}(e,i);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer))return function(e,i,n){if(i<0||e.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<i+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;r=void 0===i&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,i):new Uint8Array(e,i,n);return r.__proto__=t.prototype,r}(e,i,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return t.from(r,i,n);var s=function(e){if(t.isBuffer(e)){var i=0|h(e.length),n=a(i);return 0===n.length||e.copy(n,0,0,i),n}if(void 0!==e.length)return"number"!=typeof e.length||N(e.length)?a(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return t.from(e[Symbol.toPrimitive]("string"),i,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function o(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return o(e),a(e<0?0:0|h(e))}function l(e){for(var t=e.length<0?0:0|h(e.length),i=a(t),n=0;n<t;n+=1)i[n]=255&e[n];return i}function h(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function d(e,i){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var a=!1;;)switch(i){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return M(e).length;default:if(a)return r?-1:U(e).length;i=(""+i).toLowerCase(),a=!0}}function c(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,i);case"utf8":case"utf-8":return E(this,t,i);case"ascii":return w(this,t,i);case"latin1":case"binary":return A(this,t,i);case"base64":return T(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function f(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function p(e,i,n,r,a){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),N(n=+n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if("string"==typeof i&&(i=t.from(i,r)),t.isBuffer(i))return 0===i.length?-1:m(e,i,n,r,a);if("number"==typeof i)return i&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,i,n):Uint8Array.prototype.lastIndexOf.call(e,i,n):m(e,[i],n,r,a);throw new TypeError("val must be string, number or Buffer")}function m(e,t,i,n,r){var a,s=1,o=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,i/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var h=-1;for(a=i;a<o;a++)if(l(e,a)===l(t,-1===h?0:a-h)){if(-1===h&&(h=a),a-h+1===u)return h*s}else-1!==h&&(a-=a-h),h=-1}else for(i+u>o&&(i=o-u),a=i;a>=0;a--){for(var d=!0,c=0;c<u;c++)if(l(e,a+c)!==l(t,c)){d=!1;break}if(d)return a}return-1}function _(e,t,i,n){i=Number(i)||0;var r=e.length-i;n?(n=Number(n))>r&&(n=r):n=r;var a=t.length;n>a/2&&(n=a/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(N(o))return s;e[i+s]=o}return s}function g(e,t,i,n){return F(U(t,e.length-i),e,i,n)}function v(e,t,i,n){return F(function(e){for(var t=[],i=0;i<e.length;++i)t.push(255&e.charCodeAt(i));return t}(t),e,i,n)}function y(e,t,i,n){return v(e,t,i,n)}function b(e,t,i,n){return F(M(t),e,i,n)}function S(e,t,i,n){return F(function(e,t){for(var i,n,r,a=[],s=0;s<e.length&&!((t-=2)<0);++s)i=e.charCodeAt(s),n=i>>8,r=i%256,a.push(r),a.push(n);return a}(t,e.length-i),e,i,n)}function T(e,t,i){return 0===t&&i===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,i))}function E(e,t,i){i=Math.min(e.length,i);for(var n=[],r=t;r<i;){var a,s,o,u,l=e[r],h=null,d=l>239?4:l>223?3:l>191?2:1;if(r+d<=i)switch(d){case 1:l<128&&(h=l);break;case 2:128==(192&(a=e[r+1]))&&(u=(31&l)<<6|63&a)>127&&(h=u);break;case 3:a=e[r+1],s=e[r+2],128==(192&a)&&128==(192&s)&&(u=(15&l)<<12|(63&a)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:a=e[r+1],s=e[r+2],o=e[r+3],128==(192&a)&&128==(192&s)&&128==(192&o)&&(u=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&o)>65535&&u<1114112&&(h=u)}null===h?(h=65533,d=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),r+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var i="",n=0;for(;n<t;)i+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return i}(n)}i.kMaxLength=2147483647,t.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(e,t,i){return s(e,t,i)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(e,t,i){return function(e,t,i){return o(e),e<=0?a(e):void 0!==t?"string"==typeof i?a(e).fill(t,i):a(e).fill(t):a(e)}(e,t,i)},t.allocUnsafe=function(e){return u(e)},t.allocUnsafeSlow=function(e){return u(e)},t.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==t.prototype},t.compare=function(e,i){if(B(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),B(i,Uint8Array)&&(i=t.from(i,i.offset,i.byteLength)),!t.isBuffer(e)||!t.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;for(var n=e.length,r=i.length,a=0,s=Math.min(n,r);a<s;++a)if(e[a]!==i[a]){n=e[a],r=i[a];break}return n<r?-1:r<n?1:0},t.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,i){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var n;if(void 0===i)for(i=0,n=0;n<e.length;++n)i+=e[n].length;var r=t.allocUnsafe(i),a=0;for(n=0;n<e.length;++n){var s=e[n];if(B(s,Uint8Array)&&(s=t.from(s)),!t.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,a),a+=s.length}return r},t.byteLength=d,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},t.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},t.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},t.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):c.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var e="",t=i.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},t.prototype.compare=function(e,i,n,r,a){if(B(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===i&&(i=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===a&&(a=this.length),i<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&i>=n)return 0;if(r>=a)return-1;if(i>=n)return 1;if(this===e)return 0;for(var s=(a>>>=0)-(r>>>=0),o=(n>>>=0)-(i>>>=0),u=Math.min(s,o),l=this.slice(r,a),h=e.slice(i,n),d=0;d<u;++d)if(l[d]!==h[d]){s=l[d],o=h[d];break}return s<o?-1:o<s?1:0},t.prototype.includes=function(e,t,i){return-1!==this.indexOf(e,t,i)},t.prototype.indexOf=function(e,t,i){return p(this,e,t,i,!0)},t.prototype.lastIndexOf=function(e,t,i){return p(this,e,t,i,!1)},t.prototype.write=function(e,t,i,n){if(void 0===t)n="utf8",i=this.length,t=0;else if(void 0===i&&"string"==typeof t)n=t,i=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}var r=this.length-t;if((void 0===i||i>r)&&(i=r),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return _(this,e,t,i);case"utf8":case"utf-8":return g(this,e,t,i);case"ascii":return v(this,e,t,i);case"latin1":case"binary":return y(this,e,t,i);case"base64":return b(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(e,t,i){var n="";i=Math.min(e.length,i);for(var r=t;r<i;++r)n+=String.fromCharCode(127&e[r]);return n}function A(e,t,i){var n="";i=Math.min(e.length,i);for(var r=t;r<i;++r)n+=String.fromCharCode(e[r]);return n}function C(e,t,i){var n=e.length;(!t||t<0)&&(t=0),(!i||i<0||i>n)&&(i=n);for(var r="",a=t;a<i;++a)r+=O(e[a]);return r}function k(e,t,i){for(var n=e.slice(t,i),r="",a=0;a<n.length;a+=2)r+=String.fromCharCode(n[a]+256*n[a+1]);return r}function P(e,t,i){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}function I(e,i,n,r,a,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>a||i<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function L(e,t,i,n,r,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function x(e,t,i,n,a){return t=+t,i>>>=0,a||L(e,0,i,4),r.write(e,t,i,n,23,4),i+4}function R(e,t,i,n,a){return t=+t,i>>>=0,a||L(e,0,i,8),r.write(e,t,i,n,52,8),i+8}t.prototype.slice=function(e,i){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(i=void 0===i?n:~~i)<0?(i+=n)<0&&(i=0):i>n&&(i=n),i<e&&(i=e);var r=this.subarray(e,i);return r.__proto__=t.prototype,r},t.prototype.readUIntLE=function(e,t,i){e>>>=0,t>>>=0,i||P(e,t,this.length);for(var n=this[e],r=1,a=0;++a<t&&(r*=256);)n+=this[e+a]*r;return n},t.prototype.readUIntBE=function(e,t,i){e>>>=0,t>>>=0,i||P(e,t,this.length);for(var n=this[e+--t],r=1;t>0&&(r*=256);)n+=this[e+--t]*r;return n},t.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,t,i){e>>>=0,t>>>=0,i||P(e,t,this.length);for(var n=this[e],r=1,a=0;++a<t&&(r*=256);)n+=this[e+a]*r;return n>=(r*=128)&&(n-=Math.pow(2,8*t)),n},t.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||P(e,t,this.length);for(var n=t,r=1,a=this[e+--n];n>0&&(r*=256);)a+=this[e+--n]*r;return a>=(r*=128)&&(a-=Math.pow(2,8*t)),a},t.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},t.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},t.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,t,i,n){(e=+e,t>>>=0,i>>>=0,n)||I(this,e,t,i,Math.pow(2,8*i)-1,0);var r=1,a=0;for(this[t]=255&e;++a<i&&(r*=256);)this[t+a]=e/r&255;return t+i},t.prototype.writeUIntBE=function(e,t,i,n){(e=+e,t>>>=0,i>>>=0,n)||I(this,e,t,i,Math.pow(2,8*i)-1,0);var r=i-1,a=1;for(this[t+r]=255&e;--r>=0&&(a*=256);)this[t+r]=e/a&255;return t+i},t.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,1,255,0),this[t]=255&e,t+1},t.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},t.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){var r=Math.pow(2,8*i-1);I(this,e,t,i,r-1,-r)}var a=0,s=1,o=0;for(this[t]=255&e;++a<i&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+i},t.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){var r=Math.pow(2,8*i-1);I(this,e,t,i,r-1,-r)}var a=i-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s>>0)-o&255;return t+i},t.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},t.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},t.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeFloatLE=function(e,t,i){return x(this,e,t,!0,i)},t.prototype.writeFloatBE=function(e,t,i){return x(this,e,t,!1,i)},t.prototype.writeDoubleLE=function(e,t,i){return R(this,e,t,!0,i)},t.prototype.writeDoubleBE=function(e,t,i){return R(this,e,t,!1,i)},t.prototype.copy=function(e,i,n,r){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),i>=e.length&&(i=e.length),i||(i=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-i<r-n&&(r=e.length-i+n);var a=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(i,n,r);else if(this===e&&n<i&&i<r)for(var s=a-1;s>=0;--s)e[s+i]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),i);return a},t.prototype.fill=function(e,i,n,r){if("string"==typeof e){if("string"==typeof i?(r=i,i=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var a=e.charCodeAt(0);("utf8"===r&&a<128||"latin1"===r)&&(e=a)}}else"number"==typeof e&&(e&=255);if(i<0||this.length<i||this.length<n)throw new RangeError("Out of range index");if(n<=i)return this;var s;if(i>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=i;s<n;++s)this[s]=e;else{var o=t.isBuffer(e)?e:t.from(e,r),u=o.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-i;++s)this[s+i]=o[s%u]}return this};var D=/[^+/0-9A-Za-z-_]/g;function O(e){return e<16?"0"+e.toString(16):e.toString(16)}function U(e,t){var i;t=t||1/0;for(var n=e.length,r=null,a=[],s=0;s<n;++s){if((i=e.charCodeAt(s))>55295&&i<57344){if(!r){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}r=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),r=i;continue}i=65536+(r-55296<<10|i-56320)}else r&&(t-=3)>-1&&a.push(239,191,189);if(r=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function M(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,i,n){for(var r=0;r<n&&!(r+i>=t.length||r>=e.length);++r)t[r+i]=e[r];return r}function B(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function N(e){return e!=e}}).call(this,e("buffer").Buffer)},{"base64-js":30,buffer:32,ieee754:35}],33:[function(e,t,i){(function(i){var n,r=void 0!==i?i:"undefined"!=typeof window?window:{},a=e("min-document");"undefined"!=typeof document?n=document:(n=r["__GLOBAL_DOCUMENT_CACHE@4"])||(n=r["__GLOBAL_DOCUMENT_CACHE@4"]=a),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":31}],34:[function(e,t,i){(function(e){var i;i="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(e,t,i){i.read=function(e,t,i,n,r){var a,s,o=8*r-n-1,u=(1<<o)-1,l=u>>1,h=-7,d=i?r-1:0,c=i?-1:1,f=e[t+d];for(d+=c,a=f&(1<<-h)-1,f>>=-h,h+=o;h>0;a=256*a+e[t+d],d+=c,h-=8);for(s=a&(1<<-h)-1,a>>=-h,h+=n;h>0;s=256*s+e[t+d],d+=c,h-=8);if(0===a)a=1-l;else{if(a===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),a-=l}return(f?-1:1)*s*Math.pow(2,a-n)},i.write=function(e,t,i,n,r,a){var s,o,u,l=8*a-r-1,h=(1<<l)-1,d=h>>1,c=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+d>=1?c/u:c*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=h?(o=0,s=h):s+d>=1?(o=(t*u-1)*Math.pow(2,r),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;e[i+f]=255&o,f+=p,o/=256,r-=8);for(s=s<<r|o,l+=r;l>0;e[i+f]=255&s,f+=p,s/=256,l-=8);e[i+f-p]|=128*m}},{}],36:[function(e,t,i){t.exports=function(e){if(!e)return!1;var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},{}],37:[function(e,t,i){function n(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return o[e];var i,n=String(e);return(i=r[n.toLowerCase()])?i:(i=a[n.toLowerCase()])||(1===n.length?n.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var n;if(n=r[t.toLowerCase()])return n===i;if(n=a[t.toLowerCase()])return n===i}else if("number"==typeof t)return t===i;return!1}};var r=(i=t.exports=n).code=i.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=i.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};
-/*!
- * Programatically add the following
- */
-for(s=97;s<123;s++)r[String.fromCharCode(s)]=s-32;for(var s=48;s<58;s++)r[s-48]=s;for(s=1;s<13;s++)r["f"+s]=s+111;for(s=0;s<10;s++)r["numpad "+s]=s+96;var o=i.names=i.title={};for(s in r)o[r[s]]=s;for(var u in a)r[u]=a[u]},{}],38:[function(e,t,i){
-/*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */
-"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e("@babel/runtime/helpers/inheritsLoose"),r=e("@videojs/vhs-utils/cjs/stream.js"),a=e("@babel/runtime/helpers/extends"),s=e("@babel/runtime/helpers/assertThisInitialized"),o=e("@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(n),h=u(r),d=u(a),c=u(s),f=u(o),p=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return l.default(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(h.default),m=String.fromCharCode(9),_=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},g=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},v=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}l.default(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(e))return i=d.default(_(t[1]),{type:"tag",tagType:"byterange"}),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var a=g(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=_(a.BYTERANGE))}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=g(t[1]),i.attributes.RESOLUTION){var s=i.attributes.RESOLUTION.split("x"),o={};s[0]&&(o.width=parseInt(s[0],10)),s[1]&&(o.height=parseInt(s[1],10)),i.attributes.RESOLUTION=o}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=g(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=g(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=g(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if((t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"skip"}).attributes=g(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(m)),void n.trigger("data",i);if((t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part"}).attributes=g(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=_(i.attributes.BYTERANGE)),void n.trigger("data",i);if((t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"server-control"}).attributes=g(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part-inf"}).attributes=g(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"preload-hint"}).attributes=g(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){if(i.attributes.hasOwnProperty(e)){i.attributes[e]=parseInt(i.attributes[e],10);var t="BYTERANGE-LENGTH"===e?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e]}})),void n.trigger("data",i);if((t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"rendition-report"}).attributes=g(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:a}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(h.default),y=function(e){var t={};return Object.keys(e).forEach((function(i){var n;t[(n=i,n.toLowerCase().replace(/-(\w)/g,(function(e){return e[1].toUpperCase()})))]=e[i]})),t},b=function(e){var t=e.serverControl,i=e.targetDuration,n=e.partTargetDuration;if(t){var r="#EXT-X-SERVER-CONTROL",a="holdBack",s="partHoldBack",o=i&&3*i,u=n&&2*n;i&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:r+" defaulting HOLD-BACK to targetDuration * 3 ("+o+")."})),o&&t[a]<o&&(this.trigger("warn",{message:r+" clamping HOLD-BACK ("+t[a]+") to targetDuration * 3 ("+o+")"}),t[a]=o),n&&!t.hasOwnProperty(s)&&(t[s]=3*n,this.trigger("info",{message:r+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+t[s]+")."})),n&&t[s]<u&&(this.trigger("warn",{message:r+" clamping PART-HOLD-BACK ("+t[s]+") to partTargetDuration * 2 ("+u+")."}),t[s]=u)}},S=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new p,t.parseStream=new v,t.lineStream.pipe(t.parseStream);var i,n,r=c.default(t),a=[],s={},o=!1,u=function(){},l={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},h=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var m=0,_=0;return t.on("end",(function(){s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof h||(s.timeline=h),t.manifest.preloadSegment=s)})),t.parseStream.on("data",(function(e){var t,c;({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(e.offset=m)),"offset"in e&&(s.byterange=t,t.offset=e.offset),m=t.offset+t.length},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:f.default(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,h=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes?(s.attributes||(s.attributes={}),d.default(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(c={default:/yes/i.test(e.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(c.language=e.attributes.LANGUAGE),e.attributes.URI&&(c.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(c.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(c.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(c.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=c}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){h+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,b.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=y(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;o=!0;var i=this.manifest.segments.length,n=y(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=_),_=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=y(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),b.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=y(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?_:0,n&&(_=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;a<s.preloadHints.length-1;a++){var o=s.preloadHints[a];o.type&&(o.type===i.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t+" has the same TYPE "+i.type+" as preload hint #"+a}))}},"rendition-report":function(){var t=y(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var i=this.manifest.renditionReports.length-1,n=["LAST-MSN","URI"];o&&n.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+i,e.attributes,n)},"part-inf":function(){this.manifest.partInf=y(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),b.call(this,this.manifest)}}[e.tagType]||u).call(r)},uri:function(){s.uri=e.uri,a.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=h,i&&(s.map=i),_=0,s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}l.default(t,e);var i=t.prototype;return i.warnOnMissingAttributes_=function(e,t,i){var n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})},i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n"),this.trigger("end")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(h.default);i.LineStream=p,i.ParseStream=v,i.Parser=S},{"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/extends":3,"@babel/runtime/helpers/inheritsLoose":5,"@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js":13,"@videojs/vhs-utils/cjs/stream.js":21}],39:[function(e,t,i){var n,r,a=(n=new Date,r=4,{setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+a.getDurationString(new Date-n,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+a.getDurationString(new Date-n,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&a.getDurationString(new Date-n,1e3)},error:function(e,t){4>=r&&console.error("["+a.getDurationString(new Date-n,1e3)+"]","["+e+"]",t)}});a.getDurationString=function(e,t){var i;function n(e,t){for(var i=(""+e).split(".");i[0].length<t;)i[0]="0"+i[0];return i.join(".")}e<0?(i=!0,e=-e):i=!1;var r=e/(t||1),a=Math.floor(r/3600);r-=3600*a;var s=Math.floor(r/60),o=1e3*(r-=60*s);return o-=1e3*(r=Math.floor(r)),o=Math.floor(o),(i?"-":"")+a+":"+n(s,2)+":"+n(r,2)+"."+n(o,3)},a.printRanges=function(e){var t=e.length;if(t>0){for(var i="",n=0;n<t;n++)n>0&&(i+=","),i+="["+a.getDurationString(e.start(n))+","+a.getDurationString(e.end(n))+"]";return i}return"(empty)"},void 0!==i&&(i.Log=a);var s=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};s.prototype.getPosition=function(){return this.position},s.prototype.getEndPosition=function(){return this.buffer.byteLength},s.prototype.getLength=function(){return this.buffer.byteLength},s.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},s.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},s.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position)<<8,i|=this.dataview.getUint8(this.position);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},s.prototype.readUint8=function(){return this.readAnyInt(1,!1)},s.prototype.readUint16=function(){return this.readAnyInt(2,!1)},s.prototype.readUint24=function(){return this.readAnyInt(3,!1)},s.prototype.readUint32=function(){return this.readAnyInt(4,!1)},s.prototype.readUint64=function(){return this.readAnyInt(8,!1)},s.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;i<e;i++)t+=String.fromCharCode(this.readUint8());return t}throw"Not enough bytes in buffer"},s.prototype.readCString=function(){for(var e=[];;){var t=this.readUint8();if(0===t)break;e.push(t)}return String.fromCharCode.apply(null,e)},s.prototype.readInt8=function(){return this.readAnyInt(1,!0)},s.prototype.readInt16=function(){return this.readAnyInt(2,!0)},s.prototype.readInt32=function(){return this.readAnyInt(4,!0)},s.prototype.readInt64=function(){return this.readAnyInt(8,!1)},s.prototype.readUint8Array=function(e){for(var t=new Uint8Array(e),i=0;i<e;i++)t[i]=this.readUint8();return t},s.prototype.readInt16Array=function(e){for(var t=new Int16Array(e),i=0;i<e;i++)t[i]=this.readInt16();return t},s.prototype.readUint16Array=function(e){for(var t=new Int16Array(e),i=0;i<e;i++)t[i]=this.readUint16();return t},s.prototype.readUint32Array=function(e){for(var t=new Uint32Array(e),i=0;i<e;i++)t[i]=this.readUint32();return t},s.prototype.readInt32Array=function(e){for(var t=new Int32Array(e),i=0;i<e;i++)t[i]=this.readInt32();return t},void 0!==i&&(i.MP4BoxStream=s);var o=function(e,t,i){this._byteOffset=t||0,e instanceof ArrayBuffer?this.buffer=e:"object"==typeof e?(this.dataView=e,t&&(this._byteOffset+=t)):this.buffer=new ArrayBuffer(e||0),this.position=0,this.endianness=null==i?o.LITTLE_ENDIAN:i};o.prototype={},o.prototype.getPosition=function(){return this.position},o.prototype._realloc=function(e){if(this._dynamicSize){var t=this._byteOffset+this.position+e,i=this._buffer.byteLength;if(t<=i)t>this._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var n=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(n,0,r.length).set(r),this.buffer=n,this._byteLength=t}}},o.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},o.BIG_ENDIAN=!1,o.LITTLE_ENDIAN=!0,o.prototype._byteLength=0,Object.defineProperty(o.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(o.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(o.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(o.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},o.prototype.isEof=function(){return this.position>=this._byteLength},o.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},o.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return o.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},o.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return o.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},o.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return o.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),o.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},o.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},o.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},o.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},o.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},o.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},o.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},o.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,o.memcpy=function(e,t,i,n,r){var a=new Uint8Array(e,t,r),s=new Uint8Array(i,n,r);a.set(s)},o.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},o.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},o.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;i<e.byteLength;i+=e.BYTES_PER_ELEMENT)for(var n=i+e.BYTES_PER_ELEMENT-1,r=i;n>r;n--,r++){var a=t[r];t[r]=t[n],t[n]=a}return e},o.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i<e.length;i++)t[i]=e[i];return String.fromCharCode.apply(null,t)},o.prototype.readString=function(e,t){return null==t||"ASCII"==t?String.fromCharCodeUint8.apply(null,[this.mapUint8Array(null==e?this.byteLength-this.position:e)]):new TextDecoder(t).decode(this.mapUint8Array(e))},o.prototype.readCString=function(e){var t=this.byteLength-this.position,i=new Uint8Array(this._buffer,this._byteOffset+this.position),n=t;null!=e&&(n=Math.min(e,t));for(var r=0;r<n&&0!==i[r];r++);var a=String.fromCharCodeUint8.apply(null,[this.mapUint8Array(r)]);return null!=e?this.position+=n-r:r!=t&&(this.position+=1),a};var u=Math.pow(2,32);o.prototype.readInt64=function(){return this.readInt32()*u+this.readUint32()},o.prototype.readUint64=function(){return this.readUint32()*u+this.readUint32()},o.prototype.readInt64=function(){return this.readUint32()*u+this.readUint32()},o.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()},void 0!==i&&(i.DataStream=o),o.prototype.save=function(e){var t=new Blob([this.buffer]);if(!window.URL||!URL.createObjectURL)throw"DataStream.save: Can't create object URL.";var i=window.URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.setAttribute("href",i),n.setAttribute("download",e),n.setAttribute("target","_self"),n.click(),window.URL.revokeObjectURL(i)},o.prototype._dynamicSize=!0,Object.defineProperty(o.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){e||this._trimAlloc(),this._dynamicSize=e}}),o.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e),i=new Uint8Array(t),n=new Uint8Array(this._buffer,e,i.length);i.set(n),this.buffer=t,this.position-=e},o.prototype.writeInt32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeInt32(e[i],t)},o.prototype.writeInt16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt16Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeInt16(e[i],t)},o.prototype.writeInt8Array=function(e){if(this._realloc(1*e.length),e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapInt8Array(e.length);else for(var t=0;t<e.length;t++)this.writeInt8(e[t])},o.prototype.writeUint32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeUint32(e[i],t)},o.prototype.writeUint16Array=function(e,t){if(this._realloc(2*e.length),e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint16Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeUint16(e[i],t)},o.prototype.writeUint8Array=function(e){if(this._realloc(1*e.length),e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapUint8Array(e.length);else for(var t=0;t<e.length;t++)this.writeUint8(e[t])},o.prototype.writeFloat64Array=function(e,t){if(this._realloc(8*e.length),e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat64Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeFloat64(e[i],t)},o.prototype.writeFloat32Array=function(e,t){if(this._realloc(4*e.length),e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0)o.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength),this.mapFloat32Array(e.length,t);else for(var i=0;i<e.length;i++)this.writeFloat32(e[i],t)},o.prototype.writeInt32=function(e,t){this._realloc(4),this._dataView.setInt32(this.position,e,null==t?this.endianness:t),this.position+=4},o.prototype.writeInt16=function(e,t){this._realloc(2),this._dataView.setInt16(this.position,e,null==t?this.endianness:t),this.position+=2},o.prototype.writeInt8=function(e){this._realloc(1),this._dataView.setInt8(this.position,e),this.position+=1},o.prototype.writeUint32=function(e,t){this._realloc(4),this._dataView.setUint32(this.position,e,null==t?this.endianness:t),this.position+=4},o.prototype.writeUint16=function(e,t){this._realloc(2),this._dataView.setUint16(this.position,e,null==t?this.endianness:t),this.position+=2},o.prototype.writeUint8=function(e){this._realloc(1),this._dataView.setUint8(this.position,e),this.position+=1},o.prototype.writeFloat32=function(e,t){this._realloc(4),this._dataView.setFloat32(this.position,e,null==t?this.endianness:t),this.position+=4},o.prototype.writeFloat64=function(e,t){this._realloc(8),this._dataView.setFloat64(this.position,e,null==t?this.endianness:t),this.position+=8},o.prototype.writeUCS2String=function(e,t,i){null==i&&(i=e.length);for(var n=0;n<e.length&&n<i;n++)this.writeUint16(e.charCodeAt(n),t);for(;n<i;n++)this.writeUint16(0)},o.prototype.writeString=function(e,t,i){var n=0;if(null==t||"ASCII"==t)if(null!=i){var r=Math.min(e.length,i);for(n=0;n<r;n++)this.writeUint8(e.charCodeAt(n));for(;n<i;n++)this.writeUint8(0)}else for(n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,i)))},o.prototype.writeCString=function(e,t){var i=0;if(null!=t){var n=Math.min(e.length,t);for(i=0;i<n;i++)this.writeUint8(e.charCodeAt(i));for(;i<t;i++)this.writeUint8(0)}else{for(i=0;i<e.length;i++)this.writeUint8(e.charCodeAt(i));this.writeUint8(0)}},o.prototype.writeStruct=function(e,t){for(var i=0;i<e.length;i+=2){var n=e[i+1];this.writeType(n,t[e[i]],t)}},o.prototype.writeType=function(e,t,i){var n;if("function"==typeof e)return e(this,t);if("object"==typeof e&&!(e instanceof Array))return e.set(this,t,i);var r=null,a="ASCII",s=this.position;switch("string"==typeof e&&/:/.test(e)&&(n=e.split(":"),e=n[0],r=parseInt(n[1])),"string"==typeof e&&/,/.test(e)&&(n=e.split(","),e=n[0],a=parseInt(n[1])),e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,o.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,o.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,o.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,o.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,o.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,o.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,o.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,o.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,o.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,o.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,o.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,o.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,r);break;case"string":this.writeString(t,a,r);break;case"u16string":this.writeUCS2String(t,this.endianness,r);break;case"u16stringle":this.writeUCS2String(t,o.LITTLE_ENDIAN,r);break;case"u16stringbe":this.writeUCS2String(t,o.BIG_ENDIAN,r);break;default:if(3==e.length){for(var u=e[1],l=0;l<t.length;l++)this.writeType(u,t[l]);break}this.writeStruct(e,t)}null!=r&&(this.position=s,this._realloc(r),this.position=s+r)},o.prototype.writeUint64=function(e){var t=Math.floor(e/u);this.writeUint32(t),this.writeUint32(4294967295&e)},o.prototype.writeUint24=function(e){this.writeUint8((16711680&e)>>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},o.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},o.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},o.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},o.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},o.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},o.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},o.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},o.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return o.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var l=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(l.prototype=new o(new ArrayBuffer,0,o.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},l.prototype.reduceBuffer=function(e,t,i){var n;return(n=new Uint8Array(i)).set(new Uint8Array(e,t,i)),n.buffer.fileStart=e.fileStart+t,n.buffer.usedBytes=0,n.buffer},l.prototype.insertBuffer=function(e){for(var t=!0,i=0;i<this.buffers.length;i++){var n=this.buffers[i];if(e.fileStart<=n.fileStart){if(e.fileStart===n.fileStart){if(e.byteLength>n.byteLength){this.buffers.splice(i,1),i--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=n.fileStart||(e=this.reduceBuffer(e,0,n.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart<n.fileStart+n.byteLength){var r=n.fileStart+n.byteLength-e.fileStart,s=e.byteLength-r;if(!(s>0)){t=!1;break}e=this.reduceBuffer(e,r,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},l.prototype.logBufferLevel=function(e){var t,i,n,r,s,o=[],u="";for(n=0,r=0,t=0;t<this.buffers.length;t++)i=this.buffers[t],0===t?(s={},o.push(s),s.start=i.fileStart,s.end=i.fileStart+i.byteLength,u+="["+s.start+"-"):s.end===i.fileStart?s.end=i.fileStart+i.byteLength:((s={}).start=i.fileStart,u+=o[o.length-1].end-1+"], ["+s.start+"-",s.end=i.fileStart+i.byteLength,o.push(s)),n+=i.usedBytes,r+=i.byteLength;o.length>0&&(u+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+n+"/"+r+" bytes): "+u)},l.prototype.cleanBuffers=function(){var e,t;for(e=0;e<this.buffers.length;e++)(t=this.buffers[e]).usedBytes===t.byteLength&&(a.debug("MultiBufferStream","Removing buffer #"+e),this.buffers.splice(e,1),e--)},l.prototype.mergeNextBuffer=function(){var e;if(this.bufferIndex+1<this.buffers.length){if((e=this.buffers[this.bufferIndex+1]).fileStart===this.buffer.fileStart+this.buffer.byteLength){var t=this.buffer.byteLength,i=this.buffer.usedBytes,n=this.buffer.fileStart;return this.buffers[this.bufferIndex]=ArrayBuffer.concat(this.buffer,e),this.buffer=this.buffers[this.bufferIndex],this.buffers.splice(this.bufferIndex+1,1),this.buffer.usedBytes=i,this.buffer.fileStart=n,a.debug("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.buffer.byteLength+")"),!0}return!1}return!1},l.prototype.findPosition=function(e,t,i){var n,r=null,s=-1;for(n=!0===e?0:this.bufferIndex;n<this.buffers.length&&(r=this.buffers[n]).fileStart<=t;)s=n,i&&(r.fileStart+r.byteLength<=t?r.usedBytes=r.byteLength:r.usedBytes=t-r.fileStart,this.logBufferLevel()),n++;return-1!==s&&(r=this.buffers[s]).fileStart+r.byteLength>=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},l.prototype.findEndContiguousBuf=function(e){var t,i,n,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t<this.buffers.length&&(n=this.buffers[t]).fileStart===i.fileStart+i.byteLength;t++)i=n;return i.fileStart+i.byteLength},l.prototype.getEndFilePositionAfter=function(e){var t=this.findPosition(!0,e,!1);return-1!==t?this.findEndContiguousBuf(t):e},l.prototype.addUsedBytes=function(e){this.buffer.usedBytes+=e,this.logBufferLevel()},l.prototype.setAllUsedBytes=function(){this.buffer.usedBytes=this.buffer.byteLength,this.logBufferLevel()},l.prototype.seek=function(e,t,i){var n;return-1!==(n=this.findPosition(t,e,i))?(this.buffer=this.buffers[n],this.bufferIndex=n,this.position=e-this.buffer.fileStart,a.debug("MultiBufferStream","Repositioning parser at buffer position: "+this.position),!0):(a.debug("MultiBufferStream","Position "+e+" not found in buffered data"),!1)},l.prototype.getPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.position},l.prototype.getLength=function(){return this.byteLength},l.prototype.getEndPosition=function(){if(-1===this.bufferIndex||null===this.buffers[this.bufferIndex])throw"Error accessing position in the MultiBufferStream";return this.buffers[this.bufferIndex].fileStart+this.byteLength},void 0!==i&&(i.MultiBufferStream=l);var h=function(){var e=[];e[3]="ES_Descriptor",e[4]="DecoderConfigDescriptor",e[5]="DecoderSpecificInfo",e[6]="SLConfigDescriptor",this.getDescriptorName=function(t){return e[t]};var t=this,i={};return this.parseOneDescriptor=function(t){var n,r,s,o=0;for(n=t.readUint8(),s=t.readUint8();128&s;)o=(127&s)<<7,s=t.readUint8();return o+=127&s,a.debug("MPEG4DescriptorParser","Found "+(e[n]||"Descriptor "+n)+", size "+o+" at position "+t.getPosition()),(r=e[n]?new i[e[n]](o):new i.Descriptor(o)).parse(t),r},i.Descriptor=function(e,t){this.tag=e,this.size=t,this.descs=[]},i.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)},i.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++)if(this.descs[t].tag==e)return this.descs[t];return null},i.Descriptor.prototype.parseRemainingDescriptors=function(e){for(var i=e.position;e.position<i+this.size;){var n=t.parseOneDescriptor(e);this.descs.push(n)}},i.ES_Descriptor=function(e){i.Descriptor.call(this,3,e)},i.ES_Descriptor.prototype=new i.Descriptor,i.ES_Descriptor.prototype.parse=function(e){if(this.ES_ID=e.readUint16(),this.flags=e.readUint8(),this.size-=3,128&this.flags?(this.dependsOn_ES_ID=e.readUint16(),this.size-=2):this.dependsOn_ES_ID=0,64&this.flags){var t=e.readUint8();this.URL=e.readString(t),this.size-=t+1}else this.URL="";32&this.flags?(this.OCR_ES_ID=e.readUint16(),this.size-=2):this.OCR_ES_ID=0,this.parseRemainingDescriptors(e)},i.ES_Descriptor.prototype.getOTI=function(e){var t=this.findDescriptor(4);return t?t.oti:0},i.ES_Descriptor.prototype.getAudioConfig=function(e){var t=this.findDescriptor(4);if(!t)return null;var i=t.findDescriptor(5);if(i&&i.data){var n=(248&i.data[0])>>3;return 31===n&&i.data.length>=2&&(n=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),n}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};void 0!==i&&(i.MPEG4DescriptorParser=h);var d={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){d.FullBox.prototype=new d.Box,d.ContainerBox.prototype=new d.Box,d.SampleEntry.prototype=new d.Box,d.TrackGroupTypeBox.prototype=new d.FullBox,d.BASIC_BOXES.forEach((function(e){d.createBoxCtor(e)})),d.FULL_BOXES.forEach((function(e){d.createFullBoxCtor(e)})),d.CONTAINER_BOXES.forEach((function(e){d.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){d.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){d.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,n){d.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=n},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){d.FullBox.call(this,e,t)},createBoxCtor:function(e,t){d.boxCodes.push(e),d[e+"Box"]=function(t){d.Box.call(this,e,t)},d[e+"Box"].prototype=new d.Box,t&&(d[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){d[e+"Box"]=function(t){d.FullBox.call(this,e,t)},d[e+"Box"].prototype=new d.FullBox,d[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;i<t;i++)this[e[i]+"s"]=[]}},createContainerBoxCtor:function(e,t,i){d[e+"Box"]=function(t){d.ContainerBox.call(this,e,t),d.addSubBoxArrays.call(this,i)},d[e+"Box"].prototype=new d.ContainerBox,t&&(d[e+"Box"].prototype.parse=t)},createMediaSampleEntryCtor:function(e,t,i){d.sampleEntryCodes[e]=[],d[e+"SampleEntry"]=function(e,t){d.SampleEntry.call(this,e,t),d.addSubBoxArrays.call(this,i)},d[e+"SampleEntry"].prototype=new d.SampleEntry,t&&(d[e+"SampleEntry"].prototype.parse=t)},createSampleEntryCtor:function(e,t,i,n){d.sampleEntryCodes[e].push(t),d[t+"SampleEntry"]=function(i){d[e+"SampleEntry"].call(this,t,i),d.addSubBoxArrays.call(this,n)},d[t+"SampleEntry"].prototype=new d[e+"SampleEntry"],i&&(d[t+"SampleEntry"].prototype.parse=i)},createEncryptedSampleEntryCtor:function(e,t,i){d.createSampleEntryCtor.call(this,e,t,i,["sinf"])},createSampleGroupCtor:function(e,t){d[e+"SampleGroupEntry"]=function(t){d.SampleGroupEntry.call(this,e,t)},d[e+"SampleGroupEntry"].prototype=new d.SampleGroupEntry,t&&(d[e+"SampleGroupEntry"].prototype.parse=t)},createTrackGroupCtor:function(e,t){d[e+"TrackGroupTypeBox"]=function(t){d.TrackGroupTypeBox.call(this,e,t)},d[e+"TrackGroupTypeBox"].prototype=new d.TrackGroupTypeBox,t&&(d[e+"TrackGroupTypeBox"].prototype.parse=t)},createUUIDBox:function(e,t,i,n){d.UUIDs.push(e),d.UUIDBoxes[e]=function(n){t?d.FullBox.call(this,"uuid",n,e):i?d.ContainerBox.call(this,"uuid",n,e):d.Box.call(this,"uuid",n,e)},d.UUIDBoxes[e].prototype=t?new d.FullBox:i?new d.ContainerBox:new d.Box,n&&(d.UUIDBoxes[e].prototype.parse=t?function(e){this.parseFullHeader(e),n&&n.call(this,e)}:n)}};d.initialize(),d.TKHD_FLAG_ENABLED=1,d.TKHD_FLAG_IN_MOVIE=2,d.TKHD_FLAG_IN_PREVIEW=4,d.TFHD_FLAG_BASE_DATA_OFFSET=1,d.TFHD_FLAG_SAMPLE_DESC=2,d.TFHD_FLAG_SAMPLE_DUR=8,d.TFHD_FLAG_SAMPLE_SIZE=16,d.TFHD_FLAG_SAMPLE_FLAGS=32,d.TFHD_FLAG_DUR_EMPTY=65536,d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072,d.TRUN_FLAGS_DATA_OFFSET=1,d.TRUN_FLAGS_FIRST_FLAG=4,d.TRUN_FLAGS_DURATION=256,d.TRUN_FLAGS_SIZE=512,d.TRUN_FLAGS_FLAGS=1024,d.TRUN_FLAGS_CTS_OFFSET=2048,d.Box.prototype.add=function(e){return this.addBox(new d[e+"Box"])},d.Box.prototype.addBox=function(e){return this.boxes.push(e),this[e.type+"s"]?this[e.type+"s"].push(e):this[e.type]=e,e},d.Box.prototype.set=function(e,t){return this[e]=t,this},d.Box.prototype.addEntry=function(e,t){var i=t||"entries";return this[i]||(this[i]=[]),this[i].push(e),this},void 0!==i&&(i.BoxParser=d),d.parseUUID=function(e){return d.parseHex16(e)},d.parseHex16=function(e){for(var t="",i=0;i<16;i++){var n=e.readUint8().toString(16);t+=1===n.length?"0"+n:n}return t},d.parseOneBox=function(e,t,i){var n,r,s,o=e.getPosition(),u=0;if(e.getEndPosition()-o<8)return a.debug("BoxParser","Not enough data in stream to parse the type and size of the box"),{code:d.ERR_NOT_ENOUGH_DATA};if(i&&i<8)return a.debug("BoxParser","Not enough bytes left in the parent box to parse a new box"),{code:d.ERR_NOT_ENOUGH_DATA};var l=e.readUint32(),h=e.readString(4),c=h;if(a.debug("BoxParser","Found box of type '"+h+"' and size "+l+" at position "+o),u=8,"uuid"==h){if(e.getEndPosition()-e.getPosition()<16||i-u<16)return e.seek(o),a.debug("BoxParser","Not enough bytes left in the parent box to parse a UUID box"),{code:d.ERR_NOT_ENOUGH_DATA};u+=16,c=s=d.parseUUID(e)}if(1==l){if(e.getEndPosition()-e.getPosition()<8||i&&i-u<8)return e.seek(o),a.warn("BoxParser",'Not enough data in stream to parse the extended size of the "'+h+'" box'),{code:d.ERR_NOT_ENOUGH_DATA};l=e.readUint64(),u+=8}else if(0===l)if(i)l=i;else if("mdat"!==h)return a.error("BoxParser","Unlimited box size not supported for type: '"+h+"'"),n=new d.Box(h,l),{code:d.OK,box:n,size:n.size};return l<u?(a.error("BoxParser","Box of type "+h+" has an invalid size "+l+" (too small to be a box)"),{code:d.ERR_NOT_ENOUGH_DATA,type:h,size:l,hdr_size:u,start:o}):i&&l>i?(a.error("BoxParser","Box of type '"+h+"' has a size "+l+" greater than its container size "+i),{code:d.ERR_NOT_ENOUGH_DATA,type:h,size:l,hdr_size:u,start:o}):o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:d.ERR_NOT_ENOUGH_DATA,type:h,size:l,hdr_size:u,start:o}):t?{code:d.OK,type:h,size:l,hdr_size:u,start:o}:(d[h+"Box"]?n=new d[h+"Box"](l):"uuid"!==h?(a.warn("BoxParser","Unknown box type: '"+h+"'"),(n=new d.Box(h,l)).has_unparsed_data=!0):d.UUIDBoxes[s]?n=new d.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(n=new d.Box(h,l)).uuid=s,n.has_unparsed_data=!0),n.hdr_size=u,n.start=o,n.write===d.Box.prototype.write&&"mdat"!==n.type&&(a.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),n.parseDataAndRewind(e)),n.parse(e),(r=e.getPosition()-(n.start+n.size))<0?(a.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(n.start+n.size)):r>0&&(a.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),e.seek(n.start+n.size)),{code:d.OK,box:n,size:n.size})},d.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},d.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},d.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},d.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},d.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},d.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()<this.start+this.size;){if((t=d.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==d.OK)return;if(i=t.box,this.boxes.push(i),this.subBoxNames&&-1!=this.subBoxNames.indexOf(i.type))this[this.subBoxNames[this.subBoxNames.indexOf(i.type)]+"s"].push(i);else{var n="uuid"!==i.type?i.type:i.uuid;this[n]?a.warn("Box of type "+n+" already stored in field of this type"):this[n]=i}}},d.Box.prototype.parseLanguage=function(e){this.language=e.readUint16();var t=[];t[0]=this.language>>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},d.SAMPLE_ENTRY_TYPE_VISUAL="Visual",d.SAMPLE_ENTRY_TYPE_AUDIO="Audio",d.SAMPLE_ENTRY_TYPE_HINT="Hint",d.SAMPLE_ENTRY_TYPE_METADATA="Metadata",d.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",d.SAMPLE_ENTRY_TYPE_SYSTEM="System",d.SAMPLE_ENTRY_TYPE_TEXT="Text",d.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},d.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},d.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},d.SampleEntry.prototype.parseFooter=function(e){d.ContainerBox.prototype.parse.call(this,e)},d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_HINT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT,"enct"),d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"encm"),d.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),d.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t<this.nb_SPS_nalus;t++)this.SPS[t]={},this.SPS[t].length=e.readUint16(),this.SPS[t].nalu=e.readUint8Array(this.SPS[t].length),i-=2+this.SPS[t].length;for(this.nb_PPS_nalus=e.readUint8(),i--,this.PPS=[],t=0;t<this.nb_PPS_nalus;t++)this.PPS[t]={},this.PPS[t].length=e.readUint16(),this.PPS[t].nalu=e.readUint8Array(this.PPS[t].length),i-=2+this.PPS[t].length;i>0&&(this.ext=e.readUint8Array(i))})),d.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),d.createBoxCtor("clap",(function(e){this.cleanApertureWidthN=e.readUint32(),this.cleanApertureWidthD=e.readUint32(),this.cleanApertureHeightN=e.readUint32(),this.cleanApertureHeightD=e.readUint32(),this.horizOffN=e.readUint32(),this.horizOffD=e.readUint32(),this.vertOffN=e.readUint32(),this.vertOffD=e.readUint32()})),d.createBoxCtor("clli",(function(e){this.max_content_light_level=e.readUint16(),this.max_pic_average_light_level=e.readUint16()})),d.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i<t;i++)this.chunk_offsets.push(e.readUint64())})),d.createFullBoxCtor("CoLL",(function(e){this.maxCLL=e.readUint16(),this.maxFALL=e.readUint16()})),d.createBoxCtor("colr",(function(e){if(this.colour_type=e.readString(4),"nclx"===this.colour_type){this.colour_primaries=e.readUint16(),this.transfer_characteristics=e.readUint16(),this.matrix_coefficients=e.readUint16();var t=e.readUint8();this.full_range_flag=t>>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),d.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),d.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),d.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i<t;i++){this.sample_counts.push(e.readUint32());var n=e.readInt32();n<0&&a.warn("BoxParser","ctts box uses negative values without using version 1"),this.sample_offsets.push(n)}else if(1==this.version)for(i=0;i<t;i++)this.sample_counts.push(e.readUint32()),this.sample_offsets.push(e.readInt32())})),d.createBoxCtor("dac3",(function(e){var t=e.readUint8(),i=e.readUint8(),n=e.readUint8();this.fscod=t>>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|n>>5&7})),d.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i<this.num_ind_sub+1;i++){var n={};this.ind_subs.push(n);var r=e.readUint8(),a=e.readUint8(),s=e.readUint8();n.fscod=r>>6,n.bsid=r>>1&31,n.bsmod=(1&r)<<4|a>>4&15,n.acmod=a>>1&7,n.lfeon=1&a,n.num_dep_sub=s>>1&15,n.num_dep_sub>0&&(n.chan_loc=(1&s)<<8|e.readUint8())}})),d.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var n=e.readUint8(),r=Math.min(127&n,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&n)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),d.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),d.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),d.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),d.createFullBoxCtor("dref",(function(e){var t,i;this.entries=[];for(var n=e.readUint32(),r=0;r<n;r++){if((t=d.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==d.OK)return;i=t.box,this.entries.push(i)}})),d.createBoxCtor("drep",(function(e){this.bytessent=e.readUint64()})),d.createFullBoxCtor("elng",(function(e){this.extended_language=e.readString(this.size-this.hdr_size)})),d.createFullBoxCtor("elst",(function(e){this.entries=[];for(var t=e.readUint32(),i=0;i<t;i++){var n={};this.entries.push(n),1===this.version?(n.segment_duration=e.readUint64(),n.media_time=e.readInt64()):(n.segment_duration=e.readUint32(),n.media_time=e.readInt32()),n.media_rate_integer=e.readInt16(),n.media_rate_fraction=e.readInt16()}})),d.createFullBoxCtor("emsg",(function(e){1==this.version?(this.timescale=e.readUint32(),this.presentation_time=e.readUint64(),this.event_duration=e.readUint32(),this.id=e.readUint32(),this.scheme_id_uri=e.readCString(),this.value=e.readCString()):(this.scheme_id_uri=e.readCString(),this.value=e.readCString(),this.timescale=e.readUint32(),this.presentation_time_delta=e.readUint32(),this.event_duration=e.readUint32(),this.id=e.readUint32());var t=this.size-this.hdr_size-(16+(this.scheme_id_uri.length+1)+(this.value.length+1));1==this.version&&(t-=4),this.message_data=e.readUint8Array(t)})),d.createFullBoxCtor("esds",(function(e){var t=e.readUint8Array(this.size-this.hdr_size);if(void 0!==h){var i=new h;this.esd=i.parseOneDescriptor(new o(t.buffer,0,o.BIG_ENDIAN))}})),d.createBoxCtor("fiel",(function(e){this.fieldCount=e.readUint8(),this.fieldOrdering=e.readUint8()})),d.createBoxCtor("frma",(function(e){this.data_format=e.readString(4)})),d.createBoxCtor("ftyp",(function(e){var t=this.size-this.hdr_size;this.major_brand=e.readString(4),this.minor_version=e.readUint32(),t-=8,this.compatible_brands=[];for(var i=0;t>=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),d.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),d.createBoxCtor("hvcC",(function(e){var t,i,n,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t<a;t++){var s=[];this.nalu_arrays.push(s),r=e.readUint8(),s.completeness=(128&r)>>7,s.nalu_type=63&r;var o=e.readUint16();for(i=0;i<o;i++){var u={};s.push(u),n=e.readUint16(),u.data=e.readUint8Array(n)}}})),d.createFullBoxCtor("iinf",(function(e){var t;0===this.version?this.entry_count=e.readUint16():this.entry_count=e.readUint32(),this.item_infos=[];for(var i=0;i<this.entry_count;i++){if((t=d.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==d.OK)return;"infe"!==t.box.type&&a.error("BoxParser","Expected 'infe' box, got "+t.box.type),this.item_infos[i]=t.box}})),d.createFullBoxCtor("iloc",(function(e){var t;t=e.readUint8(),this.offset_size=t>>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var n=0;n<i;n++){var r={};if(this.items.push(r),this.version<2)r.item_ID=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r.item_ID=e.readUint16()}switch(1===this.version||2===this.version?r.construction_method=15&e.readUint16():r.construction_method=0,r.data_reference_index=e.readUint16(),this.base_offset_size){case 0:r.base_offset=0;break;case 4:r.base_offset=e.readUint32();break;case 8:r.base_offset=e.readUint64();break;default:throw"Error reading base offset size"}var a=e.readUint16();r.extents=[];for(var s=0;s<a;s++){var o={};if(r.extents.push(o),1===this.version||2===this.version)switch(this.index_size){case 0:o.extent_index=0;break;case 4:o.extent_index=e.readUint32();break;case 8:o.extent_index=e.readUint64();break;default:throw"Error reading extent index"}switch(this.offset_size){case 0:o.extent_offset=0;break;case 4:o.extent_offset=e.readUint32();break;case 8:o.extent_offset=e.readUint64();break;default:throw"Error reading extent index"}switch(this.length_size){case 0:o.extent_length=0;break;case 4:o.extent_length=e.readUint32();break;case 8:o.extent_length=e.readUint64();break;default:throw"Error reading extent index"}}}})),d.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),d.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t<entry_count;t++){var n={};this.associations.push(n),this.version<1?n.id=e.readUint16():n.id=e.readUint32();var r=e.readUint8();for(n.props=[],i=0;i<r;i++){var a=e.readUint8(),s={};n.props.push(s),s.essential=(128&a)>>7==1,1&this.flags?s.property_index=(127&a)<<8|e.readUint8():s.property_index=127&a}}})),d.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()<this.start+this.size;){if((t=d.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==d.OK)return;(i=0===this.version?new d.SingleItemTypeReferenceBox(t.type,t.size,t.hdr_size,t.start):new d.SingleItemTypeReferenceBoxLarge(t.type,t.size,t.hdr_size,t.start)).write===d.Box.prototype.write&&"mdat"!==i.type&&(a.warn("BoxParser",i.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),this.references.push(i)}})),d.createBoxCtor("irot",(function(e){this.angle=3&e.readUint8()})),d.createFullBoxCtor("ispe",(function(e){this.image_width=e.readUint32(),this.image_height=e.readUint32()})),d.createFullBoxCtor("kind",(function(e){this.schemeURI=e.readCString(),this.value=e.readCString()})),d.createFullBoxCtor("leva",(function(e){var t=e.readUint8();this.levels=[];for(var i=0;i<t;i++){var n={};this.levels[i]=n,n.track_ID=e.readUint32();var r=e.readUint8();switch(n.padding_flag=r>>7,n.assignment_type=127&r,n.assignment_type){case 0:n.grouping_type=e.readString(4);break;case 1:n.grouping_type=e.readString(4),n.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:n.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),d.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),d.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]={},this.display_primaries[0].x=e.readUint16(),this.display_primaries[0].y=e.readUint16(),this.display_primaries[1]={},this.display_primaries[1].x=e.readUint16(),this.display_primaries[1].y=e.readUint16(),this.display_primaries[2]={},this.display_primaries[2].x=e.readUint16(),this.display_primaries[2].y=e.readUint16(),this.white_point={},this.white_point.x=e.readUint16(),this.white_point.y=e.readUint16(),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),d.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),d.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),d.createFullBoxCtor("meta",(function(e){this.boxes=[],d.ContainerBox.prototype.parse.call(this,e)})),d.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),d.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),d.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),d.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),d.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),d.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i<Math.floor((t+1)/2);i++)this.padbits=e.readUint8()})),d.createBoxCtor("pasp",(function(e){this.hSpacing=e.readUint32(),this.vSpacing=e.readUint32()})),d.createBoxCtor("payl",(function(e){this.text=e.readString(this.size-this.hdr_size)})),d.createBoxCtor("payt",(function(e){this.payloadID=e.readUint32();var t=e.readUint8();this.rtpmap_string=e.readString(t)})),d.createFullBoxCtor("pdin",(function(e){var t=(this.size-this.hdr_size)/8;this.rate=[],this.initial_delay=[];for(var i=0;i<t;i++)this.rate[i]=e.readUint32(),this.initial_delay[i]=e.readUint32()})),d.createFullBoxCtor("pitm",(function(e){0===this.version?this.item_id=e.readUint16():this.item_id=e.readUint32()})),d.createFullBoxCtor("pixi",(function(e){var t;for(this.num_channels=e.readUint8(),this.bits_per_channels=[],t=0;t<this.num_channels;t++)this.bits_per_channels[t]=e.readUint8()})),d.createBoxCtor("pmax",(function(e){this.bytes=e.readUint32()})),d.createFullBoxCtor("prft",(function(e){this.ref_track_id=e.readUint32(),this.ntp_timestamp=e.readUint64(),0===this.version?this.media_time=e.readUint32():this.media_time=e.readUint64()})),d.createFullBoxCtor("pssh",(function(e){if(this.system_id=d.parseHex16(e),this.version>0){var t=e.readUint32();this.kid=[];for(var i=0;i<t;i++)this.kid[i]=d.parseHex16(e)}var n=e.readUint32();n>0&&(this.data=e.readUint8Array(n))})),d.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),d.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),d.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),d.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i<t;i++)0===this.version?this.offset[i]=e.readUint32():this.offset[i]=e.readUint64()})),d.createFullBoxCtor("saiz",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32()),this.default_sample_info_size=e.readUint8();var t=e.readUint32();if(this.sample_info_size=[],0===this.default_sample_info_size)for(var i=0;i<t;i++)this.sample_info_size[i]=e.readUint8()})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"mett",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"metx",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"sbtt",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"stpp",(function(e){this.parseHeader(e),this.namespace=e.readCString(),this.schema_location=e.readCString(),this.auxiliary_mime_types=e.readCString(),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"stxt",(function(e){this.parseHeader(e),this.content_encoding=e.readCString(),this.mime_format=e.readCString(),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE,"tx3g",(function(e){this.parseHeader(e),this.displayFlags=e.readUint32(),this.horizontal_justification=e.readInt8(),this.vertical_justification=e.readInt8(),this.bg_color_rgba=e.readUint8Array(4),this.box_record=e.readInt16Array(4),this.style_record=e.readUint8Array(12),this.parseFooter(e)})),d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA,"wvtt",(function(e){this.parseHeader(e),this.parseFooter(e)})),d.createSampleGroupCtor("alst",(function(e){var t,i=e.readUint16();for(this.first_output_sample=e.readUint16(),this.sample_offset=[],t=0;t<i;t++)this.sample_offset[t]=e.readUint32();var n=this.description_length-4-4*i;for(this.num_output_samples=[],this.num_total_samples=[],t=0;t<n/4;t++)this.num_output_samples[t]=e.readUint16(),this.num_total_samples[t]=e.readUint16()})),d.createSampleGroupCtor("avll",(function(e){this.layerNumber=e.readUint8(),this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()})),d.createSampleGroupCtor("avss",(function(e){this.subSequenceIdentifier=e.readUint16(),this.layerNumber=e.readUint8();var t=e.readUint8();this.durationFlag=t>>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),n=0;n<i;n++){var r={};this.dependency.push(r),r.subSeqDirectionFlag=e.readUint8(),r.layerNumber=e.readUint8(),r.subSequenceIdentifier=e.readUint16()}})),d.createSampleGroupCtor("dtrt",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("mvif",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("prol",(function(e){this.roll_distance=e.readInt16()})),d.createSampleGroupCtor("rap ",(function(e){var t=e.readUint8();this.num_leading_samples_known=t>>7,this.num_leading_samples=127&t})),d.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t<this.operation_point_count;t++)this.available_bitrate[t]=e.readUint32(),this.target_rate_share[t]=e.readUint16()}this.maximum_bitrate=e.readUint32(),this.minimum_bitrate=e.readUint32(),this.discard_priority=e.readUint8()}})),d.createSampleGroupCtor("roll",(function(e){this.roll_distance=e.readInt16()})),d.SampleGroupEntry.prototype.parse=function(e){a.warn("BoxParser","Unknown Sample Group type: "+this.grouping_type),this.data=e.readUint8Array(this.description_length)},d.createSampleGroupCtor("scif",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("scnm",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("seig",(function(e){this.reserved=e.readUint8();var t=e.readUint8();this.crypt_byte_block=t>>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=d.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),d.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),d.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),d.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),d.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i<t;i++){var n={};this.entries.push(n),n.sample_count=e.readInt32(),n.group_description_index=e.readInt32()}})),d.createFullBoxCtor("schm",(function(e){this.scheme_type=e.readString(4),this.scheme_version=e.readUint32(),1&this.flags&&(this.scheme_uri=e.readString(this.size-this.hdr_size-8))})),d.createBoxCtor("sdp ",(function(e){this.sdptext=e.readString(this.size-this.hdr_size)})),d.createFullBoxCtor("sdtp",(function(e){var t,i=this.size-this.hdr_size;this.is_leading=[],this.sample_depends_on=[],this.sample_is_depended_on=[],this.sample_has_redundancy=[];for(var n=0;n<i;n++)t=e.readUint8(),this.is_leading[n]=t>>6,this.sample_depends_on[n]=t>>4&3,this.sample_is_depended_on[n]=t>>2&3,this.sample_has_redundancy[n]=3&t})),d.createFullBoxCtor("senc"),d.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i<t;i++){var n;n=d[this.grouping_type+"SampleGroupEntry"]?new d[this.grouping_type+"SampleGroupEntry"](this.grouping_type):new d.SampleGroupEntry(this.grouping_type),this.entries.push(n),1===this.version&&0===this.default_length?n.description_length=e.readUint32():n.description_length=this.default_length,n.write===d.SampleGroupEntry.prototype.write&&(a.info("BoxParser","SampleGroup for type "+this.grouping_type+" writing not yet implemented, keeping unparsed data in memory for later write"),n.data=e.readUint8Array(n.description_length),e.position-=n.description_length),n.parse(e)}})),d.createFullBoxCtor("sidx",(function(e){this.reference_ID=e.readUint32(),this.timescale=e.readUint32(),0===this.version?(this.earliest_presentation_time=e.readUint32(),this.first_offset=e.readUint32()):(this.earliest_presentation_time=e.readUint64(),this.first_offset=e.readUint64()),e.readUint16(),this.references=[];for(var t=e.readUint16(),i=0;i<t;i++){var n={};this.references.push(n);var r=e.readUint32();n.reference_type=r>>31&1,n.referenced_size=2147483647&r,n.subsegment_duration=e.readUint32(),r=e.readUint32(),n.starts_with_SAP=r>>31&1,n.SAP_type=r>>28&7,n.SAP_delta_time=268435455&r}})),d.SingleItemTypeReferenceBox=function(e,t,i,n){d.Box.call(this,e,t),this.hdr_size=i,this.start=n},d.SingleItemTypeReferenceBox.prototype=new d.Box,d.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i<t;i++)this.references[i]=e.readUint16()},d.SingleItemTypeReferenceBoxLarge=function(e,t,i,n){d.Box.call(this,e,t),this.hdr_size=i,this.start=n},d.SingleItemTypeReferenceBoxLarge.prototype=new d.Box,d.SingleItemTypeReferenceBoxLarge.prototype.parse=function(e){this.from_item_ID=e.readUint32();var t=e.readUint16();this.references=[];for(var i=0;i<t;i++)this.references[i]=e.readUint32()},d.createFullBoxCtor("SmDm",(function(e){this.primaryRChromaticity_x=e.readUint16(),this.primaryRChromaticity_y=e.readUint16(),this.primaryGChromaticity_x=e.readUint16(),this.primaryGChromaticity_y=e.readUint16(),this.primaryBChromaticity_x=e.readUint16(),this.primaryBChromaticity_y=e.readUint16(),this.whitePointChromaticity_x=e.readUint16(),this.whitePointChromaticity_y=e.readUint16(),this.luminanceMax=e.readUint32(),this.luminanceMin=e.readUint32()})),d.createFullBoxCtor("smhd",(function(e){this.balance=e.readUint16(),e.readUint16()})),d.createFullBoxCtor("ssix",(function(e){this.subsegments=[];for(var t=e.readUint32(),i=0;i<t;i++){var n={};this.subsegments.push(n),n.ranges=[];for(var r=e.readUint32(),a=0;a<r;a++){var s={};n.ranges.push(s),s.level=e.readUint8(),s.range_size=e.readUint24()}}})),d.createFullBoxCtor("stco",(function(e){var t;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(var i=0;i<t;i++)this.chunk_offsets.push(e.readUint32())})),d.createFullBoxCtor("stdp",(function(e){var t=(this.size-this.hdr_size)/2;this.priority=[];for(var i=0;i<t;i++)this.priority[i]=e.readUint16()})),d.createFullBoxCtor("sthd"),d.createFullBoxCtor("stri",(function(e){this.switch_group=e.readUint16(),this.alternate_group=e.readUint16(),this.sub_track_id=e.readUint32();var t=(this.size-this.hdr_size-8)/4;this.attribute_list=[];for(var i=0;i<t;i++)this.attribute_list[i]=e.readUint32()})),d.createFullBoxCtor("stsc",(function(e){var t,i;if(t=e.readUint32(),this.first_chunk=[],this.samples_per_chunk=[],this.sample_description_index=[],0===this.version)for(i=0;i<t;i++)this.first_chunk.push(e.readUint32()),this.samples_per_chunk.push(e.readUint32()),this.sample_description_index.push(e.readUint32())})),d.createFullBoxCtor("stsd",(function(e){var t,i,n,r;for(this.entries=[],n=e.readUint32(),t=1;t<=n;t++){if((i=d.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==d.OK)return;d[i.type+"SampleEntry"]?((r=new d[i.type+"SampleEntry"](i.size)).hdr_size=i.hdr_size,r.start=i.start):(a.warn("BoxParser","Unknown sample entry type: "+i.type),r=new d.SampleEntry(i.type,i.size,i.hdr_size,i.start)),r.write===d.SampleEntry.prototype.write&&(a.info("BoxParser","SampleEntry "+r.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),r.parseDataAndRewind(e)),r.parse(e),this.entries.push(r)}})),d.createFullBoxCtor("stsg",(function(e){this.grouping_type=e.readUint32();var t=e.readUint16();this.group_description_index=[];for(var i=0;i<t;i++)this.group_description_index[i]=e.readUint32()})),d.createFullBoxCtor("stsh",(function(e){var t,i;if(t=e.readUint32(),this.shadowed_sample_numbers=[],this.sync_sample_numbers=[],0===this.version)for(i=0;i<t;i++)this.shadowed_sample_numbers.push(e.readUint32()),this.sync_sample_numbers.push(e.readUint32())})),d.createFullBoxCtor("stss",(function(e){var t,i;if(i=e.readUint32(),0===this.version)for(this.sample_numbers=[],t=0;t<i;t++)this.sample_numbers.push(e.readUint32())})),d.createFullBoxCtor("stsz",(function(e){var t;if(this.sample_sizes=[],0===this.version)for(this.sample_size=e.readUint32(),this.sample_count=e.readUint32(),t=0;t<this.sample_count;t++)0===this.sample_size?this.sample_sizes.push(e.readUint32()):this.sample_sizes[t]=this.sample_size})),d.createFullBoxCtor("stts",(function(e){var t,i,n;if(t=e.readUint32(),this.sample_counts=[],this.sample_deltas=[],0===this.version)for(i=0;i<t;i++)this.sample_counts.push(e.readUint32()),(n=e.readInt32())<0&&(a.warn("BoxParser","File uses negative stts sample delta, using value 1 instead, sync may be lost!"),n=1),this.sample_deltas.push(n)})),d.createFullBoxCtor("stvi",(function(e){var t=e.readUint32();this.single_view_allowed=3&t,this.stereo_scheme=e.readUint32();var i,n,r=e.readUint32();for(this.stereo_indication_type=e.readString(r),this.boxes=[];e.getPosition()<this.start+this.size;){if((i=d.parseOneBox(e,!1,this.size-(e.getPosition()-this.start))).code!==d.OK)return;n=i.box,this.boxes.push(n),this[n.type]=n}})),d.createBoxCtor("styp",(function(e){d.ftypBox.prototype.parse.call(this,e)})),d.createFullBoxCtor("stz2",(function(e){var t,i;if(this.sample_sizes=[],0===this.version)if(this.reserved=e.readUint24(),this.field_size=e.readUint8(),i=e.readUint32(),4===this.field_size)for(t=0;t<i;t+=2){var n=e.readUint8();this.sample_sizes[t]=n>>4&15,this.sample_sizes[t+1]=15&n}else if(8===this.field_size)for(t=0;t<i;t++)this.sample_sizes[t]=e.readUint8();else if(16===this.field_size)for(t=0;t<i;t++)this.sample_sizes[t]=e.readUint16();else a.error("BoxParser","Error in length field in stz2 box")})),d.createFullBoxCtor("subs",(function(e){var t,i,n,r;for(n=e.readUint32(),this.entries=[],t=0;t<n;t++){var a={};if(this.entries[t]=a,a.sample_delta=e.readUint32(),a.subsamples=[],(r=e.readUint16())>0)for(i=0;i<r;i++){var s={};a.subsamples.push(s),1==this.version?s.size=e.readUint32():s.size=e.readUint16(),s.priority=e.readUint8(),s.discardable=e.readUint8(),s.codec_specific_parameters=e.readUint32()}}})),d.createFullBoxCtor("tenc",(function(e){if(e.readUint8(),0===this.version)e.readUint8();else{var t=e.readUint8();this.default_crypt_byte_block=t>>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=d.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),d.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),d.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&d.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),d.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),n=0;n<i;n++)1===this.version?(this.time=e.readUint64(),this.moof_offset=e.readUint64()):(this.time=e.readUint32(),this.moof_offset=e.readUint32()),this.traf_number=e["readUint"+8*(this.length_size_of_traf_num+1)](),this.trun_number=e["readUint"+8*(this.length_size_of_trun_num+1)](),this.sample_number=e["readUint"+8*(this.length_size_of_sample_num+1)]()})),d.createFullBoxCtor("tkhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.track_id=e.readUint32(),e.readUint32(),this.duration=e.readUint32()),e.readUint32Array(2),this.layer=e.readInt16(),this.alternate_group=e.readInt16(),this.volume=e.readInt16()>>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),d.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),d.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),d.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),d.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),d.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),d.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},d.createTrackGroupCtor("msrc"),d.TrackReferenceTypeBox=function(e,t,i,n){d.Box.call(this,e,t),this.hdr_size=i,this.start=n},d.TrackReferenceTypeBox.prototype=new d.Box,d.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},d.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()<this.start+this.size;){if((t=d.parseOneBox(e,!0,this.size-(e.getPosition()-this.start))).code!==d.OK)return;(i=new d.TrackReferenceTypeBox(t.type,t.size,t.hdr_size,t.start)).write===d.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","TrackReference "+i.type+" box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),this.boxes.push(i)}},d.createFullBoxCtor("trep",(function(e){for(this.track_ID=e.readUint32(),this.boxes=[];e.getPosition()<this.start+this.size;){if(ret=d.parseOneBox(e,!1,this.size-(e.getPosition()-this.start)),ret.code!==d.OK)return;box=ret.box,this.boxes.push(box)}})),d.createFullBoxCtor("trex",(function(e){this.track_id=e.readUint32(),this.default_sample_description_index=e.readUint32(),this.default_sample_duration=e.readUint32(),this.default_sample_size=e.readUint32(),this.default_sample_flags=e.readUint32()})),d.createBoxCtor("trpy",(function(e){this.bytessent=e.readUint64()})),d.createFullBoxCtor("trun",(function(e){var t=0;if(this.sample_count=e.readUint32(),t+=4,this.size-this.hdr_size>t&&this.flags&d.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&d.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i<this.sample_count;i++)this.flags&d.TRUN_FLAGS_DURATION&&(this.sample_duration[i]=e.readUint32()),this.flags&d.TRUN_FLAGS_SIZE&&(this.sample_size[i]=e.readUint32()),this.flags&d.TRUN_FLAGS_FLAGS&&(this.sample_flags[i]=e.readUint32()),this.flags&d.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?this.sample_composition_time_offset[i]=e.readUint32():this.sample_composition_time_offset[i]=e.readInt32())})),d.createFullBoxCtor("tsel",(function(e){this.switch_group=e.readUint32();var t=(this.size-this.hdr_size-4)/4;this.attribute_list=[];for(var i=0;i<t;i++)this.attribute_list[i]=e.readUint32()})),d.createFullBoxCtor("txtC",(function(e){this.config=e.readCString()})),d.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),d.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),d.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")})),d.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=d.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),d.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),d.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=d.parseHex16(e)})),d.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t<this.fragment_count;t++){var i={},n=0,r=0;1===this.version?(n=e.readUint64(),r=e.readUint64()):(n=e.readUint32(),r=e.readUint32()),i.absolute_time=n,i.absolute_duration=r,this.entries.push(i)}})),d.createUUIDBox("6d1d9b0542d544e680e2141daff757b2",!0,!1,(function(e){1===this.version?(this.absolute_time=e.readUint64(),this.duration=e.readUint64()):(this.absolute_time=e.readUint32(),this.duration=e.readUint32())})),d.createFullBoxCtor("vmhd",(function(e){this.graphicsmode=e.readUint16(),this.opcolor=e.readUint16Array(3)})),d.createFullBoxCtor("vpcC",(function(e){var t;1===this.version?(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),d.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),d.SampleEntry.prototype.isVideo=function(){return!1},d.SampleEntry.prototype.isAudio=function(){return!1},d.SampleEntry.prototype.isSubtitle=function(){return!1},d.SampleEntry.prototype.isMetadata=function(){return!1},d.SampleEntry.prototype.isHint=function(){return!1},d.SampleEntry.prototype.getCodec=function(){return this.type.replace(".","")},d.SampleEntry.prototype.getWidth=function(){return""},d.SampleEntry.prototype.getHeight=function(){return""},d.SampleEntry.prototype.getChannelCount=function(){return""},d.SampleEntry.prototype.getSampleRate=function(){return""},d.SampleEntry.prototype.getSampleSize=function(){return""},d.VisualSampleEntry.prototype.isVideo=function(){return!0},d.VisualSampleEntry.prototype.getWidth=function(){return this.width},d.VisualSampleEntry.prototype.getHeight=function(){return this.height},d.AudioSampleEntry.prototype.isAudio=function(){return!0},d.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count},d.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate},d.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize},d.SubtitleSampleEntry.prototype.isSubtitle=function(){return!0},d.MetadataSampleEntry.prototype.isMetadata=function(){return!0},d.decimalToHex=function(e,t){var i=Number(e).toString(16);for(t=null==t?t=2:t;i.length<t;)i="0"+i;return i},d.avc1SampleEntry.prototype.getCodec=d.avc2SampleEntry.prototype.getCodec=d.avc3SampleEntry.prototype.getCodec=d.avc4SampleEntry.prototype.getCodec=function(){var e=d.SampleEntry.prototype.getCodec.call(this);return this.avcC?e+"."+d.decimalToHex(this.avcC.AVCProfileIndication)+d.decimalToHex(this.avcC.profile_compatibility)+d.decimalToHex(this.avcC.AVCLevelIndication):e},d.hev1SampleEntry.prototype.getCodec=d.hvc1SampleEntry.prototype.getCodec=function(){var e,t=d.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){switch(t+=".",this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C"}t+=this.hvcC.general_profile_idc,t+=".";var i=this.hvcC.general_profile_compatibility,n=0;for(e=0;e<32&&(n|=1&i,31!=e);e++)n<<=1,i>>=1;t+=d.decimalToHex(n,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,a="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(a="."+d.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,r=!0);t+=a}return t},d.mp4aSampleEntry.prototype.getCodec=function(){var e=d.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+d.decimalToHex(t)+(i?"."+i:"")}return e},d.stxtSampleEntry.prototype.getCodec=function(){var e=d.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},d.av01SampleEntry.prototype.getCodec=function(){var e,t=d.SampleEntry.prototype.getCodec.call(this);return 2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+this.av1C.seq_level_idx_0+(this.av1C.seq_tier_0?"H":"M")+"."+e},d.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>u&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>u?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>u&&e.writeUint64(this.size)},d.FullBox.prototype.writeHeader=function(e){this.size+=4,d.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},d.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},d.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&(this.boxes[t].write(e),this.size+=this.boxes[t].size);a.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},d.TrackReferenceTypeBox.prototype.write=function(e){this.size=4*this.track_ids.length,this.writeHeader(e),e.writeUint32Array(this.track_ids)},d.avcCBox.prototype.write=function(e){var t;for(this.size=7,t=0;t<this.SPS.length;t++)this.size+=2+this.SPS[t].length;for(t=0;t<this.PPS.length;t++)this.size+=2+this.PPS[t].length;for(this.ext&&(this.size+=this.ext.length),this.writeHeader(e),e.writeUint8(this.configurationVersion),e.writeUint8(this.AVCProfileIndication),e.writeUint8(this.profile_compatibility),e.writeUint8(this.AVCLevelIndication),e.writeUint8(this.lengthSizeMinusOne+252),e.writeUint8(this.SPS.length+224),t=0;t<this.SPS.length;t++)e.writeUint16(this.SPS[t].length),e.writeUint8Array(this.SPS[t].nalu);for(e.writeUint8(this.PPS.length),t=0;t<this.PPS.length;t++)e.writeUint16(this.PPS[t].length),e.writeUint8Array(this.PPS[t].nalu);this.ext&&e.writeUint8Array(this.ext)},d.co64Box.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),t=0;t<this.chunk_offsets.length;t++)e.writeUint64(this.chunk_offsets[t])},d.cslgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeInt32(this.compositionToDTSShift),e.writeInt32(this.leastDecodeToDisplayDelta),e.writeInt32(this.greatestDecodeToDisplayDelta),e.writeInt32(this.compositionStartTime),e.writeInt32(this.compositionEndTime)},d.cttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),1===this.version?e.writeInt32(this.sample_offsets[t]):e.writeUint32(this.sample_offsets[t])},d.drefBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;a.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},d.elngBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.extended_language.length,this.writeHeader(e),e.writeString(this.extended_language)},d.elstBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+12*this.entries.length,this.writeHeader(e),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var i=this.entries[t];e.writeUint32(i.segment_duration),e.writeInt32(i.media_time),e.writeInt16(i.media_rate_integer),e.writeInt16(i.media_rate_fraction)}},d.emsgBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=16+this.message_data.length+(this.scheme_id_uri.length+1)+(this.value.length+1),this.writeHeader(e),e.writeCString(this.scheme_id_uri),e.writeCString(this.value),e.writeUint32(this.timescale),e.writeUint32(this.presentation_time_delta),e.writeUint32(this.event_duration),e.writeUint32(this.id),e.writeUint8Array(this.message_data)},d.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length,this.writeHeader(e),e.writeString(this.major_brand,null,4),e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++)e.writeString(this.compatible_brands[t],null,4)},d.hdlrBox.prototype.write=function(e){this.size=20+this.name.length+1,this.version=0,this.flags=0,this.writeHeader(e),e.writeUint32(0),e.writeString(this.handler,null,4),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeCString(this.name)},d.kindBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=this.schemeURI.length+1+(this.value.length+1),this.writeHeader(e),e.writeCString(this.schemeURI),e.writeCString(this.value)},d.mdhdBox.prototype.write=function(e){this.size=20,this.flags=0,this.version=0,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint16(this.language),e.writeUint16(0)},d.mehdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.fragment_duration)},d.mfhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,this.writeHeader(e),e.writeUint32(this.sequence_number)},d.mvhdBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=96,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.timescale),e.writeUint32(this.duration),e.writeUint32(this.rate),e.writeUint16(this.volume<<8),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32Array(this.matrix),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(this.next_track_id)},d.SampleEntry.prototype.writeHeader=function(e){this.size=8,d.Box.prototype.writeHeader.call(this,e),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint8(0),e.writeUint16(this.data_reference_index)},d.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e),this.size+=this.boxes[t].size;a.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},d.SampleEntry.prototype.write=function(e){this.writeHeader(e),e.writeUint8Array(this.data),this.size+=this.data.length,a.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},d.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=70,e.writeUint16(0),e.writeUint16(0),e.writeUint32(0),e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.width),e.writeUint16(this.height),e.writeUint32(this.horizresolution),e.writeUint32(this.vertresolution),e.writeUint32(0),e.writeUint16(this.frame_count),e.writeUint8(Math.min(31,this.compressorname.length)),e.writeString(this.compressorname,null,31),e.writeUint16(this.depth),e.writeInt16(-1),this.writeFooter(e)},d.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=20,e.writeUint32(0),e.writeUint32(0),e.writeUint16(this.channel_count),e.writeUint16(this.samplesize),e.writeUint16(0),e.writeUint16(0),e.writeUint32(this.samplerate<<16),this.writeFooter(e)},d.stppSampleEntry.prototype.write=function(e){this.writeHeader(e),this.size+=this.namespace.length+1+this.schema_location.length+1+this.auxiliary_mime_types.length+1,e.writeCString(this.namespace),e.writeCString(this.schema_location),e.writeCString(this.auxiliary_mime_types),this.writeFooter(e)},d.SampleGroupEntry.prototype.write=function(e){e.writeUint8Array(this.data)},d.sbgpBox.prototype.write=function(e){this.version=1,this.flags=0,this.size=12+8*this.entries.length,this.writeHeader(e),e.writeString(this.grouping_type,null,4),e.writeUint32(this.grouping_type_parameter),e.writeUint32(this.entries.length);for(var t=0;t<this.entries.length;t++){var i=this.entries[t];e.writeInt32(i.sample_count),e.writeInt32(i.group_description_index)}},d.sgpdBox.prototype.write=function(e){var t,i;for(this.flags=0,this.size=12,t=0;t<this.entries.length;t++)i=this.entries[t],1===this.version&&(0===this.default_length&&(this.size+=4),this.size+=i.data.length);for(this.writeHeader(e),e.writeString(this.grouping_type,null,4),1===this.version&&e.writeUint32(this.default_length),this.version>=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t<this.entries.length;t++)i=this.entries[t],1===this.version&&0===this.default_length&&e.writeUint32(i.description_length),i.write(e)},d.sidxBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20+12*this.references.length,this.writeHeader(e),e.writeUint32(this.reference_ID),e.writeUint32(this.timescale),e.writeUint32(this.earliest_presentation_time),e.writeUint32(this.first_offset),e.writeUint16(0),e.writeUint16(this.references.length);for(var t=0;t<this.references.length;t++){var i=this.references[t];e.writeUint32(i.reference_type<<31|i.referenced_size),e.writeUint32(i.subsegment_duration),e.writeUint32(i.starts_with_SAP<<31|i.SAP_type<<28|i.SAP_delta_time)}},d.stcoBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.chunk_offsets.length,this.writeHeader(e),e.writeUint32(this.chunk_offsets.length),e.writeUint32Array(this.chunk_offsets)},d.stscBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+12*this.first_chunk.length,this.writeHeader(e),e.writeUint32(this.first_chunk.length),t=0;t<this.first_chunk.length;t++)e.writeUint32(this.first_chunk[t]),e.writeUint32(this.samples_per_chunk[t]),e.writeUint32(this.sample_description_index[t])},d.stsdBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=0,this.writeHeader(e),e.writeUint32(this.entries.length),this.size+=4,t=0;t<this.entries.length;t++)this.entries[t].write(e),this.size+=this.entries[t].size;a.debug("BoxWriter","Adjusting box "+this.type+" with new size "+this.size),e.adjustUint32(this.sizePosition,this.size)},d.stshBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.shadowed_sample_numbers.length,this.writeHeader(e),e.writeUint32(this.shadowed_sample_numbers.length),t=0;t<this.shadowed_sample_numbers.length;t++)e.writeUint32(this.shadowed_sample_numbers[t]),e.writeUint32(this.sync_sample_numbers[t])},d.stssBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4+4*this.sample_numbers.length,this.writeHeader(e),e.writeUint32(this.sample_numbers.length),e.writeUint32Array(this.sample_numbers)},d.stszBox.prototype.write=function(e){var t,i=!0;if(this.version=0,this.flags=0,this.sample_sizes.length>0)for(t=0;t+1<this.sample_sizes.length;){if(this.sample_sizes[t+1]!==this.sample_sizes[0]){i=!1;break}t++}else i=!1;this.size=8,i||(this.size+=4*this.sample_sizes.length),this.writeHeader(e),i?e.writeUint32(this.sample_sizes[0]):e.writeUint32(0),e.writeUint32(this.sample_sizes.length),i||e.writeUint32Array(this.sample_sizes)},d.sttsBox.prototype.write=function(e){var t;for(this.version=0,this.flags=0,this.size=4+8*this.sample_counts.length,this.writeHeader(e),e.writeUint32(this.sample_counts.length),t=0;t<this.sample_counts.length;t++)e.writeUint32(this.sample_counts[t]),e.writeUint32(this.sample_deltas[t])},d.tfdtBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},d.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&d.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&d.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&d.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&d.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&d.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},d.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},d.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},d.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&d.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&d.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&d.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&d.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&d.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&d.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t<this.sample_count;t++)this.flags&d.TRUN_FLAGS_DURATION&&e.writeUint32(this.sample_duration[t]),this.flags&d.TRUN_FLAGS_SIZE&&e.writeUint32(this.sample_size[t]),this.flags&d.TRUN_FLAGS_FLAGS&&e.writeUint32(this.sample_flags[t]),this.flags&d.TRUN_FLAGS_CTS_OFFSET&&(0===this.version?e.writeUint32(this.sample_composition_time_offset[t]):e.writeInt32(this.sample_composition_time_offset[t]))},d["url Box"].prototype.write=function(e){this.version=0,this.location?(this.flags=0,this.size=this.location.length+1):(this.flags=1,this.size=0),this.writeHeader(e),this.location&&e.writeCString(this.location)},d["urn Box"].prototype.write=function(e){this.version=0,this.flags=0,this.size=this.name.length+1+(this.location?this.location.length+1:0),this.writeHeader(e),e.writeCString(this.name),this.location&&e.writeCString(this.location)},d.vmhdBox.prototype.write=function(e){this.version=0,this.flags=1,this.size=8,this.writeHeader(e),e.writeUint16(this.graphicsmode),e.writeUint16Array(this.opcolor)},d.cttsBox.prototype.unpack=function(e){var t,i,n;for(n=0,t=0;t<this.sample_counts.length;t++)for(i=0;i<this.sample_counts[t];i++)e[n].pts=e[n].dts+this.sample_offsets[t],n++},d.sttsBox.prototype.unpack=function(e){var t,i,n;for(n=0,t=0;t<this.sample_counts.length;t++)for(i=0;i<this.sample_counts[t];i++)e[n].dts=0===n?0:e[n-1].dts+this.sample_deltas[t],n++},d.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++)e[t].offset=this.chunk_offsets[t]},d.stscBox.prototype.unpack=function(e){var t,i,n,r,a;for(r=0,a=0,t=0;t<this.first_chunk.length;t++)for(i=0;i<(t+1<this.first_chunk.length?this.first_chunk[t+1]:1/0);i++)for(a++,n=0;n<this.samples_per_chunk[t];n++){if(!e[r])return;e[r].description_index=this.sample_description_index[t],e[r].chunk_index=a,r++}},d.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++)e[t].size=this.sample_sizes[t]},d.DIFF_BOXES_PROP_NAMES=["boxes","entries","references","subsamples","items","item_infos","extents","associations","subsegments","ranges","seekLists","seekPoints","esd","levels"],d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES=["compatible_brands","matrix","opcolor","sample_counts","sample_counts","sample_deltas","first_chunk","samples_per_chunk","sample_sizes","chunk_offsets","sample_offsets","sample_description_index","sample_duration"],d.boxEqualFields=function(e,t){if(e&&!t)return!1;var i;for(i in e)if(!(d.DIFF_BOXES_PROP_NAMES.indexOf(i)>-1||e[i]instanceof d.Box||t[i]instanceof d.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},d.boxEqual=function(e,t){if(!d.boxEqualFields(e,t))return!1;for(var i=0;i<d.DIFF_BOXES_PROP_NAMES.length;i++){var n=d.DIFF_BOXES_PROP_NAMES[i];if(e[n]&&t[n]&&!d.boxEqual(e[n],t[n]))return!1}return!0};var c=function(){};c.prototype.parseSample=function(e){var t,i,n=new s(e.buffer);for(t=[];!n.isEos();)(i=d.parseOneBox(n,!1)).code===d.OK&&"vttc"===i.box.type&&t.push(i.box);return t},c.prototype.getText=function(e,t,i){function n(e,t,i){return i=i||"0",(e+="").length>=t?e:new Array(t-e.length+1).join(i)+e}function r(e){var t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),r=Math.floor(e-3600*t-60*i),a=Math.floor(1e3*(e-3600*t-60*i-r));return n(t,2)+":"+n(i,2)+":"+n(r,2)+"."+n(a,3)}for(var a=this.parseSample(i),s="",o=0;o<a.length;o++){var u=a[o];s+=r(e)+" --\x3e "+r(t)+"\r\n",s+=u.payl.text}return s};var f=function(){};f.prototype.parseSample=function(e){var t,i={};i.resources=[];var n=new s(e.data.buffer);if(e.subsamples&&0!==e.subsamples.length){if(i.documentString=n.readString(e.subsamples[0].size),e.subsamples.length>1)for(t=1;t<e.subsamples.length;t++)i.resources[t]=n.readUint8Array(e.subsamples[t].size)}else i.documentString=n.readString(e.data.length);return"undefined"!=typeof DOMParser&&(i.document=(new DOMParser).parseFromString(i.documentString,"application/xml")),i};var p=function(){};p.prototype.parseSample=function(e){return new s(e.data.buffer).readString(e.data.length)},p.prototype.parseConfig=function(e){var t=new s(e.buffer);return t.readUint32(),t.readCString()},void 0!==i&&(i.XMLSubtitlein4Parser=f,i.Textin4Parser=p);var m=function(e){this.stream=e||new l,this.boxes=[],this.mdats=[],this.moofs=[],this.isProgressive=!1,this.moovStartFound=!1,this.onMoovStart=null,this.moovStartSent=!1,this.onReady=null,this.readySent=!1,this.onSegment=null,this.onSamples=null,this.onError=null,this.sampleListBuilt=!1,this.fragmentedTracks=[],this.extractedTracks=[],this.isFragmentationInitialized=!1,this.sampleProcessingStarted=!1,this.nextMoofNumber=0,this.itemListBuilt=!1,this.onSidx=null,this.sidxSent=!1};m.prototype.setSegmentOptions=function(e,t,i){var n=this.getTrackById(e);if(n){var r={};this.fragmentedTracks.push(r),r.id=e,r.user=t,r.trak=n,n.nextSample=0,r.segmentStream=null,r.nb_samples=1e3,r.rapAlignement=!0,i&&(i.nbSamples&&(r.nb_samples=i.nbSamples),i.rapAlignement&&(r.rapAlignement=i.rapAlignement))}},m.prototype.unsetSegmentOptions=function(e){for(var t=-1,i=0;i<this.fragmentedTracks.length;i++){this.fragmentedTracks[i].id==e&&(t=i)}t>-1&&this.fragmentedTracks.splice(t,1)},m.prototype.setExtractionOptions=function(e,t,i){var n=this.getTrackById(e);if(n){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=n,n.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},m.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i<this.extractedTracks.length;i++){this.extractedTracks[i].id==e&&(t=i)}t>-1&&this.extractedTracks.splice(t,1)},m.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=d.parseOneBox(this.stream,!1)).code===d.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&a.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},m.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},m.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},m.prototype.getInfo=function(){var e,t,i,n,r,a={},s=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(s+1e3*this.moov.mvhd.creation_time),a.modified=new Date(s+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e<this.moov.traks.length;e++){if(r=(i=this.moov.traks[e]).mdia.minf.stbl.stsd.entries[0],n={},a.tracks.push(n),n.id=i.tkhd.track_id,n.name=i.mdia.hdlr.name,n.references=[],i.tref)for(t=0;t<i.tref.boxes.length;t++)ref={},n.references.push(ref),ref.type=i.tref.boxes[t].type,ref.track_ids=i.tref.boxes[t].track_ids;i.edts&&(n.edits=i.edts.elst.entries),n.created=new Date(s+1e3*i.tkhd.creation_time),n.modified=new Date(s+1e3*i.tkhd.modification_time),n.movie_duration=i.tkhd.duration,n.movie_timescale=a.timescale,n.layer=i.tkhd.layer,n.alternate_group=i.tkhd.alternate_group,n.volume=i.tkhd.volume,n.matrix=i.tkhd.matrix,n.track_width=i.tkhd.width/65536,n.track_height=i.tkhd.height/65536,n.timescale=i.mdia.mdhd.timescale,n.cts_shift=i.mdia.minf.stbl.cslg,n.duration=i.mdia.mdhd.duration,n.samples_duration=i.samples_duration,n.codec=r.getCodec(),n.kind=i.udta&&i.udta.kinds.length?i.udta.kinds[0]:{schemeURI:"",value:""},n.language=i.mdia.elng?i.mdia.elng.extended_language:i.mdia.mdhd.languageString,n.nb_samples=i.samples.length,n.size=i.samples_size,n.bitrate=8*n.size*n.timescale/n.samples_duration,r.isAudio()?(n.type="audio",a.audioTracks.push(n),n.audio={},n.audio.sample_rate=r.getSampleRate(),n.audio.channel_count=r.getChannelCount(),n.audio.sample_size=r.getSampleSize()):r.isVideo()?(n.type="video",a.videoTracks.push(n),n.video={},n.video.width=r.getWidth(),n.video.height=r.getHeight()):r.isSubtitle()?(n.type="subtitles",a.subtitleTracks.push(n)):r.isHint()?(n.type="metadata",a.hintTracks.push(n)):r.isMetadata()?(n.type="metadata",a.metadataTracks.push(n)):(n.type="metadata",a.otherTracks.push(n))}else a.hasMoov=!1;if(a.mime="",a.hasMoov&&a.tracks){for(a.videoTracks&&a.videoTracks.length>0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e<a.tracks.length;e++)0!==e&&(a.mime+=","),a.mime+=a.tracks[e].codec;a.mime+='"; profiles="',a.mime+=this.ftyp.compatible_brands.join(),a.mime+='"'}return a},m.prototype.processSamples=function(e){var t,i;if(this.sampleProcessingStarted){if(this.isFragmentationInitialized&&null!==this.onSegment)for(t=0;t<this.fragmentedTracks.length;t++){var n=this.fragmentedTracks[t];for(i=n.trak;i.nextSample<i.samples.length&&this.sampleProcessingStarted;){a.debug("ISOFile","Creating media fragment on track #"+n.id+" for sample "+i.nextSample);var r=this.createFragment(n.id,i.nextSample,n.segmentStream);if(!r)break;if(n.segmentStream=r,i.nextSample++,(i.nextSample%n.nb_samples==0||e||i.nextSample>=i.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+n.id+" for samples ["+Math.max(0,i.nextSample-n.nb_samples)+","+(i.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(n.id,n.user,n.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),n.segmentStream=null,n!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t<this.extractedTracks.length;t++){var s=this.extractedTracks[t];for(i=s.trak;i.nextSample<i.samples.length&&this.sampleProcessingStarted;){a.debug("ISOFile","Exporting on track #"+s.id+" sample #"+i.nextSample);var o=this.getSample(i,i.nextSample);if(!o)break;if(i.nextSample++,s.samples.push(o),(i.nextSample%s.nb_samples==0||i.nextSample>=i.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},m.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},m.prototype.getBoxes=function(e,t){var i=[];return m._sweep.call(this,e,i,t),i},m._sweep=function(e,t,i){for(var n in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;m._sweep.call(this.boxes[n],e,t,i)}},m.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},m.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},m.prototype.releaseUsedSamples=function(e,t){var i=0,n=this.getTrackById(e);n.lastValidSample||(n.lastValidSample=0);for(var r=n.lastValidSample;r<t;r++)i+=this.releaseSample(n,r);a.info("ISOFile","Track #"+e+" released samples up to "+t+" (released size: "+i+", remaining: "+this.samplesDataSize+")"),n.lastValidSample=t},m.prototype.start=function(){this.sampleProcessingStarted=!0,this.processSamples(!1)},m.prototype.stop=function(){this.sampleProcessingStarted=!1},m.prototype.flush=function(){a.info("ISOFile","Flushing remaining samples"),this.updateSampleLists(),this.processSamples(!0),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0)},m.prototype.seekTrack=function(e,t,i){var n,r,s,o,u=0,l=0;if(0===i.samples.length)return a.info("ISOFile","No sample in track, cannot seek! Using time "+a.getDurationString(0,1)+" and offset: 0"),{offset:0,time:0};for(n=0;n<i.samples.length;n++){if(r=i.samples[n],0===n)l=0,o=r.timescale;else if(r.cts>e*r.timescale){l=n-1;break}t&&r.is_sync&&(u=n)}for(t&&(l=u),e=i.samples[l].cts,i.nextSample=l;i.samples[l].alreadyRead===i.samples[l].size&&i.samples[l+1];)l++;return s=i.samples[l].offset+i.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},m.prototype.seek=function(e,t){var i,n,r,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(r=0;r<s.traks.length;r++)i=s.traks[r],(n=this.seekTrack(e,t,i)).offset<o.offset&&(o.offset=n.offset),n.time<o.time&&(o.time=n.time);return a.info("ISOFile","Seeking at time "+a.getDurationString(o.time,1)+" needs a buffer with a fileStart position of "+o.offset),o.offset===1/0?o={offset:this.nextParsePosition,time:0}:o.offset=this.stream.getEndFilePositionAfter(o.offset),a.info("ISOFile","Adjusted seek position (after checking data already in buffer): "+o.offset),o}throw"Cannot seek: moov not received!"},m.prototype.equal=function(e){for(var t=0;t<this.boxes.length&&t<e.boxes.length;){var i=this.boxes[t],n=e.boxes[t];if(!d.boxEqual(i,n))return!1;t++}return!0},void 0!==i&&(i.ISOFile=m),m.prototype.lastBoxStartPosition=0,m.prototype.parsingMdat=null,m.prototype.nextParsePosition=0,m.prototype.discardMdatData=!1,m.prototype.processIncompleteBox=function(e){var t;return"mdat"===e.type?(t=new d[e.type+"Box"](e.size),this.parsingMdat=t,this.boxes.push(t),this.mdats.push(t),t.start=e.start,t.hdr_size=e.hdr_size,this.stream.addUsedBytes(t.hdr_size),this.lastBoxStartPosition=t.start+t.size,this.stream.seek(t.start+t.size,!1,this.discardMdatData)?(this.parsingMdat=null,!0):(this.moovStartFound?this.nextParsePosition=this.stream.findEndContiguousBuf():this.nextParsePosition=t.start+t.size,!1)):("moov"===e.type&&(this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0)),!!this.stream.mergeNextBuffer&&this.stream.mergeNextBuffer()?(this.nextParsePosition=this.stream.getEndPosition(),!0):(e.type?this.moovStartFound?this.nextParsePosition=this.stream.getEndPosition():this.nextParsePosition=this.stream.getPosition()+e.size:this.nextParsePosition=this.stream.getEndPosition(),!1))},m.prototype.hasIncompleteMdat=function(){return null!==this.parsingMdat},m.prototype.processIncompleteMdat=function(){var e;return e=this.parsingMdat,this.stream.seek(e.start+e.size,!1,this.discardMdatData)?(a.debug("ISOFile","Found 'mdat' end in buffered data"),this.parsingMdat=null,!0):(this.nextParsePosition=this.stream.findEndContiguousBuf(),!1)},m.prototype.restoreParsePosition=function(){return this.stream.seek(this.lastBoxStartPosition,!0,this.discardMdatData)},m.prototype.saveParsePosition=function(){this.lastBoxStartPosition=this.stream.getPosition()},m.prototype.updateUsedBytes=function(e,t){this.stream.addUsedBytes&&("mdat"===e.type?(this.stream.addUsedBytes(e.hdr_size),this.discardMdatData&&this.stream.addUsedBytes(e.size-e.hdr_size)):this.stream.addUsedBytes(e.size))},m.prototype.add=d.Box.prototype.add,m.prototype.addBox=d.Box.prototype.addBox,m.prototype.init=function(e){var t=e||{},i=(this.add("ftyp").set("major_brand",t.brands&&t.brands[0]||"iso4").set("minor_version",0).set("compatible_brands",t.brands||["iso4"]),this.add("moov"));return i.add("mvhd").set("timescale",t.timescale||600).set("rate",t.rate||1).set("creation_time",0).set("modification_time",0).set("duration",t.duration||0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("next_track_id",1),i.add("mvex"),this},m.prototype.addTrack=function(e){this.moov||this.init(e);var t=e||{};t.width=t.width||320,t.height=t.height||320,t.id=t.id||this.moov.mvhd.next_track_id,t.type=t.type||"avc1";var i=this.moov.add("trak");this.moov.mvhd.next_track_id=t.id+1,i.add("tkhd").set("flags",d.TKHD_FLAG_ENABLED|d.TKHD_FLAG_IN_MOVIE|d.TKHD_FLAG_IN_PREVIEW).set("creation_time",0).set("modification_time",0).set("track_id",t.id).set("duration",t.duration||0).set("layer",t.layer||0).set("alternate_group",0).set("volume",1).set("matrix",[0,0,0,0,0,0,0,0,0]).set("width",t.width).set("height",t.height);var n=i.add("mdia");n.add("mdhd").set("creation_time",0).set("modification_time",0).set("timescale",t.timescale||1).set("duration",t.media_duration||0).set("language",t.language||0),n.add("hdlr").set("handler",t.hdlr||"vide").set("name",t.name||"Track created with MP4Box.js"),n.add("elng").set("extended_language",t.language||"fr-FR");var r=n.add("minf");if(void 0!==d[t.type+"SampleEntry"]){var a=new d[t.type+"SampleEntry"];a.data_reference_index=1;var s="";for(var o in d.sampleEntryCodes)for(var u=d.sampleEntryCodes[o],l=0;l<u.length;l++)if(u.indexOf(t.type)>-1){s=o;break}switch(s){case"Visual":r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24);break;case"Audio":r.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":switch(r.add("sthd"),t.type){case"stpp":a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"")}break;case"Metadata":case"System":default:r.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),r.add("dinf").add("dref").addEntry((new d["url Box"]).set("flags",1));var h=r.add("stbl");return h.add("stsd").addEntry(a),h.add("stts").set("sample_counts",[]).set("sample_deltas",[]),h.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),h.add("stco").set("chunk_offsets",[]),h.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},d.Box.prototype.computeSize=function(e){var t=e||new o;t.endianness=o.BIG_ENDIAN,this.write(t)},m.prototype.addSample=function(e,t,i){var n=i||{},r={},a=this.getTrackById(e);if(null!==a){r.number=a.samples.length,r.track_id=a.tkhd.track_id,r.timescale=a.mdia.mdhd.timescale,r.description_index=n.sample_description_index?n.sample_description_index-1:0,r.description=a.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.length,r.alreadyRead=r.size,r.duration=n.duration||1,r.cts=n.cts||0,r.dts=n.dts||0,r.is_sync=n.is_sync||!1,r.is_leading=n.is_leading||0,r.depends_on=n.depends_on||0,r.is_depended_on=n.is_depended_on||0,r.has_redundancy=n.has_redundancy||0,r.degradation_priority=n.degradation_priority||0,r.offset=0,r.subsamples=n.subsamples,a.samples.push(r),a.samples_size+=r.size,a.samples_duration+=r.duration,this.processSamples();var s=m.createSingleSampleMoof(r);return this.addBox(s),s.computeSize(),s.trafs[0].truns[0].data_offset=s.size+8,this.add("mdat").data=t,r}},m.createSingleSampleMoof=function(e){var t=new d.moofBox;t.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=t.add("traf");return i.add("tfhd").set("track_id",e.track_id).set("flags",d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts),i.add("trun").set("flags",d.TRUN_FLAGS_DATA_OFFSET|d.TRUN_FLAGS_DURATION|d.TRUN_FLAGS_SIZE|d.TRUN_FLAGS_FLAGS|d.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[0]).set("sample_composition_time_offset",[e.cts-e.dts]),t},m.prototype.lastMoofIndex=0,m.prototype.samplesDataSize=0,m.prototype.resetTables=function(){var e,t,i,n,r,a;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e<this.moov.traks.length;e++){(t=this.moov.traks[e]).tkhd.duration=0,t.mdia.mdhd.duration=0,(t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64).chunk_offsets=[],(i=t.mdia.minf.stbl.stsc).first_chunk=[],i.samples_per_chunk=[],i.sample_description_index=[],(t.mdia.minf.stbl.stsz||t.mdia.minf.stbl.stz2).sample_sizes=[],(n=t.mdia.minf.stbl.stts).sample_counts=[],n.sample_deltas=[],(r=t.mdia.minf.stbl.ctts)&&(r.sample_counts=[],r.sample_offsets=[]),a=t.mdia.minf.stbl.stss;var s=t.mdia.minf.stbl.boxes.indexOf(a);-1!=s&&(t.mdia.minf.stbl.boxes[s]=null)}},m.initSampleGroups=function(e,t,i,n,r){var a,s,o,u;function l(e,t,i){this.grouping_type=e,this.grouping_type_parameter=t,this.sbgp=i,this.last_sample_in_run=-1,this.entry_index=-1}for(t&&(t.sample_groups_info=[]),e.sample_groups_info||(e.sample_groups_info=[]),s=0;s<i.length;s++){for(u=i[s].grouping_type+"/"+i[s].grouping_type_parameter,o=new l(i[s].grouping_type,i[s].grouping_type_parameter,i[s]),t&&(t.sample_groups_info[u]=o),e.sample_groups_info[u]||(e.sample_groups_info[u]=o),a=0;a<n.length;a++)n[a].grouping_type===i[s].grouping_type&&(o.description=n[a],o.description.used=!0);if(r)for(a=0;a<r.length;a++)r[a].grouping_type===i[s].grouping_type&&(o.fragment_description=r[a],o.fragment_description.used=!0,o.is_fragment=!0)}if(t){if(r)for(s=0;s<r.length;s++)!r[s].used&&r[s].version>=2&&(u=r[s].grouping_type+"/0",(o=new l(r[s].grouping_type,0)).is_fragment=!0,t.sample_groups_info[u]||(t.sample_groups_info[u]=o))}else for(s=0;s<n.length;s++)!n[s].used&&n[s].version>=2&&(u=n[s].grouping_type+"/0",o=new l(n[s].grouping_type,0),e.sample_groups_info[u]||(e.sample_groups_info[u]=o))},m.setSampleGroupProperties=function(e,t,i,n){var r,a;for(r in t.sample_groups=[],n){var s;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=n[r].grouping_type,t.sample_groups[r].grouping_type_parameter=n[r].grouping_type_parameter,i>=n[r].last_sample_in_run&&(n[r].last_sample_in_run<0&&(n[r].last_sample_in_run=0),n[r].entry_index++,n[r].entry_index<=n[r].sbgp.entries.length-1&&(n[r].last_sample_in_run+=n[r].sbgp.entries[n[r].entry_index].sample_count)),n[r].entry_index<=n[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=n[r].sbgp.entries[n[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)s=n[r].fragment_description?n[r].fragment_description:n[r].description,t.sample_groups[r].group_description_index>0?(a=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,s&&a>=0&&(t.sample_groups[r].description=s.entries[a])):s&&s.version>=2&&s.default_group_description_index>0&&(t.sample_groups[r].description=s.entries[s.default_group_description_index-1])}},m.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},m.prototype.buildSampleLists=function(){var e,t;for(e=0;e<this.moov.traks.length;e++)t=this.moov.traks[e],this.buildTrakSampleLists(t)},m.prototype.buildTrakSampleLists=function(e){var t,i,n,r,a,s,o,u,l,h,d,c,f,p,_,g,v,y,b,S,T,E,w,A;if(e.samples=[],e.samples_duration=0,e.samples_size=0,i=e.mdia.minf.stbl.stco||e.mdia.minf.stbl.co64,n=e.mdia.minf.stbl.stsc,r=e.mdia.minf.stbl.stsz||e.mdia.minf.stbl.stz2,a=e.mdia.minf.stbl.stts,s=e.mdia.minf.stbl.ctts,o=e.mdia.minf.stbl.stss,u=e.mdia.minf.stbl.stsd,l=e.mdia.minf.stbl.subs,c=e.mdia.minf.stbl.stdp,h=e.mdia.minf.stbl.sbgps,d=e.mdia.minf.stbl.sgpds,y=-1,b=-1,S=-1,T=-1,E=0,w=0,A=0,m.initSampleGroups(e,null,h,d),void 0!==r){for(t=0;t<r.sample_sizes.length;t++){var C={};C.number=t,C.track_id=e.tkhd.track_id,C.timescale=e.mdia.mdhd.timescale,C.alreadyRead=0,e.samples[t]=C,C.size=r.sample_sizes[t],e.samples_size+=C.size,0===t?(p=1,f=0,C.chunk_index=p,C.chunk_run_index=f,v=n.samples_per_chunk[f],g=0,_=f+1<n.first_chunk.length?n.first_chunk[f+1]-1:1/0):t<v?(C.chunk_index=p,C.chunk_run_index=f):(p++,C.chunk_index=p,g=0,p<=_||(_=++f+1<n.first_chunk.length?n.first_chunk[f+1]-1:1/0),C.chunk_run_index=f,v+=n.samples_per_chunk[f]),C.description_index=n.sample_description_index[C.chunk_run_index]-1,C.description=u.entries[C.description_index],C.offset=i.chunk_offsets[C.chunk_index-1]+g,g+=C.size,t>y&&(b++,y<0&&(y=0),y+=a.sample_counts[b]),t>0?(e.samples[t-1].duration=a.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,C.dts=e.samples[t-1].dts+e.samples[t-1].duration):C.dts=0,s?(t>=S&&(T++,S<0&&(S=0),S+=s.sample_counts[T]),C.cts=e.samples[t].dts+s.sample_offsets[T]):C.cts=C.dts,o?(t==o.sample_numbers[E]-1?(C.is_sync=!0,E++):(C.is_sync=!1,C.degradation_priority=0),l&&l.entries[w].sample_delta+A==t+1&&(C.subsamples=l.entries[w].subsamples,A+=l.entries[w].sample_delta,w++)):C.is_sync=!0,m.process_sdtp(e.mdia.minf.stbl.sdtp,C,C.number),C.degradation_priority=c?c.priority[t]:0,l&&l.entries[w].sample_delta+A==t&&(C.subsamples=l.entries[w].subsamples,A+=l.entries[w].sample_delta),(h.length>0||d.length>0)&&m.setSampleGroupProperties(e,C,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},m.prototype.updateSampleLists=function(){var e,t,i,n,r,a,s,o,u,l,h,c,f,p,_;if(void 0!==this.moov)for(;this.lastMoofIndex<this.moofs.length;)if(u=this.moofs[this.lastMoofIndex],this.lastMoofIndex++,"moof"==u.type)for(l=u,e=0;e<l.trafs.length;e++){for(h=l.trafs[e],c=this.getTrackById(h.tfhd.track_id),f=this.getTrexById(h.tfhd.track_id),n=h.tfhd.flags&d.TFHD_FLAG_SAMPLE_DESC?h.tfhd.default_sample_description_index:f?f.default_sample_description_index:1,r=h.tfhd.flags&d.TFHD_FLAG_SAMPLE_DUR?h.tfhd.default_sample_duration:f?f.default_sample_duration:0,a=h.tfhd.flags&d.TFHD_FLAG_SAMPLE_SIZE?h.tfhd.default_sample_size:f?f.default_sample_size:0,s=h.tfhd.flags&d.TFHD_FLAG_SAMPLE_FLAGS?h.tfhd.default_sample_flags:f?f.default_sample_flags:0,h.sample_number=0,h.sbgps.length>0&&m.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t<h.truns.length;t++){var g=h.truns[t];for(i=0;i<g.sample_count;i++){(p={}).moof_number=this.lastMoofIndex,p.number_in_traf=h.sample_number,h.sample_number++,p.number=c.samples.length,h.first_sample_index=c.samples.length,c.samples.push(p),p.track_id=c.tkhd.track_id,p.timescale=c.mdia.mdhd.timescale,p.description_index=n-1,p.description=c.mdia.minf.stbl.stsd.entries[p.description_index],p.size=a,g.flags&d.TRUN_FLAGS_SIZE&&(p.size=g.sample_size[i]),c.samples_size+=p.size,p.duration=r,g.flags&d.TRUN_FLAGS_DURATION&&(p.duration=g.sample_duration[i]),c.samples_duration+=p.duration,c.first_traf_merged||i>0?p.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?p.dts=h.tfdt.baseMediaDecodeTime:p.dts=0,c.first_traf_merged=!0),p.cts=p.dts,g.flags&d.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+g.sample_composition_time_offset[i]),_=s,g.flags&d.TRUN_FLAGS_FLAGS?_=g.sample_flags[i]:0===i&&g.flags&d.TRUN_FLAGS_FIRST_FLAG&&(_=g.first_sample_flags),p.is_sync=!(_>>16&1),p.is_leading=_>>26&3,p.depends_on=_>>24&3,p.is_depended_on=_>>22&3,p.has_redundancy=_>>20&3,p.degradation_priority=65535&_;var v=!!(h.tfhd.flags&d.TFHD_FLAG_BASE_DATA_OFFSET),y=!!(h.tfhd.flags&d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(g.flags&d.TRUN_FLAGS_DATA_OFFSET),S=0;S=v?h.tfhd.base_data_offset:y||0===t?l.start:o,p.offset=0===t&&0===i?b?S+g.data_offset:S:o,o=p.offset+p.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&m.setSampleGroupProperties(c,p,p.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var T=h.first_sample_index;for(t=0;t<h.subs.entries.length;t++)T+=h.subs.entries[t].sample_delta,(p=c.samples[T-1]).subsamples=h.subs.entries[t].subsamples}}},m.prototype.getSample=function(e,t){var i,n=e.samples[t];if(!this.moov)return null;if(n.data){if(n.alreadyRead==n.size)return n}else n.data=new Uint8Array(n.size),n.alreadyRead=0,this.samplesDataSize+=n.size,a.debug("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+n.size+" (total: "+this.samplesDataSize+")");for(;;){var r=this.stream.findPosition(!0,n.offset+n.alreadyRead,!1);if(!(r>-1))return null;var s=(i=this.stream.buffers[r]).byteLength-(n.offset+n.alreadyRead-i.fileStart);if(n.size-n.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-i.fileStart)+" read size: "+(n.size-n.alreadyRead)+" full size: "+n.size+")"),o.memcpy(n.data.buffer,n.alreadyRead,i,n.offset+n.alreadyRead-i.fileStart,n.size-n.alreadyRead),i.usedBytes+=n.size-n.alreadyRead,this.stream.logBufferLevel(),n.alreadyRead=n.size,n;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-i.fileStart)+" read size: "+s+" full size: "+n.size+")"),o.memcpy(n.data.buffer,n.alreadyRead,i,n.offset+n.alreadyRead-i.fileStart,s),n.alreadyRead+=s,i.usedBytes+=s,this.stream.logBufferLevel()}},m.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},m.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},m.prototype.getCodecs=function(){var e,t="";for(e=0;e<this.moov.traks.length;e++){e>0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},m.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t<this.moov.mvex.trexs.length;t++){var i=this.moov.mvex.trexs[t];if(i.track_id==e)return i}return null},m.prototype.getTrackById=function(e){if(void 0===this.moov)return null;for(var t=0;t<this.moov.traks.length;t++){var i=this.moov.traks[t];if(i.tkhd.track_id==e)return i}return null},m.prototype.items=[],m.prototype.itemsDataSize=0,m.prototype.flattenItemInfo=function(){var e,t,i,n=this.items,r=this.meta;if(null!=r&&void 0!==r.hdlr&&void 0!==r.iinf){for(e=0;e<r.iinf.item_infos.length;e++)(i={}).id=r.iinf.item_infos[e].item_ID,n[i.id]=i,i.ref_to=[],i.name=r.iinf.item_infos[e].item_name,r.iinf.item_infos[e].protection_index>0&&(i.protection=r.ipro.protections[r.iinf.item_infos[e].protection_index-1]),r.iinf.item_infos[e].item_type?i.type=r.iinf.item_infos[e].item_type:i.type="mime",i.content_type=r.iinf.item_infos[e].content_type,i.content_encoding=r.iinf.item_infos[e].content_encoding;if(r.iloc)for(e=0;e<r.iloc.items.length;e++){var s=r.iloc.items[e];switch(i=n[s.item_ID],0!==s.data_reference_index&&(a.warn("Item storage with reference to other files: not supported"),i.source=r.dinf.boxes[s.data_reference_index-1]),s.construction_method){case 0:break;case 1:case 2:a.warn("Item storage with construction_method : not supported")}for(i.extents=[],i.size=0,t=0;t<s.extents.length;t++)i.extents[t]={},i.extents[t].offset=s.extents[t].extent_offset+s.base_offset,i.extents[t].length=s.extents[t].extent_length,i.extents[t].alreadyRead=0,i.size+=i.extents[t].length}if(r.pitm&&(n[r.pitm.item_id].primary=!0),r.iref)for(e=0;e<r.iref.references.length;e++){var o=r.iref.references[e];for(t=0;t<o.references.length;t++)n[o.from_item_ID].ref_to.push({type:o.type,id:o.references[t]})}if(r.iprp)for(var u=0;u<r.iprp.ipmas.length;u++){var l=r.iprp.ipmas[u];for(e=0;e<l.associations.length;e++){var h=l.associations[e];for(void 0===(i=n[h.id]).properties&&(i.properties={},i.properties.boxes=[]),t=0;t<h.props.length;t++){var d=h.props[t];if(d.property_index>0){var c=r.iprp.ipco.boxes[d.property_index-1];i.properties[c.type]=c,i.properties.boxes.push(c)}}}}}},m.prototype.getItem=function(e){var t,i;if(!this.meta)return null;if(!(i=this.items[e]).data&&i.size)i.data=new Uint8Array(i.size),i.alreadyRead=0,this.itemsDataSize+=i.size,a.debug("ISOFile","Allocating item #"+e+" of size "+i.size+" (total: "+this.itemsDataSize+")");else if(i.alreadyRead===i.size)return i;for(var n=0;n<i.extents.length;n++){var r=i.extents[n];if(r.alreadyRead!==r.length){var s=this.stream.findPosition(!0,r.offset+r.alreadyRead,!1);if(!(s>-1))return null;var u=(t=this.stream.buffers[s]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=u))return a.debug("ISOFile","Getting item #"+e+" extent #"+n+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+u+" full extent size: "+r.length+" full item size: "+i.size+")"),o.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,u),r.alreadyRead+=u,i.alreadyRead+=u,t.usedBytes+=u,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+n+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),o.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},m.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i<t.extents.length;i++){t.extents[i].alreadyRead=0}return t.size}return 0},m.prototype.processItems=function(e){for(var t in this.items){var i=this.items[t];this.getItem(i.id),e&&!i.sent&&(e(i),i.sent=!0,i.data=null)}},m.prototype.hasItem=function(e){for(var t in this.items){var i=this.items[t];if(i.name===e)return i.id}return-1},m.prototype.getMetaHandler=function(){return this.meta?this.meta.hdlr.handler:null},m.prototype.getPrimaryItem=function(){return this.meta&&this.meta.pitm?this.getItem(this.meta.pitm.item_id):null},m.prototype.itemToFragmentedTrackFile=function(e){var t=e||{},i=null;if(null==(i=t.itemId?this.getItem(t.itemId):this.getPrimaryItem()))return null;var n=new m;n.discardMdatData=!1;var r={type:i.type,description_boxes:i.properties.boxes};i.properties.ispe&&(r.width=i.properties.ispe.image_width,r.height=i.properties.ispe.image_height);var a=n.addTrack(r);return a?(n.addSample(a,i.data),n):null},m.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++)this.boxes[t].write(e)},m.prototype.createFragment=function(e,t,i){var n=this.getTrackById(e),r=this.getSample(n,t);if(null==r)return r=n.samples[t],this.nextSeekPosition?this.nextSeekPosition=Math.min(r.offset+r.alreadyRead,this.nextSeekPosition):this.nextSeekPosition=n.samples[t].offset+r.alreadyRead,null;var s=i||new o;s.endianness=o.BIG_ENDIAN;var u=m.createSingleSampleMoof(r);u.write(s),u.trafs[0].truns[0].data_offset=u.size+8,a.debug("MP4Box","Adjusting data_offset with new value "+u.trafs[0].truns[0].data_offset),s.adjustUint32(u.trafs[0].truns[0].data_offset_position,u.trafs[0].truns[0].data_offset);var l=new d.mdatBox;return l.data=r.data,l.write(s),s},m.writeInitializationSegment=function(e,t,i,n){var r;a.debug("ISOFile","Generating initialization segment");var s=new o;s.endianness=o.BIG_ENDIAN,e.write(s);var u=t.add("mvex");for(i&&u.add("mehd").set("fragment_duration",i),r=0;r<t.traks.length;r++)u.add("trex").set("track_id",t.traks[r].tkhd.track_id).set("default_sample_description_index",1).set("default_sample_duration",n).set("default_sample_size",0).set("default_sample_flags",65536);return t.write(s),s.buffer},m.prototype.save=function(e){var t=new o;t.endianness=o.BIG_ENDIAN,this.write(t),t.save(e)},m.prototype.getBuffer=function(){var e=new o;return e.endianness=o.BIG_ENDIAN,this.write(e),e.buffer},m.prototype.initializeSegmentation=function(){var e,t,i,n;for(null===this.onSegment&&a.warn("MP4Box","No segmentation callback set!"),this.isFragmentationInitialized||(this.isFragmentationInitialized=!0,this.nextMoofNumber=0,this.resetTables()),t=[],e=0;e<this.fragmentedTracks.length;e++){var r=new d.moovBox;r.mvhd=this.moov.mvhd,r.boxes.push(r.mvhd),i=this.getTrackById(this.fragmentedTracks[e].id),r.boxes.push(i),r.traks.push(i),(n={}).id=i.tkhd.track_id,n.user=this.fragmentedTracks[e].user,n.buffer=m.writeInitializationSegment(this.ftyp,r,this.moov.mvex&&this.moov.mvex.mehd?this.moov.mvex.mehd.fragment_duration:void 0,this.moov.traks[e].samples.length>0?this.moov.traks[e].samples[0].duration:0),t.push(n)}return t},d.Box.prototype.printHeader=function(e){this.size+=8,this.size>u&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},d.FullBox.prototype.printHeader=function(e){this.size+=4,d.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},d.Box.prototype.print=function(e){this.printHeader(e)},d.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t<this.boxes.length;t++)if(this.boxes[t]){var i=e.indent;e.indent+=" ",this.boxes[t].print(e),e.indent=i}},m.prototype.print=function(e){e.indent="";for(var t=0;t<this.boxes.length;t++)this.boxes[t]&&this.boxes[t].print(e)},d.mvhdBox.prototype.print=function(e){d.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"timescale: "+this.timescale),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"rate: "+this.rate),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},d.tkhdBox.prototype.print=function(e){d.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var _={createFile:function(e,t){var i=void 0===e||e,n=new m(t);return n.discardMdatData=!i,n}};void 0!==i&&(i.createFile=_.createFile)},{}],40:[function(e,t,i){
-/*! @name mpd-parser @version 0.19.0 @license Apache-2.0 */
-"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e("@videojs/vhs-utils/cjs/resolve-url"),r=e("global/window"),a=e("@videojs/vhs-utils/cjs/decode-b64-to-uint8-array"),s=e("@xmldom/xmldom");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(n),l=o(r),h=o(a),d=function(e){return!!e&&"object"==typeof e},c=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce((function(t,i){return"object"!=typeof i||Object.keys(i).forEach((function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):d(t[n])&&d(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]})),t}),{})},f=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},p=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},m="INVALID_NUMBER_OF_PERIOD",_="DASH_EMPTY_MANIFEST",g="DASH_INVALID_XML",v="NO_BASE_URL",y="SEGMENT_TIME_UNSPECIFIED",b="UNSUPPORTED_UTC_TIMING_SCHEME",S=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,a=e.range,s=void 0===a?"":a,o=e.indexRange,l=void 0===o?"":o,h={uri:r,resolvedUri:u.default(i||"",r)};if(s||l){var d=(s||l).split("-"),c=parseInt(d[0],10),f=parseInt(d[1],10);h.byterange={length:f-c+1,offset:c}}return h},T=function(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e},E={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration,a=e.periodDuration,s=T(e.endNumber),o=t/n;return"number"==typeof s?{start:0,end:s}:"number"==typeof a?{start:0,end:a/o}:{start:0,end:r/o}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.start,u=void 0===o?0:o,l=e.minimumUpdatePeriod,h=void 0===l?0:l,d=e.timeShiftBufferDepth,c=void 0===d?1/0:d,f=T(e.endNumber),p=(t+i)/1e3,m=n+u,_=p+h-m,g=Math.ceil(_*a/s),v=Math.floor((p-m-c)*a/s),y=Math.floor((p-m)*a/s);return{start:Math.max(0,v),end:"number"==typeof f?f:Math.min(g,y)}}},w=function(e){var t=e.type,i=e.duration,n=e.timescale,r=void 0===n?1:n,a=e.periodDuration,s=e.sourceDuration,o=E[t](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(e){return function(t,i){var n=e.duration,r=e.timescale,a=void 0===r?1:r,s=e.periodIndex,o=e.startNumber;return{number:(void 0===o?1:o)+t,duration:n/a,timeline:s,time:i*n}}}(e));if("static"===t){var l=u.length-1,h="number"==typeof a?a:s;u[l].duration=h-i/r*l}return u},A=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,a=e.indexRange,s=void 0===a?"":a,o=e.duration;if(!t)throw new Error(v);var u=S({baseUrl:t,source:n.sourceURL,range:n.range}),l=S({baseUrl:t,source:t,indexRange:s});if(l.map=u,o){var h=w(e);h.length&&(l.duration=h[0].duration,l.timeline=h[0].timeline)}else r&&(l.duration=r,l.timeline=0);return l.number=0,[l]},C=function(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,a=e.timeline||0,s=e.sidx.byterange,o=s.offset+s.length,u=t.timescale,l=t.references.filter((function(e){return 1!==e.referenceType})),h=[],d=e.endList?"static":"dynamic",c=o+t.firstOffset,f=0;f<l.length;f++){var p=t.references[f],m=p.referencedSize,_=p.subsegmentDuration,g=A({baseUrl:i,timescale:u,timeline:a,periodIndex:a,duration:_,sourceDuration:r,indexRange:c+"-"+(c+m-1),type:d})[0];n&&(g.map=n),h.push(g),c+=m}return e.segments=h,e},k=function(e){return e&&e.uri+"-"+(t=e.byterange,i=t.offset+t.length-1,t.offset+"-"+i);var t,i},P=function(e){var t;return(t=e.reduce((function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t,e}),{}),Object.keys(t).map((function(e){return t[e]}))).map((function(e){var t,i;return e.discontinuityStarts=(t=e.segments,i="discontinuity",t.reduce((function(e,t,n){return t[i]&&e.push(n),e}),[])),e}))},I=function(e,t){var i=k(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&C(e,n,e.sidx.resolvedUri),e},L=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=I(e[i],t);return e},x=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===i.type,timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(a.contentProtection=i.contentProtection),r&&(a.sidx=r),a},R=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},D=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},O=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},U=function(e,t,i){var n;if(void 0===i&&(i={}),!e.length)return{};var r=e[0].attributes,a=r.sourceDuration,s=r.type,o=r.suggestedPresentationDelay,u=r.minimumUpdatePeriod,l=P(e.filter(R)).map(x),h=P(e.filter(D)),d=e.filter(O),c=e.map((function(e){return e.attributes.captionServices})).filter(Boolean),f={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(n={AUDIO:{},VIDEO:{}},n["CLOSED-CAPTIONS"]={},n.SUBTITLES={},n),uri:"",duration:a,playlists:L(l,i)};u>=0&&(f.minimumUpdatePeriod=1e3*u),t&&(f.locations=t),"dynamic"===s&&(f.suggestedPresentationDelay=o);var p=0===f.playlists.length;return h.length&&(f.mediaGroups.AUDIO.audio=function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" ("+a+")":"";o=""+r.attributes.lang+u}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=I(function(e,t){var i,n=e.attributes,r=e.segments,a=e.sidx,s={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===n.type,timeline:n.periodIndex,resolvedUri:"",targetDuration:n.duration,segments:r,mediaSequence:r.length?r[0].number:1};return n.contentProtection&&(s.contentProtection=n.contentProtection),a&&(s.sidx=a),t&&(s.attributes.AUDIO="audio",s.attributes.SUBTITLES="subs"),s}(r,i),t);return e[o].playlists.push(l),void 0===n&&"main"===a&&((n=r).default=!0),e}),{});n||(r[Object.keys(r)[0]].default=!0);return r}(h,i,p)),d.length&&(f.mediaGroups.SUBTITLES.subs=function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(I(function(e){var t,i=e.attributes,n=e.segments;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var r=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(r.CODECS=i.codecs),{attributes:r,uri:"",endList:"static"===i.type,timeline:i.periodIndex,resolvedUri:i.baseUrl||"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1}}(i),t)),e}),{})}(d,i)),c.length&&(f.mediaGroups["CLOSED-CAPTIONS"].cc=c.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),f},M=function(e,t,i){var n=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.start,l=void 0===u?0:u,h=e.minimumUpdatePeriod,d=(n+r)/1e3+(void 0===h?0:h)-(a+l);return Math.ceil((d*o-t)/i)},F=function(e,t){for(var i=e.type,n=e.minimumUpdatePeriod,r=void 0===n?0:n,a=e.media,s=void 0===a?"":a,o=e.sourceDuration,u=e.timescale,l=void 0===u?1:u,h=e.startNumber,d=void 0===h?1:h,c=e.periodIndex,f=[],p=-1,m=0;m<t.length;m++){var _=t[m],g=_.d,v=_.r||0,y=_.t||0;p<0&&(p=y),y&&y>p&&(p=y);var b=void 0;if(v<0){var S=m+1;b=S===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?M(e,p,g):(o*l-p)/g:(t[S].t-p)/g}else b=v+1;for(var T=d+f.length+b,E=d+f.length;E<T;)f.push({number:E,duration:g/l,time:p,timeline:c}),p+=g,E++}return f},B=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,N=function(e,t){return e.replace(B,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var a=""+e[i];return"RepresentationID"===i?a:(r=n?parseInt(r,10):1,a.length>=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},j=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=S({baseUrl:e.baseUrl,source:N(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?w(e):F(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodIndex}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=N(e.media||"",i),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:u.default(e.baseUrl||"",n),map:a,number:t.number,presentationTime:o}}))},V=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n,a=e.periodStart;if(!i&&!t||i&&t)throw new Error(y);var s,o=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=S({baseUrl:i,source:r.sourceURL,range:r.range}),s=S({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(s=w(e)),t&&(s=F(e,t)),s.map((function(t,i){if(o[i]){var n=o[i],r=e.timescale||1,s=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=a+(t.time-s)/r,n}})).filter((function(e){return e}))},H=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=j,t=c(n,r.template)):r.base?(i=A,t=c(n,r.base)):r.list&&(i=V,t=c(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,h=void 0===l?1:l;t.duration=u/h}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},z=function(e){return e.map(H)},G=function(e,t){return p(e.childNodes).filter((function(e){return e.tagName===t}))},W=function(e){return e.textContent.trim()},Y=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},q={mediaPresentationDuration:function(e){return Y(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Y(e)},suggestedPresentationDelay:function(e){return Y(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return Y(e)},start:function(e){return Y(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Y(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},K=function(e){return e&&e.attributes?p(e.attributes).reduce((function(e,t){var i=q[t.name]||q.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},X={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},Q=function(e,t){return t.length?f(e.map((function(e){return t.map((function(t){return u.default(e,W(t))}))}))):e},$=function(e){var t=G(e,"SegmentTemplate")[0],i=G(e,"SegmentList")[0],n=i&&G(i,"SegmentURL").map((function(e){return c({tag:"SegmentURL"},K(e))})),r=G(e,"SegmentBase")[0],a=i||t,s=a&&G(a,"SegmentTimeline")[0],o=i||r||t,u=o&&G(o,"Initialization")[0],l=t&&K(t);l&&u?l.initialization=u&&K(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var h={template:l,segmentTimeline:s&&G(s,"S").map((function(e){return K(e)})),list:i&&c(K(i),{segmentUrls:n,initialization:K(u)}),base:r&&c(K(r),{initialization:K(u)})};return Object.keys(h).forEach((function(e){h[e]||delete h[e]})),h},J=function(e,t,i){return function(n){var r,a=K(n),s=Q(t,G(n,"BaseURL")),o=G(n,"Role")[0],u={role:K(o)},l=c(e,a,u),d=G(n,"Accessibility")[0],p="urn:scte:dash:cc:cea-608:2015"===(r=K(d)).schemeIdUri?r.value.split(";").map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?r.value.split(";").map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],a=void 0===r?"":r;t.channel=n,t.language=e,a.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;p&&(l=c(l,{captionServices:p}));var m=G(n,"Label")[0];if(m&&m.childNodes.length){var _=m.childNodes[0].nodeValue.trim();l=c(l,{label:_})}var g=G(n,"ContentProtection").reduce((function(e,t){var i=K(t),n=X[i.schemeIdUri];if(n){e[n]={attributes:i};var r=G(t,"cenc:pssh")[0];if(r){var a=W(r),s=a&&h.default(a);e[n].pssh=s}}return e}),{});Object.keys(g).length&&(l=c(l,{contentProtection:g}));var v=$(n),y=G(n,"Representation"),b=c(i,v);return f(y.map(function(e,t,i){return function(n){var r=G(n,"BaseURL"),a=Q(t,r),s=c(e,K(n)),o=$(n);return a.map((function(e){return{segmentInfo:c(i,o),attributes:c(s,{baseUrl:e})}}))}}(l,s,b)))}},Z=function(e,t){return function(i,n){var r=Q(t,G(i.node,"BaseURL")),a=parseInt(i.attributes.id,10),s=l.default.isNaN(a)?n:a,o=c(e,{periodIndex:s,periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(o.periodDuration=i.attributes.duration);var u=G(i.node,"AdaptationSet"),h=$(i.node);return f(u.map(J(o,r,h)))}},ee=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,l=G(e,"Period");if(!l.length)throw new Error(m);var h=G(e,"Location"),d=K(e),c=Q([r],G(e,"BaseURL"));d.type=d.type||"static",d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=s,d.clientOffset=u,h.length&&(d.locations=h.map(W));var p=[];return l.forEach((function(e,t){var i=K(e),n=p[t-1];i.start=function(e){var t=e.attributes,i=e.priorPeriodAttributes,n=e.mpdType;return"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==n?null:0}({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:d.type}),p.push({node:e,attributes:i})})),{locations:d.locations,representationInfo:f(p.map(Z(d,c)))}},te=function(e){if(""===e)throw new Error(_);var t,i,n=new s.DOMParser;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(g);return i};i.VERSION="0.19.0",i.addSidxSegmentsToPlaylist=C,i.generateSidxKey=k,i.inheritAttributes=ee,i.parse=function(e,t){void 0===t&&(t={});var i=ee(te(e),t),n=z(i.representationInfo);return U(n,i.locations,t.sidxMapping)},i.parseUTCTiming=function(e){return function(e){var t=G(e,"UTCTiming")[0];if(!t)return null;var i=K(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(b)}return i}(te(e))},i.stringToMpdXml=te,i.toM3u8=U,i.toPlaylists=z},{"@videojs/vhs-utils/cjs/decode-b64-to-uint8-array":13,"@videojs/vhs-utils/cjs/resolve-url":20,"@xmldom/xmldom":28,"global/window":34}],41:[function(e,t,i){var n,r;n=window,r=function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=14)}([function(e,t,i){"use strict";var n=i(6),r=i.n(n),a=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn)},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&console.info&&console.info(n)},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&console.warn},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&console.debug&&console.debug(n)},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE},e}();a.GLOBAL_TAG="mpegts.js",a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0,a.ENABLE_CALLBACK=!1,a.emitter=new r.a,t.a=a},function(e,t,i){"use strict";t.a={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},function(e,t,i){"use strict";i.d(t,"c",(function(){return r})),i.d(t,"b",(function(){return a})),i.d(t,"a",(function(){return s}));var n=i(3),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},s=function(){function e(e){this._type=e||"undefined",this._status=r.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=r.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===r.kConnecting||this._status===r.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new n.c("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.c("Unimplemented abstract function!")},e}()},function(e,t,i){"use strict";i.d(t,"d",(function(){return a})),i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return u}));var n,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),a=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),s=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(a),o=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(a),u=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(a)},function(e,t,i){"use strict";var n={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},a={};if(r.browser){a[r.browser]=!0;var s=r.majorVersion.split(".");a.version={major:parseInt(r.majorVersion,10),string:r.version},s.length>1&&(a.version.minor=parseInt(s[1],10)),s.length>2&&(a.version.build=parseInt(s[2],10))}for(var o in r.platform&&(a[r.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,r.browser="msie",a.msie=!0),a.edge&&(delete a.edge,r.browser="msedge",a.msedge=!0),a.opr&&(r.browser="opera",a.opera=!0),a.safari&&a.android&&(r.browser="android",a.android=!0),a.name=r.browser,a.platform=r.platform,n)n.hasOwnProperty(o)&&delete n[o];Object.assign(n,a)}(),t.a=n},function(e,t,i){"use strict";t.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(e,t,i){"use strict";var n,r="object"==typeof Reflect?Reflect:null,a=r&&"function"==typeof r.apply?r.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,a),n(i)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}g(e,t,a,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function d(e,t,i,n){var r,a,s;if(l(i),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),a=e._events),s=a[t]),void 0===s)s=a[t]=i,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=h(e))>0&&s.length>r&&!s.warned){s.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=s.length,console&&console.warn}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=c.bind(n);return r.listener=i,n.wrapFn=r,r}function p(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(r):_(r,r.length)}function m(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function _(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function g(e,t,i,n){if("function"==typeof e.on)n.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(a){n.once&&e.removeEventListener(t,r),i(a)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=r[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,h=_(u,l);for(i=0;i<l;++i)a(h[i],this,t)}return!0},o.prototype.addListener=function(e,t){return d(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return d(this,e,t,!0)},o.prototype.once=function(e,t){return l(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var i,n,r,a,s;if(l(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){s=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var r,a=Object.keys(i);for(n=0;n<a.length;++n)"removeListener"!==(r=a[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},o.prototype.listenerCount=m,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,i){"use strict";i.d(t,"d",(function(){return n})),i.d(t,"b",(function(){return r})),i.d(t,"a",(function(){return a})),i.d(t,"c",(function(){return s}));var n=function(e,t,i,n,r){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=r,this.fileposition=null},r=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),a=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,n=t.length-1,r=0,a=0,s=n;for(e<t[0].dts&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?a=r+1:s=r-1}return this._list[i]},e}(),s=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,n=0,r=0,a=i,s=0;if(e<t[0].originalBeginDts)return-1;for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){s=n;break}t[n].originalBeginDts<e?r=n+1:a=n-1}return s},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},function(e,t,i){"use strict";var n=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,n=e.length-1,r=0,a=0,s=n;for(t<e[0]&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?a=r+1:s=r-1}return i},e}();t.a=n},function(e,t,i){"use strict";var n=i(6),r=i.n(n),a=i(0),s=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return a.a.FORCE_GLOBAL_TAG},set:function(t){a.a.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return a.a.GLOBAL_TAG},set:function(t){a.a.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return a.a.ENABLE_VERBOSE&&a.a.ENABLE_DEBUG&&a.a.ENABLE_INFO&&a.a.ENABLE_WARN&&a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_VERBOSE=t,a.a.ENABLE_DEBUG=t,a.a.ENABLE_INFO=t,a.a.ENABLE_WARN=t,a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return a.a.ENABLE_DEBUG},set:function(t){a.a.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return a.a.ENABLE_VERBOSE},set:function(t){a.a.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return a.a.ENABLE_INFO},set:function(t){a.a.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return a.a.ENABLE_WARN},set:function(t){a.a.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:a.a.GLOBAL_TAG,forceGlobalTag:a.a.FORCE_GLOBAL_TAG,enableVerbose:a.a.ENABLE_VERBOSE,enableDebug:a.a.ENABLE_DEBUG,enableInfo:a.a.ENABLE_INFO,enableWarn:a.a.ENABLE_WARN,enableError:a.a.ENABLE_ERROR,enableCallback:a.a.ENABLE_CALLBACK}},e.applyConfig=function(e){a.a.GLOBAL_TAG=e.globalTag,a.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.a.ENABLE_VERBOSE=e.enableVerbose,a.a.ENABLE_DEBUG=e.enableDebug,a.a.ENABLE_INFO=e.enableInfo,a.a.ENABLE_WARN=e.enableWarn,a.a.ENABLE_ERROR=e.enableError,a.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){a.a.emitter.addListener("log",t),a.a.emitter.listenerCount("log")>0&&(a.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.a.emitter.removeListener("log",t),0===a.a.emitter.listenerCount("log")&&(a.a.ENABLE_CALLBACK=!1,e._notifyChange())},e}();s.emitter=new r.a,t.a=s},function(e,t,i){"use strict";var n=i(6),r=i.n(n),a=i(0),s=i(4),o=i(8);function u(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}var l,h,d=function(e){for(var t=[],i=e,n=0,r=e.length;n<r;)if(i[n]<128)t.push(String.fromCharCode(i[n])),++n;else{if(i[n]<192);else if(i[n]<224){if(u(i,n,1)&&(a=(31&i[n])<<6|63&i[n+1])>=128){t.push(String.fromCharCode(65535&a)),n+=2;continue}}else if(i[n]<240){if(u(i,n,2)&&(a=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2])>=2048&&55296!=(63488&a)){t.push(String.fromCharCode(65535&a)),n+=3;continue}}else if(i[n]<248){var a;if(u(i,n,3)&&(a=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3])>65536&&a<1114112){a-=65536,t.push(String.fromCharCode(a>>>10|55296)),t.push(String.fromCharCode(1023&a|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")},c=i(3),f=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]),p=function(){function e(){}return e.parseScriptData=function(t,i,n){var r={};try{var s=e.parseValue(t,i,n),o=e.parseValue(t,i+s.size,n-s.size);r[s.data]=o.data}catch(e){a.a.e("AMF",e.toString())}return r},e.parseObject=function(t,i,n){if(n<3)throw new c.a("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),a=e.parseValue(t,i+r.size,n-r.size),s=a.objectEnd;return{data:{name:r.data,value:a.data},size:r.size+a.size,objectEnd:s}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new c.a("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!f);return{data:n>0?d(new Uint8Array(e,t+2,n)):"",size:2+n}},e.parseLongString=function(e,t,i){if(i<4)throw new c.a("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!f);return{data:n>0?d(new Uint8Array(e,t+4,n)):"",size:4+n}},e.parseDate=function(e,t,i){if(i<10)throw new c.a("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!f),a=n.getInt16(8,!f);return{data:new Date(r+=60*a*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new c.a("Data not enough when parse Value");var r,s=new DataView(t,i,n),o=1,u=s.getUint8(0),l=!1;try{switch(u){case 0:r=s.getFloat64(1,!f),o+=8;break;case 1:r=!!s.getUint8(1),o+=1;break;case 2:var h=e.parseString(t,i+1,n-1);r=h.data,o+=h.size;break;case 3:r={};var d=0;for(9==(16777215&s.getUint32(n-4,!f))&&(d=3);o<n-4;){var p=e.parseObject(t,i+o,n-o-d);if(p.objectEnd)break;r[p.data.name]=p.data.value,o+=p.size}o<=n-3&&9==(16777215&s.getUint32(o-1,!f))&&(o+=3);break;case 8:for(r={},o+=4,d=0,9==(16777215&s.getUint32(n-4,!f))&&(d=3);o<n-8;){var m=e.parseVariable(t,i+o,n-o-d);if(m.objectEnd)break;r[m.data.name]=m.data.value,o+=m.size}o<=n-3&&9==(16777215&s.getUint32(o-1,!f))&&(o+=3);break;case 9:r=void 0,o=1,l=!0;break;case 10:r=[];var _=s.getUint32(1,!f);o+=4;for(var g=0;g<_;g++){var v=e.parseValue(t,i+o,n-o);r.push(v.data),o+=v.size}break;case 11:var y=e.parseDate(t,i+1,n-1);r=y.data,o+=y.size;break;case 12:var b=e.parseString(t,i+1,n-1);r=b.data,o+=b.size;break;default:o=n,a.a.w("AMF","Unsupported AMF value type "+u)}}catch(e){a.a.e("AMF",e.toString())}return{data:r,size:o,objectEnd:l}},e}(),m=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new c.a("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new c.b("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var n=e-this._current_word_bits_left;this._fillCurrentWord();var r=Math.min(n,this._current_word_bits_left),a=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,i<<r|a},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),_=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,a=0;a<i;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(n[r]=t[a],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){for(var i=t.subarray(1,4),n="avc1.",r=0;r<3;r++){var a=i[r].toString(16);a.length<2&&(a="0"+a),n+=a}var s=e._ebsp2rbsp(t),o=new m(s);o.readByte();var u=o.readByte();o.readByte();var l=o.readByte();o.readUEG();var h=e.getProfileString(u),d=e.getLevelString(l),c=1,f=420,p=8,_=8;if((100===u||110===u||122===u||244===u||44===u||83===u||86===u||118===u||128===u||138===u||144===u)&&(3===(c=o.readUEG())&&o.readBits(1),c<=3&&(f=[0,420,422,444][c]),p=o.readUEG()+8,_=o.readUEG()+8,o.readBits(1),o.readBool()))for(var g=3!==c?8:12,v=0;v<g;v++)o.readBool()&&(v<6?e._skipScalingList(o,16):e._skipScalingList(o,64));o.readUEG();var y=o.readUEG();if(0===y)o.readUEG();else if(1===y){o.readBits(1),o.readSEG(),o.readSEG();var b=o.readUEG();for(v=0;v<b;v++)o.readSEG()}var S=o.readUEG();o.readBits(1);var T=o.readUEG(),E=o.readUEG(),w=o.readBits(1);0===w&&o.readBits(1),o.readBits(1);var A=0,C=0,k=0,P=0;o.readBool()&&(A=o.readUEG(),C=o.readUEG(),k=o.readUEG(),P=o.readUEG());var I=1,L=1,x=0,R=!0,D=0,O=0;if(o.readBool()){if(o.readBool()){var U=o.readByte();U>0&&U<16?(I=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][U-1],L=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][U-1]):255===U&&(I=o.readByte()<<8|o.readByte(),L=o.readByte()<<8|o.readByte())}if(o.readBool()&&o.readBool(),o.readBool()&&(o.readBits(4),o.readBool()&&o.readBits(24)),o.readBool()&&(o.readUEG(),o.readUEG()),o.readBool()){var M=o.readBits(32),F=o.readBits(32);R=o.readBool(),x=(D=F)/(O=2*M)}}var B=1;1===I&&1===L||(B=I/L);var N=0,j=0;0===c?(N=1,j=2-w):(N=3===c?1:2,j=(1===c?2:1)*(2-w));var V=16*(T+1),H=16*(E+1)*(2-w);V-=(A+C)*N,H-=(k+P)*j;var z=Math.ceil(V*B);return o.destroy(),o=null,{codec_mimetype:n,profile_idc:u,level_idc:l,profile_string:h,level_string:d,chroma_format_idc:c,bit_depth:p,bit_depth_luma:p,bit_depth_chroma:_,ref_frames:S,chroma_format:f,chroma_format_string:e.getChromaFormatString(f),frame_rate:{fixed:R,fps:x,fps_den:O,fps_num:D},sar_ratio:{width:I,height:L},codec_size:{width:V,height:H},present_size:{width:z,height:H}}},e._skipScalingList=function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}(),g=i(5),v=function(){function e(e,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new o.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r=(4&t[4])>>>2!=0,a=0!=(1&t[4]),s=(n=t)[5]<<24|n[6]<<16|n[7]<<8|n[8];return s<9?i:{match:!0,consumed:s,dataOffset:s,hasAudioTrack:r,hasVideoTrack:a}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new o.a},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new c.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0,r=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;n=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+n!==this._dataOffset&&a.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(s=new DataView(t,n)).getUint32(0,!r)&&a.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),n+=4);n<t.byteLength;){this._dispatch=!0;var s=new DataView(t,n);if(n+11+4>t.byteLength)break;var o=s.getUint8(0),u=16777215&s.getUint32(0,!r);if(n+11+u+4>t.byteLength)break;if(8===o||9===o||18===o){var l=s.getUint8(4),h=s.getUint8(5),d=s.getUint8(6)|h<<8|l<<16|s.getUint8(7)<<24;0!=(16777215&s.getUint32(7,!r))&&a.a.w(this.TAG,"Meet tag which has StreamID != 0!");var f=n+11;switch(o){case 8:this._parseAudioData(t,f,u,d);break;case 9:this._parseVideoData(t,f,u,d,i+n);break;case 18:this._parseScriptData(t,f,u)}var p=s.getUint32(11+u,!r);p!==11+u&&a.a.w(this.TAG,"Invalid PrevTagSize "+p),n+=11+u+4}else a.a.w(this.TAG,"Unsupported tag type "+o+", skipped"),n+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),n},e.prototype._parseScriptData=function(e,t,i){var n=p.parseScriptData(e,t,i);if(n.hasOwnProperty("onMetaData")){if(null==n.onMetaData||"object"!=typeof n.onMetaData)return void a.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=n;var r=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},r)),"boolean"==typeof r.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=r.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof r.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=r.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof r.audiodatarate&&(this._mediaInfo.audioDataRate=r.audiodatarate),"number"==typeof r.videodatarate&&(this._mediaInfo.videoDataRate=r.videodatarate),"number"==typeof r.width&&(this._mediaInfo.width=r.width),"number"==typeof r.height&&(this._mediaInfo.height=r.height),"number"==typeof r.duration){if(!this._durationOverrided){var s=Math.floor(r.duration*this._timescale);this._duration=s,this._mediaInfo.duration=s}}else this._mediaInfo.duration=0;if("number"==typeof r.framerate){var o=Math.floor(1e3*r.framerate);if(o>0){var u=o/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=o,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if("object"==typeof r.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var l=r.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(l),r.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=r,a.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(n).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},n))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,n){if(i<=1)a.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var r=new DataView(e,t,i).getUint8(0),s=r>>>4;if(2===s||10===s){var o=0,u=(12&r)>>>2;if(u>=0&&u<=4){o=this._flvSoundRateTable[u];var l=1&r,h=this._audioMetadata,d=this._audioTrack;if(h||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(h=this._audioMetadata={}).type="audio",h.id=d.id,h.timescale=this._timescale,h.duration=this._duration,h.audioSampleRate=o,h.channelCount=0===l?1:2),10===s){var c=this._parseAACAudioData(e,t+1,i-1);if(null==c)return;if(0===c.packetType){h.config&&a.a.w(this.TAG,"Found another AudioSpecificConfig!");var f=c.data;h.audioSampleRate=f.samplingRate,h.channelCount=f.channelCount,h.codec=f.codec,h.originalCodec=f.originalCodec,h.config=f.config,h.refSampleDuration=1024/h.audioSampleRate*h.timescale,a.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",h),(_=this._mediaInfo).audioCodec=h.originalCodec,_.audioSampleRate=h.audioSampleRate,_.audioChannelCount=h.channelCount,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}else if(1===c.packetType){var p=this._timestampBase+n,m={unit:c.data,length:c.data.byteLength,dts:p,pts:p};d.samples.push(m),d.length+=c.data.length}else a.a.e(this.TAG,"Flv: Unsupported AAC data type "+c.packetType)}else if(2===s){if(!h.codec){var _;if(null==(f=this._parseMP3AudioData(e,t+1,i-1,!0)))return;h.audioSampleRate=f.samplingRate,h.channelCount=f.channelCount,h.codec=f.codec,h.originalCodec=f.originalCodec,h.refSampleDuration=1152/h.audioSampleRate*h.timescale,a.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",h),(_=this._mediaInfo).audioCodec=h.codec,_.audioSampleRate=h.audioSampleRate,_.audioChannelCount=h.channelCount,_.audioDataRate=f.bitRate,_.hasVideo?null!=_.videoCodec&&(_.mimeType='video/x-flv; codecs="'+_.videoCodec+","+_.audioCodec+'"'):_.mimeType='video/x-flv; codecs="'+_.audioCodec+'"',_.isComplete()&&this._onMediaInfo(_)}var v=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==v)return;p=this._timestampBase+n;var y={unit:v,length:v.byteLength,dts:p,pts:p};d.samples.push(y),d.length+=v.length}}else this._onError(g.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+u)}else this._onError(g.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var n={},r=new Uint8Array(e,t,i);return n.packetType=r[0],0===r[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=r.subarray(1),n}a.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,a=new Uint8Array(e,t,i),s=null,o=0,u=null;if(o=n=a[0]>>>3,(r=(7&a[0])<<1|a[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(g.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var l=this._mpegSamplingRates[r],h=(120&a[1])>>>3;if(!(h<0||h>=8)){5===o&&(u=(7&a[1])<<1|a[2]>>>7,a[2]);var d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?r>=6?(o=5,s=new Array(4),u=r-3):(o=2,s=new Array(2),u=r):-1!==d.indexOf("android")?(o=2,s=new Array(2),u=r):(o=5,u=r,s=new Array(4),r>=6?u=r-3:1===h&&(o=2,s=new Array(2),u=r)),s[0]=o<<3,s[0]|=(15&r)>>>1,s[1]=(15&r)<<7,s[1]|=(15&h)<<3,5===o&&(s[1]|=(15&u)>>>1,s[2]=(1&u)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:l,channelCount:h,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+n}}this._onError(g.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,n){if(!(i<4)){this._littleEndian;var r=new Uint8Array(e,t,i),s=null;if(n){if(255!==r[0])return;var o=r[1]>>>3&3,u=(6&r[1])>>1,l=(240&r[2])>>>4,h=(12&r[2])>>>2,d=3!=(r[3]>>>6&3)?2:1,c=0,f=0;switch(o){case 0:c=this._mpegAudioV25SampleRateTable[h];break;case 2:c=this._mpegAudioV20SampleRateTable[h];break;case 3:c=this._mpegAudioV10SampleRateTable[h]}switch(u){case 1:l<this._mpegAudioL3BitRateTable.length&&(f=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(f=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(f=this._mpegAudioL1BitRateTable[l])}s={bitRate:f,samplingRate:c,channelCount:d,codec:"mp3",originalCodec:"mp3"}}else s=r;return s}a.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,n,r){if(i<=1)a.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,i)[0],o=(240&s)>>>4,u=15&s;7===u?this._parseAVCVideoPacket(e,t+1,i-1,n,r,o):this._onError(g.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+u)}},e.prototype._parseAVCVideoPacket=function(e,t,i,n,r,s){if(i<4)a.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,u=new DataView(e,t,i),l=u.getUint8(0),h=(16777215&u.getUint32(0,!o))<<8>>8;if(0===l)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===l)this._parseAVCVideoData(e,t+4,i-4,n,r,s,h);else if(2!==l)return void this._onError(g.a.FORMAT_ERROR,"Flv: Invalid video packet type "+l)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)a.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,s=this._littleEndian,o=new DataView(e,t,i);n?void 0!==n.avcc&&a.a.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration);var u=o.getUint8(0),l=o.getUint8(1);if(o.getUint8(2),o.getUint8(3),1===u&&0!==l)if(this._naluLengthSize=1+(3&o.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var h=31&o.getUint8(5);if(0!==h){h>1&&a.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+h);for(var d=6,c=0;c<h;c++){var f=o.getUint16(d,!s);if(d+=2,0!==f){var p=new Uint8Array(e,t+d,f);d+=f;var m=_.parseSPS(p);if(0===c){n.codecWidth=m.codec_size.width,n.codecHeight=m.codec_size.height,n.presentWidth=m.present_size.width,n.presentHeight=m.present_size.height,n.profile=m.profile_string,n.level=m.level_string,n.bitDepth=m.bit_depth,n.chromaFormat=m.chroma_format,n.sarRatio=m.sar_ratio,n.frameRate=m.frame_rate,!1!==m.frame_rate.fixed&&0!==m.frame_rate.fps_num&&0!==m.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var v=n.frameRate.fps_den,y=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(v/y);for(var b=p.subarray(1,4),S="avc1.",T=0;T<3;T++){var E=b[T].toString(16);E.length<2&&(E="0"+E),S+=E}n.codec=S;var w=this._mediaInfo;w.width=n.codecWidth,w.height=n.codecHeight,w.fps=n.frameRate.fps,w.profile=n.profile,w.level=n.level,w.refFrames=m.ref_frames,w.chromaFormat=m.chroma_format_string,w.sarNum=n.sarRatio.width,w.sarDen=n.sarRatio.height,w.videoCodec=S,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&this._onMediaInfo(w)}}}var A=o.getUint8(d);if(0!==A){for(A>1&&a.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+A),d++,c=0;c<A;c++)f=o.getUint16(d,!s),d+=2,0!==f&&(d+=f);n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),a.a.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(g.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(g.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(g.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(g.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,n,r,s,o){for(var u=this._littleEndian,l=new DataView(e,t,i),h=[],d=0,c=0,f=this._naluLengthSize,p=this._timestampBase+n,m=1===s;c<i;){if(c+4>=i){a.a.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+c+", dataSize = "+i);break}var _=l.getUint32(c,!u);if(3===f&&(_>>>=8),_>i-f)return void a.a.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var g=31&l.getUint8(c+f);5===g&&(m=!0);var v=new Uint8Array(e,t+c,f+_),y={type:g,data:v};h.push(y),d+=v.byteLength,c+=f+_}if(h.length){var b=this._videoTrack,S={units:h,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(S.fileposition=r),b.samples.push(S),b.length+=d}},e}(),y=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}(),b=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kID3=21]="kID3",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(h||(h={}));var S,T=function(){this.pid_stream_type={},this.common_pids={h264:void 0,adts_aac:void 0},this.pes_private_data_pids={},this.timed_id3_pids={}},E=function(){},w=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(S||(S={}));var A,C,k=function(){},P=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},I=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&a.a.e(this.TAG,"Could not found H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var n=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===n||1===r)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,n=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],r=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=a,!(n>=S.kReserved0)&&0===r){var s=e.subarray(i,a);(t=new k).type=n,t.data=s}}return t},e}(),L=function(){function e(e,t,i){var n=8+e.byteLength+1+2+t.byteLength,r=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(r=!0,n+=4);var a=this.data=new Uint8Array(n);a[0]=1,a[1]=e[1],a[2]=e[2],a[3]=e[3],a[4]=255,a[5]=225;var s=e.byteLength;a[6]=s>>>8,a[7]=255&s;var o=8;a.set(e,8),a[o+=s]=1;var u=t.byteLength;a[o+1]=u>>>8,a[o+2]=255&u,a.set(t,o+3),o+=3+u,r&&(a[o]=252|i.chroma_format_idc,a[o+1]=248|i.bit_depth_luma-8,a[o+2]=248|i.bit_depth_chroma-8,a[o+3]=0,o+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(A||(A={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(C||(C={}));var x,R=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],D=function(){},O=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&a.a.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,n=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,a=1&e[i+1],s=(192&e[i+2])>>>6,o=(60&e[i+2])>>>2,u=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var h=1===a?7:9,d=l-h;i+=h;var c=this.findNextSyncwordOffset(i+d);if(this.current_syncword_offset_=c,(0===n||1===n)&&0===r){var f=e.subarray(i,i+d);(t=new D).audio_object_type=s+1,t.sampling_freq_index=o,t.sampling_frequency=R[o],t.channel_config=u,t.data=f}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),U=function(e){var t=null,i=e.audio_object_type,n=e.audio_object_type,r=e.sampling_freq_index,a=e.channel_config,s=0,o=navigator.userAgent.toLowerCase();-1!==o.indexOf("firefox")?r>=6?(n=5,t=new Array(4),s=r-3):(n=2,t=new Array(2),s=r):-1!==o.indexOf("android")?(n=2,t=new Array(2),s=r):(n=5,s=r,t=new Array(4),r>=6?s=r-3:1===a&&(n=2,t=new Array(2),s=r)),t[0]=n<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&a)<<3,5===n&&(t[1]|=(15&s)>>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=R[r],this.channel_count=a,this.codec_mimetype="mp4a.40."+n,this.original_codec_mimetype="mp4a.40."+i},M=function(){},F=function(){},B=(x=function(e,t){return(x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),N=function(e){function t(t,i){var n=e.call(this)||this;return n.TAG="TSDemuxer",n.first_parse_=!0,n.media_info_=new o.a,n.timescale_=90,n.duration_=0,n.current_pmt_pid_=-1,n.program_pmt_map_={},n.pes_slice_queues_={},n.video_metadata_={sps:void 0,pps:void 0,sps_details:void 0},n.audio_metadata_={audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},n.aac_last_sample_pts_=void 0,n.aac_last_incomplete_data_=null,n.has_video_=!1,n.has_audio_=!1,n.video_init_segment_dispatched_=!1,n.audio_init_segment_dispatched_=!1,n.video_metadata_changed_=!1,n.audio_metadata_changed_=!1,n.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},n.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},n.ts_packet_size_=t.ts_packet_size,n.sync_offset_=t.sync_offset,n.config_=i,n}return B(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,n=188;if(t.byteLength<=3*n)return a.a.e("TSDemuxer","Probe data "+t.byteLength+" bytes is too few for judging MPEG-TS stream format!"),{match:!1};for(;-1===i;){for(var r=Math.min(1e3,t.byteLength-3*n),s=0;s<r;){if(71===t[s]&&71===t[s+n]&&71===t[s+2*n]){i=s;break}s++}if(-1===i)if(188===n)n=192;else{if(192!==n)break;n=204}}return-1===i?{match:!1}:(192===n&&i>=4?(a.a.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===n&&a.a.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:n,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new o.a},t.prototype.parseChunks=function(e,t){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new c.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0;for(this.first_parse_&&(this.first_parse_=!1,i=this.sync_offset_);i+this.ts_packet_size_<=e.byteLength;){var n=t+i;192===this.ts_packet_size_&&(i+=4);var r=new Uint8Array(e,i,188),s=r[0];if(71!==s){a.a.e(this.TAG,"sync_byte = "+s+", not 0x47");break}var o=(64&r[1])>>>6,u=(r[1],(31&r[1])<<8|r[2]),l=(48&r[3])>>>4,h=15&r[3],d={},f=4;if(2==l||3==l){var p=r[4];if(5+p===188){i+=188,204===this.ts_packet_size_&&(i+=16);continue}p>0&&(d=this.parseAdaptationField(e,i+4,1+p)),f=5+p}if(1==l||3==l)if(0===u||u===this.current_pmt_pid_){o&&(f+=1+r[f]);var m=188-f;0===u?this.parsePAT(e,i+f,m,{payload_unit_start_indicator:o,continuity_conunter:h}):this.parsePMT(e,i+f,m,{payload_unit_start_indicator:o,continuity_conunter:h})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[u]){m=188-f;var _=this.pmt_.pid_stream_type[u];u!==this.pmt_.common_pids.h264&&u!==this.pmt_.common_pids.adts_aac&&!0!==this.pmt_.pes_private_data_pids[u]&&!0!==this.pmt_.timed_id3_pids[u]||this.handlePESSlice(e,i+f,m,{pid:u,stream_type:_,file_position:n,payload_unit_start_indicator:o,continuity_conunter:h,random_access_indicator:d.random_access_indicator})}i+=188,204===this.ts_packet_size_&&(i+=16)}return this.dispatchAudioVideoMediaSegment(),i},t.prototype.parseAdaptationField=function(e,t,i){var n=new Uint8Array(e,t,i),r=n[0];return r>0?r>183?(a.a.w(this.TAG,"Illegal adaptation_field_length: "+r),{}):{discontinuity_indicator:(128&n[1])>>>7,random_access_indicator:(64&n[1])>>>6,elementary_stream_priority_indicator:(32&n[1])>>>5}:{}},t.prototype.parsePAT=function(e,t,i,n){var r=new Uint8Array(e,t,i),s=r[0];if(0===s){var o=(15&r[1])<<8|r[2],u=(r[3],r[4],(62&r[5])>>>1),l=1&r[5],h=r[6],d=(r[7],null);if(1===l&&0===h)(d=new b).version_number=u;else if(null==(d=this.pat_))return;for(var c=o-5-4,f=-1,p=-1,m=8;m<8+c;m+=4){var _=r[m]<<8|r[m+1],g=(31&r[m+2])<<8|r[m+3];0===_?d.network_pid=g:(d.program_pmt_pid[_]=g,-1===f&&(f=_),-1===p&&(p=g))}1===l&&0===h&&(null==this.pat_&&a.a.v(this.TAG,"Parsed first PAT: "+JSON.stringify(d)),this.pat_=d,this.current_program_=f,this.current_pmt_pid_=p)}else a.a.e(this.TAG,"parsePAT: table_id "+s+" is not corresponded to PAT!")},t.prototype.parsePMT=function(e,t,i,n){var r=new Uint8Array(e,t,i),s=r[0];if(2===s){var o=(15&r[1])<<8|r[2],u=r[3]<<8|r[4],l=(62&r[5])>>>1,d=1&r[5],c=r[6],f=(r[7],null);if(1===d&&0===c)(f=new T).program_number=u,f.version_number=l,this.program_pmt_map_[u]=f;else if(null==(f=this.program_pmt_map_[u]))return;r[8],r[9];for(var p=(15&r[10])<<8|r[11],m=12+p,_=o-9-p-4,g=m;g<m+_;){var v=r[g],y=(31&r[g+1])<<8|r[g+2],b=(15&r[g+3])<<8|r[g+4];if(f.pid_stream_type[y]=v,v!==h.kH264||f.common_pids.h264)if(v!==h.kADTSAAC||f.common_pids.adts_aac)if(v===h.kPESPrivateData){if(f.pes_private_data_pids[y]=!0,b>0){var S=r.subarray(g+5,g+5+b);this.dispatchPESPrivateDataDescriptor(y,v,S)}}else v===h.kID3&&(f.timed_id3_pids[y]=!0);else f.common_pids.adts_aac=y;else f.common_pids.h264=y;g+=5+b}u===this.current_program_&&(null==this.pmt_&&a.a.v(this.TAG,"Parsed first PMT: "+JSON.stringify(f)),this.pmt_=f,f.common_pids.h264&&(this.has_video_=!0),f.common_pids.adts_aac&&(this.has_audio_=!0))}else a.a.e(this.TAG,"parsePMT: table_id "+s+" is not corresponded to PMT!")},t.prototype.handlePESSlice=function(e,t,i,n){var r=new Uint8Array(e,t,i),s=r[0]<<16|r[1]<<8|r[2],o=(r[3],r[4]<<8|r[5]);if(n.payload_unit_start_indicator){if(1!==s)return void a.a.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value "+s);var u=this.pes_slice_queues_[n.pid];u&&(0===u.expected_length||u.expected_length===u.total_length?this.emitPESSlices(u,n):this.cleanPESSlices(u,n)),this.pes_slice_queues_[n.pid]=new w,this.pes_slice_queues_[n.pid].file_position=n.file_position,this.pes_slice_queues_[n.pid].random_access_indicator=n.random_access_indicator}if(null!=this.pes_slice_queues_[n.pid]){var l=this.pes_slice_queues_[n.pid];l.slices.push(r),n.payload_unit_start_indicator&&(l.expected_length=0===o?0:o+6),l.total_length+=r.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,n):l.expected_length>0&&l.expected_length<l.total_length&&this.cleanPESSlices(l,n)}},t.prototype.emitPESSlices=function(e,t){for(var i=new Uint8Array(e.total_length),n=0,r=0;n<e.slices.length;n++){var a=e.slices[n];i.set(a,r),r+=a.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var s=new E;s.pid=t.pid,s.data=i,s.stream_type=t.stream_type,s.file_position=e.file_position,s.random_access_indicator=e.random_access_indicator,this.parsePES(s)},t.prototype.cleanPESSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],n=t[3],r=t[4]<<8|t[5];if(1===i)if(188!==n&&190!==n&&191!==n&&240!==n&&241!==n&&255!==n&&242!==n&&248!==n){t[6];var s=(192&t[7])>>>6,o=t[8],u=void 0,l=void 0;2!==s&&3!==s||(u=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,l=3===s?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:u);var d=9+o,c=void 0;if(0!==r){if(r<3+o)return void a.a.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");c=r-3-o}else c=t.byteLength-d;var f=t.subarray(d,d+c);switch(e.stream_type){case h.kMPEG1Audio:case h.kMPEG2Audio:break;case h.kPESPrivateData:this.parsePESPrivateDataPayload(f,u,l,e.pid,n);break;case h.kADTSAAC:this.parseAACPayload(f,u);break;case h.kID3:this.parseTimedID3MetadataPayload(f,u,l,e.pid,n);break;case h.kH264:this.parseH264Payload(f,u,l,e.file_position,e.random_access_indicator);break;case h.kH265:}}else 188!==n&&191!==n&&240!==n&&241!==n&&255!==n&&242!==n&&248!==n||e.stream_type!==h.kPESPrivateData||(d=6,c=void 0,c=0!==r?r:t.byteLength-d,f=t.subarray(d,d+c),this.parsePESPrivateDataPayload(f,void 0,void 0,e.pid,n));else a.a.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value "+i)},t.prototype.parseH264Payload=function(e,t,i,n,r){for(var s=new I(e),o=null,u=[],l=0,h=!1;null!=(o=s.readNextNaluPayload());){var d=new P(o);if(d.type===S.kSliceSPS){var c=_.parseSPS(o.data);this.video_init_segment_dispatched_?!0===this.detectVideoMetadataChange(d,c)&&(a.a.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={sps:d,pps:void 0,sps_details:c}):(this.video_metadata_.sps=d,this.video_metadata_.sps_details=c)}else d.type===S.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=d,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(d.type===S.kSliceIDR||d.type===S.kSliceNonIDR&&1===r)&&(h=!0);this.video_init_segment_dispatched_&&(u.push(d),l+=d.data.byteLength)}var f=Math.floor(t/this.timescale_),p=Math.floor(i/this.timescale_);if(u.length){var m=this.video_track_,g={units:u,length:l,isKeyframe:h,dts:p,pts:f,cts:f-p,file_position:n};m.samples.push(g),m.length+=l}},t.prototype.detectVideoMetadataChange=function(e,t){if(t.codec_mimetype!==this.video_metadata_.sps_details.codec_mimetype)return a.a.v(this.TAG,"H264: Codec mimeType changed from "+this.video_metadata_.sps_details.codec_mimetype+" to "+t.codec_mimetype),!0;if(t.codec_size.width!==this.video_metadata_.sps_details.codec_size.width||t.codec_size.height!==this.video_metadata_.sps_details.codec_size.height){var i=this.video_metadata_.sps_details.codec_size,n=t.codec_size;return a.a.v(this.TAG,"H264: Coded Resolution changed from "+i.width+"x"+i.height+" to "+n.width+"x"+n.height),!0}return t.present_size.width!==this.video_metadata_.sps_details.present_size.width&&(a.a.v(this.TAG,"H264: Present resolution width changed from "+this.video_metadata_.sps_details.present_size.width+" to "+t.present_size.width),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e=this.video_metadata_.sps_details,t={type:"video"};t.id=this.video_track_.id,t.timescale=1e3,t.duration=this.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;var i=t.frameRate.fps_den,n=t.frameRate.fps_num;t.refSampleDuration=i/n*1e3,t.codec=e.codec_mimetype;var r=this.video_metadata_.sps.data.subarray(4),s=this.video_metadata_.pps.data.subarray(4),o=new L(r,s,e);t.avcc=o.getData(),0==this.video_init_segment_dispatched_&&a.a.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: "+t.codec),this.onTrackMetadata("video",t),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var u=this.media_info_;u.hasVideo=!0,u.width=t.codecWidth,u.height=t.codecHeight,u.fps=t.frameRate.fps,u.profile=t.profile,u.level=t.level,u.refFrames=e.ref_frames,u.chromaFormat=e.chroma_format_string,u.sarNum=t.sarRatio.width,u.sarDen=t.sarRatio.height,u.videoCodec=t.codec,u.hasAudio&&u.audioCodec?u.mimeType='video/mp2t; codecs="'+u.videoCodec+","+u.audioCodec+'"':u.mimeType='video/mp2t; codecs="'+u.videoCodec+'"',u.isComplete()&&this.onMediaInfo(u)},t.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseAACPayload=function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var i=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);i.set(this.aac_last_incomplete_data_,0),i.set(e,this.aac_last_incomplete_data_.byteLength),e=i}var n,r;if(null!=t)r=t/this.timescale_;else{if(null==this.aac_last_sample_pts_)return void a.a.w(this.TAG,"AAC: Unknown pts");n=1024/this.audio_metadata_.sampling_frequency*1e3,r=this.aac_last_sample_pts_+n}if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){n=1024/this.audio_metadata_.sampling_frequency*1e3;var s=this.aac_last_sample_pts_+n;Math.abs(s-r)>1&&(a.a.w(this.TAG,"AAC: Detected pts overlapped, expected: "+s+"ms, PES pts: "+r+"ms"),r=s)}for(var o,u=new O(e),l=null,h=r;null!=(l=u.readNextAACFrame());){n=1024/l.sampling_frequency*1e3,0==this.audio_init_segment_dispatched_?(this.audio_metadata_.audio_object_type=l.audio_object_type,this.audio_metadata_.sampling_freq_index=l.sampling_freq_index,this.audio_metadata_.sampling_frequency=l.sampling_frequency,this.audio_metadata_.channel_config=l.channel_config,this.dispatchAudioInitSegment(l)):this.detectAudioMetadataChange(l)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(l)),o=h;var d=Math.floor(h),c={unit:l.data,length:l.data.byteLength,pts:d,dts:d};this.audio_track_.samples.push(c),this.audio_track_.length+=l.data.byteLength,h+=n}u.hasIncompleteData()&&(this.aac_last_incomplete_data_=u.getIncompleteData()),o&&(this.aac_last_sample_pts_=o)}},t.prototype.detectAudioMetadataChange=function(e){return e.audio_object_type!==this.audio_metadata_.audio_object_type?(a.a.v(this.TAG,"AAC: AudioObjectType changed from "+this.audio_metadata_.audio_object_type+" to "+e.audio_object_type),!0):e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index?(a.a.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+this.audio_metadata_.sampling_freq_index+" to "+e.sampling_freq_index),!0):e.channel_config!==this.audio_metadata_.channel_config&&(a.a.v(this.TAG,"AAC: Channel configuration changed from "+this.audio_metadata_.channel_config+" to "+e.channel_config),!0)},t.prototype.dispatchAudioInitSegment=function(e){var t=new U(e),i={type:"audio"};i.id=this.audio_track_.id,i.timescale=1e3,i.duration=this.duration_,i.audioSampleRate=t.sampling_rate,i.channelCount=t.channel_count,i.codec=t.codec_mimetype,i.originalCodec=t.original_codec_mimetype,i.config=t.config,i.refSampleDuration=1024/i.audioSampleRate*i.timescale,0==this.audio_init_segment_dispatched_&&a.a.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: "+i.codec),this.onTrackMetadata("audio",i),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var n=this.media_info_;n.hasAudio=!0,n.audioCodec=i.originalCodec,n.audioSampleRate=i.audioSampleRate,n.audioChannelCount=i.channelCount,n.hasVideo&&n.videoCodec?n.mimeType='video/mp2t; codecs="'+n.videoCodec+","+n.audioCodec+'"':n.mimeType='video/mp2t; codecs="'+n.audioCodec+'"',n.isComplete()&&this.onMediaInfo(n)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var n=new F;n.pid=e,n.stream_type=t,n.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(n)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,n,r){var a=new M;if(a.pid=n,a.stream_id=r,a.len=e.byteLength,a.data=e,null!=t){var s=Math.floor(t/this.timescale_);a.pts=s}else a.nearest_pts=this.aac_last_sample_pts_;if(null!=i){var o=Math.floor(i/this.timescale_);a.dts=o}this.onPESPrivateData&&this.onPESPrivateData(a)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,n,r){var a=new M;if(a.pid=n,a.stream_id=r,a.len=e.byteLength,a.data=e,null!=t){var s=Math.floor(t/this.timescale_);a.pts=s}if(null!=i){var o=Math.floor(i/this.timescale_);a.dts=o}this.onTimedID3Metadata&&this.onTimedID3Metadata(a)},t}(y),j=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,n=Array.prototype.slice.call(arguments,1),r=n.length,a=0;a<r;a++)t+=n[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var s=8;for(a=0;a<r;a++)i.set(n[a],s),s+=n[a].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),n=e.moov(t),r=new Uint8Array(i.byteLength+n.byteLength);return r.set(i,0),r.set(n,i.byteLength),r},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),n=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,i,n,r)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,n=t.duration,r=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,a>>>8&255,255&a,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,n=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))},e.hdlr=function(t){var i;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types[".mp3"],r)},e.mp4a=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types.mp4a,r,e.esds(t))},e.esds=function(t){var i=t.config||[],n=i.length,r=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(i).concat([6,1,2]));return e.box(e.types.esds,r)},e.avc1=function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>>8&255,255&n,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,a,e.box(e.types.avcC,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,n=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,n)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var n=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.sdtp(t),o=e.trun(t,s.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,a,o,s)},e.sdtp=function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),a=0;a<n;a++){var s=i[a].flags;r[a+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,r)},e.trun=function(t,i){var n=t.samples||[],r=n.length,a=12+16*r,s=new Uint8Array(a);i+=8+a,s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var o=0;o<r;o++){var u=n[o].duration,l=n[o].size,h=n[o].flags,d=n[o].cts;s.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,l>>>24&255,l>>>16&255,l>>>8&255,255&l,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o)}return e.box(e.types.trun,s)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();j.init();var V=j,H=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}(),z=i(7),G=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new z.c("audio"),this._videoSegmentInfoList=new z.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!s.a.chrome||!(s.a.version.major<50||50===s.a.version.major&&s.a.version.build<2661)),this._fillSilentAfterSeek=s.a.msedge||s.a.msie,this._mp3UseMpegAudio=!s.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new c.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,n="mp4",r=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",r="",i=new Uint8Array):i=V.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=V.generateInitSegment(t)}if(!this._onInitSegment)throw new c.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:r,container:e+"/"+n,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e&&e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,n=e,r=n.samples,o=void 0,u=-1,l=this._audioMeta.refSampleDuration,h="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,d=this._dtsBaseInited&&void 0===this._audioNextDts,c=!1;if(r&&0!==r.length&&(1!==r.length||t)){var f=0,p=null,m=0;h?(f=0,m=n.length):(f=8,m=8+n.length);var _=null;if(r.length>1&&(m-=(_=r.pop()).length),null!=this._audioStashedLastSample){var g=this._audioStashedLastSample;this._audioStashedLastSample=null,r.unshift(g),m+=g.length}null!=_&&(this._audioStashedLastSample=_);var v=r[0].dts-this._dtsBase;if(this._audioNextDts)o=v-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())o=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(c=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(v);if(null!=y){var b=v-(y.originalDts+y.duration);b<=3&&(b=0),o=v-(y.dts+y.duration+b)}else o=0}if(c){var S=v-o,T=this._videoSegmentInfoList.getLastSegmentBefore(v);if(null!=T&&T.beginDts<S){if(D=H.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var E=T.beginDts,w=S-T.beginDts;a.a.v(this.TAG,"InsertPrefixSilentAudio: dts: "+E+", duration: "+w),r.unshift({unit:D,dts:E,pts:E}),m+=D.byteLength}}else c=!1}for(var A=[],C=0;C<r.length;C++){var k=(g=r[C]).unit,P=g.dts-this._dtsBase,I=(E=P,!1),L=null,x=0;if(!(P<-.001)){if("mp3"!==this._audioMeta.codec){var R=P;if(this._audioNextDts&&(R=this._audioNextDts),(o=P-R)<=-3*l){a.a.w(this.TAG,"Dropping 1 audio frame (originalDts: "+P+" ms ,curRefDts: "+R+" ms) due to dtsCorrection: "+o+" ms overlap.");continue}if(o>=3*l&&this._fillAudioTimestampGap&&!s.a.safari){I=!0;var D,O=Math.floor(o/l);a.a.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+P+" ms, curRefDts: "+R+" ms, dtsCorrection: "+Math.round(o)+" ms, generate: "+O+" frames"),E=Math.floor(R),x=Math.floor(R+l)-E,null==(D=H.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(a.a.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),D=k),L=[];for(var U=0;U<O;U++){R+=l;var M=Math.floor(R),F=Math.floor(R+l)-M,B={dts:M,pts:M,cts:0,unit:D,size:D.byteLength,duration:F,originalDts:P,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};L.push(B),m+=B.size}this._audioNextDts=R+l}else E=Math.floor(R),x=Math.floor(R+l)-E,this._audioNextDts=R+l}else E=P-o,x=C!==r.length-1?r[C+1].dts-this._dtsBase-o-E:null!=_?_.dts-this._dtsBase-o-E:A.length>=1?A[A.length-1].duration:Math.floor(l),this._audioNextDts=E+x;-1===u&&(u=E),A.push({dts:E,pts:E,cts:0,unit:g.unit,size:g.unit.byteLength,duration:x,originalDts:P,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),I&&A.push.apply(A,L)}}if(0===A.length)return n.samples=[],void(n.length=0);for(h?p=new Uint8Array(m):((p=new Uint8Array(m))[0]=m>>>24&255,p[1]=m>>>16&255,p[2]=m>>>8&255,p[3]=255&m,p.set(V.types.mdat,4)),C=0;C<A.length;C++)k=A[C].unit,p.set(k,f),f+=k.byteLength;var N=A[A.length-1];i=N.dts+N.duration;var j,G=new z.b;G.beginDts=u,G.endDts=i,G.beginPts=u,G.endPts=i,G.originalBeginDts=A[0].originalDts,G.originalEndDts=N.originalDts+N.duration,G.firstSample=new z.d(A[0].dts,A[0].pts,A[0].duration,A[0].originalDts,!1),G.lastSample=new z.d(N.dts,N.pts,N.duration,N.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(G),n.samples=A,n.sequenceNumber++,j=h?new Uint8Array:V.moof(n,u),n.samples=[],n.length=0;var W={type:"audio",data:this._mergeBoxes(j,p).buffer,sampleCount:A.length,info:G};h&&d&&(W.timestampOffset=u),this._onMediaSegment("audio",W)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,n,r=e,a=r.samples,s=void 0,o=-1,u=-1;if(a&&0!==a.length&&(1!==a.length||t)){var l=8,h=null,d=8+e.length,c=null;if(a.length>1&&(d-=(c=a.pop()).length),null!=this._videoStashedLastSample){var f=this._videoStashedLastSample;this._videoStashedLastSample=null,a.unshift(f),d+=f.length}null!=c&&(this._videoStashedLastSample=c);var p=a[0].dts-this._dtsBase;if(this._videoNextDts)s=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())s=0;else{var m=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=m){var _=p-(m.originalDts+m.duration);_<=3&&(_=0),s=p-(m.dts+m.duration+_)}else s=0}for(var g=new z.b,v=[],y=0;y<a.length;y++){var b=(f=a[y]).dts-this._dtsBase,S=f.isKeyframe,T=b-s,E=f.cts,w=T+E;-1===o&&(o=T,u=w);var A=0;if(A=y!==a.length-1?a[y+1].dts-this._dtsBase-s-T:null!=c?c.dts-this._dtsBase-s-T:v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),S){var C=new z.d(T,w,A,f.dts,!0);C.fileposition=f.fileposition,g.appendSyncPoint(C)}v.push({dts:T,pts:w,cts:E,units:f.units,size:f.length,isKeyframe:S,duration:A,originalDts:b,flags:{isLeading:0,dependsOn:S?2:1,isDependedOn:S?1:0,hasRedundancy:0,isNonSync:S?0:1}})}for((h=new Uint8Array(d))[0]=d>>>24&255,h[1]=d>>>16&255,h[2]=d>>>8&255,h[3]=255&d,h.set(V.types.mdat,4),y=0;y<v.length;y++)for(var k=v[y].units;k.length;){var P=k.shift().data;h.set(P,l),l+=P.byteLength}var I=v[v.length-1];if(i=I.dts+I.duration,n=I.pts+I.duration,this._videoNextDts=i,g.beginDts=o,g.endDts=i,g.beginPts=u,g.endPts=n,g.originalBeginDts=v[0].originalDts,g.originalEndDts=I.originalDts+I.duration,g.firstSample=new z.d(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),g.lastSample=new z.d(I.dts,I.pts,I.duration,I.originalDts,I.isKeyframe),this._isLive||this._videoSegmentInfoList.append(g),r.samples=v,r.sequenceNumber++,this._forceFirstIDR){var L=v[0].flags;L.dependsOn=2,L.isNonSync=0}var x=V.moof(r,o);r.samples=[],r.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(x,h).buffer,sampleCount:v.length,info:g})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}(),W=i(11),Y=i(1),q=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new r.a,this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(n){n.timestampBase=i,i+=n.duration,n.cors=e.cors,n.withCredentials=e.withCredentials,t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],n=this._ioctl=new W.a(i,this._config,e);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var n=i.getNearestKeyframe(e);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var r=this._mediaInfo.segments[t];null==r?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(n=r.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,n=0;n<t.length;n++)if(e<t[n].timestampBase){i=n-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,n=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((n=N.probe(e)).match){var s=this._demuxer=new N(n,this._config);this._remuxer||(this._remuxer=new G(this._config)),s.onError=this._onDemuxException.bind(this),s.onMediaInfo=this._onMediaInfo.bind(this),s.onMetaDataArrived=this._onMetaDataArrived.bind(this),s.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),s.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),s.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),r=this._demuxer.parseChunks(e,t)}else if((n=v.probe(e)).match){this._demuxer=new v(n,this._config),this._remuxer||(this._remuxer=new G(this._config));var o=this._mediaDataSource;null==o.duration||isNaN(o.duration)||(this._demuxer.overridedDuration=o.duration),"boolean"==typeof o.hasAudio&&(this._demuxer.overridedHasAudio=o.hasAudio),"boolean"==typeof o.hasVideo&&(this._demuxer.overridedHasVideo=o.hasVideo),this._demuxer.timestampBase=o.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),r=this._demuxer.parseChunks(e,t)}else n=null,a.a.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(Y.a.DEMUX_ERROR,g.a.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"),r=0;return r},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,o.a.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,o.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(Y.a.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(Y.a.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t=this._remuxer.getTimestampBase();null!=t&&(null!=e.pts&&(e.pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(Y.a.TIMED_ID3_METADATA_ARRIVED,e))},e.prototype._onPESPrivateDataDescriptor=function(e){this._emitter.emit(Y.a.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t=this._remuxer.getTimestampBase();null!=t&&(null!=e.pts&&(e.pts-=t),null!=e.nearest_pts&&(e.nearest_pts-=t),null!=e.dts&&(e.dts-=t),this._emitter.emit(Y.a.PES_PRIVATE_DATA_ARRIVED,e))},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(Y.a.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(Y.a.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){a.a.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(Y.a.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){a.a.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(Y.a.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(Y.a.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(Y.a.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.a.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(Y.a.RECOMMEND_SEEKPOINT,n)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(Y.a.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(Y.a.STATISTICS_INFO,e)},e}();t.a=q},function(e,t,i){"use strict";var n,r=i(0),a=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}(),s=i(2),o=i(4),u=i(3),l=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),h=function(e){function t(t,i){var n=e.call(this,"fetch-stream-loader")||this;return n.TAG="FetchStreamLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._requestAbort=!1,n._abortController=null,n._contentLength=null,n._receivedLength=0,n}return l(t,e),t.isSupported=function(){try{var e=o.a.msedge&&o.a.version.minor>=15048,t=!o.a.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t),a=new self.Headers;if("object"==typeof r.headers){var o=r.headers;for(var l in o)o.hasOwnProperty(l)&&a.append(l,o[l])}var h={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)a.append(l,this._config.headers[l]);!1===e.cors&&(h.mode="same-origin"),e.withCredentials&&(h.credentials="include"),e.referrerPolicy&&(h.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,h.signal=this._abortController.signal),this._status=s.c.kConnecting,self.fetch(r.url,h).then((function(e){if(i._requestAbort)return i._status=s.c.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==r.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=s.c.kError,!i._onError)throw new u.d("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(s.b.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=s.c.kError,!i._onError)throw e;i._onError(s.b.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==s.c.kBuffering||!o.a.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=s.c.kError;var n=s.b.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new u.d(r.msg);t._onError(n,r)}else t._status=s.c.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=s.c.kComplete);if(!0===t._requestAbort)return t._status=s.c.kComplete,e.cancel();t._status=s.c.kBuffering;var a=i.value.buffer,o=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,o,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=s.c.kComplete;else if(11!==e.code||!o.a.msedge){t._status=s.c.kError;var i=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=s.b.EXCEPTION,n={code:e.code,msg:e.message}):(i=s.b.EARLY_EOF,n={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new u.d(n.msg);t._onError(i,n)}}))},t}(s.a),d=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),c=function(e){function t(t,i){var n=e.call(this,"xhr-moz-chunked-loader")||this;return n.TAG="MozChunkedLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return d(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return r.a.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var n=this._seekHandler.getConfig(i,t);this._requestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="moz-chunked-arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onloadend=this._onLoadEnd.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var a=n.headers;for(var o in a)a.hasOwnProperty(o)&&r.setRequestHeader(o,a[o])}if("object"==typeof this._config.headers)for(var o in a=this._config.headers)a.hasOwnProperty(o)&&r.setRequestHeader(o,a[o]);this._status=s.c.kConnecting,r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=s.c.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=s.c.kError,!this._onError)throw new u.d("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(s.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=s.c.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==s.c.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==s.c.kError&&(this._status=s.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=s.c.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=s.b.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=s.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.d(i.msg);this._onError(t,i)},t}(s.a),f=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),p=function(e){function t(t,i){var n=e.call(this,"xhr-range-loader")||this;return n.TAG="RangeLoader",n._seekHandler=t,n._config=i,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new a,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return f(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return r.a.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=s.c.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var n=this._seekHandler.getConfig(i,t);this._currentRequestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onload=this._onLoad.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var a=n.headers;for(var s in a)a.hasOwnProperty(s)&&r.setRequestHeader(s,a[s])}if("object"==typeof this._config.headers)for(var s in a=this._config.headers)a.hasOwnProperty(s)&&r.setRequestHeader(s,a[s]);r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=s.c.kComplete},t.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=s.c.kBuffering}else{if(this._status=s.c.kError,!this._onError)throw new u.d("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(s.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==s.c.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var n=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(n)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}},t.prototype._onLoad=function(e){if(this._status!==s.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),a&&(this._status=s.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=s.c.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=s.b.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=s.b.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.d(i.msg);this._onError(t,i)},t}(s.a),m=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),_=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return m(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=s.c.kConnecting}catch(e){this._status=s.c.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new u.d(i.msg);this._onError(s.b.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=s.c.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=s.c.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=s.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=s.c.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new u.d(n.msg);this._onError(s.b.EXCEPTION,n)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=s.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new u.d(t.msg);this._onError(s.b.EXCEPTION,t)},t}(s.a),g=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i,n={};0!==t.from||-1!==t.to?(i=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",n.Range=i):this._zeroStart&&(n.Range="bytes=0-");return{url:e,headers:n}},e.prototype.removeURLParameters=function(e){return e},e}(),v=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var n=!0;-1===i.indexOf("?")&&(i+="?",n=!1),n&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));var r="";if(null!=i&&i.length>0)for(var a=i.split("&"),s=0;s<a.length;s++){var o=a[s].split("="),u=s>0;o[0]!==this._startName&&o[0]!==this._endName&&(u&&(r+="&"),r+=a[s])}return 0===r.length?t:t+"?"+r},e}(),y=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new a,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===p?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new g(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new v(t,i)}else{if("custom"!==e.seekType)throw new u.b("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new u.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=_;else if(h.isSupported())this._loaderClass=h;else if(c.isSupported())this._loaderClass=c;else{if(!p.isSupported())throw new u.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new u.b("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var n=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(n,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new u.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var n=this._speedSampler.lastSecondKBps;if(0!==n){var r=this._normalizeSpeed(n);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(o=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(o=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var a=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(a,this._stashByteStart))<a.byteLength?l>0&&(h=new Uint8Array(a,l),o.set(h,0),this._stashUsed=h.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(s),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(e,l),0),this._stashUsed+=s,this._stashByteStart=t+l);else if(0===this._stashUsed){var s;(l=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-l)>this._bufferSize&&this._expandBuffer(s),(o=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=s,this._stashByteStart=t+l)}else{var o,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(o=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var h=new Uint8Array(this._stashBuffer,l);o.set(h,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),n=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,i);a.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=i}return 0}r.a.w(this.TAG,n+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,n}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(r.a.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=s.b.UNRECOVERABLE_EARLY_EOF),e){case s.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(r.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=s.b.UNRECOVERABLE_EARLY_EOF;break;case s.b.UNRECOVERABLE_EARLY_EOF:case s.b.CONNECTING_TIMEOUT:case s.b.HTTP_STATUS_CODE_INVALID:case s.b.EXCEPTION:}if(!this._onError)throw new u.d("IOException: "+t.msg);this._onError(e,t)},e}();t.a=y},function(e,t,i){"use strict";var n=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t},"function"!=typeof self.Promise&&i(15).polyfill()},e}();n.install(),t.a=n},function(e,t,i){function n(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var n=i(i.s=ENTRY_MODULE);return n.default||n}function r(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var s=t.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var u,l=o[1],h=new RegExp("(\\\\n|\\W)"+r(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=h.exec(s);)"dll-reference"!==u[3]&&a[n].push(u[3]);for(h=new RegExp("\\("+r(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=h.exec(s);)e[u[2]]||(a[n].push(u[1]),e[u[2]]=i(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var d,c=Object.keys(a),f=0;f<c.length;f++)for(var p=0;p<a[c[f]].length;p++)d=a[c[f]][p],isNaN(1*d)||(a[c[f]][p]=1*a[c[f]][p]);return a}function s(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:i.m},o=t.all?{main:Object.keys(r.main)}:function(e,t){for(var i={main:[t]},n={main:[]},r={main:{}};s(i);)for(var o=Object.keys(i),u=0;u<o.length;u++){var l=o[u],h=i[l].pop();if(r[l]=r[l]||{},!r[l][h]&&e[l][h]){r[l][h]=!0,n[l]=n[l]||[],n[l].push(h);for(var d=a(e,e[l][h],l),c=Object.keys(d),f=0;f<c.length;f++)i[c[f]]=i[c[f]]||[],i[c[f]]=i[c[f]].concat(d[c[f]])}}return n}(r,e),u="";Object.keys(o).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;o[e][t];)t++;o[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),u=u+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(t.bare)return l;var h=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),d=new window.Worker(h);return d.objectURL=h,d}},function(e,t,i){e.exports=i(19).default},function(e,t,i){(function(t,i){
-/*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version v4.2.8+1e68dce6
- */
-var n;n=function(){"use strict";function e(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,a=void 0,s=void 0,o=function(e,t){p[r]=e,p[r+1]=t,2===(r+=2)&&(s?s(m):b())},u="undefined"!=typeof window?window:void 0,l=u||{},h=l.MutationObserver||l.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),c="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function f(){var e=setTimeout;return function(){return e(m,1)}}var p=new Array(1e3);function m(){for(var e=0;e<r;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;r=0}var _,g,v,y,b=void 0;function S(e,t){var i=this,n=new this.constructor(w);void 0===n[E]&&O(n);var r=i._state;if(r){var a=arguments[r-1];o((function(){return R(r,n,a,i._result)}))}else L(i,n,e,t);return n}function T(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return C(t,e),t}d?b=function(){return t.nextTick(m)}:h?(g=0,v=new h(m),y=document.createTextNode(""),v.observe(y,{characterData:!0}),b=function(){y.data=g=++g%2}):c?((_=new MessageChannel).port1.onmessage=m,b=function(){return _.port2.postMessage(0)}):b=void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(a=e.runOnLoop||e.runOnContext)?function(){a(m)}:f()}catch(e){return f()}}():f();var E=Math.random().toString(36).substring(2);function w(){}function A(t,i,n){i.constructor===t.constructor&&n===S&&i.constructor.resolve===T?function(e,t){1===t._state?P(e,t._result):2===t._state?I(e,t._result):L(t,void 0,(function(t){return C(e,t)}),(function(t){return I(e,t)}))}(t,i):void 0===n?P(t,i):e(n)?function(e,t,i){o((function(e){var n=!1,r=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(i,t,(function(i){n||(n=!0,t!==i?C(e,i):P(e,i))}),(function(t){n||(n=!0,I(e,t))}),e._label);!n&&r&&(n=!0,I(e,r))}),e)}(t,i,n):P(t,i)}function C(e,t){if(e===t)I(e,new TypeError("You cannot resolve a promise with itself"));else if(r=typeof(n=t),null===n||"object"!==r&&"function"!==r)P(e,t);else{var i=void 0;try{i=t.then}catch(t){return void I(e,t)}A(e,t,i)}var n,r}function k(e){e._onerror&&e._onerror(e._result),x(e)}function P(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&o(x,e))}function I(e,t){void 0===e._state&&(e._state=2,e._result=t,o(k,e))}function L(e,t,i,n){var r=e._subscribers,a=r.length;e._onerror=null,r[a]=t,r[a+1]=i,r[a+2]=n,0===a&&e._state&&o(x,e)}function x(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,a=e._result,s=0;s<t.length;s+=3)n=t[s],r=t[s+i],n?R(i,n,r,a):r(a);e._subscribers.length=0}}function R(t,i,n,r){var a=e(n),s=void 0,o=void 0,u=!0;if(a){try{s=n(r)}catch(e){u=!1,o=e}if(i===s)return void I(i,new TypeError("A promises callback cannot return that same promise."))}else s=r;void 0!==i._state||(a&&u?C(i,s):!1===u?I(i,o):1===t?P(i,s):2===t&&I(i,s))}var D=0;function O(e){e[E]=D++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[E]||O(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&P(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===T){var r=void 0,a=void 0,s=!1;try{r=e.then}catch(e){s=!0,a=e}if(r===S&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===M){var o=new i(w);s?I(o,a):A(o,e,r),this._willSettleAt(o,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?I(n,i):this._result[t]=i),0===this._remaining&&P(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;L(e,void 0,(function(e){return i._settledAt(1,t,e)}),(function(e){return i._settledAt(2,t,e)}))},e}(),M=function(){function t(e){this[E]=D++,this._result=this._state=void 0,this._subscribers=[],w!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){C(e,t)}),(function(t){I(e,t)}))}catch(t){I(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var i=this.constructor;return e(t)?this.then((function(e){return i.resolve(t()).then((function(){return e}))}),(function(e){return i.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return M.prototype.then=S,M.all=function(e){return new U(this,e).promise},M.race=function(e){var t=this;return n(e)?new t((function(i,n){for(var r=e.length,a=0;a<r;a++)t.resolve(e[a]).then(i,n)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},M.resolve=T,M.reject=function(e){var t=new this(w);return I(t,e),t},M._setScheduler=function(e){s=e},M._setAsap=function(e){o=e},M._asap=o,M.polyfill=function(){var e=void 0;if(void 0!==i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=M},M.Promise=M,M},e.exports=n()}).call(this,i(16),i(17))},function(e,t){var i,n,r=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(i===setTimeout)return setTimeout(e,0);if((i===a||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:a}catch(e){i=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,l=[],h=!1,d=-1;function c(){h&&u&&(h=!1,u.length?l=u.concat(l):d=-1,l.length&&f())}function f(){if(!h){var e=o(c);h=!0;for(var t=l.length;t;){for(u=l,l=[];++d<t;)u&&u[d].run();d=-1,t=l.length}u=null,h=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new p(e,t)),1!==l.length||h||o(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";i.r(t);var n=i(9),r=i(12),a=i(10),s=i(1);t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function o(t,i){var n={msg:s.a.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function u(t,i){var n={msg:s.a.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function l(){var t={msg:s.a.LOADING_COMPLETE};e.postMessage(t)}function h(){var t={msg:s.a.RECOVERED_EARLY_EOF};e.postMessage(t)}function d(t){var i={msg:s.a.MEDIA_INFO,data:t};e.postMessage(i)}function c(t){var i={msg:s.a.METADATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:s.a.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:s.a.TIMED_ID3_METADATA_ARRIVED,data:t};e.postMessage(i)}function m(t){var i={msg:s.a.PES_PRIVATE_DATA_DESCRIPTOR,data:t};e.postMessage(i)}function _(t){var i={msg:s.a.PES_PRIVATE_DATA_ARRIVED,data:t};e.postMessage(i)}function g(t){var i={msg:s.a.STATISTICS_INFO,data:t};e.postMessage(i)}function v(t,i){e.postMessage({msg:s.a.IO_ERROR,data:{type:t,info:i}})}function y(t,i){e.postMessage({msg:s.a.DEMUX_ERROR,data:{type:t,info:i}})}function b(t){e.postMessage({msg:s.a.RECOMMEND_SEEKPOINT,data:t})}r.a.install(),e.addEventListener("message",(function(r){switch(r.data.cmd){case"init":(t=new a.a(r.data.param[0],r.data.param[1])).on(s.a.IO_ERROR,v.bind(this)),t.on(s.a.DEMUX_ERROR,y.bind(this)),t.on(s.a.INIT_SEGMENT,o.bind(this)),t.on(s.a.MEDIA_SEGMENT,u.bind(this)),t.on(s.a.LOADING_COMPLETE,l.bind(this)),t.on(s.a.RECOVERED_EARLY_EOF,h.bind(this)),t.on(s.a.MEDIA_INFO,d.bind(this)),t.on(s.a.METADATA_ARRIVED,c.bind(this)),t.on(s.a.SCRIPTDATA_ARRIVED,f.bind(this)),t.on(s.a.TIMED_ID3_METADATA_ARRIVED,p.bind(this)),t.on(s.a.PES_PRIVATE_DATA_DESCRIPTOR,m.bind(this)),t.on(s.a.PES_PRIVATE_DATA_ARRIVED,_.bind(this)),t.on(s.a.STATISTICS_INFO,g.bind(this)),t.on(s.a.RECOMMEND_SEEKPOINT,b.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(r.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var S=r.data.param;n.a.applyConfig(S),!0===S.enableCallback?n.a.addLogListener(i):n.a.removeLogListener(i)}}))}},function(e,t,i){"use strict";i.r(t);var n=i(12),r=i(11),a={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function s(){return Object.assign({},a)}var o=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new r.a({},s()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new r.a({},s()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),u=i(2),l=i(6),h=i.n(l),d=i(0),c=i(4),f={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info"},p=i(13),m=i.n(p),_=i(9),g=i(10),v=i(1),y=i(8),b=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new h.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=m()(18),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},_.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:_.a.getConfig()})}catch(i){d.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new g.a(e,t)}else this._controller=new g.a(e,t);if(this._controller){var i=this._controller;i.on(v.a.IO_ERROR,this._onIOError.bind(this)),i.on(v.a.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(v.a.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(v.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(v.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(v.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(v.a.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(v.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(v.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(v.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),i.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),i.on(v.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),i.on(v.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(v.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),_.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(v.a.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(v.a.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(v.a.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(v.a.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.TIMED_ID3_METADATA_ARRIVED,e)}))},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.PES_PRIVATE_DATA_DESCRIPTOR,e)}))},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.PES_PRIVATE_DATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(v.a.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(v.a.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(v.a.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case v.a.INIT_SEGMENT:case v.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case v.a.LOADING_COMPLETE:case v.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case v.a.MEDIA_INFO:Object.setPrototypeOf(i,y.a.prototype),this._emitter.emit(t.msg,i);break;case v.a.METADATA_ARRIVED:case v.a.SCRIPTDATA_ARRIVED:case v.a.TIMED_ID3_METADATA_ARRIVED:case v.a.PES_PRIVATE_DATA_DESCRIPTOR:case v.a.PES_PRIVATE_DATA_ARRIVED:case v.a.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case v.a.IO_ERROR:case v.a.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case v.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":d.a.emitter.emit("log",i.type,i.logcat)}},e}(),S="error",T="source_open",E="update_end",w="buffer_full",A=i(7),C=i(3),k=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new h.a,this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new A.a}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new C.a("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(e){d.a.e(this.TAG,e.message)}n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){d.a.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,n=""+i.container;i.codec&&i.codec.length>0&&(n+=";codecs="+i.codec);var r=!1;if(d.a.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[i.type]=i,n!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])d.a.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+n);else{r=!0;try{var a=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(n);a.addEventListener("error",this.e.onSourceBufferError),a.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return d.a.e(this.TAG,e.message),void this._emitter.emit(S,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=n}t||this._pendingSegments[i.type].push(i),r||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),c.a.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){d.a.e(this.TAG,e.message)}this._idrList.clear();var n=this._pendingSegments[t];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<i.buffered.length;r++){var a=i.buffered.start(r),s=i.buffered.end(r);this._pendingRemoveRanges[t].push({start:a,end:s})}if(i.updating||this._doRemoveRanges(),c.a.safari){var o=this._lastInitSegments[t];o&&(this._pendingSegments[t].push(o),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var n=i.buffered;if(n.length>=1&&e-n.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var n=i.buffered,r=!1,a=0;a<n.length;a++){var s=n.start(a),o=n.end(a);if(s<=e&&e<o+3){if(e-s>=this._config.autoCleanupMaxBackwardDuration){r=!0;var u=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:s,end:u})}}else o<e&&(r=!0,this._pendingRemoveRanges[t].push({start:s,end:o}))}r&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(d.a.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var n=i.shift();t.remove(n.start,n.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var n=this._sourceBuffers[t].timestampOffset,r=i.timestampOffset/1e3;Math.abs(n-r)>.1&&(d.a.v(this.TAG,"Update MPEG audio timestampOffset from "+n+" to "+r),this._sourceBuffers[t].timestampOffset=r),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(w),this._isBufferFull=!0):(d.a.e(this.TAG,e.message),this._emitter.emit(S,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(d.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(T)},e.prototype._onSourceEnded=function(){d.a.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){d.a.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(E)},e.prototype._onSourceBufferError=function(e){d.a.e(this.TAG,"SourceBuffer Error: "+e)},e}(),P=i(5),I={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},L={NETWORK_EXCEPTION:u.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:u.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:u.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:u.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:P.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:P.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:P.a.CODEC_UNSUPPORTED},x=function(){function e(e,t){this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new h.a,this._config=s(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"!==i&&"mpegts"!==i&&"m2ts"!==i&&"flv"!==i)throw new C.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");!0===e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var n=c.a.chrome&&(c.a.version.major<50||50===c.a.version.major&&c.a.version.build<2661);this._alwaysSeekKeyframe=!!(n||c.a.msedge||c.a.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===f.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(f.MEDIA_INFO,i.mediaInfo)})):e===f.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(f.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new k(this._config),this._msectl.on(E,this._onmseUpdateEnd.bind(this)),this._msectl.on(w,this._onmseBufferFull.bind(this)),this._msectl.on(T,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(S,(function(e){t._emitter.emit(f.ERROR,I.MEDIA_ERROR,L.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new C.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new C.a("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new b(this._mediaDataSource,this._config),this._transmuxer.on(v.a.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(v.a.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var n=e._mediaElement.currentTime;i.info.endDts>=1e3*(n+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(d.a.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(v.a.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(f.LOADING_COMPLETE)})),this._transmuxer.on(v.a.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(f.RECOVERED_EARLY_EOF)})),this._transmuxer.on(v.a.IO_ERROR,(function(t,i){e._emitter.emit(f.ERROR,I.NETWORK_ERROR,t,i)})),this._transmuxer.on(v.a.DEMUX_ERROR,(function(t,i){e._emitter.emit(f.ERROR,I.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(v.a.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(f.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(v.a.METADATA_ARRIVED,(function(t){e._emitter.emit(f.METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(f.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(v.a.TIMED_ID3_METADATA_ARRIVED,(function(t){e._emitter.emit(f.TIMED_ID3_METADATA_ARRIVED,t)})),this._transmuxer.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR,(function(t){e._emitter.emit(f.PES_PRIVATE_DATA_DESCRIPTOR,t)})),this._transmuxer.on(v.a.PES_PRIVATE_DATA_ARRIVED,(function(t){e._emitter.emit(f.PES_PRIVATE_DATA_ARRIVED,t)})),this._transmuxer.on(v.a.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(f.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(v.a.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},e.prototype._onmseUpdateEnd=function(){var e=this._mediaElement.buffered,t=this._mediaElement.currentTime;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&e.length>0&&!this._mediaElement.paused){var i=e.end(e.length-1);if(i>this._config.liveBufferLatencyMaxLatency&&i-t>this._config.liveBufferLatencyMaxLatency){var n=i-this._config.liveBufferLatencyMinRemain;this.currentTime=n}}if(this._config.lazyLoad&&!this._config.isLive){for(var r=0,a=0;a<e.length;a++){var s=e.start(a),o=e.end(a);if(s<=t&&t<o){r=o;break}}r>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(d.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){d.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,n=0;n<t.length;n++){var r=t.start(n),a=t.end(n);if(e>=r&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(d.a.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var n=t.start(i),r=t.end(i);if(e>=n&&e<r)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,n=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||c.a.safari)&&(i=!0,n=c.a.safari?.1:r)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=n;else if(t){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(d.a.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var n=i.start(0);if(n<1&&t<n||c.a.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=c.a.safari?.1:n)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}(),R=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new h.a,this._config=s(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new C.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new C.b("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===f.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(f.MEDIA_INFO,i.mediaInfo)})):e===f.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(f.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new C.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(f.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(f.STATISTICS_INFO,this.statisticsInfo)},e}();n.a.install();var D={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new C.b("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new C.b("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new x(i,t);default:return new R(i,t)}},isSupported:function(){return o.supportMSEH264Playback()},getFeatureList:function(){return o.getFeatureList()}};D.BaseLoader=u.a,D.LoaderStatus=u.c,D.LoaderErrors=u.b,D.Events=f,D.ErrorTypes=I,D.ErrorDetails=L,D.MSEPlayer=x,D.NativePlayer=R,D.LoggingControl=_.a,Object.defineProperty(D,"version",{enumerable:!0,get:function(){return"1.6.10"}}),t.default=D}])},"object"==typeof i&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof i?i.mpegts=r():n.mpegts=r()},{}],42:[function(e,t,i){var n=Math.pow(2,32);t.exports=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},r=12;0===i.version?(i.earliestPresentationTime=t.getUint32(r),i.firstOffset=t.getUint32(r+4),r+=8):(i.earliestPresentationTime=t.getUint32(r)*n+t.getUint32(r+4),i.firstOffset=t.getUint32(r+8)*n+t.getUint32(r+12),r+=16),r+=2;var a=t.getUint16(r);for(r+=2;a>0;r+=12,a--)i.references.push({referenceType:(128&e[r])>>>7,referencedSize:2147483647&t.getUint32(r),subsegmentDuration:t.getUint32(r+4),startsWithSap:!!(128&e[r+8]),sapType:(112&e[r+8])>>>4,sapDeltaTime:268435455&t.getUint32(r+8)});return i}},{}],43:[function(e,t,i){var n,r,a,s,o,u,l;n=function(e){return 9e4*e},r=function(e,t){return e*t},a=function(e){return e/9e4},s=function(e,t){return e/t},o=function(e,t){return n(s(e,t))},u=function(e,t){return r(a(e),t)},l=function(e,t,i){return a(i?e:e-t)},t.exports={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:n,secondsToAudioTs:r,videoTsToSeconds:a,audioTsToSeconds:s,audioTsToVideoTs:o,videoTsToAudioTs:u,metadataTsToSeconds:l}},{}],44:[function(e,t,i){var n,r,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,h=[],d=!1,c=-1;function f(){d&&l&&(d=!1,l.length?h=l.concat(h):c=-1,h.length&&p())}function p(){if(!d){var e=u(f);d=!0;for(var t=h.length;t;){for(l=h,h=[];++c<t;)l&&l[c].run();c=-1,t=h.length}l=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function _(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];h.push(new m(e,t)),1!==h.length||d||u(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=_,a.addListener=_,a.once=_,a.off=_,a.removeListener=_,a.removeAllListeners=_,a.emit=_,a.prependListener=_,a.prependOnceListener=_,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],45:[function(e,t,i){t.exports=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]}},{}],46:[function(e,t,i){var n,r,a,s,o,u;n=this,r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,a=/^([^\/?#]*)([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,u={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=u.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=u.normalizePath(n.path),u.buildURLFromParts(n)}var r=u.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=u.normalizePath(r.path),u.buildURLFromParts(r)):t;var s=u.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var o=a.exec(s.path);s.netLoc=o[1],s.path=o[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(l.netLoc=s.netLoc,"/"!==r.path[0]))if(r.path){var h=s.path,d=h.substring(0,h.lastIndexOf("/")+1)+r.path;l.path=u.normalizePath(d)}else l.path=s.path,r.params||(l.params=s.params,r.query||(l.query=s.query));return null===l.path&&(l.path=i.alwaysNormalize?u.normalizePath(r.path):r.path),u.buildURLFromParts(l)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},"object"==typeof i&&"object"==typeof t?t.exports=u:"function"==typeof define&&define.amd?define([],(function(){return u})):"object"==typeof i?i.URLToolkit=u:n.URLToolkit=u},{}],47:[function(e,t,i){
-/**
- * @license
- * Video.js 7.15.4 <http://videojs.com/>
- * Copyright Brightcove, Inc. <https://www.brightcove.com/>
- * Available under Apache License Version 2.0
- * <https://github.com/videojs/video.js/blob/main/LICENSE>
- *
- * Includes vtt.js <https://github.com/mozilla/vtt.js>
- * Available under Apache License Version 2.0
- * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
- */
-"use strict";var n=e("global/window"),r=e("global/document"),a=e("@babel/runtime/helpers/extends"),s=e("@babel/runtime/helpers/assertThisInitialized"),o=e("@babel/runtime/helpers/inheritsLoose"),u=e("safe-json-parse/tuple"),l=e("keycode"),h=e("@videojs/xhr"),d=e("videojs-vtt.js"),c=e("@babel/runtime/helpers/construct"),f=e("@babel/runtime/helpers/inherits"),p=e("@videojs/vhs-utils/cjs/resolve-url.js"),m=e("m3u8-parser"),_=e("@videojs/vhs-utils/cjs/codecs.js"),g=e("@videojs/vhs-utils/cjs/media-types.js"),v=e("mpd-parser"),y=e("mux.js/lib/tools/parse-sidx"),b=e("@videojs/vhs-utils/cjs/id3-helpers"),S=e("@videojs/vhs-utils/cjs/containers"),T=e("@videojs/vhs-utils/cjs/byte-helpers"),E=e("mux.js/lib/utils/clock");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}for(var A,C=w(n),k=w(r),P=w(a),I=w(s),L=w(o),x=w(u),R=w(l),D=w(h),O=w(d),U=w(c),M=w(f),F=w(p),B=w(y),N={},j=function(e,t){return N[e]=N[e]||[],t&&(N[e]=N[e].concat(t)),N[e]},V=function(e,t){var i=j(e).indexOf(t);return!(i<=-1)&&(N[e]=N[e].slice(),N[e].splice(i,1),!0)},H={prefixed:!0},z=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],G=z[0],W=0;W<z.length;W++)if(z[W][1]in k.default){A=z[W];break}if(A){for(var Y=0;Y<A.length;Y++)H[G[Y]]=A[Y];H.prefixed=A[0]!==G[0]}var q=[];var K=function e(t){var i,n="info",r=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i("log",n,t)};return i=function(e,t){return function(i,n,r){var a=t.levels[n],s=new RegExp("^("+a+")$");if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),q){q.push([].concat(r));var o=q.length-1e3;q.splice(0,o>0?o:0)}if(C.default.console){var u=C.default.console[i];u||"debug"!==i||(u=C.default.console.info||C.default.console.log),u&&a&&s.test(i)&&u[Array.isArray(r)?"apply":"call"](C.default.console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return q?[].concat(q):[]}).filter=function(e){return(q||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){q&&(q.length=0)},r.history.disable=function(){null!==q&&(q.length=0,q=null)},r.history.enable=function(){null===q&&(q=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("error",n,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("warn",n,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("debug",n,t)},r}("VIDEOJS"),X=K.createLogger,Q=Object.prototype.toString,$=function(e){return ee(e)?Object.keys(e):[]};function J(e,t){$(e).forEach((function(i){return t(e[i],i)}))}function Z(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?P.default.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&J(t,(function(t,i){e[i]=t}))})),e)}function ee(e){return!!e&&"object"==typeof e}function te(e){return ee(e)&&"[object Object]"===Q.call(e)&&e.constructor===Object}function ie(e,t){if(!e||!t)return"";if("function"==typeof C.default.getComputedStyle){var i;try{i=C.default.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}var ne,re=C.default.navigator&&C.default.navigator.userAgent||"",ae=/AppleWebKit\/([\d.]+)/i.exec(re),se=ae?parseFloat(ae.pop()):null,oe=/iPod/i.test(re),ue=(ne=re.match(/OS (\d+)_/i))&&ne[1]?ne[1]:null,le=/Android/i.test(re),he=function(){var e=re.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),de=le&&he<5&&se<537,ce=/Firefox/i.test(re),fe=/Edg/i.test(re),pe=!fe&&(/Chrome/i.test(re)||/CriOS/i.test(re)),me=function(){var e=re.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),_e=function(){var e=/MSIE\s(\d+)\.\d/.exec(re),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(re)&&/rv:11.0/.test(re)&&(t=11),t}(),ge=/Safari/i.test(re)&&!pe&&!le&&!fe,ve=/Windows/i.test(re),ye=Boolean(ke()&&("ontouchstart"in C.default||C.default.navigator.maxTouchPoints||C.default.DocumentTouch&&C.default.document instanceof C.default.DocumentTouch)),be=/iPad/i.test(re)||ge&&ye&&!/iPhone/i.test(re),Se=/iPhone/i.test(re)&&!be,Te=Se||be||oe,Ee=(ge||Te)&&!pe,we=Object.freeze({__proto__:null,IS_IPOD:oe,IOS_VERSION:ue,IS_ANDROID:le,ANDROID_VERSION:he,IS_NATIVE_ANDROID:de,IS_FIREFOX:ce,IS_EDGE:fe,IS_CHROME:pe,CHROME_VERSION:me,IE_VERSION:_e,IS_SAFARI:ge,IS_WINDOWS:ve,TOUCH_ENABLED:ye,IS_IPAD:be,IS_IPHONE:Se,IS_IOS:Te,IS_ANY_SAFARI:Ee});function Ae(e){return"string"==typeof e&&Boolean(e.trim())}function Ce(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ke(){return k.default===C.default.document}function Pe(e){return ee(e)&&1===e.nodeType}function Ie(){try{return C.default.parent!==C.default.self}catch(e){return!0}}function Le(e){return function(t,i){if(!Ae(t))return k.default[e](null);Ae(i)&&(i=k.default.querySelector(i));var n=Pe(i)?i:k.default;return n[e]&&n[e](t)}}function xe(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=k.default.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(K.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?Re(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&$e(r,n),r}function Re(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function De(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Oe(e,t){return Ce(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function Ue(e,t){return e.classList?e.classList.add(t):Oe(e,t)||(e.className=(e.className+" "+t).trim()),e}function Me(e,t){return e?(e.classList?e.classList.remove(t):(Ce(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(K.warn("removeClass was called with an element that doesn't exist"),null)}function Fe(e,t,i){var n=Oe(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?Ue(e,t):Me(e,t),e}function Be(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function Ne(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function je(e,t){return e.getAttribute(t)}function Ve(e,t,i){e.setAttribute(t,i)}function He(e,t){e.removeAttribute(t)}function ze(){k.default.body.focus(),k.default.onselectstart=function(){return!1}}function Ge(){k.default.onselectstart=function(){return!0}}function We(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(ie(e,"height"))),i.width||(i.width=parseFloat(ie(e,"width"))),i}}function Ye(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==k.default[H.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function qe(e,t){var i={x:0,y:0};if(Te)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=ie(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},u=Ye(t.target),l=Ye(e),h=l.width,d=l.height,c=t.offsetY-(l.top-u.top),f=t.offsetX-(l.left-u.left);return t.changedTouches&&(f=t.changedTouches[0].pageX-l.left,c=t.changedTouches[0].pageY+l.top,Te&&(f-=i.x,c-=i.y)),o.y=1-Math.max(0,Math.min(1,c/d)),o.x=Math.max(0,Math.min(1,f/h)),o}function Ke(e){return ee(e)&&3===e.nodeType}function Xe(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Qe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),Pe(e)||Ke(e)?e:"string"==typeof e&&/\S/.test(e)?k.default.createTextNode(e):void 0})).filter((function(e){return e}))}function $e(e,t){return Qe(t).forEach((function(t){return e.appendChild(t)})),e}function Je(e,t){return $e(Xe(e),t)}function Ze(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var et,tt=Le("querySelector"),it=Le("querySelectorAll"),nt=Object.freeze({__proto__:null,isReal:ke,isEl:Pe,isInFrame:Ie,createEl:xe,textContent:Re,prependTo:De,hasClass:Oe,addClass:Ue,removeClass:Me,toggleClass:Fe,setAttributes:Be,getAttributes:Ne,getAttribute:je,setAttribute:Ve,removeAttribute:He,blockTextSelection:ze,unblockTextSelection:Ge,getBoundingClientRect:We,findPosition:Ye,getPointerPosition:qe,isTextNode:Ke,emptyEl:Xe,normalizeContent:Qe,appendContent:$e,insertContent:Je,isSingleLeftClick:Ze,$:tt,$$:it}),rt=!1,at=function(){if(!1!==et.options.autoSetup){var e=Array.prototype.slice.call(k.default.getElementsByTagName("video")),t=Array.prototype.slice.call(k.default.getElementsByTagName("audio")),i=Array.prototype.slice.call(k.default.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r<a;r++){var s=n[r];if(!s||!s.getAttribute){st(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&et(s)}else rt||st(1)}};function st(e,t){ke()&&(t&&(et=t),C.default.setTimeout(at,e))}function ot(){rt=!0,C.default.removeEventListener("load",ot)}ke()&&("complete"===k.default.readyState?ot():C.default.addEventListener("load",ot));var ut,lt=function(e){var t=k.default.createElement("style");return t.className=e,t},ht=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},dt=3;function ct(){return dt++}C.default.WeakMap||(ut=function(){function e(){this.vdata="vdata"+Math.floor(C.default.performance&&C.default.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||ct();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];K("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var ft,pt=C.default.WeakMap?new WeakMap:new ut;function mt(e,t){if(pt.has(e)){var i=pt.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&pt.delete(e)}}function _t(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function gt(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var n=e||C.default.event;for(var r in e={},n)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&n.preventDefault||(e[r]=n[r]));if(e.target||(e.target=e.srcElement||k.default),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){n.preventDefault&&n.preventDefault(),e.returnValue=!1,n.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),e.cancelBubble=!0,n.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){var a=k.default.documentElement,s=k.default.body;e.pageX=e.clientX+(a&&a.scrollLeft||s&&s.scrollLeft||0)-(a&&a.clientLeft||s&&s.clientLeft||0),e.pageY=e.clientY+(a&&a.scrollTop||s&&s.scrollTop||0)-(a&&a.clientTop||s&&s.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var vt=["touchstart","touchmove"];function yt(e,t,i){if(Array.isArray(t))return _t(yt,e,t,i);pt.has(e)||pt.set(e,{});var n=pt.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=ct()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=gt(t);var r=n.handlers[t.type];if(r)for(var a=r.slice(0),s=0,o=a.length;s<o&&!t.isImmediatePropagationStopped();s++)try{a[s].call(e,t,i)}catch(e){K.error(e)}}}),1===n.handlers[t].length)if(e.addEventListener){var r=!1;(function(){if("boolean"!=typeof ft){ft=!1;try{var e=Object.defineProperty({},"passive",{get:function(){ft=!0}});C.default.addEventListener("test",null,e),C.default.removeEventListener("test",null,e)}catch(e){}}return ft})()&&vt.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function bt(e,t,i){if(pt.has(e)){var n=pt.get(e);if(n.handlers){if(Array.isArray(t))return _t(bt,e,t,i);var r=function(e,t){n.handlers[t]=[],mt(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);mt(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function St(e,t,i){var n=pt.has(e)?pt.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=gt(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)St.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){pt.has(t.target)||pt.set(t.target,{});var a=pt.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function Tt(e,t,i){if(Array.isArray(t))return _t(Tt,e,t,i);var n=function n(){bt(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||ct(),yt(e,t,n)}function Et(e,t,i){var n=function n(){bt(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||ct(),yt(e,t,n)}var wt,At=Object.freeze({__proto__:null,fixEvent:gt,on:yt,off:bt,trigger:St,one:Tt,any:Et}),Ct=function(e,t,i){t.guid||(t.guid=ct());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},kt=function(e,t){var i=C.default.performance.now();return function(){var n=C.default.performance.now();n-i>=t&&(e.apply(void 0,arguments),i=n)}},Pt=function(){};Pt.prototype.allowedEvents_={},Pt.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},yt(this,e,t),this.addEventListener=i},Pt.prototype.addEventListener=Pt.prototype.on,Pt.prototype.off=function(e,t){bt(this,e,t)},Pt.prototype.removeEventListener=Pt.prototype.off,Pt.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Tt(this,e,t),this.addEventListener=i},Pt.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Et(this,e,t),this.addEventListener=i},Pt.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=gt(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),St(this,e)},Pt.prototype.dispatchEvent=Pt.prototype.trigger,Pt.prototype.queueTrigger=function(e){var t=this;wt||(wt=new Map);var i=e.type||e,n=wt.get(this);n||(n=new Map,wt.set(this,n));var r=n.get(i);n.delete(i),C.default.clearTimeout(r);var a=C.default.setTimeout((function(){0===n.size&&(n=null,wt.delete(t)),t.trigger(e)}),0);n.set(i,a)};var It=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},Lt=function(e){return e instanceof Pt||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},xt=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},Rt=function(e,t,i){if(!e||!e.nodeName&&!Lt(e))throw new Error("Invalid target for "+It(t)+"#"+i+"; must be a DOM node or evented object.")},Dt=function(e,t,i){if(!xt(e))throw new Error("Invalid event type for "+It(t)+"#"+i+"; must be a non-empty string or array.")},Ot=function(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+It(t)+"#"+i+"; must be a function.")},Ut=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),Rt(n,e,i),Dt(r,e,i),Ot(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=Ct(e,a)}},Mt=function(e,t,i,n){Rt(e,e,t),e.nodeName?At[t](e,i,n):e[t](i,n)},Ft={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ut(this,i,"on"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(Mt(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var h=function(){return e.off("dispose",l)};h.guid=u.guid,Mt(this,"on","dispose",l),Mt(s,"on","dispose",h)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ut(this,i,"one"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Mt(s,"one",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,Mt(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Ut(this,i,"any"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Mt(s,"any",o,u);else{var l=function t(){e.off(s,o,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];u.apply(null,n)};l.guid=u.guid,Mt(s,"any",o,l)}},off:function(e,t,i){if(!e||xt(e))bt(this.eventBusEl_,e,t);else{var n=e,r=t;Rt(n,this,"off"),Dt(r,this,"off"),Ot(i,this,"off"),i=Ct(this,i),this.off("dispose",i),n.nodeName?(bt(n,r,i),bt(n,"dispose",i)):Lt(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){Rt(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(!xt(i)){var n="Invalid event type for "+It(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.";if(!e)throw new Error(n);(this.log||K).error(n)}return St(this.eventBusEl_,e,t)}};function Bt(e,t){void 0===t&&(t={});var i=t.eventBusKey;if(i){if(!e[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');e.eventBusEl_=e[i]}else e.eventBusEl_=xe("span",{className:"vjs-event-bus"});return Z(e,Ft),e.eventedCallbacks&&e.eventedCallbacks.forEach((function(e){e()})),e.on("dispose",(function(){e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&pt.has(e)&&pt.delete(e)})),C.default.setTimeout((function(){e.eventBusEl_=null}),0)})),e}var Nt={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),J(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&Lt(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function jt(e,t){return Z(e,Nt),e.state=Z({},e.state,t),"function"==typeof e.handleStateChanged&&Lt(e)&&e.on("statechanged",e.handleStateChanged),e}var Vt=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))},Ht=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))};function zt(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&J(t,(function(t,i){te(t)?(te(e[i])||(e[i]={}),e[i]=zt(e[i],t)):e[i]=t}))})),e}var Gt=function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),Wt=C.default.Map?C.default.Map:Gt,Yt=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}(),qt=C.default.Set?C.default.Set:Yt,Kt=function(){function e(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=zt({},this.options_),t=this.options_=zt(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var n=e&&e.id&&e.id()||"no_player";this.id_=n+"_component_"+ct()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&(Bt(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),jt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new qt,this.setIntervalIds_=new qt,this.rafIds_=new qt,this.namedRafs_=new Wt,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var t=e.prototype;return t.dispose=function(){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;e>=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=zt(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return xe(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),u},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.reduce((function(e,t){return e.concat(t)}),[]);for(var n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},t.addChild=function(t,i,n){var r,a;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof t){a=Ht(t);var s=i.componentClass||a;i.name=a;var o=e.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;r=new o(this.player_||this,i)}else r=t;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(a=a||r.name&&Ht(r.name()))&&(this.childNameIndex_[a]=r,this.childNameIndex_[Vt(a)]=r),"function"==typeof r.el&&r.el()){var u=null;this.children_[n+1]&&(this.children_[n+1].el_?u=this.children_[n+1].el_:Pe(this.children_[n+1])&&(u=this.children_[n+1])),this.contentEl().insertBefore(r.el(),u)}return r},t.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Ht(e.name())]=null,this.childNameIndex_[Vt(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||Ht(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return tt(e,t||this.contentEl())},t.$$=function(e,t){return it(e,t||this.contentEl())},t.hasClass=function(e){return Oe(this.el_,e)},t.addClass=function(e){Ue(this.el_,e)},t.removeClass=function(e){Me(this.el_,e)},t.toggleClass=function(e,t){Fe(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return je(this.el_,e)},t.setAttribute=function(e,t){Ve(this.el_,e,t)},t.removeAttribute=function(e){He(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+Ht(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=ie(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+Ht(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=C.default.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(C.default.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=Ct(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=Ct(this,e),this.clearTimersOnDispose_(),i=C.default.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),C.default.clearTimeout(e)),e},t.setInterval=function(e,t){e=Ct(this,e),this.clearTimersOnDispose_();var i=C.default.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),C.default.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=Ct(this,e),t=C.default.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=Ct(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),C.default.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),a=r&&r.isTech(i),s=e===i||e.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=Ht(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map((function(e){return u[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[Vt(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function Xt(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function Qt(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Xt.bind(null,"start",0,e),end:Xt.bind(null,"end",1,e)},C.default.Symbol&&C.default.Symbol.iterator&&(t[C.default.Symbol.iterator]=function(){return(e||[]).values()}),t}function $t(e,t){return Array.isArray(e)?Qt(e):void 0===e||void 0===t?Qt():Qt([[e,t]])}function Jt(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=$t(0,0));for(var a=0;a<e.length;a++)i=e.start(a),(n=e.end(a))>t&&(n=t),r+=n-i;return r/t}function Zt(e){if(e instanceof Zt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:ee(e)&&("number"==typeof e.code&&(this.code=e.code),Z(this,e)),this.message||(this.message=Zt.defaultMessages[this.code]||"")}Kt.prototype.supportsRaf_="function"==typeof C.default.requestAnimationFrame&&"function"==typeof C.default.cancelAnimationFrame,Kt.registerComponent("Component",Kt),Zt.prototype.code=0,Zt.prototype.message="",Zt.prototype.status=null,Zt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Zt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var ei=0;ei<Zt.errorTypes.length;ei++)Zt[Zt.errorTypes[ei]]=ei,Zt.prototype[Zt.errorTypes[ei]]=ei;function ti(e){return null!=e&&"function"==typeof e.then}function ii(e){ti(e)&&e.then(null,(function(e){}))}var ni=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})},ri=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=ni(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(ni))},ai=function(e,t){return e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()},si=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleKeyDown_=function(e){return n.handleKeyDown(e)},n.close_=function(e){return n.close(e)},n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=xe("div",{className:"vjs-modal-dialog-content"},{role:"document"}),n.descEl_=xe("p",{className:"vjs-modal-dialog-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),Re(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},i.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-modal-dialog vjs-hidden "+e.prototype.buildCSSClass.call(this)},i.label=function(){return this.localize(this.options_.label||"Modal Window")},i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},i.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},i.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},i.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},i.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_},i.fill=function(){this.fillWith(this.content())},i.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Je(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},i.empty=function(){this.trigger("beforemodalempty"),Xe(this.contentEl()),this.trigger("modalempty")},i.content=function(e){return void 0!==e&&(this.content_=e),this.content_},i.conditionalFocus_=function(){var e=k.default.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())},i.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},i.handleKeyDown=function(e){if(e.stopPropagation(),R.default.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(R.default.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;break}k.default.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}},i.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(function(e){return(e instanceof C.default.HTMLAnchorElement||e instanceof C.default.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof C.default.HTMLInputElement||e instanceof C.default.HTMLSelectElement||e instanceof C.default.HTMLTextAreaElement||e instanceof C.default.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof C.default.HTMLIFrameElement||e instanceof C.default.HTMLObjectElement||e instanceof C.default.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}))},t}(Kt);si.prototype.options_={pauseOnOpen:!0,temporary:!0},Kt.registerComponent("ModalDialog",si);var oi=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(I.default(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}L.default(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this,i=this.tracks_.length;""+i in this||Object.defineProperty(this,i,{get:function(){return this.tracks_[i]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},Lt(e)&&e.addEventListener("labelchange",e.labelchange_)},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(Pt);for(var ui in oi.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},oi.prototype.allowedEvents_)oi.prototype["on"+ui]=null;var li=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},hi=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){li(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}L.default(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&li(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,li(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(oi),di=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},ci=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){di(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(I.default(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}L.default(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&di(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,di(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(oi),fi=function(e){function t(){return e.apply(this,arguments)||this}L.default(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(oi),pi=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),mi=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),_i={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},gi={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},vi={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},yi={disabled:"disabled",hidden:"hidden",showing:"showing"},bi=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+ct(),kind:t.kind||"",language:t.language||""},r=t.label||"",a=function(e){Object.defineProperty(I.default(i),e,{get:function(){return n[e]},set:function(){}})};for(var s in n)a(s);return Object.defineProperty(I.default(i),"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),i}return L.default(t,e),t}(Pt),Si=function(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=k.default.createElement("a");i.href=e;for(var n={},r=0;r<t.length;r++)n[t[r]]=i[t[r]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=C.default.location.protocol),n.host||(n.host=C.default.location.host),n},Ti=function(e){if(!e.match(/^https?:\/\//)){var t=k.default.createElement("a");t.href=e,e=t.href}return e},Ei=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},wi=function(e,t){void 0===t&&(t=C.default.location);var i=Si(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host},Ai=Object.freeze({__proto__:null,parseUrl:Si,getAbsoluteURL:Ti,getFileExtension:Ei,isCrossOrigin:wi}),Ci=function(e,t){var i=new C.default.WebVTT.Parser(C.default,C.default.vttjs,C.default.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),n.length>0&&(C.default.console&&C.default.console.groupCollapsed&&C.default.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return K.error(e)})),C.default.console&&C.default.console.groupEnd&&C.default.console.groupEnd()),i.flush()},ki=function(e,t){var i={uri:e},n=wi(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),D.default(i,Ct(this,(function(e,i,n){if(e)return K.error(e,i);t.loaded_=!0,"function"!=typeof C.default.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return Ci(n,t);K.error("vttjs failed to load, stopping trying to process "+t.src)})):Ci(n,t)})))},Pi=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=zt(t,{kind:vi[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=yi[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new mi(i.cues_),o=new mi(i.activeCues_),u=!1,l=Ct(I.default(i),(function(){this.tech_.isReady_&&!this.tech_.isDisposed()&&(this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1))}));return i.tech_.one("dispose",(function(){i.tech_.off("timeupdate",l)})),"disabled"!==r&&i.tech_.on("timeupdate",l),Object.defineProperties(I.default(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){yi[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||ki(this.src,this),this.tech_.off("timeupdate",l),"disabled"!==r&&this.tech_.on("timeupdate",l),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||"subtitles"!==n.kind&&"captions"!==n.kind)&&ki(i.src,I.default(i))):i.loaded_=!0,i}L.default(t,e);var i=t.prototype;return i.addCue=function(e){var t=e;if(C.default.vttjs&&!(e instanceof C.default.vttjs.VTTCue)){for(var i in t=new C.default.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},t}(bi);Pi.prototype.allowedEvents_={cuechange:"cuechange"};var Ii=function(e){function t(t){var i;void 0===t&&(t={});var n=zt(t,{kind:gi[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(I.default(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return L.default(t,e),t}(bi),Li=function(e){function t(t){var i;void 0===t&&(t={});var n=zt(t,{kind:_i[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(I.default(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return L.default(t,e),t}(bi),xi=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new Pi(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(I.default(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:I.default(i)})})),i}return L.default(t,e),t}(Pt);xi.prototype.allowedEvents_={load:"load"},xi.NONE=0,xi.LOADING=1,xi.LOADED=2,xi.ERROR=3;var Ri={audio:{ListClass:hi,TrackClass:Ii,capitalName:"Audio"},video:{ListClass:ci,TrackClass:Li,capitalName:"Video"},text:{ListClass:fi,TrackClass:Pi,capitalName:"Text"}};Object.keys(Ri).forEach((function(e){Ri[e].getterName=e+"Tracks",Ri[e].privateName=e+"Tracks_"}));var Di={remoteText:{ListClass:fi,TrackClass:Pi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:pi,TrackClass:xi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Oi=P.default({},Ri,Di);Di.names=Object.keys(Di),Ri.names=Object.keys(Ri),Oi.names=[].concat(Di.names).concat(Ri.names);var Ui=function(e){function t(t,i){var n;return void 0===t&&(t={}),void 0===i&&(i=function(){}),t.reportTouchActivity=!1,(n=e.call(this,null,t,i)||this).onDurationChange_=function(e){return n.onDurationChange(e)},n.trackProgress_=function(e){return n.trackProgress(e)},n.trackCurrentTime_=function(e){return n.trackCurrentTime(e)},n.stopTrackingCurrentTime_=function(e){return n.stopTrackingCurrentTime(e)},n.disposeSourceHandler_=function(e){return n.disposeSourceHandler(e)},n.hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),Oi.names.forEach((function(e){var i=Oi[e];t&&t[i.getterName]&&(n[i.privateName]=t[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(e){!1===t["native"+e+"Tracks"]&&(n["featuresNative"+e+"Tracks"]=!1)})),!1===t.nativeCaptions||!1===t.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==t.preloadTextTracks,n.autoRemoteTextTracks_=new Oi.text.ListClass,n.initTrackListeners(),t.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}L.default(t,e);var i=t.prototype;return i.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)},i.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)},i.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ct(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)},i.onDurationChange=function(e){this.duration_=this.duration()},i.buffered=function(){return $t(0,0)},i.bufferedPercent=function(){return Jt(this.buffered(),this.duration_)},i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)},i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)},i.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.dispose=function(){this.clearTracks(Ri.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},i.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},i.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},i.reset=function(){},i.crossOrigin=function(){},i.setCrossOrigin=function(){},i.error=function(e){return void 0!==e&&(this.error_=new Zt(e),this.trigger("error")),this.error_},i.played=function(){return this.hasStarted_?$t(0,0):$t()},i.play=function(){},i.setScrubbing=function(){},i.scrubbing=function(){},i.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.initTrackListeners=function(){var e=this;Ri.names.forEach((function(t){var i=Ri[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",(function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))},i.addWebVttScript_=function(){var e=this;if(!C.default.WebVTT)if(k.default.body.contains(this.el())){if(!this.options_["vtt.js"]&&te(O.default)&&Object.keys(O.default).length>0)return void this.trigger("vttjsloaded");var t=k.default.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),C.default.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",a),"showing"===i.mode&&i.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",(function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",a)}}))},i.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var a=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var s=new Oi.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,i)},i.createRemoteTextTrack=function(e){var t=zt(e,{tech:this});return new Di.remoteTextEl.TrackClass(t)},i.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(K.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},i.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},i.getVideoPlaybackQuality=function(){return{}},i.requestPictureInPicture=function(){var e=this.options_.Promise||C.default.Promise;if(e)return e.reject()},i.disablePictureInPicture=function(){return!0},i.setDisablePictureInPicture=function(){},i.setPoster=function(){},i.playsinline=function(){},i.setPlaysinline=function(){},i.overrideNativeAudioTracks=function(){},i.overrideNativeVideoTracks=function(){},i.canPlayType=function(){return""},t.canPlayType=function(){return""},t.canPlaySource=function(e,i){return t.canPlayType(e.type)},t.isTech=function(e){return e.prototype instanceof t||e instanceof t||e===t},t.registerTech=function(e,i){if(t.techs_||(t.techs_={}),!t.isTech(i))throw new Error("Tech "+e+" must be a Tech");if(!t.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!t.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ht(e),t.techs_[e]=i,t.techs_[Vt(e)]=i,"Tech"!==e&&t.defaultTechOrder_.push(e),i},t.getTech=function(e){if(e)return t.techs_&&t.techs_[e]?t.techs_[e]:(e=Ht(e),C.default&&C.default.videojs&&C.default.videojs[e]?(K.warn("The "+e+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),C.default.videojs[e]):void 0)},t}(Kt);Oi.names.forEach((function(e){var t=Oi[e];Ui.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Ui.prototype.featuresVolumeControl=!0,Ui.prototype.featuresMuteControl=!0,Ui.prototype.featuresFullscreenResize=!1,Ui.prototype.featuresPlaybackRate=!1,Ui.prototype.featuresProgressEvents=!1,Ui.prototype.featuresSourceset=!1,Ui.prototype.featuresTimeupdateEvents=!1,Ui.prototype.featuresNativeTextTracks=!1,Ui.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:K.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},Kt.registerComponent("Tech",Ui),Ui.registerTech("Tech",Ui),Ui.defaultTechOrder_=[];var Mi={},Fi={},Bi={};function Ni(e,t,i){e.setTimeout((function(){return function e(t,i,n,r,a,s){void 0===t&&(t={});void 0===i&&(i=[]);void 0===a&&(a=[]);void 0===s&&(s=!1);var o=i,u=o[0],l=o.slice(1);if("string"==typeof u)e(t,Mi[u],n,r,a,s);else if(u){var h=function(e,t){var i=Fi[e.id()],n=null;if(null==i)return n=t(e),Fi[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],o=a[1];s===t&&(n=o)}null===n&&(n=t(e),i.push([t,n]));return n}(r,u);if(!h.setSource)return a.push(h),e(t,l,n,r,a,s);h.setSource(Z({},t),(function(i,o){if(i)return e(t,l,n,r,a,s);a.push(h),e(o,t.type===o.type?l:Mi[o.type],n,r,a,s)}))}else l.length?e(t,l,n,r,a,s):s?n(t,a):e(t,Mi["*"],n,r,a,!0)}(t,Mi[t.type],i,e)}),1)}function ji(e,t,i,n){void 0===n&&(n=null);var r="call"+Ht(i),a=e.reduce(Gi(r),n),s=a===Bi,o=s?null:t[i](a);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var Vi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Hi={setCurrentTime:1,setMuted:1,setVolume:1},zi={play:1,pause:1};function Gi(e){return function(t,i){return t===Bi?Bi:i[e]?i[e](t):t}}var Wi={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Yi=function(e){void 0===e&&(e="");var t=Ei(e);return Wi[t.toLowerCase()]||""};function qi(e){if(!e.type){var t=Yi(e.src);t&&(e.type=t)}return e}var Ki=function(e){function t(t,i,n){var r,a=zt({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s<o.length;s++){var u=Ht(o[s]),l=Ui.getTech(u);if(u||(l=Kt.getComponent(u)),l&&l.isSupported()){t.loadTech_(u);break}}return r}return L.default(t,e),t}(Kt);Kt.registerComponent("MediaLoader",Ki);var Xi=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseOver_=function(e){return n.handleMouseOver(e)},n.handleMouseOut_=function(e){return n.handleMouseOut(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.emitTapEvents(),n.enable(),n}L.default(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={}),t=Z({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&K.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=Z({role:"button"},i),this.tabIndex_=t.tabIndex;var n=xe(e,t,i);return n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=xe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Re(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)},i.handleLanguagechange=function(){this.controlText(this.controlText_)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){R.default.isEventKey(t,"Space")||R.default.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Kt);Kt.registerComponent("ClickableComponent",Xi);var Qi=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),n.update_=function(e){return n.update(e)},t.on("posterchange",n.update_),n}L.default(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update_),e.prototype.dispose.call(this)},i.createEl=function(){return xe("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){if(this.player_.controls()){var t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;!this.player_.tech(!0)||(_e||fe)&&t||this.player_.tech(!0).focus(),this.player_.paused()?ii(this.player_.play()):this.player_.pause()}},t}(Xi);Kt.registerComponent("PosterImage",Qi);var $i={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ji(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Zi(e,t,i){try{e.style[t]=i}catch(e){return}}var en=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",a),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(Ct(I.default(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a),C.default.addEventListener("orientationchange",a),t.on("dispose",(function(){return C.default.removeEventListener("orientationchange",a)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i<e.length;i++)this.player_.addRemoteTextTrack(e[i],!0);this.preselectTrack()}}))),r}L.default(t,e);var i=t.prototype;return i.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in n?o.kind===a.kind?i=o:i||(i=o):a&&!a.enabled?(i=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof C.default.WebVTT&&C.default.WebVTT.processCues(C.default,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a))}},i.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r=i[n];if(r){var a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Zi(a.firstChild,"color",Ji(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Zi(a.firstChild,"backgroundColor",Ji(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Zi(a,"backgroundColor",Ji(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?a.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===t.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),t.fontPercent&&1!==t.fontPercent){var s=C.default.parseFloat(a.style.fontSize);a.style.fontSize=s*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=$i[t.fontFamily])}}},i.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof C.default.WebVTT&&!e.every((function(e){return!e.activeCues}))){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);C.default.WebVTT.processCues(C.default,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;Ue(u,"vjs-text-track-cue"),Ue(u,"vjs-text-track-cue-"+(s.language?s.language:a))}this.player_.textTrackSettings&&this.updateDisplayState(s)}}},t}(Kt);Kt.registerComponent("TextTrackDisplay",en);var tn=function(e){function t(){return e.apply(this,arguments)||this}return L.default(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=xe("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(Kt);Kt.registerComponent("LoadingSpinner",tn);var nn=function(e){function t(){return e.apply(this,arguments)||this}L.default(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={});var n=xe("button",t=Z({className:this.buildCSSClass()},t),i=Z({type:"button"},i));return n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return K.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),Kt.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){R.default.isEventKey(t,"Space")||R.default.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(Xi);Kt.registerComponent("Button",nn);var rn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;return ii(t),void(!this.player_.tech(!0)||(_e||fe)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};ti(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(nn);rn.prototype.controlText_="Play Video",Kt.registerComponent("BigPlayButton",rn);var an=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){R.default.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(nn);Kt.registerComponent("CloseButton",an);var sn=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?ii(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(nn);sn.prototype.controlText_="Play",Kt.registerComponent("PlayToggle",sn);var on=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},un=on;function ln(e,t){return void 0===t&&(t=e),un(e,t)}var hn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=xe("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=xe("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=ln(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,K.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=k.default.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(Kt);hn.prototype.labelText_="Time",hn.prototype.controlText_="Time",Kt.registerComponent("TimeDisplay",hn);var dn=function(e){function t(){return e.apply(this,arguments)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(hn);dn.prototype.labelText_="Current Time",dn.prototype.controlText_="Current Time",Kt.registerComponent("CurrentTimeDisplay",dn);var cn=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(hn);cn.prototype.labelText_="Duration",cn.prototype.controlText_="Duration",Kt.registerComponent("DurationDisplay",cn);var fn=function(e){function t(){return e.apply(this,arguments)||this}return L.default(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(Kt);Kt.registerComponent("TimeDivider",fn);var pn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return t.insertBefore(xe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(hn);pn.prototype.labelText_="Remaining Time",pn.prototype.controlText_="Remaining Time",Kt.registerComponent("RemainingTimeDisplay",pn);var mn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=xe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(xe("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(k.default.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Kt);Kt.registerComponent("LiveDisplay",mn);var _n=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=xe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(nn);_n.prototype.controlText_="Seek to live, currently playing live",Kt.registerComponent("SeekToLive",_n);var gn=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},vn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}L.default(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=Z({tabIndex:0},i),n=Z({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||pe||e.preventDefault(),ze(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;Ge(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(gn(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=qe(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){R.default.isEventKey(t,"Left")||R.default.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):R.default.isEventKey(t,"Right")||R.default.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Kt);Kt.registerComponent("Slider",vn);var yn=function(e,t){return gn(e/t*100,0,100).toFixed(2)+"%"},bn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=xe("span",{className:"vjs-control-text"}),n=xe("span",{textContent:this.localize("Loaded")}),r=k.default.createTextNode(": ");return this.percentageEl_=xe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=yn(r,n);t.percent_!==s&&(t.el_.style.width=s,Re(t.percentageEl_,s),t.percent_=s);for(var o=0;o<i.length;o++){var u=i.start(o),l=i.end(o),h=a[o];h||(h=t.el_.appendChild(xe()),a[o]=h),h.dataset.start===u&&h.dataset.end===l||(h.dataset.start=u,h.dataset.end=l,h.style.left=yn(u,r),h.style.width=yn(l-u,r))}for(var d=a.length;d>i.length;d--)t.el_.removeChild(a[d-1]);a.length=i.length}))},t}(Kt);Kt.registerComponent("LoadProgressBar",bn);var Sn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=kt(Ct(I.default(n),n.update),30),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=Ye(this.el_),r=We(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>n.width&&(u=n.width),u=Math.round(u),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){Re(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+ln(u,o)}else a=ln(i,s);r.update(e,t,a),n&&n()}))},t}(Kt);Kt.registerComponent("TimeTooltip",Sn);var Tn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=kt(Ct(I.default(n),n.update),30),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Kt);Tn.prototype.options_={children:[]},Te||le||Tn.prototype.options_.children.push("timeTooltip"),Kt.registerComponent("PlayProgressBar",Tn);var En=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=kt(Ct(I.default(n),n.update),30),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(Kt);En.prototype.options_={children:["timeTooltip"]},Kt.registerComponent("MouseTimeDisplay",En);var wn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}L.default(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=Ct(this,this.update),this.update=kt(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in k.default&&"visibilityState"in k.default&&this.on(k.default,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===k.default.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==k.default.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[ln(e,r),ln(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(We(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){Ze(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e){if(Ze(e)){var t,i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(i>=.99)return void n.seekToLiveEdge();var r=n.seekableStart(),a=n.liveCurrentTime();if((t=r+i*n.liveWindow())>=a&&(t=a),t<=r&&(t=r+.1),t===1/0)return}else(t=i*this.player_.duration())===this.player_.duration()&&(t-=.1);this.userSeek_(t)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?ii(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(R.default.isEventKey(t,"Space")||R.default.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(R.default.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(R.default.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(R.default(t))){t.preventDefault(),t.stopPropagation();var n=10*(R.default.codes[R.default(t)]-R.default.codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else R.default.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):R.default.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in k.default&&"visibilityState"in k.default&&this.off(k.default,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(vn);wn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Te||le||wn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Kt.registerComponent("SeekBar",wn);var An=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=kt(Ct(I.default(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=kt(Ct(I.default(n),n.handleMouseSeek),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=Ye(r),s=qe(r,e).x;s=gn(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&ii(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(Kt);An.prototype.options_={children:["seekBar"]},Kt.registerComponent("ProgressControl",An);var Cn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.disable(),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){k.default.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(nn);Cn.prototype.controlText_="Picture-in-Picture",Kt.registerComponent("PictureInPictureToggle",Cn);var kn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===k.default[t.fsApi_.fullscreenEnabled]&&n.disable(),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(nn);kn.prototype.controlText_="Fullscreen",Kt.registerComponent("FullscreenToggle",kn);var Pn=function(e){function t(){return e.apply(this,arguments)||this}return L.default(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(Kt);Kt.registerComponent("VolumeLevel",Pn);var In=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=kt(Ct(I.default(n),n.update),30),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=We(this.el_),a=We(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;o<l?l+=l-o:u<l&&(l=u),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-"+l+"px"}this.write(n+"%")},i.write=function(e){Re(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(Kt);Kt.registerComponent("VolumeLevelTooltip",In);var Ln=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=kt(Ct(I.default(n),n.update),30),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(Kt);Ln.prototype.options_={children:["volumeLevelTooltip"]},Kt.registerComponent("MouseVolumeLevelDisplay",Ln);var xn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){Ze(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=We(i),r=this.vertical(),a=qe(i,e);a=r?a.y:a.x,a=gn(a,0,1),t.update(n,a,r)}Ze(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(vn);xn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Te||le||xn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),xn.prototype.playerEvent="volumechange",Kt.registerComponent("VolumeBar",xn);var Rn=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||te(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(I.default(n),t),n.throttledHandleMouseMove=kt(Ct(I.default(n),n.handleMouseMove),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Kt);Rn.prototype.options_={children:["volumeBar"]},Kt.registerComponent("VolumeControl",Rn);var Dn=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(I.default(n),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;Te&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)Me(this.el_,"vjs-vol-"+i);Ue(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(nn);Dn.prototype.controlText_="Mute",Kt.registerComponent("MuteToggle",Dn);var On=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||te(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}L.default(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){R.default.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),yt(k.default,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),bt(k.default,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){R.default.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(Kt);On.prototype.options_={children:["muteToggle","volumeControl"]},Kt.registerComponent("VolumePanel",On);var Un=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}L.default(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof Kt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof Kt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=xe(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),yt(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||k.default.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){R.default.isEventKey(e,"Left")||R.default.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(R.default.isEventKey(e,"Right")||R.default.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(Kt);Kt.registerComponent("Menu",Un);var Mn=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new nn(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=nn.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),yt(k.default,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}L.default(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},i.createMenu=function(){var e=new Un(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=xe("li",{className:"vjs-menu-title",textContent:Ht(this.options_.title),tabIndex:-1}),i=new Kt(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+nn.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),bt(k.default,"keyup",this.handleMenuKeyUp_)},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(e){R.default.isEventKey(e,"Esc")||R.default.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),R.default.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(R.default.isEventKey(e,"Up")||R.default.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(e){(R.default.isEventKey(e,"Esc")||R.default.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(R.default.isEventKey(e,"Esc")||R.default.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),R.default.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Te&&Ie())return;this.menu.focus()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(Kt);Kt.registerComponent("MenuButton",Mn);var Fn=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return I.default(n);var a=Ct(I.default(n),n.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),r.addEventListener("labelchange",a),n.player_.on("ready",a),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a),r.removeEventListener("labelchange",a)})),n}return L.default(t,e),t}(Mn);Kt.registerComponent("TrackButton",Fn);var Bn=["Tab","Esc","Up","Down","Right","Left"],Nn=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}L.default(t,e);var i=t.prototype;return i.createEl=function(t,i,n){this.nonIconControl=!0;var r=e.prototype.createEl.call(this,"li",Z({className:"vjs-menu-item",tabIndex:-1},i),n);return r.replaceChild(xe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),r.querySelector(".vjs-icon-placeholder")),r},i.handleKeyDown=function(t){Bn.some((function(e){return R.default.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(Xi);Kt.registerComponent("MenuItem",Nn);var jn=function(e){function t(t,i){var n,r=i.track,a=t.textTracks();i.label=r.label||r.language||"Unknown",i.selected="showing"===r.mode,(n=e.call(this,t,i)||this).track=r,n.kinds=(i.kinds||[i.kind||n.track.kind]).filter(Boolean);var s,o=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(I.default(n),t)},u=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(I.default(n),t)};(t.on(["loadstart","texttrackchange"],o),a.addEventListener("change",o),a.addEventListener("selectedlanguagechange",u),n.on("dispose",(function(){t.off(["loadstart","texttrackchange"],o),a.removeEventListener("change",o),a.removeEventListener("selectedlanguagechange",u)})),void 0===a.onchange)&&n.on(["tap","click"],(function(){if("object"!=typeof C.default.Event)try{s=new C.default.Event("change")}catch(e){}s||(s=k.default.createEvent("Event")).initEvent("change",!0,!0),a.dispatchEvent(s)}));return n.handleTracksChange(),n}L.default(t,e);var i=t.prototype;return i.handleClick=function(t){var i=this.track,n=this.player_.textTracks();if(e.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var a=n[r];-1!==this.kinds.indexOf(a.kind)&&(a===i?"showing"!==a.mode&&(a.mode="showing"):"disabled"!==a.mode&&(a.mode="disabled"))}},i.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},i.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},i.dispose=function(){this.track=null,e.prototype.dispose.call(this)},t}(Nn);Kt.registerComponent("TextTrackMenuItem",jn);var Vn=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}L.default(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(jn);Kt.registerComponent("OffTextTrackMenuItem",Vn);var Hn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return L.default(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=jn),this.label_&&(i=this.label_+" off"),e.push(new Vn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a=n[r];if(this.kinds_.indexOf(a.kind)>-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(Fn);Kt.registerComponent("TextTrackButton",Hn);var zn=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s<a.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=a,r.addEventListener("cuechange",Ct(I.default(n),n.update)),n}L.default(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},i.update=function(e){var t=this.cue,i=this.player_.currentTime();this.selected(t.startTime<=i&&i<t.endTime)},t}(Nn);Kt.registerComponent("ChaptersTrackMenuItem",zn);var Gn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){this.track_&&(!t||"addtrack"!==t.type&&"removetrack"!==t.type)||this.setTrack(this.findChaptersTrack()),e.prototype.update.call(this)},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ht(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],a=new zn(this.player_,{track:this.track_,cue:r});e.push(a)}return e},t}(Hn);Gn.prototype.kind_="chapters",Gn.prototype.controlText_="Chapters",Kt.registerComponent("ChaptersButton",Gn);var Wn=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=t.textTracks(),s=Ct(I.default(r),r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",(function(){a.removeEventListener("change",s)})),r}L.default(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var a=t[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Hn);Wn.prototype.kind_="descriptions",Wn.prototype.controlText_="Descriptions",Kt.registerComponent("DescriptionsButton",Wn);var Yn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(Hn);Yn.prototype.kind_="subtitles",Yn.prototype.controlText_="Subtitles",Kt.registerComponent("SubtitlesButton",Yn);var qn=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return L.default(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(jn);Kt.registerComponent("CaptionSettingsMenuItem",qn);var Kn=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new qn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(Hn);Kn.prototype.kind_="captions",Kn.prototype.controlText_="Captions",Kt.registerComponent("CaptionsButton",Kn);var Xn=function(e){function t(){return e.apply(this,arguments)||this}return L.default(t,e),t.prototype.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),a=r.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(a.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(xe("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),r},t}(jn);Kt.registerComponent("SubsCapsMenuItem",Xn);var Qn=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(Ht(n.label_)),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new qn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,Xn)},t}(Hn);Qn.prototype.kinds_=["captions","subtitles"],Qn.prototype.controlText_="Subtitles",Kt.registerComponent("SubsCapsButton",Qn);var $n=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(I.default(n),t)};return a.addEventListener("change",s),n.on("dispose",(function(){a.removeEventListener("change",s)})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),a=r.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(a.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),a.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text",textContent:this.localize("Descriptions")}))),r},i.handleClick=function(t){e.prototype.handleClick.call(this,t),this.track.enabled=!0},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(Nn);Kt.registerComponent("AudioTrackMenuItem",$n);var Jn=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new $n(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}(Fn);Jn.prototype.controlText_="Audio Track",Kt.registerComponent("AudioTrackButton",Jn);var Zn=function(e){function t(t,i){var n,r=i.rate,a=parseFloat(r,10);return i.label=r,i.selected=a===t.playbackRate(),i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=a,n.on(t,"ratechange",(function(e){return n.update(e)})),n}L.default(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(Nn);Zn.prototype.contentElType="button",Kt.registerComponent("PlaybackRateMenuItem",Zn);var er=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).menuButton_.el_.setAttribute("aria-describedby",n.labelElId_),n.updateVisibility(),n.updateLabel(),n.on(t,"loadstart",(function(e){return n.updateVisibility(e)})),n.on(t,"ratechange",(function(e){return n.updateLabel(e)})),n.on(t,"playbackrateschange",(function(e){return n.handlePlaybackRateschange(e)})),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=xe("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){for(var e=this.playbackRates(),t=[],i=e.length-1;i>=0;i--)t.push(new Zn(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){for(var t=this.player().playbackRate(),i=this.playbackRates(),n=i[0],r=0;r<i.length;r++)if(i[r]>t){n=i[r];break}this.player().playbackRate(n)},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(Mn);er.prototype.controlText_="Playback Rate",Kt.registerComponent("PlaybackRateMenuButton",er);var tr=function(e){function t(){return e.apply(this,arguments)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(Kt);Kt.registerComponent("Spacer",tr);var ir=function(e){function t(){return e.apply(this,arguments)||this}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(tr);Kt.registerComponent("CustomControlSpacer",ir);var nr=function(e){function t(){return e.apply(this,arguments)||this}return L.default(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Kt);nr.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in k.default&&nr.prototype.options_.children.splice(nr.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Kt.registerComponent("ControlBar",nr);var rr=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}L.default(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(si);rr.prototype.options_=P.default({},si.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Kt.registerComponent("ErrorDisplay",rr);var ar=["#000","Black"],sr=["#00F","Blue"],or=["#0FF","Cyan"],ur=["#0F0","Green"],lr=["#F0F","Magenta"],hr=["#F00","Red"],dr=["#FFF","White"],cr=["#FF0","Yellow"],fr=["1","Opaque"],pr=["0.5","Semi-Transparent"],mr=["0","Transparent"],_r={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ar,dr,hr,ur,sr,cr,lr,or]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[fr,pr,mr]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[dr,ar,hr,ur,sr,cr,lr,or]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[fr,pr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[mr,pr,fr]}};function gr(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}_r.windowColor.options=_r.backgroundColor.options;var vr=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(I.default(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=xe("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),J(_r,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}L.default(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=_r[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map((function(e){var t=a+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+s+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},i.createElColors_=function(){return xe("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return xe("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return xe("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,gr(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),$(e=_r).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;J(_r,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(gr(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;J(_r,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(C.default.localStorage.getItem("vjs-text-track-settings"))}catch(e){K.warn(e)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?C.default.localStorage.setItem("vjs-text-track-settings",JSON.stringify(e)):C.default.localStorage.removeItem("vjs-text-track-settings")}catch(e){K.warn(e)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},t}(si);Kt.registerComponent("TextTrackSettings",vr);var yr=function(e){function t(t,i){var n,r=i.ResizeObserver||C.default.ResizeObserver;null===i.ResizeObserver&&(r=!1);var a=zt({createEl:!r,reportTouchActivity:!1},i);return(n=e.call(this,t,a)||this).ResizeObserver=i.ResizeObserver||C.default.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=function(e,t,i,n){var r;void 0===n&&(n=C.default);var a=function(){var a=this,s=arguments,o=function(){r=null,o=null,i||e.apply(a,s)};!r&&i&&e.apply(a,s),n.clearTimeout(r),r=n.setTimeout(o,t)};return a.cancel=function(){n.clearTimeout(r),r=null},a}((function(){n.resizeHandler()}),100,!1,I.default(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){bt(this,"resize",e),bt(this,"unload",t),t=null};yt(n.el_.contentWindow,"unload",t),yt(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}L.default(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(Kt);Kt.registerComponent("ResizeManager",yr);var br={trackingThreshold:30,liveTolerance:15},Sr=function(e){function t(t,i){var n,r=zt(br,i,{createEl:!1});return(n=e.call(this,t,r)||this).handleVisibilityChange_=function(e){return n.handleVisibilityChange(e)},n.trackLiveHandler_=function(){return n.trackLive_()},n.handlePlay_=function(e){return n.handlePlay(e)},n.handleFirstTimeupdate_=function(e){return n.handleFirstTimeupdate(e)},n.handleSeeked_=function(e){return n.handleSeeked(e)},n.seekToLiveEdge_=function(e){return n.seekToLiveEdge(e)},n.reset_(),n.on(n.player_,"durationchange",(function(e){return n.handleDurationchange(e)})),n.one(n.player_,"canplay",(function(){return n.toggleTracking()})),_e&&"hidden"in k.default&&"visibilityState"in k.default&&n.on(k.default,"visibilitychange",n.handleVisibilityChange_),n}L.default(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(k.default.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(C.default.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;var n=this.liveCurrentTime(),r=this.player_.currentTime(),a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(k.default,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(Kt);Kt.registerComponent("LiveTracker",Sr);var Tr,Er=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a<i.length;a++){var s=i[a].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},wr=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=k.default.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=k.default.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",C.default.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Ar=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},Cr=function(e){var t=e.el();if(!t.resetSourceWatch_){var i={},n=function(e){return Ar([e.el(),C.default.HTMLMediaElement.prototype,C.default.Element.prototype,wr],"innerHTML")}(e),r=function(i){return function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=i.apply(t,r);return Er(e),s}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",zt(n,{set:r(n.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(i).forEach((function(e){t[e]=i[e]})),Object.defineProperty(t,"innerHTML",n)},e.one("sourceset",t.resetSourceWatch_)}},kr=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Ti(C.default.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return C.default.Element.prototype.setAttribute.call(this,"src",e),e}}),Pr=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var i=function(e){return Ar([e.el(),C.default.HTMLMediaElement.prototype,kr],"src")}(e),n=t.setAttribute,r=t.load;Object.defineProperty(t,"src",zt(i,{set:function(n){var r=i.set.call(t,n);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(i,r){var a=n.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),a},t.load=function(){var i=r.call(t);return Er(e)||(e.triggerSourceset(""),Cr(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):Er(e)||Cr(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},Ir=function(e,t,i,n){void 0===n&&(n=!0);var r=function(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})},a={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(a.set=r),Object.defineProperty(e,t,a)},Lr=function(e){function t(t,i){var n;n=e.call(this,t,i)||this;var r=t.source,a=!1;if(r&&(n.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?n.setSource(r):n.handleLateInit_(n.el_),t.enableSourceset&&n.setupSourcesetHandling_(),n.isScrubbing_=!1,n.el_.hasChildNodes()){for(var s=n.el_.childNodes,o=s.length,u=[];o--;){var l=s[o];"track"===l.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(l),n.remoteTextTracks().addTrack(l.track),n.textTracks().addTrack(l.track),a||n.el_.hasAttribute("crossorigin")||!wi(l.src)||(a=!0)):u.push(l))}for(var h=0;h<u.length;h++)n.el_.removeChild(u[h])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&a&&K.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(ye||Se||de)&&!0===t.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}L.default(t,e);var i=t.prototype;return i.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),t.disposeMediaElement(this.el_),this.options_=null,e.prototype.dispose.call(this)},i.setupSourcesetHandling_=function(){Pr(this)},i.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",(function(){return t.removeEventListener("change",i)}));var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",(function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)}))},i.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},i.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},i.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},i.proxyNativeTracksForType_=function(e){var t=this,i=Ri[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var a={change:function(i){var n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&t[Di.remoteText.getterName]().trigger(n)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,a=0;a<n.length;a++)if(n[a]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=a,Object.keys(a).forEach((function(e){var i=a[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",s),this.on("dispose",(function(e){return t.off("loadstart",s)}))}},i.proxyNativeTracks_=function(){var e=this;Ri.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},i.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),t.disposeMediaElement(e),e=i}else{e=k.default.createElement("video");var n=zt({},this.options_.tag&&Ne(this.options_.tag));ye&&!0===this.options_.nativeControlsForTouch||delete n.controls,Be(e,Z(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&Ve(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);for(var r=["loop","muted","playsinline","autoplay"],a=0;a<r.length;a++){var s=r[a],o=this.options_[s];void 0!==o&&(o?Ve(e,s,s):He(e,s),e[s]=o)}return e},i.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&Ee?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){K(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&le&&pe&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=C.default.navigator&&C.default.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)ii(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=k.default.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),C.default.performance&&"function"==typeof C.default.performance.now?e.creationTime=C.default.performance.now():C.default.performance&&C.default.performance.timing&&"number"==typeof C.default.performance.timing.navigationStart&&(e.creationTime=C.default.Date.now()-C.default.performance.timing.navigationStart),e},t}(Ui);Ir(Lr,"TEST_VID",(function(){if(ke()){var e=k.default.createElement("video"),t=k.default.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),Lr.isSupported=function(){try{Lr.TEST_VID.volume=.5}catch(e){return!1}return!(!Lr.TEST_VID||!Lr.TEST_VID.canPlayType)},Lr.canPlayType=function(e){return Lr.TEST_VID.canPlayType(e)},Lr.canPlaySource=function(e,t){return Lr.canPlayType(e.type)},Lr.canControlVolume=function(){try{var e=Lr.TEST_VID.volume;return Lr.TEST_VID.volume=e/2+.1,e!==Lr.TEST_VID.volume}catch(e){return!1}},Lr.canMuteVolume=function(){try{var e=Lr.TEST_VID.muted;return Lr.TEST_VID.muted=!e,Lr.TEST_VID.muted?Ve(Lr.TEST_VID,"muted","muted"):He(Lr.TEST_VID,"muted"),e!==Lr.TEST_VID.muted}catch(e){return!1}},Lr.canControlPlaybackRate=function(){if(le&&pe&&me<58)return!1;try{var e=Lr.TEST_VID.playbackRate;return Lr.TEST_VID.playbackRate=e/2+.1,e!==Lr.TEST_VID.playbackRate}catch(e){return!1}},Lr.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(k.default.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(k.default.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(k.default.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(k.default.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},Lr.supportsNativeTextTracks=function(){return Ee||Te&&pe},Lr.supportsNativeVideoTracks=function(){return!(!Lr.TEST_VID||!Lr.TEST_VID.videoTracks)},Lr.supportsNativeAudioTracks=function(){return!(!Lr.TEST_VID||!Lr.TEST_VID.audioTracks)},Lr.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];Ir(Lr.prototype,t,(function(){return Lr[i]()}),!0)})),Lr.prototype.movingMediaElementInDOM=!Te,Lr.prototype.featuresFullscreenResize=!0,Lr.prototype.featuresProgressEvents=!0,Lr.prototype.featuresTimeupdateEvents=!0,Lr.patchCanPlayType=function(){he>=4&&!ce&&!pe&&(Tr=Lr.TEST_VID&&Lr.TEST_VID.constructor.prototype.canPlayType,Lr.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Tr.call(this,e)})},Lr.unpatchCanPlayType=function(){var e=Lr.TEST_VID.constructor.prototype.canPlayType;return Tr&&(Lr.TEST_VID.constructor.prototype.canPlayType=Tr),e},Lr.patchCanPlayType(),Lr.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Lr.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){Lr.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){Lr.prototype["set"+Ht(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){Lr.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){Lr.prototype["set"+Ht(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){Lr.prototype[e]=function(){return this.el_[e]()}})),Ui.withSourceHandlers(Lr),Lr.nativeSourceHandler={},Lr.nativeSourceHandler.canPlayType=function(e){try{return Lr.TEST_VID.canPlayType(e)}catch(e){return""}},Lr.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Lr.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Ei(e.src);return Lr.nativeSourceHandler.canPlayType("video/"+i)}return""},Lr.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Lr.nativeSourceHandler.dispose=function(){},Lr.registerSourceHandler(Lr.nativeSourceHandler),Ui.registerTech("Html5",Lr);var xr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Rr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Dr=["tiny","xsmall","small","medium","large","xlarge","huge"],Or={};Dr.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Or[e]="vjs-layout-"+t}));var Ur={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Mr=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+ct(),(n=Z(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var o=i;o&&1===o.nodeType;){if(Ne(o).hasOwnProperty("lang")){n.language=o.getAttribute("lang");break}o=o.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=X(a.id_),a.fsApi_=H,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=i,a.tagAttributes=i&&Ne(i),a.language(a.options_.language),n.languages){var u={};Object.getOwnPropertyNames(n.languages).forEach((function(e){u[e.toLowerCase()]=n.languages[e]})),a.languages_=u}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),Bt(I.default(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(yt(k.default,a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var l=zt(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=l,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),ye&&a.addClass("vjs-touch-enabled"),Te||a.addClass("vjs-workinghover"),t.players[a.id_]=I.default(a);var h="7.15.4".split(".")[0];return a.addClass("vjs-v"+h),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a}L.default(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),bt(k.default,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),bt(k.default,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Fi[this.id()]=null,Oi.names.forEach((function(e){var t=Oi[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this)},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var a=Ne(i);if(r){for(t=this.el_=i,i=this.tag=k.default.createElement("video");t.children.length;)i.appendChild(t.firstChild);Oe(t,"video-js")||Ue(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),a.tabindex="-1",(_e||pe&&ve)&&(i.setAttribute("role","application"),a.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in a&&delete a.width,"height"in a&&delete a.height,Object.getOwnPropertyNames(a).forEach((function(e){r&&"class"===e||t.setAttribute(e,a[e]),r&&i.setAttribute(e,a[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==C.default.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=lt("vjs-styles-dimensions");var s=tt(".vjs-styles-defaults"),o=tt("head");o.insertBefore(this.styleEl_,s?s.nextSibling:o.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var u=i.getElementsByTagName("a"),l=0;l<u.length;l++){var h=u.item(l);Ue(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!n&&i.parentNode.insertBefore(t,i),De(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_=t,t},i.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):K.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},i.width=function(e){return this.dimension("width",e)},i.height=function(e){return this.dimension("height",e)},i.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?K.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},i.fluid=function(e){var t,i,n=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,Lt(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),i=function(){n.on(["playerreset","resize"],n.boundUpdateStyleEl_)},Lt(t=this)?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},i.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},i.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},i.updateStyleEl_=function(){if(!0!==C.default.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,i,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),ht(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid {\n padding-top: "+100*r+"%;\n }\n ")}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=Ht(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Ui.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};Oi.names.forEach((function(e){var t=Oi[e];s[t.getterName]=i[t.privateName]})),Z(s,this.options_[n]),Z(s,this.options_[r]),Z(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Ui.getTech(e);if(!o)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new o(s),this.tech_.ready(Ct(this,this.handleTechReady_),!0),ai(this.textTracksJson_||[],this.tech_),xr.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+Ht(e)+"_"](t)}))})),Object.keys(Rr).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Rr[e]+"_"].bind(i),event:t}):i["handleTech"+Rr[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||De(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;Oi.names.forEach((function(t){var i=Oi[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=ri(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&K.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(ti(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():ti(i=this.play())&&(i=i.catch(n)),ti(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return Yi(t)}(this,t)),this.cache_.source=zt({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=Ne(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},i.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},i.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},i.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},i.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(K.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(this.paused()?ii(this.play()):this.pause())},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=k.default[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){t&&(t.nativeIOSFullscreen&&this.toggleClass("vjs-ios-native-fs"),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in Hi)return function(e,t,i,n){return t[i](e.reduce(Gi(i),n))}(this.middleware_,this.tech_,e,t);if(e in zi)return ji(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw K(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in Vi)return function(e,t,i){return e.reduceRight(Gi(i),t[i]())}(this.middleware_,this.tech_,e);if(e in zi)return ji(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw K("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw K("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw K(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||C.default.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=ii),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!Ee&&!Te||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||$t(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=$t(0,0)),e},i.bufferedPercent=function(){return Jt(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||C.default.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||C.default.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=k.default[this.fsApi_.exitFullscreen]();return t&&ii(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=k.default.documentElement.style.overflow,yt(k.default,"keydown",this.boundFullWindowOnEscKey_),k.default.documentElement.style.overflow="hidden",Ue(k.default.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){R.default.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,bt(k.default,"keydown",this.boundFullWindowOnEscKey_),k.default.documentElement.style.overflow=this.docOrigOverflow,Me(k.default.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in k.default&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in k.default)return k.default.exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return R.default.isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return R.default.isEventKey(e,"m")}:r,s=t.playPauseKey,o=void 0===s?function(e){return R.default.isEventKey(e,"k")||R.default.isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=Kt.getComponent("FullscreenToggle");!1!==k.default[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),Kt.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),Kt.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],a=Ui.getTech(r);if(a||(a=Kt.getComponent(r)),a){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else K.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},i.selectSource=function(e){var t,i=this,n=this.options_.techOrder.map((function(e){return[e,Ui.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(K.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),r=function(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n},a=function(e,t){var n=e[0];if(e[1].canPlaySource(t,i.options_[n.toLowerCase()]))return{source:t,tech:n}};return(this.options_.sourceOrder?r(e,n,(t=a,function(e,i){return t(i,e)})):r(n,e,a))||!1},i.handleSrc_=function(e,t){var i=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var n=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):ee(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[qi({src:t})]:ee(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[qi(t)]:[];return t}(e);if(n.length){if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),Ni(this,n[0],(function(e,r){var a,s;if(i.middleware_=r,t||(i.cache_.sources=n),i.updateSourceCaches_(e),i.src_(e))return n.length>1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0),void i.triggerReady());a=r,s=i.tech_,a.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,Ht(t)!==Ht(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||C.default.Promise;this.paused()||!t?this.doReset_():ii(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),Lt(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(j("beforeerror").forEach((function(i){var n=i(t,e);ee(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Zt(e),this.addClass("vjs-error"),K.error("(CODE:"+this.error_.code+" "+Zt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),j("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=Ct(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||Te||le||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Lt(this)&&this.trigger("languagechange"))},i.languages=function(){return zt(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=zt(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=zt(n)).player=void 0,e.tracks[i]=n}return e},i.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new si(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},i.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Dr.length;i++){var n=Dr[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Or[e]),this.addClass(Or[n]),this.breakpoint_=n;break}}},i.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},i.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Z({},Ur,e),this.updateCurrentBreakpoint_()),Z(this.breakpoints_)},i.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},i.currentBreakpoint=function(){return this.breakpoint_},i.currentBreakpointClass=function(){return Or[this.breakpoint_]||""},i.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=zt(e);var n=this.cache_.media,r=n.artwork,a=n.poster,s=n.src,o=n.textTracks;!r&&a&&(this.cache_.media.artwork=[{src:a,type:Yi(a)}]),s&&this.src(s),a&&this.poster(a),Array.isArray(o)&&o.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},i.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Yi(t.poster)}]),t}return zt(this.cache_.media)},t.getTagSettings=function(e){var t={sources:[],tracks:[]},i=Ne(e),n=i["data-setup"];if(Oe(e,"vjs-fill")&&(i.fill=!0),Oe(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=x.default(n||"{}"),a=r[0],s=r[1];a&&K.error(a),Z(i,s)}if(Z(t,i),e.hasChildNodes())for(var o=e.childNodes,u=0,l=o.length;u<l;u++){var h=o[u],d=h.nodeName.toLowerCase();"source"===d?t.sources.push(Ne(h)):"track"===d&&t.tracks.push(Ne(h))}return t},i.flexNotSupported_=function(){var e=k.default.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},i.debug=function(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)},i.playbackRates=function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((function(e){return"number"==typeof e}))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))},t}(Kt);Oi.names.forEach((function(e){var t=Oi[e];Mr.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Mr.prototype.crossorigin=Mr.prototype.crossOrigin,Mr.players={};var Fr=C.default.navigator;Mr.prototype.options_={techOrder:Ui.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Fr&&(Fr.languages&&Fr.languages[0]||Fr.userLanguage||Fr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){Mr.prototype[e]=function(){return this.techGet_(e)}})),xr.forEach((function(e){Mr.prototype["handleTech"+Ht(e)+"_"]=function(){return this.trigger(e)}})),Kt.registerComponent("Player",Mr);var Br={},Nr=function(e){return Br.hasOwnProperty(e)},jr=function(e){return Nr(e)?Br[e]:void 0},Vr=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},Hr=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},zr=function(e,t){return t.prototype.name=e,function(){Hr(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var a=U.default(t,[this].concat(n));return this[e]=function(){return a},Hr(this,a.getEventHash()),a}},Gr=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),Bt(this),delete this.trigger,jt(this,this.constructor.defaultState),Vr(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),St(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=zr(e,Br[e])},e.isBasic=function(t){var i="string"==typeof t?jr(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(Nr(t))K.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(Mr.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return Br[t]=i,"plugin"!==t&&(e.isBasic(i)?Mr.prototype[t]=function(e,t){var i=function(){Hr(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Vr(this,e),Hr(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):Mr.prototype[t]=zr(t,i)),i},e.deregisterPlugin=function(e){if("plugin"===e)throw new Error("Cannot de-register base plugin.");Nr(e)&&(delete Br[e],delete Mr.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(Br)),e.forEach((function(e){var i=jr(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=jr(e);return t&&t.VERSION||""},e}();Gr.getPlugin=jr,Gr.BASE_PLUGIN_NAME="plugin",Gr.registerPlugin("plugin",Gr),Mr.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},Mr.prototype.hasPlugin=function(e){return!!Nr(e)};var Wr=function(e){return 0===e.indexOf("#")?e.slice(1):e};function Yr(e,t,i){var n=Yr.getPlayer(e);if(n)return t&&K.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var r="string"==typeof e?tt("#"+Wr(e)):e;if(!Pe(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||K.warn("The element supplied is not included in the DOM"),t=t||{},j("beforesetup").forEach((function(e){var i=e(r,zt(t));ee(i)&&!Array.isArray(i)?t=zt(t,i):K.error("please return an object in beforesetup hooks")}));var a=Kt.getComponent("Player");return n=new a(r,t,i),j("setup").forEach((function(e){return e(n)})),n}if(Yr.hooks_=N,Yr.hooks=j,Yr.hook=function(e,t){j(e,t)},Yr.hookOnce=function(e,t){j(e,[].concat(t).map((function(t){return function i(){return V(e,i),t.apply(void 0,arguments)}})))},Yr.removeHook=V,!0!==C.default.VIDEOJS_NO_DYNAMIC_STYLE&&ke()){var qr=tt(".vjs-styles-defaults");if(!qr){qr=lt("vjs-styles-defaults");var Kr=tt("head");Kr&&Kr.insertBefore(qr,Kr.firstChild),ht(qr,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}st(1,Yr),Yr.VERSION="7.15.4",Yr.options=Mr.prototype.options_,Yr.getPlayers=function(){return Mr.players},Yr.getPlayer=function(e){var t,i=Mr.players;if("string"==typeof e){var n=Wr(e),r=i[n];if(r)return r;t=tt("#"+n)}else t=e;if(Pe(t)){var a=t,s=a.player,o=a.playerId;if(s||i[o])return s||i[o]}},Yr.getAllPlayers=function(){return Object.keys(Mr.players).map((function(e){return Mr.players[e]})).filter(Boolean)},Yr.players=Mr.players,Yr.getComponent=Kt.getComponent,Yr.registerComponent=function(e,t){Ui.isTech(t)&&K.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),Kt.registerComponent.call(Kt,e,t)},Yr.getTech=Ui.getTech,Yr.registerTech=Ui.registerTech,Yr.use=function(e,t){Mi[e]=Mi[e]||[],Mi[e].push(t)},Object.defineProperty(Yr,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(Yr.middleware,"TERMINATOR",{value:Bi,writeable:!1,enumerable:!0}),Yr.browser=we,Yr.TOUCH_ENABLED=ye,Yr.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),M.default(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},Yr.mergeOptions=zt,Yr.bind=Ct,Yr.registerPlugin=Gr.registerPlugin,Yr.deregisterPlugin=Gr.deregisterPlugin,Yr.plugin=function(e,t){return K.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Gr.registerPlugin(e,t)},Yr.getPlugins=Gr.getPlugins,Yr.getPlugin=Gr.getPlugin,Yr.getPluginVersion=Gr.getPluginVersion,Yr.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),Yr.options.languages=zt(Yr.options.languages,((i={})[e]=t,i)),Yr.options.languages[e]},Yr.log=K,Yr.createLogger=X,Yr.createTimeRange=Yr.createTimeRanges=$t,Yr.formatTime=ln,Yr.setFormatTime=function(e){un=e},Yr.resetFormatTime=function(){un=on},Yr.parseUrl=Si,Yr.isCrossOrigin=wi,Yr.EventTarget=Pt,Yr.on=yt,Yr.one=Tt,Yr.off=bt,Yr.trigger=St,Yr.xhr=D.default,Yr.TextTrack=Pi,Yr.AudioTrack=Ii,Yr.VideoTrack=Li,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){Yr[e]=function(){return K.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),nt[e].apply(null,arguments)}})),Yr.computedStyle=ie,Yr.dom=nt,Yr.url=Ai,Yr.defineLazyProperty=Ir,Yr.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});
-/*! @name @videojs/http-streaming @version 2.10.2 @license Apache-2.0 */
-var Xr=F.default,Qr=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},$r=function(e){return Yr.log.debug?Yr.log.debug.bind(Yr,"VHS:",e+" >"):function(){}},Jr=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return Yr.createTimeRanges(n)},Zr=function(e,t){return Jr(e,(function(e,i){return e-.1<=t&&i+.1>=t}))},ea=function(e,t){return Jr(e,(function(e){return e-1/30>=t}))},ta=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},ia=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},na=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},ra=Yr.createTimeRange,aa=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},sa=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},oa=function(e){var t=e.preloadSegment;if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0);return n+=i&&i.length?i.length:0}},ua=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=sa(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},la=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=r.duration,void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);if(n.precise)return n.result;var r=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=i.duration,void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:n.result+i},ha=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return C.default.Infinity}return la(e,t,i)},da=function(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,a=0;if(n>r){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;o<Math.min(0,r);o++)a+=t;n=0}for(var u=n;u<r;u++)a+=i[u].duration;return a},ca=function(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return ha(e);if(null===t)return null;t=t||0;var r=la(e,e.mediaSequence+e.segments.length,t);return i&&(r-=n="number"==typeof n?n:ua(null,e)),Math.max(0,r)},fa=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},pa=function(e){return e.excludeUntil&&e.excludeUntil===1/0},ma=function(e){var t=fa(e);return!e.disabled&&!t},_a=function(e,t){return t.attributes&&t.attributes[e]},ga=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!ma(e)&&(e.attributes.BANDWIDTH||0)<i})).length},va=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},ya=function(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},n=!1;for(var r in i){for(var a in i[r])if(n=t(i[r][a]))break;if(n)break}return!!n},ba=function(e){if(!e||!e.playlists||!e.playlists.length)return ya(e,(function(e){return e.playlists&&e.playlists.length||e.uri}));for(var t=function(t){var i=e.playlists[t],n=i.attributes&&i.attributes.CODECS;return n&&n.split(",").every((function(e){return _.isAudioCodec(e)}))||ya(e,(function(e){return va(i,e)}))?"continue":{v:!1}},i=0;i<e.playlists.length;i++){var n=t(i);if("continue"!==n&&"object"==typeof n)return n.v}return!0},Sa={liveEdgeDelay:ua,duration:ha,seekable:function(e,t,i){var n=t||0,r=ca(e,t,!0,i);return null===r?ra():ra(n,r)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.experimentalExactManifestTimings,o=i-a,u=aa(t),l=0,h=0;h<u.length;h++){var d=u[h];if(n===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=h;break}}if(o<0){if(l>0)for(var c=l-1;c>=0;c--){var f=u[c];if(o+=f.duration,s){if(o<0)continue}else if(o+1/30<=0)continue;return{partIndex:f.partIndex,segmentIndex:f.segmentIndex,startTime:a-da({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:c})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var p=l;p<0;p++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m<u.length;m++){var _=u[m];if(o-=_.duration,s){if(o>0)continue}else if(o-1/30>=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a+da({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:ma,isDisabled:function(e){return e.disabled},isBlacklisted:fa,isIncompatible:pa,playlistEnd:ca,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:_a,estimateSegmentRequestTime:function(e,t,i,n){return void 0===n&&(n=0),_a("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:ga,isAudioOnly:ba,playlistMatch:va},Ta=Yr.log,Ea=function(e,t){return e+"-"+t},wa=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((function(i){if(e.mediaGroups[i])for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var a=e.mediaGroups[i][n][r];t(a,i,n,r)}}))},Aa=function(e){var t=e.playlist,i=e.uri,n=e.id;t.id=n,t.playlistErrors_=0,i&&(t.uri=i),t.attributes=t.attributes||{}},Ca=function(e,t){e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var n="placeholder-uri-"+i;e.playlists[i].uri=n}var r=ba(e);wa(e,(function(t,i,n,a){var s="placeholder-uri-"+i+"-"+n+"-"+a;if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o];if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===n)return}t.playlists=[P.default({},t)]}t.playlists.forEach((function(t,i){var n=Ea(i,s);t.uri?t.resolvedUri=t.resolvedUri||Xr(e.uri,t.uri):(t.uri=0===i?s:n,t.resolvedUri=t.uri),t.id=t.id||n,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];Aa({playlist:i,id:Ea(t,i.uri)}),i.resolvedUri=Xr(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||Ta.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){wa(e,(function(t){t.uri&&(t.resolvedUri=Xr(e.uri,t.uri))}))}(e)},ka=Yr.mergeOptions,Pa=Yr.EventTarget,Ia=function(e,t){if(!e)return t;var i=ka(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=ka(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},La=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=Xr(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Xr(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Xr(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Xr(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((function(e){e.resolvedUri||(e.resolvedUri=Xr(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((function(e){e.resolvedUri||(e.resolvedUri=Xr(t,e.uri))}))},xa=function(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t},Ra=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence},Da=function(e,t,i){void 0===i&&(i=Ra);var n=ka(e,{}),r=n.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=xa(t);var a=ka(r,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,i){var n=e.slice(),r=t.slice();i=i||0;for(var a,s=[],o=0;o<r.length;o++){var u=n[o+i],l=r[o];u?(a=u.map||a,s.push(Ia(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach((function(e){La(e,a.resolvedUri)}));for(var o=0;o<n.playlists.length;o++)n.playlists[o].id===t.id&&(n.playlists[o]=a);return n.playlists[t.id]=a,n.playlists[t.uri]=a,wa(e,(function(e,i,n,r){if(e.playlists)for(var a=0;a<e.playlists.length;a++)t.id===e.playlists[a].id&&(e.playlists[a]=t)})),n},Oa=function(e,t){var i=e.segments[e.segments.length-1],n=i&&i.parts&&i.parts[i.parts.length-1],r=n&&n.duration||i&&i.duration;return t&&r?1e3*r:500*(e.partTargetDuration||e.targetDuration||10)},Ua=function(e){function t(t,i,n){var r;if(void 0===n&&(n={}),r=e.call(this)||this,!t)throw new Error("A non-empty playlist URL or object is required");r.logger_=$r("PlaylistLoader");var a=n,s=a.withCredentials,o=void 0!==s&&s,u=a.handleManifestRedirects,l=void 0!==u&&u;r.src=t,r.vhs_=i,r.withCredentials=o,r.handleManifestRedirects=l;var h=i.options_;return r.customTagParsers=h&&h.customTagParsers||[],r.customTagMappers=h&&h.customTagMappers||[],r.experimentalLLHLS=h&&h.experimentalLLHLS||!1,r.state="HAVE_NOTHING",r.handleMediaupdatetimeout_=r.handleMediaupdatetimeout_.bind(I.default(r)),r.on("mediaupdatetimeout",r.handleMediaupdatetimeout_),r}L.default(t,e);var i=t.prototype;return i.handleMediaupdatetimeout_=function(){var e=this;if("HAVE_METADATA"===this.state){var t=this.media(),i=Xr(this.master.uri,t.uri);this.experimentalLLHLS&&(i=function(e,t){if(t.endList)return e;var i=[];if(t.serverControl&&t.serverControl.canBlockReload){var n=t.preloadSegment,r=t.mediaSequence+t.segments.length;if(n){var a=n.parts||[],s=oa(t)-1;s>-1&&s!==a.length-1&&i.push("_HLS_part="+s),(s>-1||a.length)&&r--}i.unshift("_HLS_msn="+r)}return t.serverControl&&t.serverControl.canSkipUntil&&i.unshift("_HLS_skip="+(t.serverControl.canSkipDateranges?"v2":"YES")),i.forEach((function(t,i){e+=""+(0===i?"?":"&")+t})),e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new m.Parser;t&&l.on("warn",t),i&&l.on("info",i),a.forEach((function(e){return l.addParser(e)})),o.forEach((function(e){return l.addTagMapper(e)})),l.push(n),l.end();var h=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){h.hasOwnProperty(e)&&delete h[e]})),h.segments&&h.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!h.targetDuration){var d=10;h.segments&&h.segments.length&&(d=h.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+d),h.targetDuration=d}var c=sa(h);if(c.length&&!h.partTargetDuration){var f=c.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+f),Ta.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),h.partTargetDuration=f}return h}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),Aa({playlist:a,uri:n,id:r});var s=Da(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Oa(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),C.default.clearTimeout(this.mediaUpdateTimeout),C.default.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(C.default.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=C.default.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Oa(e,!0)),a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=Qr(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=C.default.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=C.default.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=C.default.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=Qr(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,Ca(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=xa(e),e.segments.forEach((function(t){La(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||C.default.location.href;this.master=function(e,t){var i=Ea(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:C.default.location.href,resolvedUri:C.default.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(Pa),Ma=Yr.xhr,Fa=Yr.mergeOptions,Ba=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},Na=function(){var e=function e(t,i){t=Fa({timeout:45e3},t);var n=e.beforeRequest||Yr.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var a=(!0===Yr.Vhs.xhr.original?Ma:Yr.Vhs.xhr)(t,(function(e,t){return Ba(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},ja=function(e){var t,i,n={};return e.byterange&&(n.Range=(t=e.byterange,i=t.offset+t.length-1,"bytes="+t.offset+"-"+i)),n},Va=function(e,t){return e.start(t)+"-"+e.end(t)},Ha=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},za=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},Ga=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Wa=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Ya=function(e){return e.resolvedUri},qa=function(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map(Ha).join("")+" "+t.slice(16*n,16*n+16).map(za).join("")+"\n";return i},Ka=Object.freeze({__proto__:null,createTransferableMessage:Ga,initSegmentId:Wa,segmentKeyId:Ya,hexDump:qa,tagDump:function(e){var t=e.bytes;return qa(t)},textRanges:function(e){var t,i="";for(t=0;t<e.length;t++)i+=Va(e,t)+" ";return i}}),Xa=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>n){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},Qa=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,h=t.callback;if(!h)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!s)return h({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return h({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++){if(!e.segments[t].dateTimeObject)return!1}return!0}(n))return h({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var d=function(e,t){var i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1;r++){if(n=t.segments[r],i<t.segments[r+1].dateTimeObject)break}var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return i>new Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Sa.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!d)return h({message:i+" was not found in the stream"});var c=d.segment,f=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(c.dateTimeObject,i);if("estimate"===d.type)return 0===a?h({message:i+" is not buffered yet. Try again"}):(s(d.estimatedStart+f),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:h})})));var p=c.start+f;l.one("seeked",(function(){return h(null,l.currentTime())})),u&&l.pause(),s(p)},$a=function(e,t){if(4===e.readyState)return t()},Ja=Yr.EventTarget,Za=Yr.mergeOptions,es=function(e,t){if(!Ra(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i];if(n.uri!==r.uri)return!1;if(n.byterange||r.byterange){var a=n.byterange,s=r.byterange;if(a&&!s||!a&&s)return!1;if(a.offset!==s.offset||a.length!==s.length)return!1}}return!0},ts=function(e,t){var i,n,r={};for(var a in e){var s=e[a].sidx;if(s){var o=v.generateSidxKey(s);if(!t[o])break;var u=t[o].sidxInfo;i=u,n=s,(Boolean(!i.map&&!n.map)||Boolean(i.map&&n.map&&i.map.byterange.offset===n.map.byterange.offset&&i.map.byterange.length===n.map.byterange.length))&&i.uri===n.uri&&i.byterange.offset===n.byterange.offset&&i.byterange.length===n.byterange.length&&(r[o]=t[o])}}return r},is=function(e){function t(t,i,n,r){var a;void 0===n&&(n={}),(a=e.call(this)||this).masterPlaylistLoader_=r||I.default(a),r||(a.isMaster_=!0);var s=n,o=s.withCredentials,u=void 0!==o&&o,l=s.handleManifestRedirects,h=void 0!==l&&l;if(a.vhs_=i,a.withCredentials=u,a.handleManifestRedirects=h,!t)throw new Error("A non-empty playlist URL or object is required");return a.on("minimumUpdatePeriod",(function(){a.refreshXml_()})),a.on("mediaupdatetimeout",(function(){a.refreshMedia_(a.media().id)})),a.state="HAVE_NOTHING",a.loadedPlaylists_={},a.logger_=$r("DashPlaylistLoader"),a.isMaster_?(a.masterPlaylistLoader_.srcUrl=t,a.masterPlaylistLoader_.sidxMapping_={}):a.childPlaylist_=t,a}L.default(t,e);var i=t.prototype;return i.requestErrored_=function(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)},i.addSidxSegments_=function(e,t,i){var n=this,r=e.sidx&&v.generateSidxKey(e.sidx);if(e.sidx&&r&&!this.masterPlaylistLoader_.sidxMapping_[r]){var a=Qr(this.handleManifestRedirects,e.sidx.resolvedUri),s=function(a,s){if(!n.requestErrored_(a,s,t)){var o,u=n.masterPlaylistLoader_.sidxMapping_;try{o=B.default(T.toUint8(s.response).subarray(8))}catch(e){return void n.requestErrored_(e,s,t)}return u[r]={sidxInfo:e.sidx,sidx:o},v.addSidxSegmentsToPlaylist(e,o,e.sidx.resolvedUri),i(!0)}};this.request=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){return t.abort(),a=!0,i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r);var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=T.concatTypedArrays(r,T.stringToBytes(i,!0)),n=n||b.getId3Offset(r),r.length<10||n&&r.length<n+2)return $a(t,(function(){return s(e,t,"",r)}));var o=S.detectContainerForBytes(r);return"ts"===o&&r.length<188||!o&&r.length<376?$a(t,(function(){return s(e,t,"",r)})):s(null,t,o,r)}},u=t({uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function(t){return t.total,t.loaded,Ba(e,null,{statusCode:e.status},o)}))}},(function(e,t){return Ba(u,e,t,o)}));return u}(a,this.vhs_.xhr,(function(t,i,r,o){if(t)return s(t,i);if(!r||"mp4"!==r)return s({status:i.status,message:"Unsupported "+(r||"unknown")+" container type for sidx segment at URL: "+a,response:"",playlist:e,internal:!0,blacklistDuration:1/0,code:2},i);var u=e.sidx.byterange,l=u.offset,h=u.length;if(o.length>=h+l)return s(t,{response:o.subarray(l,l+h),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:ja({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=C.default.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},C.default.clearTimeout(this.minimumUpdatePeriodTimeout_),C.default.clearTimeout(this.mediaRequest_),C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(C.default.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;C.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=C.default.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=C.default.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=Qr(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=v.parseUTCTiming(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:Xr(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n,r,a,s=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_},t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=v.parse(t,{manifestUri:i,clientOffset:n,sidxMapping:r}),Ca(a,i),a),o=this.masterPlaylistLoader_.master;o&&(s=function(e,t,i){for(var n=!0,r=Za(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),a=0;a<t.playlists.length;a++){var s=t.playlists[a];if(s.sidx){var o=v.generateSidxKey(s.sidx);i&&i[o]&&i[o].sidx&&v.addSidxSegmentsToPlaylist(s,i[o].sidx,s.sidx.resolvedUri)}var u=Da(r,s,es);u&&(r=u,n=!1)}return wa(t,(function(e,t,i,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=Da(r,e.playlists[0],es);o&&((r=o).mediaGroups[t][i][a].playlists[0]=r.playlists[s],n=!1)}})),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1),n?null:r}(o,s,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=s||o;var u=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return u&&u!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=u),(!o||s&&s.minimumUpdatePeriod!==o.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(s)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(C.default.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=C.default.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)},i.refreshXml_=function(){var e=this;this.requestMaster_((function(t,i){var n,r,a;i&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=(n=e.masterPlaylistLoader_.master,r=e.masterPlaylistLoader_.sidxMapping_,a=ts(n.playlists,r),wa(n,(function(e,t,i,n){if(e.playlists&&e.playlists.length){var s=e.playlists;a=Za(a,ts(s,r))}})),a),e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)})))}))},i.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];if(n?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){!function e(){t.media().endList||(t.mediaUpdateTimeout=C.default.setTimeout((function(){t.trigger("mediaupdatetimeout"),e()}),Oa(t.media(),Boolean(n))))}()}this.trigger("loadedplaylist")},t}(Ja),ns={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},rs=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},as=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),i=rs(new Worker(t));i.objURL=t;var n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}},ss=function(e){return"var browserWorkerPolyFill = "+rs.toString()+";\nbrowserWorkerPolyFill(self);\n"+e},os=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},us=as(ss(os((function(){var e=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(a=[],n=arguments.length,n=1;n<arguments.length;++n)a.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,a)}},this.dispose=function(){e={}}}};e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,i,n,r,a,s,o,u,l,h,d,c,f,p,m,_,g,v,y,b,S,T,E,w,A,C,k,P,I,L,x,R,D,O,U,M,F,B,N,j,V=e,H=Math.pow(2,32)-1;!function(){var e;if(T={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in T)T.hasOwnProperty(e)&&(T[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);E=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),A=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),w=new Uint8Array([0,0,0,1]),C=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),k=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),P={video:C,audio:k},x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),R=new Uint8Array([0,0,0,0,0,0,0,0]),D=R,O=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U=R,I=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},i=function(){return t(T.dinf,t(T.dref,x))},n=function(e){return t(T.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(T.hdlr,P[e])},p=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(T.mdhd,i)},f=function(e){return t(T.mdia,p(e),m(e.type),s(e))},a=function(e){return t(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(T.minf,"video"===e.type?t(T.vmhd,I):t(T.smhd,L),i(),g(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=y(i[r]);return t.apply(null,[T.moof,a(e)].concat(n))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=d(e[i]);return t.apply(null,[T.moov,h(4294967295)].concat(n).concat(l(e)))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=b(e[i]);return t.apply(null,[T.mvex].concat(n))},h=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(T.mvhd,i)},_=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,a[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(T.sdtp,a)},g=function(e){return t(T.stbl,v(e),t(T.stts,U),t(T.stsc,D),t(T.stsz,O),t(T.stco,R))},v=function(e){return t(T.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?M(e):F(e))},M=function(e){var i,n,r=e.sps||[],a=e.pps||[],s=[],o=[];for(i=0;i<r.length;i++)s.push((65280&r[i].byteLength)>>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i<a.length;i++)o.push((65280&a[i].byteLength)>>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[T.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(T.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(T.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},F=function(e){return t(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},c=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(T.tkhd,i)},y=function(e){var i,n,r,a,s,o;return i=t(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/(H+1)),o=Math.floor(e.baseMediaDecodeTime%(H+1)),n=t(T.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===e.type?(r=S(e,92),t(T.traf,i,n,r)):(a=_(e),r=S(e,a.length+92),t(T.traf,i,n,r,a))},d=function(e){return e.duration=e.duration||4294967295,t(T.trak,c(e),f(e))},b=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(T.trex,i)},j=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},N=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=j(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u<s.length;u++)o=s[u],r[n++]=(4278190080&o.duration)>>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(T.trun,r)},B=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=j(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u<s.length;u++)o=s[u],n[r++]=(4278190080&o.duration)>>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(T.trun,n)},S=function(e,t){return"audio"===e.type?B(e,t):N(e,t)};r=function(){return t(T.ftyp,E,w,E,A)};var z,G,W,Y,q,K,X,Q,$=function(e){return t(T.mdat,e)},J=o,Z=function(e){var t,i=r(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},ee=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},te=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},ie=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},ne=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},re=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;i<e.length;i++)for(a=e[i],n=0;n<a.length;n++)s=a[n],o+=(r=ee(s,o)).size,u.push(r);return u},ae=function(e){var t,i,n,r,a,s,o=0,u=e.byteLength,l=e.nalCount,h=new Uint8Array(u+4*l),d=new DataView(h.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(a=r[i],n=0;n<a.length;n++)s=a[n],d.setUint32(o,s.data.byteLength),o+=4,h.set(s.data,o),o+=s.data.byteLength;return h},se=[33,16,5,32,164,27],oe=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ue=function(e){for(var t=[];e--;)t.push(0);return t},le=function(){if(!z){var e={96e3:[se,[227,64],ue(154),[56]],88200:[se,[231],ue(170),[56]],64e3:[se,[248,192],ue(240),[56]],48e3:[se,[255,192],ue(268),[55,148,128],ue(54),[112]],44100:[se,[255,192],ue(268),[55,163,128],ue(84),[112]],32e3:[se,[255,192],ue(268),[55,234],ue(226),[112]],24e3:[se,[255,192],ue(268),[55,255,128],ue(268),[111,112],ue(126),[224]],16e3:[se,[255,192],ue(268),[55,255,128],ue(268),[111,255],ue(269),[223,108],ue(195),[1,192]],12e3:[oe,ue(268),[3,127,248],ue(268),[6,255,240],ue(268),[13,255,224],ue(268),[27,253,128],ue(259),[56]],11025:[oe,ue(268),[3,127,248],ue(268),[6,255,240],ue(268),[13,255,224],ue(268),[27,255,192],ue(268),[55,175,128],ue(108),[112]],8e3:[oe,ue(268),[3,121,16],ue(47),[7]]};t=e,z=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return z};K=function(e,t){return G(q(e,t))},X=function(e,t){return W(Y(e),t)},Q=function(e,t,i){return Y(i?e:e-t)};var he=9e4,de=G=function(e){return 9e4*e},ce=(W=function(e,t){return e*t},Y=function(e){return e/9e4}),fe=(q=function(e,t){return e/t},K),pe=X,me=Q,_e=function(e,t,i,n){var r,a,s,o,u,l=0,h=0,d=0;if(t.length&&(r=fe(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(he/(e.samplerate/1024)),i&&n&&(l=r-Math.max(i,n),d=(h=Math.floor(l/a))*a),!(h<1||d>he/2))){for((s=le()[e.samplerate])||(s=t[0].data),o=0;o<h;o++)u=t[0],t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a});return e.baseMediaDecodeTime-=Math.floor(pe(d,e.samplerate)),d}},ge=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},ve=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},ye=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},be=he,Se=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Te=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/be,i=Math.floor(i)),i},Ee=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},we=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,n=0,r=0}return i},Ae=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},Ce=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},ke=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},Pe=4,Ie=function e(t){t=t||{},e.prototype.init.call(this),this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Ne(0,0),new Ne(0,1),new Ne(1,0),new Ne(1,1)],this.parse708captions_&&(this.cc708Stream_=new Oe),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};(Ie.prototype=new V).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=we(e.escapedRBSP)).payload&&t.payloadType===Pe&&(i=Ae(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=Ce(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ie.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Ie.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Ie.prototype.flush=function(){return this.flushStream("flush")},Ie.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ie.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Ie.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Ie.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ie.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ie.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Ie.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Le={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},xe=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Re=function(e){this.windowNum=e,this.reset()};Re.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Re.prototype.getText=function(){return this.rows.join("\n")},Re.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Re.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Re.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Re.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Re.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var De=function(e){this.serviceNum=e,this.text="",this.currentWindow=new Re(-1),this.windows=[]};De.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Re(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},De.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]};var Oe=function e(){e.prototype.init.call(this);var t=this;this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(t.new708Packet(),t.add708Bytes(e)):(null===t.current708Packet&&t.new708Packet(),t.add708Bytes(e))}};Oe.prototype=new V,Oe.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Oe.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Oe.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r<t.length;r++)n=31&(a=t[r++]),7===(i=a>>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},Oe.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r<t+i&&r<a.length;r++)n=a[r],xe(n)?r=this.handleText(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++},Oe.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return xe(i)&&(e=this.handleText(e,t,!0)),e},Oe.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Oe.prototype.initService=function(e,t){var i=this;return this.services[e]=new De(e),this.services[e].init(this.getPts(t),(function(t){i.flushDisplayed(t,i.services[e])})),this.services[e]},Oe.prototype.handleText=function(e,t,i){var n,r,a=this.current708Packet.data[e],s=(r=Le[n=(i?4096:0)|a]||n,4096&n&&n===r?"":String.fromCharCode(r)),o=t.currentWindow;return o.pendingNewLine&&!o.isEmpty()&&o.newLine(this.getPts(e)),o.pendingNewLine=!1,o.addText(s),e},Oe.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Oe.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e],r=7&n;t.setCurrentWindow(r);var a=t.currentWindow;return n=i[++e],a.visible=(32&n)>>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},Oe.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},Oe.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Oe.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Oe.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Oe.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Oe.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Oe.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Oe.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Oe.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penAttr;return n=i[++e],r.textTag=(240&n)>>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},Oe.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},Oe.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Oe.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Ue={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Me=function(e){return null===e?"":(e=Ue[e]||e,String.fromCharCode(e))},Fe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Be=function(){for(var e=[],t=15;t--;)e.push("");return e},Ne=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=Be();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Be();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Be()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Me((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Me((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Fe.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Me(n),a+=Me(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ne.prototype=new V,Ne.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ne.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Be(),this.nonDisplayed_=Be(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ne.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ne.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ne.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ne.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ne.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ne.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Ne.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ne.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ne.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Be(),this.displayed_=Be()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Ne.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},Ne.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},Ne.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ne.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ne.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Ne.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var je={CaptionStream:Ie,Cea608Stream:Ne,Cea708Stream:Oe},Ve={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},He=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},ze=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=He(e.dts,n),e.pts=He(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ze.prototype=new V;var Ge,We=ze,Ye=He,qe=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Ke=function(e,t,i){return decodeURIComponent(qe(e,t,i))},Xe=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Qe={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ke(e.data,1,t),e.value=Ke(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ke(e.data,1,t),e.url=Ke(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(qe(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Ge=function(e){var t,i={descriptor:e&&e.descriptor},n=0,r=[],a=0;if(Ge.prototype.init.call(this),this.dispatchType=Ve.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,s,o,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),a+=e.data.byteLength,1===r.length&&(n=Xe(e.data.subarray(6,10)),n+=10),!(a<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},u=0;u<n;)t.data.set(r[0].data.subarray(0,n-u),u),u+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=Xe(t.data.subarray(10,14)),n-=Xe(t.data.subarray(16,20)));do{if((s=Xe(t.data.subarray(i+4,i+8)))<1)return void this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."});if((o={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+s+10)}).key=o.id,Qe[o.id]&&(Qe[o.id](o),"com.apple.streaming.transportStreamTimestamp"===o.owner)){var l=o.data,h=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;h*=4,h+=3&l[7],o.timeStamp=h,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i<n);this.trigger("data",t)}}}).prototype=new V;var $e,Je,Ze,et=Ge,tt=We;($e=function(){var e=new Uint8Array(188),t=0;$e.prototype.init.call(this),this.push=function(i){var n,r=0,a=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;a<n.byteLength;)71!==n[r]||71!==n[a]?(r++,a++):(this.trigger("data",n.subarray(r,a)),r+=188,a+=188);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new V,(Je=function(){var e,t,i,n;Je.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===Ve.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:a===Ve.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:a===Ve.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ve.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ve.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new V,Je.STREAM_TYPES={h264:27,adts:15},(Ze=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)a=e.data[u],s.set(a.data,l),l+=a.data.byteLength;var h,d,c,f;d=o,f=(h=s)[0]<<16|h[1]<<8|h[2],d.data=new Uint8Array,1===f&&(d.packetLength=6+(h[4]<<8|h[5]),d.dataAlignmentIndicator=0!=(4&h[6]),192&(c=h[7])&&(d.pts=(14&h[9])<<27|(255&h[10])<<20|(254&h[11])<<12|(255&h[12])<<5|(254&h[13])>>>3,d.pts*=4,d.pts+=(6&h[13])>>>1,d.dts=d.pts,64&c&&(d.dts=(14&h[14])<<27|(255&h[15])<<20|(254&h[16])<<12|(255&h[17])<<5|(254&h[18])>>>3,d.dts*=4,d.dts+=(6&h[18])>>>1)),d.data=h.subarray(9+h[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};Ze.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case Ve.H264_STREAM_TYPE:e=n,t="video";break;case Ve.ADTS_STREAM_TYPE:e=r,t="audio";break;case Ve.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new V;var it={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:$e,TransportParseStream:Je,ElementaryStream:Ze,TimestampRolloverStream:tt,CaptionStream:je.CaptionStream,Cea608Stream:je.Cea608Stream,Cea708Stream:je.Cea708Stream,MetadataStream:et};for(var nt in Ve)Ve.hasOwnProperty(nt)&&(it[nt]=Ve[nt]);var rt,at=it,st=he,ot=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(rt=function(e){var t,i=0;rt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,u,l=0;if(e||(i=0),"audio"===n.type){var h;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;l+7<t.length;)if(255===t[l]&&240==(246&t[l+1])){if("number"==typeof h&&(this.skipWarn_(h,l),h=null),a=2*(1&~t[l+1]),r=(3&t[l+3])<<11|t[l+4]<<3|(224&t[l+5])>>5,u=(o=1024*(1+(3&t[l+6])))*st/ot[(60&t[l+2])>>>2],t.byteLength-l<r)break;this.trigger("data",{pts:n.pts+i*u,dts:n.dts+i*u,sampleCount:o,audioobjecttype:1+(t[l+2]>>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:ot[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),i++,l+=r}else"number"!=typeof h&&(h=l),l++;"number"==typeof h&&(this.skipWarn_(h,l),h=null),t=t.subarray(l)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new V;var ut,lt,ht,dt=rt,ct=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(lt=function(){var e,t,i=0;lt.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i<a-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<a;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<a);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new V,ht={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(ut=function(){var e,t,i,n,r,a,s,o=new lt;ut.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],a=1;a<n-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),i[a]=e[s];return i},a=function(e){var t,i,n,r,a,o,u,l,h,d,c,f,p=0,m=0,_=0,g=0,v=[1,1];if(i=(t=new ct(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),ht[i]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(c=3!==a?8:12,f=0;f<c;f++)t.readBoolean()&&s(f<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),f=0;f<u;f++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),h=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(p=t.readUnsignedExpGolomb(),m=t.readUnsignedExpGolomb(),_=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:v=[1,1];break;case 2:v=[12,11];break;case 3:v=[10,11];break;case 4:v=[16,11];break;case 5:v=[40,33];break;case 6:v=[24,11];break;case 7:v=[20,11];break;case 8:v=[32,11];break;case 9:v=[80,33];break;case 10:v=[18,11];break;case 11:v=[15,11];break;case 12:v=[64,33];break;case 13:v=[160,99];break;case 14:v=[4,3];break;case 15:v=[3,2];break;case 16:v=[2,1];break;case 255:v=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}v&&(v[0],v[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:16*(l+1)-2*p-2*m,height:(2-d)*(h+1)*16-2*_-2*g,sarRatio:v}}}).prototype=new V;var ft,pt={H264Stream:ut,NalByteStream:lt},mt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],_t=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=i>=0?i:0,(16&e[t+5])>>4?i+20:i+10},gt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},vt={isLikelyAacData:function(e){var t=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=_t(t,i))}(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:_t,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return mt[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=gt(e.subarray(10,14)));do{if((i=gt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r))){var a=n.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};(ft=function(){var e=new Uint8Array,t=0;ft.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!=(255&e[u])||240!=(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=vt.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=vt.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new V;var yt,bt,St,Tt,Et=ft,wt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],At=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ct=pt.H264Stream,kt=vt.isLikelyAacData,Pt=he,It=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},Lt=function(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}};(bt=function(e,t){var i,n=[],r=0,a=0,s=1/0;i=(t=t||{}).firstSequenceNumber||0,bt.prototype.init.call(this),this.push=function(t){Ee(e,t),e&&wt.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,h,d,c,f;0!==n.length?(o=ge(n,e,r),e.baseMediaDecodeTime=Te(e,t.keepOriginalTimestamps),f=_e(e,o,a,s),e.samples=ve(o),l=$(ye(o)),n=[],u=J(i,[e]),h=new Uint8Array(u.byteLength+l.byteLength),i++,h.set(u),h.set(l,u.byteLength),Se(e),d=Math.ceil(1024*Pt/e.samplerate),o.length&&(c=o.length*d,this.trigger("segmentTimingInfo",Lt(fe(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+c,o[0].pts+c,f||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+c})),this.trigger("data",{track:e,boxes:h}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Se(e),n=[],this.trigger("reset")}}).prototype=new V,(yt=function(e,t){var i,n,r,a=[],s=[];i=(t=t||{}).firstSequenceNumber||0,yt.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){Ee(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],At.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var n,r,o,u,l,h,d,c,f=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(n=te(a),(o=ie(n))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(f=r.duration,o.unshift(r),o.byteLength+=r.byteLength,o.nalCount+=r.nalCount,o.pts=r.pts,o.dts=r.dts,o.duration+=r.duration):o=ne(o)),s.length){var p;if(!(p=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Se(e),o=p}Ee(e,o),e.samples=re(o),l=$(ae(o)),e.baseMediaDecodeTime=Te(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),d=o[0],c=o[o.length-1],this.trigger("segmentTimingInfo",Lt(e.baseMediaDecodeTime,d.dts,d.pts,c.dts+c.duration,c.pts+c.duration,f)),this.trigger("timingInfo",{start:o[0].pts,end:o[o.length-1].pts+o[o.length-1].duration}),this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=J(i,[e]),h=new Uint8Array(u.byteLength+l.byteLength),i++,h.set(u),h.set(l,u.byteLength),this.trigger("data",{track:e,boxes:h}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),a=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){Se(e),n=void 0,r=void 0},this.getGopForFusion_=function(t){var i,n,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&It(e.pps[0],a.pps[0])&&e.sps&&It(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),h=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=h.byteLength,l.duration=h.duration,l.nalCount=h.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new V,(Tt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Tt.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new V,Tt.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,At.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,wt.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=Z(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=me(t.startPts,o,this.keepOriginalTimestamps),t.endTime=me(t.endPts,o,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=me(i.pts,o,this.keepOriginalTimestamps),s.metadata.push(i);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)i=s.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Tt.prototype.setRemux=function(e){this.remuxTracks=e},(St=function(e){var t,i,n=this,r=!0;St.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new at.MetadataStream,r.aacStream=new Et,r.audioTimestampRolloverStream=new at.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new at.TimestampRolloverStream("timed-metadata"),r.adtsStream=new dt,r.coalesceStream=new Tt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new bt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new at.MetadataStream,r.packetStream=new at.TransportPacketStream,r.parseStream=new at.TransportParseStream,r.elementaryStream=new at.ElementaryStream,r.timestampRolloverStream=new at.TimestampRolloverStream,r.adtsStream=new dt,r.h264Stream=new Ct,r.captionStream=new at.CaptionStream(e),r.coalesceStream=new Tt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new yt(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new bt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Se(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Se(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=kt(e);if(t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),this.transmuxPipeline_)for(var i=Object.keys(this.transmuxPipeline_),n=0;n<i.length;n++){var a=i[n];"headOfPipeline"!==a&&this.transmuxPipeline_[a].on&&this.transmuxPipeline_[a].on("log",this.getLogTrigger_(a))}r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new V;var xt,Rt,Dt,Ot={Transmuxer:St,VideoSegmentStream:yt,AudioSegmentStream:bt,AUDIO_PROPERTIES:wt,VIDEO_PROPERTIES:At,generateSegmentTimingInfo:Lt},Ut=function(e){return e>>>0},Mt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Ft=Ut,Bt=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Ft(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=Mt(t.subarray(n+4,n+8)),s=r>1?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},Nt=Ut,jt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4)),baseMediaDecodeTime:Nt(e[4]<<24|e[5]<<16|e[6]<<8|e[7])};return 1===t.version&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=Nt(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),t},Vt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Ht=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],h=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&h&&(t={flags:Vt(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),h--);h--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=Vt(e.subarray(d,d+4)),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i},zt=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],h=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&h&&(n.baseDataOffsetIsMoof=!0),n},Gt=ke,Wt=je.CaptionStream,Yt=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},qt=function(e,t){var i=Bt(e,["moof","traf"]),n=Bt(e,["mdat"]),r={},a=[];return n.forEach((function(e,t){var n=i[t];a.push({mdat:e,traf:n})})),a.forEach((function(e){var i,n=e.mdat,a=e.traf,s=Bt(a,["tfhd"]),o=zt(s[0]),u=o.trackId,l=Bt(a,["tfdt"]),h=l.length>0?jt(l[0]).baseMediaDecodeTime:0,d=Bt(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),h=Yt(r,t);if(n={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Gt(l),trackId:i},h)n.pts=h.pts,n.dts=h.dts,s=h;else{if(!s){u.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}n.pts=s.pts,n.dts=s.dts}u.seiNals.push(n)}return u}(n,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,a=i.defaultSampleSize||0,s=i.trackId,o=[];return e.forEach((function(e){var t=Ht(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),e.pts=n+e.compositionTimeOffset,n+=e.duration})),o=o.concat(t)})),o}(d,h,o),u),r[u]||(r[u]={seiNals:[],logs:[]}),r[u].seiNals=r[u].seiNals.concat(i.seiNals),r[u].logs=r[u].logs.concat(i.logs))})),r},Kt=function(){var e,t,i,n,r,a,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new Wt,s=!0,a=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(i!==e[0]||n!==t[i])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))i=a[0],n=s[i];else if(null===i||!n)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return(o=function(e,t,i){if(null===t)return null;var n=qt(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Xt=Ut,Qt=function(e){return("00"+e.toString(16)).slice(-2)};xt=function(e,t){var i,n,r;return i=Bt(t,["moof","traf"]),n=[].concat.apply([],i.map((function(t){return Bt(t,["tfhd"]).map((function(i){var n,r,a;return n=Xt(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),r=e[n]||9e4,(a="number"!=typeof(a=Bt(t,["tfdt"]).map((function(e){var t,i;return t=e[0],i=Xt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),1===t&&(i*=Math.pow(2,32),i+=Xt(e[8]<<24|e[9]<<16|e[10]<<8|e[11])),i}))[0])||isNaN(a)?1/0:a)/r}))}))),r=Math.min.apply(null,n),isFinite(r)?r:0},Rt=function(e){var t=Bt(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},a=Bt(e,["tkhd"])[0];a&&(n=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=Bt(e,["mdia","hdlr"])[0];if(s){var o=Mt(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Bt(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Mt(l.subarray(4,8));var h,d=Bt(l,[r.codec])[0];d&&(/^[a-z]vc[1-9]$/i.test(r.codec)?(h=d.subarray(78),"avcC"===Mt(h.subarray(4,8))&&h.length>11?(r.codec+=".",r.codec+=Qt(h[9]),r.codec+=Qt(h[10]),r.codec+=Qt(h[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(h=d.subarray(28),"esds"===Mt(h.subarray(4,8))&&h.length>20&&0!==h[19]?(r.codec+="."+Qt(h[19]),r.codec+="."+Qt(h[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var c=Bt(e,["mdia","mdhd"])[0];c&&(r.timescale=Dt(c)),i.push(r)})),i};var $t=xt,Jt=Rt,Zt=(Dt=function(e){var t=0===e[0]?12:20;return Xt(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},function(e){var t=31&e[1];return t<<=8,t|=e[2]}),ei=function(e){return!!(64&e[1])},ti=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},ii=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},ni={parseType:function(e,t){var i=Zt(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=ei(e),i=4+ti(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=ei(e),n=4+ti(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a<r;){var s=n+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:ei,parsePesType:function(e,t){switch(t[Zt(e)]){case Ve.H264_STREAM_TYPE:return"video";case Ve.ADTS_STREAM_TYPE:return"audio";case Ve.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!ei(e))return null;var t=4+ti(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+ti(e),i=e.subarray(t),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===ii(31&i[r+3])&&(a=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===ii(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===ii(31&i[r+3])&&(a=!0),a}},ri=Ye,ai={};ai.ts=ni,ai.aac=vt;var si=he,oi=function(e,t,i){for(var n,r,a,s,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),ai.ts.parseType(n,t.pid)){case"pes":r=ai.ts.parsePesType(n,t.table),a=ai.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=ai.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;o>=0;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),ai.ts.parseType(n,t.pid)){case"pes":r=ai.ts.parsePesType(n,t.table),a=ai.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=ai.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o-=188,u-=188}},ui=function(e,t,i){for(var n,r,a,s,o,u,l,h=0,d=188,c=!1,f={data:[],size:0};d<e.byteLength;)if(71!==e[h]||71!==e[d])h++,d++;else{switch(n=e.subarray(h,d),ai.ts.parseType(n,t.pid)){case"pes":if(r=ai.ts.parsePesType(n,t.table),a=ai.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!c&&(s=ai.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),c=!0),!i.firstKeyFrame)){if(a&&0!==f.size){for(o=new Uint8Array(f.size),u=0;f.data.length;)l=f.data.shift(),o.set(l,u),u+=l.byteLength;if(ai.ts.videoPacketContainsKeyFrame(o)){var p=ai.ts.parsePesTime(o);p&&(i.firstKeyFrame=p,i.firstKeyFrame.type="video")}f.size=0}f.data.push(n),f.size+=n.byteLength}}if(c&&i.firstKeyFrame)break;h+=188,d+=188}for(h=(d=e.byteLength)-188,c=!1;h>=0;)if(71!==e[h]||71!==e[d])h--,d--;else{switch(n=e.subarray(h,d),ai.ts.parseType(n,t.pid)){case"pes":r=ai.ts.parsePesType(n,t.table),a=ai.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=ai.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),c=!0)}if(c)break;h-=188,d-=188}},li=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),ai.ts.parseType(i,t.pid)){case"pat":t.pid=ai.ts.parsePat(i);break;case"pmt":var a=ai.ts.parsePmt(i);t.table=t.table||{},Object.keys(a).forEach((function(e){t.table[e]=a[e]}))}n+=188,r+=188}}(e,t),t.table){if(t.table.hasOwnProperty(n))switch(t.table[n]){case Ve.H264_STREAM_TYPE:i.video=[],ui(e,t,i),0===i.video.length&&delete i.video;break;case Ve.ADTS_STREAM_TYPE:i.audio=[],oi(e,t,i),0===i.audio.length&&delete i.audio}}return i},hi=function(e,t){var i;return(i=ai.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(ai.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=ai.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=ai.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=ai.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=ai.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=si/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):li(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=ri(e.dts,i),e.pts=ri(e.pts,i),e.dtsTime=e.dts/si,e.ptsTime=e.pts/si}))}if(e.video&&e.video.length){var n=t;if((void 0===n||isNaN(n))&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=ri(e.dts,n),e.pts=ri(e.pts,n),e.dtsTime=e.dts/si,e.ptsTime=e.pts/si})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=ri(r.dts,n),r.pts=ri(r.pts,n),r.dtsTime=r.dts/si,r.ptsTime=r.pts/si}}}(i,t),i):null},di=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Ot.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:ce(t.start.dts),presentation:ce(t.start.pts)},end:{decode:ce(t.end.dts),presentation:ce(t.end.pts)},baseMediaDecodeTime:ce(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ce(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:ce(t.start.dts),presentation:ce(t.start.pts)},end:{decode:ce(t.end.dts),presentation:ce(t.end.pts)},baseMediaDecodeTime:ce(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=ce(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ce(t.start),end:ce(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ce(t.start),end:ce(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}(this.self,this.transmuxer)},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new Kt,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,i=e.data,n=$t(t,i);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:i},[i.buffer])},t.probeMp4Tracks=function(e){var t=e.data,i=Jt(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,n="number"!=typeof i||isNaN(i)?void 0:i*he,r=hi(t,n),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(de(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(de(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new di(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new di(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})))),ls=function(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,h=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,c=e.onId3,f=e.onCaptions,p=e.onDone,m=e.onEndedTimeline,_=e.onTransmuxerLog,g=e.isEndOfTimeline,v={buffer:[]},y=g;if(t.onmessage=function(i){t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,u=n.metadata,l=n.videoFrameDtsTime,h=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},c={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};void 0!==l&&(c.videoFrameDtsTime=l),void 0!==h&&(c.videoFramePtsTime=h),i(c)}(i,v,s),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(i,v),"audioTimingInfo"===i.data.action&&u(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&l(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&h(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&d(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&f(i.data.caption),"endedtimeline"===i.data.action&&(y=!1,m()),"log"===i.data.action&&_(i.data.log),"transmuxed"===i.data.type&&(y||(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:v,callback:p}),hs(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){var b=i instanceof ArrayBuffer?i:i.buffer,S=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:b,byteOffset:S,byteLength:i.byteLength},[b])}g&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},hs=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():ls(e.currentTransmux))},ds=function(e,t){e.postMessage({action:t}),hs(e)},cs=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void ds(t,e);t.transmuxQueue.push(ds.bind(null,t,e))},fs=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void ls(e);e.transmuxer.transmuxQueue.push(e)},ps=function(e){cs("reset",e)},ms=function(e){var t=new us;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},_s=function(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=P.default({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",(function r(a){a.data.action===i&&(t.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,e.byteOffset||0,e.byteLength||a.data.data.byteLength),e.data&&(e.data=a.data.data)),n(a.data))})),e.data){var a=e.data instanceof ArrayBuffer;r.byteOffset=a?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var s=[a?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},gs=2,vs=-101,ys=-102,bs=function(e){e.forEach((function(e){e.abort()}))},Ss=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:vs,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:ys,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:gs,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:gs,xhr:t}:null},Ts=function(e,t,i){return function(n,r){var a=r.response,s=Ss(n,r);if(s)return i(s,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:gs,xhr:r},e);for(var o=new DataView(a),u=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),l=0;l<t.length;l++)t[l].bytes=u;return i(null,e)}},Es=function(e,t){var i=S.detectContainerForBytes(e.map.bytes);if("mp4"!==i){var n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:"Found unsupported "+(i||"unknown")+" container for initialization segment at URL: "+n,code:gs})}_s({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(i){var n=i.tracks,r=i.data;return e.map.bytes=r,n.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null)}})},ws=function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var a=Ss(e,r);if(a)return i(a,t);var s="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}(r.responseText.substring(t.lastReachedChar||0)):r.response;return t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),t.key?t.encryptedBytes=new Uint8Array(s):t.bytes=new Uint8Array(s),i(null,t)}},As=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,h=e.endedTimelineFn,d=e.dataFn,c=e.doneFn,f=e.onTransmuxerLog,p=t.map&&t.map.tracks||{},m=Boolean(p.audio&&p.video),_=r.bind(null,t,"audio","start"),g=r.bind(null,t,"audio","end"),v=r.bind(null,t,"video","start"),y=r.bind(null,t,"video","end");_s({action:"probeTs",transmuxer:t.transmuxer,data:i,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=i=e.data;var r=e.result;r&&(n(t,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:m}),n=null,r.hasAudio&&!m&&_(r.audioStart),r.hasVideo&&v(r.videoStart),_=null,v=null),fs({bytes:i,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:m,onData:function(e){e.type="combined"===e.type?"video":e.type,d(t,e)},onTrackInfo:function(e){n&&(m&&(e.isMuxed=!0),n(t,e))},onAudioTimingInfo:function(e){_&&void 0!==e.start&&(_(e.start),_=null),g&&void 0!==e.end&&g(e.end)},onVideoTimingInfo:function(e){v&&void 0!==e.start&&(v(e.start),v=null),y&&void 0!==e.end&&y(e.end)},onVideoSegmentTimingInfo:function(e){a(e)},onAudioSegmentTimingInfo:function(e){s(e)},onId3:function(e,i){o(t,e,i)},onCaptions:function(e){u(t,[e])},isEndOfTimeline:l,onEndedTimeline:function(){h()},onTransmuxerLog:f,onDone:function(e){c&&(e.type="combined"===e.type?"video":e.type,c(null,t,e))}})}})},Cs=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,h=e.endedTimelineFn,d=e.dataFn,c=e.doneFn,f=e.onTransmuxerLog,p=new Uint8Array(i);if(S.isLikelyFmp4MediaSegment(p)){t.isFmp4=!0;var m=t.map.tracks,_={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(_.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(_.videoCodec=m.video.codec),m.video&&m.audio&&(_.isMuxed=!0),n(t,_);var g=function(e){d(t,{data:p,type:_.hasAudio&&!_.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),c(null,t,{})};_s({action:"probeMp4StartTime",timescales:t.map.timescales,data:p,transmuxer:t.transmuxer,callback:function(e){var n=e.data,a=e.startTime;i=n.buffer,t.bytes=p=n,_.hasAudio&&!_.isMuxed&&r(t,"audio","start",a),_.hasVideo&&r(t,"video","start",a),m.video&&n.byteLength&&t.transmuxer?_s({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:p,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=p=e.data,e.logs.forEach((function(e){f(Yr.mergeOptions(e,{stream:"mp4CaptionParser"}))})),g(e.captions)}}):g()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=S.detectContainerForBytes(p)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void c(null,t,{});As({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:c,onTransmuxerLog:f})}else c(null,t,{})},ks=function(e,t){var i,n=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(Ga({source:n,encrypted:a,key:i,iv:r.iv}),[a.buffer,i.buffer])},Ps=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,h=e.endedTimelineFn,d=e.dataFn,c=e.doneFn,f=e.onTransmuxerLog,p=0,m=!1;return function(e,_){if(!m){if(e)return m=!0,bs(t),c(e,_);if((p+=1)===t.length){var g=function(){if(_.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,h=e.endedTimelineFn,d=e.dataFn,c=e.doneFn,f=e.onTransmuxerLog;ks({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,Cs({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:c,onTransmuxerLog:f})}))}({decryptionWorker:i,segment:_,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:c,onTransmuxerLog:f});Cs({segment:_,bytes:_.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:h,dataFn:d,doneFn:c,onTransmuxerLog:f})};if(_.endOfAllRequests=Date.now(),_.map&&_.map.encryptedBytes&&!_.map.bytes)return ks({decryptionWorker:i,id:_.requestId+"-init",encryptedBytes:_.map.encryptedBytes,key:_.map.key},(function(e){_.map.bytes=e,Es(_,(function(e){if(e)return bs(t),c(e,_);g()}))}));g()}}}},Is=function(e){var t=e.segment,i=e.progressFn;return e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn,function(e){if(!e.target.aborted)return t.stats=Yr.mergeOptions(t.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}},Ls=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,h=e.audioSegmentTimingInfoFn,d=e.id3Fn,c=e.captionsFn,f=e.isEndOfTimeline,p=e.endedTimelineFn,m=e.dataFn,_=e.doneFn,g=e.onTransmuxerLog,v=[],y=Ps({activeXhrs:v,decryptionWorker:n,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:c,isEndOfTimeline:f,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:g});if(r.key&&!r.key.bytes){var b=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&b.push(r.map.key);var S=t(Yr.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),Ts(r,b,y));v.push(S)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var T=t(Yr.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),Ts(r,[r.map.key],y));v.push(T)}var E=t(Yr.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:ja(r.map)}),function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=Ss(e,n);if(r)return i(r,t);var a=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=a,i(null,t);t.map.bytes=a,Es(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:y}));v.push(E)}var w=Yr.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:ja(r)}),A=t(w,ws({segment:r,finishProcessingFn:y,responseType:w.responseType}));A.addEventListener("progress",Is({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:d,captionsFn:c,isEndOfTimeline:f,endedTimelineFn:p,dataFn:m})),v.push(A);var C={};return v.forEach((function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,i=e.abortFn;return function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}}({loadendState:C,abortFn:a}))})),function(){return bs(v)}},xs=$r("CodecUtils"),Rs=function(e,t){var i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},Ds=function(e){var t={};return e.forEach((function(e){var i=e.mediaType,n=e.type,r=e.details;t[i]=t[i]||[],t[i].push(_.translateLegacyCodec(""+n+r))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return xs("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},Os=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},Us=function(e,t){var i=t.attributes||{},n=Ds(function(e){var t=e.attributes||{};if(t.CODECS)return _.parseCodecs(t.CODECS)}(t)||[]);if(Rs(e,t)&&!n.audio&&!function(e,t){if(!Rs(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=Ds(_.codecsFromDefault(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},Ms=$r("PlaylistSelector"),Fs=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},Bs=function(e,t){if(!e)return"";var i=C.default.getComputedStyle(e);return i?i[t]:""},Ns=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},js=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||C.default.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||C.default.Number.MAX_VALUE)},Vs=function(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;Sa.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||C.default.Number.MAX_VALUE,width:t,height:i,playlist:e}}));Ns(u,(function(e,t){return e.bandwidth-t.bandwidth}));var l=(u=u.filter((function(e){return!Sa.isIncompatible(e.playlist)}))).filter((function(e){return Sa.isEnabled(e.playlist)}));l.length||(l=u.filter((function(e){return!Sa.isDisabled(e.playlist)})));var h=l.filter((function(e){return e.bandwidth*ns.BANDWIDTH_VARIANCE<t})),d=h[h.length-1],c=h.filter((function(e){return e.bandwidth===d.bandwidth}))[0];if(!1===r){var f=c||l[0]||u[0];if(f&&f.playlist){var p="sortedPlaylistReps";return c&&(p="bandwidthBestRep"),l[0]&&(p="enabledPlaylistReps"),Ms("choosing "+Fs(f)+" using "+p+" with options",s),f.playlist}return Ms("could not choose a playlist with options",s),null}var m=h.filter((function(e){return e.width&&e.height}));Ns(m,(function(e,t){return e.width-t.width}));var _=m.filter((function(e){return e.width===i&&e.height===n}));d=_[_.length-1];var g,v,y,b,S=_.filter((function(e){return e.bandwidth===d.bandwidth}))[0];if(S||(v=(g=m.filter((function(e){return e.width>i||e.height>n}))).filter((function(e){return e.width===g[0].width&&e.height===g[0].height})),d=v[v.length-1],y=v.filter((function(e){return e.bandwidth===d.bandwidth}))[0]),a.experimentalLeastPixelDiffSelector){var T=m.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));Ns(T,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),b=T[0]}var E=b||y||S||c||l[0]||u[0];if(E&&E.playlist){var w="sortedPlaylistReps";return b?w="leastPixelDiffRep":y?w="resolutionPlusOneRep":S?w="resolutionBestRep":c?w="bandwidthBestRep":l[0]&&(w="enabledPlaylistReps"),Ms("choosing "+Fs(E)+" using "+w+" with options",s),E.playlist}return Ms("could not choose a playlist with options",s),null}},Hs=function(){var e=this.useDevicePixelRatio&&C.default.devicePixelRatio||1;return Vs(this.playlists.master,this.systemBandwidth,parseInt(Bs(this.tech_.el(),"width"),10)*e,parseInt(Bs(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},zs=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=C.default.WebKitDataCue||C.default.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||C.default.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return Yr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return Yr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return Yr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var h=u.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),d=Object.keys(h).sort((function(e,t){return Number(e)-Number(t)}));d.forEach((function(e,t){var i=h[e],n=Number(d[t+1])||r;i.forEach((function(e){e.endTime=n}))}))}}},Gs=function(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},Ws=function(e){return"number"==typeof e&&isFinite(e)},Ys=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,h=e.mediaIndex,d=e.partIndex,c=e.timeline,f=l.length-1,p="mediaIndex/partIndex increment";e.getMediaInfoForTime?p="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(p="getSyncSegmentCandidate (isSyncRequest)");var m="number"==typeof d,_=e.segment.uri?"segment":"pre-segment",g=m?oa({preloadSegment:n})-1:0;return _+" ["+(s+h)+"/"+(s+f)+"]"+(m?" part ["+d+"/"+g+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+c+"] selected by ["+p+"] playlist ["+o+"]"},qs=function(e){return e+"TimingInfo"},Ks=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},Xs=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+1/30},Qs=function(e,t){if("hls"!==t)return null;var i,n,r,a,s=(i=e.audioTimingInfo,n=e.videoTimingInfo,r=i&&"number"==typeof i.start&&"number"==typeof i.end?i.end-i.start:0,a=n&&"number"==typeof n.start&&"number"==typeof n.end?n.end-n.start:0,Math.max(r,a));if(!s)return null;var o=e.playlist.targetDuration,u=Xs({segmentDuration:s,maxDuration:2*o}),l=Xs({segmentDuration:s,maxDuration:o}),h="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+s+" when the reported duration is "+e.duration+" and the target duration is "+o+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return u||l?{severity:u?"warn":"info",message:h}:null},$s=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=Yr.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=$r("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(I.default(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}L.default(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return ms({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&C.default.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,C.default.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&ps(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Yr.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Wa(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Ya(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&this.resyncLoader(),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(C.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"})},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&ps(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*E.ONE_SECOND_IN_TS),a=Math.ceil((i-n)*E.ONE_SECOND_IN_TS),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)Gs(e,t,this.inbandTextTracks_[s]);Gs(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&C.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=C.default.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&C.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=C.default.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=na(this.buffered_())||0,t=Math.max(0,e-this.currentTime_()),i=!this.hasPlayed_()&&t>=1,n=t>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var a={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(a.isSyncRequest)a.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(n.push(a),(r+=s.duration)>i))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,r,e);else if(null!==this.mediaIndex){var s=r[this.mediaIndex],o="number"==typeof this.partIndex?this.partIndex:-1;a.startOfSegment=s.end?s.end:e,s.parts&&s.parts[o+1]?(a.mediaIndex=this.mediaIndex,a.partIndex=o+1):a.mediaIndex=this.mediaIndex+1}else{var u=Sa.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?e:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),l=u.segmentIndex,h=u.startTime,d=u.partIndex;a.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd":"currentTime",a.mediaIndex=l,a.startOfSegment=h,a.partIndex=d}var c=r[a.mediaIndex],f=c&&"number"==typeof a.partIndex&&c.parts&&c.parts[a.partIndex];if(!c||"number"==typeof a.partIndex&&!f)return null;"number"!=typeof a.partIndex&&c.parts&&(a.partIndex=0);var p=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return a.mediaIndex>=r.length-1&&p&&!this.seeking_()?null:this.generateSegmentInfo_(a)},i.generateSegmentInfo_=function(e){var t=e.playlist,i=e.mediaIndex,n=e.startOfSegment,r=e.isSyncRequest,a=e.partIndex,s=e.forceTimestampOffset,o=e.getMediaInfoForTime,u=t.segments[i],l="number"==typeof a&&u.parts[a],h={requestId:"segment-loader-"+Math.random(),uri:l&&l.resolvedUri||u.resolvedUri,mediaIndex:i,partIndex:l?a:null,isSyncRequest:r,startOfSegment:n,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:l&&l.duration||u.duration,segment:u,part:l,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o},d=void 0!==s?s:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:d});var c=na(this.sourceUpdater_.audioBuffered());return"number"==typeof c&&(h.audioAppendStart=c-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*E.ONE_SECOND_IN_TS);for(n=0;n<e.length&&!(e[n].pts>r);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||i!==n?i<n?r:a.length?a.end(a.length-1):r:null;var t,i,n,r,a},i.earlyAbortWhenNeeded_=function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Sa.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=function(e,t,i){return void 0===i&&(i=1),((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=a)){var s=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter((function(e){return!Sa.isIncompatible(e)})),h=l.filter(Sa.isEnabled);h.length||(h=l.filter((function(e){return!Sa.isDisabled(e)})));var d=h.filter(Sa.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=u.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:Sa.estimateSegmentRequestTime(a,n,e)*t-s}})),c=d.filter((function(e){return e.rebufferingImpact<=0}));return Ns(c,(function(e,t){return js(t.playlist,e.playlist)})),c.length?c[0]:(Ns(d,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),d[0]||null)}({master:this.vhs_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;a<=1/30&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u||(this.bandwidth=s.playlist.attributes.BANDWIDTH*ns.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}},i.handleAbort_=function(e){this.logger_("Aborting "+Ys(e)),this.mediaRequestsAborted+=1},i.handleProgress_=function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")},i.handleTrackInfo_=function(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;r<i.length;r++){var a=i[r];if(a!==n[r])return!1;if(e[a]!==t[a])return!1}return!0}(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))},i.handleTimingInfo_=function(e,t,i,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var r=this.pendingSegment_,a=qs(t);r[a]=r[a]||{},r[a][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}},i.handleCaptions_=function(e,t){var i=this;if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0!==t.length)if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach((function(e){r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+n),t.endTime=Math.max(t.endTime,e.endTime+n),t.captions.push(e)})),Object.keys(r).forEach((function(e){var t=r[e],a=t.startTime,s=t.endTime,o=t.captions,u=i.inbandTextTracks_;i.logger_("adding cues from "+a+" -> "+s+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];u&&(a=u.label,s=u.language,o=u.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(u,i.vhs_.tech_,e),Gs(a,s,u[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=C.default.WebKitDataCue||C.default.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:o,inbandTextTracks:u,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),zs({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Ks({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!Ks({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[qs(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=Wa(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ia(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ia(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,h=o.length?o.start(0):0,d=o.length?o.end(o.length-1):0;if(l-u<=1&&d-h<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+ia(s).join(", ")+", video buffer: "+ia(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));var c=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+c),this.remove(0,c,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=C.default.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],h=o.byteLength;s&&(l.unshift(s),h+=s.byteLength),n=0,(t={bytes:h,segments:l}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),u=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=P.default({},e,{forceTimestampOffset:!0});P.default(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+Ys(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Ls({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(Ys(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-ns.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)},i.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate")},i.segmentRequestFinished_=function(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===ys)return;return this.pause(),e.code===vs?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=i.segments[n-1];return 0!==n&&l&&void 0!==l.start&&l.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=e.timingInfo.start,e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=Qs(e,this.sourceType_);if(t&&("warn"===t.severity?Yr.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+Ys(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment;if(i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration)this.resetEverything();else null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+Ys(e))},i.recordThroughput_=function(e){if(e.duration<1/60)this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60);else{var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},i.addSegmentMetadataCue_=function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(Ws(i)&&Ws(n)){Gs(i,n,this.segmentMetadataTrack_);var r=C.default.WebKitDataCue||C.default.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},s=new r(i,n,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}},t}(Yr.EventTarget);function Js(){}var Zs,eo=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))},to=["video","audio"],io=function(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},no=function e(t,i){if(0!==i.queue.length){var n=0,r=i.queue[n];if("mediaSource"!==r.type){if("mediaSource"!==t&&i.ready()&&"closed"!==i.mediaSource.readyState&&!io(t,i)){if(r.type!==t){if(null===(n=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null}(t,i.queue)))return;r=i.queue[n]}return i.queue.splice(n,1),i.queuePending[t]=r,r.action(t,i),r.doneFn?void 0:(i.queuePending[t]=null,void e(t,i))}}else i.updating()||"closed"===i.mediaSource.readyState||(i.queue.shift(),r.action(i),r.doneFn&&r.doneFn(),e("audio",i),e("video",i))}},ro=function(e,t){var i=t[e+"Buffer"],n=eo(e);i&&(i.removeEventListener("updateend",t["on"+n+"UpdateEnd_"]),i.removeEventListener("error",t["on"+n+"Error_"]),t.codecs[e]=null,t[e+"Buffer"]=null)},ao=function(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)},so=function(e,t,i){return function(n,r){var a=r[n+"Buffer"];if(ao(r.mediaSource,a)){r.logger_("Appending segment "+t.mediaIndex+"'s "+e.length+" bytes to "+n+"Buffer");try{a.appendBuffer(e)}catch(e){r.logger_("Error with code "+e.code+" "+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment "+t.mediaIndex+" to "+n+"Buffer"),r.queuePending[n]=null,i(e)}}}},oo=function(e,t){return function(i,n){var r=n[i+"Buffer"];if(ao(n.mediaSource,r)){n.logger_("Removing "+e+" to "+t+" from "+i+"Buffer");try{r.remove(e,t)}catch(r){n.logger_("Remove "+e+" to "+t+" from "+i+"Buffer failed")}}}},uo=function(e){return function(t,i){var n=i[t+"Buffer"];ao(i.mediaSource,n)&&(i.logger_("Setting "+t+"timestampOffset to "+e),n.timestampOffset=e)}},lo=function(e){return function(t,i){e()}},ho=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream("+(e||"")+")");try{t.mediaSource.endOfStream(e)}catch(e){Yr.log.warn("Failed to call media source endOfStream",e)}}}},co=function(e){return function(t){t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(e){Yr.log.warn("Failed to set media source duration",e)}}},fo=function(){return function(e,t){if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(ao(t.mediaSource,i)){t.logger_("calling abort on "+e+"Buffer");try{i.abort()}catch(t){Yr.log.warn("Failed to abort on "+e+"Buffer",t)}}}}},po=function(e,t){return function(i){var n=eo(e),r=_.getMimeForCodec(t);i.logger_("Adding "+e+"Buffer with codec "+t+" to mediaSource");var a=i.mediaSource.addSourceBuffer(r);a.addEventListener("updateend",i["on"+n+"UpdateEnd_"]),a.addEventListener("error",i["on"+n+"Error_"]),i.codecs[e]=t,i[e+"Buffer"]=a}},mo=function(e){return function(t){var i=t[e+"Buffer"];if(ro(e,t),ao(t.mediaSource,i)){t.logger_("Removing "+e+"Buffer with codec "+t.codecs[e]+" from mediaSource");try{t.mediaSource.removeSourceBuffer(i)}catch(t){Yr.log.warn("Failed to removeSourceBuffer "+e+"Buffer",t)}}}},_o=function(e){return function(t,i){var n=i[t+"Buffer"],r=_.getMimeForCodec(e);ao(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_("changing "+t+"Buffer codec from "+i.codecs[t]+" to "+e),n.changeType(r),i.codecs[t]=e)}},go=function(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn,a=e.name;i.queue.push({type:t,action:n,doneFn:r,name:a}),no(t,i)},vo=function(e,t){return function(i){if(t.queuePending[e]){var n=t.queuePending[e].doneFn;t.queuePending[e]=null,n&&n(t[e+"Error_"])}no(e,t)}},yo=function(e){function t(t){var i;return(i=e.call(this)||this).mediaSource=t,i.sourceopenListener_=function(){return no("mediaSource",I.default(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=$r("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=vo("video",I.default(i)),i.onAudioUpdateEnd_=vo("audio",I.default(i)),i.onVideoError_=function(e){i.videoError_=e},i.onAudioError_=function(e){i.audioError_=e},i.createdSourceBuffers_=!1,i.initializedEme_=!1,i.triggeredReady_=!1,i}L.default(t,e);var i=t.prototype;return i.initializedEme=function(){this.initializedEme_=!0,this.triggerReady()},i.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},i.hasInitializedAnyEme=function(){return this.initializedEme_},i.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},i.createSourceBuffers=function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},i.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},i.addSourceBuffer=function(e,t){go({type:"mediaSource",sourceUpdater:this,action:po(e,t),name:"addSourceBuffer"})},i.abort=function(e){go({type:e,sourceUpdater:this,action:fo(e),name:"abort"})},i.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?go({type:"mediaSource",sourceUpdater:this,action:mo(e),name:"removeSourceBuffer"}):Yr.log.error("removeSourceBuffer is not supported!")},i.canRemoveSourceBuffer=function(){return!Yr.browser.IE_VERSION&&!Yr.browser.IS_FIREFOX&&C.default.MediaSource&&C.default.MediaSource.prototype&&"function"==typeof C.default.MediaSource.prototype.removeSourceBuffer},t.canChangeType=function(){return C.default.SourceBuffer&&C.default.SourceBuffer.prototype&&"function"==typeof C.default.SourceBuffer.prototype.changeType},i.canChangeType=function(){return this.constructor.canChangeType()},i.changeType=function(e,t){this.canChangeType()?go({type:e,sourceUpdater:this,action:_o(t),name:"changeType"}):Yr.log.error("changeType is not supported!")},i.addOrChangeSourceBuffers=function(e){var t=this;if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((function(i){var n=e[i];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(i,n);t.canChangeType()&&t.changeType(i,n)}))},i.appendBuffer=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of "+a.length+" until video append");if(go({type:r,sourceUpdater:this,action:so(a,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+s.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,s.forEach((function(e){i.appendBuffer.apply(i,e)}))}},i.audioBuffered=function(){return ao(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Yr.createTimeRange()},i.videoBuffered=function(){return ao(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Yr.createTimeRange()},i.buffered=function(){var e=ao(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ao(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var i=null,n=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return Yr.createTimeRange();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort((function(e,t){return e.time-t.time})),o=0;o<a.length;o++)"start"===a[o].type?2===++r&&(i=a[o].time):"end"===a[o].type&&1===--r&&(n=a[o].time),null!==i&&null!==n&&(s.push([i,n]),i=null,n=null);return Yr.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},i.setDuration=function(e,t){void 0===t&&(t=Js),go({type:"mediaSource",sourceUpdater:this,action:co(e),name:"duration",doneFn:t})},i.endOfStream=function(e,t){void 0===e&&(e=null),void 0===t&&(t=Js),"string"!=typeof e&&(e=void 0),go({type:"mediaSource",sourceUpdater:this,action:ho(e),name:"endOfStream",doneFn:t})},i.removeAudio=function(e,t,i){void 0===i&&(i=Js),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?go({type:"audio",sourceUpdater:this,action:oo(e,t),doneFn:i,name:"remove"}):i()},i.removeVideo=function(e,t,i){void 0===i&&(i=Js),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?go({type:"video",sourceUpdater:this,action:oo(e,t),doneFn:i,name:"remove"}):i()},i.updating=function(){return!(!io("audio",this)&&!io("video",this))},i.audioTimestampOffset=function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(go({type:"audio",sourceUpdater:this,action:uo(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},i.videoTimestampOffset=function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(go({type:"video",sourceUpdater:this,action:uo(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},i.audioQueueCallback=function(e){this.audioBuffer&&go({type:"audio",sourceUpdater:this,action:lo(e),name:"callback"})},i.videoQueueCallback=function(e){this.videoBuffer&&go({type:"video",sourceUpdater:this,action:lo(e),name:"callback"})},i.dispose=function(){var e=this;this.trigger("dispose"),to.forEach((function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e[t+"QueueCallback"]((function(){return ro(t,e)}))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},t}(Yr.EventTarget),bo=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},So=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),To=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).mediaSource_=null,n.subtitlesTrack_=null,n.loaderType_="subtitle",n.featuresNativeTextTracks_=t.featuresNativeTextTracks,n.shouldSaveSegmentTimingInfo_=!1,n}L.default(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return null},i.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Yr.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return Yr.createTimeRanges([[t,i]])},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Wa(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=So.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(So,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e},i.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.track=function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},i.remove=function(e,t){Gs(e,t,this.subtitlesTrack_)},i.fillBuffer_=function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}},i.timestampOffsetForSegment_=function(){return null},i.chooseNextRequest_=function(){return this.skipEmptySegments_(e.prototype.chooseNextRequest_.call(this))},i.skipEmptySegments_=function(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===vs&&this.handleTimeout_(),e.code===ys?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof C.default.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s,o=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",s),n.stopForError({message:"Error loading vtt.js"})};return s=function(){n.subtitlesTrack_.tech_.off("vttjserror",o),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",s),void this.subtitlesTrack_.tech_.one("vttjserror",o)}a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new C.default.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i<t.length;i++){for(var n=[],r=0,a=0;a<t.length;a++)t[i].startTime===t[a].startTime&&t[i].endTime===t[a].endTime&&t[i].text===t[a].text&&++r>1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"==typeof C.default.TextDecoder?t=new C.default.TextDecoder("utf8"):(t=C.default.WebVTT.StringDecoder(),i=!0);var n=new C.default.WebVTT.Parser(C.default,C.default.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){Yr.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=bo(r)),n.parse(r)}var a=e.bytes;i&&(a=bo(a)),n.parse(a),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/E.ONE_SECOND_IN_TS-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}($s),Eo=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},wo=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=aa(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],h=l.segment,d=e.timelineToDatetimeMappings[h.timeline];if(d&&h.dateTimeObject){var c=h.dateTimeObject.getTime()/1e3+d;if(h.parts&&"number"==typeof l.partIndex)for(var f=0;f<l.partIndex;f++)c+=h.parts[f].duration;var p=Math.abs(r-c);if(null!==s&&(0===p||s<p))break;s=p,a={time:c,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var a=null,s=null;r=r||0;for(var o=aa(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],h=l.segment,d=l.part&&l.part.start||h&&h.start;if(h.timeline===n&&void 0!==d){var c=Math.abs(r-d);if(null!==s&&s<c)break;(!a||null===s||s>=c)&&(s=c,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,h=e.discontinuities[l];if(h){var d=Math.abs(r-h.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:h.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],Ao=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=$r("SyncController"),i}L.default(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+da({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a<wo.length;a++){var s=wo[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r},i.selectSyncPoint_=function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i},i.saveExpiredSegmentInfo=function(e,t){for(var i=t.mediaSequence-e.mediaSequence-1;i>=0;i--){var n=e.segments[i];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:n.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||n<a.start)&&(a.start=n),a.end=r,!0},i.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?i.start-da({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+da({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(Yr.EventTarget),Co=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}L.default(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(Yr.EventTarget),ko=as(ss(os((function(){function e(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var t=e((function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0})),i=e((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(i,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),n=e((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();
-/*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */
-var a=null,s=function(){function e(e){var t,i,n;a||(a=function(){var e,t,i,n,r,a,s,o,u=[[[],[],[],[],[]],[[],[],[],[],[]]],l=u[0],h=u[1],d=l[4],c=h[4],f=[],p=[];for(e=0;e<256;e++)p[(f[e]=e<<1^283*(e>>7))^e]=e;for(t=i=0;!d[t];t^=n||1,i=p[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,d[t]=a,c[a]=t,o=16843009*f[r=f[n=f[t]]]^65537*r^257*n^16843008*t,s=257*f[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,h[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),h[e]=h[e].slice(0);return u}()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],s=this._tables[1],o=e.length,u=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var l=e.slice(0),h=[];for(this._key=[l,h],t=o;t<4*o+28;t++)n=l[t-1],(t%o==0||8===o&&t%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o==0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),l[t]=l[t-o]^n;for(i=0;t;i++,t--)n=l[3&i?t:t-4],h[i]=t<=4||i<4?n:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,l,h=this._key[1],d=e^h[0],c=n^h[1],f=i^h[2],p=t^h[3],m=h.length/4-2,_=4,g=this._tables[1],v=g[0],y=g[1],b=g[2],S=g[3],T=g[4];for(l=0;l<m;l++)s=v[d>>>24]^y[c>>16&255]^b[f>>8&255]^S[255&p]^h[_],o=v[c>>>24]^y[f>>16&255]^b[p>>8&255]^S[255&d]^h[_+1],u=v[f>>>24]^y[p>>16&255]^b[d>>8&255]^S[255&c]^h[_+2],p=v[p>>>24]^y[d>>16&255]^b[c>>8&255]^S[255&f]^h[_+3],_+=4,d=s,c=o,f=u;for(l=0;l<4;l++)r[(3&-l)+a]=T[d>>>24]<<24^T[c>>16&255]<<16^T[f>>8&255]<<8^T[255&p]^h[_++],s=d,d=c,c=f,f=p,p=s},e}(),o=function(e){function t(){var t;return(t=e.call(this,r)||this).jobs=[],t.delay=1,t.timeout_=null,t}n(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},l=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),h=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(h,h+a),i,n,l)),h=a;h<s.length;h+=a)n=new Uint32Array([u(s[h-4]),u(s[h-3]),u(s[h-2]),u(s[h-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(h,h+a),i,n,l));this.asyncStream_.push((function(){
-/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
-var e;r(null,(e=l).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n,r,a,o,l,h,d,c,f,p=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new s(Array.prototype.slice.call(t)),_=new Uint8Array(e.byteLength),g=new Int32Array(_.buffer);for(n=i[0],r=i[1],a=i[2],o=i[3],f=0;f<p.length;f+=4)l=u(p[f]),h=u(p[f+1]),d=u(p[f+2]),c=u(p[f+3]),m.decrypt(l,h,d,c,g,f),g[f]=u(g[f]^n),g[f+1]=u(g[f+1]^r),g[f+2]=u(g[f+2]^a),g[f+3]=u(g[f+3]^o),n=l,r=h,a=d,o=c;return _}(e,t,i);n.set(r,e.byteOffset)}},t(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}();self.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new l(i,n,r,(function(e,i){var n,r;self.postMessage((n={source:t.source,decrypted:i},r={},Object.keys(n).forEach((function(e){var t=n[e];ArrayBuffer.isView(t)?r[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:r[e]=t})),r),[i.buffer])}))}})))),Po=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Io=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Lo=function(e,t){t.activePlaylistLoader=e,e.load()},xo={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;Io(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in Yr.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];Yr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Io(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},Ro={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",xo[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",xo[e](e,i))}},Do={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,h=o.logger_,d=t.masterPlaylistLoader,c=ba(d.master);for(var f in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},c&&(s[e].main.default.playlists=d.master.playlists)),s[e])for(var p in u[f]||(u[f]=[]),s[e][f]){var m=s[e][f][p],_=void 0;if(c?(h("AUDIO group '"+f+"' label '"+p+"' is a master playlist"),m.isMasterPlaylist=!0,_=null):_="vhs-json"===n&&m.playlists?new Ua(m.playlists[0],i,a):m.resolvedUri?new Ua(m.resolvedUri,i,a):m.playlists&&"dash"===n?new is(m.playlists[0],i,a,d):null,m=Yr.mergeOptions({id:p,playlistLoader:_},m),Ro[e](e,m.playlistLoader,t),u[f].push(m),void 0===l[p]){var g=new Yr.AudioTrack({id:p,kind:Po(m),enabled:!1,language:m.language,default:m.default,label:p});l[p]=g}}r.on("error",xo[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,h=u.tracks,d=t.masterPlaylistLoader;for(var c in o[e])for(var f in l[c]||(l[c]=[]),o[e][c])if(!o[e][c][f].forced){var p=o[e][c][f],m=void 0;if("hls"===r)m=new Ua(p.resolvedUri,n,s);else if("dash"===r){if(!p.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new is(p.playlists[0],n,s,d)}else"vhs-json"===r&&(m=new Ua(p.playlists?p.playlists[0]:p.resolvedUri,n,s));if(p=Yr.mergeOptions({id:f,playlistLoader:m},p),Ro[e](e,p.playlistLoader,t),l[c].push(p),void 0===h[f]){var _=i.addRemoteTextTrack({id:f,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:f},!1).track;h[f]=_}}a.on("error",xo[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var h=i.options_.vhs&&i.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(h[d.instreamId]&&(d=Yr.mergeOptions(d,h[d.instreamId])),void 0===d.default&&delete d.default,a[o].push(Yr.mergeOptions({id:u},l)),void 0===s[u]){var c=i.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;s[u]=c}}}}},Oo=function e(t,i){for(var n=0;n<t.length;n++){if(va(i,t[n]))return!0;if(t[n].playlists&&e(t[n].playlists,i))return!0}return!1},Uo={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n];return null}}},Mo=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){Do[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,a=n.media();if(!a)return null;var s=null;a.attributes[e]&&(s=r[a.attributes[e]]);var o=Object.keys(r);if(!s)if("AUDIO"===e&&o.length>1&&ba(t.master))for(var u=0;u<o.length;u++){var l=r[o[u]];if(Oo(l,a)){s=l;break}}else r.main?s=r.main:1===o.length&&(s=r[o[0]]);return void 0===i?s:null!==i&&s&&s.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=Uo[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),u=a.activePlaylistLoader,l=a.lastGroup_;o&&l&&o.id===l.id||(a.lastGroup_=o,a.lastTrack_=s,Io(n,a),o&&!o.isMasterPlaylist&&(o.playlistLoader?(n.resyncLoader(),Lo(o.playlistLoader,a)):u&&r.resetEverything()))}}(i,e),t[i].onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,i.abort(),i.pause()}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.masterPlaylistLoader,n=t.segmentLoaders,r=n[e],a=n.main,s=t.mediaTypes[e],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,h=s.lastTrack_;if((!h||!o||h.id!==o.id)&&(s.lastGroup_=u,s.lastTrack_=o,Io(r,s),u)){if(u.isMasterPlaylist){if(!o||!h||o.id===h.id)return;var d=t.vhs.masterPlaylistController_,c=d.selectPlaylist();if(d.media()===c)return;return s.logger_("track change. Switching master audio from "+h.id+" to "+o.id),i.pause(),a.resetEverything(),void d.fastQualityChange_(c)}if("AUDIO"===e){if(!u.playlistLoader)return a.setAudio(!0),void a.resetEverything();r.setAudio(!0),a.setAudio(!1)}l!==u.playlistLoader?(r.track&&r.track(o),r.resetEverything(),Lo(u.playlistLoader,s)):Lo(u.playlistLoader,s)}}}(i,e),t[i].getActiveGroup=function(e,t){var i=t.mediaTypes;return function(){var t=i[e].activeTrack();return t?i[e].activeGroup(t):null}}(i,e)}));var u=t.AUDIO.activeGroup();if(u){var l=(u.filter((function(e){return e.default}))[0]||u[0]).id;t.AUDIO.tracks[l].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(o.setAudio(!1),s.setAudio(!0)):o.setAudio(!0)}i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))})),i.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanging()}))}));var h=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"}),n.trigger({type:"usage",name:"hls-audio-change"})};for(var d in n.audioTracks().addEventListener("change",h),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",h),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[d])},Fo=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Bo=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},No=function(e){function t(t){var i;i=e.call(this)||this;var n=t.src,r=t.handleManifestRedirects,a=t.withCredentials,s=t.tech,o=t.bandwidth,u=t.externVhs,l=t.useCueTags,h=t.blacklistDuration,d=t.enableLowInitialPlaylist,c=t.sourceType,f=t.cacheEncryptionKeys,p=t.experimentalBufferBasedABR,m=t.experimentalLeastPixelDiffSelector;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");var _,g=t.maxPlaylistRetries;null==g&&(g=1/0),Zs=u,i.experimentalBufferBasedABR=Boolean(p),i.experimentalLeastPixelDiffSelector=Boolean(m),i.withCredentials=a,i.tech_=s,i.vhs_=s.vhs,i.sourceType_=c,i.useCueTags_=l,i.blacklistDuration=h,i.maxPlaylistRetries=g,i.enableLowInitialPlaylist=d,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:a,handleManifestRedirects:r,maxPlaylistRetries:g,timeout:null},i.on("error",i.pauseLoading),i.mediaTypes_=(_={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(e){_[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Js,activeTrack:Js,getActiveGroup:Js,onGroupChanged:Js,onTrackChanged:Js,lastTrack_:null,logger_:$r("MediaGroups["+e+"]")}})),_),i.mediaSource=new C.default.MediaSource,i.handleDurationChange_=i.handleDurationChange_.bind(I.default(i)),i.handleSourceOpen_=i.handleSourceOpen_.bind(I.default(i)),i.handleSourceEnded_=i.handleSourceEnded_.bind(I.default(i)),i.mediaSource.addEventListener("durationchange",i.handleDurationChange_),i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_),i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_),i.seekable_=Yr.createTimeRanges(),i.hasPlayed_=!1,i.syncController_=new Ao(t),i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new ko,i.sourceUpdater_=new yo(i.mediaSource),i.inbandTextTracks_={},i.timelineChangeController_=new Co;var v={vhs:i.vhs_,parse708captions:t.parse708captions,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:o,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:f,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings};i.masterPlaylistLoader_="dash"===i.sourceType_?new is(n,i.vhs_,i.requestOptions_):new Ua(n,i.vhs_,i.requestOptions_),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new $s(Yr.mergeOptions(v,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new $s(Yr.mergeOptions(v,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new To(Yr.mergeOptions(v,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks}),t),i.setupSegmentLoaderListeners_(),i.experimentalBufferBasedABR&&(i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()})),i.tech_.on("pause",(function(){return i.stopABRTimer_()})),i.tech_.on("play",(function(){return i.startABRTimer_()}))),Fo.forEach((function(e){i[e+"_"]=Bo.bind(I.default(i),e)})),i.logger_=$r("MPC"),i.triggeredFmp4Usage=!1,"none"===i.tech_.preload()?(i.loadOnPlay_=function(){i.loadOnPlay_=null,i.masterPlaylistLoader_.load()},i.tech_.one("play",i.loadOnPlay_)):i.masterPlaylistLoader_.load(),i.timeToLoadedData__=-1,i.mainAppendsToLoadedData__=-1,i.audioAppendsToLoadedData__=-1;var y="none"===i.tech_.preload()?"play":"loadstart";return i.tech_.one(y,(function(){var e=Date.now();i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e,i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends,i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))})),i}L.default(t,e);var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},i.timeToLoadedData_=function(){return this.timeToLoadedData__},i.checkABR_=function(){var e=this.selectPlaylist();e&&this.shouldSwitchToMedia_(e)&&this.switchMedia_(e,"abr")},i.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),a=e.id||e.uri;r&&r!==a&&(this.logger_("switch media "+r+" -> "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=C.default.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(C.default.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var u in n)if(n[u][i.label]){var l=n[u][i.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var h=0;h<e.playlists.length;h++){var d=e.playlists[h];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===u&&o.push(d)}}return o.length?o:t},i.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;ga(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),Mo({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,vhs:e.vhs_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t=e.masterPlaylistLoader_.media();if(!t){var i;if(e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),!i||!e.shouldSwitchToMedia_(i))return;if(e.initialMedia_=i,e.switchMedia_(e.initialMedia_,"initial"),!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;ga(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&(e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),e.tech_.trigger("playliststuck")))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))},i.handleUpdatedMediaPlaylist=function(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())},i.triggerPresenceUsage_=function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var a in i.AUDIO)for(var s in i.AUDIO[a]){i.AUDIO[a][s].uri||(n=!1)}n&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(i.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),Zs.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media(),i=this.tech_.buffered();return function(e){var t=e.currentPlaylist,i=e.nextPlaylist,n=e.forwardBuffer,r=e.bufferLowWaterLine,a=e.bufferHighWaterLine,s=e.duration,o=e.experimentalBufferBasedABR,u=e.log;if(!i)return Yr.log.warn("We received no playlist to switch to. Please check your stream."),!1;var l="allowing switch "+(t&&t.id||"null")+" -> "+i.id;if(!t)return u(l+" as current playlist is not set"),!0;if(i.id===t.id)return!1;if(!t.endList)return u(l+" as current playlist is live"),!0;var h=o?ns.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ns.MAX_BUFFER_LOW_WATER_LINE;if(s<h)return u(l+" as duration < max low water line ("+s+" < "+h+")"),!0;var d=i.attributes.BANDWIDTH,c=t.attributes.BANDWIDTH;if(d<c&&(!o||n<a)){var f=l+" as next bandwidth < current bandwidth ("+d+" < "+c+")";return o&&(f+=" and forwardBuffer < bufferHighWaterLine ("+n+" < "+a+")"),u(f),!0}if((!o||d>c)&&n>=r){var p=l+" as forwardBuffer >= bufferLowWaterLine ("+n+" >= "+r+")";return o&&(p+=" and next bandwidth > current bandwidth ("+d+" > "+c+")"),u(p),!0}return u("not "+l+" as no switching criteria met"),!1}({currentPlaylist:t,nextPlaylist:e,forwardBuffer:i.length?i.end(i.length-1)-this.tech_.currentTime():0,bufferLowWaterLine:this.bufferLowWaterLine(),bufferHighWaterLine:this.bufferHighWaterLine(),duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){Yr.browser.IE_VERSION||Yr.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}},i.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(Yr.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0},i.handleSourceOpen_=function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")},i.handleSourceEnded_=function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}},i.handleDurationChange_=function(){this.tech_.trigger("durationchange")},i.onEndOfStream=function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},i.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var i=Zs.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=.1;var a=r.end(r.length-1);return a-n<=.1&&i-a<=.1},i.blacklistCurrentPlaylist=function(e,t){void 0===e&&(e={});var i=e.playlist||this.masterPlaylistLoader_.media();if(t=t||e.blacklistDuration||this.blacklistDuration,!i)return this.error=e,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var n,r=this.masterPlaylistLoader_.master.playlists,a=r.filter(ma),s=1===a.length&&a[0]===i;if(1===r.length&&t!==1/0)return Yr.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s);if(s){var o=!1;r.forEach((function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(o=!0,delete e.excludeUntil)}})),o&&(Yr.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}n=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var u=this.selectPlaylist();if(!u)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var l=e.internal?this.logger_:Yr.log.warn,h=e.message?" "+e.message:"";l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+h+" Switching to playlist "+u.id+"."),u.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var d=u.targetDuration/2*1e3||5e3,c="number"==typeof u.lastRequest&&Date.now()-u.lastRequest<=d;return this.switchMedia_(u,"exclude",s||c)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=Zr(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Zs.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Zs.Playlist.seekable(t,i,Zs.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Zs.Playlist.seekable(t,i,Zs.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=Yr.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===a&&this.seekable_.start(0)===s||(this.logger_("seekable updated ["+ta(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},i.updateDuration=function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var i=this.tech_.buffered(),n=Zs.Playlist.duration(this.masterPlaylistLoader_.media());i.length>0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=Us(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||_.DEFAULT_VIDEO_CODEC),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||_.DEFAULT_AUDIO_CODEC)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||_.DEFAULT_AUDIO_CODEC,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?_.browserSupportsCodec(o):_.muxerSupportsCodec(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(_.parseCodecs(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(_.parseCodecs(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var l=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=Us(e.master,r),s=[];!a.audio||_.muxerSupportsCodec(a.audio)||_.browserSupportsCodec(a.audio)||s.push("audio codec "+a.audio),!a.video||_.muxerSupportsCodec(a.video)||_.browserSupportsCodec(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=Ds(_.parseCodecs(e)),a=Os(r),s=r.video&&_.parseCodecs(r.video)[0]||null,o=r.audio&&_.parseCodecs(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var u=[],l=Us(t.masterPlaylistLoader_.master,r),h=Os(l);if(l.audio||l.video){if(h!==a&&u.push('codec count "'+h+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var d=l.video&&_.parseCodecs(l.video)[0]||null,c=l.audio&&_.parseCodecs(l.audio)[0]||null;d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+d.type+'" !== "'+s.type+'"'),c&&o&&c.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+c.type+'" !== "'+o.type+'"')}u.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+u.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,a=0;a<e.segments.length;a++){var s=e.segments[a];if(n||(n=Eo(t,r+s.duration/2)),n){if("cueIn"in s){n.endTime=r,n.adEndTime=r,r+=s.duration,n=null;continue}if(r<n.endTime){r+=s.duration;continue}n.endTime+=s.duration}else if("cueOut"in s&&((n=new C.default.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r,n.adEndTime=r+parseFloat(s.cueOut),t.addCue(n)),"cueOutCont"in s){var o=s.cueOutCont.split("/").map(parseFloat),u=o[0],l=o[1];(n=new C.default.VTTCue(r,r+s.duration,"")).adStartTime=r-u,n.adEndTime=n.adStartTime+l,t.addCue(n)}r+=s.duration}}(e,this.cueTagsTrack_,t)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=ns.GOAL_BUFFER_LENGTH,i=ns.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,ns.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=ns.BUFFER_LOW_WATER_LINE,i=ns.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,ns.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,ns.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},i.bufferHighWaterLine=function(){return ns.BUFFER_HIGH_WATER_LINE},t}(Yr.EventTarget),jo=function(e,t,i){var n,r,a,s=e.masterPlaylistController_,o=s[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(s);if(t.attributes){var u=t.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=t.attributes.BANDWIDTH}this.codecs=Us(s.master(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,r=t.id,a=o,function(e){var t=n.master.playlists[r],i=pa(t),s=ma(t);return void 0===e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),e)})},Vo=["seeking","seeked","pause","playing","error"],Ho=function(){function e(e){var t=this;this.masterPlaylistController_=e.masterPlaylistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=$r("PlaybackWatcher"),this.logger_("initialize");var i=function(){return t.monitorCurrentTime_()},n=function(){return t.monitorCurrentTime_()},r=function(){return t.techWaiting_()},a=function(){return t.cancelTimer_()},s=function(){return t.fixesBadSeeks_()},o=this.masterPlaylistController_,u=["main","subtitle","audio"],l={};u.forEach((function(e){l[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}},o[e+"SegmentLoader_"].on("appendsdone",l[e].updateend),o[e+"SegmentLoader_"].on("playlistupdate",l[e].reset),t.tech_.on(["seeked","seeking"],l[e].reset)})),this.tech_.on("seekablechanged",s),this.tech_.on("waiting",r),this.tech_.on(Vo,a),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=function(){t.logger_("dispose"),t.tech_.off("seekablechanged",s),t.tech_.off("waiting",r),t.tech_.off(Vo,a),t.tech_.off("canplay",n),t.tech_.off("play",i),u.forEach((function(e){o[e+"SegmentLoader_"].off("appendsdone",l[e].updateend),o[e+"SegmentLoader_"].off("playlistupdate",l[e].reset),t.tech_.off(["seeked","seeking"],l[e].reset)})),t.checkCurrentTimeTimeout_&&C.default.clearTimeout(t.checkCurrentTimeTimeout_),t.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&C.default.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=C.default.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"];this[e+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:ia(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"}),"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:.1)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+ta(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;var r=this.tech_.buffered();return!!function(e){var t=e.buffered,i=e.targetDuration,n=e.currentTime;return!!t.length&&(!(t.end(0)-t.start(0)<2*i)&&(!(n>t.start(0))&&t.start(0)-n<i))}({buffered:r,targetDuration:this.media().targetDuration,currentTime:i})&&(e=r.start(0)+.1,this.logger_("Buffered region starts ("+r.start(0)+") just beyond seek point ("+i+"). Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0)},t.waiting_=function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=Zr(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=ea(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+.1;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)},t.videoUnderflow_=function(e){var t=e.videoBuffered,i=e.audioBuffered,n=e.currentTime;if(t){var r;if(t.length&&i.length){var a=Zr(t,n-3),s=Zr(t,n),o=Zr(i,n);o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else{ea(t,n).length||(r=this.gapFromVideoUnderflow_(t,n))}return!!r&&(this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+n),!0)}},t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=ea(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+1/30),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return Yr.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return Yr.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null},e}(),zo={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Go=function(e){!function e(t,i){var n=0,r=0,a=Yr.mergeOptions(zo,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"==typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void Yr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},l=function e(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)},Wo={PlaylistLoader:Ua,Playlist:Sa,utils:Ka,STANDARD_PLAYLIST_SELECTOR:Hs,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(Sa.isEnabled);return Ns(t,(function(e,t){return js(e,t)})),t.filter((function(t){return!!Us(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:Hs,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&C.default.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Vs(this.playlists.master,t,parseInt(Bs(this.tech_.el(),"width"),10)*n,parseInt(Bs(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:js,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||C.default.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||C.default.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Na()};Object.keys(ns).forEach((function(e){Object.defineProperty(Wo,e,{get:function(){return Yr.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),ns[e]},set:function(t){Yr.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?Yr.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):ns[e]=t}})}));var Yo=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};Wo.canPlaySource=function(){return Yr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var qo=function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var a=function(e,t){return e.reduce((function(e,i){if(!i.contentProtection)return e;var n=t.reduce((function(e,t){var n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[])}(n?r.concat([n]):r,Object.keys(i)),s=[],o=[];return a.forEach((function(e){o.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)}))),s.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))})),Promise.race([Promise.all(s),Promise.race(o)])},Ko=function(e){var t=e.player,i=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=Ds(_.parseCodecs(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r=_.getMimeForCodec(n.video),a=_.getMimeForCodec(n.audio),s={};for(var o in e)s[o]={},a&&(s[o].audioContentType=a),r&&(s[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return Yr.mergeOptions(e,s)}(e.sourceKeySystems,e.media,e.audioMedia);return!!i&&(t.currentSource().keySystems=i,!(i&&!t.eme)||(Yr.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Xo=function(){if(!C.default.localStorage)return null;var e=C.default.localStorage.getItem("videojs-vhs");if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};Wo.supportsNativeHls=function(){if(!k.default||!k.default.createElement)return!1;var e=k.default.createElement("video");if(!Yr.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),Wo.supportsNativeDash=!!(k.default&&k.default.createElement&&Yr.getTech("Html5").isSupported())&&/maybe|probably/i.test(k.default.createElement("video").canPlayType("application/dash+xml")),Wo.supportsTypeNatively=function(e){return"hls"===e?Wo.supportsNativeHls:"dash"===e&&Wo.supportsNativeDash},Wo.isSupported=function(){return Yr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var Qo=function(e){function t(t,i,n){var r;if(r=e.call(this,i,Yr.mergeOptions(n.hls,n.vhs))||this,n.hls&&Object.keys(n.hls).length&&Yr.log.warn("Using hls options is deprecated. Use vhs instead."),"number"==typeof n.initialBandwidth&&(r.options_.bandwidth=n.initialBandwidth),r.logger_=$r("VhsHandler"),i.options_&&i.options_.playerId){var a=Yr(i.options_.playerId);a.hasOwnProperty("hls")||Object.defineProperty(a,"hls",{get:function(){return Yr.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"hls-player-access"}),I.default(r)},configurable:!0}),a.hasOwnProperty("vhs")||Object.defineProperty(a,"vhs",{get:function(){return Yr.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"vhs-player-access"}),I.default(r)},configurable:!0}),a.hasOwnProperty("dash")||Object.defineProperty(a,"dash",{get:function(){return Yr.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),I.default(r)},configurable:!0}),r.player_=a}if(r.tech_=i,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(k.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=k.default.fullscreenElement||k.default.webkitFullscreenElement||k.default.mozFullScreenElement||k.default.msFullscreenElement;t&&t.contains(r.tech_.el())?r.masterPlaylistController_.fastQualityChange_():r.masterPlaylistController_.checkABR_()})),r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),r.on(r.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}L.default(t,e);var i=t.prototype;return i.setOptions_=function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=Xo();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=ns.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ns.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},i.src=function(e,t){var i=this;if(e){var n;this.setOptions_(),this.options_.src=0===(n=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(n.substring(n.indexOf(",")+1)):n,this.options_.tech=this.tech_,this.options_.externVhs=Wo,this.options_.sourceType=g.simpleTypeFromSourceType(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e)},this.options_.smoothQualityChange&&Yr.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"),this.masterPlaylistController_=new No(this.options_);var r=Yr.mergeOptions({liveRangeSafeTimeDelta:.1},this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_});this.playbackWatcher_=new Ho(r),this.masterPlaylistController_.on("error",(function(){var e=Yr.players[i.tech_.options_.playerId],t=i.masterPlaylistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));var a=this.options_.experimentalBufferBasedABR?Wo.movingAverageBandwidthSelector(.55):Wo.STANDARD_PLAYLIST_SELECTOR;this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.masterPlaylistController_.selectInitialPlaylist=Wo.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){Yr.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return ia(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return ia(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!C.default.localStorage)return!1;var t=Xo();t=t?Yr.mergeOptions(t,e):e;try{C.default.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=ba(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!pa(e)})).map((function(t,i){return new jo(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=C.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=Ko({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){"output-restricted"===t.status&&e.masterPlaylistController_.blacklistCurrentPlaylist({playlist:e.masterPlaylistController_.media(),message:"DRM keystatus changed to "+t.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:1/0})})),11!==Yr.browser.IE_VERSION&&i?(this.logger_("waiting for EME key session creation"),qo({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))):this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=Yr.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),Yo(t,i.playlists)})),this.playlists.on("mediachange",(function(){Yo(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":"2.10.2","mux.js":"5.13.0","mpd-parser":"0.19.0","m3u8-parser":"4.7.0","aes-decrypter":"3.1.2"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return yo.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&C.default.URL.revokeObjectURL&&(C.default.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return Xa({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Qa({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(Yr.getComponent("Component")),$o={name:"videojs-http-streaming",VERSION:"2.10.2",canHandleSource:function(e,t){void 0===t&&(t={});var i=Yr.mergeOptions(Yr.options,t);return $o.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=Yr.mergeOptions(Yr.options,i);return t.vhs=new Qo(e,t,n),Yr.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return Yr.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Na(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=Yr.mergeOptions(Yr.options,t).vhs.overrideNative,n=void 0===i?!Yr.browser.IS_ANY_SAFARI:i,r=g.simpleTypeFromSourceType(e);return r&&(!Wo.supportsTypeNatively(r)||n)?"maybe":""}};_.browserSupportsCodec("avc1.4d400d,mp4a.40.2")&&Yr.getTech("Html5").registerSourceHandler($o,0),Yr.VhsHandler=Qo,Object.defineProperty(Yr,"HlsHandler",{get:function(){return Yr.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Qo},configurable:!0}),Yr.VhsSourceHandler=$o,Object.defineProperty(Yr,"HlsSourceHandler",{get:function(){return Yr.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),$o},configurable:!0}),Yr.Vhs=Wo,Object.defineProperty(Yr,"Hls",{get:function(){return Yr.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Wo},configurable:!0}),Yr.use||(Yr.registerComponent("Hls",Wo),Yr.registerComponent("Vhs",Wo)),Yr.options.vhs=Yr.options.vhs||{},Yr.options.hls=Yr.options.hls||{},Yr.registerPlugin?Yr.registerPlugin("reloadSourceOnError",Go):Yr.plugin("reloadSourceOnError",Go),t.exports=Yr},{"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/construct":2,"@babel/runtime/helpers/extends":3,"@babel/runtime/helpers/inherits":4,"@babel/runtime/helpers/inheritsLoose":5,"@videojs/vhs-utils/cjs/byte-helpers":9,"@videojs/vhs-utils/cjs/codecs.js":11,"@videojs/vhs-utils/cjs/containers":12,"@videojs/vhs-utils/cjs/id3-helpers":15,"@videojs/vhs-utils/cjs/media-types.js":16,"@videojs/vhs-utils/cjs/resolve-url.js":20,"@videojs/xhr":23,"global/document":33,"global/window":34,keycode:37,"m3u8-parser":38,"mpd-parser":40,"mux.js/lib/tools/parse-sidx":42,"mux.js/lib/utils/clock":43,"safe-json-parse/tuple":45,"videojs-vtt.js":48}],48:[function(e,t,i){var n=e("global/window"),r=t.exports={WebVTT:e("./vtt.js"),VTTCue:e("./vttcue.js"),VTTRegion:e("./vttregion.js")};n.vttjs=r,n.WebVTT=r.WebVTT;var a=r.VTTCue,s=r.VTTRegion,o=n.VTTCue,u=n.VTTRegion;r.shim=function(){n.VTTCue=a,n.VTTRegion=s},r.restore=function(){n.VTTCue=o,n.VTTRegion=u},n.VTTCue||r.shim()},{"./vtt.js":49,"./vttcue.js":50,"./vttregion.js":51,"global/window":34}],49:[function(e,t,i){var n=e("global/document"),r=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function a(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function s(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function o(){this.values=r(null)}function u(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);if(2===s.length)t(s[0],s[1])}}function l(e,t,i){var n=e;function r(){var t=s(e);if(null===t)throw new a(a.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function l(){e=e.replace(/^\s+/,"")}if(l(),t.startTime=r(),l(),"--\x3e"!==e.substr(0,3))throw new a(a.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),l(),t.endTime=r(),l(),function(e,t){var n=new o;u(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}a.prototype=r(Error.prototype),a.prototype.constructor=a,a.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},o.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var h=n.createElement&&n.createElement("textarea"),d={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},c={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},f={v:"title",lang:"lang"},p={rt:"ruby"};function m(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!p[t.localName]||p[t.localName]===e.localName}function r(t,i){var n=d[t];if(!n)return null;var r=e.document.createElement(n),a=f[t];return a&&i&&(r[a]=i.trim()),r}for(var a,o,u=e.document.createElement("div"),l=u,m=[];null!==(a=i());)if("<"!==a[0])l.appendChild(e.document.createTextNode((o=a,h.innerHTML=o,o=h.textContent,h.textContent="",o)));else{if("/"===a[1]){m.length&&m[m.length-1]===a.substr(2).replace(">","")&&(m.pop(),l=l.parentNode);continue}var _,g=s(a.substr(1,a.length-2));if(g){_=e.document.createProcessingInstruction("timestamp",g),l.appendChild(_);continue}var v=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!v)continue;if(!(_=r(v[1],v[3])))continue;if(!n(l,_))continue;if(v[2]){var y=v[2].split(".");y.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(c.hasOwnProperty(i)){var n=t?"background-color":"color",r=c[i];_.style[n]=r}})),_.className=y.join(" ")}m.push(v[1]),l.appendChild(_),l=_}return u}var _=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function g(e){for(var t=0;t<_.length;t++){var i=_[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function v(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a<i.length;a++)if(g(i.charCodeAt(a)))return"rtl";return"ltr"}function y(){}function b(e,t,i){y.call(this),this.cue=t,this.cueDiv=m(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:v(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function S(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function T(e,t,i,n){var r=new S(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,h=l*Math.round(s),d=i[u]+l,c=o[0];Math.abs(h)>d&&(h=h<0?-1:1,h*=Math.ceil(d/l)*l),s<0&&(h+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(c,h)}else{var f=r.lineHeight/i.height*100;switch(a.lineAlign){case"center":s-=f/2;break;case"end":s-=f}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new S(t)}var p=function(e,t){for(var r,a=new S(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var u=e.intersectPercentage(i);s>u&&(r=new S(e),s=u),e=new S(a)}return r||a}(r,o);t.move(p.toCSSCompatValues(i))}function E(){}y.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},y.prototype.formatStyle=function(e,t){return 0===e?0:e+t},b.prototype=r(y.prototype),b.prototype.constructor=b,S.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},S.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},S.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},S.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},S.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},S.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},S.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},S.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},E.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},E.convertCueToDOMTree=function(e,t){return e&&t?m(e,t):null};E.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=S.getSimpleBoxPosition(n),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var i,o,u=0;u<t.length;u++)o=t[u],i=new b(e,o,s),n.appendChild(i.div),T(0,i,a,r),o.displayState=i.div,r.push(S.getSimpleBoxPosition(i))}()}else for(var o=0;o<t.length;o++)n.appendChild(t[o].displayState)},E.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},E.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof a))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?u(e,(function(e,i){switch(e){case"X-TIMESTAMP-MAP":!function(e){var i=new o;u(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",s(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}}),/=/):u(e,(function(e,i){switch(e){case"Region":!function(e){var i=new o;if(u(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new o;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var h=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!h||!h[0])throw new a(a.Errors.BadSignature);t.state="HEADER"}for(var d=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(d?d=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{l(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var c=-1!==r.indexOf("--\x3e");if(!r||c&&(d=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new a(a.Errors.BadSignature)}catch(e){this.reportOrThrowError(e)}return this.onflush&&this.onflush(),this}},t.exports=E},{"global/document":33}],50:[function(e,t,i){var n={"":1,lr:1,rl:1},r={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function a(e){return"string"==typeof e&&(!!r[e.toLowerCase()]&&e.toLowerCase())}function s(e,t,i){this.hasBeenReset=!1;var r="",s=!1,o=e,u=t,l=i,h=null,d="",c=!0,f="auto",p="start",m="auto",_="auto",g=100,v="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(e){r=""+e}},pauseOnExit:{enumerable:!0,get:function(){return s},set:function(e){s=!!e}},startTime:{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");u=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(e){l=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return h},set:function(e){h=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return d},set:function(e){var t=function(e){return"string"==typeof e&&(!!n[e.toLowerCase()]&&e.toLowerCase())}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");d=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return f},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");f=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(e){var t=a(e);t&&(p=t,this.hasBeenReset=!0)}},position:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");m=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return _},set:function(e){var t=a(e);t&&(_=t,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");g=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return v},set:function(e){var t=a(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");v=t,this.hasBeenReset=!0}}}),this.displayState=void 0}s.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},t.exports=s},{}],51:[function(e,t,i){var n={"":!0,up:!0};function r(e){return"number"==typeof e&&e>=0&&e<=100}t.exports=function(){var e=100,t=3,i=0,a=100,s=0,o=100,u="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!r(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!r(e))throw new Error("RegionAnchorX must be between 0 and 100.");a=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!r(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(e){if(!r(e))throw new Error("ViewportAnchorY must be between 0 and 100.");o=e}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(e){if(!r(e))throw new Error("ViewportAnchorX must be between 0 and 100.");s=e}},scroll:{enumerable:!0,get:function(){return u},set:function(e){var t=function(e){return"string"==typeof e&&(!!n[e.toLowerCase()]&&e.toLowerCase())}(e);!1===t||(u=t)}}})}},{}],52:[function(e,t,i){"use strict";t.exports={H265WEBJS_COMPILE_MULTI_THREAD_SHAREDBUFFER:0,DEFAULT_PLAYERE_LOAD_TIMEOUT:20,DEFAILT_WEBGL_PLAY_ID:"glplayer",PLAYER_IN_TYPE_MP4:"mp4",PLAYER_IN_TYPE_FLV:"flv",PLAYER_IN_TYPE_HTTPFLV:"httpflv",PLAYER_IN_TYPE_RAW_265:"raw265",PLAYER_IN_TYPE_TS:"ts",PLAYER_IN_TYPE_MPEGTS:"mpegts",PLAYER_IN_TYPE_M3U8:"hls",PLAYER_IN_TYPE_M3U8_VOD:"m3u8",PLAYER_IN_TYPE_M3U8_LIVE:"hls",APPEND_TYPE_STREAM:0,APPEND_TYPE_FRAME:1,APPEND_TYPE_SEQUENCE:2,DEFAULT_WIDTH:600,DEFAULT_HEIGHT:600,DEFAULT_FPS:30,DEFAULT_FRAME_DUR:40,DEFAULT_FIXED:!1,DEFAULT_SAMPLERATE:44100,DEFAULT_CHANNELS:2,DEFAULT_CONSU_SAMPLE_LEN:20,PLAYER_MODE_VOD:"vod",PLAYER_MODE_NOTIME_LIVE:"live",AUDIO_MODE_ONCE:"ONCE",AUDIO_MODE_SWAP:"SWAP",DEFAULT_STRING_LIVE:"LIVE",CODEC_H265:0,CODEC_H264:1,PLAYER_CORE_TYPE_DEFAULT:0,PLAYER_CORE_TYPE_CNATIVE:1,PLAYER_CNATIVE_VOD_RETRY_MAX:7,URI_PROTOCOL_WEBSOCKET:"ws",URI_PROTOCOL_WEBSOCKET_DESC:"websocket",URI_PROTOCOL_HTTP:"http",URI_PROTOCOL_HTTP_DESC:"http",FETCH_FIRST_MAX_TIMES:5,FETCH_HTTP_FLV_TIMEOUT_MS:7e3,V_CODEC_NAME_HEVC:265,V_CODEC_NAME_AVC:264,V_CODEC_NAME_UNKN:500,A_CODEC_NAME_AAC:112,A_CODEC_NAME_MP3:113,A_CODEC_NAME_UNKN:500,CACHE_NO_LOADCACHE:1001,CACHE_WITH_PLAY_SIGN:1002,CACHE_WITH_NOPLAY_SIGN:1003,V_CODEC_AVC_DEFAULT_FPS:25}},{}],53:[function(e,t,i){"use strict";var n=window.AudioContext||window.webkitAudioContext,r=e("../consts"),a=e("./av-common");t.exports=function(){var e={options:{sampleRate:r.DEFAULT_SAMPLERATE,appendType:r.APPEND_TYPE_FRAME,playMode:r.AUDIO_MODE_SWAP},sourceChannel:-1,audioCtx:new n({latencyHint:"interactive",sampleRate:r.DEFAULT_SAMPLERATE}),gainNode:null,sourceList:[],startStatus:!1,sampleQueue:[],nextBuffer:null,playTimestamp:0,playStartTime:0,durationMs:-1,isLIVE:!1,voice:1,onLoadCache:null,resetStartParam:function(){e.playTimestamp=0,e.playStartTime=0},setOnLoadCache:function(t){e.onLoadCache=t},setDurationMs:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;e.durationMs=t},setVoice:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;e.voice=t,e.gainNode.gain.value=t},getAlignVPTS:function(){return e.playTimestamp+(a.GetMsTime()-e.playStartTime)/1e3},swapSource:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0==e.startStatus)return null;if(t<0||t>=e.sourceList.length)return null;if(i<0||i>=e.sourceList.length)return null;try{e.sourceChannel===t&&null!==e.sourceList[t]&&(e.sourceList[t].disconnect(e.gainNode),e.sourceList[t]=null)}catch(e){console.error("[DEFINE ERROR] audioPcmModule disconnect source Index:"+t+" error happened!",e)}e.sourceChannel=i;var n=e.decodeSample(i,t);-2==n&&e.isLIVE&&(e.getAlignVPTS()>=e.durationMs/1e3-.04?e.pause():null!==e.onLoadCache&&e.onLoadCache())},addSample:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!(null==t||!t||null==t)&&(0==e.sampleQueue.length&&(e.seekPos=t.pts),e.sampleQueue.push(t),e.sampleQueue.length,!0)},runNextBuffer:function(){window.setInterval((function(){if(!(null!=e.nextBuffer||e.sampleQueue.length<r.DEFAULT_CONSU_SAMPLE_LEN)){e.nextBuffer={data:null,pts:-1};for(var t=null,i=0;i<r.DEFAULT_CONSU_SAMPLE_LEN;i++){t=e.sampleQueue.shift();var n=null;if(n=e.options.appendType==r.APPEND_TYPE_STREAM?t:t.data,e.nextBuffer.pts<0&&(e.nextBuffer.pts=t.pts),null==e.nextBuffer.data)e.nextBuffer.data=new Float32Array(n),n.length,e.nextBuffer.data.length;else{var a=new Float32Array(n.length+e.nextBuffer.data.length);a.set(e.nextBuffer.data,0),a.set(n,e.nextBuffer.data.length),e.nextBuffer.data=a,n.length,e.nextBuffer.data.length}if(e.sampleQueue.length<=0)break;t=null}e.nextBuffer.data.length}}),10)},decodeSample:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(t<0||t>=e.sourceList.length)return-1;if(null!=e.sourceList[t]&&null!=e.sourceList[t]&&e.sourceList[t]||(e.sourceList[t]=e.audioCtx.createBufferSource(),e.sourceList[t].onended=function(){e.swapSource(t,i)}),0==e.sampleQueue.length)return e.isLIVE?(e.sourceList[t].connect(e.gainNode),e.sourceList[t].start(),e.sourceList[t].onended=function(){e.swapSource(t,i)},e.sourceList[t].stop(),0):-2;if(e.sourceList[t].buffer)return e.swapSource(t,i),0;if(null==e.nextBuffer||e.nextBuffer.data.length<1)return e.sourceList[t].connect(e.gainNode),e.sourceList[t].start(),e.sourceList[t].startState=!0,e.sourceList[t].stop(),1;var n=e.nextBuffer.data;e.playTimestamp=e.nextBuffer.pts,e.playStartTime=a.GetMsTime(),e.nextBuffer.data,e.playTimestamp;try{var r=e.audioCtx.createBuffer(1,n.length,e.options.sampleRate);r.copyToChannel(n,0),null!==e.sourceList[t]&&(e.sourceList[t].buffer=r,e.sourceList[t].connect(e.gainNode),e.sourceList[t].start(),e.sourceList[t].startState=!0)}catch(t){return e.nextBuffer=null,-3}return e.nextBuffer=null,0},decodeWholeSamples:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e.sourceChannel=t,t<0||t>=e.sourceList.length)return-1;if(null!=e.sourceList[t]&&null!=e.sourceList[t]&&e.sourceList[t]||(e.sourceList[t]=e.audioCtx.createBufferSource(),e.sourceList[t].onended=function(){}),0==e.sampleQueue.length)return-2;for(var i=null,n=null,a=0;a<e.sampleQueue.length;a++){n=e.sampleQueue.shift();var s=null;if(s=e.options.appendType==r.APPEND_TYPE_STREAM?n:n.data,null==i)i=new Uint8Array(s);else{var o=new Uint8Array(s.length+i.length);o.set(i,0),o.set(s,i.length),i=o}if(e.sampleQueue.length<=0)break;n=null}var u=i;if(null==u||u.length<1)return e.sourceList[t].connect(e.gainNode),e.sourceList[t].start(),e.sourceList[t].stop(),1;var l=u.buffer;try{var h=e.audioCtx.createBuffer(1,l.byteLength,e.options.sampleRate);h.copyToChannel(l,0),e.sourceList[t].buffer=h,e.sourceList[t].connect(e.gainNode),e.sourceList[t].start(),e.sourceList[t].startState=!0}catch(e){return-3}return 0},play:function(){if(0==e.startStatus){e.startStatus=!0;-2==(e.options.playMode==r.AUDIO_MODE_ONCE?e.decodeWholeSamples(0):e.swapSource(0,1))&&e.pause()}},pause:function(){e.startStatus=!1;for(var t=0;t<e.sourceList.length;t++)if(void 0!==e.sourceList[t]&&null!==e.sourceList[t]){e.sourceList[t],e.gainNode;try{void 0!==e.sourceList[t].buffer&&null!==e.sourceList[t].buffer&&(e.sourceList[t].stop(),e.sourceList[t].disconnect(e.gainNode)),e.sourceList[t]=null}catch(e){console.error("audio pause error ",e)}}},stop:function(){e.pause(),e.cleanQueue(),e.nextBuffer=null,e.sourceChannel=-1},cleanQueue:function(){e.sampleQueue.length=0;for(var t=0;t<e.sourceList.length;t++)try{void 0!==e.sourceList[t].buffer&&null!==e.sourceList[t].buffer&&(e.sourceList[t].stop(),e.sourceList[t].disconnect(e.gainNode)),e.sourceList[t]=null}catch(e){}}};return e.sourceList.push(e.audioCtx.createBufferSource()),e.sourceList.push(e.audioCtx.createBufferSource()),e.sourceList[0].onended=function(){e.swapSource(0,1)},e.sourceList[1].onended=function(){e.swapSource(1,0)},e.gainNode=e.audioCtx.createGain(),e.gainNode.gain.value=e.voice,e.gainNode.connect(e.audioCtx.destination),e.options,e.runNextBuffer(),e}},{"../consts":52,"./av-common":56}],54:[function(e,t,i){"use strict";var n=window.AudioContext||window.webkitAudioContext,r=e("../consts"),a=e("./av-common");t.exports=function(e){var t={options:{sampleRate:e.sampleRate||r.DEFAULT_SAMPLERATE,appendType:e.appendType||r.APPEND_TYPE_STREAM,playMode:e.playMode||r.AUDIO_MODE_SWAP},sourceChannel:-1,audioCtx:new n({latencyHint:"interactive",sampleRate:e.sampleRate}),gainNode:null,sourceList:[],startStatus:!1,sampleQueue:[],nextBuffer:null,playTimestamp:0,playStartTime:0,durationMs:-1,isLIVE:!1,voice:1,onLoadCache:null,resetStartParam:function(){t.playTimestamp=0,t.playStartTime=0},setOnLoadCache:function(e){t.onLoadCache=e},setDurationMs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;t.durationMs=e},setVoice:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;t.voice=e,t.gainNode.gain.value=e},getAlignVPTS:function(){return t.playTimestamp+(a.GetMsTime()-t.playStartTime)/1e3},swapSource:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(0==t.startStatus)return null;if(e<0||e>=t.sourceList.length)return null;if(i<0||i>=t.sourceList.length)return null;try{t.sourceChannel===e&&null!==t.sourceList[e]&&(t.sourceList[e].disconnect(t.gainNode),t.sourceList[e]=null)}catch(t){console.error("[DEFINE ERROR] audioModule disconnect source Index:"+e+" error happened!",t)}t.sourceChannel=i;var n=t.decodeSample(i,e);-2==n&&t.isLIVE&&(t.getAlignVPTS()>=t.durationMs/1e3-.04?t.pause():null!==t.onLoadCache&&t.onLoadCache())},addSample:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!(null==e||!e||null==e)&&(0==t.sampleQueue.length&&(t.seekPos=e.pts),t.sampleQueue.push(e),!0)},runNextBuffer:function(){window.setInterval((function(){if(!(null!=t.nextBuffer||t.sampleQueue.length<r.DEFAULT_CONSU_SAMPLE_LEN)){t.nextBuffer={data:null,pts:-1};for(var e=null,i=0;i<r.DEFAULT_CONSU_SAMPLE_LEN;i++){e=t.sampleQueue.shift();var n=null;if(n=t.options.appendType==r.APPEND_TYPE_STREAM?e:e.data,t.nextBuffer.pts<0&&(t.nextBuffer.pts=e.pts),null==t.nextBuffer.data)t.nextBuffer.data=new Uint8Array(n);else{var a=new Uint8Array(n.length+t.nextBuffer.data.length);a.set(t.nextBuffer.data,0),a.set(n,t.nextBuffer.data.length),t.nextBuffer.data=a}if(t.sampleQueue.length<=0)break;e=null}}}),10)},decodeSample:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;if(e<0||e>=t.sourceList.length)return-1;if(null!=t.sourceList[e]&&null!=t.sourceList[e]&&t.sourceList[e]||(t.sourceList[e]=t.audioCtx.createBufferSource(),t.sourceList[e].onended=function(){t.swapSource(e,i)}),0==t.sampleQueue.length)return t.isLIVE?(t.sourceList[e].connect(t.gainNode),t.sourceList[e].start(),t.sourceList[e].onended=function(){t.swapSource(e,i)},t.sourceList[e].stop(),0):-2;if(t.sourceList[e].buffer)return t.swapSource(e,i),0;if(null==t.nextBuffer||t.nextBuffer.data.length<1)return t.sourceList[e].connect(t.gainNode),t.sourceList[e].start(),t.sourceList[e].startState=!0,t.sourceList[e].stop(),1;var n=t.nextBuffer.data.buffer;t.playTimestamp=t.nextBuffer.pts,t.playStartTime=a.GetMsTime();try{t.audioCtx.decodeAudioData(n,(function(i){null!==t.sourceList[e]&&(t.sourceList[e].buffer=i,t.sourceList[e].connect(t.gainNode),t.sourceList[e].start(),t.sourceList[e].startState=!0)}),(function(e){}))}catch(e){return t.nextBuffer=null,-3}return t.nextBuffer=null,0},decodeWholeSamples:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(t.sourceChannel=e,e<0||e>=t.sourceList.length)return-1;if(null!=t.sourceList[e]&&null!=t.sourceList[e]&&t.sourceList[e]||(t.sourceList[e]=t.audioCtx.createBufferSource(),t.sourceList[e].onended=function(){}),0==t.sampleQueue.length)return-2;for(var i=null,n=null,a=0;a<t.sampleQueue.length;a++){n=t.sampleQueue.shift();var s=null;if(s=t.options.appendType==r.APPEND_TYPE_STREAM?n:n.data,null==i)i=new Uint8Array(s);else{var o=new Uint8Array(s.length+i.length);o.set(i,0),o.set(s,i.length),i=o}if(t.sampleQueue.length<=0)break;n=null}var u=i;if(null==u||u.length<1)return t.sourceList[e].connect(t.gainNode),t.sourceList[e].start(),t.sourceList[e].stop(),1;var l=u.buffer;try{t.audioCtx.decodeAudioData(l,(function(i){t.sourceList[e].state,t.sourceList[e].buffer=i,t.sourceList[e].connect(t.gainNode),t.sourceList[e].start(),t.sourceList[e].startState=!0,t.sourceList[e].state}),(function(e){e.err}))}catch(e){return-3}return 0},play:function(){if(0==t.startStatus){t.startStatus=!0;-2==(t.options.playMode==r.AUDIO_MODE_ONCE?t.decodeWholeSamples(0):t.swapSource(0,1))&&t.pause()}},pause:function(){t.startStatus=!1;for(var e=0;e<t.sourceList.length;e++)if(void 0!==t.sourceList[e]&&null!==t.sourceList[e]){t.sourceList[e],t.gainNode;try{void 0!==t.sourceList[e].buffer&&null!==t.sourceList[e].buffer&&(t.sourceList[e].stop(),t.sourceList[e].disconnect(t.gainNode)),t.sourceList[e]=null}catch(e){console.error("audio pause error ",e)}}},stop:function(){t.pause(),t.cleanQueue(),t.nextBuffer=null,t.sourceChannel=-1},cleanQueue:function(){t.sampleQueue.length=0;for(var e=0;e<t.sourceList.length;e++)try{void 0!==t.sourceList[e].buffer&&null!==t.sourceList[e].buffer&&(t.sourceList[e].stop(),t.sourceList[e].disconnect(t.gainNode)),t.sourceList[e]=null}catch(e){}}};return t.sourceList.push(t.audioCtx.createBufferSource()),t.sourceList.push(t.audioCtx.createBufferSource()),t.sourceList[0].onended=function(){t.swapSource(0,1)},t.sourceList[1].onended=function(){t.swapSource(1,0)},t.gainNode=t.audioCtx.createGain(),t.gainNode.gain.value=t.voice,t.gainNode.connect(t.audioCtx.destination),t.options,t.runNextBuffer(),t}},{"../consts":52,"./av-common":56}],55:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=window.AudioContext||window.webkitAudioContext,a=(e("../consts"),e("./av-common")),s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._sample_rate=44100,this._seg_dur=.1,this._channels=1,this._swapStartPlay=!0,this.playStartTime=-1,this.playTimestamp=0,this._now_seg_dur=-1,this._push_start_idx=0,this._playInterval=null,this._pcm_array_buf=null,this._pcm_array_frame=[],this._once_pop_len=parseInt(this._sample_rate*this._seg_dur),this._active_node=null,this._ctx=new r,this._gain=this._ctx.createGain(),this._gain.gain.value=1,this._gain.connect(this._ctx.destination)}var t,i,s;return t=e,(i=[{key:"setVoice",value:function(e){this._gain.gain.value=e}},{key:"pushBufferFrame",value:function(e,t){}},{key:"pushBuffer",value:function(e){var t=e.buffer,i=null,n=t.byteLength%4;if(0!==n){var r=new Uint8Array(t.byteLength+n);r.set(new Uint8Array(t),0),i=new Float32Array(r.buffer)}else i=new Float32Array(t);var a=null;if(this._channels>=2){var s=i.length/2;a=new Float32Array(s);for(var o=0,u=0;u<i.length;u+=2)a[o]=i[u],o++}else a=new Float32Array(i);if(null===this._pcm_array_buf)this._pcm_array_buf=new Float32Array(a);else{var l=new Float32Array(this._pcm_array_buf.length+a.length);l.set(this._pcm_array_buf,0),l.set(a,this._pcm_array_buf.length),this._pcm_array_buf=l}this._pcm_array_buf.length}},{key:"readingLoopWithF32",value:function(){if(!(null!==this._pcm_array_buf&&this._pcm_array_buf.length>this._push_start_idx))return-1;this.playStartTime<0&&(this.playStartTime=a.GetMsTime(),this.playTimestamp=a.GetMsTime()),this._swapStartPlay=!1;var e=this._push_start_idx+this._once_pop_len;e>this._pcm_array_buf.length&&(e=this._pcm_array_buf.length);var t=this._pcm_array_buf.slice(this._push_start_idx,e);this._push_start_idx+=t.length,this._now_seg_dur=1*t.length/this._sample_rate*1e3,t.length,this._sample_rate,this._now_seg_dur;var i=this._ctx.createBuffer(1,t.length,this._sample_rate);return t.length,new Date,i.copyToChannel(t,0),this._active_node=this._ctx.createBufferSource(),this._active_node.buffer=i,this._active_node.connect(this._gain),this.playStartTime=a.GetMsTime(),this._active_node.start(0),this.playTimestamp+=this._now_seg_dur,0}},{key:"getAlignVPTS",value:function(){return this.playTimestamp}},{key:"pause",value:function(){null!==this._playInterval&&(window.clearInterval(this._playInterval),this._playInterval=null)}},{key:"play",value:function(){var e=this;this._playInterval=window.setInterval((function(){e.readingLoopWithF32()}),10)}}])&&n(t.prototype,i),s&&n(t,s),e}();i.AudioPcmPlayer=s},{"../consts":52,"./av-common":56}],56:[function(e,t,i){"use strict";var n=e("../consts"),r=[{format:"mp4",value:"mp4",core:n.PLAYER_CORE_TYPE_CNATIVE},{format:"mov",value:"mp4",core:n.PLAYER_CORE_TYPE_CNATIVE},{format:"mkv",value:"mp4",core:n.PLAYER_CORE_TYPE_CNATIVE},{format:"flv",value:"flv",core:n.PLAYER_CORE_TYPE_CNATIVE},{format:"m3u8",value:"hls",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"m3u",value:"hls",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"ts",value:"ts",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"ps",value:"ts",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"mpegts",value:"ts",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"hevc",value:"raw265",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"h265",value:"raw265",core:n.PLAYER_CORE_TYPE_DEFAULT},{format:"265",value:"raw265",core:n.PLAYER_CORE_TYPE_DEFAULT}],a=[{format:n.URI_PROTOCOL_HTTP,value:n.URI_PROTOCOL_HTTP_DESC},{format:n.URI_PROTOCOL_WEBSOCKET,value:n.URI_PROTOCOL_WEBSOCKET_DESC}];t.exports={frameDataAlignCrop:function(e,t,i,n,r,a,s,o){if(0==e-n)return[a,s,o];for(var u=n*r,l=u/4,h=new Uint8Array(u),d=new Uint8Array(l),c=new Uint8Array(l),f=n,p=n/2,m=0;m<r;m++)h.set(a.subarray(m*e,f),m*r);for(var _=0;_<r/2;_++)d.set(s.subarray(_*t,p),_*r/2);for(var g=0;g<r/2;g++)c.set(o.subarray(g*i,p),g*r/2);return[h,d,c]},GetUriFormat:function(e){if(null!=e)for(var t=0;t<r.length;t++){var i=r[t],n="."+i.format;if(e.search(n)>=0)return i.value}return r[0].value},GetFormatPlayCore:function(e){if(null!=e)for(var t=0;t<r.length;t++){var i=r[t];if(i.value===e)return i.core}return r[0].core},GetUriProtocol:function(e){if(null!=e)for(var t=0;t<a.length;t++){var i=a[t],n=i.format+"[s]{0,}://";if(e.search(n)>=0)return i.value}return a[0].value},GetMsTime:function(){return(new Date).getTime()},GetScriptPath:function(e){var t=e.toString(),i=t.match(/^\s*function\s*\(\s*\)\s*\{(([\s\S](?!\}$))*[\s\S])/),n=[i[1]];return window.URL.createObjectURL(new Blob(n,{type:"text/javascript"}))},BrowserJudge:function(){var e=window.document,t=window.navigator.userAgent.toLowerCase(),i=e.documentMode,n=window.chrome||!1,r={agent:t,isIE:/msie/.test(t),isGecko:t.indexOf("gecko")>0&&t.indexOf("like gecko")<0,isWebkit:t.indexOf("webkit")>0,isStrict:"CSS1Compat"===e.compatMode,supportSubTitle:function(){return"track"in e.createElement("track")},supportScope:function(){return"scoped"in e.createElement("style")},ieVersion:function(){try{return t.match(/msie ([\d.]+)/)[1]||0}catch(e){return i}},operaVersion:function(){try{if(window.opera)return t.match(/opera.([\d.]+)/)[1];if(t.indexOf("opr")>0)return t.match(/opr\/([\d.]+)/)[1]}catch(e){return 0}},versionFilter:function(){if(1===arguments.length&&"string"==typeof arguments[0]){var e=arguments[0],t=e.indexOf(".");if(t>0){var i=e.indexOf(".",t+1);if(-1!==i)return e.substr(0,i)}return e}return 1===arguments.length?arguments[0]:0}};try{r.type=r.isIE?"IE":window.opera||t.indexOf("opr")>0?"Opera":t.indexOf("chrome")>0?"Chrome":t.indexOf("safari")>0||window.openDatabase?"Safari":t.indexOf("firefox")>0?"Firefox":"unknow",r.version="IE"===r.type?r.ieVersion():"Firefox"===r.type?t.match(/firefox\/([\d.]+)/)[1]:"Chrome"===r.type?t.match(/chrome\/([\d.]+)/)[1]:"Opera"===r.type?r.operaVersion():"Safari"===r.type?t.match(/version\/([\d.]+)/)[1]:"0",r.shell=function(){if(t.indexOf("maxthon")>0)return r.version=t.match(/maxthon\/([\d.]+)/)[1]||r.version,"傲游浏览器";if(t.indexOf("qqbrowser")>0)return r.version=t.match(/qqbrowser\/([\d.]+)/)[1]||r.version,"QQ浏览器";if(t.indexOf("se 2.x")>0)return"搜狗浏览器";if(n&&"Opera"!==r.type){var e=window.external,i=window.clientInformation.languages;if(e&&"LiebaoGetVersion"in e)return"猎豹浏览器";if(t.indexOf("bidubrowser")>0)return r.version=t.match(/bidubrowser\/([\d.]+)/)[1]||t.match(/chrome\/([\d.]+)/)[1],"百度浏览器";if(r.supportSubTitle()&&void 0===i){var a=Object.keys(n.webstore).length;window;return a>1?"360极速浏览器":"360安全浏览器"}return"Chrome"}return r.type},r.name=r.shell(),r.version=r.versionFilter(r.version)}catch(e){}return[r.type,r.version]},ParseGetMediaURL:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"http";if("http"!==t&&"ws"!==t&&"wss"!==t&&(e.indexOf("ws")>=0||e.indexOf("wss")>=0)&&(t="ws"),"ws"===t||"wss"===t)return e;var i=e;if(e.indexOf(t)>=0)i=e;else if("/"===e[0])i="/"===e[1]?t+":"+e:window.location.origin+e;else if(":"===e[0])i=t+e;else{var n=window.location.href.split("/");i=window.location.href.replace(n[n.length-1],e)}return i},IsSupport265Mse:function(){return MediaSource.isTypeSupported('video/mp4;codecs=hvc1.1.1.L63.B0"')}}},{"../consts":52}],57:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e("../demuxer/bufferFrame"),e("../demuxer/buffer"),e("./cache"),e("./cacheYuv");var r=e("../render-engine/webgl-420p"),a=e("./av-common"),s=(e("./audio-native-core"),e("./audio-core"),e("./audio-core-pcm")),o=e("../consts"),u=(e("../version"),function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=this;this.config={width:t.width||o.DEFAULT_WIDTH,height:t.height||o.DEFAULT_HEIGHT,fps:t.fps||o.DEFAULT_FPS,sampleRate:t.sampleRate||o.DEFAULT_SAMPLERATE,playerId:t.playerId||o.DEFAILT_WEBGL_PLAY_ID,token:t.token||null,probeSize:t.probeSize||4096,ignoreAudio:t.ignoreAudio||0,autoPlay:t.autoPlay||!1},this.config.probeSize,this.config.ignoreAudio,this.mediaInfo={noFPS:!1,fps:o.DEFAULT_FPS,width:this.config.width,height:this.config.height,sampleRate:this.config.sampleRate,size:{width:-1,height:-1},audioNone:!1},this.duration=-1,this.vCodecID=o.V_CODEC_NAME_HEVC,this.corePtr=null,this.AVGetInterval=null,this.readyShowDone=!1,this.readyKeyFrame=!1,this.cache_status=!1,this.download_length=0,this.AVGLObj=null,this.canvasBox=document.querySelector("#"+this.config.playerId),this.canvasBox.style.overflow="hidden",this.CanvasObj=null,this.CanvasObj=document.createElement("canvas"),this.CanvasObj.style.width=this.canvasBox.clientWidth+"px",this.CanvasObj.style.height=this.canvasBox.clientHeight+"px",this.CanvasObj.style.top="0px",this.CanvasObj.style.left="0px",this.canvasBox.appendChild(this.CanvasObj),this.audioWAudio=null,this.audioVoice=1,this.muted=this.config.autoPlay,!0===this.config.autoPlay&&this.config.ignoreAudio<1&&(window.onclick=document.body.onclick=function(e){i.muted=!1,i._reinitAudioModule(i.mediaInfo.sampleRate),!0===i.isPlayingState()&&(i.pause(),i.play()),window.onclick=document.body.onclick=null}),this.frameTime=1e3/this.config.fps,this.NaluBuf=[],this.YuvBuf=[],this.getPackageTimeMS=0,this.workerFetch=null,this.playInterval=null,this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null,this.totalLen=0,this.pushPkg=0,this.showScreen=!1,this.onProbeFinish=null,this.onLoadCache=null,this.onLoadCacheFinshed=null,this.onRender=null,this.onReadyShowDone=null,this.onError=null,this.onPlayState=null,this.corePtr=Module.cwrap("AVSniffHttpG711Init","number",["string","string"])(this.config.token,"0.0.0"),this.corePtr}var t,i,u;return t=e,(i=[{key:"_workerFetch_onmessage",value:function(e,t){var i=e.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"startok":t.getPackageTimeMS=a.GetMsTime(),void 0!==t.AVGetInterval&&null!==t.AVGetInterval||(t.AVGetInterval=window.setInterval((function(){Module.cwrap("getG711BufferLengthApi","number",["number"])(t.corePtr)<=t.config.probeSize&&t.getPackageTimeMS>0&&a.GetMsTime()-t.getPackageTimeMS>=o.FETCH_HTTP_FLV_TIMEOUT_MS&&(t.getPackageTimeMS=a.GetMsTime(),t.workerFetch.postMessage({cmd:"retry",data:null,msg:"retry"}))}),5));break;case"fetch-chunk":var n=i.data;t.download_length+=n.length,setTimeout((function(){var e=Module._malloc(n.length);Module.HEAP8.set(n,e),Module.cwrap("pushSniffG711FlvData","number",["number","number","number","number"])(t.corePtr,e,n.length,t.config.probeSize),Module._free(e),e=null}),0),t.totalLen+=n.length,n.length>0&&(t.getPackageTimeMS=a.GetMsTime()),t.pushPkg++;break;case"close":t.AVGetInterval&&clearInterval(t.AVGetInterval),t.AVGetInterval=null;case"fetch-fin":break;case"fetch-error":t.onError&&t.onError(i.data)}}},{key:"_checkDisplaySize",value:function(e,t,i){var n=t-e,r=this.config.width+Math.ceil(n/2),a=t/this.config.width>i/this.config.height,s=(r/t).toFixed(2),o=(this.config.height/i).toFixed(2),u=a?s:o,l=this.config.fixed,h=l?r:parseInt(t*u),d=l?this.config.height:parseInt(i*u);if(this.CanvasObj.offsetWidth!=h||this.CanvasObj.offsetHeight!=d){var c=parseInt((this.canvasBox.offsetHeight-d)/2),f=parseInt((this.canvasBox.offsetWidth-h)/2);c=c<0?0:c,f=f<0?0:f,this.CanvasObj.style.marginTop=c+"px",this.CanvasObj.style.marginLeft=f+"px",this.CanvasObj.style.width=h+"px",this.CanvasObj.style.height=d+"px"}return this.isCheckDisplay=!0,[h,d]}},{key:"_ptsFixed2",value:function(e){return Math.ceil(100*e)/100}},{key:"_reinitAudioModule",value:function(){void 0!==this.audioWAudio&&null!==this.audioWAudio&&(this.audioWAudio.stop(),this.audioWAudio=null),this.audioWAudio=s()}},{key:"_callbackProbe",value:function(e,t,i,n,r,a,s,u,l){for(var h=Module.HEAPU8.subarray(l,l+10),d=0;d<h.length;d++)String.fromCharCode(h[d]);var c=n;n>100&&(c=o.DEFAULT_FPS,this.mediaInfo.noFPS=!0),this.vCodecID=u,this.config.fps=c,this.mediaInfo.fps=c,this.mediaInfo.size.width=t,this.mediaInfo.size.height=i,this.frameTime=Math.floor(1e3/(this.mediaInfo.fps+2)),this.CanvasObj.width==t&&this.CanvasObj.height==i||(this.CanvasObj.width=t,this.CanvasObj.height=i,this.isCheckDisplay)||this._checkDisplaySize(t,t,i),r>=0&&!1===this.mediaInfo.noFPS?(this.config.sampleRate=a,this.mediaInfo.sampleRate=a,!1===this.muted&&this._reinitAudioModule(this.mediaInfo.sampleRate)):this.mediaInfo.audioNone=!0,this.onProbeFinish&&this.onProbeFinish()}},{key:"_callbackYUV",value:function(e,t,i,n,r,a,s,o,u,l){var h=this,d=Module.HEAPU8.subarray(e,e+n*o),c=new Uint8Array(d),f=Module.HEAPU8.subarray(t,t+r*o/2),p=new Uint8Array(f),m=Module.HEAPU8.subarray(i,i+a*o/2),_={bufY:c,bufU:p,bufV:new Uint8Array(m),line_y:n,h:o,pts:u};this.YuvBuf.push(_),this.checkCacheState(),Module._free(d),d=null,Module._free(f),f=null,Module._free(m),m=null,!1===this.readyShowDone&&!0===this.playYUV()&&(this.readyShowDone=!0,this.onReadyShowDone&&this.onReadyShowDone(),this.audioWAudio||!0!==this.config.autoPlay||(this.play(),setTimeout((function(){h.isPlayingState()}),3e3)))}},{key:"_callbackNALU",value:function(e,t,i,n,r,a,s){if(!1===this.readyKeyFrame){if(i<=0)return;this.readyKeyFrame=!0}var o=Module.HEAPU8.subarray(e,e+t),u=new Uint8Array(o);this.NaluBuf.push({bufData:u,len:t,isKey:i,w:n,h:r,pts:1e3*a,dts:1e3*s}),Module._free(o),o=null}},{key:"_callbackPCM",value:function(e,t,i,n){var r=Module.HEAPU8.subarray(e,e+t),a=new Uint8Array(r).buffer,s=this._ptsFixed2(i),o=null,u=a.byteLength%4;if(0!==u){var l=new Uint8Array(a.byteLength+u);l.set(new Uint8Array(a),0),o=new Float32Array(l.buffer)}else o=new Float32Array(a);var h={pts:s,data:o};this.audioWAudio.addSample(h),this.checkCacheState()}},{key:"_decode",value:function(){var e=this;setTimeout((function(){null!==e.workerFetch&&(Module.cwrap("decodeG711Frame","number",["number"])(e.corePtr),e._decode())}),1)}},{key:"setScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showScreen=e}},{key:"checkCacheState",value:function(){var e=this.YuvBuf.length>=25&&(!0===this.mediaInfo.audioNone||this.audioWAudio&&this.audioWAudio.sampleQueue.length>=50);return!1===this.cache_status&&e&&(this.playInterval&&this.audioWAudio&&this.audioWAudio.play(),this.onLoadCacheFinshed&&this.onLoadCacheFinshed(),this.cache_status=!0),e}},{key:"setVoice",value:function(e){this.audioVoice=e,this.audioWAudio&&this.audioWAudio.setVoice(e)}},{key:"_removeBindFuncPtr",value:function(){null!==this._ptr_probeCallback&&Module.removeFunction(this._ptr_probeCallback),null!==this._ptr_frameCallback&&Module.removeFunction(this._ptr_frameCallback),null!==this._ptr_naluCallback&&Module.removeFunction(this._ptr_naluCallback),null!==this._ptr_sampleCallback&&Module.removeFunction(this._ptr_sampleCallback),null!==this._ptr_aacCallback&&Module.removeFunction(this._ptr_aacCallback),this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null}},{key:"release",value:function(){return this.pause(),this.NaluBuf.length=0,this.YuvBuf.length=0,void 0!==this.workerFetch&&null!==this.workerFetch&&this.workerFetch.postMessage({cmd:"stop",data:"stop",msg:"stop"}),this.workerFetch=null,this.AVGetInterval&&clearInterval(this.AVGetInterval),this.AVGetInterval=null,this._removeBindFuncPtr(),void 0!==this.corePtr&&null!==this.corePtr&&Module.cwrap("releaseG711","number",["number"])(this.corePtr),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null,this.audioWAudio&&this.audioWAudio.stop(),this.audioWAudio=null,void 0!==this.AVGLObj&&null!==this.AVGLObj&&(r.releaseContext(this.AVGLObj),this.AVGLObj=null),this.CanvasObj&&this.CanvasObj.remove(),this.CanvasObj=null,window.onclick=document.body.onclick=null,delete window.g_players[this.corePtr],0}},{key:"isPlayingState",value:function(){return null!==this.playInterval&&void 0!==this.playInterval}},{key:"pause",value:function(){this.audioWAudio&&this.audioWAudio.pause(),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null,this.onPlayState&&this.onPlayState(this.isPlayingState())}},{key:"playYUV",value:function(){if(this.YuvBuf.length>0){var e=this.YuvBuf.shift();return e.pts,this.onRender&&this.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),r.renderFrame(this.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h),!0}return!1}},{key:"play",value:function(){var e=this;if(!1===this.checkCacheState())return this.onLoadCache&&this.onLoadCache(),setTimeout((function(){e.play()}),100),!1;var t=1*e.frameTime;if(void 0===this.playInterval||null===this.playInterval){var i=0,n=0,s=0;!1===this.mediaInfo.audioNone&&this.audioWAudio&&!1===this.mediaInfo.noFPS?(this.playInterval=setInterval((function(){if(n=a.GetMsTime(),e.cache_status){if(n-i>=e.frameTime-s){var o=e.YuvBuf.shift();if(null!=o&&null!==o){o.pts;var u=0;null!==e.audioWAudio&&void 0!==e.audioWAudio?(u=1e3*(o.pts-e.audioWAudio.getAlignVPTS()),s=u<0&&-1*u<=t||u>0&&u<=t||0===u||u>0&&u>t?a.GetMsTime()-n+1:e.frameTime):s=a.GetMsTime()-n+1,e.showScreen&&e.onRender&&e.onRender(o.line_y,o.h,o.bufY,o.bufU,o.bufV),o.pts,r.renderFrame(e.AVGLObj,o.bufY,o.bufU,o.bufV,o.line_y,o.h)}e.YuvBuf.length<=0&&(e.cache_status=!1,e.onLoadCache&&e.onLoadCache(),e.audioWAudio&&e.audioWAudio.pause()),i=n}}else s=e.frameTime}),1),this.audioWAudio&&this.audioWAudio.play()):this.playInterval=setInterval((function(){var t=e.YuvBuf.shift();null!=t&&null!==t&&(t.pts,e.showScreen&&e.onRender&&e.onRender(t.line_y,t.h,t.bufY,t.bufU,t.bufV),r.renderFrame(e.AVGLObj,t.bufY,t.bufU,t.bufV,t.line_y,t.h)),e.YuvBuf.length<=0&&(e.cache_status=!1)}),e.frameTime)}this.onPlayState&&this.onPlayState(this.isPlayingState())}},{key:"start",value:function(e){var t=this;this.workerFetch=new Worker(a.GetScriptPath((function(){var e=null,t=new AbortController,i=t.signal,n=(self,function(e){var t=!1;t||(t=!0,fetch(e,{signal:i}).then((function(e){return function e(t){return t.read().then((function(i){if(!i.done){var n=i.value;return self.postMessage({cmd:"fetch-chunk",data:n,msg:"fetch-chunk"}),e(t)}self.postMessage({cmd:"fetch-fin",data:null,msg:"fetch-fin"})}))}(e.body.getReader())})).catch((function(e){if(!e.toString().includes("user aborted")){var t=" httplive request error:"+e+" start to retry";console.error(t),self.postMessage({cmd:"fetch-error",data:t,msg:"fetch-error"})}})))});self.onmessage=function(r){var a=r.data;switch(void 0===a.cmd||null===a.cmd?"":a.cmd){case"start":e=a.data,n(e),self.postMessage({cmd:"startok",data:"WORKER STARTED",msg:"startok"});break;case"stop":t.abort(),self.close(),self.postMessage({cmd:"close",data:"close",msg:"close"});break;case"retry":t.abort(),t=null,i=null,t=new AbortController,i=t.signal,setTimeout((function(){n(e)}),3e3)}}}))),this.workerFetch.onmessage=function(e){t._workerFetch_onmessage(e,t)},this.workerFetch,this._ptr_probeCallback=Module.addFunction(this._callbackProbe.bind(this)),this._ptr_yuvCallback=Module.addFunction(this._callbackYUV.bind(this)),this._ptr_sampleCallback=Module.addFunction(this._callbackPCM.bind(this)),Module.cwrap("initializeSniffG711Module","number",["number","number","number","number","number","number"])(this.corePtr,this._ptr_probeCallback,this._ptr_yuvCallback,this._ptr_sampleCallback,0,1),this.AVGLObj=r.setupCanvas(this.CanvasObj,{preserveDrawingBuffer:!1}),this.workerFetch.postMessage({cmd:"start",data:e,msg:"start"}),0===o.H265WEBJS_COMPILE_MULTI_THREAD_SHAREDBUFFER&&this._decode()}}])&&n(t.prototype,i),u&&n(t,u),e}());i.CHttpG711Core=u},{"../consts":52,"../demuxer/buffer":66,"../demuxer/bufferFrame":67,"../render-engine/webgl-420p":81,"../version":84,"./audio-core":54,"./audio-core-pcm":53,"./audio-native-core":55,"./av-common":56,"./cache":61,"./cacheYuv":62}],58:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e("../demuxer/bufferFrame"),e("../demuxer/buffer"),e("./cache"),e("./cacheYuv");var r=e("../render-engine/webgl-420p"),a=e("./av-common"),s=(e("./audio-native-core"),e("./audio-core")),o=e("../consts"),u=(e("../version"),function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var i=this;this.config={width:t.width||o.DEFAULT_WIDTH,height:t.height||o.DEFAULT_HEIGHT,fps:t.fps||o.DEFAULT_FPS,sampleRate:t.sampleRate||o.DEFAULT_SAMPLERATE,playerId:t.playerId||o.DEFAILT_WEBGL_PLAY_ID,token:t.token||null,probeSize:t.probeSize||4096,ignoreAudio:t.ignoreAudio||0,autoPlay:t.autoPlay||!1},this.config,this.config.probeSize,this.config.ignoreAudio,this.mediaInfo={noFPS:!1,fps:o.DEFAULT_FPS,width:this.config.width,height:this.config.height,sampleRate:this.config.sampleRate,size:{width:-1,height:-1},audioNone:!1},this.duration=-1,this.vCodecID=o.V_CODEC_NAME_HEVC,this.corePtr=null,this.AVGetInterval=null,this.AVDecodeInterval=null,this.decVFrameInterval=null,this.readyShowDone=!1,this.readyKeyFrame=!1,this.cache_status=!1,this.download_length=0,this.AVGLObj=null,this.canvasBox=document.querySelector("#"+this.config.playerId),this.canvasBox.style.overflow="hidden",this.CanvasObj=null,this.CanvasObj=document.createElement("canvas"),this.CanvasObj.style.width=this.canvasBox.clientWidth+"px",this.CanvasObj.style.height=this.canvasBox.clientHeight+"px",this.CanvasObj.style.top="0px",this.CanvasObj.style.left="0px",this.canvasBox.appendChild(this.CanvasObj),this.audioWAudio=null,this.audioVoice=1,this.isCacheV=o.CACHE_NO_LOADCACHE,this.muted=this.config.autoPlay,!0===this.config.autoPlay&&this.config.ignoreAudio<1&&(window.onclick=document.body.onclick=function(e){i.muted=!1,i._reinitAudioModule(i.mediaInfo.sampleRate),!0===i.isPlayingState()&&(i.pause(),i.play()),window.onclick=document.body.onclick=null}),this.frameTimeSec=1/this.config.fps,this.frameTime=1e3*this.frameTimeSec,this.NaluBuf=[],this.YuvBuf=[],this.getPackageTimeMS=0,this.workerFetch=null,this.playInterval=null,this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null,this.totalLen=0,this.pushPkg=0,this.showScreen=!1,this.onProbeFinish=null,this.onLoadCache=null,this.onLoadCacheFinshed=null,this.onRender=null,this.onReadyShowDone=null,this.onError=null,this.onPlayState=null,this.corePtr=Module.cwrap("AVSniffHttpFlvInit","number",["string","string"])(this.config.token,"0.0.0"),this.corePtr}var t,i,u;return t=e,(i=[{key:"_workerFetch_onmessage",value:function(e,t){var i=e.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"startok":t.getPackageTimeMS=a.GetMsTime(),void 0!==t.AVGetInterval&&null!==t.AVGetInterval||(t.AVGetInterval=window.setInterval((function(){Module.cwrap("getBufferLengthApi","number",["number"])(t.corePtr)>t.config.probeSize?(Module.cwrap("getSniffHttpFlvPkg","number",["number"])(t.corePtr),t.pushPkg-=1):t.getPackageTimeMS>0&&a.GetMsTime()-t.getPackageTimeMS>=o.FETCH_HTTP_FLV_TIMEOUT_MS&&(t.getPackageTimeMS=a.GetMsTime(),t.workerFetch.postMessage({cmd:"retry",data:null,msg:"retry"}))}),5));break;case"fetch-chunk":var n=i.data;t.download_length+=n.length,setTimeout((function(){var e=Module._malloc(n.length);Module.HEAP8.set(n,e),Module.cwrap("pushSniffHttpFlvData","number",["number","number","number","number"])(t.corePtr,e,n.length,t.config.probeSize),Module._free(e),e=null}),0),t.totalLen+=n.length,n.length>0&&(t.getPackageTimeMS=a.GetMsTime()),t.pushPkg++;break;case"close":t.AVGetInterval&&clearInterval(t.AVGetInterval),t.AVGetInterval=null;break;case"fetch-fin":break;case"fetch-error":t.onError&&t.onError(i.data)}}},{key:"_checkDisplaySize",value:function(e,t,i){var n=t-e,r=this.config.width+Math.ceil(n/2),a=t/this.config.width>i/this.config.height,s=(r/t).toFixed(2),o=(this.config.height/i).toFixed(2),u=a?s:o,l=this.config.fixed,h=l?r:parseInt(t*u),d=l?this.config.height:parseInt(i*u);if(this.CanvasObj.offsetWidth!=h||this.CanvasObj.offsetHeight!=d){var c=parseInt((this.canvasBox.offsetHeight-d)/2),f=parseInt((this.canvasBox.offsetWidth-h)/2);c=c<0?0:c,f=f<0?0:f,this.CanvasObj.style.marginTop=c+"px",this.CanvasObj.style.marginLeft=f+"px",this.CanvasObj.style.width=h+"px",this.CanvasObj.style.height=d+"px"}return this.isCheckDisplay=!0,[h,d]}},{key:"_ptsFixed2",value:function(e){return Math.ceil(100*e)/100}},{key:"_reinitAudioModule",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:44100;this.config.ignoreAudio>0||(void 0!==this.audioWAudio&&null!==this.audioWAudio&&(this.audioWAudio.stop(),this.audioWAudio=null),this.audioWAudio=s({sampleRate:e,appendType:o.APPEND_TYPE_FRAME}),this.audioWAudio.isLIVE=!0)}},{key:"_callbackProbe",value:function(e,t,i,n,r,a,s,u,l){var h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0;if(1!==h){for(var d=Module.HEAPU8.subarray(l,l+10),c=0;c<d.length;c++)String.fromCharCode(d[c]);var f=n;n>100&&(f=o.DEFAULT_FPS,this.mediaInfo.noFPS=!0),this.vCodecID=u,this.config.fps=f,this.mediaInfo.fps=f,this.mediaInfo.size.width=t,this.mediaInfo.size.height=i,this.frameTime=Math.floor(1e3/(this.mediaInfo.fps+5)),this.chaseFrame=0,this.CanvasObj.width==t&&this.CanvasObj.height==i||(this.CanvasObj.width=t,this.CanvasObj.height=i,this.isCheckDisplay)||this._checkDisplaySize(t,t,i),r>=0&&!1===this.mediaInfo.noFPS?(this.config.sampleRate=a,this.mediaInfo.sampleRate=a,this.config.ignoreAudio<1&&!1===this.muted&&this._reinitAudioModule(this.mediaInfo.sampleRate)):this.mediaInfo.audioNone=!0,this.onProbeFinish&&this.onProbeFinish()}else this.onProbeFinish&&this.onProbeFinish(h)}},{key:"_callbackYUV",value:function(e,t,i,n,r,a,s,o,u,l){var h=this,d=Module.HEAPU8.subarray(e,e+n*o),c=new Uint8Array(d),f=Module.HEAPU8.subarray(t,t+r*o/2),p=new Uint8Array(f),m=Module.HEAPU8.subarray(i,i+a*o/2),_={bufY:c,bufU:p,bufV:new Uint8Array(m),line_y:n,h:o,pts:u};this.YuvBuf.push(_),this.YuvBuf.length,this.checkCacheState(),Module._free(d),d=null,Module._free(f),f=null,Module._free(m),m=null,!1===this.readyShowDone&&!0===this.playYUV()&&(this.readyShowDone=!0,this.onReadyShowDone&&this.onReadyShowDone(),this.audioWAudio||!0!==this.config.autoPlay||(this.play(),setTimeout((function(){h.isPlayingState()}),3e3)))}},{key:"_callbackNALU",value:function(e,t,i,n,r,a,s){if(!1===this.readyKeyFrame){if(i<=0)return;this.readyKeyFrame=!0}var o=Module.HEAPU8.subarray(e,e+t),u=new Uint8Array(o);this.NaluBuf.push({bufData:u,len:t,isKey:i,w:n,h:r,pts:1e3*a,dts:1e3*s}),Module._free(o),o=null}},{key:"_callbackPCM",value:function(e){this.config.ignoreAudio}},{key:"_callbackAAC",value:function(e,t,i,n){if(!(this.config.ignoreAudio>0)){var r=this._ptsFixed2(n);if(this.audioWAudio&&!1===this.muted){var a=Module.HEAPU8.subarray(e,e+t),s={pts:r,data:new Uint8Array(a)};this.audioWAudio.addSample(s),this.checkCacheState()}}}},{key:"_decode",value:function(){var e=this;setTimeout((function(){if(null!==e.workerFetch){var t=e.NaluBuf.shift();if(null!=t){var i=Module._malloc(t.bufData.length);Module.HEAP8.set(t.bufData,i),Module.cwrap("decodeHttpFlvVideoFrame","number",["number","number","number","number","number"])(e.corePtr,i,t.bufData.length,t.pts,t.dts,0),Module._free(i),i=null}e._decode()}}),1)}},{key:"setScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showScreen=e}},{key:"checkCacheState",value:function(){this.YuvBuf.length,this.config.ignoreAudio>0||!0===this.mediaInfo.audioNone||this.audioWAudio&&this.audioWAudio.sampleQueue.length;var e=this.YuvBuf.length>=25&&(!0===this.muted||this.config.ignoreAudio>0||!0===this.mediaInfo.audioNone||this.audioWAudio&&this.audioWAudio.sampleQueue.length>=50);return!1===this.cache_status&&e&&(this.playInterval&&this.audioWAudio&&this.audioWAudio.play(),this.onLoadCacheFinshed&&this.onLoadCacheFinshed(),this.cache_status=!0),e}},{key:"setVoice",value:function(e){this.config.ignoreAudio<1&&(this.audioVoice=e,this.audioWAudio&&this.audioWAudio.setVoice(e))}},{key:"_removeBindFuncPtr",value:function(){null!==this._ptr_probeCallback&&Module.removeFunction(this._ptr_probeCallback),null!==this._ptr_frameCallback&&Module.removeFunction(this._ptr_frameCallback),null!==this._ptr_naluCallback&&Module.removeFunction(this._ptr_naluCallback),null!==this._ptr_sampleCallback&&Module.removeFunction(this._ptr_sampleCallback),null!==this._ptr_aacCallback&&Module.removeFunction(this._ptr_aacCallback),this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null}},{key:"release",value:function(){return this.pause(),this.NaluBuf.length=0,this.YuvBuf.length=0,void 0!==this.workerFetch&&null!==this.workerFetch&&this.workerFetch.postMessage({cmd:"stop",data:"stop",msg:"stop"}),this.workerFetch=null,this.AVGetInterval&&clearInterval(this.AVGetInterval),this.AVGetInterval=null,this._removeBindFuncPtr(),void 0!==this.corePtr&&null!==this.corePtr&&Module.cwrap("releaseHttpFLV","number",["number"])(this.corePtr),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null,this.audioWAudio&&this.audioWAudio.stop(),this.audioWAudio=null,void 0!==this.AVGLObj&&null!==this.AVGLObj&&(r.releaseContext(this.AVGLObj),this.AVGLObj=null),this.CanvasObj&&this.CanvasObj.remove(),this.CanvasObj=null,window.onclick=document.body.onclick=null,delete window.g_players[this.corePtr],0}},{key:"isPlayingState",value:function(){return null!==this.playInterval&&void 0!==this.playInterval}},{key:"pause",value:function(){this.config.ignoreAudio,this.audioWAudio,this.config.ignoreAudio<1&&this.audioWAudio&&this.audioWAudio.pause(),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null,this.chaseFrame=0,this.onPlayState&&this.onPlayState(this.isPlayingState())}},{key:"playYUV",value:function(){if(this.YuvBuf.length>0){var e=this.YuvBuf.shift();return this.onRender&&this.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),r.renderFrame(this.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h),!0}return!1}},{key:"play",value:function(){var e=this,t=this;if(this.chaseFrame=0,!1===this.checkCacheState())return this.onLoadCache&&this.onLoadCache(),setTimeout((function(){e.play()}),100),!1;var i=1*t.frameTime;if(void 0===this.playInterval||null===this.playInterval){var n=0,s=0,o=0;if(this.config.ignoreAudio<1&&!1===this.mediaInfo.audioNone&&null!=this.audioWAudio&&!1===this.mediaInfo.noFPS)this.config.ignoreAudio,this.mediaInfo.audioNone,this.audioWAudio,this.mediaInfo.noFPS,this.playInterval=setInterval((function(){if(s=a.GetMsTime(),t.cache_status){if(s-n>=t.frameTime-o){var e=t.YuvBuf.shift();if(e.pts,t.YuvBuf.length,null!=e&&null!==e){var u=0;null!==t.audioWAudio&&void 0!==t.audioWAudio?(u=1e3*(e.pts-t.audioWAudio.getAlignVPTS()),o=u<0&&-1*u<=i||u>0&&u<=i||0===u||u>0&&u>i?a.GetMsTime()-s+1:t.frameTime):o=a.GetMsTime()-s+1,t.showScreen&&t.onRender&&t.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),e.pts,r.renderFrame(t.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h)}(t.YuvBuf.length<=0||t.audioWAudio&&t.audioWAudio.sampleQueue.length<=0)&&(t.cache_status=!1,t.onLoadCache&&t.onLoadCache(),t.audioWAudio&&t.audioWAudio.pause()),n=s}}else o=t.frameTime}),1),this.audioWAudio&&this.audioWAudio.play();else{var u=-1;this.playInterval=setInterval((function(){if(s=a.GetMsTime(),t.cache_status){t.YuvBuf.length,t.frameTime,t.frameTime,t.chaseFrame;var e=-1;if(u>0&&(e=s-n,t.frameTime,t.chaseFrame<=0&&o>0&&(t.chaseFrame=Math.floor(o/t.frameTime),t.chaseFrame)),u<=0||e>=t.frameTime||t.chaseFrame>0){u=1;var i=t.YuvBuf.shift();i.pts,t.YuvBuf.length,null!=i&&null!==i&&(t.showScreen&&t.onRender&&t.onRender(i.line_y,i.h,i.bufY,i.bufU,i.bufV),i.pts,r.renderFrame(t.AVGLObj,i.bufY,i.bufU,i.bufV,i.line_y,i.h),o=a.GetMsTime()-s+1),t.YuvBuf.length<=0&&(t.cache_status=!1,t.onLoadCache&&t.onLoadCache()),n=s,t.chaseFrame>0&&(t.chaseFrame--,0===t.chaseFrame&&(o=t.frameTime))}}else o=t.frameTime,u=-1,t.chaseFrame=0,n=0,s=0,o=0}),1)}}this.onPlayState&&this.onPlayState(this.isPlayingState())}},{key:"start",value:function(e){var t=this;this.workerFetch=new Worker(a.GetScriptPath((function(){var e=null,t=new AbortController,i=t.signal,n=(self,function(e){var t=!1;t||(t=!0,fetch(e,{signal:i}).then((function(e){return function e(t){return t.read().then((function(i){if(!i.done){var n=i.value;return self.postMessage({cmd:"fetch-chunk",data:n,msg:"fetch-chunk"}),e(t)}self.postMessage({cmd:"fetch-fin",data:null,msg:"fetch-fin"})}))}(e.body.getReader())})).catch((function(e){if(!e.toString().includes("user aborted")){var t=" httplive request error:"+e+" start to retry";console.error(t),self.postMessage({cmd:"fetch-error",data:t,msg:"fetch-error"})}})))});self.onmessage=function(r){var a=r.data;switch(void 0===a.cmd||null===a.cmd?"":a.cmd){case"start":e=a.data,n(e),self.postMessage({cmd:"startok",data:"WORKER STARTED",msg:"startok"});break;case"stop":t.abort(),self.close(),self.postMessage({cmd:"close",data:"close",msg:"close"});break;case"retry":t.abort(),t=null,i=null,t=new AbortController,i=t.signal,setTimeout((function(){n(e)}),3e3)}}}))),this.workerFetch.onmessage=function(e){t._workerFetch_onmessage(e,t)},this.workerFetch,this._ptr_probeCallback=Module.addFunction(this._callbackProbe.bind(this)),this._ptr_yuvCallback=Module.addFunction(this._callbackYUV.bind(this)),this._ptr_naluCallback=Module.addFunction(this._callbackNALU.bind(this)),this._ptr_sampleCallback=Module.addFunction(this._callbackPCM.bind(this)),this._ptr_aacCallback=Module.addFunction(this._callbackAAC.bind(this)),Module.cwrap("initializeSniffHttpFlvModule","number",["number","number","number","number","number","number","number"])(this.corePtr,this._ptr_probeCallback,this._ptr_yuvCallback,this._ptr_naluCallback,this._ptr_sampleCallback,this._ptr_aacCallback,this.config.ignoreAudio),this.AVGLObj=r.setupCanvas(this.CanvasObj,{preserveDrawingBuffer:!1}),this.workerFetch.postMessage({cmd:"start",data:e,msg:"start"}),this._decode()}}])&&n(t.prototype,i),u&&n(t,u),e}());i.CHttpLiveCore=u},{"../consts":52,"../demuxer/buffer":66,"../demuxer/bufferFrame":67,"../render-engine/webgl-420p":81,"../version":84,"./audio-core":54,"./audio-native-core":55,"./av-common":56,"./cache":61,"./cacheYuv":62}],59:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=e("../demuxer/bufferFrame"),s=e("../demuxer/buffer"),o=(e("./cache"),e("./cacheYuv"),e("../render-engine/webgl-420p")),u=e("./av-common"),l=(e("./audio-native-core"),e("./audio-core")),h=e("../consts"),d=e("../version"),c=function e(t,i,n,a,s,o,u,l,h){r(this,e),this.pts=h,this.data_y=t,this.data_u=i,this.data_v=n,this.line1=a,this.line2=s,this.line3=o,this.width=u,this.height=l,this.byteAlignIncr=this.line1-this.width},f=function(){function e(t){r(this,e);this.config={width:t.width||h.DEFAULT_WIDTH,height:t.height||h.DEFAULT_HEIGHT,fps:t.fps||h.DEFAULT_FPS,sampleRate:t.sampleRate||h.DEFAULT_SAMPLERATE,playerId:t.playerId||h.DEFAILT_WEBGL_PLAY_ID,token:t.token||null,readyShow:t.readyShow||!1,checkProbe:t.checkProbe,ignoreAudio:t.ignoreAudio,playMode:t.playMode||h.PLAYER_MODE_VOD,autoPlay:t.autoPlay||!1,defaultFps:t.defaultFps||-1,cacheLength:t.cacheLength||50},this.config.cacheLength=Math.max(this.config.cacheLength,5),this.probeSize=4524611,this.audioWAudio=null,this.audioVoice=1,this.frameCallTag=0,this.seekTarget=0,this.avSeekVState=!1,this.isNewSeek=!1,this.openFrameCall=!0,this.bufRecvStat=!1,this.bufObject=s(),this.bufLastVDTS=0,this.bufLastADTS=0,this.yuvMaxTime=0,this.loopMs=10,this.isCacheV=h.CACHE_NO_LOADCACHE,this.playVPipe=[],this._videoQueue=[],this._VIDEO_CACHE_LEN=this.config.cacheLength,this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null,this.duration=-1,this.channels=-1,this.width=-1,this.height=-1,this.isPlaying=!1,this.isCheckDisplay=!1,this.frameTime=1e3/this.config.fps,this.vCodecID=h.V_CODEC_NAME_UNKN,this.audioIdx=-1,this.audioNone=!1,this.frameDur=0,this.canvasBox=null,this.canvas=null,this.yuv=null,this.retryAuSampleNo=0,this.cacheStatus=!1,this.showScreen=!1,this.playPTS=0,this.vCachePTS=0,this.aCachePTS=0,this.reFull=!1,this.bufOK=!1,this.avRecvInterval=null,this.avFeedVideoInterval=null,this.avFeedAudioInterval=null,this.decVFrameInterval=null,this.playFrameInterval=null,this.onProbeFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onSeekFinish=null,this.onLoadCache=null,this.onLoadCacheFinshed=null,this.onRender=null,this.onCacheProcess=null,this.onReadyShowDone=null,this.onRelease=null,this.playModeEnum=this.config.playMode===h.PLAYER_MODE_NOTIME_LIVE?1:0,this.corePtr=Module.cwrap("AVSniffStreamInit","number",["string","string"])(this.config.token,d.PLAYER_VERSION),this.corePtr,this._ptr_probeCallback=Module.addFunction(this._probeFinCallback.bind(this)),this._ptr_frameCallback=Module.addFunction(this._frameCallback.bind(this)),this._ptr_naluCallback=Module.addFunction(this._naluCallback.bind(this)),this._ptr_sampleCallback=Module.addFunction(this._samplesCallback.bind(this)),this._ptr_aacCallback=Module.addFunction(this._aacFrameCallback.bind(this)),this.config.ignoreAudio,this.config.playMode,this.playModeEnum;Module.cwrap("initializeSniffStreamModuleWithAOpt","number",["number","number","number","number","number","number","number","number","number"])(this.corePtr,this._ptr_probeCallback,this._ptr_frameCallback,this._ptr_naluCallback,this._ptr_sampleCallback,this._ptr_aacCallback,this.config.ignoreAudio,this.playModeEnum,this.config.defaultFps)}var t,i,f;return t=e,(i=[{key:"_createWorker1",value:function(){var e=this;this.worker1=new Worker("./dist/dc-worker-dist.js"),this.worker1ready=!1,this.worker1decing=!1,this.worker1.onmessage=function(t){var i=t.data,n=i.cmd,r=i.params;switch(n){case"onRuntimeInitialized":e.worker1.postMessage({cmd:"AVSniffStreamInit",params:[e.config.token,d.PLAYER_VERSION]});break;case"onInitDecOK":e.worker1ready=!0;break;case"decodeVideoFrame_Start":e.worker1decing=!0;break;case"decodeVideoFrame_End":e.worker1decing=!1;break;case"_frameCallback":e._handleFrameYUVCallback(r.buf_y,r.buf_u,r.buf_v,r.line1,r.line2,r.line3,r.width,r.height,r.pts,r.tag);break;case"stop_End":e.worker1.onmessage=null,e.worker1=null}}}},{key:"_removeBindFuncPtr",value:function(){null!==this._ptr_probeCallback&&Module.removeFunction(this._ptr_probeCallback),null!==this._ptr_frameCallback&&Module.removeFunction(this._ptr_frameCallback),null!==this._ptr_naluCallback&&Module.removeFunction(this._ptr_naluCallback),null!==this._ptr_sampleCallback&&Module.removeFunction(this._ptr_sampleCallback),null!==this._ptr_aacCallback&&Module.removeFunction(this._ptr_aacCallback),this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null}},{key:"release",value:function(){null!==this.playFrameInterval&&(window.clearInterval(this.playFrameInterval),this.playFrameInterval=null),null!==this.avFeedVideoInterval&&(window.clearInterval(this.avFeedVideoInterval),this.avFeedVideoInterval=null),null!==this.avFeedAudioInterval&&(window.clearInterval(this.avFeedAudioInterval),this.avFeedAudioInterval=null),null!==this.avRecvInterval&&(window.clearInterval(this.avRecvInterval),this.avRecvInterval=null),this._clearDecInterval(),this._removeBindFuncPtr();var e=-1;return void 0!==this.corePtr&&null!==this.corePtr&&(e=Module.cwrap("releaseSniffStream","number",["number"])(this.corePtr),this.corePtr=null),this.audioWAudio&&this.audioWAudio.stop(),this.audioWAudio=null,this.bufRecvStat=!1,this.bufObject.cleanPipeline(),this.playVPipe.length=0,this.loopMs=10,void 0!==this.yuv&&null!==this.yuv&&(o.releaseContext(this.yuv),this.yuv=null),void 0!==this.canvas&&null!==this.canvas&&(this.canvas.remove(),this.canvas=null),this.config.readyShow=!0,window.onclick=document.body.onclick=null,delete window.g_players[this.corePtr],this.onRelease&&this.onRelease(),e}},{key:"setScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showScreen=e}},{key:"getCachePTS",value:function(){return 1!==this.config.ignoreAudio&&this.audioWAudio?Math.max(this.vCachePTS,this.aCachePTS):this.vCachePTS}},{key:"getMaxPTS",value:function(){return Math.max(this.vCachePTS,this.aCachePTS)}},{key:"isPlayingState",value:function(){return this.isPlaying}},{key:"_clearDecInterval",value:function(){this.decVFrameInterval&&window.clearInterval(this.decVFrameInterval),this.decVFrameInterval=null}},{key:"_checkPlayFinished",value:function(){return!(this.config.playMode!==h.PLAYER_MODE_VOD||!(!0===this.bufRecvStat&&(this.playPTS>=this.bufLastVDTS||this.audioWAudio&&this.playPTS>=this.bufLastADTS)||this.duration-this.playPTS<this.frameDur)||(this.pause(),this._clearDecInterval(),this.onPlayingTime&&this.onPlayingTime(this.duration),this.onLoadCacheFinshed&&this.onLoadCacheFinshed(),this.onPlayingFinish&&this.onPlayingFinish(),0))}},{key:"play",value:function(){var e=this,t=this;if(this.isCacheV===h.CACHE_WITH_NOPLAY_SIGN&&(this.isCacheV=h.CACHE_WITH_PLAY_SIGN),this.isPlaying=!0,!this.playFrameInterval||null===this.playFrameInterval||null==this.playFrameInterval){var i=0,n=0,r=0,a=1*this.frameTime;this.config.playMode===h.PLAYER_MODE_NOTIME_LIVE?this.playFrameInterval=window.setInterval((function(){if(n=u.GetMsTime(),t._videoQueue.length>0&&n-i>=t.frameTime-r){var e=t._videoQueue.shift();e.pts,o.renderFrame(t.yuv,e.data_y,e.data_u,e.data_v,e.line1,e.height),(r=u.GetMsTime()-n)>=t.frameTime&&(r=t.frameTime),i=n}}),2):this.playFrameInterval=window.setInterval((function(){if(n=u.GetMsTime(),e._videoQueue.length>0&&n-i>=e.frameTime-r){var t=e._videoQueue.shift(),s=0;if(e.isNewSeek||null===e.audioWAudio||void 0===e.audioWAudio||(s=1e3*(t.pts-e.audioWAudio.getAlignVPTS()),e.playPTS=Math.max(e.audioWAudio.getAlignVPTS(),e.playPTS)),i=n,e.playPTS=Math.max(t.pts,e.playPTS),e.isNewSeek&&e.seekTarget-e.frameDur>t.pts)return void(r=e.frameTime);if(e.isNewSeek&&(e.audioWAudio&&e.audioWAudio.setVoice(e.audioVoice),e.audioWAudio&&e.audioWAudio.play(),r=0,e.isNewSeek=!1,e.seekTarget=0),e.showScreen&&e.onRender&&e.onRender(t.line1,t.height,t.data_y,t.data_u,t.data_v),o.renderFrame(e.yuv,t.data_y,t.data_u,t.data_v,t.line1,t.height),e.onPlayingTime&&e.onPlayingTime(t.pts),!e.isNewSeek&&e.audioWAudio&&(s<0&&-1*s<=a||s>=0)){if(e.config.playMode===h.PLAYER_MODE_VOD)if(t.pts>=e.duration)e.onLoadCacheFinshed&&e.onLoadCacheFinshed(),e.onPlayingFinish&&e.onPlayingFinish(),e._clearDecInterval(),e.pause();else if(e._checkPlayFinished())return;r=u.GetMsTime()-n}else!e.isNewSeek&&e.audioWAudio&&(r=e.frameTime)}e._checkPlayFinished()}),1)}this.isNewSeek||this.audioWAudio&&this.audioWAudio.play()}},{key:"pause",value:function(){this.isPlaying=!1,this._pause(),this.isCacheV===h.CACHE_WITH_PLAY_SIGN&&(this.isCacheV=h.CACHE_WITH_NOPLAY_SIGN)}},{key:"_pause",value:function(){this.playFrameInterval&&window.clearInterval(this.playFrameInterval),this.playFrameInterval=null,this.audioWAudio&&this.audioWAudio.pause()}},{key:"seek",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.openFrameCall=!1,this.pause(),this._clearDecInterval(),null!==this.avFeedVideoInterval&&(window.clearInterval(this.avFeedVideoInterval),this.avFeedVideoInterval=null),null!==this.avFeedAudioInterval&&(window.clearInterval(this.avFeedAudioInterval),this.avFeedAudioInterval=null),this.yuvMaxTime=0,this.playVPipe.length=0,this._videoQueue.length=0,this.audioWAudio&&this.audioWAudio.stop(),e&&e(),this.isNewSeek=!0,this.avSeekVState=!0,this.seekTarget=i.seekTime,null!==this.audioWAudio&&void 0!==this.audioWAudio&&(this.audioWAudio.setVoice(0),this.audioWAudio.resetStartParam(),this.audioWAudio.stop()),this._avFeedData(i.seekTime),setTimeout((function(){t.yuvMaxTime=0,t._videoQueue.length=0,t.openFrameCall=!0,t.frameCallTag+=1,t._decVFrameIntervalFunc()}),1e3)}},{key:"setVoice",value:function(e){this.audioVoice=e,this.audioWAudio&&this.audioWAudio.setVoice(e)}},{key:"cacheIsFull",value:function(){return this._videoQueue.length>=this._VIDEO_CACHE_LEN}},{key:"_checkDisplaySize",value:function(e,t,i){var n=t-e,r=this.config.width+Math.ceil(n/2),a=t/this.config.width>i/this.config.height,s=(r/t).toFixed(2),o=(this.config.height/i).toFixed(2),u=a?s:o,l=this.config.fixed,h=l?r:parseInt(t*u),d=l?this.config.height:parseInt(i*u);if(this.canvas.offsetWidth!=h||this.canvas.offsetHeight!=d){var c=parseInt((this.canvasBox.offsetHeight-d)/2),f=parseInt((this.canvasBox.offsetWidth-h)/2);c=c<0?0:c,f=f<0?0:f,this.canvas.style.marginTop=c+"px",this.canvas.style.marginLeft=f+"px",this.canvas.style.width=h+"px",this.canvas.style.height=d+"px"}return this.isCheckDisplay=!0,[h,d]}},{key:"_createYUVCanvas",value:function(){this.canvasBox=document.querySelector("#"+this.config.playerId),this.canvasBox.style.overflow="hidden",this.canvas=document.createElement("canvas"),this.canvas.style.width=this.canvasBox.clientWidth+"px",this.canvas.style.height=this.canvasBox.clientHeight+"px",this.canvas.style.top="0px",this.canvas.style.left="0px",this.canvasBox.appendChild(this.canvas),this.yuv=o.setupCanvas(this.canvas,{preserveDrawingBuffer:!1})}},{key:"_avRecvPackets",value:function(){var e=this;this.bufObject.cleanPipeline(),null!==this.avRecvInterval&&(window.clearInterval(this.avRecvInterval),this.avRecvInterval=null),!0===this.config.checkProbe?this.avRecvInterval=window.setInterval((function(){Module.cwrap("getSniffStreamPkg","number",["number"])(e.corePtr),e._avCheckRecvFinish()}),5):this.avRecvInterval=window.setInterval((function(){Module.cwrap("getSniffStreamPkgNoCheckProbe","number",["number"])(e.corePtr),e._avCheckRecvFinish()}),5),this._avFeedData(0,!1)}},{key:"_avCheckRecvFinish",value:function(){this.config.playMode===h.PLAYER_MODE_VOD&&this.duration-this.getMaxPTS()<this.frameDur&&this._avSetRecvFinished()}},{key:"_avSetRecvFinished",value:function(){this.bufRecvStat=!0,null!==this.avRecvInterval&&(window.clearInterval(this.avRecvInterval),this.avRecvInterval=null),this.bufOK=!0}},{key:"_afterAvFeedSeekToStartWithFinishedBuffer",value:function(e){var t=this,i=window.setInterval((function(){t._videoQueue.length>=t._VIDEO_CACHE_LEN&&(t.onSeekFinish&&t.onSeekFinish(),t.onPlayingTime&&t.onPlayingTime(e),t.play(),window.clearInterval(i),i=null)}),10);return!0}},{key:"_afterAvFeedSeekToStartWithUnFinBuffer",value:function(e){var t=this,i=this,n=window.setInterval((function(){t._videoQueue.length,i._videoQueue.length>=i._VIDEO_CACHE_LEN&&(i.onSeekFinish&&i.onSeekFinish(),i.onPlayingTime&&i.onPlayingTime(e),!1===i.reFull?i.play():i.reFull=!1,window.clearInterval(n),n=null)}),10);return!0}},{key:"_avFeedData",value:function(e){var t=this;if(this.playVPipe.length=0,this.audioWAudio&&this.audioWAudio.cleanQueue(),e<=0&&!1===this.bufOK){var i=0;if(t.avFeedVideoInterval=window.setInterval((function(){var n=t.bufObject.videoBuffer.length;if(n-1>i||t.duration>0&&t.duration-t.getMaxPTS()<t.frameDur&&n-1==i){var r=t.bufObject.videoBuffer[i].length;if(r>0){for(var s=0;s<r;s++)t.playVPipe.push(a.ConstructWithDts(t.bufObject.videoBuffer[i][s].pts,t.bufObject.videoBuffer[i][s].dts,t.bufObject.videoBuffer[i][s].isKey,t.bufObject.videoBuffer[i][s].data,!0));i+=1}t.config.playMode===h.PLAYER_MODE_VOD&&t.duration-t.getMaxPTS()<t.frameDur&&t.playVPipe.length>0&&t.playVPipe[t.playVPipe.length-1].pts>=t.bufLastVDTS&&(window.clearInterval(t.avFeedVideoInterval),t.avFeedVideoInterval=null,t.playVPipe[t.playVPipe.length-1].pts,t.bufLastVDTS,t.bufObject.videoBuffer,t.playVPipe)}else t.config.playMode===h.PLAYER_MODE_VOD&&t.playVPipe.length>0&&t.playVPipe[t.playVPipe.length-1].pts>=t.duration&&(window.clearInterval(t.avFeedVideoInterval),t.avFeedVideoInterval=null,t.playVPipe[t.playVPipe.length-1].pts,t.duration,t.bufObject.videoBuffer,t.playVPipe);t.avSeekVState&&(t.getMaxPTS(),t.duration,t.config.playMode===h.PLAYER_MODE_VOD&&(t._afterAvFeedSeekToStartWithFinishedBuffer(e),t.avSeekVState=!1))}),5),void 0!==t.audioWAudio&&null!==t.audioWAudio&&t.config.ignoreAudio<1){var n=0;t.avFeedAudioInterval=window.setInterval((function(){var e=t.bufObject.audioBuffer.length;if(e-1>n||t.duration-t.getMaxPTS()<t.frameDur&&e-1==n){for(var i=t.bufObject.audioBuffer[n].length,r=0;r<i;r++)t.audioWAudio.addSample(new a.BufferFrame(t.bufObject.audioBuffer[n][r].pts,t.bufObject.audioBuffer[n][r].isKey,t.bufObject.audioBuffer[n][r].data,!1));n+=1,t.config.playMode===h.PLAYER_MODE_VOD&&t.duration-t.getMaxPTS()<t.frameDur&&t.audioWAudio.sampleQueue.length>0&&t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts>=t.bufLastADTS&&(window.clearInterval(t.avFeedAudioInterval),t.avFeedAudioInterval=null,t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts,t.bufObject.audioBuffer)}else t.config.playMode===h.PLAYER_MODE_VOD&&t.audioWAudio.sampleQueue.length>0&&t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts>=t.duration&&(window.clearInterval(t.avFeedAudioInterval),t.avFeedAudioInterval=null,t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts,t.bufObject.audioBuffer)}),5)}}else{var r=this.bufObject.seekIDR(e),s=parseInt(r,10);this.playPTS=0;var o=s;if(this.avFeedVideoInterval=window.setInterval((function(){var i=t.bufObject.videoBuffer.length;if(i-1>o||t.duration-t.getMaxPTS()<t.frameDur&&i-1==o){var n=t.bufObject.videoBuffer[o].length;if(n>0){for(var r=0;r<n;r++)t.playVPipe.push(a.ConstructWithDts(t.bufObject.videoBuffer[o][r].pts,t.bufObject.videoBuffer[o][r].dts,t.bufObject.videoBuffer[o][r].isKey,t.bufObject.videoBuffer[o][r].data,!0));o+=1}t.config.playMode===h.PLAYER_MODE_VOD&&t.duration-t.getMaxPTS()<t.frameDur&&t.playVPipe.length>0&&t.playVPipe[t.playVPipe.length-1].pts>=t.bufLastVDTS&&(window.clearInterval(t.avFeedVideoInterval),t.avFeedVideoInterval=null)}else t.config.playMode===h.PLAYER_MODE_VOD&&t.playVPipe.length>0&&t.playVPipe[t.playVPipe.length-1].pts>=t.duration&&(window.clearInterval(t.avFeedVideoInterval),t.avFeedVideoInterval=null);t.avSeekVState&&(t.getMaxPTS(),t.duration,t.config.playMode===h.PLAYER_MODE_VOD&&(t._afterAvFeedSeekToStartWithUnFinBuffer(e),t.avSeekVState=!1))}),5),this.audioWAudio&&this.config.ignoreAudio<1){var u=parseInt(e,10);this.avFeedAudioInterval=window.setInterval((function(){var e=t.bufObject.audioBuffer.length;if(e-1>u||t.duration-t.getMaxPTS()<t.frameDur&&e-1==u){for(var i=t.bufObject.audioBuffer[u].length,n=0;n<i;n++)t.bufObject.audioBuffer[u][n].pts<t.seekTarget||t.audioWAudio.addSample(new a.BufferFrame(t.bufObject.audioBuffer[u][n].pts,t.bufObject.audioBuffer[u][n].isKey,t.bufObject.audioBuffer[u][n].data,!1));u+=1,t.config.playMode===h.PLAYER_MODE_VOD&&t.duration-t.getMaxPTS()<t.frameDur&&t.audioWAudio.sampleQueue.length>0&&t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts>=t.bufLastADTS&&(window.clearInterval(t.avFeedAudioInterval),t.avFeedAudioInterval=null)}else t.config.playMode===h.PLAYER_MODE_VOD&&t.audioWAudio.sampleQueue.length>0&&t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length-1].pts>=t.duration&&(window.clearInterval(t.avFeedAudioInterval),t.avFeedAudioInterval=null)}),5)}}}},{key:"_probeFinCallback",value:function(e,t,i,n,r,a,s,o,u){var d=this;this._createYUVCanvas(),h.V_CODEC_NAME_HEVC,this.config.fps=1*n,this.frameTime=1e3/this.config.fps,this.width=t,this.height=i,this.frameDur=1/this.config.fps,this.duration=e-this.frameDur,this.vCodecID=o,this.config.sampleRate=a,this.channels=s,this.audioIdx=r,this.duration<0&&(this.config.playMode=h.PLAYER_MODE_NOTIME_LIVE,this.frameTime,this.frameDur);for(var c=Module.HEAPU8.subarray(u,u+10),f=0;f<c.length;f++)String.fromCharCode(c[f]);r>=0&&this.config.ignoreAudio<1?this.audioNone=!1:this.audioNone=!0,h.V_CODEC_NAME_HEVC===this.vCodecID&&(!1===this.audioNone&&(void 0!==this.audioWAudio&&null!==this.audioWAudio&&(this.audioWAudio.stop(),this.audioWAudio=null),this.audioWAudio=l({sampleRate:a,appendType:h.APPEND_TYPE_FRAME}),this.audioWAudio.setDurationMs(1e3*e),this.onLoadCache&&this.audioWAudio.setOnLoadCache((function(){if(d.retryAuSampleNo,d.retryAuSampleNo<=5){d.pause(),d.onLoadCache&&d.onLoadCache();var e=window.setInterval((function(){return d.retryAuSampleNo,d.audioWAudio.sampleQueue.length,d.audioWAudio.sampleQueue.length>2?(d.onLoadCacheFinshed&&d.onLoadCacheFinshed(),d.play(),d.retryAuSampleNo=0,window.clearInterval(e),void(e=null)):(d.retryAuSampleNo+=1,d.retryAuSampleNo>5?(d.play(),d.onLoadCacheFinshed&&d.onLoadCacheFinshed(),window.clearInterval(e),void(e=null)):void 0)}),1e3)}}))),this._avRecvPackets(),this._decVFrameIntervalFunc()),this.onProbeFinish&&this.onProbeFinish()}},{key:"_ptsFixed2",value:function(e){return Math.ceil(100*e)/100}},{key:"_naluCallback",value:function(e,t,i,n,r,a,s,o){var u=this._ptsFixed2(a);o>0&&(u=a);var l=Module.HEAPU8.subarray(e,e+t),h=new Uint8Array(l);this.bufObject.appendFrameWithDts(u,s,h,!0,i),this.bufLastVDTS=Math.max(s,this.bufLastVDTS),this.vCachePTS=Math.max(u,this.vCachePTS),this.onCacheProcess&&this.onCacheProcess(this.getCachePTS())}},{key:"_samplesCallback",value:function(e,t,i,n){}},{key:"_aacFrameCallback",value:function(e,t,i,n){var r=this._ptsFixed2(n);if(this.audioWAudio){var a=Module.HEAPU8.subarray(e,e+t),s=new Uint8Array(a);this.bufObject.appendFrame(r,s,!1,!0),this.bufLastADTS=Math.max(r,this.bufLastADTS),this.aCachePTS=Math.max(r,this.aCachePTS),this.onCacheProcess&&this.onCacheProcess(this.getCachePTS())}}},{key:"_setLoadCache",value:function(){if(null===this.avFeedVideoInterval&&null===this.avFeedAudioInterval&&this.playVPipe.length<=0)return 1;if(this.isCacheV===h.CACHE_NO_LOADCACHE){var e=this.isPlaying;this.pause(),this.onLoadCache&&this.onLoadCache(),this.isCacheV=e?h.CACHE_WITH_PLAY_SIGN:h.CACHE_WITH_NOPLAY_SIGN}return 0}},{key:"_setLoadCacheFinished",value:function(){this.isCacheV!==h.CACHE_NO_LOADCACHE&&(this.isCacheV,this.onLoadCacheFinshed&&this.onLoadCacheFinshed(),this.isCacheV===h.CACHE_WITH_PLAY_SIGN&&this.play(),this.isCacheV=h.CACHE_NO_LOADCACHE)}},{key:"_createDecVframeInterval",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=this;null!==this.decVFrameInterval&&(window.clearInterval(this.decVFrameInterval),this.decVFrameInterval=null);var i=0;this.loopMs=e,this.decVFrameInterval=window.setInterval((function(){if(t._videoQueue.length<1?t._setLoadCache():t._videoQueue.length>=t._VIDEO_CACHE_LEN&&t._setLoadCacheFinished(),t._videoQueue.length<t._VIDEO_CACHE_LEN&&i<=t._VIDEO_CACHE_LEN){if(t.playVPipe.length>0){100===t.loopMs&&t._createDecVframeInterval(10);var e=t.playVPipe.shift(),n=e.data,r=Module._malloc(n.length);Module.HEAP8.set(n,r);var a=parseInt(1e3*e.pts,10),s=parseInt(1e3*e.dts,10);t.yuvMaxTime=Math.max(e.pts,t.yuvMaxTime);var o=Module.cwrap("decodeVideoFrame","number",["number","number","number","number","number"])(t.corePtr,r,n.length,a,s,t.frameCallTag);o>0&&(i=o),Module._free(r),r=null}}else i=Module.cwrap("naluLListLength","number",["number"])(t.corePtr)}),e)}},{key:"_decVFrameIntervalFunc",value:function(){null==this.decVFrameInterval&&this._createDecVframeInterval(10)}},{key:"_frameCallback",value:function(e,t,i,n,r,a,s,o,u,l){if(this._videoQueue.length,!1===this.openFrameCall)return-1;if(l!==this.frameCallTag)return-2;if(u>this.yuvMaxTime+this.frameDur)return-3;if(this.isNewSeek&&this.seekTarget-u>3*this.frameDur)return-4;var h=this._videoQueue.length;if(this.canvas.width==n&&this.canvas.height==o||(this.canvas.width=n,this.canvas.height=o,this.isCheckDisplay)||this._checkDisplaySize(s,n,o),this.playPTS>u)return-5;var d=Module.HEAPU8.subarray(e,e+n*o),f=Module.HEAPU8.subarray(t,t+r*o/2),p=Module.HEAPU8.subarray(i,i+a*o/2),m=new Uint8Array(d),_=new Uint8Array(f),g=new Uint8Array(p),v=new c(m,_,g,n,r,a,s,o,u);if(h<=0||u>this._videoQueue[h-1].pts)this._videoQueue.push(v);else if(u<this._videoQueue[0].pts)this._videoQueue.splice(0,0,v);else if(u<this._videoQueue[h-1].pts)for(var y=0;y<h;y++)if(u>this._videoQueue[y].pts&&y+1<h&&u<this._videoQueue[y+1].pts){this._videoQueue.splice(y+1,0,v);break}return this._videoQueue,this.vCachePTS=Math.max(u,this.vCachePTS),this.onCacheProcess&&this.onCacheProcess(this.getCachePTS()),this.config.readyShow&&!0===this.playYUV()&&(this.config.readyShow=!1,this.onReadyShowDone&&this.onReadyShowDone()),0}},{key:"_handleFrameYUVCallback",value:function(e,t,i,n,r,a,s,o,u,l){var h=new Uint8Array(e),d=new Uint8Array(t),f=new Uint8Array(i);if(!(!1===this.openFrameCall||l!==this.frameCallTag||u>this.yuvMaxTime+this.frameDur||this.isNewSeek&&this.seekTarget-u>3*this.frameDur)){var p=this._videoQueue.length;if(this.canvas.width==n&&this.canvas.height==o||(this.canvas.width=n,this.canvas.height=o,this.isCheckDisplay)||this._checkDisplaySize(s,n,o),!(this.playPTS>u)){var m=new c(h,d,f,n,r,a,s,o,u);if(p<=0||u>this._videoQueue[p-1].pts)this._videoQueue.push(m);else if(u<this._videoQueue[0].pts)this._videoQueue.splice(0,0,m);else if(u<this._videoQueue[p-1].pts)for(var _=0;_<p;_++)if(u>this._videoQueue[_].pts&&_+1<p&&u<this._videoQueue[_+1].pts){this._videoQueue.splice(_+1,0,m);break}this._videoQueue,this.vCachePTS=Math.max(u,this.vCachePTS),this.onCacheProcess&&this.onCacheProcess(this.getCachePTS()),this.config.readyShow&&!0===this.playYUV()&&(this.config.readyShow=!1,this.onReadyShowDone&&this.onReadyShowDone())}}}},{key:"playYUV",value:function(){if(this._videoQueue.length>0){var e=this._videoQueue.shift();return e.pts,this.onRender&&this.onRender(e.line1,e.height,e.data_y,e.data_u,e.data_v),o.renderFrame(this.yuv,e.data_y,e.data_u,e.data_v,e.line1,e.height),!0}return!1}},{key:"setProbeSize",value:function(e){this.probeSize=e}},{key:"pushBuffer",value:function(e){if(void 0===this.corePtr||null===this.corePtr)return-1;var t=Module._malloc(e.length);Module.HEAP8.set(e,t);var i=Module.cwrap("pushSniffStreamData","number",["number","number","number","number"])(this.corePtr,t,e.length,this.probeSize);return i}}])&&n(t.prototype,i),f&&n(t,f),e}();i.CNativeCore=f},{"../consts":52,"../demuxer/buffer":66,"../demuxer/bufferFrame":67,"../render-engine/webgl-420p":81,"../version":84,"./audio-core":54,"./audio-native-core":55,"./av-common":56,"./cache":61,"./cacheYuv":62}],60:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e("../demuxer/bufferFrame"),e("../demuxer/buffer"),e("./cache"),e("./cacheYuv");var r=e("../render-engine/webgl-420p"),a=e("./av-common"),s=(e("./audio-native-core"),e("./audio-core")),o=e("../consts"),u=(e("../version"),function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config={width:t.width||o.DEFAULT_WIDTH,height:t.height||o.DEFAULT_HEIGHT,fps:t.fps||o.DEFAULT_FPS,sampleRate:t.sampleRate||o.DEFAULT_SAMPLERATE,playerId:t.playerId||o.DEFAILT_WEBGL_PLAY_ID,token:t.token||null,probeSize:t.probeSize||4096,ignoreAudio:t.ignoreAudio||0,autoPlay:t.autoPlay||!1},this.config.probeSize,this.config.ignoreAudio,this.mediaInfo={noFPS:!1,fps:o.DEFAULT_FPS,width:this.config.width,height:this.config.height,sampleRate:this.config.sampleRate,size:{width:-1,height:-1},audioNone:!1},this.duration=-1,this.vCodecID=o.V_CODEC_NAME_HEVC,this.corePtr=null,this.AVGetInterval=null,this.readyShowDone=!1,this.readyKeyFrame=!1,this.cache_status=!1,this.download_length=0,this.AVGLObj=null,this.canvasBox=document.querySelector("#"+this.config.playerId),this.canvasBox.style.overflow="hidden",this.CanvasObj=null,this.CanvasObj=document.createElement("canvas"),this.CanvasObj.style.width=this.canvasBox.clientWidth+"px",this.CanvasObj.style.height=this.canvasBox.clientHeight+"px",this.CanvasObj.style.top="0px",this.CanvasObj.style.left="0px",this.canvasBox.appendChild(this.CanvasObj),this.audioWAudio=null,this.audioVoice=1,this.frameTime=1e3/this.config.fps,this.NaluBuf=[],this.YuvBuf=[],this.getPackageTimeMS=0,this.workerFetch=null,this.playInterval=null,this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null;this.totalLen=0,this.pushPkg=0,this.showScreen=!1,this.onProbeFinish=null,this.onLoadCache=null,this.onLoadCacheFinshed=null,this.onRender=null,this.onReadyShowDone=null,this.onError=null;this.corePtr=Module.cwrap("AVSniffHttpFlvInit","number",["string","string"])("base64:QXV0aG9yOmNoYW5neWFubG9uZ3xudW1iZXJ3b2xmLEdpdGh1YjpodHRwczovL2dpdGh1Yi5jb20vbnVtYmVyd29sZixFbWFpbDpwb3JzY2hlZ3QyM0Bmb3htYWlsLmNvbSxRUTo1MzEzNjU4NzIsSG9tZVBhZ2U6aHR0cDovL3h2aWRlby52aWRlbyxEaXNjb3JkOm51bWJlcndvbGYjODY5NCx3ZWNoYXI6bnVtYmVyd29sZjExLEJlaWppbmcsV29ya0luOkJhaWR1","0.0.0"),this.corePtr}var t,i,u;return t=e,(i=[{key:"_workerFetch_onmessage",value:function(e,t){var i=e.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"fetch-chunk":var n=i.data;t.download_length+=n.length,setTimeout((function(){var e=Module._malloc(n.length);Module.HEAP8.set(n,e),Module.cwrap("pushSniffHttpFlvData","number",["number","number","number","number"])(t.corePtr,e,n.length,t.config.probeSize),Module._free(e),e=null}),0),t.totalLen+=n.length,n.length>0&&(t.getPackageTimeMS=a.GetMsTime()),t.pushPkg++,void 0!==t.AVGetInterval&&null!==t.AVGetInterval||(t.AVGetInterval=window.setInterval((function(){Module.cwrap("getBufferLengthApi","number",["number"])(t.corePtr)>t.config.probeSize&&(Module.cwrap("getSniffHttpFlvPkg","number",["number"])(t.corePtr),t.pushPkg-=1)}),5));break;case"close":t.AVGetInterval&&clearInterval(t.AVGetInterval),t.AVGetInterval=null;case"fetch-fin":break;case"fetch-error":t.onError&&t.onError(i.data)}}},{key:"_checkDisplaySize",value:function(e,t,i){var n=t-e,r=this.config.width+Math.ceil(n/2),a=t/this.config.width>i/this.config.height,s=(r/t).toFixed(2),o=(this.config.height/i).toFixed(2),u=a?s:o,l=this.config.fixed,h=l?r:parseInt(t*u),d=l?this.config.height:parseInt(i*u);if(this.CanvasObj.offsetWidth!=h||this.CanvasObj.offsetHeight!=d){var c=parseInt((this.canvasBox.offsetHeight-d)/2),f=parseInt((this.canvasBox.offsetWidth-h)/2);c=c<0?0:c,f=f<0?0:f,this.CanvasObj.style.marginTop=c+"px",this.CanvasObj.style.marginLeft=f+"px",this.CanvasObj.style.width=h+"px",this.CanvasObj.style.height=d+"px"}return this.isCheckDisplay=!0,[h,d]}},{key:"_ptsFixed2",value:function(e){return Math.ceil(100*e)/100}},{key:"_callbackProbe",value:function(e,t,i,n,r,a,u,l,h){for(var d=Module.HEAPU8.subarray(h,h+10),c=0;c<d.length;c++)String.fromCharCode(d[c]);var f=n;n>100&&(f=o.DEFAULT_FPS,this.mediaInfo.noFPS=!0),this.vCodecID=l,this.config.fps=f,this.mediaInfo.fps=f,this.mediaInfo.size.width=t,this.mediaInfo.size.height=i,this.frameTime=Math.floor(1e3/(this.mediaInfo.fps+2)),this.CanvasObj.width==t&&this.CanvasObj.height==i||(this.CanvasObj.width=t,this.CanvasObj.height=i,this.isCheckDisplay)||this._checkDisplaySize(t,t,i),r>=0&&!1===this.mediaInfo.noFPS&&this.config.ignoreAudio<1?(void 0!==this.audioWAudio&&null!==this.audioWAudio&&(this.audioWAudio.stop(),this.audioWAudio=null),this.config.sampleRate=a,this.mediaInfo.sampleRate=a,this.audioWAudio=s({sampleRate:this.mediaInfo.sampleRate,appendType:o.APPEND_TYPE_FRAME}),this.audioWAudio.isLIVE=!0):this.mediaInfo.audioNone=!0,this.onProbeFinish&&this.onProbeFinish()}},{key:"_callbackYUV",value:function(e,t,i,n,r,a,s,o,u){var l=Module.HEAPU8.subarray(e,e+n*o),h=new Uint8Array(l),d=Module.HEAPU8.subarray(t,t+r*o/2),c=new Uint8Array(d),f=Module.HEAPU8.subarray(i,i+a*o/2),p={bufY:h,bufU:c,bufV:new Uint8Array(f),line_y:n,h:o,pts:u};this.YuvBuf.push(p),this.checkCacheState(),Module._free(l),l=null,Module._free(d),d=null,Module._free(f),f=null,!1===this.readyShowDone&&!0===this.playYUV()&&(this.readyShowDone=!0,this.onReadyShowDone&&this.onReadyShowDone(),this.audioWAudio||this.play())}},{key:"_callbackNALU",value:function(e,t,i,n,r,a,s){if(!1===this.readyKeyFrame){if(i<=0)return;this.readyKeyFrame=!0}var o=Module.HEAPU8.subarray(e,e+t),u=new Uint8Array(o);this.NaluBuf.push({bufData:u,len:t,isKey:i,w:n,h:r,pts:1e3*a,dts:1e3*s}),Module._free(o),o=null}},{key:"_callbackPCM",value:function(e){}},{key:"_callbackAAC",value:function(e,t,i,n){var r=this._ptsFixed2(n);if(this.audioWAudio){var a=Module.HEAPU8.subarray(e,e+t),s={pts:r,data:new Uint8Array(a)};this.audioWAudio.addSample(s),this.checkCacheState()}}},{key:"_decode",value:function(){var e=this;setTimeout((function(){if(null!==e.workerFetch){var t=e.NaluBuf.shift();if(null!=t){var i=Module._malloc(t.bufData.length);Module.HEAP8.set(t.bufData,i),Module.cwrap("decodeHttpFlvVideoFrame","number",["number","number","number","number","number"])(e.corePtr,i,t.bufData.length,t.pts,t.dts,0),Module._free(i),i=null}e._decode()}}),1)}},{key:"setScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.showScreen=e}},{key:"checkCacheState",value:function(){var e=this.YuvBuf.length>=25&&(!0===this.mediaInfo.audioNone||this.audioWAudio&&this.audioWAudio.sampleQueue.length>=50);return!1===this.cache_status&&e&&(this.playInterval&&this.audioWAudio&&this.audioWAudio.play(),this.onLoadCacheFinshed&&this.onLoadCacheFinshed(),this.cache_status=!0),e}},{key:"setVoice",value:function(e){this.audioVoice=e,this.audioWAudio&&this.audioWAudio.setVoice(e)}},{key:"_removeBindFuncPtr",value:function(){null!==this._ptr_probeCallback&&Module.removeFunction(this._ptr_probeCallback),null!==this._ptr_frameCallback&&Module.removeFunction(this._ptr_frameCallback),null!==this._ptr_naluCallback&&Module.removeFunction(this._ptr_naluCallback),null!==this._ptr_sampleCallback&&Module.removeFunction(this._ptr_sampleCallback),null!==this._ptr_aacCallback&&Module.removeFunction(this._ptr_aacCallback),this._ptr_probeCallback=null,this._ptr_frameCallback=null,this._ptr_naluCallback=null,this._ptr_sampleCallback=null,this._ptr_aacCallback=null}},{key:"release",value:function(){return this.pause(),this.NaluBuf.length=0,this.YuvBuf.length=0,void 0!==this.workerFetch&&null!==this.workerFetch&&this.workerFetch.postMessage({cmd:"stop",data:"stop",msg:"stop"}),this.workerFetch=null,this.AVGetInterval&&clearInterval(this.AVGetInterval),this.AVGetInterval=null,this._removeBindFuncPtr(),void 0!==this.corePtr&&null!==this.corePtr&&Module.cwrap("releaseHttpFLV","number",["number"])(this.corePtr),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null,this.audioWAudio&&this.audioWAudio.stop(),this.audioWAudio=null,void 0!==this.AVGLObj&&null!==this.AVGLObj&&(r.releaseContext(this.AVGLObj),this.AVGLObj=null),this.CanvasObj&&this.CanvasObj.remove(),this.CanvasObj=null,window.onclick=document.body.onclick=null,0}},{key:"isPlayingState",value:function(){return null!==this.playInterval&&void 0!==this.playInterval}},{key:"pause",value:function(){this.audioWAudio&&this.audioWAudio.pause(),this.playInterval&&clearInterval(this.playInterval),this.playInterval=null}},{key:"playYUV",value:function(){if(this.YuvBuf.length>0){var e=this.YuvBuf.shift();return this.onRender&&this.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),r.renderFrame(this.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h),!0}return!1}},{key:"play",value:function(){var e=this,t=this;if(!1===this.checkCacheState())return this.onLoadCache&&this.onLoadCache(),setTimeout((function(){e.play()}),100),!1;if(void 0===this.playInterval||null===this.playInterval){var i=0,n=0,s=0;!1===this.mediaInfo.audioNone&&this.audioWAudio&&!1===this.mediaInfo.noFPS?(this.playInterval=setInterval((function(){if(n=a.GetMsTime(),t.cache_status){if(n-i>=t.frameTime-s){var e=t.YuvBuf.shift();if(null!=e&&null!==e){var o=0;null!==t.audioWAudio&&void 0!==t.audioWAudio&&(o=1e3*(e.pts-t.audioWAudio.getAlignVPTS())),s=t.audioWAudio?o<0&&-1*o<=t.frameTime||o>=0?a.GetMsTime()-n+1:t.frameTime:a.GetMsTime()-n+1,t.showScreen&&t.onRender&&t.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),e.pts,r.renderFrame(t.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h)}(t.YuvBuf.length<=0||t.audioWAudio&&t.audioWAudio.sampleQueue.length<=0)&&(t.cache_status=!1,t.onLoadCache&&t.onLoadCache(),t.audioWAudio&&t.audioWAudio.pause()),i=n}}else s=t.frameTime}),1),this.audioWAudio&&this.audioWAudio.play()):this.playInterval=setInterval((function(){var e=t.YuvBuf.shift();null!=e&&null!==e&&(t.showScreen&&t.onRender&&t.onRender(e.line_y,e.h,e.bufY,e.bufU,e.bufV),r.renderFrame(t.AVGLObj,e.bufY,e.bufU,e.bufV,e.line_y,e.h)),t.YuvBuf.length<=0&&(t.cache_status=!1)}),t.frameTime)}}},{key:"start",value:function(e){var t=this;this.workerFetch=new Worker(a.GetScriptPath((function(){var e=null;self,self.onmessage=function(t){var i=t.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"start":var n=i.data;(e=new WebSocket(n)).binaryType="arraybuffer",e.onopen=function(t){e.send("Hello WebSockets!")},e.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=e.data;t.byteLength>0&&postMessage({cmd:"fetch-chunk",data:new Uint8Array(t),msg:"fetch-chunk"})}},e.onclose=function(e){};break;case"stop":e&&e.close(),self.close(),self.postMessage({cmd:"close",data:"close",msg:"close"})}}}))),this.workerFetch.onmessage=function(e){t._workerFetch_onmessage(e,t)},this.workerFetch,this._ptr_probeCallback=Module.addFunction(this._callbackProbe.bind(this)),this._ptr_yuvCallback=Module.addFunction(this._callbackYUV.bind(this)),this._ptr_naluCallback=Module.addFunction(this._callbackNALU.bind(this)),this._ptr_sampleCallback=Module.addFunction(this._callbackPCM.bind(this)),this._ptr_aacCallback=Module.addFunction(this._callbackAAC.bind(this)),Module.cwrap("initializeSniffHttpFlvModule","number",["number","number","number","number","number","number"])(this.corePtr,this._ptr_probeCallback,this._ptr_yuvCallback,this._ptr_naluCallback,this._ptr_sampleCallback,this._ptr_aacCallback),this.AVGLObj=r.setupCanvas(this.CanvasObj,{preserveDrawingBuffer:!1}),this.workerFetch.postMessage({cmd:"start",data:e,msg:"start"}),this._decode()}}])&&n(t.prototype,i),u&&n(t,u),e}());i.CWsLiveCore=u},{"../consts":52,"../demuxer/buffer":66,"../demuxer/bufferFrame":67,"../render-engine/webgl-420p":81,"../version":84,"./audio-core":54,"./audio-native-core":55,"./av-common":56,"./cache":61,"./cacheYuv":62}],61:[function(e,t,i){(function(i){"use strict";e("./cacheYuv");i.CACHE_APPEND_STATUS_CODE={FAILED:-1,OVERFLOW:-2,OK:0,NOT_FULL:1,FULL:2,NULL:3},t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:60,t={limit:e,yuvCache:[],appendCacheByCacheYuv:function(e){e.pts;return t.yuvCache.length>=t.limit?CACHE_APPEND_STATUS_CODE.OVERFLOW:(t.yuvCache.push(e),t.yuvCache.length>=t.limit?CACHE_APPEND_STATUS_CODE.FULL:CACHE_APPEND_STATUS_CODE.NOT_FULL)},getState:function(){return t.yuvCache.length<=0?CACHE_APPEND_STATUS_CODE.NULL:t.yuvCache.length>=t.limit?CACHE_APPEND_STATUS_CODE.FULL:CACHE_APPEND_STATUS_CODE.NOT_FULL},cleanPipeline:function(){t.yuvCache.length=0},vYuv:function(){return t.yuvCache.length<=0?null:t.yuvCache.shift()}};return t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cacheYuv":62}],62:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(t,i,n,r,a,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pts=t,this.width=i,this.height=n,this.imageBufferY=r,this.imageBufferB=a,this.imageBufferR=s}var t,i,r;return t=e,(i=[{key:"setYuv",value:function(e,t,i,n,r,a){this.pts=e,this.width=t,this.height=i,this.imageBufferY=n,this.imageBufferB=r,this.imageBufferR=a}}])&&n(t.prototype,i),r&&n(t,r),e}();i.CacheYuvStruct=r},{}],63:[function(e,t,i){"use strict";t.exports={HEVC_NAL_TRAIL_N:0,HEVC_NAL_TRAIL_R:1,HEVC_NAL_TSA_N:2,HEVC_NAL_TSA_R:3,HEVC_NAL_STSA_N:4,HEVC_NAL_STSA_R:5,HEVC_NAL_RADL_N:6,HEVC_NAL_RADL_R:7,HEVC_NAL_RASL_N:8,HEVC_NAL_RASL_R:9,HEVC_NAL_VCL_N10:10,HEVC_NAL_VCL_R11:11,HEVC_NAL_VCL_N12:12,HEVC_NAL_VCL_R13:13,HEVC_NAL_VCL_N14:14,HEVC_NAL_VCL_R15:15,HEVC_NAL_BLA_W_LP:16,HEVC_NAL_BLA_W_RADL:17,HEVC_NAL_BLA_N_LP:18,HEVC_NAL_IDR_W_RADL:19,HEVC_NAL_IDR_N_LP:20,HEVC_NAL_CRA_NUT:21,HEVC_NAL_IRAP_VCL22:22,HEVC_NAL_IRAP_VCL23:23,HEVC_NAL_RSV_VCL24:24,HEVC_NAL_RSV_VCL25:25,HEVC_NAL_RSV_VCL26:26,HEVC_NAL_RSV_VCL27:27,HEVC_NAL_RSV_VCL28:28,HEVC_NAL_RSV_VCL29:29,HEVC_NAL_RSV_VCL30:30,HEVC_NAL_RSV_VCL31:31,HEVC_NAL_VPS:32,HEVC_NAL_SPS:33,HEVC_NAL_PPS:34,HEVC_NAL_AUD:35,HEVC_NAL_EOS_NUT:36,HEVC_NAL_EOB_NUT:37,HEVC_NAL_FD_NUT:38,HEVC_NAL_SEI_PREFIX:39,HEVC_NAL_SEI_SUFFIX:40,HEVC_NAL_RSV_NVCL41:41,HEVC_NAL_RSV_NVCL42:42,HEVC_NAL_RSV_NVCL43:43,HEVC_NAL_RSV_NVCL44:44,HEVC_NAL_RSV_NVCL45:45,HEVC_NAL_RSV_NVCL46:46,HEVC_NAL_RSV_NVCL47:47,HEVC_NAL_UNSPEC48:48,HEVC_NAL_UNSPEC49:49,HEVC_NAL_UNSPEC50:50,HEVC_NAL_UNSPEC51:51,HEVC_NAL_UNSPEC52:52,HEVC_NAL_UNSPEC53:53,HEVC_NAL_UNSPEC54:54,HEVC_NAL_UNSPEC55:55,HEVC_NAL_UNSPEC56:56,HEVC_NAL_UNSPEC57:57,HEVC_NAL_UNSPEC58:58,HEVC_NAL_UNSPEC59:59,HEVC_NAL_UNSPEC60:60,HEVC_NAL_UNSPEC61:61,HEVC_NAL_UNSPEC62:62,HEVC_NAL_UNSPEC63:63,SOURCE_CODE_VPS:64,SOURCE_CODE_SPS:66,SOURCE_CODE_PPS:68,SOURCE_CODE_SEI:78,SOURCE_CODE_IDR:38,SOURCE_CODE_P:2,SOURCE_CODE_SEI_END:128,DEFINE_STARTCODE:new Uint8Array([0,0,0,1]),DEFINE_KEY_FRAME:21,DEFINE_P_FRAME:9,DEFINE_OTHERS_FRAME:153}},{}],64:[function(e,t,i){"use strict";var n=e("./hevc-header"),r=[n.HEVC_NAL_VPS,n.HEVC_NAL_SPS,n.HEVC_NAL_PPS,n.HEVC_NAL_SEI_PREFIX];t.exports={IS_HEV_PS_INFO_CHAR:function(e){var t=(126&e)>>1;return r.indexOf(t)},GET_NALU_TYPE:function(e){var t=(126&e)>>1;if(t>=1&&t<=9)return n.DEFINE_P_FRAME;if(t>=16&&t<=21)return n.DEFINE_KEY_FRAME;var i=r.indexOf(t);return i>=0?r[i]:n.DEFINE_OTHERS_FRAME},PACK_NALU:function(e){var t=e.nalu,i=e.vlc.vlc;null==t.vps&&(t.vps=new Uint8Array);var n=new Uint8Array(t.vps.length+t.sps.length+t.pps.length+t.sei.length+i.length);return n.set(t.vps,0),n.set(t.sps,t.vps.length),n.set(t.pps,t.vps.length+t.sps.length),n.set(t.sei,t.vps.length+t.sps.length+t.pps.length),n.set(i,t.vps.length+t.sps.length+t.pps.length+t.sei.length),n}}},{"./hevc-header":63}],65:[function(e,t,i){"use strict";function n(e){return function(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t<e.length;t++)i[t]=e[t];return i}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=e("./av-common"),a=e("./audio-core"),s=e("./cache"),o=e("./cacheYuv"),u=e("../render-engine/webgl-420p"),l=e("../consts"),h=e("../version");t.exports=function(e){var t={config:{width:e.width||l.DEFAULT_WIDTH,height:e.height||l.DEFAULT_HEIGHT,fps:e.fps||l.DEFAULT_FPS,fixed:e.fixed||l.DEFAULT_FIXED,sampleRate:e.sampleRate||l.DEFAULT_SAMPLERATE,appendHevcType:e.appendHevcType||l.APPEND_TYPE_STREAM,frameDurMs:e.frameDur||l.DEFAULT_FRAME_DUR,playerId:e.playerId||l.DEFAILT_WEBGL_PLAY_ID,audioNone:e.audioNone||!1,token:e.token||null,videoCodec:e.videoCodec||l.CODEC_H265},vcodecerPtr:null,videoCallback:null,frameList:[],cacheInterval:null,cacheYuvBuf:s(30),nowPacket:null,stream:new Uint8Array,vCodecID:l.V_CODEC_NAME_HEVC,audio:null,liveStartMs:-1,durationMs:-1,videoPTS:0,loop:null,debugYUVSwitch:!1,debugID:null,cacheLoop:null,playParams:{seekPos:-1,mode:l.PLAYER_MODE_VOD,accurateSeek:!0,seekEvent:!1,realPlay:!0},calcuteStartTime:-1,fix_poc_err_skip:0,frameTime:0,frameTimeSec:0,preCostTime:0,realVolume:1,isPlaying:!1,isCaching:l.CACHE_NO_LOADCACHE,isNewSeek:!1,flushDecoder:0,isCheckDisplay:!1,isPlayLoadingFinish:0,vCachePTS:0,aCachePTS:0,showScreen:!1,noCacheFrame:0,onPlayingTime:null,onPlayingFinish:null,onSeekFinish:null,onLoadCache:null,onLoadCacheFinshed:null,onRender:null,setScreen:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null!=t&&(t.showScreen=e)},setSize:function(e,i){t.config.width=e||l.DEFAULT_WIDTH,t.config.height=i||l.DEFAULT_HEIGHT},setFrameRate:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:25;t.config.fps=e,t.config.frameDurMs=1e3/e},setDurationMs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;t.durationMs=e,0==t.config.audioNone&&t.audio.setDurationMs(e)},setPlayingCall:function(e){t.onPlayingTime=e},setVoice:function(e){t.realVolume=e,0==t.config.audioNone&&t.audio.setVoice(t.realVolume)},isPlayingState:function(){return t.isPlaying||t.isCaching===l.CACHE_WITH_PLAY_SIGN},appendAACFrame:function(e){t.audio.addSample(e),t.aCachePTS=Math.max(e.pts,t.aCachePTS)},appendHevcFrame:function(e){var i;t.config.appendHevcType==l.APPEND_TYPE_STREAM?t.stream=new Uint8Array((i=n(t.stream)).concat.apply(i,n(e))):t.config.appendHevcType==l.APPEND_TYPE_FRAME&&(t.frameList.push(e),t.vCachePTS=Math.max(e.pts,t.vCachePTS))},getCachePTS:function(){return Math.max(t.vCachePTS,t.aCachePTS)},endAudio:function(){0==t.config.audioNone&&t.audio.stop()},cleanSample:function(){0==t.config.audioNone&&t.audio.cleanQueue()},cleanVideoQueue:function(){t.config.appendHevcType==l.APPEND_TYPE_STREAM?t.stream=new Uint8Array:t.config.appendHevcType==l.APPEND_TYPE_FRAME&&(t.frameList=[],t.frameList.length=0)},cleanCacheYUV:function(){t.cacheYuvBuf.cleanPipeline()},pause:function(){t.loop&&window.clearInterval(t.loop),t.loop=null,0==t.config.audioNone&&t.audio.pause(),t.isPlaying=!1,t.isCaching===l.CACHE_WITH_PLAY_SIGN&&(t.isCaching=l.CACHE_WITH_NOPLAY_SIGN)},checkFinished:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.PLAYER_MODE_VOD;return e==l.PLAYER_MODE_VOD&&t.cacheYuvBuf.yuvCache.length<=0&&(t.videoPTS.toFixed(1)>=(t.durationMs-t.config.frameDurMs)/1e3||t.noCacheFrame>=10)&&(null!=t.onPlayingFinish&&(l.PLAYER_MODE_VOD,t.frameList.length,t.cacheYuvBuf.yuvCache.length,t.videoPTS.toFixed(1),t.durationMs,t.config.frameDurMs,t.noCacheFrame,t.onPlayingFinish()),!0)},clearAllCache:function(){t.nowPacket=null,t.vCachePTS=0,t.aCachePTS=0,t.cleanSample(),t.cleanVideoQueue(),t.cleanCacheYUV()},seek:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isPlaying;t.pause(),t.stopCacheThread(),t.clearAllCache(),e&&e(),t.isNewSeek=!0,t.flushDecoder=1,t.videoPTS=parseInt(i.seekTime);var r={seekPos:i.seekTime||-1,mode:i.mode||l.PLAYER_MODE_VOD,accurateSeek:i.accurateSeek||!0,seekEvent:i.seekEvent||!0,realPlay:n};t.cacheThread(),t.play(r)},getNalu1Packet:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=null,n=-1;if(t.config.appendHevcType==l.APPEND_TYPE_STREAM)i=t.nextNalu();else{if(t.config.appendHevcType!=l.APPEND_TYPE_FRAME)return null;var r=t.frameList.shift();if(!r)return null;i=r.data,n=r.pts,e&&(t.videoPTS=n)}return{nalBuf:i,pts:n}},decodeNalu1Frame:function(e,i){var n=Module._malloc(e.length);Module.HEAP8.set(e,n);var r=parseInt(1e3*i);Module.cwrap("decodeCodecContext","number",["number","number","number","number","number"])(t.vcodecerPtr,n,e.length,r,t.flushDecoder);return t.flushDecoder=0,Module._free(n),n=null,!1},cacheThread:function(){t.cacheLoop=window.setInterval((function(){if(t.cacheYuvBuf.getState()!=CACHE_APPEND_STATUS_CODE.FULL){var e=t.getNalu1Packet(!1);if(null!=e){var i=e.nalBuf,n=e.pts;t.decodeNalu1Frame(i,n,!0)}}}),10)},stopCacheThread:function(){null!==t.cacheLoop&&(window.clearInterval(t.cacheLoop),t.cacheLoop=null)},loadCache:function(){if(!(t.frameList.length<=3)){var e=t.isPlaying;if(t.cacheYuvBuf.yuvCache.length<=3){t.pause(),null!=t.onLoadCache&&t.onLoadCache(),t.isCaching=e?l.CACHE_WITH_PLAY_SIGN:l.CACHE_WITH_NOPLAY_SIGN;var i=t.frameList.length>30?30:t.frameList.length;null===t.cacheInterval&&(t.cacheInterval=window.setInterval((function(){t.cacheYuvBuf.yuvCache.length>=i&&(null!=t.onLoadCacheFinshed&&t.onLoadCacheFinshed(),window.clearInterval(t.cacheInterval),t.cacheInterval=null,t.isCaching===l.CACHE_WITH_PLAY_SIGN&&t.play(t.playParams),t.isCaching=l.CACHE_NO_LOADCACHE)}),40))}}},playFunc:function(){var e=!1;if(t.playParams.seekEvent||r.GetMsTime()-t.calcuteStartTime>=t.frameTime-t.preCostTime){e=!0;var i=!0;if(t.calcuteStartTime=r.GetMsTime(),t.config.audioNone)t.playFrameYUV(i,t.playParams.accurateSeek);else{t.fix_poc_err_skip>0&&(t.fix_poc_err_skip--,i=!1);var n=t.videoPTS-t.audio.getAlignVPTS();if(n>0)return void(t.playParams.seekEvent&&!t.config.audioNone&&t.audio.setVoice(0));if(i){if(!(i=-1*n<=1*t.frameTimeSec)){for(var a=parseInt(n/t.frameTimeSec),s=0;s<a;s++)t.playFrameYUV(!1,t.playParams.accurateSeek);t.playFrameYUV(!0,t.playParams.accurateSeek)}t.playFrameYUV(i,t.playParams.accurateSeek)}}}return t.playParams.seekEvent&&(t.playParams.seekEvent=!1,t.onSeekFinish(),t.isPlaying||(t.playFrameYUV(!0,t.playParams.accurateSeek),t.pause()),t.config.audioNone||t.audio.setVoice(t.realVolume)),t.onPlayingTime&&t.onPlayingTime(t.videoPTS),t.checkFinished(t.playParams.mode),e},play:function(e){if(t.playParams=e,t.calcuteStartTime=r.GetMsTime(),t.noCacheFrame=0,t.isPlaying=t.playParams.realPlay,!0===t.config.audioNone&&t.playParams.mode==l.PLAYER_MODE_NOTIME_LIVE){t.liveStartMs=r.GetMsTime(),t.frameTime=Math.floor(1e3/t.config.fps),t.frameTimeSec=t.frameTime/1e3;var i=0;t.loop=window.setInterval((function(){var e=r.GetMsTime()-t.liveStartMs,n=e/t.frameTime;n>=i&&(t.playFrameYUV(!0,t.playParams.accurateSeek),i+=1)}),1)}else t.videoPTS>=t.playParams.seekPos&&!t.isNewSeek||0===t.playParams.seekPos||0===t.playParams.seekPos?(t.frameTime=1e3/t.config.fps,t.frameTimeSec=t.frameTime/1e3,0==t.config.audioNone&&t.audio.play(),t.realVolume=t.config.audioNone?0:t.audio.voice,t.playParams.seekEvent&&(t.fix_poc_err_skip=10),t.loop=window.setInterval((function(){var e=r.GetMsTime();t.playFunc(),t.preCostTime=r.GetMsTime()-e}),1)):(t.loop=window.setInterval((function(){t.playFrameYUV(!1,t.playParams.accurateSeek),t.checkFinished(t.playParams.mode)?(window.clearInterval(t.loop),t.loop=null):t.videoPTS>=t.playParams.seekPos&&(window.clearInterval(t.loop),t.loop=null,t.play(t.playParams))}),1),t.isNewSeek=!1)},stop:function(){t.release(),Module.cwrap("initializeDecoder","number",["number"])(t.vcodecerPtr),t.stream=new Uint8Array},release:function(){return void 0!==t.yuv&&null!==t.yuv&&(u.releaseContext(t.yuv),t.yuv=null),t.endAudio(),t.cacheLoop&&window.clearInterval(t.cacheLoop),t.cacheLoop=null,t.loop&&window.clearInterval(t.loop),t.loop=null,t.pause(),null!==t.videoCallback&&Module.removeFunction(t.videoCallback),t.videoCallback=null,Module.cwrap("release","number",["number"])(t.vcodecerPtr),t.stream=null,t.frameList.length=0,t.durationMs=-1,t.videoPTS=0,t.isPlaying=!1,t.canvas.remove(),t.canvas=null,window.onclick=document.body.onclick=null,!0},nextNalu:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(t.stream.length<=4)return!1;for(var i=-1,n=0;n<t.stream.length;n++){if(n+5>=t.stream.length){if(-1==i)return!1;var r=t.stream.subarray(i);return t.stream=new Uint8Array,r}var a="0 0 1"==t.stream.slice(0,3).join(" "),s="0 0 0 1"==t.stream.slice(0,4).join(" ");if(a||s){if(-1==i)i=n;else{if(e<=1){var o=t.stream.subarray(i,n);return t.stream=t.stream.subarray(n),o}e-=1}n+=3}}return!1},decodeSendPacket:function(e){var i=Module._malloc(e.length);Module.HEAP8.set(e,i);var n=Module.cwrap("decodeSendPacket","number",["number","number","number"])(t.vcodecerPtr,i,e.length);return Module._free(i),n},decodeRecvFrame:function(){return Module.cwrap("decodeRecv","number",["number"])(t.vcodecerPtr)},playYUV:function(){return t.playFrameYUV(!0,!0)},playFrameYUV:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.cacheYuvBuf.vYuv();if(null==n)return t.noCacheFrame+=1,e&&!t.playParams.seekEvent&&t.loadCache(),!1;t.noCacheFrame=0;var r=n.pts;return t.videoPTS=r,(!e&&i||e)&&e&&(t.onRender(n.width,n.height,n.imageBufferY,n.imageBufferB,n.imageBufferR),t.drawImage(n.width,n.height,n.imageBufferY,n.imageBufferB,n.imageBufferR)),e&&!t.playParams.seekEvent&&t.isPlaying&&t.loadCache(),!0},drawImage:function(e,i,n,r,a){if(t.canvas.width===e&&t.canvas.height==i||(t.canvas.width=e,t.canvas.height=i),t.showScreen&&null!=t.onRender&&t.onRender(e,i,n,r,a),!t.isCheckDisplay)t.checkDisplaySize(e,i);var s=e*i,o=e/2*(i/2),l=new Uint8Array(s+2*o);l.set(n,0),l.set(r,s),l.set(a,s+o),u.renderFrame(t.yuv,n,r,a,e,i)},debugYUV:function(e){t.debugYUVSwitch=!0,t.debugID=e},checkDisplaySize:function(e,i){var n=e/t.config.width>i/t.config.height,r=(t.config.width/e).toFixed(2),a=(t.config.height/i).toFixed(2),s=n?r:a,o=t.config.fixed,u=o?t.config.width:parseInt(e*s),l=o?t.config.height:parseInt(i*s);if(t.canvas.offsetWidth!=u||t.canvas.offsetHeight!=l){var h=parseInt((t.canvasBox.offsetHeight-l)/2),d=parseInt((t.canvasBox.offsetWidth-u)/2);t.canvas.style.marginTop=h+"px",t.canvas.style.marginLeft=d+"px",t.canvas.style.width=u+"px",t.canvas.style.height=l+"px"}return t.isCheckDisplay=!0,[u,l]},makeWasm:function(){if(null!=t.config.token){t.vcodecerPtr=Module.cwrap("registerPlayer","number",["string","string"])(t.config.token,h.PLAYER_VERSION),t.videoCallback=Module.addFunction((function(e,i,n,r,a,s,u,l,h){var d=Module.HEAPU8.subarray(e,e+r*l),c=Module.HEAPU8.subarray(i,i+a*l/2),f=Module.HEAPU8.subarray(n,n+s*l/2),p=new Uint8Array(d),m=new Uint8Array(c),_=new Uint8Array(f),g=1*h/1e3,v=new o.CacheYuvStruct(g,r,l,p,m,_);Module._free(d),d=null,Module._free(c),c=null,Module._free(f),f=null,t.cacheYuvBuf.appendCacheByCacheYuv(v)})),Module.cwrap("setCodecType","number",["number","number","number"])(t.vcodecerPtr,t.config.videoCodec,t.videoCallback);Module.cwrap("initializeDecoder","number",["number"])(t.vcodecerPtr)}},makeIt:function(){var e=document.querySelector("div#"+t.config.playerId),i=document.createElement("canvas");i.style.width=e.clientWidth+"px",i.style.height=e.clientHeight+"px",i.style.top="0px",i.style.left="0px",e.appendChild(i),t.canvasBox=e,t.canvas=i,t.yuv=u.setupCanvas(i,{preserveDrawingBuffer:!1}),0==t.config.audioNone&&(t.audio=a({sampleRate:t.config.sampleRate,appendType:t.config.appendHevcType})),t.isPlayLoadingFinish=1}};return t.makeWasm(),t.makeIt(),t.cacheThread(),t}},{"../consts":52,"../render-engine/webgl-420p":81,"../version":84,"./audio-core":54,"./av-common":56,"./cache":61,"./cacheYuv":62}],66:[function(e,t,i){"use strict";var n=e("./bufferFrame");t.exports=function(){var e={videoBuffer:[],audioBuffer:[],idrIdxBuffer:[],appendFrame:function(t,i){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=new n.BufferFrame(t,a,i,r),o=parseInt(t);return r?(e.videoBuffer.length-1>=o?e.videoBuffer[o].push(s):e.videoBuffer.push([s]),a&&!e.idrIdxBuffer.includes(t)&&e.idrIdxBuffer.push(t)):e.audioBuffer.length-1>=o&&null!=e.audioBuffer[o]&&null!=e.audioBuffer[o]?e.audioBuffer[o]&&e.audioBuffer[o].push(s):e.audioBuffer.push([s]),!0},appendFrameWithDts:function(t,i,r){var a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=n.ConstructWithDts(t,i,s,r,a),u=parseInt(i);return a?(e.videoBuffer.length-1>=u?e.videoBuffer[u].push(o):e.videoBuffer.push([o]),s&&!e.idrIdxBuffer.includes(i)&&e.idrIdxBuffer.push(i)):e.audioBuffer.length-1>=u&&null!=e.audioBuffer[u]&&null!=e.audioBuffer[u]?e.audioBuffer[u]&&e.audioBuffer[u].push(o):e.audioBuffer.push([o]),e.videoBuffer,e.idrIdxBuffer,!0},appendFrameByBufferFrame:function(t){var i=t.pts,n=parseInt(i);return t.video?(e.videoBuffer.length-1>=n?e.videoBuffer[n].push(t):e.videoBuffer.push([t]),isKey&&!e.idrIdxBuffer.includes(i)&&e.idrIdxBuffer.push(i)):e.audioBuffer.length-1>=n?e.audioBuffer[n].push(t):e.audioBuffer.push([t]),!0},cleanPipeline:function(){e.videoBuffer.length=0,e.audioBuffer.length=0},vFrame:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(!(t<0||t>e.videoBuffer.length-1))return e.videoBuffer[t]},aFrame:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(!(t<0||t>e.audioBuffer.length-1))return e.audioBuffer[t]},seekIDR:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e.idrIdxBuffer,e.videoBuffer,t<0)return null;if(e.idrIdxBuffer.includes(t))return t;for(var i=0;i<e.idrIdxBuffer.length;i++)if(i===e.idrIdxBuffer.length-1||e.idrIdxBuffer[i]<t&&e.idrIdxBuffer[i+1]>t||0===i&&e.idrIdxBuffer[i]>=t){for(var n=1;n>=0;n--){var r=i-n;if(r>=0)return e.idrIdxBuffer[r],e.idrIdxBuffer[r]}return e.idrIdxBuffer[i],j,e.idrIdxBuffer[i]}}};return e}},{"./bufferFrame":67}],67:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(t,i,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pts=t,this.dts=t,this.isKey=i,this.data=n,this.video=r}var t,i,r;return t=e,(i=[{key:"setFrame",value:function(e,t,i,n){this.pts=e,this.isKey=t,this.data=i,this.video=n}}])&&n(t.prototype,i),r&&n(t,r),e}();i.BufferFrame=r,i.ConstructWithDts=function(e,t,i,n,a){var s=new r(e,i,n,a);return s.dts=t,s}},{}],68:[function(e,t,i){(function(e){"use strict";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)}var r,a;r=self,a=function(){return function(){var t={"./node_modules/es6-promise/dist/es6-promise.js":
-/*!******************************************************!*\
- !*** ./node_modules/es6-promise/dist/es6-promise.js ***!
- \******************************************************/
-function(t,i,r){
-/*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version v4.2.8+1e68dce6
- */
-t.exports=function(){function t(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=0,s=void 0,o=void 0,u=function(e,t){m[a]=e,m[a+1]=t,2===(a+=2)&&(o?o(_):S())},l="undefined"!=typeof window?window:void 0,h=l||{},d=h.MutationObserver||h.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(_,1)}}var m=new Array(1e3);function _(){for(var e=0;e<a;e+=2)(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0;a=0}var g,v,y,b,S=void 0;function T(e,t){var i=this,n=new this.constructor(A);void 0===n[w]&&U(n);var r=i._state;if(r){var a=arguments[r-1];u((function(){return D(r,n,a,i._result)}))}else x(i,n,e,t);return n}function E(e){if(e&&"object"===n(e)&&e.constructor===this)return e;var t=new this(A);return k(t,e),t}c?S=function(){return e.nextTick(_)}:d?(v=0,y=new d(_),b=document.createTextNode(""),y.observe(b,{characterData:!0}),S=function(){b.data=v=++v%2}):f?((g=new MessageChannel).port1.onmessage=_,S=function(){return g.port2.postMessage(0)}):S=void 0===l?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(_)}:p()}catch(e){return p()}}():p();var w=Math.random().toString(36).substring(2);function A(){}function C(e,i,n){i.constructor===e.constructor&&n===T&&i.constructor.resolve===E?function(e,t){1===t._state?I(e,t._result):2===t._state?L(e,t._result):x(t,void 0,(function(t){return k(e,t)}),(function(t){return L(e,t)}))}(e,i):void 0===n?I(e,i):t(n)?function(e,t,i){u((function(e){var n=!1,r=function(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}(i,t,(function(i){n||(n=!0,t!==i?k(e,i):I(e,i))}),(function(t){n||(n=!0,L(e,t))}),e._label);!n&&r&&(n=!0,L(e,r))}),e)}(e,i,n):I(e,i)}function k(e,t){if(e===t)L(e,new TypeError("You cannot resolve a promise with itself"));else if(a=n(r=t),null===r||"object"!==a&&"function"!==a)I(e,t);else{var i=void 0;try{i=t.then}catch(t){return void L(e,t)}C(e,t,i)}var r,a}function P(e){e._onerror&&e._onerror(e._result),R(e)}function I(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&u(R,e))}function L(e,t){void 0===e._state&&(e._state=2,e._result=t,u(P,e))}function x(e,t,i,n){var r=e._subscribers,a=r.length;e._onerror=null,r[a]=t,r[a+1]=i,r[a+2]=n,0===a&&e._state&&u(R,e)}function R(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,a=e._result,s=0;s<t.length;s+=3)n=t[s],r=t[s+i],n?D(i,n,r,a):r(a);e._subscribers.length=0}}function D(e,i,n,r){var a=t(n),s=void 0,o=void 0,u=!0;if(a){try{s=n(r)}catch(e){u=!1,o=e}if(i===s)return void L(i,new TypeError("A promises callback cannot return that same promise."))}else s=r;void 0!==i._state||(a&&u?k(i,s):!1===u?L(i,o):1===e?I(i,s):2===e&&L(i,s))}var O=0;function U(e){e[w]=O++,e._state=void 0,e._result=void 0,e._subscribers=[]}var M=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(A),this.promise[w]||U(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&I(this.promise,this._result))):L(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===E){var r=void 0,a=void 0,s=!1;try{r=e.then}catch(e){s=!0,a=e}if(r===T&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===F){var o=new i(A);s?L(o,a):C(o,e,r),this._willSettleAt(o,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;void 0===n._state&&(this._remaining--,2===e?L(n,i):this._result[t]=i),0===this._remaining&&I(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;x(e,void 0,(function(e){return i._settledAt(1,t,e)}),(function(e){return i._settledAt(2,t,e)}))},e}(),F=function(){function e(t){this[w]=O++,this._result=this._state=void 0,this._subscribers=[],A!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t((function(t){k(e,t)}),(function(t){L(e,t)}))}catch(t){L(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this.constructor;return t(e)?this.then((function(t){return i.resolve(e()).then((function(){return t}))}),(function(t){return i.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return F.prototype.then=T,F.all=function(e){return new M(this,e).promise},F.race=function(e){var t=this;return i(e)?new t((function(i,n){for(var r=e.length,a=0;a<r;a++)t.resolve(e[a]).then(i,n)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},F.resolve=E,F.reject=function(e){var t=new this(A);return L(t,e),t},F._setScheduler=function(e){o=e},F._setAsap=function(e){u=e},F._asap=u,F.polyfill=function(){var e=void 0;if(void 0!==r.g)e=r.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=F},F.Promise=F,F}()},"./node_modules/events/events.js":
-/*!***************************************!*\
- !*** ./node_modules/events/events.js ***!
- \***************************************/
-function(e){var t,i="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,r=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,a),n(i)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}_(e,t,a,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&_(e,"error",t,i)}(e,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(e))}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,i,n){var r,a,s;if(u(i),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),a=e._events),s=a[t]),void 0===s)s=a[t]=i,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=l(e))>0&&s.length>r&&!s.warned){s.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=s.length,console&&console.warn}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=d.bind(n);return r.listener=i,n.wrapFn=r,r}function f(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(r):m(r,r.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function m(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function _(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+n(e));e.addEventListener(t,(function n(a){r.once&&e.removeEventListener(t,n),i(a)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,a=this._events;if(void 0!==a)n=n&&void 0===a.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var l=u.length,h=m(u,l);for(i=0;i<l;++i)r(h[i],this,t)}return!0},s.prototype.addListener=function(e,t){return h(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return h(this,e,t,!0)},s.prototype.once=function(e,t){return u(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var i,n,r,a,s;if(u(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){s=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var r,a=Object.keys(i);for(n=0;n<a.length;++n)"removeListener"!==(r=a[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/webworkify-webpack/index.js":
-/*!**************************************************!*\
- !*** ./node_modules/webworkify-webpack/index.js ***!
- \**************************************************/
-function(e,t,i){function n(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var n=i(i.s=ENTRY_MODULE);return n.default||n}function r(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var s=t.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var u,l=o[1],h=new RegExp("(\\\\n|\\W)"+r(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=h.exec(s);)"dll-reference"!==u[3]&&a[n].push(u[3]);for(h=new RegExp("\\("+r(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=h.exec(s);)e[u[2]]||(a[n].push(u[1]),e[u[2]]=i(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var d,c=Object.keys(a),f=0;f<c.length;f++)for(var p=0;p<a[c[f]].length;p++)d=a[c[f]][p],isNaN(1*d)||(a[c[f]][p]=1*a[c[f]][p]);return a}function s(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:i.m},o=t.all?{main:Object.keys(r.main)}:function(e,t){for(var i={main:[t]},n={main:[]},r={main:{}};s(i);)for(var o=Object.keys(i),u=0;u<o.length;u++){var l=o[u],h=i[l].pop();if(r[l]=r[l]||{},!r[l][h]&&e[l][h]){r[l][h]=!0,n[l]=n[l]||[],n[l].push(h);for(var d=a(e,e[l][h],l),c=Object.keys(d),f=0;f<c.length;f++)i[c[f]]=i[c[f]]||[],i[c[f]]=i[c[f]].concat(d[c[f]])}}return n}(r,e),u="";Object.keys(o).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;o[e][t];)t++;o[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),u=u+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(t.bare)return l;var h=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),d=new window.Worker(h);return d.objectURL=h,d}},"./src/config.js":
-/*!***********************!*\
- !*** ./src/config.js ***!
- \***********************/
-function(e,t,i){i.r(t),i.d(t,{defaultConfig:function(){return n},createDefaultConfig:function(){return r}});var n={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function r(){return Object.assign({},n)}},"./src/core/features.js":
-/*!******************************!*\
- !*** ./src/core/features.js ***!
- \******************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ../io/io-controller.js */
-"./src/io/io-controller.js"),r=i(
-/*! ../config.js */
-"./src/config.js"),a=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new n.default({},(0,r.createDefaultConfig)()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.default({},(0,r.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}();t.default=a},"./src/core/media-info.js":
-/*!********************************!*\
- !*** ./src/core/media-info.js ***!
- \********************************/
-function(e,t,i){i.r(t);var n=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,n=e.length-1,r=0,a=0,s=n;for(t<e[0]&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?a=r+1:s=r-1}return i},e}();t.default=n},"./src/core/media-segment-info.js":
-/*!****************************************!*\
- !*** ./src/core/media-segment-info.js ***!
- \****************************************/
-function(e,t,i){i.r(t),i.d(t,{SampleInfo:function(){return n},MediaSegmentInfo:function(){return r},IDRSampleList:function(){return a},MediaSegmentInfoList:function(){return s}});var n=function(e,t,i,n,r){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=r,this.fileposition=null},r=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),a=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,n=t.length-1,r=0,a=0,s=n;for(e<t[0].dts&&(i=0,a=s+1);a<=s;){if((r=a+Math.floor((s-a)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?a=r+1:s=r-1}return this._list[i]},e}(),s=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,n=0,r=0,a=i,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){s=n;break}t[n].originalBeginDts<e?r=n+1:a=n-1}return s},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},"./src/core/mse-controller.js":
-/*!************************************!*\
- !*** ./src/core/mse-controller.js ***!
- \************************************/
-function(e,t,i){i.r(t);var n=i(
-/*! events */
-"./node_modules/events/events.js"),r=i.n(n),a=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),s=i(
-/*! ../utils/browser.js */
-"./src/utils/browser.js"),o=i(
-/*! ./mse-events.js */
-"./src/core/mse-events.js"),u=i(
-/*! ./media-segment-info.js */
-"./src/core/media-segment-info.js"),l=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),h=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(r()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new u.IDRSampleList}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new l.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(e){a.default.e(this.TAG,e.message)}n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){a.default.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,n=""+i.container;i.codec&&i.codec.length>0&&(n+=";codecs="+i.codec);var r=!1;if(a.default.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[i.type]=i,n!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])a.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+n);else{r=!0;try{var u=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(n);u.addEventListener("error",this.e.onSourceBufferError),u.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return a.default.e(this.TAG,e.message),void this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[i.type]=n}t||this._pendingSegments[i.type].push(i),r||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),s.default.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){a.default.e(this.TAG,e.message)}this._idrList.clear();var n=this._pendingSegments[t];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<i.buffered.length;r++){var o=i.buffered.start(r),u=i.buffered.end(r);this._pendingRemoveRanges[t].push({start:o,end:u})}if(i.updating||this._doRemoveRanges(),s.default.safari){var l=this._lastInitSegments[t];l&&(this._pendingSegments[t].push(l),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var n=i.buffered;if(n.length>=1&&e-n.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var n=i.buffered,r=!1,a=0;a<n.length;a++){var s=n.start(a),o=n.end(a);if(s<=e&&e<o+3){if(e-s>=this._config.autoCleanupMaxBackwardDuration){r=!0;var u=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:s,end:u})}}else o<e&&(r=!0,this._pendingRemoveRanges[t].push({start:s,end:o}))}r&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(a.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var n=i.shift();t.remove(n.start,n.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var n=this._sourceBuffers[t].timestampOffset,r=i.timestampOffset/1e3;Math.abs(n-r)>.1&&(a.default.v(this.TAG,"Update MPEG audio timestampOffset from "+n+" to "+r),this._sourceBuffers[t].timestampOffset=r),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(o.default.BUFFER_FULL),this._isBufferFull=!0):(a.default.e(this.TAG,t,e.message),this._emitter.emit(o.default.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(a.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(o.default.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){a.default.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){a.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return(e.video&&e.video.length)>0||e.audio&&e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return(e.video&&e.video.length)>0||e.audio&&e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(o.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){a.default.e(this.TAG,"SourceBuffer Error: "+e)},e}();t.default=h},"./src/core/mse-events.js":
-/*!********************************!*\
- !*** ./src/core/mse-events.js ***!
- \********************************/
-function(e,t,i){i.r(t),t.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},"./src/core/transmuxer.js":
-/*!********************************!*\
- !*** ./src/core/transmuxer.js ***!
- \********************************/
-function(e,t,i){i.r(t);var n=i(
-/*! events */
-"./node_modules/events/events.js"),r=i.n(n),a=i(
-/*! webworkify-webpack */
-"./node_modules/webworkify-webpack/index.js"),s=i.n(a),o=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),u=i(
-/*! ../utils/logging-control.js */
-"./src/utils/logging-control.js"),l=i(
-/*! ./transmuxing-controller.js */
-"./src/core/transmuxing-controller.js"),h=i(
-/*! ./transmuxing-events.js */
-"./src/core/transmuxing-events.js"),d=i(
-/*! ./media-info.js */
-"./src/core/media-info.js"),c=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(r()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=s()(
-/*! ./transmuxing-worker */
-"./src/core/transmuxing-worker.js"),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},u.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:u.default.getConfig()})}catch(i){o.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new l.default(e,t)}else this._controller=new l.default(e,t);if(this._controller){var i=this._controller;i.on(h.default.IO_ERROR,this._onIOError.bind(this)),i.on(h.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(h.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(h.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(h.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(h.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(h.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(h.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(h.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(h.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(h.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),u.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(h.default.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(h.default.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(h.default.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(h.default.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(h.default.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(h.default.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(h.default.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(h.default.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(h.default.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(h.default.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(h.default.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case h.default.INIT_SEGMENT:case h.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case h.default.LOADING_COMPLETE:case h.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case h.default.MEDIA_INFO:Object.setPrototypeOf(i,d.default.prototype),this._emitter.emit(t.msg,i);break;case h.default.METADATA_ARRIVED:case h.default.SCRIPTDATA_ARRIVED:case h.default.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case h.default.IO_ERROR:case h.default.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case h.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":o.default.emitter.emit("log",i.type,i.logcat)}},e}();t.default=c},"./src/core/transmuxing-controller.js":
-/*!********************************************!*\
- !*** ./src/core/transmuxing-controller.js ***!
- \********************************************/
-function(e,t,i){i.r(t);var n=i(
-/*! events */
-"./node_modules/events/events.js"),r=i.n(n),a=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),s=i(
-/*! ../utils/browser.js */
-"./src/utils/browser.js"),o=i(
-/*! ./media-info.js */
-"./src/core/media-info.js"),u=i(
-/*! ../demux/flv-demuxer.js */
-"./src/demux/flv-demuxer.js"),l=i(
-/*! ../remux/mp4-remuxer.js */
-"./src/remux/mp4-remuxer.js"),h=i(
-/*! ../demux/demux-errors.js */
-"./src/demux/demux-errors.js"),d=i(
-/*! ../io/io-controller.js */
-"./src/io/io-controller.js"),c=i(
-/*! ./transmuxing-events.js */
-"./src/core/transmuxing-events.js"),f=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(r()),this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(n){n.timestampBase=i,i+=n.duration,n.cors=e.cors,n.withCredentials=e.withCredentials,t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],n=this._ioctl=new d.default(i,this._config,e);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var n=i.getNearestKeyframe(e);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var r=this._mediaInfo.segments[t];null==r?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(n=r.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,n=0;n<t.length;n++)if(e<t[n].timestampBase){i=n-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,n=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((n=u.default.probe(e)).match){this._demuxer=new u.default(n,this._config),this._remuxer||(this._remuxer=new l.default(this._config));var s=this._mediaDataSource;null==s.duration||isNaN(s.duration)||(this._demuxer.overridedDuration=s.duration),"boolean"==typeof s.hasAudio&&(this._demuxer.overridedHasAudio=s.hasAudio),"boolean"==typeof s.hasVideo&&(this._demuxer.overridedHasVideo=s.hasVideo),this._demuxer.timestampBase=s.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),r=this._demuxer.parseChunks(e,t)}else n=null,a.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(c.default.DEMUX_ERROR,h.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),r=0;return r},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,o.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,o.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(c.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(c.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(c.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(c.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){a.default.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(c.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){a.default.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(c.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(c.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(c.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.default.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(c.default.RECOMMEND_SEEKPOINT,n)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(c.default.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(c.default.STATISTICS_INFO,e)},e}();t.default=f},"./src/core/transmuxing-events.js":
-/*!****************************************!*\
- !*** ./src/core/transmuxing-events.js ***!
- \****************************************/
-function(e,t,i){i.r(t),t.default={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},"./src/core/transmuxing-worker.js":
-/*!****************************************!*\
- !*** ./src/core/transmuxing-worker.js ***!
- \****************************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ../utils/logging-control.js */
-"./src/utils/logging-control.js"),r=i(
-/*! ../utils/polyfill.js */
-"./src/utils/polyfill.js"),a=i(
-/*! ./transmuxing-controller.js */
-"./src/core/transmuxing-controller.js"),s=i(
-/*! ./transmuxing-events.js */
-"./src/core/transmuxing-events.js");t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function o(t,i){var n={msg:s.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function u(t,i){var n={msg:s.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function l(){var t={msg:s.default.LOADING_COMPLETE};e.postMessage(t)}function h(){var t={msg:s.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function d(t){var i={msg:s.default.MEDIA_INFO,data:t};e.postMessage(i)}function c(t){var i={msg:s.default.METADATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:s.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:s.default.STATISTICS_INFO,data:t};e.postMessage(i)}function m(t,i){e.postMessage({msg:s.default.IO_ERROR,data:{type:t,info:i}})}function _(t,i){e.postMessage({msg:s.default.DEMUX_ERROR,data:{type:t,info:i}})}function g(t){e.postMessage({msg:s.default.RECOMMEND_SEEKPOINT,data:t})}r.default.install(),e.addEventListener("message",(function(r){switch(r.data.cmd){case"init":(t=new a.default(r.data.param[0],r.data.param[1])).on(s.default.IO_ERROR,m.bind(this)),t.on(s.default.DEMUX_ERROR,_.bind(this)),t.on(s.default.INIT_SEGMENT,o.bind(this)),t.on(s.default.MEDIA_SEGMENT,u.bind(this)),t.on(s.default.LOADING_COMPLETE,l.bind(this)),t.on(s.default.RECOVERED_EARLY_EOF,h.bind(this)),t.on(s.default.MEDIA_INFO,d.bind(this)),t.on(s.default.METADATA_ARRIVED,c.bind(this)),t.on(s.default.SCRIPTDATA_ARRIVED,f.bind(this)),t.on(s.default.STATISTICS_INFO,p.bind(this)),t.on(s.default.RECOMMEND_SEEKPOINT,g.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(r.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var v=r.data.param;n.default.applyConfig(v),!0===v.enableCallback?n.default.addLogListener(i):n.default.removeLogListener(i)}}))}},"./src/demux/amf-parser.js":
-/*!*********************************!*\
- !*** ./src/demux/amf-parser.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n,r=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),a=i(
-/*! ../utils/utf8-conv.js */
-"./src/utils/utf8-conv.js"),s=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),o=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),u=function(){function e(){}return e.parseScriptData=function(t,i,n){var a={};try{var s=e.parseValue(t,i,n),o=e.parseValue(t,i+s.size,n-s.size);a[s.data]=o.data}catch(e){r.default.e("AMF",e.toString())}return a},e.parseObject=function(t,i,n){if(n<3)throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),a=e.parseValue(t,i+r.size,n-r.size),o=a.objectEnd;return{data:{name:r.data,value:a.data},size:r.size+a.size,objectEnd:o}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new s.IllegalStateException("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!o);return{data:n>0?(0,a.default)(new Uint8Array(e,t+2,n)):"",size:2+n}},e.parseLongString=function(e,t,i){if(i<4)throw new s.IllegalStateException("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!o);return{data:n>0?(0,a.default)(new Uint8Array(e,t+4,n)):"",size:4+n}},e.parseDate=function(e,t,i){if(i<10)throw new s.IllegalStateException("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!o),a=n.getInt16(8,!o);return{data:new Date(r+=60*a*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new s.IllegalStateException("Data not enough when parse Value");var a,u=new DataView(t,i,n),l=1,h=u.getUint8(0),d=!1;try{switch(h){case 0:a=u.getFloat64(1,!o),l+=8;break;case 1:a=!!u.getUint8(1),l+=1;break;case 2:var c=e.parseString(t,i+1,n-1);a=c.data,l+=c.size;break;case 3:a={};var f=0;for(9==(16777215&u.getUint32(n-4,!o))&&(f=3);l<n-4;){var p=e.parseObject(t,i+l,n-l-f);if(p.objectEnd)break;a[p.data.name]=p.data.value,l+=p.size}l<=n-3&&9==(16777215&u.getUint32(l-1,!o))&&(l+=3);break;case 8:for(a={},l+=4,f=0,9==(16777215&u.getUint32(n-4,!o))&&(f=3);l<n-8;){var m=e.parseVariable(t,i+l,n-l-f);if(m.objectEnd)break;a[m.data.name]=m.data.value,l+=m.size}l<=n-3&&9==(16777215&u.getUint32(l-1,!o))&&(l+=3);break;case 9:a=void 0,l=1,d=!0;break;case 10:a=[];var _=u.getUint32(1,!o);l+=4;for(var g=0;g<_;g++){var v=e.parseValue(t,i+l,n-l);a.push(v.data),l+=v.size}break;case 11:var y=e.parseDate(t,i+1,n-1);a=y.data,l+=y.size;break;case 12:var b=e.parseString(t,i+1,n-1);a=b.data,l+=b.size;break;default:l=n,r.default.w("AMF","Unsupported AMF value type "+h)}}catch(e){r.default.e("AMF",e.toString())}return{data:a,size:l,objectEnd:d}},e}();t.default=u},"./src/demux/demux-errors.js":
-/*!***********************************!*\
- !*** ./src/demux/demux-errors.js ***!
- \***********************************/
-function(e,t,i){i.r(t),t.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},"./src/demux/exp-golomb.js":
-/*!*********************************!*\
- !*** ./src/demux/exp-golomb.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),r=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new n.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new n.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,i=i<<a|s},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}();t.default=r},"./src/demux/flv-demuxer.js":
-/*!**********************************!*\
- !*** ./src/demux/flv-demuxer.js ***!
- \**********************************/
-function(e,t,i){i.r(t);var r=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),a=i(
-/*! ./amf-parser.js */
-"./src/demux/amf-parser.js"),s=i(
-/*! ./sps-parser.js */
-"./src/demux/sps-parser.js"),o=i(
-/*! ./hevc-sps-parser.js */
-"./src/demux/hevc-sps-parser.js"),u=i(
-/*! ./demux-errors.js */
-"./src/demux/demux-errors.js"),l=i(
-/*! ../core/media-info.js */
-"./src/core/media-info.js"),h=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),d=function(){function e(e,t){var i;this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new l.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=(i=new ArrayBuffer(2),new DataView(i).setInt16(0,256,!0),256===new Int16Array(i)[0])}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r,a=(4&t[4])>>>2!=0,s=0!=(1&t[4]),o=(n=t)[r=5]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3];return o<9?i:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:a,hasVideoTrack:s}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new l.default},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new h.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0,a=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;n=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+n!==this._dataOffset&&r.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(s=new DataView(t,n)).getUint32(0,!a)&&r.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),n+=4);n<t.byteLength;){this._dispatch=!0;var s=new DataView(t,n);if(n+11+4>t.byteLength)break;var o=s.getUint8(0),u=16777215&s.getUint32(0,!a);if(n+11+u+4>t.byteLength)break;if(8===o||9===o||18===o){var l=s.getUint8(4),d=s.getUint8(5),c=s.getUint8(6)|d<<8|l<<16|s.getUint8(7)<<24;0!=(16777215&s.getUint32(7,!a))&&r.default.w(this.TAG,"Meet tag which has StreamID != 0!");var f=n+11;switch(o){case 8:this._parseAudioData(t,f,u,c);break;case 9:this._parseVideoData(t,f,u,c,i+n);break;case 18:this._parseScriptData(t,f,u)}var p=s.getUint32(11+u,!a);p!==11+u&&r.default.w(this.TAG,"Invalid PrevTagSize "+p),n+=11+u+4}else r.default.w(this.TAG,"Unsupported tag type "+o+", skipped"),n+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),n},e.prototype._parseScriptData=function(e,t,i){var s=a.default.parseScriptData(e,t,i);if(s.hasOwnProperty("onMetaData")){if(null==s.onMetaData||"object"!==n(s.onMetaData))return void r.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&r.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=s;var o=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},o)),"boolean"==typeof o.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=o.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof o.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=o.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof o.audiodatarate&&(this._mediaInfo.audioDataRate=o.audiodatarate),"number"==typeof o.videodatarate&&(this._mediaInfo.videoDataRate=o.videodatarate),"number"==typeof o.width&&(this._mediaInfo.width=o.width),"number"==typeof o.height&&(this._mediaInfo.height=o.height),"number"==typeof o.duration){if(!this._durationOverrided){var u=Math.floor(o.duration*this._timescale);this._duration=u,this._mediaInfo.duration=u}}else this._mediaInfo.duration=0;if("number"==typeof o.framerate){var l=Math.floor(1e3*o.framerate);if(l>0){var h=l/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=l,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=h}}if("object"===n(o.keyframes)){this._mediaInfo.hasKeyframesIndex=!0;var d=o.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(d),o.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=o,r.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(s).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},s))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,n){if(i<=1)r.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var a=new DataView(e,t,i).getUint8(0),s=a>>>4;if(2===s||10===s){var o=0,l=(12&a)>>>2;if(l>=0&&l<=4){o=this._flvSoundRateTable[l];var h=1&a,d=this._audioMetadata,c=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=c.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=o,d.channelCount=0===h?1:2),10===s){var f=this._parseAACAudioData(e,t+1,i-1);if(null==f)return;if(0===f.packetType){d.config&&r.default.w(this.TAG,"Found another AudioSpecificConfig!");var p=f.data;d.audioSampleRate=p.samplingRate,d.channelCount=p.channelCount,d.codec=p.codec,d.originalCodec=p.originalCodec,d.config=p.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,r.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d),(g=this._mediaInfo).audioCodec=d.originalCodec,g.audioSampleRate=d.audioSampleRate,g.audioChannelCount=d.channelCount,g.hasVideo?null!=g.videoCodec&&(g.mimeType='video/x-flv; codecs="'+g.videoCodec+","+g.audioCodec+'"'):g.mimeType='video/x-flv; codecs="'+g.audioCodec+'"',g.isComplete()&&this._onMediaInfo(g)}else if(1===f.packetType){var m=this._timestampBase+n,_={unit:f.data,length:f.data.byteLength,dts:m,pts:m};c.samples.push(_),c.length+=f.data.length}else r.default.e(this.TAG,"Flv: Unsupported AAC data type "+f.packetType)}else if(2===s){if(!d.codec){var g;if(null==(p=this._parseMP3AudioData(e,t+1,i-1,!0)))return;d.audioSampleRate=p.samplingRate,d.channelCount=p.channelCount,d.codec=p.codec,d.originalCodec=p.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,r.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d),(g=this._mediaInfo).audioCodec=d.codec,g.audioSampleRate=d.audioSampleRate,g.audioChannelCount=d.channelCount,g.audioDataRate=p.bitRate,g.hasVideo?null!=g.videoCodec&&(g.mimeType='video/x-flv; codecs="'+g.videoCodec+","+g.audioCodec+'"'):g.mimeType='video/x-flv; codecs="'+g.audioCodec+'"',g.isComplete()&&this._onMediaInfo(g)}var v=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==v)return;m=this._timestampBase+n;var y={unit:v,length:v.byteLength,dts:m,pts:m};c.samples.push(y),c.length+=v.length}}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+l)}else this._onError(u.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+s)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var n={},a=new Uint8Array(e,t,i);return n.packetType=a[0],0===a[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=a.subarray(1),n}r.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,a=new Uint8Array(e,t,i),s=null,o=0,l=null;if(o=n=a[0]>>>3,(r=(7&a[0])<<1|a[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(u.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var h=this._mpegSamplingRates[r],d=(120&a[1])>>>3;if(!(d<0||d>=8)){5===o&&(l=(7&a[1])<<1|a[2]>>>7,a[2]);var c=self.navigator.userAgent.toLowerCase();return-1!==c.indexOf("firefox")?r>=6?(o=5,s=new Array(4),l=r-3):(o=2,s=new Array(2),l=r):-1!==c.indexOf("android")?(o=2,s=new Array(2),l=r):(o=5,l=r,s=new Array(4),r>=6?l=r-3:1===d&&(o=2,s=new Array(2),l=r)),s[0]=o<<3,s[0]|=(15&r)>>>1,s[1]=(15&r)<<7,s[1]|=(15&d)<<3,5===o&&(s[1]|=(15&l)>>>1,s[2]=(1&l)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:h,channelCount:d,codec:"mp4a.40."+o,originalCodec:"mp4a.40."+n}}this._onError(u.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,n){if(!(i<4)){this._littleEndian;var a=new Uint8Array(e,t,i),s=null;if(n){if(255!==a[0])return;var o=a[1]>>>3&3,u=(6&a[1])>>1,l=(240&a[2])>>>4,h=(12&a[2])>>>2,d=3!=(a[3]>>>6&3)?2:1,c=0,f=0;switch(o){case 0:c=this._mpegAudioV25SampleRateTable[h];break;case 2:c=this._mpegAudioV20SampleRateTable[h];break;case 3:c=this._mpegAudioV10SampleRateTable[h]}switch(u){case 1:l<this._mpegAudioL3BitRateTable.length&&(f=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(f=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(f=this._mpegAudioL1BitRateTable[l])}s={bitRate:f,samplingRate:c,channelCount:d,codec:"mp3",originalCodec:"mp3"}}else s=a;return s}r.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,n,a){if(i<=1)r.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var s=new Uint8Array(e,t,i)[0],o=(240&s)>>>4,l=15&s;7===l||12===l?7===l?this._parseAVCVideoPacket(e,t+1,i-1,n,a,o):12===l&&this._parseHVCVideoPacket(e,t+1,i-1,n,a,o):this._onError(u.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+l)}},e.prototype._parseAVCVideoPacket=function(e,t,i,n,a,s){if(i<4)r.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,l=new DataView(e,t,i),h=l.getUint8(0),d=(16777215&l.getUint32(0,!o))<<8>>8;if(0===h)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===h)this._parseAVCVideoData(e,t+4,i-4,n,a,s,d);else if(2!==h)return void this._onError(u.default.FORMAT_ERROR,"Flv: Invalid video packet type "+h)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)r.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,a=this._videoTrack,o=this._littleEndian,l=new DataView(e,t,i);n?void 0!==n.avcc&&r.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=a.id,n.timescale=this._timescale,n.duration=this._duration);var h=l.getUint8(0),d=l.getUint8(1);if(l.getUint8(2),l.getUint8(3),1===h&&0!==d)if(this._naluLengthSize=1+(3&l.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var c=31&l.getUint8(5);if(0!==c){c>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+c);for(var f=6,p=0;p<c;p++){var m=l.getUint16(f,!o);if(f+=2,0!==m){var _=new Uint8Array(e,t+f,m);f+=m;var g=s.default.parseSPS(_);if(0===p){n.codecWidth=g.codec_size.width,n.codecHeight=g.codec_size.height,n.presentWidth=g.present_size.width,n.presentHeight=g.present_size.height,n.profile=g.profile_string,n.level=g.level_string,n.bitDepth=g.bit_depth,n.chromaFormat=g.chroma_format,n.sarRatio=g.sar_ratio,n.frameRate=g.frame_rate,!1!==g.frame_rate.fixed&&0!==g.frame_rate.fps_num&&0!==g.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var v=n.frameRate.fps_den,y=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(v/y);for(var b=_.subarray(1,4),S="avc1.",T=0;T<3;T++){var E=b[T].toString(16);E.length<2&&(E="0"+E),S+=E}n.codec=S;var w=this._mediaInfo;w.width=n.codecWidth,w.height=n.codecHeight,w.fps=n.frameRate.fps,w.profile=n.profile,w.level=n.level,w.refFrames=g.ref_frames,w.chromaFormat=g.chroma_format_string,w.sarNum=n.sarRatio.width,w.sarDen=n.sarRatio.height,w.videoCodec=S,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&this._onMediaInfo(w)}}}var A=l.getUint8(f);if(0!==A){for(A>1&&r.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+A),f++,p=0;p<A;p++)m=l.getUint16(f,!o),f+=2,0!==m&&(f+=m);n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,n,a,s,o){for(var u=this._littleEndian,l=new DataView(e,t,i),h=[],d=0,c=0,f=this._naluLengthSize,p=this._timestampBase+n,m=1===s;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+c+", dataSize = "+i);break}var _=l.getUint32(c,!u);if(3===f&&(_>>>=8),_>i-f)return void r.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var g=31&l.getUint8(c+f);5===g&&(m=!0);var v=new Uint8Array(e,t+c,f+_),y={type:g,data:v};h.push(y),d+=v.byteLength,c+=f+_}if(h.length){var b=this._videoTrack,S={units:h,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(S.fileposition=a),b.samples.push(S),b.length+=d}},e.prototype._parseHVCVideoPacket=function(e,t,i,n,a,s){if(i<4)r.default.w(this.TAG,"Flv: Invalid HVC packet, missing HVCPacketType or/and CompositionTime");else{var o=this._littleEndian,l=new DataView(e,t,i),h=l.getUint8(0),d=(16777215&l.getUint32(0,!o))<<8>>8;if(0===h)this._parseHVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===h)this._parseHVCVideoData(e,t+4,i-4,n,a,s,d);else if(2!==h)return void this._onError(u.default.FORMAT_ERROR,"Flv: Invalid video packet type "+h)}},e.prototype._parseHVCDecoderConfigurationRecord=function(e,t,i){if(i<23)r.default.w(this.TAG,"Flv: Invalid HVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,a=this._videoTrack,s=this._littleEndian,l=new DataView(e,t,i);if(n?void 0!==n.avcc&&r.default.w(this.TAG,"Found another HVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=a.id,n.timescale=this._timescale,n.duration=this._duration),1===l.getUint8(0))if(this._naluLengthSize=1+(3&l.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var h,d,c,f=l.getUint8(22),p=23,m=[],_=0;_<f;_++){var g=63&l.getUint8(p++),v=l.getUint16(p,!s);if(p+=2,0!==v){switch(g){case 32:h+=v;break;case 33:d+=v;break;case 34:c+=v}for(var y=0;y<v;y++){var b=l.getUint16(p,!s);if(p+=2,0!==b){if(33===g){var S=new Uint8Array(e,t+p,b);m.push(S)}p+=b}}}}if(0!==h)if(h>1&&r.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: VPS Count = "+h),0!==d)if(d>1&&r.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: SPS Count = "+d),0!==c){c>1&&r.default.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: PPS Count = "+d);var T=m[0],E=o.default.parseSPS(T);n.codecWidth=E.codec_size.width,n.codecHeight=E.codec_size.height,n.presentWidth=E.present_size.width,n.presentHeight=E.present_size.height,n.profile=E.profile_string,n.level=E.level_string,n.profile_idc=E.profile_idc,n.level_idc=E.level_idc,n.bitDepth=E.bit_depth,n.chromaFormat=E.chroma_format,n.sarRatio=E.sar_ratio,n.frameRate=E.frame_rate,!1!==E.frame_rate.fixed&&0!==E.frame_rate.fps_num&&0!==E.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var w=n.frameRate.fps_den,A=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(w/A);var C="hvc1."+n.profile_idc+".1.L"+n.level_idc+".B0";n.codec=C;var k=this._mediaInfo;k.width=n.codecWidth,k.height=n.codecHeight,k.fps=n.frameRate.fps,k.profile=n.profile,k.level=n.level,k.refFrames=E.ref_frames,k.chromaFormat=E.chroma_format_string,k.sarNum=n.sarRatio.width,k.sarDen=n.sarRatio.height,k.videoCodec=C,k.hasAudio?null!=k.audioCodec&&(k.mimeType='video/x-flv; codecs="'+k.videoCodec+","+k.audioCodec+'"'):k.mimeType='video/x-flv; codecs="'+k.videoCodec+'"',k.isComplete()&&this._onMediaInfo(k),n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),r.default.v(this.TAG,"Parsed HVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No PPS");else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No SPS");else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No VPS")}else this._onError(u.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(u.default.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord")}},e.prototype._parseHVCVideoData=function(e,t,i,n,a,s,o){for(var u=this._littleEndian,l=new DataView(e,t,i),h=[],d=0,c=0,f=this._naluLengthSize,p=this._timestampBase+n,m=1===s;c<i;){if(c+4>=i){r.default.w(this.TAG,"Malformed Nalu near timestamp "+p+", offset = "+c+", dataSize = "+i);break}var _=l.getUint32(c,!u);if(3===f&&(_>>>=8),_>i-f)return void r.default.w(this.TAG,"Malformed Nalus near timestamp "+p+", NaluSize > DataSize!");var g=l.getUint8(c+f)>>1&63;g>=16&&g<=23&&(m=!0);var v=new Uint8Array(e,t+c,f+_),y={type:g,data:v};h.push(y),d+=v.byteLength,c+=f+_}if(h.length){var b=this._videoTrack,S={units:h,length:d,isKeyframe:m,dts:p,cts:o,pts:p+o};m&&(S.fileposition=a),b.samples.push(S),b.length+=d}},e}();t.default=d},"./src/demux/hevc-sps-parser.js":
-/*!**************************************!*\
- !*** ./src/demux/hevc-sps-parser.js ***!
- \**************************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ./exp-golomb.js */
-"./src/demux/exp-golomb.js"),r=i(
-/*! ./sps-parser.js */
-"./src/demux/sps-parser.js"),a=function(){function e(){}return e.parseSPS=function(t){var i=r.default._ebsp2rbsp(t),a=new n.default(i),s={};a.readBits(16),a.readBits(4);var o=a.readBits(3);a.readBits(1),e._hvcc_parse_ptl(a,s,o),a.readUEG();var u=0,l=a.readUEG();3==l&&(u=a.readBits(1)),s.sar_width=s.sar_height=1,s.conf_win_left_offset=s.conf_win_right_offset=s.conf_win_top_offset=s.conf_win_bottom_offset=0,s.def_disp_win_left_offset=s.def_disp_win_right_offset=s.def_disp_win_top_offset=s.def_disp_win_bottom_offset=0;var h=a.readUEG(),d=a.readUEG();a.readBits(1)&&(s.conf_win_left_offset=a.readUEG(),s.conf_win_right_offset=a.readUEG(),s.conf_win_top_offset=a.readUEG(),s.conf_win_bottom_offset=a.readUEG(),1===s.default_display_window_flag&&(s.conf_win_left_offset,s.def_disp_win_left_offset,s.conf_win_right_offset,s.def_disp_win_right_offset,s.conf_win_top_offset,s.def_disp_win_top_offset,s.conf_win_bottom_offset,s.def_disp_win_bottom_offset));var c=a.readUEG()+8;a.readUEG();for(var f=a.readUEG(),p=a.readBits(1)?0:o;p<=o;p++)e._skip_sub_layer_ordering_info(a);a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readUEG(),a.readBits(1)&&a.readBits(1)&&e._skip_scaling_list_data(a),a.readBits(1),a.readBits(1),a.readBits(1)&&(a.readBits(4),a.readBits(4),a.readUEG(),a.readUEG(),a.readBits(1));var m=[],_=a.readUEG();for(p=0;p<_;p++){var g=e._parse_rps(a,p,_,m);if(g<0)return g}if(a.readBits(1)){var v=a.readUEG();for(p=0;p<v;p++){var y=Math.min(f+4,16);if(y>32){for(var b=y/32,S=y%32,T=0;T<b;T++)a.readBits(32);a.readBits(S)}else a.readBits(y);a.readBits(1)}}a.readBits(1),a.readBits(1),a.readBits(1)&&e._hvcc_parse_vui(a,s,o);var E=e.getProfileString(s.profile_idc),w=e.getLevelString(s.level_idc),A=1;1===s.sar_width&&1===s.sar_height||(A=s.sar_width/s.sar_height);var C=h,k=d,P=1===l&&0===u?2:1;C-=(1!==l&&2!=l||0!==u?1:2)*(s.conf_win_left_offset+s.conf_win_right_offset),k-=P*(s.conf_win_top_offset+s.conf_win_bottom_offset);var I=Math.ceil(C*A);return a.destroy(),a=null,{profile_string:E,level_string:w,profile_idc:s.profile_idc,level_idc:s.level_idc,bit_depth:c,ref_frames:1,chroma_format:l,chroma_format_string:e.getChromaFormatString(l),frame_rate:{fixed:s.fps_fixed,fps:s.fps,fps_den:s.fps_den,fps_num:s.fps_num},sar_ratio:{width:s.sar_width,height:s.sar_height},codec_size:{width:C,height:k},present_size:{width:I,height:k}}},e._hvcc_parse_ptl=function(e,t,i){e.readBits(2);var n=e.readBits(1),r=e.readBits(5);e.readBits(32),e.readBits(32),e.readBits(16);var a=e.readByte();void 0===t.tier_flag||void 0===t.level_idc||t.tier_flag<n?t.level_idc=a:t.level_idc=Math.max(t.level_idc,a),t.profile_idc=Math.max(void 0===t.profile_idc?0:t.profile_idc,r);for(var s=[],o=[],u=0;u<i;u++)s.push(e.readBits(1)),o.push(e.readBits(1));if(i>0)for(u=i;u<8;u++)e.readBits(2);for(u=0;u<i;u++)s[u]&&(e.readBits(32),e.readBits(32),e.readBits(24)),o[u]&&e.readByte()},e._parse_rps=function(e,t,i,n){if(t&&e.readBits(1)){if(t>=i)return-1;e.readBits(1),e.readUEG(),n[t]=0;for(var r=0;r<=n[t-1];r++){var a=0,s=e.readBits(1);s||(a=e.readBits(1)),(s||a)&&n[t]++}}else{var o=e.readUEG(),u=e.readUEG();for(n[t]=o+u,r=0;r<o;r++)e.readUEG(),e.readBits(1);for(r=0;r<u;r++)e.readUEG(),e.readBits(1)}return 0},e._hvcc_parse_vui=function(t,i,n){t.readBits(1)&&255==t.readByte()&&(i.sar_width=t.readBits(16),i.sar_height=t.readBits(16)),t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(4),t.readBits(1)&&t.readBits(24)),t.readBits(1)&&(t.readUEG(),t.readUEG()),t.readBits(3),i.default_display_window_flag=t.readBits(1),i.default_display_window_flag&&(i.def_disp_win_left_offset=t.readUEG(),i.def_disp_win_right_offset=t.readUEG(),i.def_disp_win_top_offset=t.readUEG(),i.def_disp_win_bottom_offset=t.readUEG()),t.readBits(1)&&(e._skip_timing_info(t,i),t.readBits(1)&&e._skip_hrd_parameters(t,i,1,n)),t.readBits(1)&&(t.readBits(3),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG())},e._skip_sub_layer_ordering_info=function(e,t){e.readUEG(),e.readUEG(),e.readUEG()},e._skip_scaling_list_data=function(e){for(var t=0;t<4;t++)for(var i=0;i<(3==t?2:6);i++)if(e.readBits(1)){var n=Math.min(64,1<<4+(t<<1));t>1&&e.readSEG();for(var r=0;r<n;r++)e.readSEG()}else e.readUEG()},e._skip_sub_layer_hrd_parameters=function(e,t,i){for(var n=0;n<=t;n++)e.readUEG(),e.readUEG(),i&&(e.readUEG(),e.readUEG()),e.readBits(1)},e._skip_timing_info=function(e,t){t.fps_den=e.readBits(32),t.fps_num=e.readBits(32),t.fps_den>0&&(t.fps=t.fps_num/t.fps_den);var i=0;e.readBits(1)&&(i=e.readUEG())>=0&&(t.fps/=i+1)},e._skip_hrd_parameters=function(t,i,n){var r=0,a=0;if(i&&(r=t.readBits(1),a=t.readBits(1),r||a)){var s=t.readBits(1);s&&t.readBits(19),t.readByte(),s&&t.readBits(4),t.readBits(15)}for(var o=0;o<=n;o++){var u=0,l=0,h=0,d=t.readBits(1);hvcc.fps_fixed=d,d||(h=t.readBits(1)),h?t.readUEG():l=t.readBits(1),l||(u=t.readUEG(t)),r&&e._skip_sub_layer_hrd_parameters(t,u,0),a&&e._skip_sub_layer_hrd_parameters(t,u,0)}},e.getProfileString=function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},e.getLevelString=function(e){return(e/30).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},e}();t.default=a},"./src/demux/sps-parser.js":
-/*!*********************************!*\
- !*** ./src/demux/sps-parser.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ./exp-golomb.js */
-"./src/demux/exp-golomb.js"),r=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,a=0;a<i;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(n[r]=t[a],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),r=new n.default(i);r.readByte();var a=r.readByte();r.readByte();var s=r.readByte();r.readUEG();var o=e.getProfileString(a),u=e.getLevelString(s),l=1,h=420,d=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(3===(l=r.readUEG())&&r.readBits(1),l<=3&&(h=[0,420,422,444][l]),d=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool()))for(var c=3!==l?8:12,f=0;f<c;f++)r.readBool()&&(f<6?e._skipScalingList(r,16):e._skipScalingList(r,64));r.readUEG();var p=r.readUEG();if(0===p)r.readUEG();else if(1===p){r.readBits(1),r.readSEG(),r.readSEG();var m=r.readUEG();for(f=0;f<m;f++)r.readSEG()}var _=r.readUEG();r.readBits(1);var g=r.readUEG(),v=r.readUEG(),y=r.readBits(1);0===y&&r.readBits(1),r.readBits(1);var b=0,S=0,T=0,E=0;r.readBool()&&(b=r.readUEG(),S=r.readUEG(),T=r.readUEG(),E=r.readUEG());var w=1,A=1,C=0,k=!0,P=0,I=0;if(r.readBool()){if(r.readBool()){var L=r.readByte();L>0&&L<16?(w=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][L-1],A=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][L-1]):255===L&&(w=r.readByte()<<8|r.readByte(),A=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){var x=r.readBits(32),R=r.readBits(32);k=r.readBool(),C=(P=R)/(I=2*x)}}var D=1;1===w&&1===A||(D=w/A);var O=0,U=0;0===l?(O=1,U=2-y):(O=3===l?1:2,U=(1===l?2:1)*(2-y));var M=16*(g+1),F=16*(v+1)*(2-y);M-=(b+S)*O,F-=(T+E)*U;var B=Math.ceil(M*D);return r.destroy(),r=null,{profile_string:o,level_string:u,bit_depth:d,ref_frames:_,chroma_format:h,chroma_format_string:e.getChromaFormatString(h),frame_rate:{fixed:k,fps:C,fps_den:I,fps_num:P},sar_ratio:{width:w,height:A},codec_size:{width:M,height:F},present_size:{width:B,height:F}}},e._skipScalingList=function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n},e.getProfileString=function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}();t.default=r},"./src/flv.js":
-/*!********************!*\
- !*** ./src/flv.js ***!
- \********************/
-function(e,t,i){i.r(t);var r=i(
-/*! ./utils/polyfill.js */
-"./src/utils/polyfill.js"),a=i(
-/*! ./core/features.js */
-"./src/core/features.js"),s=i(
-/*! ./io/loader.js */
-"./src/io/loader.js"),o=i(
-/*! ./player/flv-player.js */
-"./src/player/flv-player.js"),u=i(
-/*! ./player/native-player.js */
-"./src/player/native-player.js"),l=i(
-/*! ./player/player-events.js */
-"./src/player/player-events.js"),h=i(
-/*! ./player/player-errors.js */
-"./src/player/player-errors.js"),d=i(
-/*! ./utils/logging-control.js */
-"./src/utils/logging-control.js"),c=i(
-/*! ./utils/exception.js */
-"./src/utils/exception.js");r.default.install();var f={createPlayer:function(e,t){var i=e;if(null==i||"object"!==n(i))throw new c.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new c.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"flv":return new o.default(i,t);default:return new u.default(i,t)}},isSupported:function(){return a.default.supportMSEH264Playback()},getFeatureList:function(){return a.default.getFeatureList()}};f.BaseLoader=s.BaseLoader,f.LoaderStatus=s.LoaderStatus,f.LoaderErrors=s.LoaderErrors,f.Events=l.default,f.ErrorTypes=h.ErrorTypes,f.ErrorDetails=h.ErrorDetails,f.FlvPlayer=o.default,f.NativePlayer=u.default,f.LoggingControl=d.default,Object.defineProperty(f,"version",{enumerable:!0,get:function(){return"1.7.0"}}),t.default=f},"./src/index.js":
-/*!**********************!*\
- !*** ./src/index.js ***!
- \**********************/
-function(e,t,i){e.exports=i(
-/*! ./flv.js */
-"./src/flv.js").default},"./src/io/fetch-stream-loader.js":
-/*!***************************************!*\
- !*** ./src/io/fetch-stream-loader.js ***!
- \***************************************/
-function(e,t,i){i.r(t);var r,a=i(
-/*! ../utils/browser.js */
-"./src/utils/browser.js"),s=i(
-/*! ./loader.js */
-"./src/io/loader.js"),o=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),u=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),l=function(e){function t(t,i){var n=e.call(this,"fetch-stream-loader")||this;return n.TAG="FetchStreamLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return u(t,e),t.isSupported=function(){try{var e=a.default.msedge&&a.default.version.minor>=15048,t=!a.default.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(r=e.redirectedURL);var a=this._seekHandler.getConfig(r,t),u=new self.Headers;if("object"===n(a.headers)){var l=a.headers;for(var h in l)l.hasOwnProperty(h)&&u.append(h,l[h])}var d={method:"GET",headers:u,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"===n(this._config.headers))for(var h in this._config.headers)u.append(h,this._config.headers[h]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,d.signal=this._abortController.signal),this._status=s.LoaderStatus.kConnecting,self.fetch(a.url,d).then((function(e){if(i._requestAbort)return i._status=s.LoaderStatus.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==a.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=s.LoaderStatus.kError,!i._onError)throw new o.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=s.LoaderStatus.kError,!i._onError)throw e;i._onError(s.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==s.LoaderStatus.kBuffering||!a.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=s.LoaderStatus.kError;var n=s.LoaderErrors.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new o.RuntimeException(r.msg);t._onError(n,r)}else t._status=s.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=s.LoaderStatus.kComplete);if(!0===t._requestAbort)return t._status=s.LoaderStatus.kComplete,e.cancel();t._status=s.LoaderStatus.kBuffering;var a=i.value.buffer,u=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,u,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=s.LoaderStatus.kComplete;else if(11!==e.code||!a.default.msedge){t._status=s.LoaderStatus.kError;var i=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=s.LoaderErrors.EXCEPTION,n={code:e.code,msg:e.message}):(i=s.LoaderErrors.EARLY_EOF,n={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new o.RuntimeException(n.msg);t._onError(i,n)}}))},t}(s.BaseLoader);t.default=l},"./src/io/io-controller.js":
-/*!*********************************!*\
- !*** ./src/io/io-controller.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),r=i(
-/*! ./speed-sampler.js */
-"./src/io/speed-sampler.js"),a=i(
-/*! ./loader.js */
-"./src/io/loader.js"),s=i(
-/*! ./fetch-stream-loader.js */
-"./src/io/fetch-stream-loader.js"),o=i(
-/*! ./xhr-moz-chunked-loader.js */
-"./src/io/xhr-moz-chunked-loader.js"),u=i(
-/*! ./xhr-range-loader.js */
-"./src/io/xhr-range-loader.js"),l=i(
-/*! ./websocket-loader.js */
-"./src/io/websocket-loader.js"),h=i(
-/*! ./range-seek-handler.js */
-"./src/io/range-seek-handler.js"),d=i(
-/*! ./param-seek-handler.js */
-"./src/io/param-seek-handler.js"),c=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),f=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=393216,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===u.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new h.default(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new d.default(t,i)}else{if("custom"!==e.seekType)throw new c.InvalidArgumentException("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new c.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=l.default;else if(s.default.isSupported())this._loaderClass=s.default;else if(o.default.isSupported())this._loaderClass=o.default;else{if(!u.default.isSupported())throw new c.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=u.default}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new c.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var n=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(n,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive||e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new c.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var n=this._speedSampler.lastSecondKBps;if(0!==n){var r=this._normalizeSpeed(n);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(o=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(o=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var a=this._stashBuffer.slice(0,this._stashUsed);(u=this._dispatchChunks(a,this._stashByteStart))<a.byteLength?u>0&&(l=new Uint8Array(a,u),o.set(l,0),this._stashUsed=l.byteLength,this._stashByteStart+=u):(this._stashUsed=0,this._stashByteStart+=u),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(u=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-u)>this._bufferSize&&(this._expandBuffer(s),o=new Uint8Array(this._stashBuffer,0,this._bufferSize)),o.set(new Uint8Array(e,u),0),this._stashUsed+=s,this._stashByteStart=t+u);else if(0===this._stashUsed){var s;(u=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-u)>this._bufferSize&&this._expandBuffer(s),(o=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,u),0),this._stashUsed+=s,this._stashByteStart=t+u)}else{var o,u;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(o=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(u=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&u>0){var l=new Uint8Array(this._stashBuffer,u);o.set(l,0)}this._stashUsed-=u,this._stashByteStart+=u}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,i);a.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=i}return 0}n.default.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.default.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=a.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case a.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=a.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case a.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case a.LoaderErrors.CONNECTING_TIMEOUT:case a.LoaderErrors.HTTP_STATUS_CODE_INVALID:case a.LoaderErrors.EXCEPTION:}if(!this._onError)throw new c.RuntimeException("IOException: "+t.msg);this._onError(e,t)},e}();t.default=f},"./src/io/loader.js":
-/*!**************************!*\
- !*** ./src/io/loader.js ***!
- \**************************/
-function(e,t,i){i.r(t),i.d(t,{LoaderStatus:function(){return r},LoaderErrors:function(){return a},BaseLoader:function(){return s}});var n=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},a={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},s=function(){function e(e){this._type=e||"undefined",this._status=r.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=r.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===r.kConnecting||this._status===r.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new n.NotImplementedException("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.NotImplementedException("Unimplemented abstract function!")},e}()},"./src/io/param-seek-handler.js":
-/*!**************************************!*\
- !*** ./src/io/param-seek-handler.js ***!
- \**************************************/
-function(e,t,i){i.r(t);var n=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var n=!0;-1===i.indexOf("?")&&(i+="?",n=!1),n&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));var r="";if(null!=i&&i.length>0)for(var a=i.split("&"),s=0;s<a.length;s++){var o=a[s].split("="),u=s>0;o[0]!==this._startName&&o[0]!==this._endName&&(u&&(r+="&"),r+=a[s])}return 0===r.length?t:t+"?"+r},e}();t.default=n},"./src/io/range-seek-handler.js":
-/*!**************************************!*\
- !*** ./src/io/range-seek-handler.js ***!
- \**************************************/
-function(e,t,i){i.r(t);var n=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var n=void 0;n=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=n}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}();t.default=n},"./src/io/speed-sampler.js":
-/*!*********************************!*\
- !*** ./src/io/speed-sampler.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}();t.default=n},"./src/io/websocket-loader.js":
-/*!************************************!*\
- !*** ./src/io/websocket-loader.js ***!
- \************************************/
-function(e,t,i){i.r(t);var n,r=i(
-/*! ./loader.js */
-"./src/io/loader.js"),a=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),s=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return s(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=r.LoaderStatus.kConnecting}catch(e){this._status=r.LoaderStatus.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new a.RuntimeException(i.msg);this._onError(r.LoaderErrors.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=r.LoaderStatus.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=r.LoaderStatus.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=r.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=r.LoaderStatus.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new a.RuntimeException(n.msg);this._onError(r.LoaderErrors.EXCEPTION,n)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=r.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new a.RuntimeException(t.msg);this._onError(r.LoaderErrors.EXCEPTION,t)},t}(r.BaseLoader);t.default=o},"./src/io/xhr-moz-chunked-loader.js":
-/*!******************************************!*\
- !*** ./src/io/xhr-moz-chunked-loader.js ***!
- \******************************************/
-function(e,t,i){i.r(t);var r,a=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),s=i(
-/*! ./loader.js */
-"./src/io/loader.js"),o=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),u=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),l=function(e){function t(t,i){var n=e.call(this,"xhr-moz-chunked-loader")||this;return n.TAG="MozChunkedLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return u(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return a.default.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var r=this._seekHandler.getConfig(i,t);this._requestURL=r.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",r.url,!0),a.responseType="moz-chunked-arraybuffer",a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onloadend=this._onLoadEnd.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"===n(r.headers)){var o=r.headers;for(var u in o)o.hasOwnProperty(u)&&a.setRequestHeader(u,o[u])}if("object"===n(this._config.headers))for(var u in o=this._config.headers)o.hasOwnProperty(u)&&a.setRequestHeader(u,o[u]);this._status=s.LoaderStatus.kConnecting,a.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=s.LoaderStatus.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=s.LoaderStatus.kError,!this._onError)throw new o.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=s.LoaderStatus.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==s.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==s.LoaderStatus.kError&&(this._status=s.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=s.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=s.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=s.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new o.RuntimeException(i.msg);this._onError(t,i)},t}(s.BaseLoader);t.default=l},"./src/io/xhr-range-loader.js":
-/*!************************************!*\
- !*** ./src/io/xhr-range-loader.js ***!
- \************************************/
-function(e,t,i){i.r(t);var r,a=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),s=i(
-/*! ./speed-sampler.js */
-"./src/io/speed-sampler.js"),o=i(
-/*! ./loader.js */
-"./src/io/loader.js"),u=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),l=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),h=function(e){function t(t,i){var n=e.call(this,"xhr-range-loader")||this;return n.TAG="RangeLoader",n._seekHandler=t,n._config=i,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new s.default,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return l(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return a.default.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.LoaderStatus.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var r=this._seekHandler.getConfig(i,t);this._currentRequestURL=r.url;var a=this._xhr=new XMLHttpRequest;if(a.open("GET",r.url,!0),a.responseType="arraybuffer",a.onreadystatechange=this._onReadyStateChange.bind(this),a.onprogress=this._onProgress.bind(this),a.onload=this._onLoad.bind(this),a.onerror=this._onXhrError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"===n(r.headers)){var s=r.headers;for(var o in s)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o])}if("object"===n(this._config.headers))for(var o in s=this._config.headers)s.hasOwnProperty(o)&&a.setRequestHeader(o,s[o]);a.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.LoaderStatus.kComplete},t.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.LoaderStatus.kBuffering}else{if(this._status=o.LoaderStatus.kError,!this._onError)throw new u.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var n=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(n)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,n=0,r=0,a=i;if(e<t[0])return t[0];for(;r<=a;){if((n=r+Math.floor((a-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:a=n-1}},t.prototype._onLoad=function(e){if(this._status!==o.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),a&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader);t.default=h},"./src/player/flv-player.js":
-/*!**********************************!*\
- !*** ./src/player/flv-player.js ***!
- \**********************************/
-function(e,t,i){i.r(t);var r=i(
-/*! events */
-"./node_modules/events/events.js"),a=i.n(r),s=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),o=i(
-/*! ../utils/browser.js */
-"./src/utils/browser.js"),u=i(
-/*! ./player-events.js */
-"./src/player/player-events.js"),l=i(
-/*! ../core/transmuxer.js */
-"./src/core/transmuxer.js"),h=i(
-/*! ../core/transmuxing-events.js */
-"./src/core/transmuxing-events.js"),d=i(
-/*! ../core/mse-controller.js */
-"./src/core/mse-controller.js"),c=i(
-/*! ../core/mse-events.js */
-"./src/core/mse-events.js"),f=i(
-/*! ./player-errors.js */
-"./src/player/player-errors.js"),p=i(
-/*! ../config.js */
-"./src/config.js"),m=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),_=function(){function e(e,t){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(a()),this._config=(0,p.createDefaultConfig)(),"object"===n(t)&&Object.assign(this._config,t),"flv"!==e.type.toLowerCase())throw new m.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var i=o.default.chrome&&(o.default.version.major<50||50===o.default.version.major&&o.default.version.build<2661);this._alwaysSeekKeyframe=!!(i||o.default.msedge||o.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===u.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(u.default.MEDIA_INFO,i.mediaInfo)})):e===u.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(u.default.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new d.default(this._config),this._msectl.on(c.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(c.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(c.default.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(c.default.ERROR,(function(e){t._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,f.ErrorDetails.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new m.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new m.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new l.default(this._mediaDataSource,this._config),this._transmuxer.on(h.default.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(h.default.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var n=e._mediaElement.currentTime;i.info.endDts>=1e3*(n+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(s.default.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(h.default.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(u.default.LOADING_COMPLETE)})),this._transmuxer.on(h.default.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(u.default.RECOVERED_EARLY_EOF)})),this._transmuxer.on(h.default.IO_ERROR,(function(t,i){e._emitter.emit(u.default.ERROR,f.ErrorTypes.NETWORK_ERROR,t,i)})),this._transmuxer.on(h.default.DEMUX_ERROR,(function(t,i){e._emitter.emit(u.default.ERROR,f.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(h.default.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(u.default.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(h.default.METADATA_ARRIVED,(function(t){e._emitter.emit(u.default.METADATA_ARRIVED,t)})),this._transmuxer.on(h.default.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(u.default.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(h.default.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(u.default.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(h.default.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},e.prototype._onmseUpdateEnd=function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,i=0,n=0;n<e.length;n++){var r=e.start(n),a=e.end(n);if(r<=t&&t<a){i=a;break}}i>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(s.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){s.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,n=0;n<t.length;n++){var r=t.start(n),a=t.end(n);if(e>=r&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(s.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var n=t.start(i),r=t.end(i);if(e>=n&&e<r)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,n=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||o.default.safari)&&(i=!0,n=o.default.safari?.1:r)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=n;else if(t){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(s.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var n=i.start(0);if(n<1&&t<n||o.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=o.default.safari?.1:n)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}();t.default=_},"./src/player/native-player.js":
-/*!*************************************!*\
- !*** ./src/player/native-player.js ***!
- \*************************************/
-function(e,t,i){i.r(t);var r=i(
-/*! events */
-"./node_modules/events/events.js"),a=i.n(r),s=i(
-/*! ./player-events.js */
-"./src/player/player-events.js"),o=i(
-/*! ../config.js */
-"./src/config.js"),u=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),l=function(){function e(e,t){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(a()),this._config=(0,o.createDefaultConfig)(),"object"===n(t)&&Object.assign(this._config,t),"flv"===e.type.toLowerCase())throw new u.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new u.InvalidArgumentException("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===s.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(s.default.MEDIA_INFO,i.mediaInfo)})):e===s.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(s.default.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new u.IllegalStateException("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(s.default.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(s.default.STATISTICS_INFO,this.statisticsInfo)},e}();t.default=l},"./src/player/player-errors.js":
-/*!*************************************!*\
- !*** ./src/player/player-errors.js ***!
- \*************************************/
-function(e,t,i){i.r(t),i.d(t,{ErrorTypes:function(){return a},ErrorDetails:function(){return s}});var n=i(
-/*! ../io/loader.js */
-"./src/io/loader.js"),r=i(
-/*! ../demux/demux-errors.js */
-"./src/demux/demux-errors.js"),a={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},s={NETWORK_EXCEPTION:n.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:n.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:n.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:n.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:r.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:r.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:r.default.CODEC_UNSUPPORTED}},"./src/player/player-events.js":
-/*!*************************************!*\
- !*** ./src/player/player-events.js ***!
- \*************************************/
-function(e,t,i){i.r(t),t.default={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"}},"./src/remux/aac-silent.js":
-/*!*********************************!*\
- !*** ./src/remux/aac-silent.js ***!
- \*********************************/
-function(e,t,i){i.r(t);var n=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}();t.default=n},"./src/remux/mp4-generator.js":
-/*!************************************!*\
- !*** ./src/remux/mp4-generator.js ***!
- \************************************/
-function(e,t,i){i.r(t);var n=function(){function e(){}return e.init=function(){for(var t in e.types={hvc1:[],hvcC:[],avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pasp:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,n=Array.prototype.slice.call(arguments,1),r=n.length,a=0;a<r;a++)t+=n[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var s=8;for(a=0;a<r;a++)i.set(n[a],s),s+=n[a].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),n=e.moov(t),r=new Uint8Array(i.byteLength+n.byteLength);return r.set(i,0),r.set(n,i.byteLength),r},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),n=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,i,n,r)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,n=t.duration,r=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,a>>>8&255,255&a,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,n=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))},e.hdlr=function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types[".mp3"],r)},e.mp4a=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types.mp4a,r,e.esds(t))},e.esds=function(t){var i=t.config||[],n=i.length,r=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(i).concat([6,1,2]));return e.box(e.types.esds,r)},e.avc1=function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>>8&255,255&n,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return t.codec.indexOf("avc1")>=0?e.box(e.types.avc1,a,e.box(e.types.avcC,i)):e.box(e.types.hvc1,a,e.box(e.types.hvcC,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,n=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,n)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var n=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.sdtp(t),o=e.trun(t,s.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,a,o,s)},e.sdtp=function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),a=0;a<n;a++){var s=i[a].flags;r[a+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,r)},e.trun=function(t,i){var n=t.samples||[],r=n.length,a=12+16*r,s=new Uint8Array(a);i+=8+a,s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var o=0;o<r;o++){var u=n[o].duration,l=n[o].size,h=n[o].flags,d=n[o].cts;s.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,l>>>24&255,l>>>16&255,l>>>8&255,255&l,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o)}return e.box(e.types.trun,s)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();n.init(),t.default=n},"./src/remux/mp4-remuxer.js":
-/*!**********************************!*\
- !*** ./src/remux/mp4-remuxer.js ***!
- \**********************************/
-function(e,t,i){i.r(t);var n=i(
-/*! ../utils/logger.js */
-"./src/utils/logger.js"),r=i(
-/*! ./mp4-generator.js */
-"./src/remux/mp4-generator.js"),a=i(
-/*! ./aac-silent.js */
-"./src/remux/aac-silent.js"),s=i(
-/*! ../utils/browser.js */
-"./src/utils/browser.js"),o=i(
-/*! ../core/media-segment-info.js */
-"./src/core/media-segment-info.js"),u=i(
-/*! ../utils/exception.js */
-"./src/utils/exception.js"),l=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new o.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new o.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!s.default.chrome||!(s.default.version.major<50||50===s.default.version.major&&s.default.version.build<2661)),this._fillSilentAfterSeek=s.default.msedge||s.default.msie,this._mp3UseMpegAudio=!s.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,n="mp4",a=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",a="",i=new Uint8Array):i=r.default.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=r.default.generateInitSegment(t)}if(!this._onInitSegment)throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:a,container:e+"/"+n,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,u=e,l=u.samples,h=void 0,d=-1,c=this._audioMeta.refSampleDuration,f="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,p=this._dtsBaseInited&&void 0===this._audioNextDts,m=!1;if(l&&0!==l.length&&(1!==l.length||t)){var _=0,g=null,v=0;f?(_=0,v=u.length):(_=8,v=8+u.length);var y=null;if(l.length>1&&(v-=(y=l.pop()).length),null!=this._audioStashedLastSample){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,l.unshift(b),v+=b.length}null!=y&&(this._audioStashedLastSample=y);var S=l[0].dts-this._dtsBase;if(this._audioNextDts)h=S-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())h=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(m=!0);else{var T=this._audioSegmentInfoList.getLastSampleBefore(S);if(null!=T){var E=S-(T.originalDts+T.duration);E<=3&&(E=0),h=S-(T.dts+T.duration+E)}else h=0}if(m){var w=S-h,A=this._videoSegmentInfoList.getLastSegmentBefore(S);if(null!=A&&A.beginDts<w){if(M=a.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var C=A.beginDts,k=w-A.beginDts;n.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+C+", duration: "+k),l.unshift({unit:M,dts:C,pts:C}),v+=M.byteLength}}else m=!1}for(var P=[],I=0;I<l.length;I++){var L=(b=l[I]).unit,x=b.dts-this._dtsBase,R=(C=x,!1),D=null,O=0;if(!(x<-.001)){if("mp3"!==this._audioMeta.codec){var U=x;if(this._audioNextDts&&(U=this._audioNextDts),(h=x-U)<=-3*c){n.default.w(this.TAG,"Dropping 1 audio frame (originalDts: "+x+" ms ,curRefDts: "+U+" ms) due to dtsCorrection: "+h+" ms overlap.");continue}if(h>=3*c&&this._fillAudioTimestampGap&&!s.default.safari){R=!0;var M,F=Math.floor(h/c);n.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+x+" ms, curRefDts: "+U+" ms, dtsCorrection: "+Math.round(h)+" ms, generate: "+F+" frames"),C=Math.floor(U),O=Math.floor(U+c)-C,null==(M=a.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(n.default.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),M=L),D=[];for(var B=0;B<F;B++){U+=c;var N=Math.floor(U),j=Math.floor(U+c)-N,V={dts:N,pts:N,cts:0,unit:M,size:M.byteLength,duration:j,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};D.push(V),v+=V.size}this._audioNextDts=U+c}else C=Math.floor(U),O=Math.floor(U+c)-C,this._audioNextDts=U+c}else C=x-h,O=I!==l.length-1?l[I+1].dts-this._dtsBase-h-C:null!=y?y.dts-this._dtsBase-h-C:P.length>=1?P[P.length-1].duration:Math.floor(c),this._audioNextDts=C+O;-1===d&&(d=C),P.push({dts:C,pts:C,cts:0,unit:b.unit,size:b.unit.byteLength,duration:O,originalDts:x,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),R&&P.push.apply(P,D)}}if(0===P.length)return u.samples=[],void(u.length=0);for(f?g=new Uint8Array(v):((g=new Uint8Array(v))[0]=v>>>24&255,g[1]=v>>>16&255,g[2]=v>>>8&255,g[3]=255&v,g.set(r.default.types.mdat,4)),I=0;I<P.length;I++)L=P[I].unit,g.set(L,_),_+=L.byteLength;var H=P[P.length-1];i=H.dts+H.duration;var z=new o.MediaSegmentInfo;z.beginDts=d,z.endDts=i,z.beginPts=d,z.endPts=i,z.originalBeginDts=P[0].originalDts,z.originalEndDts=H.originalDts+H.duration,z.firstSample=new o.SampleInfo(P[0].dts,P[0].pts,P[0].duration,P[0].originalDts,!1),z.lastSample=new o.SampleInfo(H.dts,H.pts,H.duration,H.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(z),u.samples=P,u.sequenceNumber++;var G=null;G=f?new Uint8Array:r.default.moof(u,d),u.samples=[],u.length=0;var W={type:"audio",data:this._mergeBoxes(G,g).buffer,sampleCount:P.length,info:z};f&&p&&(W.timestampOffset=d),this._onMediaSegment("audio",W)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,n,a=e,s=a.samples,u=void 0,l=-1,h=-1;if(s&&0!==s.length&&(1!==s.length||t)){var d=8,c=null,f=8+e.length,p=null;if(s.length>1&&(f-=(p=s.pop()).length),null!=this._videoStashedLastSample){var m=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(m),f+=m.length}null!=p&&(this._videoStashedLastSample=p);var _=s[0].dts-this._dtsBase;if(this._videoNextDts)u=_-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())u=0;else{var g=this._videoSegmentInfoList.getLastSampleBefore(_);if(null!=g){var v=_-(g.originalDts+g.duration);v<=3&&(v=0),u=_-(g.dts+g.duration+v)}else u=0}for(var y=new o.MediaSegmentInfo,b=[],S=0;S<s.length;S++){var T=(m=s[S]).dts-this._dtsBase,E=m.isKeyframe,w=T-u,A=m.cts,C=w+A;-1===l&&(l=w,h=C);var k=0;if(k=S!==s.length-1?s[S+1].dts-this._dtsBase-u-w:null!=p?p.dts-this._dtsBase-u-w:b.length>=1?b[b.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),E){var P=new o.SampleInfo(w,C,k,m.dts,!0);P.fileposition=m.fileposition,y.appendSyncPoint(P)}b.push({dts:w,pts:C,cts:A,units:m.units,size:m.length,isKeyframe:E,duration:k,originalDts:T,flags:{isLeading:0,dependsOn:E?2:1,isDependedOn:E?1:0,hasRedundancy:0,isNonSync:E?0:1}})}for((c=new Uint8Array(f))[0]=f>>>24&255,c[1]=f>>>16&255,c[2]=f>>>8&255,c[3]=255&f,c.set(r.default.types.mdat,4),S=0;S<b.length;S++)for(var I=b[S].units;I.length;){var L=I.shift().data;c.set(L,d),d+=L.byteLength}var x=b[b.length-1];if(i=x.dts+x.duration,n=x.pts+x.duration,this._videoNextDts=i,y.beginDts=l,y.endDts=i,y.beginPts=h,y.endPts=n,y.originalBeginDts=b[0].originalDts,y.originalEndDts=x.originalDts+x.duration,y.firstSample=new o.SampleInfo(b[0].dts,b[0].pts,b[0].duration,b[0].originalDts,b[0].isKeyframe),y.lastSample=new o.SampleInfo(x.dts,x.pts,x.duration,x.originalDts,x.isKeyframe),this._isLive||this._videoSegmentInfoList.append(y),a.samples=b,a.sequenceNumber++,this._forceFirstIDR){var R=b[0].flags;R.dependsOn=2,R.isNonSync=0}var D=r.default.moof(a,l);a.samples=[],a.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(D,c).buffer,sampleCount:b.length,info:y})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}();t.default=l},"./src/utils/browser.js":
-/*!******************************!*\
- !*** ./src/utils/browser.js ***!
- \******************************/
-function(e,t,i){i.r(t);var n={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},a={};if(r.browser){a[r.browser]=!0;var s=r.majorVersion.split(".");a.version={major:parseInt(r.majorVersion,10),string:r.version},s.length>1&&(a.version.minor=parseInt(s[1],10)),s.length>2&&(a.version.build=parseInt(s[2],10))}for(var o in r.platform&&(a[r.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),(a.rv||a.iemobile)&&(a.rv&&delete a.rv,r.browser="msie",a.msie=!0),a.edge&&(delete a.edge,r.browser="msedge",a.msedge=!0),a.opr&&(r.browser="opera",a.opera=!0),a.safari&&a.android&&(r.browser="android",a.android=!0),a.name=r.browser,a.platform=r.platform,n)n.hasOwnProperty(o)&&delete n[o];Object.assign(n,a)}(),t.default=n},"./src/utils/exception.js":
-/*!********************************!*\
- !*** ./src/utils/exception.js ***!
- \********************************/
-function(e,t,i){i.r(t),i.d(t,{RuntimeException:function(){return a},IllegalStateException:function(){return s},InvalidArgumentException:function(){return o},NotImplementedException:function(){return u}});var n,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),a=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),s=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(a),o=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(a),u=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(a)},"./src/utils/logger.js":
-/*!*****************************!*\
- !*** ./src/utils/logger.js ***!
- \*****************************/
-function(e,t,i){i.r(t);var n=i(
-/*! events */
-"./node_modules/events/events.js"),r=i.n(n),a=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn)},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&console.info&&console.info(n)},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&console.warn},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&console.debug&&console.debug(n)},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE},e}();a.GLOBAL_TAG="flv.js",a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!0,a.ENABLE_WARN=!0,a.ENABLE_DEBUG=!0,a.ENABLE_VERBOSE=!0,a.ENABLE_CALLBACK=!1,a.emitter=new(r()),t.default=a},"./src/utils/logging-control.js":
-/*!**************************************!*\
- !*** ./src/utils/logging-control.js ***!
- \**************************************/
-function(e,t,i){i.r(t);var n=i(
-/*! events */
-"./node_modules/events/events.js"),r=i.n(n),a=i(
-/*! ./logger.js */
-"./src/utils/logger.js"),s=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return a.default.FORCE_GLOBAL_TAG},set:function(t){a.default.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return a.default.GLOBAL_TAG},set:function(t){a.default.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return a.default.ENABLE_VERBOSE&&a.default.ENABLE_DEBUG&&a.default.ENABLE_INFO&&a.default.ENABLE_WARN&&a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_VERBOSE=t,a.default.ENABLE_DEBUG=t,a.default.ENABLE_INFO=t,a.default.ENABLE_WARN=t,a.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return a.default.ENABLE_DEBUG},set:function(t){a.default.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return a.default.ENABLE_VERBOSE},set:function(t){a.default.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return a.default.ENABLE_INFO},set:function(t){a.default.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return a.default.ENABLE_WARN},set:function(t){a.default.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return a.default.ENABLE_ERROR},set:function(t){a.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:a.default.GLOBAL_TAG,forceGlobalTag:a.default.FORCE_GLOBAL_TAG,enableVerbose:a.default.ENABLE_VERBOSE,enableDebug:a.default.ENABLE_DEBUG,enableInfo:a.default.ENABLE_INFO,enableWarn:a.default.ENABLE_WARN,enableError:a.default.ENABLE_ERROR,enableCallback:a.default.ENABLE_CALLBACK}},e.applyConfig=function(e){a.default.GLOBAL_TAG=e.globalTag,a.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.default.ENABLE_VERBOSE=e.enableVerbose,a.default.ENABLE_DEBUG=e.enableDebug,a.default.ENABLE_INFO=e.enableInfo,a.default.ENABLE_WARN=e.enableWarn,a.default.ENABLE_ERROR=e.enableError,a.default.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){a.default.emitter.addListener("log",t),a.default.emitter.listenerCount("log")>0&&(a.default.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.default.emitter.removeListener("log",t),0===a.default.emitter.listenerCount("log")&&(a.default.ENABLE_CALLBACK=!1,e._notifyChange())},e}();s.emitter=new(r()),t.default=s},"./src/utils/polyfill.js":
-/*!*******************************!*\
- !*** ./src/utils/polyfill.js ***!
- \*******************************/
-function(e,t,i){i.r(t);var n=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t},"function"!=typeof self.Promise&&i(
-/*! es6-promise */
-"./node_modules/es6-promise/dist/es6-promise.js").polyfill()},e}();n.install(),t.default=n},"./src/utils/utf8-conv.js":
-/*!********************************!*\
- !*** ./src/utils/utf8-conv.js ***!
- \********************************/
-function(e,t,i){function n(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}i.r(t),t.default=function(e){for(var t=[],i=e,r=0,a=e.length;r<a;)if(i[r]<128)t.push(String.fromCharCode(i[r])),++r;else{if(i[r]<192);else if(i[r]<224){if(n(i,r,1)&&(s=(31&i[r])<<6|63&i[r+1])>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}else if(i[r]<240){if(n(i,r,2)&&(s=(15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2])>=2048&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),r+=3;continue}}else if(i[r]<248){var s;if(n(i,r,3)&&(s=(7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")}}},i={};function r(e){var n=i[e];if(void 0!==n)return n.exports;var a=i[e]={exports:{}};return t[e].call(a.exports,a,a.exports,r),a.exports}return r.m=t,r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"===("undefined"==typeof globalThis?"undefined":n(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===("undefined"==typeof window?"undefined":n(window)))return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r("./src/index.js")}()},"object"===(void 0===i?"undefined":n(i))&&"object"===(void 0===t?"undefined":n(t))?t.exports=a():"function"==typeof define&&define.amd?define([],a):"object"===(void 0===i?"undefined":n(i))?i.flvjshevc=a():r.flvjshevc=a()}).call(this,e("_process"))},{_process:44}],69:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("./m3u8base"),a=e("./mpegts/mpeg.js"),s=e("./bufferFrame"),o=e("./buffer"),u=e("../decoder/hevc-imp"),l=e("../consts"),h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.hls=new r.M3u8Base,this.mpegTsObj=new a.MPEG_JS({}),this.mpegTsWasmState=!1,this.mpegTsWasmRetryLoadTimes=0,this.tsList=[],this.vStartTime=0,this.aStartTime=0,this.lockWait={state:!1,lockMember:{dur:0}},this.timerFeed=null,this.timerTsWasm=null,this.seekPos=-1,this.vPreFramePTS=0,this.aPreFramePTS=0,this.audioNone=!1,this.isHevcParam=!1,this.vCodec=!1,this.aCodec=!1,this.aChannel=0,this.durationMs=-1,this.bufObject=o(),this.fps=-1,this.sampleRate=-1,this.size={width:-1,height:-1},this.mediaInfo=null,this.extensionInfo=null,this.onReadyOBJ=null,this.onFinished=null,this.onDemuxed=null,this.onSamples=null,this.onCacheProcess=null}var t,i,h;return t=e,(i=[{key:"getCachePTS",value:function(){return Math.max(this.vPreFramePTS,this.aPreFramePTS)}},{key:"demux",value:function(e){var t=this,i=this;this.vPreFramePTS=0,this.aPreFramePTS=0,this.hls.onTransportStream=function(e,t){i.lockWait.state,i.tsList.length,i.tsList.push({streamURI:e,streamDur:t})},this.hls.onFinished=function(e){e.type==l.PLAYER_IN_TYPE_M3U8_VOD?i.durationMs=1e3*e.duration:i.durationMs=-1,null!=i.onFinished&&i.onFinished(i.onReadyOBJ,e)},this.mpegTsObj.onDemuxedFailed=function(e,t){console.error("onDemuxedFailed: ",e,t),i.lockWait.state=!1},this.mpegTsObj.onDemuxed=function(){null==i.mediaInfo&&(i.mediaInfo=i.mpegTsObj.readMediaInfo(),i.mediaInfo,i.isHevcParam=i.mpegTsObj.isHEVC(),i.vCodec=i.mpegTsObj.vCodec,i.aCodec=i.mediaInfo.aCodec,i.aChannel=i.mediaInfo.sampleChannel,i.fps=i.mediaInfo.vFps,i.sampleRate=i.mediaInfo.sampleRate,(null===i.aCodec||""===i.aCodec||i.aChannel<=0)&&(i.audioNone=!0)),null==i.extensionInfo&&(i.extensionInfo=i.mpegTsObj.readExtensionInfo(),i.extensionInfo.vWidth>0&&i.extensionInfo.vHeight>0&&(i.size.width=i.extensionInfo.vWidth,i.size.height=i.extensionInfo.vHeight)),i.mediaInfo.duration,null!=i.onDemuxed&&i.onDemuxed(i.onReadyOBJ);for(var e=!1;void 0!==i.mpegTsObj&&null!==i.mpegTsObj;){var n=i.mpegTsObj.readPacket();if(n.size<=0)break;var r=n.dtime>0?n.dtime:n.ptime;if(!(r<0)){if(0==n.type){r<=i.vPreFramePTS&&(e=!0);var a=u.PACK_NALU(n.layer),o=1==n.keyframe,l=1==e?r+i.vStartTime:r,h=new s.BufferFrame(l,o,a,!0);i.bufObject.appendFrame(h.pts,h.data,!0,h.isKey),i.vPreFramePTS=l,null!=i.onSamples&&i.onSamples(i.onReadyOBJ,h)}else if(r<=i.aPreFramePTS&&(e=!0),"aac"==i.mediaInfo.aCodec)for(var d=n.data,c=0;c<d.length;c++){var f=d[c],p=1==e?f.ptime+i.vStartTime:r,m=new s.BufferFrame(p,!0,f.data,!1);i.bufObject.appendFrameByBufferFrame(m),i.aPreFramePTS=p,null!=i.onSamples&&i.onSamples(i.onReadyOBJ,m)}else{var _=1==e?r+i.vStartTime:r,g=new s.BufferFrame(_,!0,n.data,!1);i.bufObject.appendFrameByBufferFrame(g),i.aPreFramePTS=_,null!=i.onSamples&&i.onSamples(i.onReadyOBJ,g)}t.onCacheProcess&&t.onCacheProcess(t.getCachePTS())}}i.vStartTime+=parseFloat(i.lockWait.lockMember.dur),i.aStartTime+=parseFloat(i.lockWait.lockMember.dur),i.vStartTime,i.lockWait.state=!1},this.mpegTsObj.onReady=function(){i._onTsReady(e)},i.mpegTsObj.initDemuxer(),this.timerTsWasm=window.setInterval((function(){i.mpegTsWasmState?(window.clearInterval(i.timerTsWasm),i.timerTsWasm=null):i.mpegTsWasmRetryLoadTimes>=3?(i._onTsReady(e),window.clearInterval(i.timerTsWasm),i.timerTsWasm=null):(i.mpegTsWasmRetryLoadTimes+=1,i.mpegTsObj.initDemuxer())}),3e3)}},{key:"_onTsReady",value:function(e){var t=this;t.hls.fetchM3u8(e),t.mpegTsWasmState=!0,t.timerFeed=window.setInterval((function(){if(t.tsList.length>0&&0==t.lockWait.state)try{var e=t.tsList.shift();if(null!=e){var i=e.streamURI,n=e.streamDur;t.lockWait.state=!0,t.lockWait.lockMember.dur=n,t.mpegTsObj.isLive=t.hls.isLive(),t.mpegTsObj.demuxURL(i)}else console.error("_onTsReady need wait ")}catch(e){console.error("onTsReady ERROR:",e),t.lockWait.state=!1}}),50)}},{key:"release",value:function(){this.hls&&this.hls.release(),this.hls=null,this.timerFeed&&window.clearInterval(this.timerFeed),this.timerFeed=null,this.timerTsWasm&&window.clearInterval(this.timerTsWasm),this.timerTsWasm=null}},{key:"bindReady",value:function(e){this.onReadyOBJ=e}},{key:"popBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return t<0?null:1===e?t+1>this.bufObject.videoBuffer.length?null:this.bufObject.vFrame(t):2===e?t+1>this.bufObject.audioBuffer.length?null:this.bufObject.aFrame(t):void 0}},{key:"getVLen",value:function(){return this.bufObject.videoBuffer.length}},{key:"getALen",value:function(){return this.bufObject.audioBuffer.length}},{key:"getLastIdx",value:function(){return this.bufObject.videoBuffer.length-1}},{key:"getALastIdx",value:function(){return this.bufObject.audioBuffer.length-1}},{key:"getACodec",value:function(){return this.aCodec}},{key:"getVCodec",value:function(){return this.vCodec}},{key:"getDurationMs",value:function(){return this.durationMs}},{key:"getFPS",value:function(){return this.fps}},{key:"getSampleRate",value:function(){return this.sampleRate}},{key:"getSampleChannel",value:function(){return this.aChannel}},{key:"getSize",value:function(){return this.size}},{key:"seek",value:function(e){if(e>=0){var t=this.bufObject.seekIDR(e);this.seekPos=t}}}])&&n(t.prototype,i),h&&n(t,h),e}();i.M3u8=h},{"../consts":52,"../decoder/hevc-imp":64,"./buffer":66,"./bufferFrame":67,"./m3u8base":70,"./mpegts/mpeg.js":74}],70:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("../consts"),a=[/#EXT-X-PROGRAM-DATE-TIME.+\n/g],s={lineDelimiter:/\r?\n/,extensionHeader:"#EXTM3U",tagPrefix:"#EXT",segmentPrefix:"#EXTINF",segmentParse:/^#EXTINF: *([0-9.]+)(, *(.+?)?)?$/,tagParse:/^#EXT-X-([A-Z-]+)(:(.+))?$/,version:"VERSION",allowCache:"ALLOW-CACHE",combined:"COMBINED",endList:"ENDLIST",targetDuration:"TARGETDURATION",mediaSequence:"MEDIA-SEQUENCE",discontinuity:"DISCONTINUITY",streamInf:"STREAM-INF",isComment:function(e){return e&&"#"===e[0]&&!e.startsWith(s.tagPrefix)},isBlank:function(e){return""===e},canStrip:function(e){return s.isBlank(e)||s.isComment(e)},defaultMinDur:99999,hlsSliceLimit:100},o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initState=!0,this.controller=new AbortController,this._slices=[],this._type=r.PLAYER_IN_TYPE_M3U8_LIVE,this._preURI="",this.duration=-1,this.onTransportStream=null,this.onFinished=null}var t,i,o;return t=e,(i=[{key:"isLive",value:function(){return this._type===r.PLAYER_IN_TYPE_M3U8_LIVE?1:0}},{key:"release",value:function(){this.initState=!1}},{key:"fetchM3u8",value:function(e){var t=this,i=this;this.initState&&fetch(e).then((function(e){return e.text()})).then((function(t){return 1==i._uriParse(e)?i._m3u8Parse(t):null})).then((function(n){null!=n&&!1!==n&&!0!==n&&t._type==r.PLAYER_IN_TYPE_M3U8_LIVE&&setTimeout((function(){i.fetchM3u8(e)}),500*n)})).catch((function(t){console.error("fetchM3u8 ERROR fetch ERROR ==> ",t),setTimeout((function(){i.fetchM3u8(e)}),500)}))}},{key:"_uriParse",value:function(e){this._preURI="";var t=e.split("://"),i=null,n=null;if(t.length<1)return!1;t.length>1?(i=t[0],n=t[1].split("/"),this._preURI=i+"://"):n=t[0].split("/");for(var r=0;r<n.length-1;r++)this._preURI+=n[r]+"/";return!0}},{key:"_m3u8Parse",value:function(e){for(var t=e,i=0;i<a.length;i++)t=e.replace(a[i],"");for(var n=t.split(s.lineDelimiter),o=s.defaultMinDur,u="",l=0;l<n.length;l++){var h=n[l];if(!(h.length<1)){if(null!=u&&""!==u)switch(u){case s.version:case s.mediaSequence:case s.allowCache:case s.discontinuity:case s.targetDuration:case s.combined:break;case s.streamInf:return this.fetchM3u8(h),null}var d=this._readTag(h);if(null!=d)switch(u=d.key,d.key){case s.version:case s.mediaSequence:case s.allowCache:case s.discontinuity:case s.targetDuration:case s.combined:case s.streamInf:break;case s.endList:if(this._type=r.PLAYER_IN_TYPE_M3U8_VOD,null!=this.onFinished){var c={type:this._type,duration:this.duration};this.onFinished(c)}return!0;default:d.key}var f=s.segmentParse.exec(h);if(null!=f){var p=f[1];this.duration+=parseFloat(f[1]),o>p&&(o=p);var m=n[l+=1],_=null;if(m.indexOf("http")>=0)_=m;else{if("/"===m[0]){var g=this._preURI.split("//"),v=g[g.length-1].split("/");this._preURI=g[0]+"//"+v[0]}_=this._preURI+m}this._slices.indexOf(_)<0&&(this._slices.push(_),this._slices[this._slices.length-1],null!=this.onTransportStream&&this.onTransportStream(_,p))}}}if(this._slices.length>s.hlsSliceLimit&&this._type==r.PLAYER_IN_TYPE_M3U8_LIVE&&(this._slices=this._slices.slice(-1*s.hlsSliceLimit)),null!=this.onFinished){var y={type:this._type,duration:-1};this.onFinished(y)}return o}},{key:"_readTag",value:function(e){var t=s.tagParse.exec(e);return null!==t?{key:t[1],value:t[3]}:null}}])&&n(t.prototype,i),o&&n(t,o),e}();i.M3u8Base=o},{"../consts":52}],71:[function(e,t,i){"use strict";var n=e("mp4box"),r=e("../decoder/hevc-header"),a=e("../decoder/hevc-imp"),s=e("./buffer"),o=e("../consts"),u={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12,Reserved:13,"frequency is written explictly":15},l=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].toString(16));return t};function h(){}h.prototype.setStartCode=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return t?((i=e)[0]=r.DEFINE_STARTCODE[0],i[1]=r.DEFINE_STARTCODE[1],i[2]=r.DEFINE_STARTCODE[2],i[3]=r.DEFINE_STARTCODE[3]):((i=new Uint8Array(r.DEFINE_STARTCODE.length+e.length)).set(r.DEFINE_STARTCODE,0),i.set(e,r.DEFINE_STARTCODE.length)),i},h.prototype.setAACAdts=function(e){var t=null,i=this.aacProfile,n=u[this.sampleRate],r=new Uint8Array(7),a=r.length+e.length;return r[0]=255,r[1]=241,r[2]=(i-1<<6)+(n<<2)+0,r[3]=128+(a>>11),r[4]=(2047&a)>>3,r[5]=31+((7&a)<<5),r[6]=252,(t=new Uint8Array(a)).set(r,0),t.set(e,r.length),t},h.prototype.demux=function(){var e=this;e.seekPos=-1,e.mp4boxfile=n.createFile(),e.movieInfo=null,e.videoCodec=null,e.durationMs=-1,e.fps=-1,e.sampleRate=-1,e.aacProfile=2,e.size={width:-1,height:-1},e.bufObject=s(),e.audioNone=!1,e.naluHeader={vps:null,sps:null,pps:null,sei:null},e.mp4boxfile.onError=function(e){},this.mp4boxfile.onReady=function(t){for(var i in e.movieInfo=t,t.tracks)"VideoHandler"!==t.tracks[i].name&&"video"!==t.tracks[i].type||(t.tracks[i].codec,t.tracks[i].codec.indexOf("hev")>=0||t.tracks[i].codec.indexOf("hvc")>=0?e.videoCodec=o.CODEC_H265:t.tracks[i].codec.indexOf("avc")>=0&&(e.videoCodec=o.CODEC_H264));var n=-1;if(n=t.videoTracks[0].samples_duration/t.videoTracks[0].timescale,e.durationMs=1e3*n,e.fps=t.videoTracks[0].nb_samples/n,e.seekDiffTime=1/e.fps,e.size.width=t.videoTracks[0].track_width,e.size.height=t.videoTracks[0].track_height,t.audioTracks.length>0){e.sampleRate=t.audioTracks[0].audio.sample_rate;var r=t.audioTracks[0].codec.split(".");e.aacProfile=r[r.length-1]}else e.audioNone=!0;null!=e.onMp4BoxReady&&e.onMp4BoxReady(e.videoCodec),e.videoCodec===o.CODEC_H265?(e.initializeAllSourceBuffers(),e.mp4boxfile.start()):(e.videoCodec,o.CODEC_H264)},e.mp4boxfile.onSamples=function(t,i,n){var s=window.setInterval((function(){for(var i=0;i<n.length;i++){var u=n[i],h=u.data,d=null;if(!(null==h||h.length<4)&&h){var c=u.dts/u.timescale;if(1===t){var f=null,p=u.is_sync;if(e.videoCodec===o.CODEC_H265){f=u.description.hvcC;var m=a.GET_NALU_TYPE(h[4]);p||(p=m==r.DEFINE_KEY_FRAME||u.is_sync)}else e.videoCodec===o.CODEC_H264&&(f=u.description.avcC);if(p){if(e.videoCodec==o.CODEC_H265){var _=f.nalu_arrays;e.naluHeader.vps=e.setStartCode(_[0][0].data,!1),e.naluHeader.sps=e.setStartCode(_[1][0].data,!1),e.naluHeader.pps=e.setStartCode(_[2][0].data,!1),_.length>3?e.naluHeader.sei=e.setStartCode(_[3][0].data,!1):e.naluHeader.sei=new Uint8Array,e.naluHeader}else e.videoCodec==o.CODEC_H264&&(e.naluHeader.vps=new Uint8Array,e.naluHeader.sps=e.setStartCode(f.SPS[0].nalu,!1),e.naluHeader.pps=e.setStartCode(f.PPS[0].nalu,!1),e.naluHeader.sei=new Uint8Array);h[4].toString(16),e.naluHeader.vps[4].toString(16),l(e.naluHeader.vps),l(h);var g=e.setStartCode(h.subarray(0,e.naluHeader.vps.length),!0);if(l(g),h[4]===e.naluHeader.vps[4]){var v=e.naluHeader.vps.length+4,y=e.naluHeader.vps.length+e.naluHeader.sps.length+4,b=e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length+4;if(e.naluHeader.sei.length<=0&&e.naluHeader.sps.length>0&&h[v]===e.naluHeader.sps[4]&&e.naluHeader.pps.length>0&&h[y]===e.naluHeader.pps[4]&&78===h[b]){h[e.naluHeader.vps.length+4],e.naluHeader.sps[4],h[e.naluHeader.vps.length+e.naluHeader.sps.length+4],e.naluHeader.pps[4],h[e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length+4];for(var S=0,T=0;T<h.length;T++)if(h[T]===r.SOURCE_CODE_SEI_END&&a.GET_NALU_TYPE(h[T+5])===r.DEFINE_KEY_FRAME){S=T;break}h[3]=1,h[v-1]=1,h[y-1]=1,h[b-1]=1,h[2]=0,h[v-2]=0,h[y-2]=0,h[b-2]=0,h[1]=0,h[v-3]=0,h[y-3]=0,h[b-3]=0,h[S+1]=0,h[S+2]=0,h[S+3]=0,h[S+4]=1,e.naluHeader.vps=null,e.naluHeader.sps=null,e.naluHeader.pps=null,e.naluHeader.vps=new Uint8Array,e.naluHeader.sps=new Uint8Array,e.naluHeader.pps=new Uint8Array}else h[4].toString(16),e.naluHeader.vps[4].toString(16),l(e.naluHeader.vps),l(h),h=h.subarray(e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length+e.naluHeader.sei.length)}else if(e.naluHeader.sei.length>4&&h[4]===e.naluHeader.sei[4]){var E=h.subarray(0,10),w=new Uint8Array(e.naluHeader.vps.length+E.length);w.set(E,0),w.set(e.naluHeader.vps,E.length),w[3]=1,e.naluHeader.vps=null,e.naluHeader.vps=new Uint8Array(w),w=null,E=null,(h=h.subarray(10))[4],e.naluHeader.vps[4],e.naluHeader.vps}else if(0===e.naluHeader.sei.length&&78===h[4]){h=e.setStartCode(h,!0);for(var A=0,C=0;C<h.length;C++)if(h[C]===r.SOURCE_CODE_SEI_END&&a.GET_NALU_TYPE(h[C+5])===r.DEFINE_KEY_FRAME){A=C;break}e.naluHeader.sei=h.subarray(0,A+1),h=new Uint8Array(h.subarray(A+1)),e.naluHeader.sei}l(e.naluHeader.vps),l(e.naluHeader.sps),l(e.naluHeader.pps),l(e.naluHeader.sei),l(h),(d=new Uint8Array(e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length+e.naluHeader.sei.length+h.length)).set(e.naluHeader.vps,0),d.set(e.naluHeader.sps,e.naluHeader.vps.length),d.set(e.naluHeader.pps,e.naluHeader.vps.length+e.naluHeader.sps.length),d.set(e.naluHeader.sei,e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length),d.set(e.setStartCode(h,!0),e.naluHeader.vps.length+e.naluHeader.sps.length+e.naluHeader.pps.length+e.naluHeader.sei.length)}else d=e.setStartCode(h,!0);e.bufObject.appendFrame(c,d,!0,p)}else 2==t&&(d=e.setAACAdts(h),e.bufObject.appendFrame(c,d,!1,!0))}}window.clearInterval(s),s=null}),0)}},h.prototype.appendBufferData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.fileStart=t,this.mp4boxfile.appendBuffer(e)},h.prototype.finishBuffer=function(){this.mp4boxfile.flush()},h.prototype.play=function(){},h.prototype.getVideoCoder=function(){return this.videoCodec},h.prototype.getDurationMs=function(){return this.durationMs},h.prototype.getFPS=function(){return this.fps},h.prototype.getSampleRate=function(){return this.sampleRate},h.prototype.getSize=function(){return this.size},h.prototype.seek=function(e){if(e>=0){var t=this.bufObject.seekIDR(e);this.seekPos=t}},h.prototype.popBuffer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return t<0?null:1==e?this.bufObject.vFrame(t):2==e?this.bufObject.aFrame(t):void 0},h.prototype.addBuffer=function(e){var t=e.id;this.mp4boxfile.setExtractionOptions(t)},h.prototype.initializeAllSourceBuffers=function(){if(this.movieInfo){for(var e=this.movieInfo,t=0;t<e.tracks.length;t++){var i=e.tracks[t];this.addBuffer(i)}this.initializeSourceBuffers()}},h.prototype.onInitAppended=function(e){var t=e.target;"open"===t.ms.readyState&&(t.sampleNum=0,t.removeEventListener("updateend",this.onInitAppended),t.ms.pendingInits--,0===t.ms.pendingInits&&this.mp4boxfile.start())},h.prototype.initializeSourceBuffers=function(){for(var e=this.mp4boxfile.initializeSegmentation(),t=0;t<e.length;t++){var i=e[t].user;0===t&&(i.ms.pendingInits=0),i.addEventListener("updateend",this.onInitAppended),i.appendBuffer(e[t].buffer),i.segmentIndex=0,i.ms.pendingInits++}},t.exports=h},{"../consts":52,"../decoder/hevc-header":63,"../decoder/hevc-imp":64,"./buffer":66,mp4box:39}],72:[function(e,t,i){"use strict";t.exports={DEFAULT_SAMPLERATE:44100,DEFAULT_CHANNEL:1,H264AUD:[0,0,0,1,9,224],H265AUD:[0,0,0,1,70,1,80],DEF_AAC:"aac",DEF_MP3:"mp3",DEF_H265:"h265",DEF_HEVC:"hevc",DEF_H264:"h264",DEF_AVC:"avc",CODEC_OFFSET_TABLE:["hevc","h265","avc","h264","aac","mp3"]}},{}],73:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sampleRate=t.sampleRate,this.frameDurMs=Math.floor(1024e3/this.sampleRate),this.frameDurSec=this.frameDurMs/1e3}var t,i,r;return t=e,(i=[{key:"updateConfig",value:function(e){this.sampleRate=e.sampleRate,this.frameDurMs=1024e3/this.sampleRate,this.frameDurSec=this.frameDurMs/1e3}},{key:"_getPktLen",value:function(e,t,i){return((3&e)<<11)+(t<<3)+((224&i)>>5)}},{key:"sliceAACFrames",value:function(e,t){for(var i=[],n=e,r=0;r<t.length-1;)if(255==t[r]&&t[r+1]>>4==15){var a=this._getPktLen(t[r+3],t[r+4],t[r+5]);if(a<=0)continue;var s=t.subarray(r,r+a),o=new Uint8Array(a);o.set(s,0),i.push({ptime:n,data:o}),n+=this.frameDurSec,r+=a}else r+=1;return i}}])&&n(t.prototype,i),r&&n(t,r),e}();i.AACDecoder=r},{}],74:[function(e,t,i){(function(t){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("./decoder/aac"),a=e("./consts"),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configFormat={},this.isLive=0,this.mediaAttr={sampleRate:0,sampleChannel:0,vFps:0,vGop:0,vDuration:0,aDuration:0,duration:0,aCodec:"",vCodec:"",audioNone:!1},this.extensionInfo={vWidth:0,vHeight:0},this.controller=new AbortController,this.offsetDemux=null,this.wasmState=0,this.naluLayer=null,this.vlcLayer=null,this.onReady=null,this.onDemuxed=null,this.onDemuxedFailed=null,this.aacDec=null}var i,s,o;return i=e,(s=[{key:"initDemuxer",value:function(){var e=this;return window.WebAssembly?(Module.run(),1===t.STATIC_MEM_wasmDecoderState?(e.wasmState=1,e.onReady()):(Module.onRuntimeInitialized=function(){null!=e.onReady&&0==e.wasmState&&(e.wasmState=1,e.onReady())},Module.postRun=function(){null!=e.onReady&&0==e.wasmState&&(e.wasmState=1,e.onReady())})):/iPhone|iPad/.test(window.navigator.userAgent),!0}},{key:"demuxURL",value:function(e){this._demuxerTsInit(e)}},{key:"demuxUint8Buf",value:function(e){this._demuxCore(e)}},{key:"_demuxerTsInit",value:function(e){var t=this,i=this.controller.signal;fetch(e,{signal:i}).then((function(e){return e.arrayBuffer()})).then((function(i){i.fileStart=0;var n=new Uint8Array(i);null!=n?t._demuxCore(n):console.error("demuxerTsInit ERROR fetch res is null ==> ",e),n=null})).catch((function(i){console.error("demuxerTsInit ERROR fetch ERROR ==> ",i),t._releaseOffset(),t.onDemuxedFailed&&t.onDemuxedFailed(i,e)}))}},{key:"_releaseOffset",value:function(){void 0!==this.offsetDemux&&null!==this.offsetDemux&&(Module._free(this.offsetDemux),this.offsetDemux=null)}},{key:"_demuxCore",value:function(e){if(this._releaseOffset(),this._refreshDemuxer(),!(e.length<=0)){this.offsetDemux=Module._malloc(e.length),Module.HEAP8.set(e,this.offsetDemux);var t=Module.cwrap("demuxBox","number",["number","number","number"])(this.offsetDemux,e.length,this.isLive);Module._free(this.offsetDemux),this.offsetDemux=null,t>=0&&(this._setMediaInfo(),this._setExtensionInfo(),null!=this.onDemuxed&&this.onDemuxed())}}},{key:"_setMediaInfo",value:function(){var e=Module.cwrap("getMediaInfo","number",[])(),t=Module.HEAPU32[e/4],i=Module.HEAPU32[e/4+1],n=Module.HEAPF64[e/8+1],s=Module.HEAPF64[e/8+1+1],o=Module.HEAPF64[e/8+1+1+1],u=Module.HEAPF64[e/8+1+1+1+1],l=Module.HEAPU32[e/4+2+2+2+2+2];this.mediaAttr.vFps=n,this.mediaAttr.vGop=l,this.mediaAttr.vDuration=s,this.mediaAttr.aDuration=o,this.mediaAttr.duration=u;var h=Module.cwrap("getAudioCodecID","number",[])();h>=0?(this.mediaAttr.aCodec=a.CODEC_OFFSET_TABLE[h],this.mediaAttr.sampleRate=t>0?t:a.DEFAULT_SAMPLERATE,this.mediaAttr.sampleChannel=i>=0?i:a.DEFAULT_CHANNEL):(this.mediaAttr.sampleRate=0,this.mediaAttr.sampleChannel=0,this.mediaAttr.audioNone=!0);var d=Module.cwrap("getVideoCodecID","number",[])();d>=0&&(this.mediaAttr.vCodec=a.CODEC_OFFSET_TABLE[d]),null==this.aacDec?this.aacDec=new r.AACDecoder(this.mediaAttr):this.aacDec.updateConfig(this.mediaAttr)}},{key:"_setExtensionInfo",value:function(){var e=Module.cwrap("getExtensionInfo","number",[])(),t=Module.HEAPU32[e/4],i=Module.HEAPU32[e/4+1];this.extensionInfo.vWidth=t,this.extensionInfo.vHeight=i}},{key:"readMediaInfo",value:function(){return this.mediaAttr}},{key:"readExtensionInfo",value:function(){return this.extensionInfo}},{key:"readAudioNone",value:function(){return this.mediaAttr.audioNone}},{key:"_readLayer",value:function(){null===this.naluLayer?this.naluLayer={vps:null,sps:null,pps:null,sei:null}:(this.naluLayer.vps=null,this.naluLayer.sps=null,this.naluLayer.pps=null,this.naluLayer.sei=null),null===this.vlcLayer?this.vlcLayer={vlc:null}:this.vlcLayer.vlc=null;var e=Module.cwrap("getSPSLen","number",[])(),t=Module.cwrap("getSPS","number",[])();if(!(e<0)){var i=Module.HEAPU8.subarray(t,t+e);this.naluLayer.sps=new Uint8Array(e),this.naluLayer.sps.set(i,0);var n=Module.cwrap("getPPSLen","number",[])(),r=Module.cwrap("getPPS","number",[])(),s=Module.HEAPU8.subarray(r,r+n);this.naluLayer.pps=new Uint8Array(n),this.naluLayer.pps.set(s,0);var o=Module.cwrap("getSEILen","number",[])(),u=Module.cwrap("getSEI","number",[])(),l=Module.HEAPU8.subarray(u,u+o);this.naluLayer.sei=new Uint8Array(o),this.naluLayer.sei.set(l,0);var h=Module.cwrap("getVLCLen","number",[])(),d=Module.cwrap("getVLC","number",[])(),c=Module.HEAPU8.subarray(d,d+h);if(this.vlcLayer.vlc=new Uint8Array(h),this.vlcLayer.vlc.set(c,0),this.mediaAttr.vCodec==a.DEF_HEVC||this.mediaAttr.vCodec==a.DEF_H265){var f=Module.cwrap("getVPSLen","number",[])(),p=Module.cwrap("getVPS","number",[])(),m=Module.HEAPU8.subarray(p,p+f);this.naluLayer.vps=new Uint8Array(f),this.naluLayer.vps.set(m,0),Module._free(m),m=null}else this.mediaAttr.vCodec==a.DEF_AVC||(this.mediaAttr.vCodec,a.DEF_H264);return Module._free(i),i=null,Module._free(s),s=null,Module._free(l),l=null,Module._free(c),c=null,{nalu:this.naluLayer,vlc:this.vlcLayer}}}},{key:"isHEVC",value:function(){return this.mediaAttr.vCodec==a.DEF_HEVC||this.mediaAttr.vCodec==a.DEF_H265}},{key:"readPacket",value:function(){var e=Module.cwrap("getPacket","number",[])(),t=Module.HEAPU32[e/4],i=Module.HEAPU32[e/4+1],n=Module.HEAPF64[e/8+1],r=Module.HEAPF64[e/8+1+1],s=Module.HEAPU32[e/4+1+1+2+2],o=Module.HEAPU32[e/4+1+1+2+2+1],u=Module.HEAPU8.subarray(o,o+i),l=this._readLayer(),h={type:t,size:i,ptime:n,dtime:r,keyframe:s,src:u,data:1==t&&this.mediaAttr.aCodec==a.DEF_AAC?this.aacDec.sliceAACFrames(n,u):u,layer:l};return Module._free(u),u=null,h}},{key:"_refreshDemuxer",value:function(){this.releaseTsDemuxer(),this._initDemuxer()}},{key:"_initDemuxer",value:function(){Module.cwrap("initTsMissile","number",[])(),Module.cwrap("initializeDemuxer","number",[])()}},{key:"releaseTsDemuxer",value:function(){Module.cwrap("exitTsMissile","number",[])()}}])&&n(i.prototype,s),o&&n(i,o),e}();i.MPEG_JS=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./consts":72,"./decoder/aac":73}],75:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("./mpegts/mpeg.js"),a=e("./buffer"),s=e("../decoder/hevc-imp"),o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.seekPos=-1,this.durationMs=-1,this.fps=-1,this.sampleRate=-1,this.aCodec="",this.vCodec="",this.size={width:-1,height:-1},this.bufObject=a(),this.mpegTsObj=null,this.bufObject=a(),this.mediaInfo={},this.extensionInfo={},this.onReady=null,this.onDemuxed=null,this.onReadyOBJ=null}var t,i,o;return t=e,(i=[{key:"initMPEG",value:function(){var e=this;this.mpegTsObj=new r.MPEG_JS({}),this.mpegTsObj.onDemuxed=function(){e.mediaInfo=e.mpegTsObj.readMediaInfo(),e.mediaInfo,e.extensionInfo=e.mpegTsObj.readExtensionInfo(),e.extensionInfo,e.vCodec=e.mediaInfo.vCodec,e.aCodec=e.mediaInfo.aCodec,e.durationMs=1e3*e.mediaInfo.duration,e.fps=e.mediaInfo.vFps,e.sampleRate=e.mediaInfo.sampleRate,e.extensionInfo.vWidth>0&&e.extensionInfo.vHeight>0&&(e.size.width=e.extensionInfo.vWidth,e.size.height=e.extensionInfo.vHeight);for(var t=null;!((t=e.mpegTsObj.readPacket()).size<=0);){var i=t.dtime;if(0==t.type){var n=s.PACK_NALU(t.layer),r=1==t.keyframe;e.bufObject.appendFrame(i,n,!0,r)}else if("aac"==e.mediaInfo.aCodec)for(var a=t.data,o=0;o<a.length;o++){var u=a[o];e.bufObject.appendFrame(u.ptime,u.data,!1,!0)}else e.bufObject.appendFrame(i,t.data,!1,!0)}e.bufObject.videoBuffer,e.bufObject.audioBuffer,null!=e.onDemuxed&&e.onDemuxed(e.onReadyOBJ)},this.mpegTsObj.onReady=function(){null!=e.onReady&&e.onReady(e.onReadyOBJ)},this.mpegTsObj.initDemuxer()}},{key:"bindReady",value:function(e){this.onReadyOBJ=e}},{key:"releaseTsDemuxer",value:function(){this.mpegTsObj&&this.mpegTsObj.releaseTsDemuxer(),this.mpegTsObj=null}},{key:"demux",value:function(e){this.mpegTsObj.demuxUint8Buf(e)}},{key:"popBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return t<0?null:1==e?this.bufObject.vFrame(t):2==e?this.bufObject.aFrame(t):void 0}},{key:"isHEVC",value:function(){return this.mpegTsObj.isHEVC()}},{key:"getACodec",value:function(){return this.aCodec}},{key:"getVCodec",value:function(){return this.vCodec}},{key:"getAudioNone",value:function(){return this.mpegTsObj.mediaAttr.audioNone}},{key:"getDurationMs",value:function(){return this.durationMs}},{key:"getFPS",value:function(){return this.fps}},{key:"getSampleRate",value:function(){return this.sampleRate}},{key:"getSize",value:function(){return this.size}},{key:"seek",value:function(e){if(e>=0){var t=this.bufObject.seekIDR(e);this.seekPos=t}}}])&&n(t.prototype,i),o&&n(t,o),e}();i.MpegTs=o},{"../decoder/hevc-imp":64,"./buffer":66,"./mpegts/mpeg.js":74}],76:[function(e,t,i){(function(t){"use strict";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 r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=e("./decoder/player-core"),s=e("./native/mp4-player"),o=e("./decoder/c-native-core"),u=e("./decoder/c-httplive-core"),l=e("./decoder/c-http-g711-core"),h=e("./decoder/c-wslive-core"),d=e("./native/nv-videojs-core"),c=e("./native/nv-flvjs-core"),f=e("./native/nv-mpegts-core"),p=e("./decoder/av-common"),m=(e("./demuxer/mpegts/mpeg.js"),e("./demuxer/mp4")),_=e("./demuxer/ts"),g=e("./demuxer/m3u8"),v=e("./consts"),y=(e("./utils/static-mem"),e("./utils/ui/ui")),b=(e("./decoder/cache"),e("./render-engine/webgl-420p")),S={moovStartFlag:!0,readyShow:!0,rawFps:24,autoCrop:!1,core:v.PLAYER_CORE_TYPE_DEFAULT,coreProbePart:0,checkProbe:!0,ignoreAudio:0,probeSize:4096,autoPlay:!1,cacheLength:50,loadTimeout:30,hevc:!0},T=function(e,t){return t-1e3/e};void 0!==t.Module&&null!==t.Module||(t.Module={}),Module.onRuntimeInitialized=function(){t.STATIC_MEM_wasmDecoderState=1,t.STATIC_MEM_wasmDecoderState},window.g_players={},window.onmessage=function(e){},window.addEventListener("wasmLoaded",(function(){t.STATIC_MEM_wasmDecoderState=1})),t.onWASMLoaded=function(){t.STATIC_MEM_wasmDecoderState=1};var E=function(){function e(i,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.STATICE_MEM_playerCount+=1,this.playerIndex=t.STATICE_MEM_playerCount,this.mp4Obj=null,this.mpegTsObj=null,this.hlsObj=null,this.hlsConf={hlsType:v.PLAYER_IN_TYPE_M3U8_VOD},this.snapshotCanvasContext=null,this.snapshotYuvLastFrame={width:0,height:0,luma:null,chromaB:null,chromaR:null},this.videoURL=i,this.configFormat={playerId:n.player||v.DEFAILT_WEBGL_PLAY_ID,playerW:n.width||v.DEFAULT_WIDTH,playerH:n.height||v.DEFAULT_HEIGHT,type:n.type||p.GetUriFormat(this.videoURL),accurateSeek:n.accurateSeek||!0,playIcon:n.playIcon||"assets/icon-play@300.png",loadIcon:n.loadIcon||"assets/icon-loading.gif",token:n.token||null,extInfo:S},this.mediaExtFormat=this.configFormat.type,this.mediaExtProtocol=null,void 0!==this.videoURL&&null!==this.videoURL&&(this.mediaExtProtocol=p.GetUriProtocol(this.videoURL)),this.mediaExtProtocol,this.mediaExtFormat,null!=this.configFormat.token){for(var r in this.configFormat.extInfo.core=p.GetFormatPlayCore(this.configFormat.type),n.extInfo)r in this.configFormat.extInfo&&(this.configFormat.extInfo[r]=n.extInfo[r]);this.playMode=v.PLAYER_MODE_VOD,this.seekTarget=0,this.playParam=null,this.timerFeed=null,this.player=null,this.volume=1,this.rawModePts=0,this.loadTimeoutInterval=null,this.loadTimeoutSecNow=this.configFormat.extInfo.loadTimeout,this.autoScreenClose=!0,this.feedMP4Data=null,this.workerFetch=null,this.workerParse=null,this.onPlayTime=null,this.onLoadFinish=null,this.onSeekStart=null,this.onSeekFinish=null,this.onRender=null,this.onLoadCache=null,this.onLoadCacheFinshed=null,this.onPlayFinish=null,this.onCacheProcess=null,this.onReadyShowDone=null,this.onOpenFullScreen=null,this.onCloseFullScreen=null,this.onError=null,this.onProbeError=null,this.onMakeItReady=null,this.onPlayState=null,this.filterConfigParams(),this.configFormat;var a=this;document.addEventListener("fullscreenchange",(function(e){a._isFullScreen()?a.onOpenFullScreen&&a.onOpenFullScreen():(!0===a.autoScreenClose&&a.closeFullScreen(!0),a.onCloseFullScreen&&a.onCloseFullScreen())})),this.screenW=window.screen.width,this.screenH=window.screen.height}}var i,E,w;return i=e,(E=[{key:"filterConfigParams",value:function(){void 0!==this.configFormat.extInfo.checkProbe&&null!==this.configFormat.extInfo.checkProbe||(this.configFormat.extInfo.checkProbe=!0),this.configFormat.type===v.PLAYER_IN_TYPE_FLV?(this.configFormat.extInfo.core=v.PLAYER_CORE_TYPE_CNATIVE,this.configFormat.type=v.PLAYER_IN_TYPE_MP4):this.configFormat.type===v.PLAYER_IN_TYPE_HTTPFLV&&(this.configFormat.extInfo.core=v.PLAYER_CORE_TYPE_CNATIVE,this.configFormat.type=v.PLAYER_IN_TYPE_MP4,this.playMode=v.PLAYER_MODE_NOTIME_LIVE)}},{key:"do",value:function(){var e=this,i=!1;if(this.configFormat.extInfo.ignoreAudio>0&&(i=!0),this.configFormat.type===v.PLAYER_IN_TYPE_RAW_265&&(i=!0,this.playMode=v.PLAYER_MODE_NOTIME_LIVE),this.playParam={durationMs:0,fps:0,sampleRate:0,size:{width:0,height:0},audioNone:i,videoCodec:v.CODEC_H265},y.UI.createPlayerRender(this.configFormat.playerId,this.configFormat.playerW,this.configFormat.playerH),!1===this._isSupportWASM())return this._makeMP4Player(!1),0;if(!1===this.configFormat.extInfo.hevc)return Module.cwrap("AVPlayerInit","number",["string","string"])(this.configFormat.token,"0.0.0"),this._makeMP4Player(!0),0;var n=window.setInterval((function(){t.STATICE_MEM_playerIndexPtr===e.playerIndex&&(t.STATICE_MEM_playerIndexPtr,e.playerIndex,window.WebAssembly?(t.STATIC_MEM_wasmDecoderState,1==t.STATIC_MEM_wasmDecoderState&&(e._makeMP4Player(),t.STATICE_MEM_playerIndexPtr+=1,window.clearInterval(n),n=null)):(/iPhone|iPad/.test(window.navigator.userAgent),t.STATICE_MEM_playerIndexPtr+=1,window.clearInterval(n),n=null))}),500)}},{key:"release",value:function(){return void 0!==this.player&&null!==this.player&&(this.player,this.playParam.videoCodec===v.CODEC_H265&&this.player?(this.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&void 0!==this.hlsObj&&null!==this.hlsObj&&this.hlsObj.release(),this.player.release()):this.player.release(),void 0!==this.snapshotCanvasContext&&null!==this.snapshotCanvasContext&&(b.releaseContext(this.snapshotCanvasContext),this.snapshotCanvasContext=null,void 0!==this.snapshotYuvLastFrame&&null!==this.snapshotYuvLastFrame&&(this.snapshotYuvLastFrame.luma=null,this.snapshotYuvLastFrame.chromaB=null,this.snapshotYuvLastFrame.chromaR=null,this.snapshotYuvLastFrame.width=0,this.snapshotYuvLastFrame.height=0)),void 0!==this.workerFetch&&null!==this.workerFetch&&(this.workerFetch.postMessage({cmd:"stop",params:"",type:this.mediaExtProtocol}),this.workerFetch.onmessage=null),void 0!==this.workerParse&&null!==this.workerParse&&(this.workerParse.postMessage({cmd:"stop",params:""}),this.workerParse.onmessage=null),this.workerFetch=null,this.workerParse=null,this.configFormat.extInfo.readyShow=!0,window.onclick=document.body.onclick=null,window.g_players={},!0)}},{key:"debugYUV",value:function(e){this.player.debugYUV(e)}},{key:"setPlaybackRate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return!(this.playParam.videoCodec===v.CODEC_H265||e<=0||void 0===this.player||null===this.player)&&this.player.setPlaybackRate(e)}},{key:"getPlaybackRate",value:function(){return void 0!==this.player&&null!==this.player&&(this.playParam.videoCodec===v.CODEC_H265?1:this.player.getPlaybackRate())}},{key:"setRenderScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return void 0!==this.player&&null!==this.player&&(this.player.setScreen(e),!0)}},{key:"play",value:function(){if(void 0===this.player||null===this.player)return!1;if(this.playParam.videoCodec===v.CODEC_H265){var e={seekPos:this._getSeekTarget(),mode:this.playMode,accurateSeek:this.configFormat.accurateSeek,seekEvent:!1,realPlay:!0};this.player.play(e)}else this.player.play();return!0}},{key:"pause",value:function(){return void 0!==this.player&&null!==this.player&&(this.player.pause(),!0)}},{key:"isPlaying",value:function(){return void 0!==this.player&&null!==this.player&&this.player.isPlayingState()}},{key:"setVoice",value:function(e){return!(e<0||void 0===this.player||null===this.player||(this.volume=e,this.player&&this.player.setVoice(e),0))}},{key:"getVolume",value:function(){return this.volume}},{key:"mediaInfo",value:function(){var e={meta:this.playParam,videoType:this.playMode};return e.meta.isHEVC=0===this.playParam.videoCodec,e}},{key:"snapshot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null===e||void 0!==this.playParam&&null!==this.playParam&&(0===this.playParam.videoCodec?(this.player.setScreen(!0),e.width=this.snapshotYuvLastFrame.width,e.height=this.snapshotYuvLastFrame.height,this.snapshotYuvLastFrame,void 0!==this.snapshotCanvasContext&&null!==this.snapshotCanvasContext||(this.snapshotCanvasContext=b.setupCanvas(e,{preserveDrawingBuffer:!1})),b.renderFrame(this.snapshotCanvasContext,this.snapshotYuvLastFrame.luma,this.snapshotYuvLastFrame.chromaB,this.snapshotYuvLastFrame.chromaR,this.snapshotYuvLastFrame.width,this.snapshotYuvLastFrame.height)):(e.width=this.playParam.size.width,e.height=this.playParam.size.height,e.getContext("2d").drawImage(this.player.videoTag,0,0,e.width,e.height))),null}},{key:"_seekHLS",value:function(e,t,i){if(void 0===this.player||null===this.player)return!1;setTimeout((function(){t.player.getCachePTS(),t.player.getCachePTS()>e?i():t._seekHLS(e,t,i)}),100)}},{key:"seek",value:function(e){if(void 0===this.player||null===this.player)return!1;var t=this;this.seekTarget=e,this.onSeekStart&&this.onSeekStart(e),this.timerFeed&&(window.clearInterval(this.timerFeed),this.timerFeed=null);var i=this._getSeekTarget();return this.playParam.videoCodec===v.CODEC_H264?(this.player.seek(e),this.onSeekFinish&&this.onSeekFinish()):this.configFormat.extInfo.core===v.PLAYER_CORE_TYPE_CNATIVE?(this.pause(),this._seekHLS(e,this,(function(){t.player.seek((function(){}),{seekTime:i,mode:t.playMode,accurateSeek:t.configFormat.accurateSeek})}))):this._seekHLS(e,this,(function(){t.player.seek((function(){t.configFormat.type==v.PLAYER_IN_TYPE_MP4?t.mp4Obj.seek(e):t.configFormat.type==v.PLAYER_IN_TYPE_TS||t.configFormat.type==v.PLAYER_IN_TYPE_MPEGTS?t.mpegTsObj.seek(e):t.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&(t.hlsObj.onSamples=null,t.hlsObj.seek(e));var i,n=(i=0,i=t.configFormat.accurateSeek?e:t._getBoxBufSeekIDR(),parseInt(i)),r=parseInt(t._getBoxBufSeekIDR())||0;t._avFeedMP4Data(r,n)}),{seekTime:i,mode:t.playMode,accurateSeek:t.configFormat.accurateSeek})})),!0}},{key:"fullScreen",value:function(){if(this.autoScreenClose=!0,this.player.vCodecID,this.player,this.player.vCodecID===v.V_CODEC_NAME_HEVC){var e=document.querySelector("#"+this.configFormat.playerId),t=e.getElementsByTagName("canvas")[0];e.style.width=this.screenW+"px",e.style.height=this.screenH+"px";var i=this._checkScreenDisplaySize(this.screenW,this.screenH,this.playParam.size.width,this.playParam.size.height);t.style.marginTop=i[0]+"px",t.style.marginLeft=i[1]+"px",t.style.width=i[2]+"px",t.style.height=i[3]+"px",this._requestFullScreen(e)}else this._requestFullScreen(this.player.videoTag)}},{key:"closeFullScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!1===e&&(this.autoScreenClose=!1,this._exitFull()),this.player.vCodecID===v.V_CODEC_NAME_HEVC){var t=document.querySelector("#"+this.configFormat.playerId),i=t.getElementsByTagName("canvas")[0];t.style.width=this.configFormat.playerW+"px",t.style.height=this.configFormat.playerH+"px";var n=this._checkScreenDisplaySize(this.configFormat.playerW,this.configFormat.playerH,this.playParam.size.width,this.playParam.size.height);i.style.marginTop=n[0]+"px",i.style.marginLeft=n[1]+"px",i.style.width=n[2]+"px",i.style.height=n[3]+"px"}}},{key:"playNextFrame",value:function(){return this.pause(),void 0!==this.playParam&&null!==this.playParam&&(0===this.playParam.videoCodec?this.player.playYUV():this.player.nativeNextFrame(),!0)}},{key:"resize",value:function(e,t){if(void 0!==this.player&&null!==this.player){if(!(e&&t&&this.playParam.size.width&&this.playParam.size.height))return!1;var i=this.playParam.size.width,n=this.playParam.size.height,r=0===this.playParam.videoCodec,a=document.querySelector("#"+this.configFormat.playerId);if(a.style.width=e+"px",a.style.height=t+"px",!0===r){var s=a.getElementsByTagName("canvas")[0],o=function(e,t){var r=i/e>n/t,a=(e/i).toFixed(2),s=(t/n).toFixed(2),o=r?a:s,u=parseInt(i*o,10),l=parseInt(n*o,10);return[parseInt((t-l)/2,10),parseInt((e-u)/2,10),u,l]}(e,t);s.style.marginTop=o[0]+"px",s.style.marginLeft=o[1]+"px",s.style.width=o[2]+"px",s.style.height=o[3]+"px"}else{var u=a.getElementsByTagName("video")[0];u.style.width=e+"px",u.style.height=t+"px"}return!0}return!1}},{key:"_checkScreenDisplaySize",value:function(e,t,i,n){var r=i/e>n/t,a=(e/i).toFixed(2),s=(t/n).toFixed(2),o=r?a:s,u=this.fixed?e:parseInt(i*o),l=this.fixed?t:parseInt(n*o);return[parseInt((t-l)/2),parseInt((e-u)/2),u,l]}},{key:"_isFullScreen",value:function(){var e=document.fullscreenElement||document.mozFullscreenElement||document.webkitFullscreenElement;return document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled,null!=e}},{key:"_requestFullScreen",value:function(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullScreen()}},{key:"_exitFull",value:function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()}},{key:"_durationText",value:function(e){if(e<0)return"Play";var t=Math.round(e);return Math.floor(t/3600)+":"+Math.floor(t%3600/60)+":"+Math.floor(t%60)}},{key:"_getSeekTarget",value:function(){return this.configFormat.accurateSeek?this.seekTarget:this._getBoxBufSeekIDR()}},{key:"_getBoxBufSeekIDR",value:function(){return this.configFormat.type==v.PLAYER_IN_TYPE_MP4?this.mp4Obj.seekPos:this.configFormat.type==v.PLAYER_IN_TYPE_TS||this.configFormat.type==v.PLAYER_IN_TYPE_MPEGTS?this.mpegTsObj.seekPos:this.configFormat.type==v.PLAYER_IN_TYPE_M3U8?this.hlsObj.seekPos:void 0}},{key:"_playControl",value:function(){this.isPlaying()?this.pause():this.play()}},{key:"_avFeedMP4Data",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(void 0===this.player||null===this.player)return!1;var r=parseInt(this.playParam.durationMs/1e3);this.player.clearAllCache(),this.timerFeed=window.setInterval((function(){var a=null,s=null,o=!0,u=!0;if(e.configFormat.type==v.PLAYER_IN_TYPE_MP4?(a=e.mp4Obj.popBuffer(1,t),s=e.mp4Obj.audioNone?null:e.mp4Obj.popBuffer(2,i)):e.configFormat.type==v.PLAYER_IN_TYPE_TS||e.configFormat.type==v.PLAYER_IN_TYPE_MPEGTS?(a=e.mpegTsObj.popBuffer(1,t),s=e.mpegTsObj.getAudioNone()?null:e.mpegTsObj.popBuffer(2,i)):e.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&(a=e.hlsObj.popBuffer(1,t),s=e.hlsObj.audioNone?null:e.hlsObj.popBuffer(2,i),t<r-1&&t>=e.hlsObj.getLastIdx()&&(o=!1),i<r-1&&i>=e.hlsObj.getALastIdx()&&(u=!1)),!0===o&&null!=a)for(var l=0;l<a.length;l++)e.player.appendHevcFrame(a[l]);if(!0===u&&null!=s)for(var h=0;h<s.length;h++)e.player.appendAACFrame(s[h]);if(e.playMode!==v.PLAYER_MODE_NOTIME_LIVE&&e.configFormat.type!==v.PLAYER_IN_TYPE_M3U8&&e.onCacheProcess&&e.onCacheProcess(e.player.getCachePTS()),!0===o&&null!=a&&(a.length,e.configFormat.extInfo.readyShow&&(e.configFormat.type===v.PLAYER_IN_TYPE_M3U8?e.configFormat.extInfo.readyShow=!1:e.configFormat.extInfo.core===v.PLAYER_CORE_TYPE_CNATIVE||(e.player.cacheYuvBuf.getState(),CACHE_APPEND_STATUS_CODE.NULL,!0===e.player.playYUV(!0,!0)&&(e.configFormat.extInfo.readyShow=!1,e.onReadyShowDone&&e.onReadyShowDone()))),t++),!0===u&&null!=s&&i++,t>r)return window.clearInterval(e.timerFeed),e.timerFeed=null,e.player.vCachePTS,e.player.aCachePTS,void(null!=n&&n())}),5)}},{key:"_isSupportWASM",value:function(){window.document;var e=window.navigator,t=e.userAgent.toLowerCase(),i="ipad"==t.match(/ipad/i),r="iphone os"==t.match(/iphone os/i),a="iPad"==t.match(/iPad/i),s="iPhone os"==t.match(/iPhone os/i),o="midp"==t.match(/midp/i),u="rv:1.2.3.4"==t.match(/rv:1.2.3.4/i),l="ucweb"==t.match(/ucweb/i),h="android"==t.match(/android/i),d="Android"==t.match(/Android/i),c="windows ce"==t.match(/windows ce/i),f="windows mobile"==t.match(/windows mobile/i);if(i||r||a||s||o||u||l||h||d||c||f)return!1;var m=function(){try{if("object"===("undefined"==typeof WebAssembly?"undefined":n(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}return!1}();if(!1===m)return!1;if(!0===m){var _=p.BrowserJudge(),g=_[0],v=_[1];if("Chrome"===g&&v<85)return!1;if(g.indexOf("360")>=0)return!1;if(/Safari/.test(e.userAgent)&&!/Chrome/.test(e.userAgent)&&v>13)return!1}return!0}},{key:"_makeMP4Player",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if(this._isSupportWASM(),!1===this._isSupportWASM()||!0===e){if(this.configFormat.type==v.PLAYER_IN_TYPE_MP4)t.mediaExtFormat===v.PLAYER_IN_TYPE_FLV?this._flvJsPlayer(this.playParam.durationMs,t.playParam.audioNone):this._makeNativePlayer();else if(this.configFormat.type==v.PLAYER_IN_TYPE_TS||this.configFormat.type==v.PLAYER_IN_TYPE_MPEGTS)this._mpegTsNv3rdPlayer(-1,!1);else if(this.configFormat.type==v.PLAYER_IN_TYPE_M3U8)this._videoJsPlayer();else if(this.configFormat.type===v.PLAYER_IN_TYPE_RAW_265)return-1;return 1}return this.mediaExtProtocol===v.URI_PROTOCOL_WEBSOCKET_DESC?(this.configFormat.type,this.configFormat.type===v.PLAYER_IN_TYPE_RAW_265?this._raw265Entry():this._cWsFLVDecoderEntry(),0):(null!=this.configFormat.extInfo.core&&null!==this.configFormat.extInfo.core&&this.configFormat.extInfo.core===v.PLAYER_CORE_TYPE_CNATIVE?this._cDemuxDecoderEntry():this.configFormat.type==v.PLAYER_IN_TYPE_MP4?this.configFormat.extInfo.moovStartFlag?this._mp4EntryVodStream():this._mp4Entry():this.configFormat.type==v.PLAYER_IN_TYPE_TS||this.configFormat.type==v.PLAYER_IN_TYPE_MPEGTS?this._mpegTsEntry():this.configFormat.type==v.PLAYER_IN_TYPE_M3U8?this._m3u8Entry():this.configFormat.type===v.PLAYER_IN_TYPE_RAW_265&&this._raw265Entry(),0)}},{key:"_makeMP4PlayerViewEvent",value:function(e,t,i,n){var r=this,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=this;if(this.playParam.durationMs=e,this.playParam.fps=t,this.playParam.sampleRate=i,this.playParam.size=n,this.playParam.audioNone=s,this.playParam.videoCodec=o||v.CODEC_H265,this.playParam,(this.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&this.hlsConf.hlsType==v.PLAYER_IN_TYPE_M3U8_LIVE||this.configFormat.type==v.PLAYER_IN_TYPE_RAW_265)&&(this.playMode=v.PLAYER_MODE_NOTIME_LIVE),u.configFormat.extInfo.autoCrop){var l=document.querySelector("#"+this.configFormat.playerId),h=n.width/n.height,d=this.configFormat.playerW/this.configFormat.playerH;h>d?l.style.height=this.configFormat.playerW/h+"px":h<d&&(l.style.width=this.configFormat.playerH*h+"px")}this.player=a({width:this.configFormat.playerW,height:this.configFormat.playerH,sampleRate:i,fps:t,appendHevcType:v.APPEND_TYPE_FRAME,fixed:!1,playerId:this.configFormat.playerId,audioNone:s,token:this.configFormat.token,videoCodec:o}),this.player.onPlayingTime=function(t){u._durationText(t),u._durationText(e/1e3),null!=u.onPlayTime&&u.onPlayTime(t)},this.player.onPlayingFinish=function(){r.pause(),r.seek(0),null!=r.onPlayFinish&&r.onPlayFinish()},this.player.onSeekFinish=function(){null!=u.onSeekFinish&&u.onSeekFinish()},this.player.onRender=function(e,t,i,n,r){u.snapshotYuvLastFrame.luma=null,u.snapshotYuvLastFrame.chromaB=null,u.snapshotYuvLastFrame.chromaR=null,u.snapshotYuvLastFrame.width=e,u.snapshotYuvLastFrame.height=t,u.snapshotYuvLastFrame.luma=new Uint8Array(i),u.snapshotYuvLastFrame.chromaB=new Uint8Array(n),u.snapshotYuvLastFrame.chromaR=new Uint8Array(r),null!=u.onRender&&u.onRender(e,t,i,n,r)},this.player.onLoadCache=function(){null!=r.onLoadCache&&r.onLoadCache()},this.player.onLoadCacheFinshed=function(){null!=r.onLoadCacheFinshed&&r.onLoadCacheFinshed()},u.player.setDurationMs(e),u.player.setFrameRate(t),null!=u.onLoadFinish&&(u.onLoadFinish(),u.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&u.onReadyShowDone&&u.onReadyShowDone())}},{key:"_makeNativePlayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,o=this;this.playParam.durationMs=e,this.playParam.fps=t,this.playParam.sampleRate=i,this.playParam.size=n,this.playParam.audioNone=r,this.playParam.videoCodec=a||v.CODEC_H264,this.configFormat.type==v.PLAYER_IN_TYPE_M3U8&&this.hlsConf.hlsType==v.PLAYER_IN_TYPE_M3U8_LIVE&&(this.playMode=v.PLAYER_MODE_NOTIME_LIVE),this.player=new s.Mp4Player({width:this.configFormat.playerW,height:this.configFormat.playerH,sampleRate:i,fps:t,appendHevcType:v.APPEND_TYPE_FRAME,fixed:!1,playerId:this.configFormat.playerId,audioNone:r,token:this.configFormat.token,videoCodec:a,autoPlay:this.configFormat.extInfo.autoPlay});var u=0,l=window.setInterval((function(){u++,void 0!==o.player&&null!==o.player||(window.clearInterval(l),l=null),u>v.DEFAULT_PLAYERE_LOAD_TIMEOUT&&(o.player.release(),o.player=null,o._cDemuxDecoderEntry(0,!0),window.clearInterval(l),l=null)}),1e3);this.player.makeIt(this.videoURL),this.player.onPlayingTime=function(t){o._durationText(t),o._durationText(e/1e3),null!=o.onPlayTime&&o.onPlayTime(t)},this.player.onPlayingFinish=function(){null!=o.onPlayFinish&&o.onPlayFinish()},this.player.onLoadFinish=function(){window.clearInterval(l),l=null,o.playParam.durationMs=1e3*o.player.duration,o.playParam.size=o.player.getSize(),o.onLoadFinish&&o.onLoadFinish(),o.onReadyShowDone&&o.onReadyShowDone()},this.player.onPlayState=function(e){o.onPlayState&&o.onPlayState(e)},this.player.onCacheProcess=function(e){o.onCacheProcess&&o.onCacheProcess(e)}}},{key:"_initMp4BoxObject",value:function(){var e=this;this.timerFeed=null,this.mp4Obj=new m,this.mp4Obj.onMp4BoxReady=function(t){var i=e.mp4Obj.getFPS(),n=T(i,e.mp4Obj.getDurationMs()),r=e.mp4Obj.getSampleRate(),a=e.mp4Obj.getSize(),s=e.mp4Obj.getVideoCoder();t===v.CODEC_H265?(e._makeMP4PlayerViewEvent(n,i,r,a,e.mp4Obj.audioNone,s),parseInt(n/1e3),e._avFeedMP4Data(0,0)):e._makeNativePlayer(n,i,r,a,e.mp4Obj.audioNone,s)}}},{key:"_mp4Entry",value:function(){var e=this,t=this;fetch(this.videoURL).then((function(e){return e.arrayBuffer()})).then((function(i){t._initMp4BoxObject(),e.mp4Obj.demux(),e.mp4Obj.appendBufferData(i,0),e.mp4Obj.finishBuffer(),e.mp4Obj.seek(-1)}))}},{key:"_mp4EntryVodStream",value:function(){var e=this,t=this;this.timerFeed=null,this.mp4Obj=new m,this._initMp4BoxObject(),this.mp4Obj.demux();var i=0,n=!1,r=window.setInterval((function(){n||(n=!0,fetch(e.videoURL).then((function(e){return function e(n){return n.read().then((function(a){if(a.done)return t.mp4Obj.finishBuffer(),t.mp4Obj.seek(-1),void window.clearInterval(r);var s=a.value;return t.mp4Obj.appendBufferData(s.buffer,i),i+=s.byteLength,e(n)}))}(e.body.getReader())})).catch((function(e){})))}),1)}},{key:"_cDemuxDecoderEntry",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.configFormat.type;var n=this,r=!1,a=new AbortController,s=a.signal,u={width:this.configFormat.playerW,height:this.configFormat.playerH,playerId:this.configFormat.playerId,token:this.configFormat.token,readyShow:this.configFormat.extInfo.readyShow,checkProbe:this.configFormat.extInfo.checkProbe,ignoreAudio:this.configFormat.extInfo.ignoreAudio,playMode:this.playMode,autoPlay:this.configFormat.extInfo.autoPlay,defaultFps:this.configFormat.extInfo.rawFps,cacheLength:this.configFormat.extInfo.cacheLength};this.player=new o.CNativeCore(u),window.g_players[this.player.corePtr]=this.player,this.player.onReadyShowDone=function(){n.configFormat.extInfo.readyShow=!1,n.onReadyShowDone&&n.onReadyShowDone()},this.player.onRelease=function(){a.abort()},this.player.onProbeFinish=function(){r=!0,n.player.config,n.player.audioNone,n.playParam.fps=n.player.config.fps,n.playParam.durationMs=T(n.playParam.fps,1e3*n.player.duration),n.player.duration<0&&(n.playMode=v.PLAYER_MODE_NOTIME_LIVE,n.playParam.durationMs=-1),n.playParam.sampleRate=n.player.config.sampleRate,n.playParam.size={width:n.player.width,height:n.player.height},n.playParam.audioNone=n.player.audioNone,n.player.vCodecID===v.V_CODEC_NAME_HEVC?(n.playParam.videoCodec=v.CODEC_H265,n.playParam.audioIdx<0&&(n.playParam.audioNone=!0),!0!==p.IsSupport265Mse()||!1!==i||n.mediaExtFormat!==v.PLAYER_IN_TYPE_MP4&&n.mediaExtFormat!==v.PLAYER_IN_TYPE_FLV?n.onLoadFinish&&n.onLoadFinish():(a.abort(),n.player.release(),n.mediaExtFormat,v.PLAYER_IN_TYPE_MP4,n.player=null,n.mediaExtFormat===v.PLAYER_IN_TYPE_MP4?n._makeNativePlayer(n.playParam.durationMs,n.playParam.fps,n.playParam.sampleRate,n.playParam.size,!1,n.playParam.videoCodec):n.mediaExtFormat===v.PLAYER_IN_TYPE_FLV&&n._flvJsPlayer(n.playParam.durationMs,n.playParam.audioNone))):(n.playParam.videoCodec=v.CODEC_H264,a.abort(),n.player.release(),n.player=null,n.mediaExtFormat===v.PLAYER_IN_TYPE_MP4?n._makeNativePlayer(n.playParam.durationMs,n.playParam.fps,n.playParam.sampleRate,n.playParam.size,!1,n.playParam.videoCodec):n.mediaExtFormat===v.PLAYER_IN_TYPE_FLV?n._flvJsPlayer(n.playParam.durationMs,n.playParam.audioNone):n.onLoadFinish&&n.onLoadFinish())},this.player.onPlayingTime=function(e){n._durationText(e),n._durationText(n.player.duration),null!=n.onPlayTime&&n.onPlayTime(e)},this.player.onPlayingFinish=function(){n.pause(),null!=n.onPlayTime&&n.onPlayTime(0),n.onPlayFinish&&n.onPlayFinish(),n.player.reFull=!0,n.seek(0)},this.player.onCacheProcess=function(t){e.onCacheProcess&&e.onCacheProcess(t)},this.player.onLoadCache=function(){null!=e.onLoadCache&&e.onLoadCache()},this.player.onLoadCacheFinshed=function(){null!=e.onLoadCacheFinshed&&e.onLoadCacheFinshed()},this.player.onRender=function(e,t,i,r,a){n.snapshotYuvLastFrame.luma=null,n.snapshotYuvLastFrame.chromaB=null,n.snapshotYuvLastFrame.chromaR=null,n.snapshotYuvLastFrame.width=e,n.snapshotYuvLastFrame.height=t,n.snapshotYuvLastFrame.luma=new Uint8Array(i),n.snapshotYuvLastFrame.chromaB=new Uint8Array(r),n.snapshotYuvLastFrame.chromaR=new Uint8Array(a),null!=n.onRender&&n.onRender(e,t,i,r,a)},this.player.onSeekFinish=function(){null!=e.onSeekFinish&&e.onSeekFinish()};var l=!1,h=0,d=function e(i){setTimeout((function(){if(!1===l){if(a.abort(),a=null,s=null,i>=v.FETCH_FIRST_MAX_TIMES)return;a=new AbortController,s=a.signal,e(i+1)}}),v.FETCH_HTTP_FLV_TIMEOUT_MS),fetch(n.videoURL,{signal:s}).then((function(e){if(e.headers.get("Content-Length"),!e.ok)return console.error("error cdemuxdecoder prepare request media failed with http code:",e.status),!1;if(l=!0,e.headers.has("Content-Length"))h=e.headers.get("Content-Length"),n.configFormat.extInfo.coreProbePart<=0?n.player&&n.player.setProbeSize(n.configFormat.extInfo.probeSize):n.player&&n.player.setProbeSize(h*n.configFormat.extInfo.coreProbePart);else{if(n.mediaExtFormat===v.PLAYER_IN_TYPE_FLV)return a.abort(),n.player.release(),n.player=null,n._cLiveFLVDecoderEntry(u),!0;n.player&&n.player.setProbeSize(40960)}return e.headers.get("Content-Length"),n.configFormat.type,n.mediaExtFormat,function e(i){return i.read().then((function(a){if(a.done)return!0===r||(n.player.release(),n.player=null,t<v.PLAYER_CNATIVE_VOD_RETRY_MAX?(t+=1,n._cDemuxDecoderEntry(t),!0):(n._mp4EntryVodStream(),!1));a.value.buffer;var s=new Uint8Array(a.value.buffer);return n.player&&n.player.pushBuffer(s)<0?(n.player.release(),n.player=null,t<v.PLAYER_CNATIVE_VOD_RETRY_MAX?(t+=1,n._cDemuxDecoderEntry(t),!0):(n._mp4EntryVodStream(),!1)):e(i)}))}(e.body.getReader())})).catch((function(e){e.toString().includes("user aborted")||console.error("cdemuxdecoder error",e)}))};d(0)}},{key:"_cLiveG711DecoderEntry",value:function(e){var t=this,i=this;e.probeSize=this.configFormat.extInfo.probeSize,this.player=new l.CHttpG711Core(e),window.g_players[this.player.corePtr]=this.player,this.player.onProbeFinish=function(){i.playParam.fps=i.player.mediaInfo.fps,i.playParam.durationMs=-1,i.playMode=v.PLAYER_MODE_NOTIME_LIVE,i.playParam.sampleRate=i.player.mediaInfo.sampleRate,i.playParam.size={width:i.player.mediaInfo.width,height:i.player.mediaInfo.height},i.playParam.audioNone=i.player.mediaInfo.audioNone,i.player.mediaInfo,i.player.vCodecID===v.V_CODEC_NAME_HEVC?(i.playParam.audioIdx<0&&(i.playParam.audioNone=!0),i.playParam.videoCodec=v.CODEC_H265,i.onLoadFinish&&i.onLoadFinish()):(i.playParam.videoCodec=v.CODEC_H264,i.player.release(),i.player=null,i._flvJsPlayer(i.playParam.durationMs,i.playParam.audioNone))},this.player.onError=function(e){i.onError&&i.onError(e)},this.player.onReadyShowDone=function(){i.configFormat.extInfo.readyShow=!1,i.onReadyShowDone&&i.onReadyShowDone()},this.player.onLoadCache=function(){null!=t.onLoadCache&&t.onLoadCache()},this.player.onLoadCacheFinshed=function(){null!=t.onLoadCacheFinshed&&t.onLoadCacheFinshed()},this.player.onRender=function(e,t,n,r,a){i.snapshotYuvLastFrame.luma=null,i.snapshotYuvLastFrame.chromaB=null,i.snapshotYuvLastFrame.chromaR=null,i.snapshotYuvLastFrame.width=e,i.snapshotYuvLastFrame.height=t,i.snapshotYuvLastFrame.luma=new Uint8Array(n),i.snapshotYuvLastFrame.chromaB=new Uint8Array(r),i.snapshotYuvLastFrame.chromaR=new Uint8Array(a),null!=i.onRender&&i.onRender(e,t,n,r,a)},this.player.onPlayState=function(e){i.onPlayState&&i.onPlayState(e)},this.player.start(this.videoURL)}},{key:"_cLiveFLVDecoderEntry",value:function(e){var t=this,i=this;e.probeSize=this.configFormat.extInfo.probeSize,this.player=new u.CHttpLiveCore(e),window.g_players[this.player.corePtr]=this.player,this.player.onProbeFinish=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(1===t)return i.player.release(),i.player=null,void i._cLiveG711DecoderEntry(e);if(i.playParam.fps=i.player.mediaInfo.fps,i.playParam.durationMs=-1,i.playMode=v.PLAYER_MODE_NOTIME_LIVE,i.playParam.sampleRate=i.player.mediaInfo.sampleRate,i.playParam.size={width:i.player.mediaInfo.width,height:i.player.mediaInfo.height},i.playParam.audioNone=i.player.mediaInfo.audioNone,i.player.mediaInfo,i.player.vCodecID===v.V_CODEC_NAME_HEVC)i.playParam.videoCodec=v.CODEC_H265,i.playParam.audioIdx<0&&(i.playParam.audioNone=!0),!0===p.IsSupport265Mse()&&i.mediaExtFormat===v.PLAYER_IN_TYPE_FLV?(i.player.release(),i.player=null,i.mediaExtFormat===v.PLAYER_IN_TYPE_FLV&&i._flvJsPlayer(i.playParam.durationMs,i.playParam.audioNone)):i.onLoadFinish&&i.onLoadFinish();else if(i.playParam.videoCodec=v.CODEC_H264,i.player.release(),i.player=null,i.mediaExtFormat===v.PLAYER_IN_TYPE_FLV)i._flvJsPlayer(i.playParam.durationMs,i.playParam.audioNone);else{if(i.mediaExtFormat!==v.PLAYER_IN_TYPE_TS&&i.mediaExtFormat!==v.PLAYER_IN_TYPE_MPEGTS)return-1;i._mpegTsNv3rdPlayer(i.playParam.durationMs,i.playParam.audioNone)}},this.player.onError=function(e){i.onError&&i.onError(e)},this.player.onReadyShowDone=function(){i.configFormat.extInfo.readyShow=!1,i.onReadyShowDone&&i.onReadyShowDone()},this.player.onLoadCache=function(){null!=t.onLoadCache&&t.onLoadCache()},this.player.onLoadCacheFinshed=function(){null!=t.onLoadCacheFinshed&&t.onLoadCacheFinshed()},this.player.onRender=function(e,t,n,r,a){i.snapshotYuvLastFrame.luma=null,i.snapshotYuvLastFrame.chromaB=null,i.snapshotYuvLastFrame.chromaR=null,i.snapshotYuvLastFrame.width=e,i.snapshotYuvLastFrame.height=t,i.snapshotYuvLastFrame.luma=new Uint8Array(n),i.snapshotYuvLastFrame.chromaB=new Uint8Array(r),i.snapshotYuvLastFrame.chromaR=new Uint8Array(a),null!=i.onRender&&i.onRender(e,t,n,r,a)},this.player.onPlayState=function(e){i.onPlayState&&i.onPlayState(e)},this.player.start(this.videoURL)}},{key:"_cWsFLVDecoderEntry",value:function(){var e=this,t=this,i={width:this.configFormat.playerW,height:this.configFormat.playerH,playerId:this.configFormat.playerId,token:this.configFormat.token,readyShow:this.configFormat.extInfo.readyShow,checkProbe:this.configFormat.extInfo.checkProbe,ignoreAudio:this.configFormat.extInfo.ignoreAudio,playMode:this.playMode,autoPlay:this.configFormat.extInfo.autoPlay};i.probeSize=this.configFormat.extInfo.probeSize,this.player=new h.CWsLiveCore(i),i.probeSize,window.g_players[this.player.corePtr]=this.player,this.player.onProbeFinish=function(){t.playParam.fps=t.player.mediaInfo.fps,t.playParam.durationMs=-1,t.playMode=v.PLAYER_MODE_NOTIME_LIVE,t.playParam.sampleRate=t.player.mediaInfo.sampleRate,t.playParam.size={width:t.player.mediaInfo.width,height:t.player.mediaInfo.height},t.playParam.audioNone=t.player.mediaInfo.audioNone,t.player.mediaInfo,t.player.vCodecID===v.V_CODEC_NAME_HEVC?(t.playParam.audioIdx<0&&(t.playParam.audioNone=!0),t.playParam.videoCodec=v.CODEC_H265,!0===p.IsSupport265Mse()&&t.mediaExtFormat===v.PLAYER_IN_TYPE_FLV?(t.player.release(),t.player=null,t._flvJsPlayer(t.playParam.durationMs,t.playParam.audioNone)):t.onLoadFinish&&t.onLoadFinish()):(t.playParam.videoCodec=v.CODEC_H264,t.player.release(),t.player=null,t._flvJsPlayer(t.playParam.durationMs,t.playParam.audioNone))},this.player.onError=function(e){t.onError&&t.onError(e)},this.player.onReadyShowDone=function(){t.configFormat.extInfo.readyShow=!1,t.onReadyShowDone&&t.onReadyShowDone()},this.player.onLoadCache=function(){null!=e.onLoadCache&&e.onLoadCache()},this.player.onLoadCacheFinshed=function(){null!=e.onLoadCacheFinshed&&e.onLoadCacheFinshed()},this.player.onRender=function(e,i,n,r,a){t.snapshotYuvLastFrame.luma=null,t.snapshotYuvLastFrame.chromaB=null,t.snapshotYuvLastFrame.chromaR=null,t.snapshotYuvLastFrame.width=e,t.snapshotYuvLastFrame.height=i,t.snapshotYuvLastFrame.luma=new Uint8Array(n),t.snapshotYuvLastFrame.chromaB=new Uint8Array(r),t.snapshotYuvLastFrame.chromaR=new Uint8Array(a),null!=t.onRender&&t.onRender(e,i,n,r,a)},this.player.start(this.videoURL)}},{key:"_mpegTsEntry",value:function(){var e=this,t=(Module.cwrap("AVPlayerInit","number",["string","string"])(this.configFormat.token,"0.0.0"),new AbortController),i=t.signal;this.timerFeed=null,this.mpegTsObj=new _.MpegTs,this.mpegTsObj.bindReady(e),this.mpegTsObj.onDemuxed=this._mpegTsEntryReady.bind(this),this.mpegTsObj.onReady=function(){var n=null;fetch(e.videoURL,{signal:i}).then((function(r){if(r.headers.has("Content-Length"))return function t(i){return i.read().then((function(r){if(!r.done){var a=r.value;if(null===n)n=a;else{var s=a,o=n.length+s.length,u=new Uint8Array(o);u.set(n),u.set(s,n.length),n=new Uint8Array(u),s=null,u=null}return t(i)}e.mpegTsObj.demux(n)}))}(r.body.getReader());t.abort(),i=null,t=null;var a={width:e.configFormat.playerW,height:e.configFormat.playerH,playerId:e.configFormat.playerId,token:e.configFormat.token,readyShow:e.configFormat.extInfo.readyShow,checkProbe:e.configFormat.extInfo.checkProbe,ignoreAudio:e.configFormat.extInfo.ignoreAudio,playMode:e.playMode,autoPlay:e.configFormat.extInfo.autoPlay};e._cLiveFLVDecoderEntry(a)})).catch((function(e){if(!e.toString().includes("user aborted")){var t=" mpegts request error:"+e;console.error(t)}}))},this.mpegTsObj.initMPEG()}},{key:"_mpegTsEntryReady",value:function(e){var t=e,i=(t.mpegTsObj.getVCodec(),t.mpegTsObj.getACodec()),n=t.mpegTsObj.getDurationMs(),r=t.mpegTsObj.getFPS(),a=t.mpegTsObj.getSampleRate(),s=t.mpegTsObj.getSize(),o=this.mpegTsObj.isHEVC();if(!o)return this.mpegTsObj.releaseTsDemuxer(),this.mpegTsObj=null,this.playParam.durationMs=n,this.playParam.fps=r,this.playParam.sampleRate=a,this.playParam.size=s,this.playParam.audioNone=""==i,this.playParam.videoCodec=o?0:1,this.playParam,void this._mpegTsNv3rdPlayer(this.playParam.durationMs,this.playParam.audioNone);t._makeMP4PlayerViewEvent(n,r,a,s,""==i),parseInt(n/1e3),t._avFeedMP4Data(0,0)}},{key:"_m3u8Entry",value:function(){var e=this,t=this;if(!1===this._isSupportWASM())return this._videoJsPlayer();Module.cwrap("AVPlayerInit","number",["string","string"])(this.configFormat.token,"0.0.0");var i=!1,n=0;this.hlsObj=new g.M3u8,this.hlsObj.bindReady(t),this.hlsObj.onFinished=function(e,r){0==i&&(n=t.hlsObj.getDurationMs(),t.hlsConf.hlsType=r.type,i=!0)},this.hlsObj.onCacheProcess=function(t){e.playMode!==v.PLAYER_MODE_NOTIME_LIVE&&e.onCacheProcess&&e.onCacheProcess(t)},this.hlsObj.onDemuxed=function(e){if(null==t.player){var i=t.hlsObj.isHevcParam,r=(t.hlsObj.getVCodec(),t.hlsObj.getACodec()),a=t.hlsObj.getFPS(),s=t.hlsObj.getSampleRate(),o=t.hlsObj.getSize(),u=!1;if(u=t.hlsObj.getSampleChannel()<=0||""===r,!i)return t.hlsObj.release(),t.hlsObj.mpegTsObj&&t.hlsObj.mpegTsObj.releaseTsDemuxer(),t.hlsObj=null,t.playParam.durationMs=n,t.playParam.fps=a,t.playParam.sampleRate=s,t.playParam.size=o,t.playParam.audioNone=""==r,t.playParam.videoCodec=i?0:1,t.playParam,void t._videoJsPlayer(n);t._makeMP4PlayerViewEvent(n,a,s,o,u)}},this.hlsObj.onSamples=this._hlsOnSamples.bind(this),this.hlsObj.demux(this.videoURL)}},{key:"_hlsOnSamples",value:function(e,t){1==t.video?this.player.appendHevcFrame(t):!1===this.hlsObj.audioNone&&this.player.appendAACFrame(t)}},{key:"_videoJsPlayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=this,i={probeDurationMS:e,width:this.configFormat.playerW,height:this.configFormat.playerH,playerId:this.configFormat.playerId,ignoreAudio:this.configFormat.extInfo.ignoreAudio,autoPlay:this.configFormat.extInfo.autoPlay,playMode:this.playMode};this.player=new d.NvVideojsCore(i),this.player.onMakeItReady=function(){t.onMakeItReady&&t.onMakeItReady()},this.player.onLoadFinish=function(){t.playParam.size=t.player.getSize(),t.playParam.videoCodec=1,t.player.duration===1/0||t.player.duration<0?(t.playParam.durationMs=-1,t.playMode=v.PLAYER_MODE_NOTIME_LIVE):(t.playParam.durationMs=1e3*t.player.duration,t.playMode=v.PLAYER_MODE_VOD),t.playParam,t.player.duration,t.player.getSize(),t.onLoadFinish&&t.onLoadFinish()},this.player.onReadyShowDone=function(){t.onReadyShowDone&&t.onReadyShowDone()},this.player.onPlayingFinish=function(){t.pause(),t.seek(0),null!=t.onPlayFinish&&t.onPlayFinish()},this.player.onPlayingTime=function(e){t._durationText(e),t._durationText(t.player.duration),null!=t.onPlayTime&&t.onPlayTime(e)},this.player.onSeekFinish=function(){t.onSeekFinish&&t.onSeekFinish()},this.player.onPlayState=function(e){t.onPlayState&&t.onPlayState(e)},this.player.onCacheProcess=function(e){t.onCacheProcess&&t.onCacheProcess(e)},this.player.makeIt(this.videoURL)}},{key:"_flvJsPlayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this,n={width:this.configFormat.playerW,height:this.configFormat.playerH,playerId:this.configFormat.playerId,ignoreAudio:this.configFormat.extInfo.ignoreAudio,duration:e,autoPlay:this.configFormat.extInfo.autoPlay,audioNone:t};this.player=new c.NvFlvjsCore(n),this.player.onLoadFinish=function(){i.playParam.size=i.player.getSize(),!i.player.duration||NaN===i.player.duration||i.player.duration===1/0||i.player.duration<0?(i.playParam.durationMs=-1,i.playMode=v.PLAYER_MODE_NOTIME_LIVE):(i.playParam.durationMs=1e3*i.player.duration,i.playMode=v.PLAYER_MODE_VOD),i.onLoadFinish&&i.onLoadFinish()},this.player.onReadyShowDone=function(){i.onReadyShowDone&&i.onReadyShowDone()},this.player.onPlayingTime=function(e){i._durationText(e),i._durationText(i.player.duration),null!=i.onPlayTime&&i.onPlayTime(e)},this.player.onPlayingFinish=function(){i.pause(),i.seek(0),null!=i.onPlayFinish&&i.onPlayFinish()},this.player.onPlayState=function(e){i.onPlayState&&i.onPlayState(e)},this.player.onCacheProcess=function(e){i.onCacheProcess&&i.onCacheProcess(e)},this.player.makeIt(this.videoURL)}},{key:"_mpegTsNv3rdPlayer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this,n={width:this.configFormat.playerW,height:this.configFormat.playerH,playerId:this.configFormat.playerId,ignoreAudio:this.configFormat.extInfo.ignoreAudio,duration:e,autoPlay:this.configFormat.extInfo.autoPlay,audioNone:t};this.player=new f.NvMpegTsCore(n),this.player.onLoadFinish=function(){i.playParam.size=i.player.getSize(),!i.player.duration||NaN===i.player.duration||i.player.duration===1/0||i.player.duration<0?(i.playParam.durationMs=-1,i.playMode=v.PLAYER_MODE_NOTIME_LIVE):(i.playParam.durationMs=1e3*i.player.duration,i.playMode=v.PLAYER_MODE_VOD),i.onLoadFinish&&i.onLoadFinish()},this.player.onReadyShowDone=function(){i.onReadyShowDone&&i.onReadyShowDone()},this.player.onPlayingTime=function(e){i._durationText(e),i._durationText(i.player.duration),null!=i.onPlayTime&&i.onPlayTime(e)},this.player.onPlayingFinish=function(){i.pause(),i.seek(0),null!=i.onPlayFinish&&i.onPlayFinish()},this.player.onPlayState=function(e){i.onPlayState&&i.onPlayState(e)},this.player.onCacheProcess=function(e){i.onCacheProcess&&i.onCacheProcess(e)},this.player.makeIt(this.videoURL)}},{key:"_raw265Entry",value:function(){var e=this;this.videoURL;var t=function t(){setTimeout((function(){e.workerParse.postMessage({cmd:"get-nalu",data:null,msg:"get-nalu"}),e.workerParse.parseEmpty,e.workerFetch.onMsgFetchFinished,!0===e.workerFetch.onMsgFetchFinished&&!0===e.workerParse.frameListEmpty&&!1===e.workerParse.streamEmpty&&e.workerParse.postMessage({cmd:"last-nalu",data:null,msg:"last-nalu"}),!0===e.workerParse.parseEmpty&&(e.workerParse.stopNaluInterval=!0),!0!==e.workerParse.stopNaluInterval&&t()}),1e3)};this._makeMP4PlayerViewEvent(-1,this.configFormat.extInfo.rawFps,-1,{width:this.configFormat.playerW,height:this.configFormat.playerH},!0,v.CODEC_H265),this.timerFeed&&(window.clearInterval(this.timerFeed),this.timerFeed=null),e.workerFetch=new Worker(p.GetScriptPath((function(){var e=new AbortController,t=e.signal,i=null;onmessage=function(n){var r=n.data;switch(void 0===r.cmd||null===r.cmd?"":r.cmd){case"start":var a=r.url;"http"===r.type?fetch(a,{signal:t}).then((function(e){return function e(t){return t.read().then((function(i){if(!i.done){var n=i.value;return postMessage({cmd:"fetch-chunk",data:n,msg:"fetch-chunk"}),e(t)}postMessage({cmd:"fetch-fin",data:null,msg:"fetch-fin"})}))}(e.body.getReader())})).catch((function(e){})):"websocket"===r.type&&function(e){(i=new WebSocket(e)).binaryType="arraybuffer",i.onopen=function(e){i.send("Hello WebSockets!")},i.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=e.data;t.byteLength>0&&postMessage({cmd:"fetch-chunk",data:new Uint8Array(t),msg:"fetch-chunk"})}},i.onclose=function(e){postMessage({cmd:"fetch-fin",data:null,msg:"fetch-fin"})}}(a),postMessage({cmd:"default",data:"WORKER STARTED",msg:"default"});break;case"stop":"http"===r.type?e.abort():"websocket"===r.type&&i&&i.close(),close()}}}))),e.workerFetch.onMsgFetchFinished=!1,e.workerFetch.onmessage=function(i){var n=i.data;switch(void 0===n.cmd||null===n.cmd?"":n.cmd){case"fetch-chunk":var r=n.data;e.workerParse.postMessage({cmd:"append-chunk",data:r,msg:"append-chunk"});break;case"fetch-fin":e.workerFetch.onMsgFetchFinished=!0,t()}},e.workerParse=new Worker(p.GetScriptPath((function(){var e,t=((e=new Object).frameList=[],e.stream=null,e.frameListEmpty=function(){return e.frameList.length<=0},e.streamEmpty=function(){return null===e.stream||e.stream.length<=0},e.checkEmpty=function(){return!0===e.streamEmpty()&&!0===e.frameListEmpty()||(e.stream,e.frameList,!1)},e.pushFrameRet=function(t){return!(!t||null==t||null==t||(e.frameList&&null!=e.frameList&&null!=e.frameList||(e.frameList=[]),e.frameList.push(t),0))},e.nextFrame=function(){return!e.frameList&&null==e.frameList||null==e.frameList&&e.frameList.length<1?null:e.frameList.shift()},e.clearFrameRet=function(){e.frameList=null},e.setStreamRet=function(t){e.stream=t},e.getStreamRet=function(){return e.stream},e.appendStreamRet=function(t){if(!t||void 0===t||null==t)return!1;if(!e.stream||void 0===e.stream||null==e.stream)return e.stream=t,!0;var i=e.stream.length,n=t.length,r=new Uint8Array(i+n);r.set(e.stream,0),r.set(t,i),e.stream=r;for(var a=0;a<9999;a++){var s=e.nextNalu();if(!1===s||null==s)break;e.frameList.push(s)}return!0},e.subBuf=function(t,i){var n=new Uint8Array(e.stream.subarray(t,i+1));return e.stream=new Uint8Array(e.stream.subarray(i+1)),n},e.lastNalu=function(){var t=e.subBuf(0,e.stream.length);e.frameList.push(t)},e.nextNalu=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(null==e.stream||e.stream.length<=4)return!1;for(var i=-1,n=0;n<e.stream.length;n++){if(n+5>=e.stream.length)return!1;if(0==e.stream[n]&&0==e.stream[n+1]&&1==e.stream[n+2]||0==e.stream[n]&&0==e.stream[n+1]&&0==e.stream[n+2]&&1==e.stream[n+3]){var r=n;if(n+=3,-1==i)i=r;else{if(t<=1)return e.subBuf(i,r-1);t-=1}}}return!1},e.nextNalu2=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(null==e.stream||e.stream.length<=4)return!1;for(var i=-1,n=0;n<e.stream.length;n++){if(n+5>=e.stream.length)return-1!=i&&e.subBuf(i,e.stream.length-1);var r="0 0 1"==e.stream.slice(n,n+3).join(" "),a="0 0 0 1"==e.stream.slice(n,n+4).join(" ");if(r||a){var s=n;if(n+=3,-1==i)i=s;else{if(t<=1)return e.subBuf(i,s-1);t-=1}}}return!1},e);onmessage=function(e){var i=e.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"append-chunk":var n=i.data;t.appendStreamRet(n);var r=t.nextFrame();postMessage({cmd:"return-nalu",data:r,msg:"return-nalu",parseEmpty:t.checkEmpty(),streamEmpty:t.streamEmpty(),frameListEmpty:t.frameListEmpty()});break;case"get-nalu":var a=t.nextFrame();postMessage({cmd:"return-nalu",data:a,msg:"return-nalu",parseEmpty:t.checkEmpty(),streamEmpty:t.streamEmpty(),frameListEmpty:t.frameListEmpty()});break;case"last-nalu":var s=t.lastNalu();postMessage({cmd:"return-nalu",data:s,msg:"return-nalu",parseEmpty:t.checkEmpty(),streamEmpty:t.streamEmpty(),frameListEmpty:t.frameListEmpty()});break;case"stop":postMessage("parse - WORKER STOPPED: "+i),close()}}}))),e.workerParse.stopNaluInterval=!1,e.workerParse.parseEmpty=!1,e.workerParse.streamEmpty=!1,e.workerParse.frameListEmpty=!1,e.workerParse.onmessage=function(t){var i=t.data;switch(void 0===i.cmd||null===i.cmd?"":i.cmd){case"return-nalu":var n=i.data,r=i.parseEmpty,a=i.streamEmpty,s=i.frameListEmpty;e.workerParse.parseEmpty=r,e.workerParse.streamEmpty=a,e.workerParse.frameListEmpty=s,!1===n||null==n?!0===e.workerFetch.onMsgFetchFinished&&!0===r&&(e.workerParse.stopNaluInterval=!0):(e.append265NaluFrame(n),e.workerParse.postMessage({cmd:"get-nalu",data:null,msg:"get-nalu"}))}},p.ParseGetMediaURL(this.videoURL),this.workerFetch.postMessage({cmd:"start",url:p.ParseGetMediaURL(this.videoURL),type:this.mediaExtProtocol,msg:"start"}),function t(){setTimeout((function(){e.configFormat.extInfo.readyShow&&(e.player.cacheYuvBuf.getState()!=CACHE_APPEND_STATUS_CODE.NULL?(e.player.playFrameYUV(!0,!0),e.configFormat.extInfo.readyShow=!1,e.onReadyShowDone&&e.onReadyShowDone()):t())}),1e3)}()}},{key:"append265NaluFrame",value:function(e){var t={data:e,pts:this.rawModePts};this.player.appendHevcFrame(t),this.configFormat.extInfo.readyShow&&this.player.cacheYuvBuf.getState()!=CACHE_APPEND_STATUS_CODE.NULL&&(this.player.playFrameYUV(!0,!0),this.configFormat.extInfo.readyShow=!1,this.onReadyShowDone&&this.onReadyShowDone()),this.rawModePts+=1/this.configFormat.extInfo.rawFps}}])&&r(i.prototype,E),w&&r(i,w),e}();i.H265webjs=E,t.new265webjs=function(e,t){return new E(e,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./consts":52,"./decoder/av-common":56,"./decoder/c-http-g711-core":57,"./decoder/c-httplive-core":58,"./decoder/c-native-core":59,"./decoder/c-wslive-core":60,"./decoder/cache":61,"./decoder/player-core":65,"./demuxer/m3u8":69,"./demuxer/mp4":71,"./demuxer/mpegts/mpeg.js":74,"./demuxer/ts":75,"./native/mp4-player":77,"./native/nv-flvjs-core":78,"./native/nv-mpegts-core":79,"./native/nv-videojs-core":80,"./render-engine/webgl-420p":81,"./utils/static-mem":82,"./utils/ui/ui":83}],77:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("../consts"),a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configFormat={width:t.width||r.DEFAULT_WIDTH,height:t.height||r.DEFAULT_HEIGHT,fps:t.fps||r.DEFAULT_FPS,fixed:t.fixed||r.DEFAULT_FIXED,sampleRate:t.sampleRate||r.DEFAULT_SAMPLERATE,appendHevcType:t.appendHevcType||r.APPEND_TYPE_STREAM,frameDurMs:t.frameDur||r.DEFAULT_FRAME_DUR,playerId:t.playerId||r.DEFAILT_WEBGL_PLAY_ID,audioNone:t.audioNone||!1,token:t.token||null,videoCodec:t.videoCodec||r.CODEC_H265,autoPlay:t.autoPlay||!1},this.videoTag=null,this.isPlaying=!1,this.duration=-1,this.bufferInterval=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onPlayState=null,this.onCacheProcess=null}var t,i,a;return t=e,(i=[{key:"makeIt",value:function(e){var t=this,i=document.querySelector("div#"+this.configFormat.playerId);this.videoTag=document.createElement("video"),!0===this.configFormat.autoPlay&&(this.videoTag.muted="muted",this.videoTag.autoplay="autoplay",window.onclick=document.body.onclick=function(e){t.videoTag.muted=!1,t.isPlayingState()}),this.videoTag.onplay=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.videoTag.onpause=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.videoTag.ontimeupdate=function(){t.onPlayingTime&&t.onPlayingTime(t.videoTag.currentTime)},this.videoTag.onended=function(){t.onPlayingFinish&&t.onPlayingFinish()},this.videoTag.onloadedmetadata=function(e){t.duration=t.videoTag.duration,t.onLoadFinish&&t.onLoadFinish(),null!==t.bufferInterval&&(window.clearInterval(t.bufferInterval),t.bufferInterval=null),t.bufferInterval=window.setInterval((function(){var e=t.videoTag.buffered.end(0);if(e>=t.duration-.04)return t.onCacheProcess&&t.onCacheProcess(t.duration),void window.clearInterval(t.bufferInterval);t.onCacheProcess&&t.onCacheProcess(e)}),200)},this.videoTag.src=e,this.videoTag.style.width="100%",this.videoTag.style.height="100%",i.appendChild(this.videoTag)}},{key:"setPlaybackRate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return!(e<=0||null==this.videoTag||null===this.videoTag||(this.videoTag.playbackRate=e,0))}},{key:"getPlaybackRate",value:function(){return null==this.videoTag||null===this.videoTag?0:this.videoTag.playbackRate}},{key:"getSize",value:function(){return{width:this.videoTag.videoWidth>0?this.videoTag.videoWidth:this.configFormat.width,height:this.videoTag.videoHeight>0?this.videoTag.videoHeight:this.configFormat.height}}},{key:"play",value:function(){this.videoTag.play()}},{key:"seek",value:function(e){this.videoTag.currentTime=e}},{key:"pause",value:function(){this.videoTag.pause()}},{key:"setVoice",value:function(e){this.videoTag.volume=e}},{key:"isPlayingState",value:function(){return!this.videoTag.paused}},{key:"release",value:function(){this.videoTag&&this.videoTag.remove(),this.videoTag=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onPlayState=null,null!==this.bufferInterval&&(window.clearInterval(this.bufferInterval),this.bufferInterval=null),window.onclick=document.body.onclick=null}},{key:"nativeNextFrame",value:function(){void 0!==this.videoTag&&null!==this.videoTag&&(this.videoTag.currentTime+=1/this.configFormat.fps)}}])&&n(t.prototype,i),a&&n(t,a),e}();i.Mp4Player=a},{"../consts":52}],78:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("../consts"),a=(e("../version"),e("../demuxer/flv-hevc/flv-hevc.js")),s=e("../decoder/av-common"),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configFormat={width:t.width||r.DEFAULT_WIDTH,height:t.height||r.DEFAULT_HEIGHT,playerId:t.playerId||r.DEFAILT_WEBGL_PLAY_ID,ignoreAudio:t.ignoreAudio,duration:t.duration,autoPlay:t.autoPlay||!1,audioNone:t.audioNone},this.audioVoice=1,this.myPlayerID=this.configFormat.playerId+"-flv-hevc",this.myPlayer=null,this.videoContaner=null,this.videoTag=null,this.duration=-1,this.width=-1,this.height=-1,this.isPlaying=!1,this.vCodecID=r.V_CODEC_NAME_AVC,this.audioNone=!1,this.showScreen=!1,this.playPTS=0,this.vCachePTS=0,this.aCachePTS=0,this.isInitDecodeFrames=!1,this.lastDecodedFrame=0,this.lastDecodedFrameTime=-1,this.checkStartIntervalCount=0,this.checkStartInterval=null,this.checkPicBlockInterval=null,this.bufferInterval=null,this.onPlayState=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onReadyShowDone=null,this.onCacheProcess=null}var t,i,o;return t=e,(i=[{key:"_reBuildFlvjs",value:function(e){this._releaseFlvjs(),this.makeIt(e)}},{key:"_checkPicBlock",value:function(e){var t=this;this.checkPicBlockInterval=window.setInterval((function(){if(t.lastDecodedFrameTime>0&&s.GetMsTime()-t.lastDecodedFrameTime>1e4)return window.clearInterval(t.checkPicBlockInterval),t.checkPicBlockInterval=null,void t._reBuildFlvjs(e)}),1e3)}},{key:"_checkLoadState",value:function(e){var t=this;this.checkStartIntervalCount=0,this.checkStartInterval=window.setInterval((function(){return t.lastDecodedFrame,t.isInitDecodeFrames,t.checkStartIntervalCount,!1!==t.isInitDecodeFrames?(t.checkStartIntervalCount=0,window.clearInterval(t.checkStartInterval),void(t.checkStartInterval=null)):(t.checkStartIntervalCount+=1,t.checkStartIntervalCount>20?(window.clearInterval(t.checkStartInterval),t.checkStartIntervalCount=0,t.checkStartInterval=null,void(!1===t.isInitDecodeFrames&&t._reBuildFlvjs(e))):void 0)}),500)}},{key:"makeIt",value:function(e){var t=this;if(a.isSupported()){var i=document.querySelector("#"+this.configFormat.playerId);this.videoTag=document.createElement("video"),this.videoTag.id=this.myPlayerID,this.videoTag.style.width=this.configFormat.width+"px",this.videoTag.style.height=this.configFormat.height+"px",i.appendChild(this.videoTag),!0===this.configFormat.autoPlay&&(this.videoTag.muted="muted",this.videoTag.autoplay="autoplay",window.onclick=document.body.onclick=function(e){t.videoTag.muted=!1,t.isPlayingState(),window.onclick=document.body.onclick=null}),this.videoTag.onplay=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.videoTag.onpause=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)};var n={hasVideo:!0,hasAudio:!(!0===this.configFormat.audioNone),type:"flv",url:e,isLive:this.configFormat.duration<=0,withCredentials:!1};this.myPlayer=a.createPlayer(n),this.myPlayer.attachMediaElement(this.videoTag),this.myPlayer.on(a.Events.MEDIA_INFO,(function(e){t.videoTag.videoWidth,!1===t.isInitDecodeFrames&&(t.isInitDecodeFrames=!0,t.width=Math.max(t.videoTag.videoWidth,e.width),t.height=Math.max(t.videoTag.videoHeight,e.height),t.duration=t.videoTag.duration,t.duration,t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.isPlayingState(),t.videoTag.ontimeupdate=function(){t.onPlayingTime&&t.onPlayingTime(t.videoTag.currentTime)},t.duration!==1/0&&t.duration>0&&(t.videoTag.onended=function(){t.onPlayingFinish&&t.onPlayingFinish()}))})),this.myPlayer.on(a.Events.STATISTICS_INFO,(function(e){t.videoTag.videoWidth,t.videoTag.videoHeight,t.videoTag.duration,!1===t.isInitDecodeFrames&&t.videoTag.videoWidth>0&&t.videoTag.videoHeight>0&&(t.isInitDecodeFrames=!0,t.width=t.videoTag.videoWidth,t.height=t.videoTag.videoHeight,t.duration=t.videoTag.duration,t.duration,t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.isPlayingState(),t.videoTag.ontimeupdate=function(){t.onPlayingTime&&t.onPlayingTime(t.videoTag.currentTime)},t.duration!==1/0&&(t.videoTag.onended=function(){t.onPlayingFinish&&t.onPlayingFinish()})),t.lastDecodedFrame=e.decodedFrames,t.lastDecodedFrameTime=s.GetMsTime()})),this.myPlayer.on(a.Events.SCRIPTDATA_ARRIVED,(function(e){})),this.myPlayer.on(a.Events.METADATA_ARRIVED,(function(e){!1===t.isInitDecodeFrames&&e.width&&e.width>0&&(t.isInitDecodeFrames=!0,t.duration=e.duration,t.width=e.width,t.height=e.height,t.duration,t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.isPlayingState(),t.videoTag.ontimeupdate=function(){t.onPlayingTime&&t.onPlayingTime(t.videoTag.currentTime)},t.duration!==1/0&&(t.videoTag.onended=function(){t.onPlayingFinish&&t.onPlayingFinish()}))})),this.myPlayer.on(a.Events.ERROR,(function(i,n,r){t.myPlayer&&t._reBuildFlvjs(e)})),this.myPlayer.load(),this._checkLoadState(e),this._checkPicBlock(e)}else console.error("FLV is AVC/H.264, But your brower do not support mse!")}},{key:"setPlaybackRate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return!(e<=0||null==this.videoTag||null===this.videoTag||(this.videoTag.playbackRate=e,0))}},{key:"getPlaybackRate",value:function(){return null==this.videoTag||null===this.videoTag?0:this.videoTag.playbackRate}},{key:"getSize",value:function(){return{width:this.videoTag.videoWidth>0?this.videoTag.videoWidth:this.width,height:this.videoTag.videoHeight>0?this.videoTag.videoHeight:this.height}}},{key:"play",value:function(){this.myPlayer.play()}},{key:"seek",value:function(e){this.myPlayer.currentTime=e}},{key:"pause",value:function(){this.myPlayer.pause()}},{key:"setVoice",value:function(e){this.myPlayer.volume=e}},{key:"isPlayingState",value:function(){return!this.videoTag.paused}},{key:"_loopBufferState",value:function(){var e=this;e.duration<=0&&(e.duration=e.videoTag.duration),null!==e.bufferInterval&&(window.clearInterval(e.bufferInterval),e.bufferInterval=null),e.bufferInterval=window.setInterval((function(){if(!e.duration||e.duration<0)window.clearInterval(e.bufferInterval);else{var t=e.videoTag.buffered.end(0);if(t>=e.duration-.04)return e.onCacheProcess&&e.onCacheProcess(e.duration),void window.clearInterval(e.bufferInterval);e.onCacheProcess&&e.onCacheProcess(t)}}),200)}},{key:"_releaseFlvjs",value:function(){this.myPlayer,this.myPlayer.pause(),this.myPlayer.unload(),this.myPlayer.detachMediaElement(),this.myPlayer.destroy(),this.myPlayer=null,this.videoTag.remove(),this.videoTag=null,null!==this.checkStartInterval&&(this.checkStartIntervalCount=0,window.clearInterval(this.checkStartInterval),this.checkStartInterval=null),null!==this.checkPicBlockInterval&&(window.clearInterval(this.checkPicBlockInterval),this.checkPicBlockInterval=null),this.isInitDecodeFrames=!1,this.lastDecodedFrame=0,this.lastDecodedFrameTime=-1}},{key:"release",value:function(){null!==this.checkStartInterval&&(this.checkStartIntervalCount=0,window.clearInterval(this.checkStartInterval),this.checkStartInterval=null),null!==this.checkPicBlockInterval&&(window.clearInterval(this.checkPicBlockInterval),this.checkPicBlockInterval=null),null!==this.bufferInterval&&(window.clearInterval(this.bufferInterval),this.bufferInterval=null),this._releaseFlvjs(),this.myPlayerID=null,this.videoContaner=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onReadyShowDone=null,this.onPlayState=null,window.onclick=document.body.onclick=null}}])&&n(t.prototype,i),o&&n(t,o),e}();i.NvFlvjsCore=o},{"../consts":52,"../decoder/av-common":56,"../demuxer/flv-hevc/flv-hevc.js":68,"../version":84}],79:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("../consts"),a=(e("../version"),e("mpegts.js")),s=e("../decoder/av-common"),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configFormat={width:t.width||r.DEFAULT_WIDTH,height:t.height||r.DEFAULT_HEIGHT,playerId:t.playerId||r.DEFAILT_WEBGL_PLAY_ID,ignoreAudio:t.ignoreAudio,duration:t.duration,autoPlay:t.autoPlay||!1,audioNone:t.audioNone},this.audioVoice=1,this.myPlayerID=this.configFormat.playerId+"-jsmpegts",this.myPlayer=null,this.videoContaner=null,this.videoTag=null,this.duration=-1,this.width=-1,this.height=-1,this.isPlaying=!1,this.vCodecID=r.V_CODEC_NAME_AVC,this.audioNone=!1,this.showScreen=!1,this.playPTS=0,this.vCachePTS=0,this.aCachePTS=0,this.isInitDecodeFrames=!1,this.lastDecodedFrame=0,this.lastDecodedFrameTime=-1,this.checkStartIntervalCount=0,this.checkStartInterval=null,this.checkPicBlockInterval=null,this.bufferInterval=null,this.onPlayState=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onReadyShowDone=null,this.onCacheProcess=null}var t,i,o;return t=e,(i=[{key:"_reBuildMpegTsjs",value:function(e){this._releaseMpegTsjs(),this.makeIt(e)}},{key:"_checkPicBlock",value:function(e){var t=this;this.checkPicBlockInterval=window.setInterval((function(){if(t.lastDecodedFrameTime>0&&s.GetMsTime()-t.lastDecodedFrameTime>1e4)return window.clearInterval(t.checkPicBlockInterval),t.checkPicBlockInterval=null,void t._reBuildMpegTsjs(e)}),1e3)}},{key:"_checkLoadState",value:function(e){var t=this;this.checkStartIntervalCount=0,this.checkStartInterval=window.setInterval((function(){return t.lastDecodedFrame,t.isInitDecodeFrames,t.checkStartIntervalCount,!1!==t.isInitDecodeFrames?(t.checkStartIntervalCount=0,window.clearInterval(t.checkStartInterval),void(t.checkStartInterval=null)):(t.checkStartIntervalCount+=1,t.checkStartIntervalCount>20?(window.clearInterval(t.checkStartInterval),t.checkStartIntervalCount=0,t.checkStartInterval=null,void(!1===t.isInitDecodeFrames&&t._reBuildMpegTsjs(e))):void 0)}),500)}},{key:"makeIt",value:function(e){var t=this;if(a.isSupported()){var i=document.querySelector("#"+this.configFormat.playerId);this.videoTag=document.createElement("video"),this.videoTag.id=this.myPlayerID,this.videoTag.style.width=this.configFormat.width+"px",this.videoTag.style.height=this.configFormat.height+"px",i.appendChild(this.videoTag),!0===this.configFormat.autoPlay&&(this.videoTag.muted="muted",this.videoTag.autoplay="autoplay",window.onclick=document.body.onclick=function(e){t.videoTag.muted=!1,t.isPlayingState(),window.onclick=document.body.onclick=null}),this.videoTag.onplay=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.videoTag.onpause=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)};var n={hasVideo:!0,hasAudio:!(!0===this.configFormat.audioNone),type:"mse",url:e,isLive:this.configFormat.duration<=0,withCredentials:!1};this.myPlayer=a.createPlayer(n),this.myPlayer.attachMediaElement(this.videoTag),this.myPlayer.on(a.Events.MEDIA_INFO,(function(e){t.videoTag.videoWidth,!1===t.isInitDecodeFrames&&(t.isInitDecodeFrames=!0,t.width=Math.max(t.videoTag.videoWidth,e.width),t.height=Math.max(t.videoTag.videoHeight,e.height),t.videoTag.duration&&e.duration?t.videoTag.duration?t.duration=t.videoTag.duration:e.duration&&(t.duration=e.duration):t.duration=t.configFormat.duration/1e3,t.duration,t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.isPlayingState(),t.videoTag.ontimeupdate=function(){t.onPlayingTime&&t.onPlayingTime(t.videoTag.currentTime)},t.duration!==1/0&&t.duration>0&&(t.videoTag.onended=function(){t.onPlayingFinish&&t.onPlayingFinish()}))})),this.myPlayer.on(a.Events.SCRIPTDATA_ARRIVED,(function(e){})),this.myPlayer.on(a.Events.ERROR,(function(i,n,r){t.myPlayer&&t._reBuildMpegTsjs(e)})),this.myPlayer.load(),this._checkLoadState(e),this._checkPicBlock(e)}else console.error("FLV is AVC/H.264, But your brower do not support mse!")}},{key:"setPlaybackRate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return!(e<=0||null==this.videoTag||null===this.videoTag||(this.videoTag.playbackRate=e,0))}},{key:"getPlaybackRate",value:function(){return null==this.videoTag||null===this.videoTag?0:this.videoTag.playbackRate}},{key:"getSize",value:function(){return{width:this.videoTag.videoWidth>0?this.videoTag.videoWidth:this.width,height:this.videoTag.videoHeight>0?this.videoTag.videoHeight:this.height}}},{key:"play",value:function(){this.videoTag,this.videoTag.play()}},{key:"seek",value:function(e){this.videoTag.currentTime=e}},{key:"pause",value:function(){this.videoTag.pause()}},{key:"setVoice",value:function(e){this.videoTag.volume=e}},{key:"isPlayingState",value:function(){return!this.videoTag.paused}},{key:"_loopBufferState",value:function(){var e=this;e.duration<=0&&e.videoTag.duration&&(e.duration=e.videoTag.duration),null!==e.bufferInterval&&(window.clearInterval(e.bufferInterval),e.bufferInterval=null),e.bufferInterval=window.setInterval((function(){if(e.configFormat.duration<=0)window.clearInterval(e.bufferInterval);else{var t=e.videoTag.buffered.end(0);if(t>=e.duration-.04)return e.onCacheProcess&&e.onCacheProcess(e.duration),void window.clearInterval(e.bufferInterval);e.onCacheProcess&&e.onCacheProcess(t)}}),200)}},{key:"_releaseMpegTsjs",value:function(){this.myPlayer,this.myPlayer.pause(),this.myPlayer.unload(),this.myPlayer.detachMediaElement(),this.myPlayer.destroy(),this.myPlayer=null,this.videoTag.remove(),this.videoTag=null,null!==this.checkStartInterval&&(this.checkStartIntervalCount=0,window.clearInterval(this.checkStartInterval),this.checkStartInterval=null),null!==this.checkPicBlockInterval&&(window.clearInterval(this.checkPicBlockInterval),this.checkPicBlockInterval=null),this.isInitDecodeFrames=!1,this.lastDecodedFrame=0,this.lastDecodedFrameTime=-1}},{key:"release",value:function(){null!==this.checkStartInterval&&(this.checkStartIntervalCount=0,window.clearInterval(this.checkStartInterval),this.checkStartInterval=null),null!==this.checkPicBlockInterval&&(window.clearInterval(this.checkPicBlockInterval),this.checkPicBlockInterval=null),null!==this.bufferInterval&&(window.clearInterval(this.bufferInterval),this.bufferInterval=null),this._releaseMpegTsjs(),this.myPlayerID=null,this.videoContaner=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onReadyShowDone=null,this.onPlayState=null,window.onclick=document.body.onclick=null}}])&&n(t.prototype,i),o&&n(t,o),e}();i.NvMpegTsCore=o},{"../consts":52,"../decoder/av-common":56,"../version":84,"mpegts.js":41}],80:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=e("../consts"),a=(e("../version"),e("video.js")),s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configFormat={probeDurationMS:t.probeDurationMS,width:t.width||r.DEFAULT_WIDTH,height:t.height||r.DEFAULT_HEIGHT,playerId:t.playerId||r.DEFAILT_WEBGL_PLAY_ID,ignoreAudio:t.ignoreAudio,autoPlay:t.autoPlay||!1},this.configFormat,this.audioVoice=1,this.myPlayerID=this.configFormat.playerId+"-vjs",this.myPlayer=null,this.videoContaner=null,this.videoTag=null,this.duration=-1,this.vCodecID=r.V_CODEC_NAME_AVC,this.audioNone=!1,this.showScreen=!1,this.playPTS=0,this.loadSuccess=!1,this.bufferInterval=null,this.bootInterval=null,this.onMakeItReady=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onSeekFinish=null,this.onReadyShowDone=null,this.onPlayState=null,this.onCacheProcess=null}var t,i,s;return t=e,(i=[{key:"_hiddenUnusedPlugins",value:function(){this._hiddenUnused("vjs-loading-spinner"),this._hiddenUnused("vjs-hidden"),this._hiddenUnused("vjs-control-bar"),this._hiddenUnused("vjs-control"),this._hiddenUnused("vjs-text-track-display"),this._hiddenUnused("vjs-big-play-button")}},{key:"_hiddenUnused",value:function(e){Array.from(document.getElementsByClassName(e)).forEach((function(e){status?e&&e.setAttribute("style","display: block;"):e&&e.setAttribute("style","display: none;")}))}},{key:"_onVideoJsReady",value:function(){var e=this;this._hiddenUnusedPlugins(),this.videoContaner=document.querySelector("#"+this.myPlayerID),this.videoTag.style.width=this.configFormat.width+"px",this.videoTag.style.height=this.configFormat.height+"px",this.duration=this.myPlayer.duration(),this.videoTag,this.duration,this.getSize(),this.videoTag.videoWidth,this.myPlayer.on("progress",(function(){e.myPlayer.buffered().length,e.myPlayer.duration()})),this.myPlayer.on("timeupdate",(function(){e.videoTag.currentTime,e.myPlayer.duration(),e.onPlayingTime&&e.onPlayingTime(e.myPlayer.currentTime())}))}},{key:"makeIt",value:function(e){var t=this,i={techOrder:["html5"],width:this.configFormat.width,height:this.configFormat.height,controls:!1,bigPlayButton:!1,textTrackDisplay:!1,posterImage:!0,errorDisplay:!1,controlBar:!1,preload:"auto",autoplay:this.configFormat.autoPlay,sources:[{src:e,type:"application/x-mpegURL"}]},n=document.querySelector("#"+this.configFormat.playerId),r=document.createElement("video");r.id=this.myPlayerID,this.videoTag=r,n.appendChild(r),!0===this.configFormat.autoPlay&&(this.videoTag.muted="muted",this.videoTag.autoplay="autoplay",window.onclick=document.body.onclick=function(e){t.videoTag.muted=!1,t.isPlayingState(),window.onclick=document.body.onclick=null}),this.videoTag,this.videoTag.onplay=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.videoTag.onpause=function(){var e=t.isPlayingState();t.onPlayState&&t.onPlayState(e)},this.myPlayer=a(this.myPlayerID,i,(function(){t.myPlayer.on("canplaythrough",(function(){t.getSize(),t.videoTag.videoWidth,!0!==t.loadSuccess&&(t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.loadSuccess=!0)})),t.myPlayer.on("loadedmetadata",(function(e){t._onVideoJsReady(),!0!==t.loadSuccess&&(t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.loadSuccess=!0)})),t.myPlayer.on("ended",(function(){t.pause(),t.onPlayingFinish&&t.onPlayingFinish()})),t.myPlayer.on("seeking",(function(){})),t.myPlayer.on("seeked",(function(){t.onSeekFinish&&t.onSeekFinish()})),t.onMakeItReady&&t.onMakeItReady(),setTimeout((function(){!0!==t.loadSuccess&&t.configFormat.probeDurationMS<0&&(t.onLoadFinish&&t.onLoadFinish(),t.onReadyShowDone&&t.onReadyShowDone(),t._loopBufferState(),t.loadSuccess=!0)}),1e3)})),this.myPlayer.options.controls=!1,this.myPlayer.options.autoplay=!1,this._hiddenUnusedPlugins()}},{key:"_refreshVideoTagEvent",value:function(){this.videoTag=document.getElementById(this.myPlayerID).querySelector("video")}},{key:"setPlaybackRate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return!(e<=0||null==this.videoTag||null===this.videoTag||(this.videoTag.playbackRate=e,0))}},{key:"getPlaybackRate",value:function(){return null==this.videoTag||null===this.videoTag?0:this.videoTag.playbackRate}},{key:"getSize",value:function(){return this.myPlayer.videoWidth()<=0?{width:this.videoTag.videoWidth,height:this.videoTag.videoHeight}:{width:this.myPlayer.videoWidth(),height:this.myPlayer.videoHeight()}}},{key:"play",value:function(){void 0===this.videoTag||null===this.videoTag?this.myPlayer.play():this.videoTag.play()}},{key:"seek",value:function(e){void 0===this.videoTag||null===this.videoTag?this.myPlayer.currentTime=e:this.videoTag.currentTime=e}},{key:"pause",value:function(){void 0===this.videoTag||null===this.videoTag?this.myPlayer.pause():this.videoTag.pause()}},{key:"setVoice",value:function(e){void 0===this.videoTag||null===this.videoTag?this.myPlayer.volume=e:this.videoTag.volume=e}},{key:"isPlayingState",value:function(){return!this.myPlayer.paused()}},{key:"_loopBufferState",value:function(){var e=this;e.duration<=0&&(e.duration=e.videoTag.duration),null!==e.bufferInterval&&(window.clearInterval(e.bufferInterval),e.bufferInterval=null),e.configFormat.probeDurationMS,e.configFormat.probeDurationMS<=0||e.duration<=0||(e.bufferInterval=window.setInterval((function(){var t=e.videoTag.buffered.end(0);if(t>=e.duration-.04)return e.onCacheProcess&&e.onCacheProcess(e.duration),void window.clearInterval(e.bufferInterval);e.onCacheProcess&&e.onCacheProcess(t)}),200))}},{key:"release",value:function(){this.loadSuccess=!1,void 0!==this.bootInterval&&null!==this.bootInterval&&(window.clearInterval(this.bootInterval),this.bootInterval=null),this.myPlayer.dispose(),this.myPlayerID=null,this.myPlayer=null,this.videoContaner=null,this.videoTag=null,this.onLoadFinish=null,this.onPlayingTime=null,this.onPlayingFinish=null,this.onSeekFinish=null,this.onReadyShowDone=null,this.onPlayState=null,null!==this.bufferInterval&&(window.clearInterval(this.bufferInterval),this.bufferInterval=null),window.onclick=document.body.onclick=null}}])&&n(t.prototype,i),s&&n(t,s),e}();i.NvVideojsCore=s},{"../consts":52,"../version":84,"video.js":47}],81:[function(e,t,i){"use strict";e("../decoder/av-common");function n(e){this.gl=e,this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}n.prototype.bind=function(e,t,i){var n=this.gl;n.activeTexture([n.TEXTURE0,n.TEXTURE1,n.TEXTURE2][e]),n.bindTexture(n.TEXTURE_2D,this.texture),n.uniform1i(n.getUniformLocation(t,i),e)},n.prototype.fill=function(e,t,i){var n=this.gl;n.bindTexture(n.TEXTURE_2D,this.texture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,i)},t.exports={renderFrame:function(e,t,i,n,r,a){e.viewport(0,0,e.canvas.width,e.canvas.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.y.fill(r,a,t),e.u.fill(r>>1,a>>1,i),e.v.fill(r>>1,a>>1,n),e.drawArrays(e.TRIANGLE_STRIP,0,4)},setupCanvas:function(e,t){var i=e.getContext("webgl")||e.getContext("experimental-webgl");if(!i)return i;var r=i.createProgram(),a=["attribute highp vec4 aVertexPosition;","attribute vec2 aTextureCoord;","varying highp vec2 vTextureCoord;","void main(void) {"," gl_Position = aVertexPosition;"," vTextureCoord = aTextureCoord;","}"].join("\n"),s=i.createShader(i.VERTEX_SHADER);i.shaderSource(s,a),i.compileShader(s);var o=["precision highp float;","varying lowp vec2 vTextureCoord;","uniform sampler2D YTexture;","uniform sampler2D UTexture;","uniform sampler2D VTexture;","const mat4 YUV2RGB = mat4","("," 1.1643828125, 0, 1.59602734375, -.87078515625,"," 1.1643828125, -.39176171875, -.81296875, .52959375,"," 1.1643828125, 2.017234375, 0, -1.081390625,"," 0, 0, 0, 1",");","void main(void) {"," gl_FragColor = vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB;","}"].join("\n"),u=i.createShader(i.FRAGMENT_SHADER);i.shaderSource(u,o),i.compileShader(u),i.attachShader(r,s),i.attachShader(r,u),i.linkProgram(r),i.useProgram(r),i.getProgramParameter(r,i.LINK_STATUS);var l=i.getAttribLocation(r,"aVertexPosition");i.enableVertexAttribArray(l);var h=i.getAttribLocation(r,"aTextureCoord");i.enableVertexAttribArray(h);var d=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,d),i.bufferData(i.ARRAY_BUFFER,new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0]),i.STATIC_DRAW),i.vertexAttribPointer(l,3,i.FLOAT,!1,0,0);var c=i.createBuffer();return i.bindBuffer(i.ARRAY_BUFFER,c),i.bufferData(i.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),i.STATIC_DRAW),i.vertexAttribPointer(h,2,i.FLOAT,!1,0,0),i.y=new n(i),i.u=new n(i),i.v=new n(i),i.y.bind(0,r,"YTexture"),i.u.bind(1,r,"UTexture"),i.v.bind(2,r,"VTexture"),i},releaseContext:function(e){e.deleteTexture(e.y.texture),e.deleteTexture(e.u.texture),e.deleteTexture(e.v.texture)}}},{"../decoder/av-common":56}],82:[function(e,t,i){(function(e){"use strict";e.STATIC_MEM_wasmDecoderState=-1,e.STATICE_MEM_playerCount=-1,e.STATICE_MEM_playerIndexPtr=0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],83:[function(e,t,i){"use strict";function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,i,r;return t=e,r=[{key:"createPlayerRender",value:function(e,t,i){var n=document.querySelector("div#"+e);return n.style.position="relative",n.style.backgroundColor="black",n.style.width=t+"px",n.style.height=i+"px",n}}],(i=null)&&n(t.prototype,i),r&&n(t,r),e}();i.UI=r},{}],84:[function(e,t,i){"use strict";t.exports={PLAYER_VERSION:"4.2.0"}},{}]},{},[76]); \ No newline at end of file
+! function e(t, i, n) {
+ function r(s, o) {
+ if (!i[s]) {
+ if (!t[s]) {
+ var u = "function" == typeof require && require;
+ if (!o && u) return u(s, !0);
+ if (a) return a(s, !0);
+ var l = new Error("Cannot find module '" + s + "'");
+ throw l.code = "MODULE_NOT_FOUND", l
+ }
+ var h = i[s] = {
+ exports: {}
+ };
+ t[s][0].call(h.exports, (function(e) {
+ return r(t[s][1][e] || e)
+ }), h, h.exports, e, t, i, n)
+ }
+ return i[s].exports
+ }
+ for (var a = "function" == typeof require && require, s = 0; s < n.length; s++) r(n[s]);
+ return r
+}({
+ 1: [function(e, t, i) {
+ t.exports = function(e) {
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ return e
+ }
+ }, {}],
+ 2: [function(e, t, i) {
+ var n = e("./setPrototypeOf"),
+ r = e("./isNativeReflectConstruct");
+
+ function a(e, i, s) {
+ return r() ? t.exports = a = Reflect.construct : t.exports = a = function(e, t, i) {
+ var r = [null];
+ r.push.apply(r, t);
+ var a = new(Function.bind.apply(e, r));
+ return i && n(a, i.prototype), a
+ }, a.apply(null, arguments)
+ }
+ t.exports = a
+ }, {
+ "./isNativeReflectConstruct": 7,
+ "./setPrototypeOf": 8
+ }],
+ 3: [function(e, t, i) {
+ function n() {
+ return t.exports = n = Object.assign || function(e) {
+ for (var t = 1; t < arguments.length; t++) {
+ var i = arguments[t];
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n])
+ }
+ return e
+ }, n.apply(this, arguments)
+ }
+ t.exports = n
+ }, {}],
+ 4: [function(e, t, i) {
+ var n = e("./setPrototypeOf");
+ t.exports = function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
+ e.prototype = Object.create(t && t.prototype, {
+ constructor: {
+ value: e,
+ writable: !0,
+ configurable: !0
+ }
+ }), t && n(e, t)
+ }
+ }, {
+ "./setPrototypeOf": 8
+ }],
+ 5: [function(e, t, i) {
+ t.exports = function(e, t) {
+ e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e.__proto__ = t
+ }
+ }, {}],
+ 6: [function(e, t, i) {
+ t.exports = function(e) {
+ return e && e.__esModule ? e : {
+ default: e
+ }
+ }
+ }, {}],
+ 7: [function(e, t, i) {
+ t.exports = function() {
+ if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
+ if (Reflect.construct.sham) return !1;
+ if ("function" == typeof Proxy) return !0;
+ try {
+ return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {}))), !0
+ } catch (e) {
+ return !1
+ }
+ }
+ }, {}],
+ 8: [function(e, t, i) {
+ function n(e, i) {
+ return t.exports = n = Object.setPrototypeOf || function(e, t) {
+ return e.__proto__ = t, e
+ }, n(e, i)
+ }
+ t.exports = n
+ }, {}],
+ 9: [function(e, t, i) {
+ "use strict";
+ var n = e("@babel/runtime/helpers/interopRequireDefault");
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.reverseBytes = i.sliceBytes = i.bytesMatch = i.concatTypedArrays = i.stringToBytes = i.bytesToString = i.numberToBytes = i.bytesToNumber = i.IS_LITTLE_ENDIAN = i.IS_BIG_ENDIAN = i.ENDIANNESS = i.toBinaryString = i.toHexString = i.toUint8 = i.isTypedArray = i.padStart = i.countBytes = i.countBits = void 0;
+ var r = n(e("global/window")),
+ a = function(e) {
+ return e.toString(2).length
+ };
+ i.countBits = a;
+ var s = function(e) {
+ return Math.ceil(a(e) / 8)
+ };
+ i.countBytes = s;
+ var o = function(e, t, i) {
+ return void 0 === i && (i = " "), (function(e, t) {
+ for (var i = ""; t--;) i += e;
+ return i
+ }(i, t) + e.toString()).slice(-t)
+ };
+ i.padStart = o;
+ var u = function(e) {
+ return ArrayBuffer.isView(e)
+ };
+ i.isTypedArray = u;
+ var l = function(e) {
+ return e instanceof Uint8Array ? e : (Array.isArray(e) || u(e) || e instanceof ArrayBuffer || (e = "number" != typeof e || "number" == typeof e && e != e ? 0 : [e]), new Uint8Array(e && e.buffer || e, e && e.byteOffset || 0, e && e.byteLength || 0))
+ };
+ i.toUint8 = l;
+ i.toHexString = function(e) {
+ e = l(e);
+ for (var t = "", i = 0; i < e.length; i++) t += o(e[i].toString(16), 2, "0");
+ return t
+ };
+ i.toBinaryString = function(e) {
+ e = l(e);
+ for (var t = "", i = 0; i < e.length; i++) t += o(e[i].toString(2), 8, "0");
+ return t
+ };
+ var h, d, c = r.default.BigInt || Number,
+ f = [c("0x1"), c("0x100"), c("0x10000"), c("0x1000000"), c("0x100000000"), c("0x10000000000"), c("0x1000000000000"), c("0x100000000000000"), c("0x10000000000000000")],
+ p = (h = new Uint16Array([65484]), 255 === (d = new Uint8Array(h.buffer, h.byteOffset, h.byteLength))[0] ? "big" : 204 === d[0] ? "little" : "unknown");
+ i.ENDIANNESS = p;
+ var m = "big" === p;
+ i.IS_BIG_ENDIAN = m;
+ var _ = "little" === p;
+ i.IS_LITTLE_ENDIAN = _;
+ i.bytesToNumber = function(e, t) {
+ var i = void 0 === t ? {} : t,
+ n = i.signed,
+ r = void 0 !== n && n,
+ a = i.le,
+ s = void 0 !== a && a;
+ e = l(e);
+ var o = s ? "reduce" : "reduceRight",
+ u = (e[o] ? e[o] : Array.prototype[o]).call(e, (function(t, i, n) {
+ var r = s ? n : Math.abs(n + 1 - e.length);
+ return t + c(i) * f[r]
+ }), c(0));
+ if (r) {
+ var h = f[e.length] / c(2) - c(1);
+ (u = c(u)) > h && (u -= h, u -= h, u -= c(2))
+ }
+ return Number(u)
+ };
+ i.numberToBytes = function(e, t) {
+ var i = (void 0 === t ? {} : t).le,
+ n = void 0 !== i && i;
+ ("bigint" != typeof e && "number" != typeof e || "number" == typeof e && e != e) && (e = 0), e = c(e);
+ for (var r = s(e), a = new Uint8Array(new ArrayBuffer(r)), o = 0; o < r; o++) {
+ var u = n ? o : Math.abs(o + 1 - a.length);
+ a[u] = Number(e / f[o] & c(255)), e < 0 && (a[u] = Math.abs(~a[u]), a[u] -= 0 === o ? 1 : 2)
+ }
+ return a
+ };
+ i.bytesToString = function(e) {
+ if (!e) return "";
+ e = Array.prototype.slice.call(e);
+ var t = String.fromCharCode.apply(null, l(e));
+ try {
+ return decodeURIComponent(escape(t))
+ } catch (e) {}
+ return t
+ };
+ i.stringToBytes = function(e, t) {
+ if ("string" != typeof e && e && "function" == typeof e.toString && (e = e.toString()), "string" != typeof e) return new Uint8Array;
+ t || (e = unescape(encodeURIComponent(e)));
+ for (var i = new Uint8Array(e.length), n = 0; n < e.length; n++) i[n] = e.charCodeAt(n);
+ return i
+ };
+ i.concatTypedArrays = function() {
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
+ if ((t = t.filter((function(e) {
+ return e && (e.byteLength || e.length) && "string" != typeof e
+ }))).length <= 1) return l(t[0]);
+ var n = t.reduce((function(e, t, i) {
+ return e + (t.byteLength || t.length)
+ }), 0),
+ r = new Uint8Array(n),
+ a = 0;
+ return t.forEach((function(e) {
+ e = l(e), r.set(e, a), a += e.byteLength
+ })), r
+ };
+ i.bytesMatch = function(e, t, i) {
+ var n = void 0 === i ? {} : i,
+ r = n.offset,
+ a = void 0 === r ? 0 : r,
+ s = n.mask,
+ o = void 0 === s ? [] : s;
+ e = l(e);
+ var u = (t = l(t)).every ? t.every : Array.prototype.every;
+ return t.length && e.length - a >= t.length && u.call(t, (function(t, i) {
+ return t === (o[i] ? o[i] & e[a + i] : e[a + i])
+ }))
+ };
+ i.sliceBytes = function(e, t, i) {
+ return Uint8Array.prototype.slice ? Uint8Array.prototype.slice.call(e, t, i) : new Uint8Array(Array.prototype.slice.call(e, t, i))
+ };
+ i.reverseBytes = function(e) {
+ return e.reverse ? e.reverse() : Array.prototype.reverse.call(e)
+ }
+ }, {
+ "@babel/runtime/helpers/interopRequireDefault": 6,
+ "global/window": 34
+ }],
+ 10: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.getHvcCodec = i.getAvcCodec = i.getAv1Codec = void 0;
+ var n = e("./byte-helpers.js");
+ i.getAv1Codec = function(e) {
+ var t, i = "",
+ r = e[1] >>> 3,
+ a = 31 & e[1],
+ s = e[2] >>> 7,
+ o = (64 & e[2]) >> 6,
+ u = (32 & e[2]) >> 5,
+ l = (16 & e[2]) >> 4,
+ h = (8 & e[2]) >> 3,
+ d = (4 & e[2]) >> 2,
+ c = 3 & e[2];
+ return i += r + "." + (0, n.padStart)(a, 2, "0"), 0 === s ? i += "M" : 1 === s && (i += "H"), t = 2 === r && o ? u ? 12 : 10 : o ? 10 : 8, i += "." + (0, n.padStart)(t, 2, "0"), i += "." + l, i += "." + h + d + c
+ };
+ i.getAvcCodec = function(e) {
+ return "" + (0, n.toHexString)(e[1]) + (0, n.toHexString)(252 & e[2]) + (0, n.toHexString)(e[3])
+ };
+ i.getHvcCodec = function(e) {
+ var t = "",
+ i = e[1] >> 6,
+ r = 31 & e[1],
+ a = (32 & e[1]) >> 5,
+ s = e.subarray(2, 6),
+ o = e.subarray(6, 12),
+ u = e[12];
+ 1 === i ? t += "A" : 2 === i ? t += "B" : 3 === i && (t += "C"), t += r + ".";
+ var l = parseInt((0, n.toBinaryString)(s).split("").reverse().join(""), 2);
+ l > 255 && (l = parseInt((0, n.toBinaryString)(s), 2)), t += l.toString(16) + ".", t += 0 === a ? "L" : "H", t += u;
+ for (var h = "", d = 0; d < o.length; d++) {
+ var c = o[d];
+ c && (h && (h += "."), h += c.toString(16))
+ }
+ return h && (t += "." + h), t
+ }
+ }, {
+ "./byte-helpers.js": 9
+ }],
+ 11: [function(e, t, i) {
+ "use strict";
+ var n = e("@babel/runtime/helpers/interopRequireDefault");
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.DEFAULT_VIDEO_CODEC = i.DEFAULT_AUDIO_CODEC = i.muxerSupportsCodec = i.browserSupportsCodec = i.getMimeForCodec = i.isTextCodec = i.isAudioCodec = i.isVideoCodec = i.codecsFromDefault = i.parseCodecs = i.mapLegacyAvcCodecs = i.translateLegacyCodecs = i.translateLegacyCodec = void 0;
+ var r = n(e("global/window")),
+ a = {
+ mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
+ webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
+ ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
+ video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
+ audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
+ text: /^(stpp.ttml.im1t)/,
+ muxerVideo: /^(avc0?1)/,
+ muxerAudio: /^(mp4a)/,
+ muxerText: /a^/
+ },
+ s = ["video", "audio", "text"],
+ o = ["Video", "Audio", "Text"],
+ u = function(e) {
+ return e ? e.replace(/avc1\.(\d+)\.(\d+)/i, (function(e, t, i) {
+ return "avc1." + ("00" + Number(t).toString(16)).slice(-2) + "00" + ("00" + Number(i).toString(16)).slice(-2)
+ })) : e
+ };
+ i.translateLegacyCodec = u;
+ var l = function(e) {
+ return e.map(u)
+ };
+ i.translateLegacyCodecs = l;
+ i.mapLegacyAvcCodecs = function(e) {
+ return e.replace(/avc1\.(\d+)\.(\d+)/i, (function(e) {
+ return l([e])[0]
+ }))
+ };
+ var h = function(e) {
+ void 0 === e && (e = "");
+ var t = e.split(","),
+ i = [];
+ return t.forEach((function(e) {
+ var t;
+ e = e.trim(), s.forEach((function(n) {
+ var r = a[n].exec(e.toLowerCase());
+ if (r && !(r.length <= 1)) {
+ t = n;
+ var s = e.substring(0, r[1].length),
+ o = e.replace(s, "");
+ i.push({
+ type: s,
+ details: o,
+ mediaType: n
+ })
+ }
+ })), t || i.push({
+ type: e,
+ details: "",
+ mediaType: "unknown"
+ })
+ })), i
+ };
+ i.parseCodecs = h;
+ i.codecsFromDefault = function(e, t) {
+ if (!e.mediaGroups.AUDIO || !t) return null;
+ var i = e.mediaGroups.AUDIO[t];
+ if (!i) return null;
+ for (var n in i) {
+ var r = i[n];
+ if (r.default && r.playlists) return h(r.playlists[0].attributes.CODECS)
+ }
+ return null
+ };
+ i.isVideoCodec = function(e) {
+ return void 0 === e && (e = ""), a.video.test(e.trim().toLowerCase())
+ };
+ var d = function(e) {
+ return void 0 === e && (e = ""), a.audio.test(e.trim().toLowerCase())
+ };
+ i.isAudioCodec = d;
+ var c = function(e) {
+ return void 0 === e && (e = ""), a.text.test(e.trim().toLowerCase())
+ };
+ i.isTextCodec = c;
+ var f = function(e) {
+ if (e && "string" == typeof e) {
+ var t = e.toLowerCase().split(",").map((function(e) {
+ return u(e.trim())
+ })),
+ i = "video";
+ 1 === t.length && d(t[0]) ? i = "audio" : 1 === t.length && c(t[0]) && (i = "application");
+ var n = "mp4";
+ return t.every((function(e) {
+ return a.mp4.test(e)
+ })) ? n = "mp4" : t.every((function(e) {
+ return a.webm.test(e)
+ })) ? n = "webm" : t.every((function(e) {
+ return a.ogg.test(e)
+ })) && (n = "ogg"), i + "/" + n + ';codecs="' + e + '"'
+ }
+ };
+ i.getMimeForCodec = f;
+ i.browserSupportsCodec = function(e) {
+ return void 0 === e && (e = ""), r.default.MediaSource && r.default.MediaSource.isTypeSupported && r.default.MediaSource.isTypeSupported(f(e)) || !1
+ };
+ i.muxerSupportsCodec = function(e) {
+ return void 0 === e && (e = ""), e.toLowerCase().split(",").every((function(e) {
+ e = e.trim();
+ for (var t = 0; t < o.length; t++) {
+ if (a["muxer" + o[t]].test(e)) return !0
+ }
+ return !1
+ }))
+ };
+ i.DEFAULT_AUDIO_CODEC = "mp4a.40.2";
+ i.DEFAULT_VIDEO_CODEC = "avc1.4d400d"
+ }, {
+ "@babel/runtime/helpers/interopRequireDefault": 6,
+ "global/window": 34
+ }],
+ 12: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.isLikelyFmp4MediaSegment = i.detectContainerForBytes = i.isLikely = void 0;
+ var n = e("./byte-helpers.js"),
+ r = e("./mp4-helpers.js"),
+ a = e("./ebml-helpers.js"),
+ s = e("./id3-helpers.js"),
+ o = e("./nal-helpers.js"),
+ u = {
+ webm: (0, n.toUint8)([119, 101, 98, 109]),
+ matroska: (0, n.toUint8)([109, 97, 116, 114, 111, 115, 107, 97]),
+ flac: (0, n.toUint8)([102, 76, 97, 67]),
+ ogg: (0, n.toUint8)([79, 103, 103, 83]),
+ ac3: (0, n.toUint8)([11, 119]),
+ riff: (0, n.toUint8)([82, 73, 70, 70]),
+ avi: (0, n.toUint8)([65, 86, 73]),
+ wav: (0, n.toUint8)([87, 65, 86, 69]),
+ "3gp": (0, n.toUint8)([102, 116, 121, 112, 51, 103]),
+ mp4: (0, n.toUint8)([102, 116, 121, 112]),
+ fmp4: (0, n.toUint8)([115, 116, 121, 112]),
+ mov: (0, n.toUint8)([102, 116, 121, 112, 113, 116]),
+ moov: (0, n.toUint8)([109, 111, 111, 118]),
+ moof: (0, n.toUint8)([109, 111, 111, 102])
+ },
+ l = {
+ aac: function(e) {
+ var t = (0, s.getId3Offset)(e);
+ return (0, n.bytesMatch)(e, [255, 16], {
+ offset: t,
+ mask: [255, 22]
+ })
+ },
+ mp3: function(e) {
+ var t = (0, s.getId3Offset)(e);
+ return (0, n.bytesMatch)(e, [255, 2], {
+ offset: t,
+ mask: [255, 6]
+ })
+ },
+ webm: function(e) {
+ var t = (0, a.findEbml)(e, [a.EBML_TAGS.EBML, a.EBML_TAGS.DocType])[0];
+ return (0, n.bytesMatch)(t, u.webm)
+ },
+ mkv: function(e) {
+ var t = (0, a.findEbml)(e, [a.EBML_TAGS.EBML, a.EBML_TAGS.DocType])[0];
+ return (0, n.bytesMatch)(t, u.matroska)
+ },
+ mp4: function(e) {
+ return !l["3gp"](e) && !l.mov(e) && (!(!(0, n.bytesMatch)(e, u.mp4, {
+ offset: 4
+ }) && !(0, n.bytesMatch)(e, u.fmp4, {
+ offset: 4
+ })) || (!(!(0, n.bytesMatch)(e, u.moof, {
+ offset: 4
+ }) && !(0, n.bytesMatch)(e, u.moov, {
+ offset: 4
+ })) || void 0))
+ },
+ mov: function(e) {
+ return (0, n.bytesMatch)(e, u.mov, {
+ offset: 4
+ })
+ },
+ "3gp": function(e) {
+ return (0, n.bytesMatch)(e, u["3gp"], {
+ offset: 4
+ })
+ },
+ ac3: function(e) {
+ var t = (0, s.getId3Offset)(e);
+ return (0, n.bytesMatch)(e, u.ac3, {
+ offset: t
+ })
+ },
+ ts: function(e) {
+ if (e.length < 189 && e.length >= 1) return 71 === e[0];
+ for (var t = 0; t + 188 < e.length && t < 188;) {
+ if (71 === e[t] && 71 === e[t + 188]) return !0;
+ t += 1
+ }
+ return !1
+ },
+ flac: function(e) {
+ var t = (0, s.getId3Offset)(e);
+ return (0, n.bytesMatch)(e, u.flac, {
+ offset: t
+ })
+ },
+ ogg: function(e) {
+ return (0, n.bytesMatch)(e, u.ogg)
+ },
+ avi: function(e) {
+ return (0, n.bytesMatch)(e, u.riff) && (0, n.bytesMatch)(e, u.avi, {
+ offset: 8
+ })
+ },
+ wav: function(e) {
+ return (0, n.bytesMatch)(e, u.riff) && (0, n.bytesMatch)(e, u.wav, {
+ offset: 8
+ })
+ },
+ h264: function(e) {
+ return (0, o.findH264Nal)(e, 7, 3).length
+ },
+ h265: function(e) {
+ return (0, o.findH265Nal)(e, [32, 33], 3).length
+ }
+ },
+ h = Object.keys(l).filter((function(e) {
+ return "ts" !== e && "h264" !== e && "h265" !== e
+ })).concat(["ts", "h264", "h265"]);
+ h.forEach((function(e) {
+ var t = l[e];
+ l[e] = function(e) {
+ return t((0, n.toUint8)(e))
+ }
+ }));
+ var d = l;
+ i.isLikely = d;
+ i.detectContainerForBytes = function(e) {
+ e = (0, n.toUint8)(e);
+ for (var t = 0; t < h.length; t++) {
+ var i = h[t];
+ if (d[i](e)) return i
+ }
+ return ""
+ };
+ i.isLikelyFmp4MediaSegment = function(e) {
+ return (0, r.findBox)(e, ["moof"]).length > 0
+ }
+ }, {
+ "./byte-helpers.js": 9,
+ "./ebml-helpers.js": 14,
+ "./id3-helpers.js": 15,
+ "./mp4-helpers.js": 17,
+ "./nal-helpers.js": 18
+ }],
+ 13: [function(e, t, i) {
+ (function(n) {
+ "use strict";
+ var r = e("@babel/runtime/helpers/interopRequireDefault");
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.default = function(e) {
+ for (var t = (s = e, a.default.atob ? a.default.atob(s) : n.from(s, "base64").toString("binary")), i = new Uint8Array(t.length), r = 0; r < t.length; r++) i[r] = t.charCodeAt(r);
+ var s;
+ return i
+ };
+ var a = r(e("global/window"));
+ t.exports = i.default
+ }).call(this, e("buffer").Buffer)
+ }, {
+ "@babel/runtime/helpers/interopRequireDefault": 6,
+ buffer: 32,
+ "global/window": 34
+ }],
+ 14: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.parseData = i.parseTracks = i.decodeBlock = i.findEbml = i.EBML_TAGS = void 0;
+ var n = e("./byte-helpers"),
+ r = e("./codec-helpers.js"),
+ a = {
+ EBML: (0, n.toUint8)([26, 69, 223, 163]),
+ DocType: (0, n.toUint8)([66, 130]),
+ Segment: (0, n.toUint8)([24, 83, 128, 103]),
+ SegmentInfo: (0, n.toUint8)([21, 73, 169, 102]),
+ Tracks: (0, n.toUint8)([22, 84, 174, 107]),
+ Track: (0, n.toUint8)([174]),
+ TrackNumber: (0, n.toUint8)([215]),
+ DefaultDuration: (0, n.toUint8)([35, 227, 131]),
+ TrackEntry: (0, n.toUint8)([174]),
+ TrackType: (0, n.toUint8)([131]),
+ FlagDefault: (0, n.toUint8)([136]),
+ CodecID: (0, n.toUint8)([134]),
+ CodecPrivate: (0, n.toUint8)([99, 162]),
+ VideoTrack: (0, n.toUint8)([224]),
+ AudioTrack: (0, n.toUint8)([225]),
+ Cluster: (0, n.toUint8)([31, 67, 182, 117]),
+ Timestamp: (0, n.toUint8)([231]),
+ TimestampScale: (0, n.toUint8)([42, 215, 177]),
+ BlockGroup: (0, n.toUint8)([160]),
+ BlockDuration: (0, n.toUint8)([155]),
+ Block: (0, n.toUint8)([161]),
+ SimpleBlock: (0, n.toUint8)([163])
+ };
+ i.EBML_TAGS = a;
+ var s = [128, 64, 32, 16, 8, 4, 2, 1],
+ o = function(e, t, i, r) {
+ void 0 === i && (i = !0), void 0 === r && (r = !1);
+ var a = function(e) {
+ for (var t = 1, i = 0; i < s.length && !(e & s[i]); i++) t++;
+ return t
+ }(e[t]),
+ o = e.subarray(t, t + a);
+ return i && ((o = Array.prototype.slice.call(e, t, t + a))[0] ^= s[a - 1]), {
+ length: a,
+ value: (0, n.bytesToNumber)(o, {
+ signed: r
+ }),
+ bytes: o
+ }
+ },
+ u = function e(t) {
+ return "string" == typeof t ? t.match(/.{1,2}/g).map((function(t) {
+ return e(t)
+ })) : "number" == typeof t ? (0, n.numberToBytes)(t) : t
+ },
+ l = function e(t, i, r) {
+ if (r >= i.length) return i.length;
+ var a = o(i, r, !1);
+ if ((0, n.bytesMatch)(t.bytes, a.bytes)) return r;
+ var s = o(i, r + a.length);
+ return e(t, i, r + s.length + s.value + a.length)
+ },
+ h = function e(t, i) {
+ i = function(e) {
+ return Array.isArray(e) ? e.map((function(e) {
+ return u(e)
+ })) : [u(e)]
+ }(i), t = (0, n.toUint8)(t);
+ var r = [];
+ if (!i.length) return r;
+ for (var a = 0; a < t.length;) {
+ var s = o(t, a, !1),
+ h = o(t, a + s.length),
+ d = a + s.length + h.length;
+ 127 === h.value && (h.value = l(s, t, d), h.value !== t.length && (h.value -= d));
+ var c = d + h.value > t.length ? t.length : d + h.value,
+ f = t.subarray(d, c);
+ (0, n.bytesMatch)(i[0], s.bytes) && (1 === i.length ? r.push(f) : r = r.concat(e(f, i.slice(1)))), a += s.length + h.length + f.length
+ }
+ return r
+ };
+ i.findEbml = h;
+ var d = function(e, t, i, r) {
+ var s;
+ "group" === t && ((s = h(e, [a.BlockDuration])[0]) && (s = 1 / i * (s = (0, n.bytesToNumber)(s)) * i / 1e3), e = h(e, [a.Block])[0], t = "block");
+ var u = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ l = o(e, 0),
+ d = u.getInt16(l.length, !1),
+ c = e[l.length + 2],
+ f = e.subarray(l.length + 3),
+ p = 1 / i * (r + d) * i / 1e3,
+ m = {
+ duration: s,
+ trackNumber: l.value,
+ keyframe: "simple" === t && c >> 7 == 1,
+ invisible: (8 & c) >> 3 == 1,
+ lacing: (6 & c) >> 1,
+ discardable: "simple" === t && 1 == (1 & c),
+ frames: [],
+ pts: p,
+ dts: p,
+ timestamp: d
+ };
+ if (!m.lacing) return m.frames.push(f), m;
+ var _ = f[0] + 1,
+ g = [],
+ v = 1;
+ if (2 === m.lacing)
+ for (var y = (f.length - v) / _, b = 0; b < _; b++) g.push(y);
+ if (1 === m.lacing)
+ for (var S = 0; S < _ - 1; S++) {
+ var T = 0;
+ do {
+ T += f[v], v++
+ } while (255 === f[v - 1]);
+ g.push(T)
+ }
+ if (3 === m.lacing)
+ for (var E = 0, w = 0; w < _ - 1; w++) {
+ var A = 0 === w ? o(f, v) : o(f, v, !0, !0);
+ E += A.value, g.push(E), v += A.length
+ }
+ return g.forEach((function(e) {
+ m.frames.push(f.subarray(v, v + e)), v += e
+ })), m
+ };
+ i.decodeBlock = d;
+ var c = function(e) {
+ e = (0, n.toUint8)(e);
+ var t = [],
+ i = h(e, [a.Segment, a.Tracks, a.Track]);
+ return i.length || (i = h(e, [a.Tracks, a.Track])), i.length || (i = h(e, [a.Track])), i.length ? (i.forEach((function(e) {
+ var i = h(e, a.TrackType)[0];
+ if (i && i.length) {
+ if (1 === i[0]) i = "video";
+ else if (2 === i[0]) i = "audio";
+ else {
+ if (17 !== i[0]) return;
+ i = "subtitle"
+ }
+ var s = {
+ rawCodec: (0, n.bytesToString)(h(e, [a.CodecID])[0]),
+ type: i,
+ codecPrivate: h(e, [a.CodecPrivate])[0],
+ number: (0, n.bytesToNumber)(h(e, [a.TrackNumber])[0]),
+ defaultDuration: (0, n.bytesToNumber)(h(e, [a.DefaultDuration])[0]),
+ default: h(e, [a.FlagDefault])[0],
+ rawData: e
+ },
+ o = "";
+ if (/V_MPEG4\/ISO\/AVC/.test(s.rawCodec)) o = "avc1." + (0, r.getAvcCodec)(s.codecPrivate);
+ else if (/V_MPEGH\/ISO\/HEVC/.test(s.rawCodec)) o = "hev1." + (0, r.getHvcCodec)(s.codecPrivate);
+ else if (/V_MPEG4\/ISO\/ASP/.test(s.rawCodec)) o = s.codecPrivate ? "mp4v.20." + s.codecPrivate[4].toString() : "mp4v.20.9";
+ else if (/^V_THEORA/.test(s.rawCodec)) o = "theora";
+ else if (/^V_VP8/.test(s.rawCodec)) o = "vp8";
+ else if (/^V_VP9/.test(s.rawCodec))
+ if (s.codecPrivate) {
+ var u = function(e) {
+ for (var t = 0, i = {}; t < e.length;) {
+ var n = 127 & e[t],
+ r = e[t + 1],
+ a = void 0;
+ a = 1 === r ? e[t + 2] : e.subarray(t + 2, t + 2 + r), 1 === n ? i.profile = a : 2 === n ? i.level = a : 3 === n ? i.bitDepth = a : 4 === n ? i.chromaSubsampling = a : i[n] = a, t += 2 + r
+ }
+ return i
+ }(s.codecPrivate),
+ l = u.profile,
+ d = u.level,
+ c = u.bitDepth,
+ f = u.chromaSubsampling;
+ o = "vp09.", o += (0, n.padStart)(l, 2, "0") + ".", o += (0, n.padStart)(d, 2, "0") + ".", o += (0, n.padStart)(c, 2, "0") + ".", o += "" + (0, n.padStart)(f, 2, "0");
+ var p = h(e, [224, [85, 176],
+ [85, 177]
+ ])[0] || [],
+ m = h(e, [224, [85, 176],
+ [85, 185]
+ ])[0] || [],
+ _ = h(e, [224, [85, 176],
+ [85, 186]
+ ])[0] || [],
+ g = h(e, [224, [85, 176],
+ [85, 187]
+ ])[0] || [];
+ (p.length || m.length || _.length || g.length) && (o += "." + (0, n.padStart)(g[0], 2, "0"), o += "." + (0, n.padStart)(_[0], 2, "0"), o += "." + (0, n.padStart)(p[0], 2, "0"), o += "." + (0, n.padStart)(m[0], 2, "0"))
+ } else o = "vp9";
+ else /^V_AV1/.test(s.rawCodec) ? o = "av01." + (0, r.getAv1Codec)(s.codecPrivate) : /A_ALAC/.test(s.rawCodec) ? o = "alac" : /A_MPEG\/L2/.test(s.rawCodec) ? o = "mp2" : /A_MPEG\/L3/.test(s.rawCodec) ? o = "mp3" : /^A_AAC/.test(s.rawCodec) ? o = s.codecPrivate ? "mp4a.40." + (s.codecPrivate[0] >>> 3).toString() : "mp4a.40.2" : /^A_AC3/.test(s.rawCodec) ? o = "ac-3" : /^A_PCM/.test(s.rawCodec) ? o = "pcm" : /^A_MS\/ACM/.test(s.rawCodec) ? o = "speex" : /^A_EAC3/.test(s.rawCodec) ? o = "ec-3" : /^A_VORBIS/.test(s.rawCodec) ? o = "vorbis" : /^A_FLAC/.test(s.rawCodec) ? o = "flac" : /^A_OPUS/.test(s.rawCodec) && (o = "opus");
+ s.codec = o, t.push(s)
+ }
+ })), t.sort((function(e, t) {
+ return e.number - t.number
+ }))) : t
+ };
+ i.parseTracks = c;
+ i.parseData = function(e, t) {
+ var i = [],
+ r = h(e, [a.Segment])[0],
+ s = h(r, [a.SegmentInfo, a.TimestampScale])[0];
+ s = s && s.length ? (0, n.bytesToNumber)(s) : 1e6;
+ var o = h(r, [a.Cluster]);
+ return t || (t = c(r)), o.forEach((function(e, t) {
+ var r = h(e, [a.SimpleBlock]).map((function(e) {
+ return {
+ type: "simple",
+ data: e
+ }
+ })),
+ o = h(e, [a.BlockGroup]).map((function(e) {
+ return {
+ type: "group",
+ data: e
+ }
+ })),
+ u = h(e, [a.Timestamp])[0] || 0;
+ u && u.length && (u = (0, n.bytesToNumber)(u)), r.concat(o).sort((function(e, t) {
+ return e.data.byteOffset - t.data.byteOffset
+ })).forEach((function(e, t) {
+ var n = d(e.data, e.type, s, u);
+ i.push(n)
+ }))
+ })), {
+ tracks: t,
+ blocks: i
+ }
+ }
+ }, {
+ "./byte-helpers": 9,
+ "./codec-helpers.js": 10
+ }],
+ 15: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.getId3Offset = i.getId3Size = void 0;
+ var n = e("./byte-helpers.js"),
+ r = (0, n.toUint8)([73, 68, 51]),
+ a = function(e, t) {
+ void 0 === t && (t = 0);
+ var i = (e = (0, n.toUint8)(e))[t + 5],
+ r = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
+ return (16 & i) >> 4 ? r + 20 : r + 10
+ };
+ i.getId3Size = a;
+ i.getId3Offset = function e(t, i) {
+ return void 0 === i && (i = 0), (t = (0, n.toUint8)(t)).length - i < 10 || !(0, n.bytesMatch)(t, r, {
+ offset: i
+ }) ? i : e(t, i += a(t, i))
+ }
+ }, {
+ "./byte-helpers.js": 9
+ }],
+ 16: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.simpleTypeFromSourceType = void 0;
+ var n = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,
+ r = /^application\/dash\+xml/i;
+ i.simpleTypeFromSourceType = function(e) {
+ return n.test(e) ? "hls" : r.test(e) ? "dash" : "application/vnd.videojs.vhs+json" === e ? "vhs-json" : null
+ }
+ }, {}],
+ 17: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.parseMediaInfo = i.parseTracks = i.addSampleDescription = i.buildFrameTable = i.findNamedBox = i.findBox = i.parseDescriptors = void 0;
+ var n, r = e("./byte-helpers.js"),
+ a = e("./codec-helpers.js"),
+ s = e("./opus-helpers.js"),
+ o = function(e) {
+ return "string" == typeof e ? (0, r.stringToBytes)(e) : e
+ },
+ u = function(e) {
+ e = (0, r.toUint8)(e);
+ for (var t = [], i = 0; e.length > i;) {
+ var a = e[i],
+ s = 0,
+ o = 0,
+ u = e[++o];
+ for (o++; 128 & u;) s = (127 & u) << 7, u = e[o], o++;
+ s += 127 & u;
+ for (var l = 0; l < n.length; l++) {
+ var h = n[l],
+ d = h.id,
+ c = h.parser;
+ if (a === d) {
+ t.push(c(e.subarray(o, o + s)));
+ break
+ }
+ }
+ i += s + o
+ }
+ return t
+ };
+ i.parseDescriptors = u, n = [{
+ id: 3,
+ parser: function(e) {
+ var t = {
+ tag: 3,
+ id: e[0] << 8 | e[1],
+ flags: e[2],
+ size: 3,
+ dependsOnEsId: 0,
+ ocrEsId: 0,
+ descriptors: [],
+ url: ""
+ };
+ if (128 & t.flags && (t.dependsOnEsId = e[t.size] << 8 | e[t.size + 1], t.size += 2), 64 & t.flags) {
+ var i = e[t.size];
+ t.url = (0, r.bytesToString)(e.subarray(t.size + 1, t.size + 1 + i)), t.size += i
+ }
+ return 32 & t.flags && (t.ocrEsId = e[t.size] << 8 | e[t.size + 1], t.size += 2), t.descriptors = u(e.subarray(t.size)) || [], t
+ }
+ }, {
+ id: 4,
+ parser: function(e) {
+ return {
+ tag: 4,
+ oti: e[0],
+ streamType: e[1],
+ bufferSize: e[2] << 16 | e[3] << 8 | e[4],
+ maxBitrate: e[5] << 24 | e[6] << 16 | e[7] << 8 | e[8],
+ avgBitrate: e[9] << 24 | e[10] << 16 | e[11] << 8 | e[12],
+ descriptors: u(e.subarray(13))
+ }
+ }
+ }, {
+ id: 5,
+ parser: function(e) {
+ return {
+ tag: 5,
+ bytes: e
+ }
+ }
+ }, {
+ id: 6,
+ parser: function(e) {
+ return {
+ tag: 6,
+ bytes: e
+ }
+ }
+ }];
+ var l = function e(t, i, n) {
+ void 0 === n && (n = !1), i = function(e) {
+ return Array.isArray(e) ? e.map((function(e) {
+ return o(e)
+ })) : [o(e)]
+ }(i), t = (0, r.toUint8)(t);
+ var a = [];
+ if (!i.length) return a;
+ for (var s = 0; s < t.length;) {
+ var u = (t[s] << 24 | t[s + 1] << 16 | t[s + 2] << 8 | t[s + 3]) >>> 0,
+ l = t.subarray(s + 4, s + 8);
+ if (0 === u) break;
+ var h = s + u;
+ if (h > t.length) {
+ if (n) break;
+ h = t.length
+ }
+ var d = t.subarray(s + 8, h);
+ (0, r.bytesMatch)(l, i[0]) && (1 === i.length ? a.push(d) : a.push.apply(a, e(d, i.slice(1), n))), s = h
+ }
+ return a
+ };
+ i.findBox = l;
+ var h = function(e, t) {
+ if (!(t = o(t)).length) return e.subarray(e.length);
+ for (var i = 0; i < e.length;) {
+ if ((0, r.bytesMatch)(e.subarray(i, i + t.length), t)) {
+ var n = (e[i - 4] << 24 | e[i - 3] << 16 | e[i - 2] << 8 | e[i - 1]) >>> 0,
+ a = n > 1 ? i + n : e.byteLength;
+ return e.subarray(i + 4, a)
+ }
+ i++
+ }
+ return e.subarray(e.length)
+ };
+ i.findNamedBox = h;
+ var d = function(e, t, i) {
+ void 0 === t && (t = 4), void 0 === i && (i = function(e) {
+ return (0, r.bytesToNumber)(e)
+ });
+ var n = [];
+ if (!e || !e.length) return n;
+ for (var a = (0, r.bytesToNumber)(e.subarray(4, 8)), s = 8; a; s += t, a--) n.push(i(e.subarray(s, s + t)));
+ return n
+ },
+ c = function(e, t) {
+ for (var i = d(l(e, ["stss"])[0]), n = d(l(e, ["stco"])[0]), a = d(l(e, ["stts"])[0], 8, (function(e) {
+ return {
+ sampleCount: (0, r.bytesToNumber)(e.subarray(0, 4)),
+ sampleDelta: (0, r.bytesToNumber)(e.subarray(4, 8))
+ }
+ })), s = d(l(e, ["stsc"])[0], 12, (function(e) {
+ return {
+ firstChunk: (0, r.bytesToNumber)(e.subarray(0, 4)),
+ samplesPerChunk: (0, r.bytesToNumber)(e.subarray(4, 8)),
+ sampleDescriptionIndex: (0, r.bytesToNumber)(e.subarray(8, 12))
+ }
+ })), o = l(e, ["stsz"])[0], u = d(o && o.length && o.subarray(4) || null), h = [], c = 0; c < n.length; c++) {
+ for (var f = void 0, p = 0; p < s.length; p++) {
+ var m = s[p];
+ if (c + 1 >= m.firstChunk && (p + 1 >= s.length || c + 1 < s[p + 1].firstChunk)) {
+ f = m.samplesPerChunk;
+ break
+ }
+ }
+ for (var _ = n[c], g = 0; g < f; g++) {
+ var v = u[h.length],
+ y = !i.length;
+ i.length && -1 !== i.indexOf(h.length + 1) && (y = !0);
+ for (var b = {
+ keyframe: y,
+ start: _,
+ end: _ + v
+ }, S = 0; S < a.length; S++) {
+ var T = a[S],
+ E = T.sampleCount,
+ w = T.sampleDelta;
+ if (h.length <= E) {
+ var A = h.length ? h[h.length - 1].timestamp : 0;
+ b.timestamp = A + w / t * 1e3, b.duration = w;
+ break
+ }
+ }
+ h.push(b), _ += v
+ }
+ }
+ return h
+ };
+ i.buildFrameTable = c;
+ var f = function(e, t) {
+ var i = (0, r.bytesToString)(t.subarray(0, 4));
+ if ("video" === e.type ? (e.info = e.info || {}, e.info.width = t[28] << 8 | t[29], e.info.height = t[30] << 8 | t[31]) : "audio" === e.type && (e.info = e.info || {}, e.info.channels = t[20] << 8 | t[21], e.info.bitDepth = t[22] << 8 | t[23], e.info.sampleRate = t[28] << 8 | t[29]), "avc1" === i) {
+ var n = h(t, "avcC");
+ i += "." + (0, a.getAvcCodec)(n), e.info.avcC = n
+ } else if ("hvc1" === i || "hev1" === i) i += "." + (0, a.getHvcCodec)(h(t, "hvcC"));
+ else if ("mp4a" === i || "mp4v" === i) {
+ var o = h(t, "esds"),
+ l = u(o.subarray(4))[0],
+ d = l && l.descriptors.filter((function(e) {
+ return 4 === e.tag
+ }))[0];
+ d ? (i += "." + (0, r.toHexString)(d.oti), 64 === d.oti ? i += "." + (d.descriptors[0].bytes[0] >> 3).toString() : 32 === d.oti ? i += "." + d.descriptors[0].bytes[4].toString() : 221 === d.oti && (i = "vorbis")) : "audio" === e.type ? i += ".40.2" : i += ".20.9"
+ } else if ("av01" === i) i += "." + (0, a.getAv1Codec)(h(t, "av1C"));
+ else if ("vp09" === i) {
+ var c = h(t, "vpcC"),
+ f = c[0],
+ p = c[1],
+ m = c[2] >> 4,
+ _ = (15 & c[2]) >> 1,
+ g = (15 & c[2]) >> 3,
+ v = c[3],
+ y = c[4],
+ b = c[5];
+ i += "." + (0, r.padStart)(f, 2, "0"), i += "." + (0, r.padStart)(p, 2, "0"), i += "." + (0, r.padStart)(m, 2, "0"), i += "." + (0, r.padStart)(_, 2, "0"), i += "." + (0, r.padStart)(v, 2, "0"), i += "." + (0, r.padStart)(y, 2, "0"), i += "." + (0, r.padStart)(b, 2, "0"), i += "." + (0, r.padStart)(g, 2, "0")
+ } else if ("theo" === i) i = "theora";
+ else if ("spex" === i) i = "speex";
+ else if (".mp3" === i) i = "mp4a.40.34";
+ else if ("msVo" === i) i = "vorbis";
+ else if ("Opus" === i) {
+ i = "opus";
+ var S = h(t, "dOps");
+ e.info.opus = (0, s.parseOpusHead)(S), e.info.codecDelay = 65e5
+ } else i = i.toLowerCase();
+ e.codec = i
+ };
+ i.addSampleDescription = f;
+ i.parseTracks = function(e, t) {
+ void 0 === t && (t = !0), e = (0, r.toUint8)(e);
+ var i = l(e, ["moov", "trak"], !0),
+ n = [];
+ return i.forEach((function(e) {
+ var i = {
+ bytes: e
+ },
+ a = l(e, ["mdia"])[0],
+ s = l(a, ["hdlr"])[0],
+ o = (0, r.bytesToString)(s.subarray(8, 12));
+ i.type = "soun" === o ? "audio" : "vide" === o ? "video" : o;
+ var u = l(e, ["tkhd"])[0];
+ if (u) {
+ var h = new DataView(u.buffer, u.byteOffset, u.byteLength),
+ d = h.getUint8(0);
+ i.number = 0 === d ? h.getUint32(12) : h.getUint32(20)
+ }
+ var p = l(a, ["mdhd"])[0];
+ if (p) {
+ var m = 0 === p[0] ? 12 : 20;
+ i.timescale = (p[m] << 24 | p[m + 1] << 16 | p[m + 2] << 8 | p[m + 3]) >>> 0
+ }
+ for (var _ = l(a, ["minf", "stbl"])[0], g = l(_, ["stsd"])[0], v = (0, r.bytesToNumber)(g.subarray(4, 8)), y = 8; v--;) {
+ var b = (0, r.bytesToNumber)(g.subarray(y, y + 4)),
+ S = g.subarray(y + 4, y + 4 + b);
+ f(i, S), y += 4 + b
+ }
+ t && (i.frameTable = c(_, i.timescale)), n.push(i)
+ })), n
+ };
+ i.parseMediaInfo = function(e) {
+ var t = l(e, ["moov", "mvhd"], !0)[0];
+ if (t && t.length) {
+ var i = {};
+ return 1 === t[0] ? (i.timestampScale = (0, r.bytesToNumber)(t.subarray(20, 24)), i.duration = (0, r.bytesToNumber)(t.subarray(24, 32))) : (i.timestampScale = (0, r.bytesToNumber)(t.subarray(12, 16)), i.duration = (0, r.bytesToNumber)(t.subarray(16, 20))), i.bytes = t, i
+ }
+ }
+ }, {
+ "./byte-helpers.js": 9,
+ "./codec-helpers.js": 10,
+ "./opus-helpers.js": 19
+ }],
+ 18: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.findH265Nal = i.findH264Nal = i.findNal = i.discardEmulationPreventionBytes = i.EMULATION_PREVENTION = i.NAL_TYPE_TWO = i.NAL_TYPE_ONE = void 0;
+ var n = e("./byte-helpers.js"),
+ r = (0, n.toUint8)([0, 0, 0, 1]);
+ i.NAL_TYPE_ONE = r;
+ var a = (0, n.toUint8)([0, 0, 1]);
+ i.NAL_TYPE_TWO = a;
+ var s = (0, n.toUint8)([0, 0, 3]);
+ i.EMULATION_PREVENTION = s;
+ var o = function(e) {
+ for (var t = [], i = 1; i < e.length - 2;)(0, n.bytesMatch)(e.subarray(i, i + 3), s) && (t.push(i + 2), i++), i++;
+ if (0 === t.length) return e;
+ var r = e.length - t.length,
+ a = new Uint8Array(r),
+ o = 0;
+ for (i = 0; i < r; o++, i++) o === t[0] && (o++, t.shift()), a[i] = e[o];
+ return a
+ };
+ i.discardEmulationPreventionBytes = o;
+ var u = function(e, t, i, s) {
+ void 0 === s && (s = 1 / 0), e = (0, n.toUint8)(e), i = [].concat(i);
+ for (var u, l = 0, h = 0; l < e.length && (h < s || u);) {
+ var d = void 0;
+ if ((0, n.bytesMatch)(e.subarray(l), r) ? d = 4 : (0, n.bytesMatch)(e.subarray(l), a) && (d = 3), d) {
+ if (h++, u) return o(e.subarray(u, l));
+ var c = void 0;
+ "h264" === t ? c = 31 & e[l + d] : "h265" === t && (c = e[l + d] >> 1 & 63), -1 !== i.indexOf(c) && (u = l + d), l += d + ("h264" === t ? 1 : 2)
+ } else l++
+ }
+ return e.subarray(0, 0)
+ };
+ i.findNal = u;
+ i.findH264Nal = function(e, t, i) {
+ return u(e, "h264", t, i)
+ };
+ i.findH265Nal = function(e, t, i) {
+ return u(e, "h265", t, i)
+ }
+ }, {
+ "./byte-helpers.js": 9
+ }],
+ 19: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.setOpusHead = i.parseOpusHead = i.OPUS_HEAD = void 0;
+ var n = new Uint8Array([79, 112, 117, 115, 72, 101, 97, 100]);
+ i.OPUS_HEAD = n;
+ i.parseOpusHead = function(e) {
+ var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ i = t.getUint8(0),
+ n = 0 !== i,
+ r = {
+ version: i,
+ channels: t.getUint8(1),
+ preSkip: t.getUint16(2, n),
+ sampleRate: t.getUint32(4, n),
+ outputGain: t.getUint16(8, n),
+ channelMappingFamily: t.getUint8(10)
+ };
+ if (r.channelMappingFamily > 0 && e.length > 10) {
+ r.streamCount = t.getUint8(11), r.twoChannelStreamCount = t.getUint8(12), r.channelMapping = [];
+ for (var a = 0; a < r.channels; a++) r.channelMapping.push(t.getUint8(13 + a))
+ }
+ return r
+ };
+ i.setOpusHead = function(e) {
+ var t = e.channelMappingFamily <= 0 ? 11 : 12 + e.channels,
+ i = new DataView(new ArrayBuffer(t)),
+ n = 0 !== e.version;
+ return i.setUint8(0, e.version), i.setUint8(1, e.channels), i.setUint16(2, e.preSkip, n), i.setUint32(4, e.sampleRate, n), i.setUint16(8, e.outputGain, n), i.setUint8(10, e.channelMappingFamily), e.channelMappingFamily > 0 && (i.setUint8(11, e.streamCount), e.channelMapping.foreach((function(e, t) {
+ i.setUint8(12 + t, e)
+ }))), new Uint8Array(i.buffer)
+ }
+ }, {}],
+ 20: [function(e, t, i) {
+ "use strict";
+ var n = e("@babel/runtime/helpers/interopRequireDefault");
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.default = void 0;
+ var r = n(e("url-toolkit")),
+ a = n(e("global/window")),
+ s = function(e, t) {
+ if (/^[a-z]+:/i.test(t)) return t;
+ /^data:/.test(e) && (e = a.default.location && a.default.location.href || "");
+ var i = "function" == typeof a.default.URL,
+ n = /^\/\//.test(e),
+ s = !a.default.location && !/\/\//i.test(e);
+ if (i ? e = new a.default.URL(e, a.default.location || "http://example.com") : /\/\//i.test(e) || (e = r.default.buildAbsoluteURL(a.default.location && a.default.location.href || "", e)), i) {
+ var o = new URL(t, e);
+ return s ? o.href.slice("http://example.com".length) : n ? o.href.slice(o.protocol.length) : o.href
+ }
+ return r.default.buildAbsoluteURL(e, t)
+ };
+ i.default = s, t.exports = i.default
+ }, {
+ "@babel/runtime/helpers/interopRequireDefault": 6,
+ "global/window": 34,
+ "url-toolkit": 46
+ }],
+ 21: [function(e, t, i) {
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ }), i.default = void 0;
+ var n = function() {
+ function e() {
+ this.listeners = {}
+ }
+ var t = e.prototype;
+ return t.on = function(e, t) {
+ this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
+ }, t.off = function(e, t) {
+ if (!this.listeners[e]) return !1;
+ var i = this.listeners[e].indexOf(t);
+ return this.listeners[e] = this.listeners[e].slice(0), this.listeners[e].splice(i, 1), i > -1
+ }, t.trigger = function(e) {
+ var t = this.listeners[e];
+ if (t)
+ if (2 === arguments.length)
+ for (var i = t.length, n = 0; n < i; ++n) t[n].call(this, arguments[1]);
+ else
+ for (var r = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s].apply(this, r)
+ }, t.dispose = function() {
+ this.listeners = {}
+ }, t.pipe = function(e) {
+ this.on("data", (function(t) {
+ e.push(t)
+ }))
+ }, e
+ }();
+ i.default = n, t.exports = i.default
+ }, {}],
+ 22: [function(e, t, i) {
+ "use strict";
+ var n = e("global/window");
+ t.exports = function(e, t) {
+ return void 0 === t && (t = !1),
+ function(i, r, a) {
+ if (i) e(i);
+ else if (r.statusCode >= 400 && r.statusCode <= 599) {
+ var s = a;
+ if (t)
+ if (n.TextDecoder) {
+ var o = function(e) {
+ void 0 === e && (e = "");
+ return e.toLowerCase().split(";").reduce((function(e, t) {
+ var i = t.split("="),
+ n = i[0],
+ r = i[1];
+ return "charset" === n.trim() ? r.trim() : e
+ }), "utf-8")
+ }(r.headers && r.headers["content-type"]);
+ try {
+ s = new TextDecoder(o).decode(a)
+ } catch (e) {}
+ } else s = String.fromCharCode.apply(null, new Uint8Array(a));
+ e({
+ cause: s
+ })
+ } else e(null, a)
+ }
+ }
+ }, {
+ "global/window": 34
+ }],
+ 23: [function(e, t, i) {
+ "use strict";
+ var n = e("global/window"),
+ r = e("@babel/runtime/helpers/extends"),
+ a = e("is-function");
+ o.httpHandler = e("./http-handler.js");
+
+ function s(e, t, i) {
+ var n = e;
+ return a(t) ? (i = t, "string" == typeof e && (n = {
+ uri: e
+ })) : n = r({}, t, {
+ uri: e
+ }), n.callback = i, n
+ }
+
+ function o(e, t, i) {
+ return u(t = s(e, t, i))
+ }
+
+ function u(e) {
+ if (void 0 === e.callback) throw new Error("callback argument missing");
+ var t = !1,
+ i = function(i, n, r) {
+ t || (t = !0, e.callback(i, n, r))
+ };
+
+ function n() {
+ var e = void 0;
+ if (e = l.response ? l.response : l.responseText || function(e) {
+ try {
+ if ("document" === e.responseType) return e.responseXML;
+ var t = e.responseXML && "parsererror" === e.responseXML.documentElement.nodeName;
+ if ("" === e.responseType && !t) return e.responseXML
+ } catch (e) {}
+ return null
+ }(l), _) try {
+ e = JSON.parse(e)
+ } catch (e) {}
+ return e
+ }
+
+ function r(e) {
+ return clearTimeout(h), e instanceof Error || (e = new Error("" + (e || "Unknown XMLHttpRequest Error"))), e.statusCode = 0, i(e, g)
+ }
+
+ function a() {
+ if (!u) {
+ var t;
+ clearTimeout(h), t = e.useXDR && void 0 === l.status ? 200 : 1223 === l.status ? 204 : l.status;
+ var r = g,
+ a = null;
+ return 0 !== t ? (r = {
+ body: n(),
+ statusCode: t,
+ method: c,
+ headers: {},
+ url: d,
+ rawRequest: l
+ }, l.getAllResponseHeaders && (r.headers = function(e) {
+ var t = {};
+ return e ? (e.trim().split("\n").forEach((function(e) {
+ var i = e.indexOf(":"),
+ n = e.slice(0, i).trim().toLowerCase(),
+ r = e.slice(i + 1).trim();
+ void 0 === t[n] ? t[n] = r : Array.isArray(t[n]) ? t[n].push(r) : t[n] = [t[n], r]
+ })), t) : t
+ }(l.getAllResponseHeaders()))) : a = new Error("Internal XMLHttpRequest Error"), i(a, r, r.body)
+ }
+ }
+ var s, u, l = e.xhr || null;
+ l || (l = e.cors || e.useXDR ? new o.XDomainRequest : new o.XMLHttpRequest);
+ var h, d = l.url = e.uri || e.url,
+ c = l.method = e.method || "GET",
+ f = e.body || e.data,
+ p = l.headers = e.headers || {},
+ m = !!e.sync,
+ _ = !1,
+ g = {
+ body: void 0,
+ headers: {},
+ statusCode: 0,
+ method: c,
+ url: d,
+ rawRequest: l
+ };
+ if ("json" in e && !1 !== e.json && (_ = !0, p.accept || p.Accept || (p.Accept = "application/json"), "GET" !== c && "HEAD" !== c && (p["content-type"] || p["Content-Type"] || (p["Content-Type"] = "application/json"), f = JSON.stringify(!0 === e.json ? f : e.json))), l.onreadystatechange = function() {
+ 4 === l.readyState && setTimeout(a, 0)
+ }, l.onload = a, l.onerror = r, l.onprogress = function() {}, l.onabort = function() {
+ u = !0
+ }, l.ontimeout = r, l.open(c, d, !m, e.username, e.password), m || (l.withCredentials = !!e.withCredentials), !m && e.timeout > 0 && (h = setTimeout((function() {
+ if (!u) {
+ u = !0, l.abort("timeout");
+ var e = new Error("XMLHttpRequest timeout");
+ e.code = "ETIMEDOUT", r(e)
+ }
+ }), e.timeout)), l.setRequestHeader)
+ for (s in p) p.hasOwnProperty(s) && l.setRequestHeader(s, p[s]);
+ else if (e.headers && ! function(e) {
+ for (var t in e)
+ if (e.hasOwnProperty(t)) return !1;
+ return !0
+ }(e.headers)) throw new Error("Headers cannot be set on an XDomainRequest object");
+ return "responseType" in e && (l.responseType = e.responseType), "beforeSend" in e && "function" == typeof e.beforeSend && e.beforeSend(l), l.send(f || null), l
+ }
+ t.exports = o, t.exports.default = o, o.XMLHttpRequest = n.XMLHttpRequest || function() {}, o.XDomainRequest = "withCredentials" in new o.XMLHttpRequest ? o.XMLHttpRequest : n.XDomainRequest,
+ function(e, t) {
+ for (var i = 0; i < e.length; i++) t(e[i])
+ }(["get", "put", "post", "patch", "head", "delete"], (function(e) {
+ o["delete" === e ? "del" : e] = function(t, i, n) {
+ return (i = s(t, i, n)).method = e.toUpperCase(), u(i)
+ }
+ }))
+ }, {
+ "./http-handler.js": 22,
+ "@babel/runtime/helpers/extends": 3,
+ "global/window": 34,
+ "is-function": 36
+ }],
+ 24: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ return void 0 === t && (t = Object), t && "function" == typeof t.freeze ? t.freeze(e) : e
+ }
+ var r = n({
+ HTML: "text/html",
+ isHTML: function(e) {
+ return e === r.HTML
+ },
+ XML_APPLICATION: "application/xml",
+ XML_TEXT: "text/xml",
+ XML_XHTML_APPLICATION: "application/xhtml+xml",
+ XML_SVG_IMAGE: "image/svg+xml"
+ }),
+ a = n({
+ HTML: "http://www.w3.org/1999/xhtml",
+ isHTML: function(e) {
+ return e === a.HTML
+ },
+ SVG: "http://www.w3.org/2000/svg",
+ XML: "http://www.w3.org/XML/1998/namespace",
+ XMLNS: "http://www.w3.org/2000/xmlns/"
+ });
+ i.freeze = n, i.MIME_TYPE = r, i.NAMESPACE = a
+ }, {}],
+ 25: [function(e, t, i) {
+ var n = e("./conventions"),
+ r = e("./dom"),
+ a = e("./entities"),
+ s = e("./sax"),
+ o = r.DOMImplementation,
+ u = n.NAMESPACE,
+ l = s.ParseError,
+ h = s.XMLReader;
+
+ function d(e) {
+ this.options = e || {
+ locator: {}
+ }
+ }
+
+ function c() {
+ this.cdata = !1
+ }
+
+ function f(e, t) {
+ t.lineNumber = e.lineNumber, t.columnNumber = e.columnNumber
+ }
+
+ function p(e) {
+ if (e) return "\n@" + (e.systemId || "") + "#[line:" + e.lineNumber + ",col:" + e.columnNumber + "]"
+ }
+
+ function m(e, t, i) {
+ return "string" == typeof e ? e.substr(t, i) : e.length >= t + i || t ? new java.lang.String(e, t, i) + "" : e
+ }
+
+ function _(e, t) {
+ e.currentElement ? e.currentElement.appendChild(t) : e.doc.appendChild(t)
+ }
+ d.prototype.parseFromString = function(e, t) {
+ var i = this.options,
+ n = new h,
+ r = i.domBuilder || new c,
+ s = i.errorHandler,
+ o = i.locator,
+ l = i.xmlns || {},
+ d = /\/x?html?$/.test(t),
+ f = d ? a.HTML_ENTITIES : a.XML_ENTITIES;
+ return o && r.setDocumentLocator(o), n.errorHandler = function(e, t, i) {
+ if (!e) {
+ if (t instanceof c) return t;
+ e = t
+ }
+ var n = {},
+ r = e instanceof Function;
+
+ function a(t) {
+ var a = e[t];
+ !a && r && (a = 2 == e.length ? function(i) {
+ e(t, i)
+ } : e), n[t] = a && function(e) {
+ a("[xmldom " + t + "]\t" + e + p(i))
+ } || function() {}
+ }
+ return i = i || {}, a("warning"), a("error"), a("fatalError"), n
+ }(s, r, o), n.domBuilder = i.domBuilder || r, d && (l[""] = u.HTML), l.xml = l.xml || u.XML, e && "string" == typeof e ? n.parse(e, l, f) : n.errorHandler.error("invalid doc source"), r.doc
+ }, c.prototype = {
+ startDocument: function() {
+ this.doc = (new o).createDocument(null, null, null), this.locator && (this.doc.documentURI = this.locator.systemId)
+ },
+ startElement: function(e, t, i, n) {
+ var r = this.doc,
+ a = r.createElementNS(e, i || t),
+ s = n.length;
+ _(this, a), this.currentElement = a, this.locator && f(this.locator, a);
+ for (var o = 0; o < s; o++) {
+ e = n.getURI(o);
+ var u = n.getValue(o),
+ l = (i = n.getQName(o), r.createAttributeNS(e, i));
+ this.locator && f(n.getLocator(o), l), l.value = l.nodeValue = u, a.setAttributeNode(l)
+ }
+ },
+ endElement: function(e, t, i) {
+ var n = this.currentElement;
+ n.tagName;
+ this.currentElement = n.parentNode
+ },
+ startPrefixMapping: function(e, t) {},
+ endPrefixMapping: function(e) {},
+ processingInstruction: function(e, t) {
+ var i = this.doc.createProcessingInstruction(e, t);
+ this.locator && f(this.locator, i), _(this, i)
+ },
+ ignorableWhitespace: function(e, t, i) {},
+ characters: function(e, t, i) {
+ if (e = m.apply(this, arguments)) {
+ if (this.cdata) var n = this.doc.createCDATASection(e);
+ else n = this.doc.createTextNode(e);
+ this.currentElement ? this.currentElement.appendChild(n) : /^\s*$/.test(e) && this.doc.appendChild(n), this.locator && f(this.locator, n)
+ }
+ },
+ skippedEntity: function(e) {},
+ endDocument: function() {
+ this.doc.normalize()
+ },
+ setDocumentLocator: function(e) {
+ (this.locator = e) && (e.lineNumber = 0)
+ },
+ comment: function(e, t, i) {
+ e = m.apply(this, arguments);
+ var n = this.doc.createComment(e);
+ this.locator && f(this.locator, n), _(this, n)
+ },
+ startCDATA: function() {
+ this.cdata = !0
+ },
+ endCDATA: function() {
+ this.cdata = !1
+ },
+ startDTD: function(e, t, i) {
+ var n = this.doc.implementation;
+ if (n && n.createDocumentType) {
+ var r = n.createDocumentType(e, t, i);
+ this.locator && f(this.locator, r), _(this, r), this.doc.doctype = r
+ }
+ },
+ warning: function(e) {
+ p(this.locator)
+ },
+ error: function(e) {
+ console.error("[xmldom error]\t" + e, p(this.locator))
+ },
+ fatalError: function(e) {
+ throw new l(e, this.locator)
+ }
+ }, "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, (function(e) {
+ c.prototype[e] = function() {
+ return null
+ }
+ })), i.__DOMHandler = c, i.DOMParser = d, i.DOMImplementation = r.DOMImplementation, i.XMLSerializer = r.XMLSerializer
+ }, {
+ "./conventions": 24,
+ "./dom": 26,
+ "./entities": 27,
+ "./sax": 29
+ }],
+ 26: [function(e, t, i) {
+ var n = e("./conventions").NAMESPACE;
+
+ function r(e) {
+ return "" !== e
+ }
+
+ function a(e, t) {
+ return e.hasOwnProperty(t) || (e[t] = !0), e
+ }
+
+ function s(e) {
+ if (!e) return [];
+ var t = function(e) {
+ return e ? e.split(/[\t\n\f\r ]+/).filter(r) : []
+ }(e);
+ return Object.keys(t.reduce(a, {}))
+ }
+
+ function o(e, t) {
+ for (var i in e) t[i] = e[i]
+ }
+
+ function u(e, t) {
+ var i = e.prototype;
+ if (!(i instanceof t)) {
+ function n() {}
+ n.prototype = t.prototype, o(i, n = new n), e.prototype = i = n
+ }
+ i.constructor != e && ("function" != typeof e && console.error("unknown Class:" + e), i.constructor = e)
+ }
+ var l = {},
+ h = l.ELEMENT_NODE = 1,
+ d = l.ATTRIBUTE_NODE = 2,
+ c = l.TEXT_NODE = 3,
+ f = l.CDATA_SECTION_NODE = 4,
+ p = l.ENTITY_REFERENCE_NODE = 5,
+ m = l.ENTITY_NODE = 6,
+ _ = l.PROCESSING_INSTRUCTION_NODE = 7,
+ g = l.COMMENT_NODE = 8,
+ v = l.DOCUMENT_NODE = 9,
+ y = l.DOCUMENT_TYPE_NODE = 10,
+ b = l.DOCUMENT_FRAGMENT_NODE = 11,
+ S = l.NOTATION_NODE = 12,
+ T = {},
+ E = {},
+ w = (T.INDEX_SIZE_ERR = (E[1] = "Index size error", 1), T.DOMSTRING_SIZE_ERR = (E[2] = "DOMString size error", 2), T.HIERARCHY_REQUEST_ERR = (E[3] = "Hierarchy request error", 3)),
+ A = (T.WRONG_DOCUMENT_ERR = (E[4] = "Wrong document", 4), T.INVALID_CHARACTER_ERR = (E[5] = "Invalid character", 5), T.NO_DATA_ALLOWED_ERR = (E[6] = "No data allowed", 6), T.NO_MODIFICATION_ALLOWED_ERR = (E[7] = "No modification allowed", 7), T.NOT_FOUND_ERR = (E[8] = "Not found", 8)),
+ C = (T.NOT_SUPPORTED_ERR = (E[9] = "Not supported", 9), T.INUSE_ATTRIBUTE_ERR = (E[10] = "Attribute in use", 10));
+ T.INVALID_STATE_ERR = (E[11] = "Invalid state", 11), T.SYNTAX_ERR = (E[12] = "Syntax error", 12), T.INVALID_MODIFICATION_ERR = (E[13] = "Invalid modification", 13), T.NAMESPACE_ERR = (E[14] = "Invalid namespace", 14), T.INVALID_ACCESS_ERR = (E[15] = "Invalid access", 15);
+
+ function k(e, t) {
+ if (t instanceof Error) var i = t;
+ else i = this, Error.call(this, E[e]), this.message = E[e], Error.captureStackTrace && Error.captureStackTrace(this, k);
+ return i.code = e, t && (this.message = this.message + ": " + t), i
+ }
+
+ function P() {}
+
+ function I(e, t) {
+ this._node = e, this._refresh = t, L(this)
+ }
+
+ function L(e) {
+ var t = e._node._inc || e._node.ownerDocument._inc;
+ if (e._inc != t) {
+ var i = e._refresh(e._node);
+ oe(e, "length", i.length), o(i, e), e._inc = t
+ }
+ }
+
+ function x() {}
+
+ function R(e, t) {
+ for (var i = e.length; i--;)
+ if (e[i] === t) return i
+ }
+
+ function D(e, t, i, r) {
+ if (r ? t[R(t, r)] = i : t[t.length++] = i, e) {
+ i.ownerElement = e;
+ var a = e.ownerDocument;
+ a && (r && j(a, e, r), function(e, t, i) {
+ e && e._inc++, i.namespaceURI === n.XMLNS && (t._nsMap[i.prefix ? i.localName : ""] = i.value)
+ }(a, e, i))
+ }
+ }
+
+ function O(e, t, i) {
+ var n = R(t, i);
+ if (!(n >= 0)) throw k(A, new Error(e.tagName + "@" + i));
+ for (var r = t.length - 1; n < r;) t[n] = t[++n];
+ if (t.length = r, e) {
+ var a = e.ownerDocument;
+ a && (j(a, e, i), i.ownerElement = null)
+ }
+ }
+
+ function U() {}
+
+ function M() {}
+
+ function F(e) {
+ return ("<" == e ? "&lt;" : ">" == e && "&gt;") || "&" == e && "&amp;" || '"' == e && "&quot;" || "&#" + e.charCodeAt() + ";"
+ }
+
+ function B(e, t) {
+ if (t(e)) return !0;
+ if (e = e.firstChild)
+ do {
+ if (B(e, t)) return !0
+ } while (e = e.nextSibling)
+ }
+
+ function N() {}
+
+ function j(e, t, i, r) {
+ e && e._inc++, i.namespaceURI === n.XMLNS && delete t._nsMap[i.prefix ? i.localName : ""]
+ }
+
+ function V(e, t, i) {
+ if (e && e._inc) {
+ e._inc++;
+ var n = t.childNodes;
+ if (i) n[n.length++] = i;
+ else {
+ for (var r = t.firstChild, a = 0; r;) n[a++] = r, r = r.nextSibling;
+ n.length = a
+ }
+ }
+ }
+
+ function H(e, t) {
+ var i = t.previousSibling,
+ n = t.nextSibling;
+ return i ? i.nextSibling = n : e.firstChild = n, n ? n.previousSibling = i : e.lastChild = i, V(e.ownerDocument, e), t
+ }
+
+ function z(e, t, i) {
+ var n = t.parentNode;
+ if (n && n.removeChild(t), t.nodeType === b) {
+ var r = t.firstChild;
+ if (null == r) return t;
+ var a = t.lastChild
+ } else r = a = t;
+ var s = i ? i.previousSibling : e.lastChild;
+ r.previousSibling = s, a.nextSibling = i, s ? s.nextSibling = r : e.firstChild = r, null == i ? e.lastChild = a : i.previousSibling = a;
+ do {
+ r.parentNode = e
+ } while (r !== a && (r = r.nextSibling));
+ return V(e.ownerDocument || e, e), t.nodeType == b && (t.firstChild = t.lastChild = null), t
+ }
+
+ function G() {
+ this._nsMap = {}
+ }
+
+ function W() {}
+
+ function Y() {}
+
+ function q() {}
+
+ function K() {}
+
+ function X() {}
+
+ function Q() {}
+
+ function $() {}
+
+ function J() {}
+
+ function Z() {}
+
+ function ee() {}
+
+ function te() {}
+
+ function ie() {}
+
+ function ne(e, t) {
+ var i = [],
+ n = 9 == this.nodeType && this.documentElement || this,
+ r = n.prefix,
+ a = n.namespaceURI;
+ if (a && null == r && null == (r = n.lookupPrefix(a))) var s = [{
+ namespace: a,
+ prefix: null
+ }];
+ return se(this, i, e, t, s), i.join("")
+ }
+
+ function re(e, t, i) {
+ var r = e.prefix || "",
+ a = e.namespaceURI;
+ if (!a) return !1;
+ if ("xml" === r && a === n.XML || a === n.XMLNS) return !1;
+ for (var s = i.length; s--;) {
+ var o = i[s];
+ if (o.prefix === r) return o.namespace !== a
+ }
+ return !0
+ }
+
+ function ae(e, t, i) {
+ e.push(" ", t, '="', i.replace(/[<&"]/g, F), '"')
+ }
+
+ function se(e, t, i, r, a) {
+ if (a || (a = []), r) {
+ if (!(e = r(e))) return;
+ if ("string" == typeof e) return void t.push(e)
+ }
+ switch (e.nodeType) {
+ case h:
+ var s = e.attributes,
+ o = s.length,
+ u = e.firstChild,
+ l = e.tagName,
+ m = l;
+ if (!(i = n.isHTML(e.namespaceURI) || i) && !e.prefix && e.namespaceURI) {
+ for (var S, T = 0; T < s.length; T++)
+ if ("xmlns" === s.item(T).name) {
+ S = s.item(T).value;
+ break
+ } if (!S)
+ for (var E = a.length - 1; E >= 0; E--) {
+ if ("" === (w = a[E]).prefix && w.namespace === e.namespaceURI) {
+ S = w.namespace;
+ break
+ }
+ }
+ if (S !== e.namespaceURI)
+ for (E = a.length - 1; E >= 0; E--) {
+ var w;
+ if ((w = a[E]).namespace === e.namespaceURI) {
+ w.prefix && (m = w.prefix + ":" + l);
+ break
+ }
+ }
+ }
+ t.push("<", m);
+ for (var A = 0; A < o; A++) {
+ "xmlns" == (C = s.item(A)).prefix ? a.push({
+ prefix: C.localName,
+ namespace: C.value
+ }) : "xmlns" == C.nodeName && a.push({
+ prefix: "",
+ namespace: C.value
+ })
+ }
+ for (A = 0; A < o; A++) {
+ var C, k, P;
+ if (re(C = s.item(A), 0, a)) ae(t, (k = C.prefix || "") ? "xmlns:" + k : "xmlns", P = C.namespaceURI), a.push({
+ prefix: k,
+ namespace: P
+ });
+ se(C, t, i, r, a)
+ }
+ if (l === m && re(e, 0, a)) ae(t, (k = e.prefix || "") ? "xmlns:" + k : "xmlns", P = e.namespaceURI), a.push({
+ prefix: k,
+ namespace: P
+ });
+ if (u || i && !/^(?:meta|link|img|br|hr|input)$/i.test(l)) {
+ if (t.push(">"), i && /^script$/i.test(l))
+ for (; u;) u.data ? t.push(u.data) : se(u, t, i, r, a.slice()), u = u.nextSibling;
+ else
+ for (; u;) se(u, t, i, r, a.slice()), u = u.nextSibling;
+ t.push("</", m, ">")
+ } else t.push("/>");
+ return;
+ case v:
+ case b:
+ for (u = e.firstChild; u;) se(u, t, i, r, a.slice()), u = u.nextSibling;
+ return;
+ case d:
+ return ae(t, e.name, e.value);
+ case c:
+ return t.push(e.data.replace(/[<&]/g, F).replace(/]]>/g, "]]&gt;"));
+ case f:
+ return t.push("<![CDATA[", e.data, "]]>");
+ case g:
+ return t.push("\x3c!--", e.data, "--\x3e");
+ case y:
+ var I = e.publicId,
+ L = e.systemId;
+ if (t.push("<!DOCTYPE ", e.name), I) t.push(" PUBLIC ", I), L && "." != L && t.push(" ", L), t.push(">");
+ else if (L && "." != L) t.push(" SYSTEM ", L, ">");
+ else {
+ var x = e.internalSubset;
+ x && t.push(" [", x, "]"), t.push(">")
+ }
+ return;
+ case _:
+ return t.push("<?", e.target, " ", e.data, "?>");
+ case p:
+ return t.push("&", e.nodeName, ";");
+ default:
+ t.push("??", e.nodeName)
+ }
+ }
+
+ function oe(e, t, i) {
+ e[t] = i
+ }
+ k.prototype = Error.prototype, o(T, k), P.prototype = {
+ length: 0,
+ item: function(e) {
+ return this[e] || null
+ },
+ toString: function(e, t) {
+ for (var i = [], n = 0; n < this.length; n++) se(this[n], i, e, t);
+ return i.join("")
+ }
+ }, I.prototype.item = function(e) {
+ return L(this), this[e]
+ }, u(I, P), x.prototype = {
+ length: 0,
+ item: P.prototype.item,
+ getNamedItem: function(e) {
+ for (var t = this.length; t--;) {
+ var i = this[t];
+ if (i.nodeName == e) return i
+ }
+ },
+ setNamedItem: function(e) {
+ var t = e.ownerElement;
+ if (t && t != this._ownerElement) throw new k(C);
+ var i = this.getNamedItem(e.nodeName);
+ return D(this._ownerElement, this, e, i), i
+ },
+ setNamedItemNS: function(e) {
+ var t, i = e.ownerElement;
+ if (i && i != this._ownerElement) throw new k(C);
+ return t = this.getNamedItemNS(e.namespaceURI, e.localName), D(this._ownerElement, this, e, t), t
+ },
+ removeNamedItem: function(e) {
+ var t = this.getNamedItem(e);
+ return O(this._ownerElement, this, t), t
+ },
+ removeNamedItemNS: function(e, t) {
+ var i = this.getNamedItemNS(e, t);
+ return O(this._ownerElement, this, i), i
+ },
+ getNamedItemNS: function(e, t) {
+ for (var i = this.length; i--;) {
+ var n = this[i];
+ if (n.localName == t && n.namespaceURI == e) return n
+ }
+ return null
+ }
+ }, U.prototype = {
+ hasFeature: function(e, t) {
+ return !0
+ },
+ createDocument: function(e, t, i) {
+ var n = new N;
+ if (n.implementation = this, n.childNodes = new P, n.doctype = i || null, i && n.appendChild(i), t) {
+ var r = n.createElementNS(e, t);
+ n.appendChild(r)
+ }
+ return n
+ },
+ createDocumentType: function(e, t, i) {
+ var n = new Q;
+ return n.name = e, n.nodeName = e, n.publicId = t || "", n.systemId = i || "", n
+ }
+ }, M.prototype = {
+ firstChild: null,
+ lastChild: null,
+ previousSibling: null,
+ nextSibling: null,
+ attributes: null,
+ parentNode: null,
+ childNodes: null,
+ ownerDocument: null,
+ nodeValue: null,
+ namespaceURI: null,
+ prefix: null,
+ localName: null,
+ insertBefore: function(e, t) {
+ return z(this, e, t)
+ },
+ replaceChild: function(e, t) {
+ this.insertBefore(e, t), t && this.removeChild(t)
+ },
+ removeChild: function(e) {
+ return H(this, e)
+ },
+ appendChild: function(e) {
+ return this.insertBefore(e, null)
+ },
+ hasChildNodes: function() {
+ return null != this.firstChild
+ },
+ cloneNode: function(e) {
+ return function e(t, i, n) {
+ var r = new i.constructor;
+ for (var a in i) {
+ var s = i[a];
+ "object" != typeof s && s != r[a] && (r[a] = s)
+ }
+ i.childNodes && (r.childNodes = new P);
+ switch (r.ownerDocument = t, r.nodeType) {
+ case h:
+ var o = i.attributes,
+ u = r.attributes = new x,
+ l = o.length;
+ u._ownerElement = r;
+ for (var c = 0; c < l; c++) r.setAttributeNode(e(t, o.item(c), !0));
+ break;
+ case d:
+ n = !0
+ }
+ if (n)
+ for (var f = i.firstChild; f;) r.appendChild(e(t, f, n)), f = f.nextSibling;
+ return r
+ }(this.ownerDocument || this, this, e)
+ },
+ normalize: function() {
+ for (var e = this.firstChild; e;) {
+ var t = e.nextSibling;
+ t && t.nodeType == c && e.nodeType == c ? (this.removeChild(t), e.appendData(t.data)) : (e.normalize(), e = t)
+ }
+ },
+ isSupported: function(e, t) {
+ return this.ownerDocument.implementation.hasFeature(e, t)
+ },
+ hasAttributes: function() {
+ return this.attributes.length > 0
+ },
+ lookupPrefix: function(e) {
+ for (var t = this; t;) {
+ var i = t._nsMap;
+ if (i)
+ for (var n in i)
+ if (i[n] == e) return n;
+ t = t.nodeType == d ? t.ownerDocument : t.parentNode
+ }
+ return null
+ },
+ lookupNamespaceURI: function(e) {
+ for (var t = this; t;) {
+ var i = t._nsMap;
+ if (i && e in i) return i[e];
+ t = t.nodeType == d ? t.ownerDocument : t.parentNode
+ }
+ return null
+ },
+ isDefaultNamespace: function(e) {
+ return null == this.lookupPrefix(e)
+ }
+ }, o(l, M), o(l, M.prototype), N.prototype = {
+ nodeName: "#document",
+ nodeType: v,
+ doctype: null,
+ documentElement: null,
+ _inc: 1,
+ insertBefore: function(e, t) {
+ if (e.nodeType == b) {
+ for (var i = e.firstChild; i;) {
+ var n = i.nextSibling;
+ this.insertBefore(i, t), i = n
+ }
+ return e
+ }
+ return null == this.documentElement && e.nodeType == h && (this.documentElement = e), z(this, e, t), e.ownerDocument = this, e
+ },
+ removeChild: function(e) {
+ return this.documentElement == e && (this.documentElement = null), H(this, e)
+ },
+ importNode: function(e, t) {
+ return function e(t, i, n) {
+ var r;
+ switch (i.nodeType) {
+ case h:
+ (r = i.cloneNode(!1)).ownerDocument = t;
+ case b:
+ break;
+ case d:
+ n = !0
+ }
+ r || (r = i.cloneNode(!1));
+ if (r.ownerDocument = t, r.parentNode = null, n)
+ for (var a = i.firstChild; a;) r.appendChild(e(t, a, n)), a = a.nextSibling;
+ return r
+ }(this, e, t)
+ },
+ getElementById: function(e) {
+ var t = null;
+ return B(this.documentElement, (function(i) {
+ if (i.nodeType == h && i.getAttribute("id") == e) return t = i, !0
+ })), t
+ },
+ getElementsByClassName: function(e) {
+ var t = s(e);
+ return new I(this, (function(i) {
+ var n = [];
+ return t.length > 0 && B(i.documentElement, (function(r) {
+ if (r !== i && r.nodeType === h) {
+ var a = r.getAttribute("class");
+ if (a) {
+ var o = e === a;
+ if (!o) {
+ var u = s(a);
+ o = t.every((l = u, function(e) {
+ return l && -1 !== l.indexOf(e)
+ }))
+ }
+ o && n.push(r)
+ }
+ }
+ var l
+ })), n
+ }))
+ },
+ createElement: function(e) {
+ var t = new G;
+ return t.ownerDocument = this, t.nodeName = e, t.tagName = e, t.localName = e, t.childNodes = new P, (t.attributes = new x)._ownerElement = t, t
+ },
+ createDocumentFragment: function() {
+ var e = new ee;
+ return e.ownerDocument = this, e.childNodes = new P, e
+ },
+ createTextNode: function(e) {
+ var t = new q;
+ return t.ownerDocument = this, t.appendData(e), t
+ },
+ createComment: function(e) {
+ var t = new K;
+ return t.ownerDocument = this, t.appendData(e), t
+ },
+ createCDATASection: function(e) {
+ var t = new X;
+ return t.ownerDocument = this, t.appendData(e), t
+ },
+ createProcessingInstruction: function(e, t) {
+ var i = new te;
+ return i.ownerDocument = this, i.tagName = i.target = e, i.nodeValue = i.data = t, i
+ },
+ createAttribute: function(e) {
+ var t = new W;
+ return t.ownerDocument = this, t.name = e, t.nodeName = e, t.localName = e, t.specified = !0, t
+ },
+ createEntityReference: function(e) {
+ var t = new Z;
+ return t.ownerDocument = this, t.nodeName = e, t
+ },
+ createElementNS: function(e, t) {
+ var i = new G,
+ n = t.split(":"),
+ r = i.attributes = new x;
+ return i.childNodes = new P, i.ownerDocument = this, i.nodeName = t, i.tagName = t, i.namespaceURI = e, 2 == n.length ? (i.prefix = n[0], i.localName = n[1]) : i.localName = t, r._ownerElement = i, i
+ },
+ createAttributeNS: function(e, t) {
+ var i = new W,
+ n = t.split(":");
+ return i.ownerDocument = this, i.nodeName = t, i.name = t, i.namespaceURI = e, i.specified = !0, 2 == n.length ? (i.prefix = n[0], i.localName = n[1]) : i.localName = t, i
+ }
+ }, u(N, M), G.prototype = {
+ nodeType: h,
+ hasAttribute: function(e) {
+ return null != this.getAttributeNode(e)
+ },
+ getAttribute: function(e) {
+ var t = this.getAttributeNode(e);
+ return t && t.value || ""
+ },
+ getAttributeNode: function(e) {
+ return this.attributes.getNamedItem(e)
+ },
+ setAttribute: function(e, t) {
+ var i = this.ownerDocument.createAttribute(e);
+ i.value = i.nodeValue = "" + t, this.setAttributeNode(i)
+ },
+ removeAttribute: function(e) {
+ var t = this.getAttributeNode(e);
+ t && this.removeAttributeNode(t)
+ },
+ appendChild: function(e) {
+ return e.nodeType === b ? this.insertBefore(e, null) : function(e, t) {
+ var i = t.parentNode;
+ if (i) {
+ var n = e.lastChild;
+ i.removeChild(t);
+ n = e.lastChild
+ }
+ return n = e.lastChild, t.parentNode = e, t.previousSibling = n, t.nextSibling = null, n ? n.nextSibling = t : e.firstChild = t, e.lastChild = t, V(e.ownerDocument, e, t), t
+ }(this, e)
+ },
+ setAttributeNode: function(e) {
+ return this.attributes.setNamedItem(e)
+ },
+ setAttributeNodeNS: function(e) {
+ return this.attributes.setNamedItemNS(e)
+ },
+ removeAttributeNode: function(e) {
+ return this.attributes.removeNamedItem(e.nodeName)
+ },
+ removeAttributeNS: function(e, t) {
+ var i = this.getAttributeNodeNS(e, t);
+ i && this.removeAttributeNode(i)
+ },
+ hasAttributeNS: function(e, t) {
+ return null != this.getAttributeNodeNS(e, t)
+ },
+ getAttributeNS: function(e, t) {
+ var i = this.getAttributeNodeNS(e, t);
+ return i && i.value || ""
+ },
+ setAttributeNS: function(e, t, i) {
+ var n = this.ownerDocument.createAttributeNS(e, t);
+ n.value = n.nodeValue = "" + i, this.setAttributeNode(n)
+ },
+ getAttributeNodeNS: function(e, t) {
+ return this.attributes.getNamedItemNS(e, t)
+ },
+ getElementsByTagName: function(e) {
+ return new I(this, (function(t) {
+ var i = [];
+ return B(t, (function(n) {
+ n === t || n.nodeType != h || "*" !== e && n.tagName != e || i.push(n)
+ })), i
+ }))
+ },
+ getElementsByTagNameNS: function(e, t) {
+ return new I(this, (function(i) {
+ var n = [];
+ return B(i, (function(r) {
+ r === i || r.nodeType !== h || "*" !== e && r.namespaceURI !== e || "*" !== t && r.localName != t || n.push(r)
+ })), n
+ }))
+ }
+ }, N.prototype.getElementsByTagName = G.prototype.getElementsByTagName, N.prototype.getElementsByTagNameNS = G.prototype.getElementsByTagNameNS, u(G, M), W.prototype.nodeType = d, u(W, M), Y.prototype = {
+ data: "",
+ substringData: function(e, t) {
+ return this.data.substring(e, e + t)
+ },
+ appendData: function(e) {
+ e = this.data + e, this.nodeValue = this.data = e, this.length = e.length
+ },
+ insertData: function(e, t) {
+ this.replaceData(e, 0, t)
+ },
+ appendChild: function(e) {
+ throw new Error(E[w])
+ },
+ deleteData: function(e, t) {
+ this.replaceData(e, t, "")
+ },
+ replaceData: function(e, t, i) {
+ i = this.data.substring(0, e) + i + this.data.substring(e + t), this.nodeValue = this.data = i, this.length = i.length
+ }
+ }, u(Y, M), q.prototype = {
+ nodeName: "#text",
+ nodeType: c,
+ splitText: function(e) {
+ var t = this.data,
+ i = t.substring(e);
+ t = t.substring(0, e), this.data = this.nodeValue = t, this.length = t.length;
+ var n = this.ownerDocument.createTextNode(i);
+ return this.parentNode && this.parentNode.insertBefore(n, this.nextSibling), n
+ }
+ }, u(q, Y), K.prototype = {
+ nodeName: "#comment",
+ nodeType: g
+ }, u(K, Y), X.prototype = {
+ nodeName: "#cdata-section",
+ nodeType: f
+ }, u(X, Y), Q.prototype.nodeType = y, u(Q, M), $.prototype.nodeType = S, u($, M), J.prototype.nodeType = m, u(J, M), Z.prototype.nodeType = p, u(Z, M), ee.prototype.nodeName = "#document-fragment", ee.prototype.nodeType = b, u(ee, M), te.prototype.nodeType = _, u(te, M), ie.prototype.serializeToString = function(e, t, i) {
+ return ne.call(e, t, i)
+ }, M.prototype.toString = ne;
+ try {
+ if (Object.defineProperty) {
+ Object.defineProperty(I.prototype, "length", {
+ get: function() {
+ return L(this), this.$$length
+ }
+ }), Object.defineProperty(M.prototype, "textContent", {
+ get: function() {
+ return function e(t) {
+ switch (t.nodeType) {
+ case h:
+ case b:
+ var i = [];
+ for (t = t.firstChild; t;) 7 !== t.nodeType && 8 !== t.nodeType && i.push(e(t)), t = t.nextSibling;
+ return i.join("");
+ default:
+ return t.nodeValue
+ }
+ }(this)
+ },
+ set: function(e) {
+ switch (this.nodeType) {
+ case h:
+ case b:
+ for (; this.firstChild;) this.removeChild(this.firstChild);
+ (e || String(e)) && this.appendChild(this.ownerDocument.createTextNode(e));
+ break;
+ default:
+ this.data = e, this.value = e, this.nodeValue = e
+ }
+ }
+ }), oe = function(e, t, i) {
+ e["$$" + t] = i
+ }
+ }
+ } catch (e) {}
+ i.DocumentType = Q, i.DOMException = k, i.DOMImplementation = U, i.Element = G, i.Node = M, i.NodeList = P, i.XMLSerializer = ie
+ }, {
+ "./conventions": 24
+ }],
+ 27: [function(e, t, i) {
+ var n = e("./conventions").freeze;
+ i.XML_ENTITIES = n({
+ amp: "&",
+ apos: "'",
+ gt: ">",
+ lt: "<",
+ quot: '"'
+ }), i.HTML_ENTITIES = n({
+ lt: "<",
+ gt: ">",
+ amp: "&",
+ quot: '"',
+ apos: "'",
+ Agrave: "À",
+ Aacute: "Á",
+ Acirc: "Â",
+ Atilde: "Ã",
+ Auml: "Ä",
+ Aring: "Å",
+ AElig: "Æ",
+ Ccedil: "Ç",
+ Egrave: "È",
+ Eacute: "É",
+ Ecirc: "Ê",
+ Euml: "Ë",
+ Igrave: "Ì",
+ Iacute: "Í",
+ Icirc: "Î",
+ Iuml: "Ï",
+ ETH: "Ð",
+ Ntilde: "Ñ",
+ Ograve: "Ò",
+ Oacute: "Ó",
+ Ocirc: "Ô",
+ Otilde: "Õ",
+ Ouml: "Ö",
+ Oslash: "Ø",
+ Ugrave: "Ù",
+ Uacute: "Ú",
+ Ucirc: "Û",
+ Uuml: "Ü",
+ Yacute: "Ý",
+ THORN: "Þ",
+ szlig: "ß",
+ agrave: "à",
+ aacute: "á",
+ acirc: "â",
+ atilde: "ã",
+ auml: "ä",
+ aring: "å",
+ aelig: "æ",
+ ccedil: "ç",
+ egrave: "è",
+ eacute: "é",
+ ecirc: "ê",
+ euml: "ë",
+ igrave: "ì",
+ iacute: "í",
+ icirc: "î",
+ iuml: "ï",
+ eth: "ð",
+ ntilde: "ñ",
+ ograve: "ò",
+ oacute: "ó",
+ ocirc: "ô",
+ otilde: "õ",
+ ouml: "ö",
+ oslash: "ø",
+ ugrave: "ù",
+ uacute: "ú",
+ ucirc: "û",
+ uuml: "ü",
+ yacute: "ý",
+ thorn: "þ",
+ yuml: "ÿ",
+ nbsp: " ",
+ iexcl: "¡",
+ cent: "¢",
+ pound: "£",
+ curren: "¤",
+ yen: "¥",
+ brvbar: "¦",
+ sect: "§",
+ uml: "¨",
+ copy: "©",
+ ordf: "ª",
+ laquo: "«",
+ not: "¬",
+ shy: "­­",
+ reg: "®",
+ macr: "¯",
+ deg: "°",
+ plusmn: "±",
+ sup2: "²",
+ sup3: "³",
+ acute: "´",
+ micro: "µ",
+ para: "¶",
+ middot: "·",
+ cedil: "¸",
+ sup1: "¹",
+ ordm: "º",
+ raquo: "»",
+ frac14: "¼",
+ frac12: "½",
+ frac34: "¾",
+ iquest: "¿",
+ times: "×",
+ divide: "÷",
+ forall: "∀",
+ part: "∂",
+ exist: "∃",
+ empty: "∅",
+ nabla: "∇",
+ isin: "∈",
+ notin: "∉",
+ ni: "∋",
+ prod: "∏",
+ sum: "∑",
+ minus: "−",
+ lowast: "∗",
+ radic: "√",
+ prop: "∝",
+ infin: "∞",
+ ang: "∠",
+ and: "∧",
+ or: "∨",
+ cap: "∩",
+ cup: "∪",
+ int: "∫",
+ there4: "∴",
+ sim: "∼",
+ cong: "≅",
+ asymp: "≈",
+ ne: "≠",
+ equiv: "≡",
+ le: "≤",
+ ge: "≥",
+ sub: "⊂",
+ sup: "⊃",
+ nsub: "⊄",
+ sube: "⊆",
+ supe: "⊇",
+ oplus: "⊕",
+ otimes: "⊗",
+ perp: "⊥",
+ sdot: "⋅",
+ Alpha: "Α",
+ Beta: "Β",
+ Gamma: "Γ",
+ Delta: "Δ",
+ Epsilon: "Ε",
+ Zeta: "Ζ",
+ Eta: "Η",
+ Theta: "Θ",
+ Iota: "Ι",
+ Kappa: "Κ",
+ Lambda: "Λ",
+ Mu: "Μ",
+ Nu: "Ν",
+ Xi: "Ξ",
+ Omicron: "Ο",
+ Pi: "Π",
+ Rho: "Ρ",
+ Sigma: "Σ",
+ Tau: "Τ",
+ Upsilon: "Υ",
+ Phi: "Φ",
+ Chi: "Χ",
+ Psi: "Ψ",
+ Omega: "Ω",
+ alpha: "α",
+ beta: "β",
+ gamma: "γ",
+ delta: "δ",
+ epsilon: "ε",
+ zeta: "ζ",
+ eta: "η",
+ theta: "θ",
+ iota: "ι",
+ kappa: "κ",
+ lambda: "λ",
+ mu: "μ",
+ nu: "ν",
+ xi: "ξ",
+ omicron: "ο",
+ pi: "π",
+ rho: "ρ",
+ sigmaf: "ς",
+ sigma: "σ",
+ tau: "τ",
+ upsilon: "υ",
+ phi: "φ",
+ chi: "χ",
+ psi: "ψ",
+ omega: "ω",
+ thetasym: "ϑ",
+ upsih: "ϒ",
+ piv: "ϖ",
+ OElig: "Œ",
+ oelig: "œ",
+ Scaron: "Š",
+ scaron: "š",
+ Yuml: "Ÿ",
+ fnof: "ƒ",
+ circ: "ˆ",
+ tilde: "˜",
+ ensp: " ",
+ emsp: " ",
+ thinsp: " ",
+ zwnj: "‌",
+ zwj: "‍",
+ lrm: "‎",
+ rlm: "‏",
+ ndash: "–",
+ mdash: "—",
+ lsquo: "‘",
+ rsquo: "’",
+ sbquo: "‚",
+ ldquo: "“",
+ rdquo: "”",
+ bdquo: "„",
+ dagger: "†",
+ Dagger: "‡",
+ bull: "•",
+ hellip: "…",
+ permil: "‰",
+ prime: "′",
+ Prime: "″",
+ lsaquo: "‹",
+ rsaquo: "›",
+ oline: "‾",
+ euro: "€",
+ trade: "™",
+ larr: "←",
+ uarr: "↑",
+ rarr: "→",
+ darr: "↓",
+ harr: "↔",
+ crarr: "↵",
+ lceil: "⌈",
+ rceil: "⌉",
+ lfloor: "⌊",
+ rfloor: "⌋",
+ loz: "◊",
+ spades: "♠",
+ clubs: "♣",
+ hearts: "♥",
+ diams: "♦"
+ }), i.entityMap = i.HTML_ENTITIES
+ }, {
+ "./conventions": 24
+ }],
+ 28: [function(e, t, i) {
+ var n = e("./dom");
+ i.DOMImplementation = n.DOMImplementation, i.XMLSerializer = n.XMLSerializer, i.DOMParser = e("./dom-parser").DOMParser
+ }, {
+ "./dom": 26,
+ "./dom-parser": 25
+ }],
+ 29: [function(e, t, i) {
+ var n = e("./conventions").NAMESPACE,
+ r = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
+ a = new RegExp("[\\-\\.0-9" + r.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),
+ s = new RegExp("^" + r.source + a.source + "*(?::" + r.source + a.source + "*)?$");
+
+ function o(e, t) {
+ this.message = e, this.locator = t, Error.captureStackTrace && Error.captureStackTrace(this, o)
+ }
+
+ function u() {}
+
+ function l(e, t) {
+ return t.lineNumber = e.lineNumber, t.columnNumber = e.columnNumber, t
+ }
+
+ function h(e, t, i, r, a, s) {
+ function o(e, t, n) {
+ i.attributeNames.hasOwnProperty(e) && s.fatalError("Attribute " + e + " redefined"), i.addValue(e, t, n)
+ }
+ for (var u, l = ++t, h = 0;;) {
+ var d = e.charAt(l);
+ switch (d) {
+ case "=":
+ if (1 === h) u = e.slice(t, l), h = 3;
+ else {
+ if (2 !== h) throw new Error("attribute equal must after attrName");
+ h = 3
+ }
+ break;
+ case "'":
+ case '"':
+ if (3 === h || 1 === h) {
+ if (1 === h && (s.warning('attribute value must after "="'), u = e.slice(t, l)), t = l + 1, !((l = e.indexOf(d, t)) > 0)) throw new Error("attribute value no end '" + d + "' match");
+ o(u, c = e.slice(t, l).replace(/&#?\w+;/g, a), t - 1), h = 5
+ } else {
+ if (4 != h) throw new Error('attribute value must after "="');
+ o(u, c = e.slice(t, l).replace(/&#?\w+;/g, a), t), s.warning('attribute "' + u + '" missed start quot(' + d + ")!!"), t = l + 1, h = 5
+ }
+ break;
+ case "/":
+ switch (h) {
+ case 0:
+ i.setTagName(e.slice(t, l));
+ case 5:
+ case 6:
+ case 7:
+ h = 7, i.closed = !0;
+ case 4:
+ case 1:
+ case 2:
+ break;
+ default:
+ throw new Error("attribute invalid close char('/')")
+ }
+ break;
+ case "":
+ return s.error("unexpected end of input"), 0 == h && i.setTagName(e.slice(t, l)), l;
+ case ">":
+ switch (h) {
+ case 0:
+ i.setTagName(e.slice(t, l));
+ case 5:
+ case 6:
+ case 7:
+ break;
+ case 4:
+ case 1:
+ "/" === (c = e.slice(t, l)).slice(-1) && (i.closed = !0, c = c.slice(0, -1));
+ case 2:
+ 2 === h && (c = u), 4 == h ? (s.warning('attribute "' + c + '" missed quot(")!'), o(u, c.replace(/&#?\w+;/g, a), t)) : (n.isHTML(r[""]) && c.match(/^(?:disabled|checked|selected)$/i) || s.warning('attribute "' + c + '" missed value!! "' + c + '" instead!!'), o(c, c, t));
+ break;
+ case 3:
+ throw new Error("attribute value missed!!")
+ }
+ return l;
+ case "€":
+ d = " ";
+ default:
+ if (d <= " ") switch (h) {
+ case 0:
+ i.setTagName(e.slice(t, l)), h = 6;
+ break;
+ case 1:
+ u = e.slice(t, l), h = 2;
+ break;
+ case 4:
+ var c = e.slice(t, l).replace(/&#?\w+;/g, a);
+ s.warning('attribute "' + c + '" missed quot(")!!'), o(u, c, t);
+ case 5:
+ h = 6
+ } else switch (h) {
+ case 2:
+ i.tagName;
+ n.isHTML(r[""]) && u.match(/^(?:disabled|checked|selected)$/i) || s.warning('attribute "' + u + '" missed value!! "' + u + '" instead2!!'), o(u, u, t), t = l, h = 1;
+ break;
+ case 5:
+ s.warning('attribute space is required"' + u + '"!!');
+ case 6:
+ h = 1, t = l;
+ break;
+ case 3:
+ h = 4, t = l;
+ break;
+ case 7:
+ throw new Error("elements closed character '/' and '>' must be connected to")
+ }
+ }
+ l++
+ }
+ }
+
+ function d(e, t, i) {
+ for (var r = e.tagName, a = null, s = e.length; s--;) {
+ var o = e[s],
+ u = o.qName,
+ l = o.value;
+ if ((f = u.indexOf(":")) > 0) var h = o.prefix = u.slice(0, f),
+ d = u.slice(f + 1),
+ c = "xmlns" === h && d;
+ else d = u, h = null, c = "xmlns" === u && "";
+ o.localName = d, !1 !== c && (null == a && (a = {}, p(i, i = {})), i[c] = a[c] = l, o.uri = n.XMLNS, t.startPrefixMapping(c, l))
+ }
+ for (s = e.length; s--;) {
+ (h = (o = e[s]).prefix) && ("xml" === h && (o.uri = n.XML), "xmlns" !== h && (o.uri = i[h || ""]))
+ }
+ var f;
+ (f = r.indexOf(":")) > 0 ? (h = e.prefix = r.slice(0, f), d = e.localName = r.slice(f + 1)) : (h = null, d = e.localName = r);
+ var m = e.uri = i[h || ""];
+ if (t.startElement(m, d, r, e), !e.closed) return e.currentNSMap = i, e.localNSMap = a, !0;
+ if (t.endElement(m, d, r), a)
+ for (h in a) t.endPrefixMapping(h)
+ }
+
+ function c(e, t, i, n, r) {
+ if (/^(?:script|textarea)$/i.test(i)) {
+ var a = e.indexOf("</" + i + ">", t),
+ s = e.substring(t + 1, a);
+ if (/[&<]/.test(s)) return /^script$/i.test(i) ? (r.characters(s, 0, s.length), a) : (s = s.replace(/&#?\w+;/g, n), r.characters(s, 0, s.length), a)
+ }
+ return t + 1
+ }
+
+ function f(e, t, i, n) {
+ var r = n[i];
+ return null == r && ((r = e.lastIndexOf("</" + i + ">")) < t && (r = e.lastIndexOf("</" + i)), n[i] = r), r < t
+ }
+
+ function p(e, t) {
+ for (var i in e) t[i] = e[i]
+ }
+
+ function m(e, t, i, n) {
+ switch (e.charAt(t + 2)) {
+ case "-":
+ return "-" === e.charAt(t + 3) ? (r = e.indexOf("--\x3e", t + 4)) > t ? (i.comment(e, t + 4, r - t - 4), r + 3) : (n.error("Unclosed comment"), -1) : -1;
+ default:
+ if ("CDATA[" == e.substr(t + 3, 6)) {
+ var r = e.indexOf("]]>", t + 9);
+ return i.startCDATA(), i.characters(e, t + 9, r - t - 9), i.endCDATA(), r + 3
+ }
+ var a = function(e, t) {
+ var i, n = [],
+ r = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
+ r.lastIndex = t, r.exec(e);
+ for (; i = r.exec(e);)
+ if (n.push(i), i[1]) return n
+ }(e, t),
+ s = a.length;
+ if (s > 1 && /!doctype/i.test(a[0][0])) {
+ var o = a[1][0],
+ u = !1,
+ l = !1;
+ s > 3 && (/^public$/i.test(a[2][0]) ? (u = a[3][0], l = s > 4 && a[4][0]) : /^system$/i.test(a[2][0]) && (l = a[3][0]));
+ var h = a[s - 1];
+ return i.startDTD(o, u, l), i.endDTD(), h.index + h[0].length
+ }
+ }
+ return -1
+ }
+
+ function _(e, t, i) {
+ var n = e.indexOf("?>", t);
+ if (n) {
+ var r = e.substring(t, n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
+ if (r) {
+ r[0].length;
+ return i.processingInstruction(r[1], r[2]), n + 2
+ }
+ return -1
+ }
+ return -1
+ }
+
+ function g() {
+ this.attributeNames = {}
+ }
+ o.prototype = new Error, o.prototype.name = o.name, u.prototype = {
+ parse: function(e, t, i) {
+ var r = this.domBuilder;
+ r.startDocument(), p(t, t = {}),
+ function(e, t, i, r, a) {
+ function s(e) {
+ var t = e.slice(1, -1);
+ return t in i ? i[t] : "#" === t.charAt(0) ? function(e) {
+ if (e > 65535) {
+ var t = 55296 + ((e -= 65536) >> 10),
+ i = 56320 + (1023 & e);
+ return String.fromCharCode(t, i)
+ }
+ return String.fromCharCode(e)
+ }(parseInt(t.substr(1).replace("x", "0x"))) : (a.error("entity not found:" + e), e)
+ }
+
+ function u(t) {
+ if (t > w) {
+ var i = e.substring(w, t).replace(/&#?\w+;/g, s);
+ S && p(w), r.characters(i, 0, t - w), w = t
+ }
+ }
+
+ function p(t, i) {
+ for (; t >= y && (i = b.exec(e));) v = i.index, y = v + i[0].length, S.lineNumber++;
+ S.columnNumber = t - v + 1
+ }
+ var v = 0,
+ y = 0,
+ b = /.*(?:\r\n?|\n)|.*$/g,
+ S = r.locator,
+ T = [{
+ currentNSMap: t
+ }],
+ E = {},
+ w = 0;
+ for (;;) {
+ try {
+ var A = e.indexOf("<", w);
+ if (A < 0) {
+ if (!e.substr(w).match(/^\s*$/)) {
+ var C = r.doc,
+ k = C.createTextNode(e.substr(w));
+ C.appendChild(k), r.currentElement = k
+ }
+ return
+ }
+ switch (A > w && u(A), e.charAt(A + 1)) {
+ case "/":
+ var P = e.indexOf(">", A + 3),
+ I = e.substring(A + 2, P).replace(/[ \t\n\r]+$/g, ""),
+ L = T.pop();
+ P < 0 ? (I = e.substring(A + 2).replace(/[\s<].*/, ""), a.error("end tag name: " + I + " is not complete:" + L.tagName), P = A + 1 + I.length) : I.match(/\s</) && (I = I.replace(/[\s<].*/, ""), a.error("end tag name: " + I + " maybe not complete"), P = A + 1 + I.length);
+ var x = L.localNSMap,
+ R = L.tagName == I;
+ if (R || L.tagName && L.tagName.toLowerCase() == I.toLowerCase()) {
+ if (r.endElement(L.uri, L.localName, I), x)
+ for (var D in x) r.endPrefixMapping(D);
+ R || a.fatalError("end tag name: " + I + " is not match the current start tagName:" + L.tagName)
+ } else T.push(L);
+ P++;
+ break;
+ case "?":
+ S && p(A), P = _(e, A, r);
+ break;
+ case "!":
+ S && p(A), P = m(e, A, r, a);
+ break;
+ default:
+ S && p(A);
+ var O = new g,
+ U = T[T.length - 1].currentNSMap,
+ M = (P = h(e, A, O, U, s, a), O.length);
+ if (!O.closed && f(e, P, O.tagName, E) && (O.closed = !0, i.nbsp || a.warning("unclosed xml attribute")), S && M) {
+ for (var F = l(S, {}), B = 0; B < M; B++) {
+ var N = O[B];
+ p(N.offset), N.locator = l(S, {})
+ }
+ r.locator = F, d(O, r, U) && T.push(O), r.locator = S
+ } else d(O, r, U) && T.push(O);
+ n.isHTML(O.uri) && !O.closed ? P = c(e, P, O.tagName, s, r) : P++
+ }
+ } catch (e) {
+ if (e instanceof o) throw e;
+ a.error("element parse error: " + e), P = -1
+ }
+ P > w ? w = P : u(Math.max(A, w) + 1)
+ }
+ }(e, t, i, r, this.errorHandler), r.endDocument()
+ }
+ }, g.prototype = {
+ setTagName: function(e) {
+ if (!s.test(e)) throw new Error("invalid tagName:" + e);
+ this.tagName = e
+ },
+ addValue: function(e, t, i) {
+ if (!s.test(e)) throw new Error("invalid attribute:" + e);
+ this.attributeNames[e] = this.length, this[this.length++] = {
+ qName: e,
+ value: t,
+ offset: i
+ }
+ },
+ length: 0,
+ getLocalName: function(e) {
+ return this[e].localName
+ },
+ getLocator: function(e) {
+ return this[e].locator
+ },
+ getQName: function(e) {
+ return this[e].qName
+ },
+ getURI: function(e) {
+ return this[e].uri
+ },
+ getValue: function(e) {
+ return this[e].value
+ }
+ }, i.XMLReader = u, i.ParseError = o
+ }, {
+ "./conventions": 24
+ }],
+ 30: [function(e, t, i) {
+ "use strict";
+ i.byteLength = function(e) {
+ var t = l(e),
+ i = t[0],
+ n = t[1];
+ return 3 * (i + n) / 4 - n
+ }, i.toByteArray = function(e) {
+ var t, i, n = l(e),
+ s = n[0],
+ o = n[1],
+ u = new a(function(e, t, i) {
+ return 3 * (t + i) / 4 - i
+ }(0, s, o)),
+ h = 0,
+ d = o > 0 ? s - 4 : s;
+ for (i = 0; i < d; i += 4) t = r[e.charCodeAt(i)] << 18 | r[e.charCodeAt(i + 1)] << 12 | r[e.charCodeAt(i + 2)] << 6 | r[e.charCodeAt(i + 3)], u[h++] = t >> 16 & 255, u[h++] = t >> 8 & 255, u[h++] = 255 & t;
+ 2 === o && (t = r[e.charCodeAt(i)] << 2 | r[e.charCodeAt(i + 1)] >> 4, u[h++] = 255 & t);
+ 1 === o && (t = r[e.charCodeAt(i)] << 10 | r[e.charCodeAt(i + 1)] << 4 | r[e.charCodeAt(i + 2)] >> 2, u[h++] = t >> 8 & 255, u[h++] = 255 & t);
+ return u
+ }, i.fromByteArray = function(e) {
+ for (var t, i = e.length, r = i % 3, a = [], s = 0, o = i - r; s < o; s += 16383) a.push(h(e, s, s + 16383 > o ? o : s + 16383));
+ 1 === r ? (t = e[i - 1], a.push(n[t >> 2] + n[t << 4 & 63] + "==")) : 2 === r && (t = (e[i - 2] << 8) + e[i - 1], a.push(n[t >> 10] + n[t >> 4 & 63] + n[t << 2 & 63] + "="));
+ return a.join("")
+ };
+ for (var n = [], r = [], a = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, u = s.length; o < u; ++o) n[o] = s[o], r[s.charCodeAt(o)] = o;
+
+ function l(e) {
+ var t = e.length;
+ if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
+ var i = e.indexOf("=");
+ return -1 === i && (i = t), [i, i === t ? 0 : 4 - i % 4]
+ }
+
+ function h(e, t, i) {
+ for (var r, a, s = [], o = t; o < i; o += 3) r = (e[o] << 16 & 16711680) + (e[o + 1] << 8 & 65280) + (255 & e[o + 2]), s.push(n[(a = r) >> 18 & 63] + n[a >> 12 & 63] + n[a >> 6 & 63] + n[63 & a]);
+ return s.join("")
+ }
+ r["-".charCodeAt(0)] = 62, r["_".charCodeAt(0)] = 63
+ }, {}],
+ 31: [function(e, t, i) {}, {}],
+ 32: [function(e, t, i) {
+ (function(t) {
+ /*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh <https://feross.org>
+ * @license MIT
+ */
+ "use strict";
+ var n = e("base64-js"),
+ r = e("ieee754");
+ i.Buffer = t, i.SlowBuffer = function(e) {
+ +e != e && (e = 0);
+ return t.alloc(+e)
+ }, i.INSPECT_MAX_BYTES = 50;
+
+ function a(e) {
+ if (e > 2147483647) throw new RangeError('The value "' + e + '" is invalid for option "size"');
+ var i = new Uint8Array(e);
+ return i.__proto__ = t.prototype, i
+ }
+
+ function t(e, t, i) {
+ if ("number" == typeof e) {
+ if ("string" == typeof t) throw new TypeError('The "string" argument must be of type string. Received type number');
+ return u(e)
+ }
+ return s(e, t, i)
+ }
+
+ function s(e, i, n) {
+ if ("string" == typeof e) return function(e, i) {
+ "string" == typeof i && "" !== i || (i = "utf8");
+ if (!t.isEncoding(i)) throw new TypeError("Unknown encoding: " + i);
+ var n = 0 | d(e, i),
+ r = a(n),
+ s = r.write(e, i);
+ s !== n && (r = r.slice(0, s));
+ return r
+ }(e, i);
+ if (ArrayBuffer.isView(e)) return l(e);
+ if (null == e) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
+ if (B(e, ArrayBuffer) || e && B(e.buffer, ArrayBuffer)) return function(e, i, n) {
+ if (i < 0 || e.byteLength < i) throw new RangeError('"offset" is outside of buffer bounds');
+ if (e.byteLength < i + (n || 0)) throw new RangeError('"length" is outside of buffer bounds');
+ var r;
+ r = void 0 === i && void 0 === n ? new Uint8Array(e) : void 0 === n ? new Uint8Array(e, i) : new Uint8Array(e, i, n);
+ return r.__proto__ = t.prototype, r
+ }(e, i, n);
+ if ("number" == typeof e) throw new TypeError('The "value" argument must not be of type number. Received type number');
+ var r = e.valueOf && e.valueOf();
+ if (null != r && r !== e) return t.from(r, i, n);
+ var s = function(e) {
+ if (t.isBuffer(e)) {
+ var i = 0 | h(e.length),
+ n = a(i);
+ return 0 === n.length || e.copy(n, 0, 0, i), n
+ }
+ if (void 0 !== e.length) return "number" != typeof e.length || N(e.length) ? a(0) : l(e);
+ if ("Buffer" === e.type && Array.isArray(e.data)) return l(e.data)
+ }(e);
+ if (s) return s;
+ if ("undefined" != typeof Symbol && null != Symbol.toPrimitive && "function" == typeof e[Symbol.toPrimitive]) return t.from(e[Symbol.toPrimitive]("string"), i, n);
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e)
+ }
+
+ function o(e) {
+ if ("number" != typeof e) throw new TypeError('"size" argument must be of type number');
+ if (e < 0) throw new RangeError('The value "' + e + '" is invalid for option "size"')
+ }
+
+ function u(e) {
+ return o(e), a(e < 0 ? 0 : 0 | h(e))
+ }
+
+ function l(e) {
+ for (var t = e.length < 0 ? 0 : 0 | h(e.length), i = a(t), n = 0; n < t; n += 1) i[n] = 255 & e[n];
+ return i
+ }
+
+ function h(e) {
+ if (e >= 2147483647) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + 2147483647..toString(16) + " bytes");
+ return 0 | e
+ }
+
+ function d(e, i) {
+ if (t.isBuffer(e)) return e.length;
+ if (ArrayBuffer.isView(e) || B(e, ArrayBuffer)) return e.byteLength;
+ if ("string" != typeof e) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e);
+ var n = e.length,
+ r = arguments.length > 2 && !0 === arguments[2];
+ if (!r && 0 === n) return 0;
+ for (var a = !1;;) switch (i) {
+ case "ascii":
+ case "latin1":
+ case "binary":
+ return n;
+ case "utf8":
+ case "utf-8":
+ return U(e).length;
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return 2 * n;
+ case "hex":
+ return n >>> 1;
+ case "base64":
+ return M(e).length;
+ default:
+ if (a) return r ? -1 : U(e).length;
+ i = ("" + i).toLowerCase(), a = !0
+ }
+ }
+
+ function c(e, t, i) {
+ var n = !1;
+ if ((void 0 === t || t < 0) && (t = 0), t > this.length) return "";
+ if ((void 0 === i || i > this.length) && (i = this.length), i <= 0) return "";
+ if ((i >>>= 0) <= (t >>>= 0)) return "";
+ for (e || (e = "utf8");;) switch (e) {
+ case "hex":
+ return C(this, t, i);
+ case "utf8":
+ case "utf-8":
+ return E(this, t, i);
+ case "ascii":
+ return w(this, t, i);
+ case "latin1":
+ case "binary":
+ return A(this, t, i);
+ case "base64":
+ return T(this, t, i);
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return k(this, t, i);
+ default:
+ if (n) throw new TypeError("Unknown encoding: " + e);
+ e = (e + "").toLowerCase(), n = !0
+ }
+ }
+
+ function f(e, t, i) {
+ var n = e[t];
+ e[t] = e[i], e[i] = n
+ }
+
+ function p(e, i, n, r, a) {
+ if (0 === e.length) return -1;
+ if ("string" == typeof n ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), N(n = +n) && (n = a ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
+ if (a) return -1;
+ n = e.length - 1
+ } else if (n < 0) {
+ if (!a) return -1;
+ n = 0
+ }
+ if ("string" == typeof i && (i = t.from(i, r)), t.isBuffer(i)) return 0 === i.length ? -1 : m(e, i, n, r, a);
+ if ("number" == typeof i) return i &= 255, "function" == typeof Uint8Array.prototype.indexOf ? a ? Uint8Array.prototype.indexOf.call(e, i, n) : Uint8Array.prototype.lastIndexOf.call(e, i, n) : m(e, [i], n, r, a);
+ throw new TypeError("val must be string, number or Buffer")
+ }
+
+ function m(e, t, i, n, r) {
+ var a, s = 1,
+ o = e.length,
+ u = t.length;
+ if (void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n)) {
+ if (e.length < 2 || t.length < 2) return -1;
+ s = 2, o /= 2, u /= 2, i /= 2
+ }
+
+ function l(e, t) {
+ return 1 === s ? e[t] : e.readUInt16BE(t * s)
+ }
+ if (r) {
+ var h = -1;
+ for (a = i; a < o; a++)
+ if (l(e, a) === l(t, -1 === h ? 0 : a - h)) {
+ if (-1 === h && (h = a), a - h + 1 === u) return h * s
+ } else - 1 !== h && (a -= a - h), h = -1
+ } else
+ for (i + u > o && (i = o - u), a = i; a >= 0; a--) {
+ for (var d = !0, c = 0; c < u; c++)
+ if (l(e, a + c) !== l(t, c)) {
+ d = !1;
+ break
+ } if (d) return a
+ }
+ return -1
+ }
+
+ function _(e, t, i, n) {
+ i = Number(i) || 0;
+ var r = e.length - i;
+ n ? (n = Number(n)) > r && (n = r) : n = r;
+ var a = t.length;
+ n > a / 2 && (n = a / 2);
+ for (var s = 0; s < n; ++s) {
+ var o = parseInt(t.substr(2 * s, 2), 16);
+ if (N(o)) return s;
+ e[i + s] = o
+ }
+ return s
+ }
+
+ function g(e, t, i, n) {
+ return F(U(t, e.length - i), e, i, n)
+ }
+
+ function v(e, t, i, n) {
+ return F(function(e) {
+ for (var t = [], i = 0; i < e.length; ++i) t.push(255 & e.charCodeAt(i));
+ return t
+ }(t), e, i, n)
+ }
+
+ function y(e, t, i, n) {
+ return v(e, t, i, n)
+ }
+
+ function b(e, t, i, n) {
+ return F(M(t), e, i, n)
+ }
+
+ function S(e, t, i, n) {
+ return F(function(e, t) {
+ for (var i, n, r, a = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) i = e.charCodeAt(s), n = i >> 8, r = i % 256, a.push(r), a.push(n);
+ return a
+ }(t, e.length - i), e, i, n)
+ }
+
+ function T(e, t, i) {
+ return 0 === t && i === e.length ? n.fromByteArray(e) : n.fromByteArray(e.slice(t, i))
+ }
+
+ function E(e, t, i) {
+ i = Math.min(e.length, i);
+ for (var n = [], r = t; r < i;) {
+ var a, s, o, u, l = e[r],
+ h = null,
+ d = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
+ if (r + d <= i) switch (d) {
+ case 1:
+ l < 128 && (h = l);
+ break;
+ case 2:
+ 128 == (192 & (a = e[r + 1])) && (u = (31 & l) << 6 | 63 & a) > 127 && (h = u);
+ break;
+ case 3:
+ a = e[r + 1], s = e[r + 2], 128 == (192 & a) && 128 == (192 & s) && (u = (15 & l) << 12 | (63 & a) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (h = u);
+ break;
+ case 4:
+ a = e[r + 1], s = e[r + 2], o = e[r + 3], 128 == (192 & a) && 128 == (192 & s) && 128 == (192 & o) && (u = (15 & l) << 18 | (63 & a) << 12 | (63 & s) << 6 | 63 & o) > 65535 && u < 1114112 && (h = u)
+ }
+ null === h ? (h = 65533, d = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | 1023 & h), n.push(h), r += d
+ }
+ return function(e) {
+ var t = e.length;
+ if (t <= 4096) return String.fromCharCode.apply(String, e);
+ var i = "",
+ n = 0;
+ for (; n < t;) i += String.fromCharCode.apply(String, e.slice(n, n += 4096));
+ return i
+ }(n)
+ }
+ i.kMaxLength = 2147483647, t.TYPED_ARRAY_SUPPORT = function() {
+ try {
+ var e = new Uint8Array(1);
+ return e.__proto__ = {
+ __proto__: Uint8Array.prototype,
+ foo: function() {
+ return 42
+ }
+ }, 42 === e.foo()
+ } catch (e) {
+ return !1
+ }
+ }(), t.TYPED_ARRAY_SUPPORT || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), Object.defineProperty(t.prototype, "parent", {
+ enumerable: !0,
+ get: function() {
+ if (t.isBuffer(this)) return this.buffer
+ }
+ }), Object.defineProperty(t.prototype, "offset", {
+ enumerable: !0,
+ get: function() {
+ if (t.isBuffer(this)) return this.byteOffset
+ }
+ }), "undefined" != typeof Symbol && null != Symbol.species && t[Symbol.species] === t && Object.defineProperty(t, Symbol.species, {
+ value: null,
+ configurable: !0,
+ enumerable: !1,
+ writable: !1
+ }), t.poolSize = 8192, t.from = function(e, t, i) {
+ return s(e, t, i)
+ }, t.prototype.__proto__ = Uint8Array.prototype, t.__proto__ = Uint8Array, t.alloc = function(e, t, i) {
+ return function(e, t, i) {
+ return o(e), e <= 0 ? a(e) : void 0 !== t ? "string" == typeof i ? a(e).fill(t, i) : a(e).fill(t) : a(e)
+ }(e, t, i)
+ }, t.allocUnsafe = function(e) {
+ return u(e)
+ }, t.allocUnsafeSlow = function(e) {
+ return u(e)
+ }, t.isBuffer = function(e) {
+ return null != e && !0 === e._isBuffer && e !== t.prototype
+ }, t.compare = function(e, i) {
+ if (B(e, Uint8Array) && (e = t.from(e, e.offset, e.byteLength)), B(i, Uint8Array) && (i = t.from(i, i.offset, i.byteLength)), !t.isBuffer(e) || !t.isBuffer(i)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');
+ if (e === i) return 0;
+ for (var n = e.length, r = i.length, a = 0, s = Math.min(n, r); a < s; ++a)
+ if (e[a] !== i[a]) {
+ n = e[a], r = i[a];
+ break
+ } return n < r ? -1 : r < n ? 1 : 0
+ }, t.isEncoding = function(e) {
+ switch (String(e).toLowerCase()) {
+ case "hex":
+ case "utf8":
+ case "utf-8":
+ case "ascii":
+ case "latin1":
+ case "binary":
+ case "base64":
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return !0;
+ default:
+ return !1
+ }
+ }, t.concat = function(e, i) {
+ if (!Array.isArray(e)) throw new TypeError('"list" argument must be an Array of Buffers');
+ if (0 === e.length) return t.alloc(0);
+ var n;
+ if (void 0 === i)
+ for (i = 0, n = 0; n < e.length; ++n) i += e[n].length;
+ var r = t.allocUnsafe(i),
+ a = 0;
+ for (n = 0; n < e.length; ++n) {
+ var s = e[n];
+ if (B(s, Uint8Array) && (s = t.from(s)), !t.isBuffer(s)) throw new TypeError('"list" argument must be an Array of Buffers');
+ s.copy(r, a), a += s.length
+ }
+ return r
+ }, t.byteLength = d, t.prototype._isBuffer = !0, t.prototype.swap16 = function() {
+ var e = this.length;
+ if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
+ for (var t = 0; t < e; t += 2) f(this, t, t + 1);
+ return this
+ }, t.prototype.swap32 = function() {
+ var e = this.length;
+ if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
+ for (var t = 0; t < e; t += 4) f(this, t, t + 3), f(this, t + 1, t + 2);
+ return this
+ }, t.prototype.swap64 = function() {
+ var e = this.length;
+ if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
+ for (var t = 0; t < e; t += 8) f(this, t, t + 7), f(this, t + 1, t + 6), f(this, t + 2, t + 5), f(this, t + 3, t + 4);
+ return this
+ }, t.prototype.toString = function() {
+ var e = this.length;
+ return 0 === e ? "" : 0 === arguments.length ? E(this, 0, e) : c.apply(this, arguments)
+ }, t.prototype.toLocaleString = t.prototype.toString, t.prototype.equals = function(e) {
+ if (!t.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
+ return this === e || 0 === t.compare(this, e)
+ }, t.prototype.inspect = function() {
+ var e = "",
+ t = i.INSPECT_MAX_BYTES;
+ return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), "<Buffer " + e + ">"
+ }, t.prototype.compare = function(e, i, n, r, a) {
+ if (B(e, Uint8Array) && (e = t.from(e, e.offset, e.byteLength)), !t.isBuffer(e)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e);
+ if (void 0 === i && (i = 0), void 0 === n && (n = e ? e.length : 0), void 0 === r && (r = 0), void 0 === a && (a = this.length), i < 0 || n > e.length || r < 0 || a > this.length) throw new RangeError("out of range index");
+ if (r >= a && i >= n) return 0;
+ if (r >= a) return -1;
+ if (i >= n) return 1;
+ if (this === e) return 0;
+ for (var s = (a >>>= 0) - (r >>>= 0), o = (n >>>= 0) - (i >>>= 0), u = Math.min(s, o), l = this.slice(r, a), h = e.slice(i, n), d = 0; d < u; ++d)
+ if (l[d] !== h[d]) {
+ s = l[d], o = h[d];
+ break
+ } return s < o ? -1 : o < s ? 1 : 0
+ }, t.prototype.includes = function(e, t, i) {
+ return -1 !== this.indexOf(e, t, i)
+ }, t.prototype.indexOf = function(e, t, i) {
+ return p(this, e, t, i, !0)
+ }, t.prototype.lastIndexOf = function(e, t, i) {
+ return p(this, e, t, i, !1)
+ }, t.prototype.write = function(e, t, i, n) {
+ if (void 0 === t) n = "utf8", i = this.length, t = 0;
+ else if (void 0 === i && "string" == typeof t) n = t, i = this.length, t = 0;
+ else {
+ if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
+ t >>>= 0, isFinite(i) ? (i >>>= 0, void 0 === n && (n = "utf8")) : (n = i, i = void 0)
+ }
+ var r = this.length - t;
+ if ((void 0 === i || i > r) && (i = r), e.length > 0 && (i < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
+ n || (n = "utf8");
+ for (var a = !1;;) switch (n) {
+ case "hex":
+ return _(this, e, t, i);
+ case "utf8":
+ case "utf-8":
+ return g(this, e, t, i);
+ case "ascii":
+ return v(this, e, t, i);
+ case "latin1":
+ case "binary":
+ return y(this, e, t, i);
+ case "base64":
+ return b(this, e, t, i);
+ case "ucs2":
+ case "ucs-2":
+ case "utf16le":
+ case "utf-16le":
+ return S(this, e, t, i);
+ default:
+ if (a) throw new TypeError("Unknown encoding: " + n);
+ n = ("" + n).toLowerCase(), a = !0
+ }
+ }, t.prototype.toJSON = function() {
+ return {
+ type: "Buffer",
+ data: Array.prototype.slice.call(this._arr || this, 0)
+ }
+ };
+
+ function w(e, t, i) {
+ var n = "";
+ i = Math.min(e.length, i);
+ for (var r = t; r < i; ++r) n += String.fromCharCode(127 & e[r]);
+ return n
+ }
+
+ function A(e, t, i) {
+ var n = "";
+ i = Math.min(e.length, i);
+ for (var r = t; r < i; ++r) n += String.fromCharCode(e[r]);
+ return n
+ }
+
+ function C(e, t, i) {
+ var n = e.length;
+ (!t || t < 0) && (t = 0), (!i || i < 0 || i > n) && (i = n);
+ for (var r = "", a = t; a < i; ++a) r += O(e[a]);
+ return r
+ }
+
+ function k(e, t, i) {
+ for (var n = e.slice(t, i), r = "", a = 0; a < n.length; a += 2) r += String.fromCharCode(n[a] + 256 * n[a + 1]);
+ return r
+ }
+
+ function P(e, t, i) {
+ if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint");
+ if (e + t > i) throw new RangeError("Trying to access beyond buffer length")
+ }
+
+ function I(e, i, n, r, a, s) {
+ if (!t.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
+ if (i > a || i < s) throw new RangeError('"value" argument is out of bounds');
+ if (n + r > e.length) throw new RangeError("Index out of range")
+ }
+
+ function L(e, t, i, n, r, a) {
+ if (i + n > e.length) throw new RangeError("Index out of range");
+ if (i < 0) throw new RangeError("Index out of range")
+ }
+
+ function x(e, t, i, n, a) {
+ return t = +t, i >>>= 0, a || L(e, 0, i, 4), r.write(e, t, i, n, 23, 4), i + 4
+ }
+
+ function R(e, t, i, n, a) {
+ return t = +t, i >>>= 0, a || L(e, 0, i, 8), r.write(e, t, i, n, 52, 8), i + 8
+ }
+ t.prototype.slice = function(e, i) {
+ var n = this.length;
+ (e = ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n), (i = void 0 === i ? n : ~~i) < 0 ? (i += n) < 0 && (i = 0) : i > n && (i = n), i < e && (i = e);
+ var r = this.subarray(e, i);
+ return r.__proto__ = t.prototype, r
+ }, t.prototype.readUIntLE = function(e, t, i) {
+ e >>>= 0, t >>>= 0, i || P(e, t, this.length);
+ for (var n = this[e], r = 1, a = 0; ++a < t && (r *= 256);) n += this[e + a] * r;
+ return n
+ }, t.prototype.readUIntBE = function(e, t, i) {
+ e >>>= 0, t >>>= 0, i || P(e, t, this.length);
+ for (var n = this[e + --t], r = 1; t > 0 && (r *= 256);) n += this[e + --t] * r;
+ return n
+ }, t.prototype.readUInt8 = function(e, t) {
+ return e >>>= 0, t || P(e, 1, this.length), this[e]
+ }, t.prototype.readUInt16LE = function(e, t) {
+ return e >>>= 0, t || P(e, 2, this.length), this[e] | this[e + 1] << 8
+ }, t.prototype.readUInt16BE = function(e, t) {
+ return e >>>= 0, t || P(e, 2, this.length), this[e] << 8 | this[e + 1]
+ }, t.prototype.readUInt32LE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3]
+ }, t.prototype.readUInt32BE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3])
+ }, t.prototype.readIntLE = function(e, t, i) {
+ e >>>= 0, t >>>= 0, i || P(e, t, this.length);
+ for (var n = this[e], r = 1, a = 0; ++a < t && (r *= 256);) n += this[e + a] * r;
+ return n >= (r *= 128) && (n -= Math.pow(2, 8 * t)), n
+ }, t.prototype.readIntBE = function(e, t, i) {
+ e >>>= 0, t >>>= 0, i || P(e, t, this.length);
+ for (var n = t, r = 1, a = this[e + --n]; n > 0 && (r *= 256);) a += this[e + --n] * r;
+ return a >= (r *= 128) && (a -= Math.pow(2, 8 * t)), a
+ }, t.prototype.readInt8 = function(e, t) {
+ return e >>>= 0, t || P(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
+ }, t.prototype.readInt16LE = function(e, t) {
+ e >>>= 0, t || P(e, 2, this.length);
+ var i = this[e] | this[e + 1] << 8;
+ return 32768 & i ? 4294901760 | i : i
+ }, t.prototype.readInt16BE = function(e, t) {
+ e >>>= 0, t || P(e, 2, this.length);
+ var i = this[e + 1] | this[e] << 8;
+ return 32768 & i ? 4294901760 | i : i
+ }, t.prototype.readInt32LE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
+ }, t.prototype.readInt32BE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
+ }, t.prototype.readFloatLE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), r.read(this, e, !0, 23, 4)
+ }, t.prototype.readFloatBE = function(e, t) {
+ return e >>>= 0, t || P(e, 4, this.length), r.read(this, e, !1, 23, 4)
+ }, t.prototype.readDoubleLE = function(e, t) {
+ return e >>>= 0, t || P(e, 8, this.length), r.read(this, e, !0, 52, 8)
+ }, t.prototype.readDoubleBE = function(e, t) {
+ return e >>>= 0, t || P(e, 8, this.length), r.read(this, e, !1, 52, 8)
+ }, t.prototype.writeUIntLE = function(e, t, i, n) {
+ (e = +e, t >>>= 0, i >>>= 0, n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
+ var r = 1,
+ a = 0;
+ for (this[t] = 255 & e; ++a < i && (r *= 256);) this[t + a] = e / r & 255;
+ return t + i
+ }, t.prototype.writeUIntBE = function(e, t, i, n) {
+ (e = +e, t >>>= 0, i >>>= 0, n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
+ var r = i - 1,
+ a = 1;
+ for (this[t + r] = 255 & e; --r >= 0 && (a *= 256);) this[t + r] = e / a & 255;
+ return t + i
+ }, t.prototype.writeUInt8 = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 1, 255, 0), this[t] = 255 & e, t + 1
+ }, t.prototype.writeUInt16LE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 2, 65535, 0), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2
+ }, t.prototype.writeUInt16BE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2
+ }, t.prototype.writeUInt32LE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e, t + 4
+ }, t.prototype.writeUInt32BE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4
+ }, t.prototype.writeIntLE = function(e, t, i, n) {
+ if (e = +e, t >>>= 0, !n) {
+ var r = Math.pow(2, 8 * i - 1);
+ I(this, e, t, i, r - 1, -r)
+ }
+ var a = 0,
+ s = 1,
+ o = 0;
+ for (this[t] = 255 & e; ++a < i && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a - 1] && (o = 1), this[t + a] = (e / s >> 0) - o & 255;
+ return t + i
+ }, t.prototype.writeIntBE = function(e, t, i, n) {
+ if (e = +e, t >>>= 0, !n) {
+ var r = Math.pow(2, 8 * i - 1);
+ I(this, e, t, i, r - 1, -r)
+ }
+ var a = i - 1,
+ s = 1,
+ o = 0;
+ for (this[t + a] = 255 & e; --a >= 0 && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a + 1] && (o = 1), this[t + a] = (e / s >> 0) - o & 255;
+ return t + i
+ }, t.prototype.writeInt8 = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1
+ }, t.prototype.writeInt16LE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 2, 32767, -32768), this[t] = 255 & e, this[t + 1] = e >>> 8, t + 2
+ }, t.prototype.writeInt16BE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = 255 & e, t + 2
+ }, t.prototype.writeInt32LE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 4, 2147483647, -2147483648), this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4
+ }, t.prototype.writeInt32BE = function(e, t, i) {
+ return e = +e, t >>>= 0, i || I(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e, t + 4
+ }, t.prototype.writeFloatLE = function(e, t, i) {
+ return x(this, e, t, !0, i)
+ }, t.prototype.writeFloatBE = function(e, t, i) {
+ return x(this, e, t, !1, i)
+ }, t.prototype.writeDoubleLE = function(e, t, i) {
+ return R(this, e, t, !0, i)
+ }, t.prototype.writeDoubleBE = function(e, t, i) {
+ return R(this, e, t, !1, i)
+ }, t.prototype.copy = function(e, i, n, r) {
+ if (!t.isBuffer(e)) throw new TypeError("argument should be a Buffer");
+ if (n || (n = 0), r || 0 === r || (r = this.length), i >= e.length && (i = e.length), i || (i = 0), r > 0 && r < n && (r = n), r === n) return 0;
+ if (0 === e.length || 0 === this.length) return 0;
+ if (i < 0) throw new RangeError("targetStart out of bounds");
+ if (n < 0 || n >= this.length) throw new RangeError("Index out of range");
+ if (r < 0) throw new RangeError("sourceEnd out of bounds");
+ r > this.length && (r = this.length), e.length - i < r - n && (r = e.length - i + n);
+ var a = r - n;
+ if (this === e && "function" == typeof Uint8Array.prototype.copyWithin) this.copyWithin(i, n, r);
+ else if (this === e && n < i && i < r)
+ for (var s = a - 1; s >= 0; --s) e[s + i] = this[s + n];
+ else Uint8Array.prototype.set.call(e, this.subarray(n, r), i);
+ return a
+ }, t.prototype.fill = function(e, i, n, r) {
+ if ("string" == typeof e) {
+ if ("string" == typeof i ? (r = i, i = 0, n = this.length) : "string" == typeof n && (r = n, n = this.length), void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
+ if ("string" == typeof r && !t.isEncoding(r)) throw new TypeError("Unknown encoding: " + r);
+ if (1 === e.length) {
+ var a = e.charCodeAt(0);
+ ("utf8" === r && a < 128 || "latin1" === r) && (e = a)
+ }
+ } else "number" == typeof e && (e &= 255);
+ if (i < 0 || this.length < i || this.length < n) throw new RangeError("Out of range index");
+ if (n <= i) return this;
+ var s;
+ if (i >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), "number" == typeof e)
+ for (s = i; s < n; ++s) this[s] = e;
+ else {
+ var o = t.isBuffer(e) ? e : t.from(e, r),
+ u = o.length;
+ if (0 === u) throw new TypeError('The value "' + e + '" is invalid for argument "value"');
+ for (s = 0; s < n - i; ++s) this[s + i] = o[s % u]
+ }
+ return this
+ };
+ var D = /[^+/0-9A-Za-z-_]/g;
+
+ function O(e) {
+ return e < 16 ? "0" + e.toString(16) : e.toString(16)
+ }
+
+ function U(e, t) {
+ var i;
+ t = t || 1 / 0;
+ for (var n = e.length, r = null, a = [], s = 0; s < n; ++s) {
+ if ((i = e.charCodeAt(s)) > 55295 && i < 57344) {
+ if (!r) {
+ if (i > 56319) {
+ (t -= 3) > -1 && a.push(239, 191, 189);
+ continue
+ }
+ if (s + 1 === n) {
+ (t -= 3) > -1 && a.push(239, 191, 189);
+ continue
+ }
+ r = i;
+ continue
+ }
+ if (i < 56320) {
+ (t -= 3) > -1 && a.push(239, 191, 189), r = i;
+ continue
+ }
+ i = 65536 + (r - 55296 << 10 | i - 56320)
+ } else r && (t -= 3) > -1 && a.push(239, 191, 189);
+ if (r = null, i < 128) {
+ if ((t -= 1) < 0) break;
+ a.push(i)
+ } else if (i < 2048) {
+ if ((t -= 2) < 0) break;
+ a.push(i >> 6 | 192, 63 & i | 128)
+ } else if (i < 65536) {
+ if ((t -= 3) < 0) break;
+ a.push(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128)
+ } else {
+ if (!(i < 1114112)) throw new Error("Invalid code point");
+ if ((t -= 4) < 0) break;
+ a.push(i >> 18 | 240, i >> 12 & 63 | 128, i >> 6 & 63 | 128, 63 & i | 128)
+ }
+ }
+ return a
+ }
+
+ function M(e) {
+ return n.toByteArray(function(e) {
+ if ((e = (e = e.split("=")[0]).trim().replace(D, "")).length < 2) return "";
+ for (; e.length % 4 != 0;) e += "=";
+ return e
+ }(e))
+ }
+
+ function F(e, t, i, n) {
+ for (var r = 0; r < n && !(r + i >= t.length || r >= e.length); ++r) t[r + i] = e[r];
+ return r
+ }
+
+ function B(e, t) {
+ return e instanceof t || null != e && null != e.constructor && null != e.constructor.name && e.constructor.name === t.name
+ }
+
+ function N(e) {
+ return e != e
+ }
+ }).call(this, e("buffer").Buffer)
+ }, {
+ "base64-js": 30,
+ buffer: 32,
+ ieee754: 35
+ }],
+ 33: [function(e, t, i) {
+ (function(i) {
+ var n, r = void 0 !== i ? i : "undefined" != typeof window ? window : {},
+ a = e("min-document");
+ "undefined" != typeof document ? n = document : (n = r["__GLOBAL_DOCUMENT_CACHE@4"]) || (n = r["__GLOBAL_DOCUMENT_CACHE@4"] = a), t.exports = n
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {
+ "min-document": 31
+ }],
+ 34: [function(e, t, i) {
+ (function(e) {
+ var i;
+ i = "undefined" != typeof window ? window : void 0 !== e ? e : "undefined" != typeof self ? self : {}, t.exports = i
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {}],
+ 35: [function(e, t, i) {
+ i.read = function(e, t, i, n, r) {
+ var a, s, o = 8 * r - n - 1,
+ u = (1 << o) - 1,
+ l = u >> 1,
+ h = -7,
+ d = i ? r - 1 : 0,
+ c = i ? -1 : 1,
+ f = e[t + d];
+ for (d += c, a = f & (1 << -h) - 1, f >>= -h, h += o; h > 0; a = 256 * a + e[t + d], d += c, h -= 8);
+ for (s = a & (1 << -h) - 1, a >>= -h, h += n; h > 0; s = 256 * s + e[t + d], d += c, h -= 8);
+ if (0 === a) a = 1 - l;
+ else {
+ if (a === u) return s ? NaN : 1 / 0 * (f ? -1 : 1);
+ s += Math.pow(2, n), a -= l
+ }
+ return (f ? -1 : 1) * s * Math.pow(2, a - n)
+ }, i.write = function(e, t, i, n, r, a) {
+ var s, o, u, l = 8 * a - r - 1,
+ h = (1 << l) - 1,
+ d = h >> 1,
+ c = 23 === r ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
+ f = n ? 0 : a - 1,
+ p = n ? 1 : -1,
+ m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (o = isNaN(t) ? 1 : 0, s = h) : (s = Math.floor(Math.log(t) / Math.LN2), t * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), (t += s + d >= 1 ? c / u : c * Math.pow(2, 1 - d)) * u >= 2 && (s++, u /= 2), s + d >= h ? (o = 0, s = h) : s + d >= 1 ? (o = (t * u - 1) * Math.pow(2, r), s += d) : (o = t * Math.pow(2, d - 1) * Math.pow(2, r), s = 0)); r >= 8; e[i + f] = 255 & o, f += p, o /= 256, r -= 8);
+ for (s = s << r | o, l += r; l > 0; e[i + f] = 255 & s, f += p, s /= 256, l -= 8);
+ e[i + f - p] |= 128 * m
+ }
+ }, {}],
+ 36: [function(e, t, i) {
+ t.exports = function(e) {
+ if (!e) return !1;
+ var t = n.call(e);
+ return "[object Function]" === t || "function" == typeof e && "[object RegExp]" !== t || "undefined" != typeof window && (e === window.setTimeout || e === window.alert || e === window.confirm || e === window.prompt)
+ };
+ var n = Object.prototype.toString
+ }, {}],
+ 37: [function(e, t, i) {
+ function n(e) {
+ if (e && "object" == typeof e) {
+ var t = e.which || e.keyCode || e.charCode;
+ t && (e = t)
+ }
+ if ("number" == typeof e) return o[e];
+ var i, n = String(e);
+ return (i = r[n.toLowerCase()]) ? i : (i = a[n.toLowerCase()]) || (1 === n.length ? n.charCodeAt(0) : void 0)
+ }
+ n.isEventKey = function(e, t) {
+ if (e && "object" == typeof e) {
+ var i = e.which || e.keyCode || e.charCode;
+ if (null == i) return !1;
+ if ("string" == typeof t) {
+ var n;
+ if (n = r[t.toLowerCase()]) return n === i;
+ if (n = a[t.toLowerCase()]) return n === i
+ } else if ("number" == typeof t) return t === i;
+ return !1
+ }
+ };
+ var r = (i = t.exports = n).code = i.codes = {
+ backspace: 8,
+ tab: 9,
+ enter: 13,
+ shift: 16,
+ ctrl: 17,
+ alt: 18,
+ "pause/break": 19,
+ "caps lock": 20,
+ esc: 27,
+ space: 32,
+ "page up": 33,
+ "page down": 34,
+ end: 35,
+ home: 36,
+ left: 37,
+ up: 38,
+ right: 39,
+ down: 40,
+ insert: 45,
+ delete: 46,
+ command: 91,
+ "left command": 91,
+ "right command": 93,
+ "numpad *": 106,
+ "numpad +": 107,
+ "numpad -": 109,
+ "numpad .": 110,
+ "numpad /": 111,
+ "num lock": 144,
+ "scroll lock": 145,
+ "my computer": 182,
+ "my calculator": 183,
+ ";": 186,
+ "=": 187,
+ ",": 188,
+ "-": 189,
+ ".": 190,
+ "/": 191,
+ "`": 192,
+ "[": 219,
+ "\\": 220,
+ "]": 221,
+ "'": 222
+ },
+ a = i.aliases = {
+ windows: 91,
+ "⇧": 16,
+ "⌥": 18,
+ "⌃": 17,
+ "⌘": 91,
+ ctl: 17,
+ control: 17,
+ option: 18,
+ pause: 19,
+ break: 19,
+ caps: 20,
+ return: 13,
+ escape: 27,
+ spc: 32,
+ spacebar: 32,
+ pgup: 33,
+ pgdn: 34,
+ ins: 45,
+ del: 46,
+ cmd: 91
+ };
+ /*!
+ * Programatically add the following
+ */
+ for (s = 97; s < 123; s++) r[String.fromCharCode(s)] = s - 32;
+ for (var s = 48; s < 58; s++) r[s - 48] = s;
+ for (s = 1; s < 13; s++) r["f" + s] = s + 111;
+ for (s = 0; s < 10; s++) r["numpad " + s] = s + 96;
+ var o = i.names = i.title = {};
+ for (s in r) o[r[s]] = s;
+ for (var u in a) r[u] = a[u]
+ }, {}],
+ 38: [function(e, t, i) {
+ /*! @name m3u8-parser @version 4.7.0 @license Apache-2.0 */
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ });
+ var n = e("@babel/runtime/helpers/inheritsLoose"),
+ r = e("@videojs/vhs-utils/cjs/stream.js"),
+ a = e("@babel/runtime/helpers/extends"),
+ s = e("@babel/runtime/helpers/assertThisInitialized"),
+ o = e("@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js");
+
+ function u(e) {
+ return e && "object" == typeof e && "default" in e ? e : {
+ default: e
+ }
+ }
+ var l = u(n),
+ h = u(r),
+ d = u(a),
+ c = u(s),
+ f = u(o),
+ p = function(e) {
+ function t() {
+ var t;
+ return (t = e.call(this) || this).buffer = "", t
+ }
+ return l.default(t, e), t.prototype.push = function(e) {
+ var t;
+ for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf("\n")) this.trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1)
+ }, t
+ }(h.default),
+ m = String.fromCharCode(9),
+ _ = function(e) {
+ var t = /([0-9.]*)?@?([0-9.]*)?/.exec(e || ""),
+ i = {};
+ return t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[2], 10)), i
+ },
+ g = function(e) {
+ for (var t, i = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), n = {}, r = i.length; r--;) "" !== i[r] && ((t = /([^=]*)=(.*)/.exec(i[r]).slice(1))[0] = t[0].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^['"](.*)['"]$/g, "$1"), n[t[0]] = t[1]);
+ return n
+ },
+ v = function(e) {
+ function t() {
+ var t;
+ return (t = e.call(this) || this).customParsers = [], t.tagMappers = [], t
+ }
+ l.default(t, e);
+ var i = t.prototype;
+ return i.push = function(e) {
+ var t, i, n = this;
+ 0 !== (e = e.trim()).length && ("#" === e[0] ? this.tagMappers.reduce((function(t, i) {
+ var n = i(e);
+ return n === e ? t : t.concat([n])
+ }), [e]).forEach((function(e) {
+ for (var r = 0; r < n.customParsers.length; r++)
+ if (n.customParsers[r].call(n, e)) return;
+ if (0 === e.indexOf("#EXT"))
+ if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) n.trigger("data", {
+ type: "tag",
+ tagType: "m3u"
+ });
+ else {
+ if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "inf"
+ }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void n.trigger("data", i);
+ if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = {
+ type: "tag",
+ tagType: "targetduration"
+ }, t[1] && (i.duration = parseInt(t[1], 10)), void n.trigger("data", i);
+ if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = {
+ type: "tag",
+ tagType: "version"
+ }, t[1] && (i.version = parseInt(t[1], 10)), void n.trigger("data", i);
+ if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
+ type: "tag",
+ tagType: "media-sequence"
+ }, t[1] && (i.number = parseInt(t[1], 10)), void n.trigger("data", i);
+ if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
+ type: "tag",
+ tagType: "discontinuity-sequence"
+ }, t[1] && (i.number = parseInt(t[1], 10)), void n.trigger("data", i);
+ if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "playlist-type"
+ }, t[1] && (i.playlistType = t[1]), void n.trigger("data", i);
+ if (t = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(e)) return i = d.default(_(t[1]), {
+ type: "tag",
+ tagType: "byterange"
+ }), void n.trigger("data", i);
+ if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = {
+ type: "tag",
+ tagType: "allow-cache"
+ }, t[1] && (i.allowed = !/NO/.test(t[1])), void n.trigger("data", i);
+ if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
+ if (i = {
+ type: "tag",
+ tagType: "map"
+ }, t[1]) {
+ var a = g(t[1]);
+ a.URI && (i.uri = a.URI), a.BYTERANGE && (i.byterange = _(a.BYTERANGE))
+ }
+ n.trigger("data", i)
+ } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) {
+ if (i = {
+ type: "tag",
+ tagType: "stream-inf"
+ }, t[1]) {
+ if (i.attributes = g(t[1]), i.attributes.RESOLUTION) {
+ var s = i.attributes.RESOLUTION.split("x"),
+ o = {};
+ s[0] && (o.width = parseInt(s[0], 10)), s[1] && (o.height = parseInt(s[1], 10)), i.attributes.RESOLUTION = o
+ }
+ i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes.BANDWIDTH, 10)), i.attributes["PROGRAM-ID"] && (i.attributes["PROGRAM-ID"] = parseInt(i.attributes["PROGRAM-ID"], 10))
+ }
+ n.trigger("data", i)
+ } else {
+ if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "media"
+ }, t[1] && (i.attributes = g(t[1])), void n.trigger("data", i);
+ if (t = /^#EXT-X-ENDLIST/.exec(e)) n.trigger("data", {
+ type: "tag",
+ tagType: "endlist"
+ });
+ else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) n.trigger("data", {
+ type: "tag",
+ tagType: "discontinuity"
+ });
+ else {
+ if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "program-date-time"
+ }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void n.trigger("data", i);
+ if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "key"
+ }, t[1] && (i.attributes = g(t[1]), i.attributes.IV && ("0x" === i.attributes.IV.substring(0, 2).toLowerCase() && (i.attributes.IV = i.attributes.IV.substring(2)), i.attributes.IV = i.attributes.IV.match(/.{8}/g), i.attributes.IV[0] = parseInt(i.attributes.IV[0], 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i.attributes.IV[2] = parseInt(i.attributes.IV[2], 16), i.attributes.IV[3] = parseInt(i.attributes.IV[3], 16), i.attributes.IV = new Uint32Array(i.attributes.IV))), void n.trigger("data", i);
+ if (t = /^#EXT-X-START:?(.*)$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "start"
+ }, t[1] && (i.attributes = g(t[1]), i.attributes["TIME-OFFSET"] = parseFloat(i.attributes["TIME-OFFSET"]), i.attributes.PRECISE = /YES/.test(i.attributes.PRECISE)), void n.trigger("data", i);
+ if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "cue-out-cont"
+ }, t[1] ? i.data = t[1] : i.data = "", void n.trigger("data", i);
+ if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "cue-out"
+ }, t[1] ? i.data = t[1] : i.data = "", void n.trigger("data", i);
+ if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = {
+ type: "tag",
+ tagType: "cue-in"
+ }, t[1] ? i.data = t[1] : i.data = "", void n.trigger("data", i);
+ if ((t = /^#EXT-X-SKIP:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "skip"
+ }).attributes = g(t[1]), i.attributes.hasOwnProperty("SKIPPED-SEGMENTS") && (i.attributes["SKIPPED-SEGMENTS"] = parseInt(i.attributes["SKIPPED-SEGMENTS"], 10)), i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES") && (i.attributes["RECENTLY-REMOVED-DATERANGES"] = i.attributes["RECENTLY-REMOVED-DATERANGES"].split(m)), void n.trigger("data", i);
+ if ((t = /^#EXT-X-PART:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "part"
+ }).attributes = g(t[1]), ["DURATION"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = parseFloat(i.attributes[e]))
+ })), ["INDEPENDENT", "GAP"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = /YES/.test(i.attributes[e]))
+ })), i.attributes.hasOwnProperty("BYTERANGE") && (i.attributes.byterange = _(i.attributes.BYTERANGE)), void n.trigger("data", i);
+ if ((t = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "server-control"
+ }).attributes = g(t[1]), ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = parseFloat(i.attributes[e]))
+ })), ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = /YES/.test(i.attributes[e]))
+ })), void n.trigger("data", i);
+ if ((t = /^#EXT-X-PART-INF:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "part-inf"
+ }).attributes = g(t[1]), ["PART-TARGET"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = parseFloat(i.attributes[e]))
+ })), void n.trigger("data", i);
+ if ((t = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "preload-hint"
+ }).attributes = g(t[1]), ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach((function(e) {
+ if (i.attributes.hasOwnProperty(e)) {
+ i.attributes[e] = parseInt(i.attributes[e], 10);
+ var t = "BYTERANGE-LENGTH" === e ? "length" : "offset";
+ i.attributes.byterange = i.attributes.byterange || {}, i.attributes.byterange[t] = i.attributes[e], delete i.attributes[e]
+ }
+ })), void n.trigger("data", i);
+ if ((t = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e)) && t[1]) return (i = {
+ type: "tag",
+ tagType: "rendition-report"
+ }).attributes = g(t[1]), ["LAST-MSN", "LAST-PART"].forEach((function(e) {
+ i.attributes.hasOwnProperty(e) && (i.attributes[e] = parseInt(i.attributes[e], 10))
+ })), void n.trigger("data", i);
+ n.trigger("data", {
+ type: "tag",
+ data: e.slice(4)
+ })
+ }
+ }
+ }
+ else n.trigger("data", {
+ type: "comment",
+ text: e.slice(1)
+ })
+ })) : this.trigger("data", {
+ type: "uri",
+ uri: e
+ }))
+ }, i.addParser = function(e) {
+ var t = this,
+ i = e.expression,
+ n = e.customType,
+ r = e.dataParser,
+ a = e.segment;
+ "function" != typeof r && (r = function(e) {
+ return e
+ }), this.customParsers.push((function(e) {
+ if (i.exec(e)) return t.trigger("data", {
+ type: "custom",
+ data: r(e),
+ customType: n,
+ segment: a
+ }), !0
+ }))
+ }, i.addTagMapper = function(e) {
+ var t = e.expression,
+ i = e.map;
+ this.tagMappers.push((function(e) {
+ return t.test(e) ? i(e) : e
+ }))
+ }, t
+ }(h.default),
+ y = function(e) {
+ var t = {};
+ return Object.keys(e).forEach((function(i) {
+ var n;
+ t[(n = i, n.toLowerCase().replace(/-(\w)/g, (function(e) {
+ return e[1].toUpperCase()
+ })))] = e[i]
+ })), t
+ },
+ b = function(e) {
+ var t = e.serverControl,
+ i = e.targetDuration,
+ n = e.partTargetDuration;
+ if (t) {
+ var r = "#EXT-X-SERVER-CONTROL",
+ a = "holdBack",
+ s = "partHoldBack",
+ o = i && 3 * i,
+ u = n && 2 * n;
+ i && !t.hasOwnProperty(a) && (t[a] = o, this.trigger("info", {
+ message: r + " defaulting HOLD-BACK to targetDuration * 3 (" + o + ")."
+ })), o && t[a] < o && (this.trigger("warn", {
+ message: r + " clamping HOLD-BACK (" + t[a] + ") to targetDuration * 3 (" + o + ")"
+ }), t[a] = o), n && !t.hasOwnProperty(s) && (t[s] = 3 * n, this.trigger("info", {
+ message: r + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + t[s] + ")."
+ })), n && t[s] < u && (this.trigger("warn", {
+ message: r + " clamping PART-HOLD-BACK (" + t[s] + ") to partTargetDuration * 2 (" + u + ")."
+ }), t[s] = u)
+ }
+ },
+ S = function(e) {
+ function t() {
+ var t;
+ (t = e.call(this) || this).lineStream = new p, t.parseStream = new v, t.lineStream.pipe(t.parseStream);
+ var i, n, r = c.default(t),
+ a = [],
+ s = {},
+ o = !1,
+ u = function() {},
+ l = {
+ AUDIO: {},
+ VIDEO: {},
+ "CLOSED-CAPTIONS": {},
+ SUBTITLES: {}
+ },
+ h = 0;
+ t.manifest = {
+ allowCache: !0,
+ discontinuityStarts: [],
+ segments: []
+ };
+ var m = 0,
+ _ = 0;
+ return t.on("end", (function() {
+ s.uri || !s.parts && !s.preloadHints || (!s.map && i && (s.map = i), !s.key && n && (s.key = n), s.timeline || "number" != typeof h || (s.timeline = h), t.manifest.preloadSegment = s)
+ })), t.parseStream.on("data", (function(e) {
+ var t, c;
+ ({
+ tag: function() {
+ ({
+ version: function() {
+ e.version && (this.manifest.version = e.version)
+ },
+ "allow-cache": function() {
+ this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger("info", {
+ message: "defaulting allowCache to YES"
+ }), this.manifest.allowCache = !0)
+ },
+ byterange: function() {
+ var t = {};
+ "length" in e && (s.byterange = t, t.length = e.length, "offset" in e || (e.offset = m)), "offset" in e && (s.byterange = t, t.offset = e.offset), m = t.offset + t.length
+ },
+ endlist: function() {
+ this.manifest.endList = !0
+ },
+ inf: function() {
+ "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this.trigger("info", {
+ message: "defaulting media sequence to zero"
+ })), "discontinuitySequence" in this.manifest || (this.manifest.discontinuitySequence = 0, this.trigger("info", {
+ message: "defaulting discontinuity sequence to zero"
+ })), e.duration > 0 && (s.duration = e.duration), 0 === e.duration && (s.duration = .01, this.trigger("info", {
+ message: "updating zero segment duration to a small value"
+ })), this.manifest.segments = a
+ },
+ key: function() {
+ if (e.attributes)
+ if ("NONE" !== e.attributes.METHOD)
+ if (e.attributes.URI) {
+ if ("com.apple.streamingkeydelivery" === e.attributes.KEYFORMAT) return this.manifest.contentProtection = this.manifest.contentProtection || {}, void(this.manifest.contentProtection["com.apple.fps.1_0"] = {
+ attributes: e.attributes
+ });
+ if ("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" === e.attributes.KEYFORMAT) {
+ return -1 === ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD) ? void this.trigger("warn", {
+ message: "invalid key method provided for Widevine"
+ }) : ("SAMPLE-AES-CENC" === e.attributes.METHOD && this.trigger("warn", {
+ message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
+ }), "data:text/plain;base64," !== e.attributes.URI.substring(0, 23) ? void this.trigger("warn", {
+ message: "invalid key URI provided for Widevine"
+ }) : e.attributes.KEYID && "0x" === e.attributes.KEYID.substring(0, 2) ? (this.manifest.contentProtection = this.manifest.contentProtection || {}, void(this.manifest.contentProtection["com.widevine.alpha"] = {
+ attributes: {
+ schemeIdUri: e.attributes.KEYFORMAT,
+ keyId: e.attributes.KEYID.substring(2)
+ },
+ pssh: f.default(e.attributes.URI.split(",")[1])
+ })) : void this.trigger("warn", {
+ message: "invalid key ID provided for Widevine"
+ }))
+ }
+ e.attributes.METHOD || this.trigger("warn", {
+ message: "defaulting key method to AES-128"
+ }), n = {
+ method: e.attributes.METHOD || "AES-128",
+ uri: e.attributes.URI
+ }, void 0 !== e.attributes.IV && (n.iv = e.attributes.IV)
+ } else this.trigger("warn", {
+ message: "ignoring key declaration without URI"
+ });
+ else n = null;
+ else this.trigger("warn", {
+ message: "ignoring key declaration without attribute list"
+ })
+ },
+ "media-sequence": function() {
+ isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger("warn", {
+ message: "ignoring invalid media sequence: " + e.number
+ })
+ },
+ "discontinuity-sequence": function() {
+ isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, h = e.number) : this.trigger("warn", {
+ message: "ignoring invalid discontinuity sequence: " + e.number
+ })
+ },
+ "playlist-type": function() {
+ /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType : this.trigger("warn", {
+ message: "ignoring unknown playlist type: " + e.playlist
+ })
+ },
+ map: function() {
+ i = {}, e.uri && (i.uri = e.uri), e.byterange && (i.byterange = e.byterange), n && (i.key = n)
+ },
+ "stream-inf": function() {
+ this.manifest.playlists = a, this.manifest.mediaGroups = this.manifest.mediaGroups || l, e.attributes ? (s.attributes || (s.attributes = {}), d.default(s.attributes, e.attributes)) : this.trigger("warn", {
+ message: "ignoring empty stream-inf attributes"
+ })
+ },
+ media: function() {
+ if (this.manifest.mediaGroups = this.manifest.mediaGroups || l, e.attributes && e.attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME) {
+ var i = this.manifest.mediaGroups[e.attributes.TYPE];
+ i[e.attributes["GROUP-ID"]] = i[e.attributes["GROUP-ID"]] || {}, t = i[e.attributes["GROUP-ID"]], (c = {
+ default: /yes/i.test(e.attributes.DEFAULT)
+ }).default ? c.autoselect = !0 : c.autoselect = /yes/i.test(e.attributes.AUTOSELECT), e.attributes.LANGUAGE && (c.language = e.attributes.LANGUAGE), e.attributes.URI && (c.uri = e.attributes.URI), e.attributes["INSTREAM-ID"] && (c.instreamId = e.attributes["INSTREAM-ID"]), e.attributes.CHARACTERISTICS && (c.characteristics = e.attributes.CHARACTERISTICS), e.attributes.FORCED && (c.forced = /yes/i.test(e.attributes.FORCED)), t[e.attributes.NAME] = c
+ } else this.trigger("warn", {
+ message: "ignoring incomplete or missing media group"
+ })
+ },
+ discontinuity: function() {
+ h += 1, s.discontinuity = !0, this.manifest.discontinuityStarts.push(a.length)
+ },
+ "program-date-time": function() {
+ void 0 === this.manifest.dateTimeString && (this.manifest.dateTimeString = e.dateTimeString, this.manifest.dateTimeObject = e.dateTimeObject), s.dateTimeString = e.dateTimeString, s.dateTimeObject = e.dateTimeObject
+ },
+ targetduration: function() {
+ !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
+ message: "ignoring invalid target duration: " + e.duration
+ }) : (this.manifest.targetDuration = e.duration, b.call(this, this.manifest))
+ },
+ start: function() {
+ e.attributes && !isNaN(e.attributes["TIME-OFFSET"]) ? this.manifest.start = {
+ timeOffset: e.attributes["TIME-OFFSET"],
+ precise: e.attributes.PRECISE
+ } : this.trigger("warn", {
+ message: "ignoring start declaration without appropriate attribute list"
+ })
+ },
+ "cue-out": function() {
+ s.cueOut = e.data
+ },
+ "cue-out-cont": function() {
+ s.cueOutCont = e.data
+ },
+ "cue-in": function() {
+ s.cueIn = e.data
+ },
+ skip: function() {
+ this.manifest.skip = y(e.attributes), this.warnOnMissingAttributes_("#EXT-X-SKIP", e.attributes, ["SKIPPED-SEGMENTS"])
+ },
+ part: function() {
+ var t = this;
+ o = !0;
+ var i = this.manifest.segments.length,
+ n = y(e.attributes);
+ s.parts = s.parts || [], s.parts.push(n), n.byterange && (n.byterange.hasOwnProperty("offset") || (n.byterange.offset = _), _ = n.byterange.offset + n.byterange.length);
+ var r = s.parts.length - 1;
+ this.warnOnMissingAttributes_("#EXT-X-PART #" + r + " for segment #" + i, e.attributes, ["URI", "DURATION"]), this.manifest.renditionReports && this.manifest.renditionReports.forEach((function(e, i) {
+ e.hasOwnProperty("lastPart") || t.trigger("warn", {
+ message: "#EXT-X-RENDITION-REPORT #" + i + " lacks required attribute(s): LAST-PART"
+ })
+ }))
+ },
+ "server-control": function() {
+ var t = this.manifest.serverControl = y(e.attributes);
+ t.hasOwnProperty("canBlockReload") || (t.canBlockReload = !1, this.trigger("info", {
+ message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
+ })), b.call(this, this.manifest), t.canSkipDateranges && !t.hasOwnProperty("canSkipUntil") && this.trigger("warn", {
+ message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
+ })
+ },
+ "preload-hint": function() {
+ var t = this.manifest.segments.length,
+ i = y(e.attributes),
+ n = i.type && "PART" === i.type;
+ s.preloadHints = s.preloadHints || [], s.preloadHints.push(i), i.byterange && (i.byterange.hasOwnProperty("offset") || (i.byterange.offset = n ? _ : 0, n && (_ = i.byterange.offset + i.byterange.length)));
+ var r = s.preloadHints.length - 1;
+ if (this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + r + " for segment #" + t, e.attributes, ["TYPE", "URI"]), i.type)
+ for (var a = 0; a < s.preloadHints.length - 1; a++) {
+ var o = s.preloadHints[a];
+ o.type && (o.type === i.type && this.trigger("warn", {
+ message: "#EXT-X-PRELOAD-HINT #" + r + " for segment #" + t + " has the same TYPE " + i.type + " as preload hint #" + a
+ }))
+ }
+ },
+ "rendition-report": function() {
+ var t = y(e.attributes);
+ this.manifest.renditionReports = this.manifest.renditionReports || [], this.manifest.renditionReports.push(t);
+ var i = this.manifest.renditionReports.length - 1,
+ n = ["LAST-MSN", "URI"];
+ o && n.push("LAST-PART"), this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + i, e.attributes, n)
+ },
+ "part-inf": function() {
+ this.manifest.partInf = y(e.attributes), this.warnOnMissingAttributes_("#EXT-X-PART-INF", e.attributes, ["PART-TARGET"]), this.manifest.partInf.partTarget && (this.manifest.partTargetDuration = this.manifest.partInf.partTarget), b.call(this, this.manifest)
+ }
+ } [e.tagType] || u).call(r)
+ },
+ uri: function() {
+ s.uri = e.uri, a.push(s), this.manifest.targetDuration && !("duration" in s) && (this.trigger("warn", {
+ message: "defaulting segment duration to the target duration"
+ }), s.duration = this.manifest.targetDuration), n && (s.key = n), s.timeline = h, i && (s.map = i), _ = 0, s = {}
+ },
+ comment: function() {},
+ custom: function() {
+ e.segment ? (s.custom = s.custom || {}, s.custom[e.customType] = e.data) : (this.manifest.custom = this.manifest.custom || {}, this.manifest.custom[e.customType] = e.data)
+ }
+ })[e.type].call(r)
+ })), t
+ }
+ l.default(t, e);
+ var i = t.prototype;
+ return i.warnOnMissingAttributes_ = function(e, t, i) {
+ var n = [];
+ i.forEach((function(e) {
+ t.hasOwnProperty(e) || n.push(e)
+ })), n.length && this.trigger("warn", {
+ message: e + " lacks required attribute(s): " + n.join(", ")
+ })
+ }, i.push = function(e) {
+ this.lineStream.push(e)
+ }, i.end = function() {
+ this.lineStream.push("\n"), this.trigger("end")
+ }, i.addParser = function(e) {
+ this.parseStream.addParser(e)
+ }, i.addTagMapper = function(e) {
+ this.parseStream.addTagMapper(e)
+ }, t
+ }(h.default);
+ i.LineStream = p, i.ParseStream = v, i.Parser = S
+ }, {
+ "@babel/runtime/helpers/assertThisInitialized": 1,
+ "@babel/runtime/helpers/extends": 3,
+ "@babel/runtime/helpers/inheritsLoose": 5,
+ "@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js": 13,
+ "@videojs/vhs-utils/cjs/stream.js": 21
+ }],
+ 39: [function(e, t, i) {
+ var n, r, a = (n = new Date, r = 4, {
+ setLogLevel: function(e) {
+ r = e == this.debug ? 1 : e == this.info ? 2 : e == this.warn ? 3 : (this.error, 4)
+ },
+ debug: function(e, t) {
+ void 0 === console.debug && (console.debug = console.log), 1 >= r && console.debug("[" + a.getDurationString(new Date - n, 1e3) + "]", "[" + e + "]", t)
+ },
+ log: function(e, t) {
+ this.debug(e.msg)
+ },
+ info: function(e, t) {
+ 2 >= r && console.info("[" + a.getDurationString(new Date - n, 1e3) + "]", "[" + e + "]", t)
+ },
+ warn: function(e, t) {
+ 3 >= r && a.getDurationString(new Date - n, 1e3)
+ },
+ error: function(e, t) {
+ 4 >= r && console.error("[" + a.getDurationString(new Date - n, 1e3) + "]", "[" + e + "]", t)
+ }
+ });
+ a.getDurationString = function(e, t) {
+ var i;
+
+ function n(e, t) {
+ for (var i = ("" + e).split("."); i[0].length < t;) i[0] = "0" + i[0];
+ return i.join(".")
+ }
+ e < 0 ? (i = !0, e = -e) : i = !1;
+ var r = e / (t || 1),
+ a = Math.floor(r / 3600);
+ r -= 3600 * a;
+ var s = Math.floor(r / 60),
+ o = 1e3 * (r -= 60 * s);
+ return o -= 1e3 * (r = Math.floor(r)), o = Math.floor(o), (i ? "-" : "") + a + ":" + n(s, 2) + ":" + n(r, 2) + "." + n(o, 3)
+ }, a.printRanges = function(e) {
+ var t = e.length;
+ if (t > 0) {
+ for (var i = "", n = 0; n < t; n++) n > 0 && (i += ","), i += "[" + a.getDurationString(e.start(n)) + "," + a.getDurationString(e.end(n)) + "]";
+ return i
+ }
+ return "(empty)"
+ }, void 0 !== i && (i.Log = a);
+ var s = function(e) {
+ if (!(e instanceof ArrayBuffer)) throw "Needs an array buffer";
+ this.buffer = e, this.dataview = new DataView(e), this.position = 0
+ };
+ s.prototype.getPosition = function() {
+ return this.position
+ }, s.prototype.getEndPosition = function() {
+ return this.buffer.byteLength
+ }, s.prototype.getLength = function() {
+ return this.buffer.byteLength
+ }, s.prototype.seek = function(e) {
+ var t = Math.max(0, Math.min(this.buffer.byteLength, e));
+ return this.position = isNaN(t) || !isFinite(t) ? 0 : t, !0
+ }, s.prototype.isEos = function() {
+ return this.getPosition() >= this.getEndPosition()
+ }, s.prototype.readAnyInt = function(e, t) {
+ var i = 0;
+ if (this.position + e <= this.buffer.byteLength) {
+ switch (e) {
+ case 1:
+ i = t ? this.dataview.getInt8(this.position) : this.dataview.getUint8(this.position);
+ break;
+ case 2:
+ i = t ? this.dataview.getInt16(this.position) : this.dataview.getUint16(this.position);
+ break;
+ case 3:
+ if (t) throw "No method for reading signed 24 bits values";
+ i = this.dataview.getUint8(this.position) << 16, i |= this.dataview.getUint8(this.position) << 8, i |= this.dataview.getUint8(this.position);
+ break;
+ case 4:
+ i = t ? this.dataview.getInt32(this.position) : this.dataview.getUint32(this.position);
+ break;
+ case 8:
+ if (t) throw "No method for reading signed 64 bits values";
+ i = this.dataview.getUint32(this.position) << 32, i |= this.dataview.getUint32(this.position);
+ break;
+ default:
+ throw "readInt method not implemented for size: " + e
+ }
+ return this.position += e, i
+ }
+ throw "Not enough bytes in buffer"
+ }, s.prototype.readUint8 = function() {
+ return this.readAnyInt(1, !1)
+ }, s.prototype.readUint16 = function() {
+ return this.readAnyInt(2, !1)
+ }, s.prototype.readUint24 = function() {
+ return this.readAnyInt(3, !1)
+ }, s.prototype.readUint32 = function() {
+ return this.readAnyInt(4, !1)
+ }, s.prototype.readUint64 = function() {
+ return this.readAnyInt(8, !1)
+ }, s.prototype.readString = function(e) {
+ if (this.position + e <= this.buffer.byteLength) {
+ for (var t = "", i = 0; i < e; i++) t += String.fromCharCode(this.readUint8());
+ return t
+ }
+ throw "Not enough bytes in buffer"
+ }, s.prototype.readCString = function() {
+ for (var e = [];;) {
+ var t = this.readUint8();
+ if (0 === t) break;
+ e.push(t)
+ }
+ return String.fromCharCode.apply(null, e)
+ }, s.prototype.readInt8 = function() {
+ return this.readAnyInt(1, !0)
+ }, s.prototype.readInt16 = function() {
+ return this.readAnyInt(2, !0)
+ }, s.prototype.readInt32 = function() {
+ return this.readAnyInt(4, !0)
+ }, s.prototype.readInt64 = function() {
+ return this.readAnyInt(8, !1)
+ }, s.prototype.readUint8Array = function(e) {
+ for (var t = new Uint8Array(e), i = 0; i < e; i++) t[i] = this.readUint8();
+ return t
+ }, s.prototype.readInt16Array = function(e) {
+ for (var t = new Int16Array(e), i = 0; i < e; i++) t[i] = this.readInt16();
+ return t
+ }, s.prototype.readUint16Array = function(e) {
+ for (var t = new Int16Array(e), i = 0; i < e; i++) t[i] = this.readUint16();
+ return t
+ }, s.prototype.readUint32Array = function(e) {
+ for (var t = new Uint32Array(e), i = 0; i < e; i++) t[i] = this.readUint32();
+ return t
+ }, s.prototype.readInt32Array = function(e) {
+ for (var t = new Int32Array(e), i = 0; i < e; i++) t[i] = this.readInt32();
+ return t
+ }, void 0 !== i && (i.MP4BoxStream = s);
+ var o = function(e, t, i) {
+ this._byteOffset = t || 0, e instanceof ArrayBuffer ? this.buffer = e : "object" == typeof e ? (this.dataView = e, t && (this._byteOffset += t)) : this.buffer = new ArrayBuffer(e || 0), this.position = 0, this.endianness = null == i ? o.LITTLE_ENDIAN : i
+ };
+ o.prototype = {}, o.prototype.getPosition = function() {
+ return this.position
+ }, o.prototype._realloc = function(e) {
+ if (this._dynamicSize) {
+ var t = this._byteOffset + this.position + e,
+ i = this._buffer.byteLength;
+ if (t <= i) t > this._byteLength && (this._byteLength = t);
+ else {
+ for (i < 1 && (i = 1); t > i;) i *= 2;
+ var n = new ArrayBuffer(i),
+ r = new Uint8Array(this._buffer);
+ new Uint8Array(n, 0, r.length).set(r), this.buffer = n, this._byteLength = t
+ }
+ }
+ }, o.prototype._trimAlloc = function() {
+ if (this._byteLength != this._buffer.byteLength) {
+ var e = new ArrayBuffer(this._byteLength),
+ t = new Uint8Array(e),
+ i = new Uint8Array(this._buffer, 0, t.length);
+ t.set(i), this.buffer = e
+ }
+ }, o.BIG_ENDIAN = !1, o.LITTLE_ENDIAN = !0, o.prototype._byteLength = 0, Object.defineProperty(o.prototype, "byteLength", {
+ get: function() {
+ return this._byteLength - this._byteOffset
+ }
+ }), Object.defineProperty(o.prototype, "buffer", {
+ get: function() {
+ return this._trimAlloc(), this._buffer
+ },
+ set: function(e) {
+ this._buffer = e, this._dataView = new DataView(this._buffer, this._byteOffset), this._byteLength = this._buffer.byteLength
+ }
+ }), Object.defineProperty(o.prototype, "byteOffset", {
+ get: function() {
+ return this._byteOffset
+ },
+ set: function(e) {
+ this._byteOffset = e, this._dataView = new DataView(this._buffer, this._byteOffset), this._byteLength = this._buffer.byteLength
+ }
+ }), Object.defineProperty(o.prototype, "dataView", {
+ get: function() {
+ return this._dataView
+ },
+ set: function(e) {
+ this._byteOffset = e.byteOffset, this._buffer = e.buffer, this._dataView = new DataView(this._buffer, this._byteOffset), this._byteLength = this._byteOffset + e.byteLength
+ }
+ }), o.prototype.seek = function(e) {
+ var t = Math.max(0, Math.min(this.byteLength, e));
+ this.position = isNaN(t) || !isFinite(t) ? 0 : t
+ }, o.prototype.isEof = function() {
+ return this.position >= this._byteLength
+ }, o.prototype.mapUint8Array = function(e) {
+ this._realloc(1 * e);
+ var t = new Uint8Array(this._buffer, this.byteOffset + this.position, e);
+ return this.position += 1 * e, t
+ }, o.prototype.readInt32Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 4 : e;
+ var i = new Int32Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readInt16Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 2 : e;
+ var i = new Int16Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readInt8Array = function(e) {
+ e = null == e ? this.byteLength - this.position : e;
+ var t = new Int8Array(e);
+ return o.memcpy(t.buffer, 0, this.buffer, this.byteOffset + this.position, e * t.BYTES_PER_ELEMENT), this.position += t.byteLength, t
+ }, o.prototype.readUint32Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 4 : e;
+ var i = new Uint32Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readUint16Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 2 : e;
+ var i = new Uint16Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readUint8Array = function(e) {
+ e = null == e ? this.byteLength - this.position : e;
+ var t = new Uint8Array(e);
+ return o.memcpy(t.buffer, 0, this.buffer, this.byteOffset + this.position, e * t.BYTES_PER_ELEMENT), this.position += t.byteLength, t
+ }, o.prototype.readFloat64Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 8 : e;
+ var i = new Float64Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readFloat32Array = function(e, t) {
+ e = null == e ? this.byteLength - this.position / 4 : e;
+ var i = new Float32Array(e);
+ return o.memcpy(i.buffer, 0, this.buffer, this.byteOffset + this.position, e * i.BYTES_PER_ELEMENT), o.arrayToNative(i, null == t ? this.endianness : t), this.position += i.byteLength, i
+ }, o.prototype.readInt32 = function(e) {
+ var t = this._dataView.getInt32(this.position, null == e ? this.endianness : e);
+ return this.position += 4, t
+ }, o.prototype.readInt16 = function(e) {
+ var t = this._dataView.getInt16(this.position, null == e ? this.endianness : e);
+ return this.position += 2, t
+ }, o.prototype.readInt8 = function() {
+ var e = this._dataView.getInt8(this.position);
+ return this.position += 1, e
+ }, o.prototype.readUint32 = function(e) {
+ var t = this._dataView.getUint32(this.position, null == e ? this.endianness : e);
+ return this.position += 4, t
+ }, o.prototype.readUint16 = function(e) {
+ var t = this._dataView.getUint16(this.position, null == e ? this.endianness : e);
+ return this.position += 2, t
+ }, o.prototype.readUint8 = function() {
+ var e = this._dataView.getUint8(this.position);
+ return this.position += 1, e
+ }, o.prototype.readFloat32 = function(e) {
+ var t = this._dataView.getFloat32(this.position, null == e ? this.endianness : e);
+ return this.position += 4, t
+ }, o.prototype.readFloat64 = function(e) {
+ var t = this._dataView.getFloat64(this.position, null == e ? this.endianness : e);
+ return this.position += 8, t
+ }, o.endianness = new Int8Array(new Int16Array([1]).buffer)[0] > 0, o.memcpy = function(e, t, i, n, r) {
+ var a = new Uint8Array(e, t, r),
+ s = new Uint8Array(i, n, r);
+ a.set(s)
+ }, o.arrayToNative = function(e, t) {
+ return t == this.endianness ? e : this.flipArrayEndianness(e)
+ }, o.nativeToEndian = function(e, t) {
+ return this.endianness == t ? e : this.flipArrayEndianness(e)
+ }, o.flipArrayEndianness = function(e) {
+ for (var t = new Uint8Array(e.buffer, e.byteOffset, e.byteLength), i = 0; i < e.byteLength; i += e.BYTES_PER_ELEMENT)
+ for (var n = i + e.BYTES_PER_ELEMENT - 1, r = i; n > r; n--, r++) {
+ var a = t[r];
+ t[r] = t[n], t[n] = a
+ }
+ return e
+ }, o.prototype.failurePosition = 0, String.fromCharCodeUint8 = function(e) {
+ for (var t = [], i = 0; i < e.length; i++) t[i] = e[i];
+ return String.fromCharCode.apply(null, t)
+ }, o.prototype.readString = function(e, t) {
+ return null == t || "ASCII" == t ? String.fromCharCodeUint8.apply(null, [this.mapUint8Array(null == e ? this.byteLength - this.position : e)]) : new TextDecoder(t).decode(this.mapUint8Array(e))
+ }, o.prototype.readCString = function(e) {
+ var t = this.byteLength - this.position,
+ i = new Uint8Array(this._buffer, this._byteOffset + this.position),
+ n = t;
+ null != e && (n = Math.min(e, t));
+ for (var r = 0; r < n && 0 !== i[r]; r++);
+ var a = String.fromCharCodeUint8.apply(null, [this.mapUint8Array(r)]);
+ return null != e ? this.position += n - r : r != t && (this.position += 1), a
+ };
+ var u = Math.pow(2, 32);
+ o.prototype.readInt64 = function() {
+ return this.readInt32() * u + this.readUint32()
+ }, o.prototype.readUint64 = function() {
+ return this.readUint32() * u + this.readUint32()
+ }, o.prototype.readInt64 = function() {
+ return this.readUint32() * u + this.readUint32()
+ }, o.prototype.readUint24 = function() {
+ return (this.readUint8() << 16) + (this.readUint8() << 8) + this.readUint8()
+ }, void 0 !== i && (i.DataStream = o), o.prototype.save = function(e) {
+ var t = new Blob([this.buffer]);
+ if (!window.URL || !URL.createObjectURL) throw "DataStream.save: Can't create object URL.";
+ var i = window.URL.createObjectURL(t),
+ n = document.createElement("a");
+ document.body.appendChild(n), n.setAttribute("href", i), n.setAttribute("download", e), n.setAttribute("target", "_self"), n.click(), window.URL.revokeObjectURL(i)
+ }, o.prototype._dynamicSize = !0, Object.defineProperty(o.prototype, "dynamicSize", {
+ get: function() {
+ return this._dynamicSize
+ },
+ set: function(e) {
+ e || this._trimAlloc(), this._dynamicSize = e
+ }
+ }), o.prototype.shift = function(e) {
+ var t = new ArrayBuffer(this._byteLength - e),
+ i = new Uint8Array(t),
+ n = new Uint8Array(this._buffer, e, i.length);
+ i.set(n), this.buffer = t, this.position -= e
+ }, o.prototype.writeInt32Array = function(e, t) {
+ if (this._realloc(4 * e.length), e instanceof Int32Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapInt32Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeInt32(e[i], t)
+ }, o.prototype.writeInt16Array = function(e, t) {
+ if (this._realloc(2 * e.length), e instanceof Int16Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapInt16Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeInt16(e[i], t)
+ }, o.prototype.writeInt8Array = function(e) {
+ if (this._realloc(1 * e.length), e instanceof Int8Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapInt8Array(e.length);
+ else
+ for (var t = 0; t < e.length; t++) this.writeInt8(e[t])
+ }, o.prototype.writeUint32Array = function(e, t) {
+ if (this._realloc(4 * e.length), e instanceof Uint32Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapUint32Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeUint32(e[i], t)
+ }, o.prototype.writeUint16Array = function(e, t) {
+ if (this._realloc(2 * e.length), e instanceof Uint16Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapUint16Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeUint16(e[i], t)
+ }, o.prototype.writeUint8Array = function(e) {
+ if (this._realloc(1 * e.length), e instanceof Uint8Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapUint8Array(e.length);
+ else
+ for (var t = 0; t < e.length; t++) this.writeUint8(e[t])
+ }, o.prototype.writeFloat64Array = function(e, t) {
+ if (this._realloc(8 * e.length), e instanceof Float64Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapFloat64Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeFloat64(e[i], t)
+ }, o.prototype.writeFloat32Array = function(e, t) {
+ if (this._realloc(4 * e.length), e instanceof Float32Array && this.byteOffset + this.position % e.BYTES_PER_ELEMENT === 0) o.memcpy(this._buffer, this.byteOffset + this.position, e.buffer, 0, e.byteLength), this.mapFloat32Array(e.length, t);
+ else
+ for (var i = 0; i < e.length; i++) this.writeFloat32(e[i], t)
+ }, o.prototype.writeInt32 = function(e, t) {
+ this._realloc(4), this._dataView.setInt32(this.position, e, null == t ? this.endianness : t), this.position += 4
+ }, o.prototype.writeInt16 = function(e, t) {
+ this._realloc(2), this._dataView.setInt16(this.position, e, null == t ? this.endianness : t), this.position += 2
+ }, o.prototype.writeInt8 = function(e) {
+ this._realloc(1), this._dataView.setInt8(this.position, e), this.position += 1
+ }, o.prototype.writeUint32 = function(e, t) {
+ this._realloc(4), this._dataView.setUint32(this.position, e, null == t ? this.endianness : t), this.position += 4
+ }, o.prototype.writeUint16 = function(e, t) {
+ this._realloc(2), this._dataView.setUint16(this.position, e, null == t ? this.endianness : t), this.position += 2
+ }, o.prototype.writeUint8 = function(e) {
+ this._realloc(1), this._dataView.setUint8(this.position, e), this.position += 1
+ }, o.prototype.writeFloat32 = function(e, t) {
+ this._realloc(4), this._dataView.setFloat32(this.position, e, null == t ? this.endianness : t), this.position += 4
+ }, o.prototype.writeFloat64 = function(e, t) {
+ this._realloc(8), this._dataView.setFloat64(this.position, e, null == t ? this.endianness : t), this.position += 8
+ }, o.prototype.writeUCS2String = function(e, t, i) {
+ null == i && (i = e.length);
+ for (var n = 0; n < e.length && n < i; n++) this.writeUint16(e.charCodeAt(n), t);
+ for (; n < i; n++) this.writeUint16(0)
+ }, o.prototype.writeString = function(e, t, i) {
+ var n = 0;
+ if (null == t || "ASCII" == t)
+ if (null != i) {
+ var r = Math.min(e.length, i);
+ for (n = 0; n < r; n++) this.writeUint8(e.charCodeAt(n));
+ for (; n < i; n++) this.writeUint8(0)
+ } else
+ for (n = 0; n < e.length; n++) this.writeUint8(e.charCodeAt(n));
+ else this.writeUint8Array(new TextEncoder(t).encode(e.substring(0, i)))
+ }, o.prototype.writeCString = function(e, t) {
+ var i = 0;
+ if (null != t) {
+ var n = Math.min(e.length, t);
+ for (i = 0; i < n; i++) this.writeUint8(e.charCodeAt(i));
+ for (; i < t; i++) this.writeUint8(0)
+ } else {
+ for (i = 0; i < e.length; i++) this.writeUint8(e.charCodeAt(i));
+ this.writeUint8(0)
+ }
+ }, o.prototype.writeStruct = function(e, t) {
+ for (var i = 0; i < e.length; i += 2) {
+ var n = e[i + 1];
+ this.writeType(n, t[e[i]], t)
+ }
+ }, o.prototype.writeType = function(e, t, i) {
+ var n;
+ if ("function" == typeof e) return e(this, t);
+ if ("object" == typeof e && !(e instanceof Array)) return e.set(this, t, i);
+ var r = null,
+ a = "ASCII",
+ s = this.position;
+ switch ("string" == typeof e && /:/.test(e) && (n = e.split(":"), e = n[0], r = parseInt(n[1])), "string" == typeof e && /,/.test(e) && (n = e.split(","), e = n[0], a = parseInt(n[1])), e) {
+ case "uint8":
+ this.writeUint8(t);
+ break;
+ case "int8":
+ this.writeInt8(t);
+ break;
+ case "uint16":
+ this.writeUint16(t, this.endianness);
+ break;
+ case "int16":
+ this.writeInt16(t, this.endianness);
+ break;
+ case "uint32":
+ this.writeUint32(t, this.endianness);
+ break;
+ case "int32":
+ this.writeInt32(t, this.endianness);
+ break;
+ case "float32":
+ this.writeFloat32(t, this.endianness);
+ break;
+ case "float64":
+ this.writeFloat64(t, this.endianness);
+ break;
+ case "uint16be":
+ this.writeUint16(t, o.BIG_ENDIAN);
+ break;
+ case "int16be":
+ this.writeInt16(t, o.BIG_ENDIAN);
+ break;
+ case "uint32be":
+ this.writeUint32(t, o.BIG_ENDIAN);
+ break;
+ case "int32be":
+ this.writeInt32(t, o.BIG_ENDIAN);
+ break;
+ case "float32be":
+ this.writeFloat32(t, o.BIG_ENDIAN);
+ break;
+ case "float64be":
+ this.writeFloat64(t, o.BIG_ENDIAN);
+ break;
+ case "uint16le":
+ this.writeUint16(t, o.LITTLE_ENDIAN);
+ break;
+ case "int16le":
+ this.writeInt16(t, o.LITTLE_ENDIAN);
+ break;
+ case "uint32le":
+ this.writeUint32(t, o.LITTLE_ENDIAN);
+ break;
+ case "int32le":
+ this.writeInt32(t, o.LITTLE_ENDIAN);
+ break;
+ case "float32le":
+ this.writeFloat32(t, o.LITTLE_ENDIAN);
+ break;
+ case "float64le":
+ this.writeFloat64(t, o.LITTLE_ENDIAN);
+ break;
+ case "cstring":
+ this.writeCString(t, r);
+ break;
+ case "string":
+ this.writeString(t, a, r);
+ break;
+ case "u16string":
+ this.writeUCS2String(t, this.endianness, r);
+ break;
+ case "u16stringle":
+ this.writeUCS2String(t, o.LITTLE_ENDIAN, r);
+ break;
+ case "u16stringbe":
+ this.writeUCS2String(t, o.BIG_ENDIAN, r);
+ break;
+ default:
+ if (3 == e.length) {
+ for (var u = e[1], l = 0; l < t.length; l++) this.writeType(u, t[l]);
+ break
+ }
+ this.writeStruct(e, t)
+ }
+ null != r && (this.position = s, this._realloc(r), this.position = s + r)
+ }, o.prototype.writeUint64 = function(e) {
+ var t = Math.floor(e / u);
+ this.writeUint32(t), this.writeUint32(4294967295 & e)
+ }, o.prototype.writeUint24 = function(e) {
+ this.writeUint8((16711680 & e) >> 16), this.writeUint8((65280 & e) >> 8), this.writeUint8(255 & e)
+ }, o.prototype.adjustUint32 = function(e, t) {
+ var i = this.position;
+ this.seek(e), this.writeUint32(t), this.seek(i)
+ }, o.prototype.mapInt32Array = function(e, t) {
+ this._realloc(4 * e);
+ var i = new Int32Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 4 * e, i
+ }, o.prototype.mapInt16Array = function(e, t) {
+ this._realloc(2 * e);
+ var i = new Int16Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 2 * e, i
+ }, o.prototype.mapInt8Array = function(e) {
+ this._realloc(1 * e);
+ var t = new Int8Array(this._buffer, this.byteOffset + this.position, e);
+ return this.position += 1 * e, t
+ }, o.prototype.mapUint32Array = function(e, t) {
+ this._realloc(4 * e);
+ var i = new Uint32Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 4 * e, i
+ }, o.prototype.mapUint16Array = function(e, t) {
+ this._realloc(2 * e);
+ var i = new Uint16Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 2 * e, i
+ }, o.prototype.mapFloat64Array = function(e, t) {
+ this._realloc(8 * e);
+ var i = new Float64Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 8 * e, i
+ }, o.prototype.mapFloat32Array = function(e, t) {
+ this._realloc(4 * e);
+ var i = new Float32Array(this._buffer, this.byteOffset + this.position, e);
+ return o.arrayToNative(i, null == t ? this.endianness : t), this.position += 4 * e, i
+ };
+ var l = function(e) {
+ this.buffers = [], this.bufferIndex = -1, e && (this.insertBuffer(e), this.bufferIndex = 0)
+ };
+ (l.prototype = new o(new ArrayBuffer, 0, o.BIG_ENDIAN)).initialized = function() {
+ var e;
+ return this.bufferIndex > -1 || (this.buffers.length > 0 ? 0 === (e = this.buffers[0]).fileStart ? (this.buffer = e, this.bufferIndex = 0, a.debug("MultiBufferStream", "Stream ready for parsing"), !0) : (a.warn("MultiBufferStream", "The first buffer should have a fileStart of 0"), this.logBufferLevel(), !1) : (a.warn("MultiBufferStream", "No buffer to start parsing from"), this.logBufferLevel(), !1))
+ }, ArrayBuffer.concat = function(e, t) {
+ a.debug("ArrayBuffer", "Trying to create a new buffer of size: " + (e.byteLength + t.byteLength));
+ var i = new Uint8Array(e.byteLength + t.byteLength);
+ return i.set(new Uint8Array(e), 0), i.set(new Uint8Array(t), e.byteLength), i.buffer
+ }, l.prototype.reduceBuffer = function(e, t, i) {
+ var n;
+ return (n = new Uint8Array(i)).set(new Uint8Array(e, t, i)), n.buffer.fileStart = e.fileStart + t, n.buffer.usedBytes = 0, n.buffer
+ }, l.prototype.insertBuffer = function(e) {
+ for (var t = !0, i = 0; i < this.buffers.length; i++) {
+ var n = this.buffers[i];
+ if (e.fileStart <= n.fileStart) {
+ if (e.fileStart === n.fileStart) {
+ if (e.byteLength > n.byteLength) {
+ this.buffers.splice(i, 1), i--;
+ continue
+ }
+ a.warn("MultiBufferStream", "Buffer (fileStart: " + e.fileStart + " - Length: " + e.byteLength + ") already appended, ignoring")
+ } else e.fileStart + e.byteLength <= n.fileStart || (e = this.reduceBuffer(e, 0, n.fileStart - e.fileStart)), a.debug("MultiBufferStream", "Appending new buffer (fileStart: " + e.fileStart + " - Length: " + e.byteLength + ")"), this.buffers.splice(i, 0, e), 0 === i && (this.buffer = e);
+ t = !1;
+ break
+ }
+ if (e.fileStart < n.fileStart + n.byteLength) {
+ var r = n.fileStart + n.byteLength - e.fileStart,
+ s = e.byteLength - r;
+ if (!(s > 0)) {
+ t = !1;
+ break
+ }
+ e = this.reduceBuffer(e, r, s)
+ }
+ }
+ t && (a.debug("MultiBufferStream", "Appending new buffer (fileStart: " + e.fileStart + " - Length: " + e.byteLength + ")"), this.buffers.push(e), 0 === i && (this.buffer = e))
+ }, l.prototype.logBufferLevel = function(e) {
+ var t, i, n, r, s, o = [],
+ u = "";
+ for (n = 0, r = 0, t = 0; t < this.buffers.length; t++) i = this.buffers[t], 0 === t ? (s = {}, o.push(s), s.start = i.fileStart, s.end = i.fileStart + i.byteLength, u += "[" + s.start + "-") : s.end === i.fileStart ? s.end = i.fileStart + i.byteLength : ((s = {}).start = i.fileStart, u += o[o.length - 1].end - 1 + "], [" + s.start + "-", s.end = i.fileStart + i.byteLength, o.push(s)), n += i.usedBytes, r += i.byteLength;
+ o.length > 0 && (u += s.end - 1 + "]");
+ var l = e ? a.info : a.debug;
+ 0 === this.buffers.length ? l("MultiBufferStream", "No more buffer in memory") : l("MultiBufferStream", this.buffers.length + " stored buffer(s) (" + n + "/" + r + " bytes): " + u)
+ }, l.prototype.cleanBuffers = function() {
+ var e, t;
+ for (e = 0; e < this.buffers.length; e++)(t = this.buffers[e]).usedBytes === t.byteLength && (a.debug("MultiBufferStream", "Removing buffer #" + e), this.buffers.splice(e, 1), e--)
+ }, l.prototype.mergeNextBuffer = function() {
+ var e;
+ if (this.bufferIndex + 1 < this.buffers.length) {
+ if ((e = this.buffers[this.bufferIndex + 1]).fileStart === this.buffer.fileStart + this.buffer.byteLength) {
+ var t = this.buffer.byteLength,
+ i = this.buffer.usedBytes,
+ n = this.buffer.fileStart;
+ return this.buffers[this.bufferIndex] = ArrayBuffer.concat(this.buffer, e), this.buffer = this.buffers[this.bufferIndex], this.buffers.splice(this.bufferIndex + 1, 1), this.buffer.usedBytes = i, this.buffer.fileStart = n, a.debug("ISOFile", "Concatenating buffer for box parsing (length: " + t + "->" + this.buffer.byteLength + ")"), !0
+ }
+ return !1
+ }
+ return !1
+ }, l.prototype.findPosition = function(e, t, i) {
+ var n, r = null,
+ s = -1;
+ for (n = !0 === e ? 0 : this.bufferIndex; n < this.buffers.length && (r = this.buffers[n]).fileStart <= t;) s = n, i && (r.fileStart + r.byteLength <= t ? r.usedBytes = r.byteLength : r.usedBytes = t - r.fileStart, this.logBufferLevel()), n++;
+ return -1 !== s && (r = this.buffers[s]).fileStart + r.byteLength >= t ? (a.debug("MultiBufferStream", "Found position in existing buffer #" + s), s) : -1
+ }, l.prototype.findEndContiguousBuf = function(e) {
+ var t, i, n, r = void 0 !== e ? e : this.bufferIndex;
+ if (i = this.buffers[r], this.buffers.length > r + 1)
+ for (t = r + 1; t < this.buffers.length && (n = this.buffers[t]).fileStart === i.fileStart + i.byteLength; t++) i = n;
+ return i.fileStart + i.byteLength
+ }, l.prototype.getEndFilePositionAfter = function(e) {
+ var t = this.findPosition(!0, e, !1);
+ return -1 !== t ? this.findEndContiguousBuf(t) : e
+ }, l.prototype.addUsedBytes = function(e) {
+ this.buffer.usedBytes += e, this.logBufferLevel()
+ }, l.prototype.setAllUsedBytes = function() {
+ this.buffer.usedBytes = this.buffer.byteLength, this.logBufferLevel()
+ }, l.prototype.seek = function(e, t, i) {
+ var n;
+ return -1 !== (n = this.findPosition(t, e, i)) ? (this.buffer = this.buffers[n], this.bufferIndex = n, this.position = e - this.buffer.fileStart, a.debug("MultiBufferStream", "Repositioning parser at buffer position: " + this.position), !0) : (a.debug("MultiBufferStream", "Position " + e + " not found in buffered data"), !1)
+ }, l.prototype.getPosition = function() {
+ if (-1 === this.bufferIndex || null === this.buffers[this.bufferIndex]) throw "Error accessing position in the MultiBufferStream";
+ return this.buffers[this.bufferIndex].fileStart + this.position
+ }, l.prototype.getLength = function() {
+ return this.byteLength
+ }, l.prototype.getEndPosition = function() {
+ if (-1 === this.bufferIndex || null === this.buffers[this.bufferIndex]) throw "Error accessing position in the MultiBufferStream";
+ return this.buffers[this.bufferIndex].fileStart + this.byteLength
+ }, void 0 !== i && (i.MultiBufferStream = l);
+ var h = function() {
+ var e = [];
+ e[3] = "ES_Descriptor", e[4] = "DecoderConfigDescriptor", e[5] = "DecoderSpecificInfo", e[6] = "SLConfigDescriptor", this.getDescriptorName = function(t) {
+ return e[t]
+ };
+ var t = this,
+ i = {};
+ return this.parseOneDescriptor = function(t) {
+ var n, r, s, o = 0;
+ for (n = t.readUint8(), s = t.readUint8(); 128 & s;) o = (127 & s) << 7, s = t.readUint8();
+ return o += 127 & s, a.debug("MPEG4DescriptorParser", "Found " + (e[n] || "Descriptor " + n) + ", size " + o + " at position " + t.getPosition()), (r = e[n] ? new i[e[n]](o) : new i.Descriptor(o)).parse(t), r
+ }, i.Descriptor = function(e, t) {
+ this.tag = e, this.size = t, this.descs = []
+ }, i.Descriptor.prototype.parse = function(e) {
+ this.data = e.readUint8Array(this.size)
+ }, i.Descriptor.prototype.findDescriptor = function(e) {
+ for (var t = 0; t < this.descs.length; t++)
+ if (this.descs[t].tag == e) return this.descs[t];
+ return null
+ }, i.Descriptor.prototype.parseRemainingDescriptors = function(e) {
+ for (var i = e.position; e.position < i + this.size;) {
+ var n = t.parseOneDescriptor(e);
+ this.descs.push(n)
+ }
+ }, i.ES_Descriptor = function(e) {
+ i.Descriptor.call(this, 3, e)
+ }, i.ES_Descriptor.prototype = new i.Descriptor, i.ES_Descriptor.prototype.parse = function(e) {
+ if (this.ES_ID = e.readUint16(), this.flags = e.readUint8(), this.size -= 3, 128 & this.flags ? (this.dependsOn_ES_ID = e.readUint16(), this.size -= 2) : this.dependsOn_ES_ID = 0, 64 & this.flags) {
+ var t = e.readUint8();
+ this.URL = e.readString(t), this.size -= t + 1
+ } else this.URL = "";
+ 32 & this.flags ? (this.OCR_ES_ID = e.readUint16(), this.size -= 2) : this.OCR_ES_ID = 0, this.parseRemainingDescriptors(e)
+ }, i.ES_Descriptor.prototype.getOTI = function(e) {
+ var t = this.findDescriptor(4);
+ return t ? t.oti : 0
+ }, i.ES_Descriptor.prototype.getAudioConfig = function(e) {
+ var t = this.findDescriptor(4);
+ if (!t) return null;
+ var i = t.findDescriptor(5);
+ if (i && i.data) {
+ var n = (248 & i.data[0]) >> 3;
+ return 31 === n && i.data.length >= 2 && (n = 32 + ((7 & i.data[0]) << 3) + ((224 & i.data[1]) >> 5)), n
+ }
+ return null
+ }, i.DecoderConfigDescriptor = function(e) {
+ i.Descriptor.call(this, 4, e)
+ }, i.DecoderConfigDescriptor.prototype = new i.Descriptor, i.DecoderConfigDescriptor.prototype.parse = function(e) {
+ this.oti = e.readUint8(), this.streamType = e.readUint8(), this.bufferSize = e.readUint24(), this.maxBitrate = e.readUint32(), this.avgBitrate = e.readUint32(), this.size -= 13, this.parseRemainingDescriptors(e)
+ }, i.DecoderSpecificInfo = function(e) {
+ i.Descriptor.call(this, 5, e)
+ }, i.DecoderSpecificInfo.prototype = new i.Descriptor, i.SLConfigDescriptor = function(e) {
+ i.Descriptor.call(this, 6, e)
+ }, i.SLConfigDescriptor.prototype = new i.Descriptor, this
+ };
+ void 0 !== i && (i.MPEG4DescriptorParser = h);
+ var d = {
+ ERR_INVALID_DATA: -1,
+ ERR_NOT_ENOUGH_DATA: 0,
+ OK: 1,
+ BASIC_BOXES: ["mdat", "idat", "free", "skip", "meco", "strk"],
+ FULL_BOXES: ["hmhd", "nmhd", "iods", "xml ", "bxml", "ipro", "mere"],
+ CONTAINER_BOXES: [
+ ["moov", ["trak", "pssh"]],
+ ["trak"],
+ ["edts"],
+ ["mdia"],
+ ["minf"],
+ ["dinf"],
+ ["stbl", ["sgpd", "sbgp"]],
+ ["mvex", ["trex"]],
+ ["moof", ["traf"]],
+ ["traf", ["trun", "sgpd", "sbgp"]],
+ ["vttc"],
+ ["tref"],
+ ["iref"],
+ ["mfra", ["tfra"]],
+ ["meco"],
+ ["hnti"],
+ ["hinf"],
+ ["strk"],
+ ["strd"],
+ ["sinf"],
+ ["rinf"],
+ ["schi"],
+ ["trgr"],
+ ["udta", ["kind"]],
+ ["iprp", ["ipma"]],
+ ["ipco"]
+ ],
+ boxCodes: [],
+ fullBoxCodes: [],
+ containerBoxCodes: [],
+ sampleEntryCodes: {},
+ sampleGroupEntryCodes: [],
+ trackGroupTypes: [],
+ UUIDBoxes: {},
+ UUIDs: [],
+ initialize: function() {
+ d.FullBox.prototype = new d.Box, d.ContainerBox.prototype = new d.Box, d.SampleEntry.prototype = new d.Box, d.TrackGroupTypeBox.prototype = new d.FullBox, d.BASIC_BOXES.forEach((function(e) {
+ d.createBoxCtor(e)
+ })), d.FULL_BOXES.forEach((function(e) {
+ d.createFullBoxCtor(e)
+ })), d.CONTAINER_BOXES.forEach((function(e) {
+ d.createContainerBoxCtor(e[0], null, e[1])
+ }))
+ },
+ Box: function(e, t, i) {
+ this.type = e, this.size = t, this.uuid = i
+ },
+ FullBox: function(e, t, i) {
+ d.Box.call(this, e, t, i), this.flags = 0, this.version = 0
+ },
+ ContainerBox: function(e, t, i) {
+ d.Box.call(this, e, t, i), this.boxes = []
+ },
+ SampleEntry: function(e, t, i, n) {
+ d.ContainerBox.call(this, e, t), this.hdr_size = i, this.start = n
+ },
+ SampleGroupEntry: function(e) {
+ this.grouping_type = e
+ },
+ TrackGroupTypeBox: function(e, t) {
+ d.FullBox.call(this, e, t)
+ },
+ createBoxCtor: function(e, t) {
+ d.boxCodes.push(e), d[e + "Box"] = function(t) {
+ d.Box.call(this, e, t)
+ }, d[e + "Box"].prototype = new d.Box, t && (d[e + "Box"].prototype.parse = t)
+ },
+ createFullBoxCtor: function(e, t) {
+ d[e + "Box"] = function(t) {
+ d.FullBox.call(this, e, t)
+ }, d[e + "Box"].prototype = new d.FullBox, d[e + "Box"].prototype.parse = function(e) {
+ this.parseFullHeader(e), t && t.call(this, e)
+ }
+ },
+ addSubBoxArrays: function(e) {
+ if (e) {
+ this.subBoxNames = e;
+ for (var t = e.length, i = 0; i < t; i++) this[e[i] + "s"] = []
+ }
+ },
+ createContainerBoxCtor: function(e, t, i) {
+ d[e + "Box"] = function(t) {
+ d.ContainerBox.call(this, e, t), d.addSubBoxArrays.call(this, i)
+ }, d[e + "Box"].prototype = new d.ContainerBox, t && (d[e + "Box"].prototype.parse = t)
+ },
+ createMediaSampleEntryCtor: function(e, t, i) {
+ d.sampleEntryCodes[e] = [], d[e + "SampleEntry"] = function(e, t) {
+ d.SampleEntry.call(this, e, t), d.addSubBoxArrays.call(this, i)
+ }, d[e + "SampleEntry"].prototype = new d.SampleEntry, t && (d[e + "SampleEntry"].prototype.parse = t)
+ },
+ createSampleEntryCtor: function(e, t, i, n) {
+ d.sampleEntryCodes[e].push(t), d[t + "SampleEntry"] = function(i) {
+ d[e + "SampleEntry"].call(this, t, i), d.addSubBoxArrays.call(this, n)
+ }, d[t + "SampleEntry"].prototype = new d[e + "SampleEntry"], i && (d[t + "SampleEntry"].prototype.parse = i)
+ },
+ createEncryptedSampleEntryCtor: function(e, t, i) {
+ d.createSampleEntryCtor.call(this, e, t, i, ["sinf"])
+ },
+ createSampleGroupCtor: function(e, t) {
+ d[e + "SampleGroupEntry"] = function(t) {
+ d.SampleGroupEntry.call(this, e, t)
+ }, d[e + "SampleGroupEntry"].prototype = new d.SampleGroupEntry, t && (d[e + "SampleGroupEntry"].prototype.parse = t)
+ },
+ createTrackGroupCtor: function(e, t) {
+ d[e + "TrackGroupTypeBox"] = function(t) {
+ d.TrackGroupTypeBox.call(this, e, t)
+ }, d[e + "TrackGroupTypeBox"].prototype = new d.TrackGroupTypeBox, t && (d[e + "TrackGroupTypeBox"].prototype.parse = t)
+ },
+ createUUIDBox: function(e, t, i, n) {
+ d.UUIDs.push(e), d.UUIDBoxes[e] = function(n) {
+ t ? d.FullBox.call(this, "uuid", n, e) : i ? d.ContainerBox.call(this, "uuid", n, e) : d.Box.call(this, "uuid", n, e)
+ }, d.UUIDBoxes[e].prototype = t ? new d.FullBox : i ? new d.ContainerBox : new d.Box, n && (d.UUIDBoxes[e].prototype.parse = t ? function(e) {
+ this.parseFullHeader(e), n && n.call(this, e)
+ } : n)
+ }
+ };
+ d.initialize(), d.TKHD_FLAG_ENABLED = 1, d.TKHD_FLAG_IN_MOVIE = 2, d.TKHD_FLAG_IN_PREVIEW = 4, d.TFHD_FLAG_BASE_DATA_OFFSET = 1, d.TFHD_FLAG_SAMPLE_DESC = 2, d.TFHD_FLAG_SAMPLE_DUR = 8, d.TFHD_FLAG_SAMPLE_SIZE = 16, d.TFHD_FLAG_SAMPLE_FLAGS = 32, d.TFHD_FLAG_DUR_EMPTY = 65536, d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF = 131072, d.TRUN_FLAGS_DATA_OFFSET = 1, d.TRUN_FLAGS_FIRST_FLAG = 4, d.TRUN_FLAGS_DURATION = 256, d.TRUN_FLAGS_SIZE = 512, d.TRUN_FLAGS_FLAGS = 1024, d.TRUN_FLAGS_CTS_OFFSET = 2048, d.Box.prototype.add = function(e) {
+ return this.addBox(new d[e + "Box"])
+ }, d.Box.prototype.addBox = function(e) {
+ return this.boxes.push(e), this[e.type + "s"] ? this[e.type + "s"].push(e) : this[e.type] = e, e
+ }, d.Box.prototype.set = function(e, t) {
+ return this[e] = t, this
+ }, d.Box.prototype.addEntry = function(e, t) {
+ var i = t || "entries";
+ return this[i] || (this[i] = []), this[i].push(e), this
+ }, void 0 !== i && (i.BoxParser = d), d.parseUUID = function(e) {
+ return d.parseHex16(e)
+ }, d.parseHex16 = function(e) {
+ for (var t = "", i = 0; i < 16; i++) {
+ var n = e.readUint8().toString(16);
+ t += 1 === n.length ? "0" + n : n
+ }
+ return t
+ }, d.parseOneBox = function(e, t, i) {
+ var n, r, s, o = e.getPosition(),
+ u = 0;
+ if (e.getEndPosition() - o < 8) return a.debug("BoxParser", "Not enough data in stream to parse the type and size of the box"), {
+ code: d.ERR_NOT_ENOUGH_DATA
+ };
+ if (i && i < 8) return a.debug("BoxParser", "Not enough bytes left in the parent box to parse a new box"), {
+ code: d.ERR_NOT_ENOUGH_DATA
+ };
+ var l = e.readUint32(),
+ h = e.readString(4),
+ c = h;
+ if (a.debug("BoxParser", "Found box of type '" + h + "' and size " + l + " at position " + o), u = 8, "uuid" == h) {
+ if (e.getEndPosition() - e.getPosition() < 16 || i - u < 16) return e.seek(o), a.debug("BoxParser", "Not enough bytes left in the parent box to parse a UUID box"), {
+ code: d.ERR_NOT_ENOUGH_DATA
+ };
+ u += 16, c = s = d.parseUUID(e)
+ }
+ if (1 == l) {
+ if (e.getEndPosition() - e.getPosition() < 8 || i && i - u < 8) return e.seek(o), a.warn("BoxParser", 'Not enough data in stream to parse the extended size of the "' + h + '" box'), {
+ code: d.ERR_NOT_ENOUGH_DATA
+ };
+ l = e.readUint64(), u += 8
+ } else if (0 === l)
+ if (i) l = i;
+ else if ("mdat" !== h) return a.error("BoxParser", "Unlimited box size not supported for type: '" + h + "'"), n = new d.Box(h, l), {
+ code: d.OK,
+ box: n,
+ size: n.size
+ };
+ return l < u ? (a.error("BoxParser", "Box of type " + h + " has an invalid size " + l + " (too small to be a box)"), {
+ code: d.ERR_NOT_ENOUGH_DATA,
+ type: h,
+ size: l,
+ hdr_size: u,
+ start: o
+ }) : i && l > i ? (a.error("BoxParser", "Box of type '" + h + "' has a size " + l + " greater than its container size " + i), {
+ code: d.ERR_NOT_ENOUGH_DATA,
+ type: h,
+ size: l,
+ hdr_size: u,
+ start: o
+ }) : o + l > e.getEndPosition() ? (e.seek(o), a.info("BoxParser", "Not enough data in stream to parse the entire '" + h + "' box"), {
+ code: d.ERR_NOT_ENOUGH_DATA,
+ type: h,
+ size: l,
+ hdr_size: u,
+ start: o
+ }) : t ? {
+ code: d.OK,
+ type: h,
+ size: l,
+ hdr_size: u,
+ start: o
+ } : (d[h + "Box"] ? n = new d[h + "Box"](l) : "uuid" !== h ? (a.warn("BoxParser", "Unknown box type: '" + h + "'"), (n = new d.Box(h, l)).has_unparsed_data = !0) : d.UUIDBoxes[s] ? n = new d.UUIDBoxes[s](l) : (a.warn("BoxParser", "Unknown uuid type: '" + s + "'"), (n = new d.Box(h, l)).uuid = s, n.has_unparsed_data = !0), n.hdr_size = u, n.start = o, n.write === d.Box.prototype.write && "mdat" !== n.type && (a.info("BoxParser", "'" + c + "' box writing not yet implemented, keeping unparsed data in memory for later write"), n.parseDataAndRewind(e)), n.parse(e), (r = e.getPosition() - (n.start + n.size)) < 0 ? (a.warn("BoxParser", "Parsing of box '" + c + "' did not read the entire indicated box data size (missing " + -r + " bytes), seeking forward"), e.seek(n.start + n.size)) : r > 0 && (a.error("BoxParser", "Parsing of box '" + c + "' read " + r + " more bytes than the indicated box data size, seeking backwards"), e.seek(n.start + n.size)), {
+ code: d.OK,
+ box: n,
+ size: n.size
+ })
+ }, d.Box.prototype.parse = function(e) {
+ "mdat" != this.type ? this.data = e.readUint8Array(this.size - this.hdr_size) : 0 === this.size ? e.seek(e.getEndPosition()) : e.seek(this.start + this.size)
+ }, d.Box.prototype.parseDataAndRewind = function(e) {
+ this.data = e.readUint8Array(this.size - this.hdr_size), e.position -= this.size - this.hdr_size
+ }, d.FullBox.prototype.parseDataAndRewind = function(e) {
+ this.parseFullHeader(e), this.data = e.readUint8Array(this.size - this.hdr_size), this.hdr_size -= 4, e.position -= this.size - this.hdr_size
+ }, d.FullBox.prototype.parseFullHeader = function(e) {
+ this.version = e.readUint8(), this.flags = e.readUint24(), this.hdr_size += 4
+ }, d.FullBox.prototype.parse = function(e) {
+ this.parseFullHeader(e), this.data = e.readUint8Array(this.size - this.hdr_size)
+ }, d.ContainerBox.prototype.parse = function(e) {
+ for (var t, i; e.getPosition() < this.start + this.size;) {
+ if ((t = d.parseOneBox(e, !1, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ if (i = t.box, this.boxes.push(i), this.subBoxNames && -1 != this.subBoxNames.indexOf(i.type)) this[this.subBoxNames[this.subBoxNames.indexOf(i.type)] + "s"].push(i);
+ else {
+ var n = "uuid" !== i.type ? i.type : i.uuid;
+ this[n] ? a.warn("Box of type " + n + " already stored in field of this type") : this[n] = i
+ }
+ }
+ }, d.Box.prototype.parseLanguage = function(e) {
+ this.language = e.readUint16();
+ var t = [];
+ t[0] = this.language >> 10 & 31, t[1] = this.language >> 5 & 31, t[2] = 31 & this.language, this.languageString = String.fromCharCode(t[0] + 96, t[1] + 96, t[2] + 96)
+ }, d.SAMPLE_ENTRY_TYPE_VISUAL = "Visual", d.SAMPLE_ENTRY_TYPE_AUDIO = "Audio", d.SAMPLE_ENTRY_TYPE_HINT = "Hint", d.SAMPLE_ENTRY_TYPE_METADATA = "Metadata", d.SAMPLE_ENTRY_TYPE_SUBTITLE = "Subtitle", d.SAMPLE_ENTRY_TYPE_SYSTEM = "System", d.SAMPLE_ENTRY_TYPE_TEXT = "Text", d.SampleEntry.prototype.parseHeader = function(e) {
+ e.readUint8Array(6), this.data_reference_index = e.readUint16(), this.hdr_size += 8
+ }, d.SampleEntry.prototype.parse = function(e) {
+ this.parseHeader(e), this.data = e.readUint8Array(this.size - this.hdr_size)
+ }, d.SampleEntry.prototype.parseDataAndRewind = function(e) {
+ this.parseHeader(e), this.data = e.readUint8Array(this.size - this.hdr_size), this.hdr_size -= 8, e.position -= this.size - this.hdr_size
+ }, d.SampleEntry.prototype.parseFooter = function(e) {
+ d.ContainerBox.prototype.parse.call(this, e)
+ }, d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_HINT), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, (function(e) {
+ var t;
+ this.parseHeader(e), e.readUint16(), e.readUint16(), e.readUint32Array(3), this.width = e.readUint16(), this.height = e.readUint16(), this.horizresolution = e.readUint32(), this.vertresolution = e.readUint32(), e.readUint32(), this.frame_count = e.readUint16(), t = Math.min(31, e.readUint8()), this.compressorname = e.readString(t), t < 31 && e.readString(31 - t), this.depth = e.readUint16(), e.readUint16(), this.parseFooter(e)
+ })), d.createMediaSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO, (function(e) {
+ this.parseHeader(e), e.readUint32Array(2), this.channel_count = e.readUint16(), this.samplesize = e.readUint16(), e.readUint16(), e.readUint16(), this.samplerate = e.readUint32() / 65536, this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "avc1"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "avc2"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "avc3"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "avc4"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "av01"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "hvc1"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "hev1"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO, "mp4a"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO, "ac-3"), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO, "ec-3"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_VISUAL, "encv"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_AUDIO, "enca"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE, "encu"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SYSTEM, "encs"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_TEXT, "enct"), d.createEncryptedSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA, "encm"), d.createBoxCtor("av1C", (function(e) {
+ var t = e.readUint8();
+ if (t >> 7 & !1) a.error("av1C marker problem");
+ else if (this.version = 127 & t, 1 === this.version)
+ if (t = e.readUint8(), this.seq_profile = t >> 5 & 7, this.seq_level_idx_0 = 31 & t, t = e.readUint8(), this.seq_tier_0 = t >> 7 & 1, this.high_bitdepth = t >> 6 & 1, this.twelve_bit = t >> 5 & 1, this.monochrome = t >> 4 & 1, this.chroma_subsampling_x = t >> 3 & 1, this.chroma_subsampling_y = t >> 2 & 1, this.chroma_sample_position = 3 & t, t = e.readUint8(), this.reserved_1 = t >> 5 & 7, 0 === this.reserved_1) {
+ if (this.initial_presentation_delay_present = t >> 4 & 1, 1 === this.initial_presentation_delay_present) this.initial_presentation_delay_minus_one = 15 & t;
+ else if (this.reserved_2 = 15 & t, 0 !== this.reserved_2) return void a.error("av1C reserved_2 parsing problem");
+ var i = this.size - this.hdr_size - 4;
+ this.configOBUs = e.readUint8Array(i)
+ } else a.error("av1C reserved_1 parsing problem");
+ else a.error("av1C version " + this.version + " not supported")
+ })), d.createBoxCtor("avcC", (function(e) {
+ var t, i;
+ for (this.configurationVersion = e.readUint8(), this.AVCProfileIndication = e.readUint8(), this.profile_compatibility = e.readUint8(), this.AVCLevelIndication = e.readUint8(), this.lengthSizeMinusOne = 3 & e.readUint8(), this.nb_SPS_nalus = 31 & e.readUint8(), i = this.size - this.hdr_size - 6, this.SPS = [], t = 0; t < this.nb_SPS_nalus; t++) this.SPS[t] = {}, this.SPS[t].length = e.readUint16(), this.SPS[t].nalu = e.readUint8Array(this.SPS[t].length), i -= 2 + this.SPS[t].length;
+ for (this.nb_PPS_nalus = e.readUint8(), i--, this.PPS = [], t = 0; t < this.nb_PPS_nalus; t++) this.PPS[t] = {}, this.PPS[t].length = e.readUint16(), this.PPS[t].nalu = e.readUint8Array(this.PPS[t].length), i -= 2 + this.PPS[t].length;
+ i > 0 && (this.ext = e.readUint8Array(i))
+ })), d.createBoxCtor("btrt", (function(e) {
+ this.bufferSizeDB = e.readUint32(), this.maxBitrate = e.readUint32(), this.avgBitrate = e.readUint32()
+ })), d.createBoxCtor("clap", (function(e) {
+ this.cleanApertureWidthN = e.readUint32(), this.cleanApertureWidthD = e.readUint32(), this.cleanApertureHeightN = e.readUint32(), this.cleanApertureHeightD = e.readUint32(), this.horizOffN = e.readUint32(), this.horizOffD = e.readUint32(), this.vertOffN = e.readUint32(), this.vertOffD = e.readUint32()
+ })), d.createBoxCtor("clli", (function(e) {
+ this.max_content_light_level = e.readUint16(), this.max_pic_average_light_level = e.readUint16()
+ })), d.createFullBoxCtor("co64", (function(e) {
+ var t, i;
+ if (t = e.readUint32(), this.chunk_offsets = [], 0 === this.version)
+ for (i = 0; i < t; i++) this.chunk_offsets.push(e.readUint64())
+ })), d.createFullBoxCtor("CoLL", (function(e) {
+ this.maxCLL = e.readUint16(), this.maxFALL = e.readUint16()
+ })), d.createBoxCtor("colr", (function(e) {
+ if (this.colour_type = e.readString(4), "nclx" === this.colour_type) {
+ this.colour_primaries = e.readUint16(), this.transfer_characteristics = e.readUint16(), this.matrix_coefficients = e.readUint16();
+ var t = e.readUint8();
+ this.full_range_flag = t >> 7
+ } else("rICC" === this.colour_type || "prof" === this.colour_type) && (this.ICC_profile = e.readUint8Array(this.size - 4))
+ })), d.createFullBoxCtor("cprt", (function(e) {
+ this.parseLanguage(e), this.notice = e.readCString()
+ })), d.createFullBoxCtor("cslg", (function(e) {
+ 0 === this.version && (this.compositionToDTSShift = e.readInt32(), this.leastDecodeToDisplayDelta = e.readInt32(), this.greatestDecodeToDisplayDelta = e.readInt32(), this.compositionStartTime = e.readInt32(), this.compositionEndTime = e.readInt32())
+ })), d.createFullBoxCtor("ctts", (function(e) {
+ var t, i;
+ if (t = e.readUint32(), this.sample_counts = [], this.sample_offsets = [], 0 === this.version)
+ for (i = 0; i < t; i++) {
+ this.sample_counts.push(e.readUint32());
+ var n = e.readInt32();
+ n < 0 && a.warn("BoxParser", "ctts box uses negative values without using version 1"), this.sample_offsets.push(n)
+ } else if (1 == this.version)
+ for (i = 0; i < t; i++) this.sample_counts.push(e.readUint32()), this.sample_offsets.push(e.readInt32())
+ })), d.createBoxCtor("dac3", (function(e) {
+ var t = e.readUint8(),
+ i = e.readUint8(),
+ n = e.readUint8();
+ this.fscod = t >> 6, this.bsid = t >> 1 & 31, this.bsmod = (1 & t) << 2 | i >> 6 & 3, this.acmod = i >> 3 & 7, this.lfeon = i >> 2 & 1, this.bit_rate_code = 3 & i | n >> 5 & 7
+ })), d.createBoxCtor("dec3", (function(e) {
+ var t = e.readUint16();
+ this.data_rate = t >> 3, this.num_ind_sub = 7 & t, this.ind_subs = [];
+ for (var i = 0; i < this.num_ind_sub + 1; i++) {
+ var n = {};
+ this.ind_subs.push(n);
+ var r = e.readUint8(),
+ a = e.readUint8(),
+ s = e.readUint8();
+ n.fscod = r >> 6, n.bsid = r >> 1 & 31, n.bsmod = (1 & r) << 4 | a >> 4 & 15, n.acmod = a >> 1 & 7, n.lfeon = 1 & a, n.num_dep_sub = s >> 1 & 15, n.num_dep_sub > 0 && (n.chan_loc = (1 & s) << 8 | e.readUint8())
+ }
+ })), d.createFullBoxCtor("dfLa", (function(e) {
+ var t = [],
+ i = ["STREAMINFO", "PADDING", "APPLICATION", "SEEKTABLE", "VORBIS_COMMENT", "CUESHEET", "PICTURE", "RESERVED"];
+ for (this.parseFullHeader(e);;) {
+ var n = e.readUint8(),
+ r = Math.min(127 & n, i.length - 1);
+ if (r ? e.readUint8Array(e.readUint24()) : (e.readUint8Array(13), this.samplerate = e.readUint32() >> 12, e.readUint8Array(20)), t.push(i[r]), 128 & n) break
+ }
+ this.numMetadataBlocks = t.length + " (" + t.join(", ") + ")"
+ })), d.createBoxCtor("dimm", (function(e) {
+ this.bytessent = e.readUint64()
+ })), d.createBoxCtor("dmax", (function(e) {
+ this.time = e.readUint32()
+ })), d.createBoxCtor("dmed", (function(e) {
+ this.bytessent = e.readUint64()
+ })), d.createFullBoxCtor("dref", (function(e) {
+ var t, i;
+ this.entries = [];
+ for (var n = e.readUint32(), r = 0; r < n; r++) {
+ if ((t = d.parseOneBox(e, !1, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ i = t.box, this.entries.push(i)
+ }
+ })), d.createBoxCtor("drep", (function(e) {
+ this.bytessent = e.readUint64()
+ })), d.createFullBoxCtor("elng", (function(e) {
+ this.extended_language = e.readString(this.size - this.hdr_size)
+ })), d.createFullBoxCtor("elst", (function(e) {
+ this.entries = [];
+ for (var t = e.readUint32(), i = 0; i < t; i++) {
+ var n = {};
+ this.entries.push(n), 1 === this.version ? (n.segment_duration = e.readUint64(), n.media_time = e.readInt64()) : (n.segment_duration = e.readUint32(), n.media_time = e.readInt32()), n.media_rate_integer = e.readInt16(), n.media_rate_fraction = e.readInt16()
+ }
+ })), d.createFullBoxCtor("emsg", (function(e) {
+ 1 == this.version ? (this.timescale = e.readUint32(), this.presentation_time = e.readUint64(), this.event_duration = e.readUint32(), this.id = e.readUint32(), this.scheme_id_uri = e.readCString(), this.value = e.readCString()) : (this.scheme_id_uri = e.readCString(), this.value = e.readCString(), this.timescale = e.readUint32(), this.presentation_time_delta = e.readUint32(), this.event_duration = e.readUint32(), this.id = e.readUint32());
+ var t = this.size - this.hdr_size - (16 + (this.scheme_id_uri.length + 1) + (this.value.length + 1));
+ 1 == this.version && (t -= 4), this.message_data = e.readUint8Array(t)
+ })), d.createFullBoxCtor("esds", (function(e) {
+ var t = e.readUint8Array(this.size - this.hdr_size);
+ if (void 0 !== h) {
+ var i = new h;
+ this.esd = i.parseOneDescriptor(new o(t.buffer, 0, o.BIG_ENDIAN))
+ }
+ })), d.createBoxCtor("fiel", (function(e) {
+ this.fieldCount = e.readUint8(), this.fieldOrdering = e.readUint8()
+ })), d.createBoxCtor("frma", (function(e) {
+ this.data_format = e.readString(4)
+ })), d.createBoxCtor("ftyp", (function(e) {
+ var t = this.size - this.hdr_size;
+ this.major_brand = e.readString(4), this.minor_version = e.readUint32(), t -= 8, this.compatible_brands = [];
+ for (var i = 0; t >= 4;) this.compatible_brands[i] = e.readString(4), t -= 4, i++
+ })), d.createFullBoxCtor("hdlr", (function(e) {
+ 0 === this.version && (e.readUint32(), this.handler = e.readString(4), e.readUint32Array(3), this.name = e.readString(this.size - this.hdr_size - 20), "\0" === this.name[this.name.length - 1] && (this.name = this.name.slice(0, -1)))
+ })), d.createBoxCtor("hvcC", (function(e) {
+ var t, i, n, r;
+ this.configurationVersion = e.readUint8(), r = e.readUint8(), this.general_profile_space = r >> 6, this.general_tier_flag = (32 & r) >> 5, this.general_profile_idc = 31 & r, this.general_profile_compatibility = e.readUint32(), this.general_constraint_indicator = e.readUint8Array(6), this.general_level_idc = e.readUint8(), this.min_spatial_segmentation_idc = 4095 & e.readUint16(), this.parallelismType = 3 & e.readUint8(), this.chroma_format_idc = 3 & e.readUint8(), this.bit_depth_luma_minus8 = 7 & e.readUint8(), this.bit_depth_chroma_minus8 = 7 & e.readUint8(), this.avgFrameRate = e.readUint16(), r = e.readUint8(), this.constantFrameRate = r >> 6, this.numTemporalLayers = (13 & r) >> 3, this.temporalIdNested = (4 & r) >> 2, this.lengthSizeMinusOne = 3 & r, this.nalu_arrays = [];
+ var a = e.readUint8();
+ for (t = 0; t < a; t++) {
+ var s = [];
+ this.nalu_arrays.push(s), r = e.readUint8(), s.completeness = (128 & r) >> 7, s.nalu_type = 63 & r;
+ var o = e.readUint16();
+ for (i = 0; i < o; i++) {
+ var u = {};
+ s.push(u), n = e.readUint16(), u.data = e.readUint8Array(n)
+ }
+ }
+ })), d.createFullBoxCtor("iinf", (function(e) {
+ var t;
+ 0 === this.version ? this.entry_count = e.readUint16() : this.entry_count = e.readUint32(), this.item_infos = [];
+ for (var i = 0; i < this.entry_count; i++) {
+ if ((t = d.parseOneBox(e, !1, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ "infe" !== t.box.type && a.error("BoxParser", "Expected 'infe' box, got " + t.box.type), this.item_infos[i] = t.box
+ }
+ })), d.createFullBoxCtor("iloc", (function(e) {
+ var t;
+ t = e.readUint8(), this.offset_size = t >> 4 & 15, this.length_size = 15 & t, t = e.readUint8(), this.base_offset_size = t >> 4 & 15, 1 === this.version || 2 === this.version ? this.index_size = 15 & t : this.index_size = 0, this.items = [];
+ var i = 0;
+ if (this.version < 2) i = e.readUint16();
+ else {
+ if (2 !== this.version) throw "version of iloc box not supported";
+ i = e.readUint32()
+ }
+ for (var n = 0; n < i; n++) {
+ var r = {};
+ if (this.items.push(r), this.version < 2) r.item_ID = e.readUint16();
+ else {
+ if (2 !== this.version) throw "version of iloc box not supported";
+ r.item_ID = e.readUint16()
+ }
+ switch (1 === this.version || 2 === this.version ? r.construction_method = 15 & e.readUint16() : r.construction_method = 0, r.data_reference_index = e.readUint16(), this.base_offset_size) {
+ case 0:
+ r.base_offset = 0;
+ break;
+ case 4:
+ r.base_offset = e.readUint32();
+ break;
+ case 8:
+ r.base_offset = e.readUint64();
+ break;
+ default:
+ throw "Error reading base offset size"
+ }
+ var a = e.readUint16();
+ r.extents = [];
+ for (var s = 0; s < a; s++) {
+ var o = {};
+ if (r.extents.push(o), 1 === this.version || 2 === this.version) switch (this.index_size) {
+ case 0:
+ o.extent_index = 0;
+ break;
+ case 4:
+ o.extent_index = e.readUint32();
+ break;
+ case 8:
+ o.extent_index = e.readUint64();
+ break;
+ default:
+ throw "Error reading extent index"
+ }
+ switch (this.offset_size) {
+ case 0:
+ o.extent_offset = 0;
+ break;
+ case 4:
+ o.extent_offset = e.readUint32();
+ break;
+ case 8:
+ o.extent_offset = e.readUint64();
+ break;
+ default:
+ throw "Error reading extent index"
+ }
+ switch (this.length_size) {
+ case 0:
+ o.extent_length = 0;
+ break;
+ case 4:
+ o.extent_length = e.readUint32();
+ break;
+ case 8:
+ o.extent_length = e.readUint64();
+ break;
+ default:
+ throw "Error reading extent index"
+ }
+ }
+ }
+ })), d.createFullBoxCtor("infe", (function(e) {
+ if (0 !== this.version && 1 !== this.version || (this.item_ID = e.readUint16(), this.item_protection_index = e.readUint16(), this.item_name = e.readCString(), this.content_type = e.readCString(), this.content_encoding = e.readCString()), 1 === this.version) return this.extension_type = e.readString(4), a.warn("BoxParser", "Cannot parse extension type"), void e.seek(this.start + this.size);
+ this.version >= 2 && (2 === this.version ? this.item_ID = e.readUint16() : 3 === this.version && (this.item_ID = e.readUint32()), this.item_protection_index = e.readUint16(), this.item_type = e.readString(4), this.item_name = e.readCString(), "mime" === this.item_type ? (this.content_type = e.readCString(), this.content_encoding = e.readCString()) : "uri " === this.item_type && (this.item_uri_type = e.readCString()))
+ })), d.createFullBoxCtor("ipma", (function(e) {
+ var t, i;
+ for (entry_count = e.readUint32(), this.associations = [], t = 0; t < entry_count; t++) {
+ var n = {};
+ this.associations.push(n), this.version < 1 ? n.id = e.readUint16() : n.id = e.readUint32();
+ var r = e.readUint8();
+ for (n.props = [], i = 0; i < r; i++) {
+ var a = e.readUint8(),
+ s = {};
+ n.props.push(s), s.essential = (128 & a) >> 7 == 1, 1 & this.flags ? s.property_index = (127 & a) << 8 | e.readUint8() : s.property_index = 127 & a
+ }
+ }
+ })), d.createFullBoxCtor("iref", (function(e) {
+ var t, i;
+ for (this.references = []; e.getPosition() < this.start + this.size;) {
+ if ((t = d.parseOneBox(e, !0, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ (i = 0 === this.version ? new d.SingleItemTypeReferenceBox(t.type, t.size, t.hdr_size, t.start) : new d.SingleItemTypeReferenceBoxLarge(t.type, t.size, t.hdr_size, t.start)).write === d.Box.prototype.write && "mdat" !== i.type && (a.warn("BoxParser", i.type + " box writing not yet implemented, keeping unparsed data in memory for later write"), i.parseDataAndRewind(e)), i.parse(e), this.references.push(i)
+ }
+ })), d.createBoxCtor("irot", (function(e) {
+ this.angle = 3 & e.readUint8()
+ })), d.createFullBoxCtor("ispe", (function(e) {
+ this.image_width = e.readUint32(), this.image_height = e.readUint32()
+ })), d.createFullBoxCtor("kind", (function(e) {
+ this.schemeURI = e.readCString(), this.value = e.readCString()
+ })), d.createFullBoxCtor("leva", (function(e) {
+ var t = e.readUint8();
+ this.levels = [];
+ for (var i = 0; i < t; i++) {
+ var n = {};
+ this.levels[i] = n, n.track_ID = e.readUint32();
+ var r = e.readUint8();
+ switch (n.padding_flag = r >> 7, n.assignment_type = 127 & r, n.assignment_type) {
+ case 0:
+ n.grouping_type = e.readString(4);
+ break;
+ case 1:
+ n.grouping_type = e.readString(4), n.grouping_type_parameter = e.readUint32();
+ break;
+ case 2:
+ case 3:
+ break;
+ case 4:
+ n.sub_track_id = e.readUint32();
+ break;
+ default:
+ a.warn("BoxParser", "Unknown leva assignement type")
+ }
+ }
+ })), d.createBoxCtor("maxr", (function(e) {
+ this.period = e.readUint32(), this.bytes = e.readUint32()
+ })), d.createBoxCtor("mdcv", (function(e) {
+ this.display_primaries = [], this.display_primaries[0] = {}, this.display_primaries[0].x = e.readUint16(), this.display_primaries[0].y = e.readUint16(), this.display_primaries[1] = {}, this.display_primaries[1].x = e.readUint16(), this.display_primaries[1].y = e.readUint16(), this.display_primaries[2] = {}, this.display_primaries[2].x = e.readUint16(), this.display_primaries[2].y = e.readUint16(), this.white_point = {}, this.white_point.x = e.readUint16(), this.white_point.y = e.readUint16(), this.max_display_mastering_luminance = e.readUint32(), this.min_display_mastering_luminance = e.readUint32()
+ })), d.createFullBoxCtor("mdhd", (function(e) {
+ 1 == this.version ? (this.creation_time = e.readUint64(), this.modification_time = e.readUint64(), this.timescale = e.readUint32(), this.duration = e.readUint64()) : (this.creation_time = e.readUint32(), this.modification_time = e.readUint32(), this.timescale = e.readUint32(), this.duration = e.readUint32()), this.parseLanguage(e), e.readUint16()
+ })), d.createFullBoxCtor("mehd", (function(e) {
+ 1 & this.flags && (a.warn("BoxParser", "mehd box incorrectly uses flags set to 1, converting version to 1"), this.version = 1), 1 == this.version ? this.fragment_duration = e.readUint64() : this.fragment_duration = e.readUint32()
+ })), d.createFullBoxCtor("meta", (function(e) {
+ this.boxes = [], d.ContainerBox.prototype.parse.call(this, e)
+ })), d.createFullBoxCtor("mfhd", (function(e) {
+ this.sequence_number = e.readUint32()
+ })), d.createFullBoxCtor("mfro", (function(e) {
+ this._size = e.readUint32()
+ })), d.createFullBoxCtor("mvhd", (function(e) {
+ 1 == this.version ? (this.creation_time = e.readUint64(), this.modification_time = e.readUint64(), this.timescale = e.readUint32(), this.duration = e.readUint64()) : (this.creation_time = e.readUint32(), this.modification_time = e.readUint32(), this.timescale = e.readUint32(), this.duration = e.readUint32()), this.rate = e.readUint32(), this.volume = e.readUint16() >> 8, e.readUint16(), e.readUint32Array(2), this.matrix = e.readUint32Array(9), e.readUint32Array(6), this.next_track_id = e.readUint32()
+ })), d.createBoxCtor("npck", (function(e) {
+ this.packetssent = e.readUint32()
+ })), d.createBoxCtor("nump", (function(e) {
+ this.packetssent = e.readUint64()
+ })), d.createFullBoxCtor("padb", (function(e) {
+ var t = e.readUint32();
+ this.padbits = [];
+ for (var i = 0; i < Math.floor((t + 1) / 2); i++) this.padbits = e.readUint8()
+ })), d.createBoxCtor("pasp", (function(e) {
+ this.hSpacing = e.readUint32(), this.vSpacing = e.readUint32()
+ })), d.createBoxCtor("payl", (function(e) {
+ this.text = e.readString(this.size - this.hdr_size)
+ })), d.createBoxCtor("payt", (function(e) {
+ this.payloadID = e.readUint32();
+ var t = e.readUint8();
+ this.rtpmap_string = e.readString(t)
+ })), d.createFullBoxCtor("pdin", (function(e) {
+ var t = (this.size - this.hdr_size) / 8;
+ this.rate = [], this.initial_delay = [];
+ for (var i = 0; i < t; i++) this.rate[i] = e.readUint32(), this.initial_delay[i] = e.readUint32()
+ })), d.createFullBoxCtor("pitm", (function(e) {
+ 0 === this.version ? this.item_id = e.readUint16() : this.item_id = e.readUint32()
+ })), d.createFullBoxCtor("pixi", (function(e) {
+ var t;
+ for (this.num_channels = e.readUint8(), this.bits_per_channels = [], t = 0; t < this.num_channels; t++) this.bits_per_channels[t] = e.readUint8()
+ })), d.createBoxCtor("pmax", (function(e) {
+ this.bytes = e.readUint32()
+ })), d.createFullBoxCtor("prft", (function(e) {
+ this.ref_track_id = e.readUint32(), this.ntp_timestamp = e.readUint64(), 0 === this.version ? this.media_time = e.readUint32() : this.media_time = e.readUint64()
+ })), d.createFullBoxCtor("pssh", (function(e) {
+ if (this.system_id = d.parseHex16(e), this.version > 0) {
+ var t = e.readUint32();
+ this.kid = [];
+ for (var i = 0; i < t; i++) this.kid[i] = d.parseHex16(e)
+ }
+ var n = e.readUint32();
+ n > 0 && (this.data = e.readUint8Array(n))
+ })), d.createFullBoxCtor("clef", (function(e) {
+ this.width = e.readUint32(), this.height = e.readUint32()
+ })), d.createFullBoxCtor("enof", (function(e) {
+ this.width = e.readUint32(), this.height = e.readUint32()
+ })), d.createFullBoxCtor("prof", (function(e) {
+ this.width = e.readUint32(), this.height = e.readUint32()
+ })), d.createContainerBoxCtor("tapt", null, ["clef", "prof", "enof"]), d.createBoxCtor("rtp ", (function(e) {
+ this.descriptionformat = e.readString(4), this.sdptext = e.readString(this.size - this.hdr_size - 4)
+ })), d.createFullBoxCtor("saio", (function(e) {
+ 1 & this.flags && (this.aux_info_type = e.readUint32(), this.aux_info_type_parameter = e.readUint32());
+ var t = e.readUint32();
+ this.offset = [];
+ for (var i = 0; i < t; i++) 0 === this.version ? this.offset[i] = e.readUint32() : this.offset[i] = e.readUint64()
+ })), d.createFullBoxCtor("saiz", (function(e) {
+ 1 & this.flags && (this.aux_info_type = e.readUint32(), this.aux_info_type_parameter = e.readUint32()), this.default_sample_info_size = e.readUint8();
+ var t = e.readUint32();
+ if (this.sample_info_size = [], 0 === this.default_sample_info_size)
+ for (var i = 0; i < t; i++) this.sample_info_size[i] = e.readUint8()
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA, "mett", (function(e) {
+ this.parseHeader(e), this.content_encoding = e.readCString(), this.mime_format = e.readCString(), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA, "metx", (function(e) {
+ this.parseHeader(e), this.content_encoding = e.readCString(), this.namespace = e.readCString(), this.schema_location = e.readCString(), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE, "sbtt", (function(e) {
+ this.parseHeader(e), this.content_encoding = e.readCString(), this.mime_format = e.readCString(), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE, "stpp", (function(e) {
+ this.parseHeader(e), this.namespace = e.readCString(), this.schema_location = e.readCString(), this.auxiliary_mime_types = e.readCString(), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE, "stxt", (function(e) {
+ this.parseHeader(e), this.content_encoding = e.readCString(), this.mime_format = e.readCString(), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_SUBTITLE, "tx3g", (function(e) {
+ this.parseHeader(e), this.displayFlags = e.readUint32(), this.horizontal_justification = e.readInt8(), this.vertical_justification = e.readInt8(), this.bg_color_rgba = e.readUint8Array(4), this.box_record = e.readInt16Array(4), this.style_record = e.readUint8Array(12), this.parseFooter(e)
+ })), d.createSampleEntryCtor(d.SAMPLE_ENTRY_TYPE_METADATA, "wvtt", (function(e) {
+ this.parseHeader(e), this.parseFooter(e)
+ })), d.createSampleGroupCtor("alst", (function(e) {
+ var t, i = e.readUint16();
+ for (this.first_output_sample = e.readUint16(), this.sample_offset = [], t = 0; t < i; t++) this.sample_offset[t] = e.readUint32();
+ var n = this.description_length - 4 - 4 * i;
+ for (this.num_output_samples = [], this.num_total_samples = [], t = 0; t < n / 4; t++) this.num_output_samples[t] = e.readUint16(), this.num_total_samples[t] = e.readUint16()
+ })), d.createSampleGroupCtor("avll", (function(e) {
+ this.layerNumber = e.readUint8(), this.accurateStatisticsFlag = e.readUint8(), this.avgBitRate = e.readUint16(), this.avgFrameRate = e.readUint16()
+ })), d.createSampleGroupCtor("avss", (function(e) {
+ this.subSequenceIdentifier = e.readUint16(), this.layerNumber = e.readUint8();
+ var t = e.readUint8();
+ this.durationFlag = t >> 7, this.avgRateFlag = t >> 6 & 1, this.durationFlag && (this.duration = e.readUint32()), this.avgRateFlag && (this.accurateStatisticsFlag = e.readUint8(), this.avgBitRate = e.readUint16(), this.avgFrameRate = e.readUint16()), this.dependency = [];
+ for (var i = e.readUint8(), n = 0; n < i; n++) {
+ var r = {};
+ this.dependency.push(r), r.subSeqDirectionFlag = e.readUint8(), r.layerNumber = e.readUint8(), r.subSequenceIdentifier = e.readUint16()
+ }
+ })), d.createSampleGroupCtor("dtrt", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("mvif", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("prol", (function(e) {
+ this.roll_distance = e.readInt16()
+ })), d.createSampleGroupCtor("rap ", (function(e) {
+ var t = e.readUint8();
+ this.num_leading_samples_known = t >> 7, this.num_leading_samples = 127 & t
+ })), d.createSampleGroupCtor("rash", (function(e) {
+ if (this.operation_point_count = e.readUint16(), this.description_length !== 2 + (1 === this.operation_point_count ? 2 : 6 * this.operation_point_count) + 9) a.warn("BoxParser", "Mismatch in " + this.grouping_type + " sample group length"), this.data = e.readUint8Array(this.description_length - 2);
+ else {
+ if (1 === this.operation_point_count) this.target_rate_share = e.readUint16();
+ else {
+ this.target_rate_share = [], this.available_bitrate = [];
+ for (var t = 0; t < this.operation_point_count; t++) this.available_bitrate[t] = e.readUint32(), this.target_rate_share[t] = e.readUint16()
+ }
+ this.maximum_bitrate = e.readUint32(), this.minimum_bitrate = e.readUint32(), this.discard_priority = e.readUint8()
+ }
+ })), d.createSampleGroupCtor("roll", (function(e) {
+ this.roll_distance = e.readInt16()
+ })), d.SampleGroupEntry.prototype.parse = function(e) {
+ a.warn("BoxParser", "Unknown Sample Group type: " + this.grouping_type), this.data = e.readUint8Array(this.description_length)
+ }, d.createSampleGroupCtor("scif", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("scnm", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("seig", (function(e) {
+ this.reserved = e.readUint8();
+ var t = e.readUint8();
+ this.crypt_byte_block = t >> 4, this.skip_byte_block = 15 & t, this.isProtected = e.readUint8(), this.Per_Sample_IV_Size = e.readUint8(), this.KID = d.parseHex16(e), this.constant_IV_size = 0, this.constant_IV = 0, 1 === this.isProtected && 0 === this.Per_Sample_IV_Size && (this.constant_IV_size = e.readUint8(), this.constant_IV = e.readUint8Array(this.constant_IV_size))
+ })), d.createSampleGroupCtor("stsa", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("sync", (function(e) {
+ var t = e.readUint8();
+ this.NAL_unit_type = 63 & t
+ })), d.createSampleGroupCtor("tele", (function(e) {
+ var t = e.readUint8();
+ this.level_independently_decodable = t >> 7
+ })), d.createSampleGroupCtor("tsas", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("tscl", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createSampleGroupCtor("vipr", (function(e) {
+ a.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed")
+ })), d.createFullBoxCtor("sbgp", (function(e) {
+ this.grouping_type = e.readString(4), 1 === this.version ? this.grouping_type_parameter = e.readUint32() : this.grouping_type_parameter = 0, this.entries = [];
+ for (var t = e.readUint32(), i = 0; i < t; i++) {
+ var n = {};
+ this.entries.push(n), n.sample_count = e.readInt32(), n.group_description_index = e.readInt32()
+ }
+ })), d.createFullBoxCtor("schm", (function(e) {
+ this.scheme_type = e.readString(4), this.scheme_version = e.readUint32(), 1 & this.flags && (this.scheme_uri = e.readString(this.size - this.hdr_size - 8))
+ })), d.createBoxCtor("sdp ", (function(e) {
+ this.sdptext = e.readString(this.size - this.hdr_size)
+ })), d.createFullBoxCtor("sdtp", (function(e) {
+ var t, i = this.size - this.hdr_size;
+ this.is_leading = [], this.sample_depends_on = [], this.sample_is_depended_on = [], this.sample_has_redundancy = [];
+ for (var n = 0; n < i; n++) t = e.readUint8(), this.is_leading[n] = t >> 6, this.sample_depends_on[n] = t >> 4 & 3, this.sample_is_depended_on[n] = t >> 2 & 3, this.sample_has_redundancy[n] = 3 & t
+ })), d.createFullBoxCtor("senc"), d.createFullBoxCtor("sgpd", (function(e) {
+ this.grouping_type = e.readString(4), a.debug("BoxParser", "Found Sample Groups of type " + this.grouping_type), 1 === this.version ? this.default_length = e.readUint32() : this.default_length = 0, this.version >= 2 && (this.default_group_description_index = e.readUint32()), this.entries = [];
+ for (var t = e.readUint32(), i = 0; i < t; i++) {
+ var n;
+ n = d[this.grouping_type + "SampleGroupEntry"] ? new d[this.grouping_type + "SampleGroupEntry"](this.grouping_type) : new d.SampleGroupEntry(this.grouping_type), this.entries.push(n), 1 === this.version && 0 === this.default_length ? n.description_length = e.readUint32() : n.description_length = this.default_length, n.write === d.SampleGroupEntry.prototype.write && (a.info("BoxParser", "SampleGroup for type " + this.grouping_type + " writing not yet implemented, keeping unparsed data in memory for later write"), n.data = e.readUint8Array(n.description_length), e.position -= n.description_length), n.parse(e)
+ }
+ })), d.createFullBoxCtor("sidx", (function(e) {
+ this.reference_ID = e.readUint32(), this.timescale = e.readUint32(), 0 === this.version ? (this.earliest_presentation_time = e.readUint32(), this.first_offset = e.readUint32()) : (this.earliest_presentation_time = e.readUint64(), this.first_offset = e.readUint64()), e.readUint16(), this.references = [];
+ for (var t = e.readUint16(), i = 0; i < t; i++) {
+ var n = {};
+ this.references.push(n);
+ var r = e.readUint32();
+ n.reference_type = r >> 31 & 1, n.referenced_size = 2147483647 & r, n.subsegment_duration = e.readUint32(), r = e.readUint32(), n.starts_with_SAP = r >> 31 & 1, n.SAP_type = r >> 28 & 7, n.SAP_delta_time = 268435455 & r
+ }
+ })), d.SingleItemTypeReferenceBox = function(e, t, i, n) {
+ d.Box.call(this, e, t), this.hdr_size = i, this.start = n
+ }, d.SingleItemTypeReferenceBox.prototype = new d.Box, d.SingleItemTypeReferenceBox.prototype.parse = function(e) {
+ this.from_item_ID = e.readUint16();
+ var t = e.readUint16();
+ this.references = [];
+ for (var i = 0; i < t; i++) this.references[i] = e.readUint16()
+ }, d.SingleItemTypeReferenceBoxLarge = function(e, t, i, n) {
+ d.Box.call(this, e, t), this.hdr_size = i, this.start = n
+ }, d.SingleItemTypeReferenceBoxLarge.prototype = new d.Box, d.SingleItemTypeReferenceBoxLarge.prototype.parse = function(e) {
+ this.from_item_ID = e.readUint32();
+ var t = e.readUint16();
+ this.references = [];
+ for (var i = 0; i < t; i++) this.references[i] = e.readUint32()
+ }, d.createFullBoxCtor("SmDm", (function(e) {
+ this.primaryRChromaticity_x = e.readUint16(), this.primaryRChromaticity_y = e.readUint16(), this.primaryGChromaticity_x = e.readUint16(), this.primaryGChromaticity_y = e.readUint16(), this.primaryBChromaticity_x = e.readUint16(), this.primaryBChromaticity_y = e.readUint16(), this.whitePointChromaticity_x = e.readUint16(), this.whitePointChromaticity_y = e.readUint16(), this.luminanceMax = e.readUint32(), this.luminanceMin = e.readUint32()
+ })), d.createFullBoxCtor("smhd", (function(e) {
+ this.balance = e.readUint16(), e.readUint16()
+ })), d.createFullBoxCtor("ssix", (function(e) {
+ this.subsegments = [];
+ for (var t = e.readUint32(), i = 0; i < t; i++) {
+ var n = {};
+ this.subsegments.push(n), n.ranges = [];
+ for (var r = e.readUint32(), a = 0; a < r; a++) {
+ var s = {};
+ n.ranges.push(s), s.level = e.readUint8(), s.range_size = e.readUint24()
+ }
+ }
+ })), d.createFullBoxCtor("stco", (function(e) {
+ var t;
+ if (t = e.readUint32(), this.chunk_offsets = [], 0 === this.version)
+ for (var i = 0; i < t; i++) this.chunk_offsets.push(e.readUint32())
+ })), d.createFullBoxCtor("stdp", (function(e) {
+ var t = (this.size - this.hdr_size) / 2;
+ this.priority = [];
+ for (var i = 0; i < t; i++) this.priority[i] = e.readUint16()
+ })), d.createFullBoxCtor("sthd"), d.createFullBoxCtor("stri", (function(e) {
+ this.switch_group = e.readUint16(), this.alternate_group = e.readUint16(), this.sub_track_id = e.readUint32();
+ var t = (this.size - this.hdr_size - 8) / 4;
+ this.attribute_list = [];
+ for (var i = 0; i < t; i++) this.attribute_list[i] = e.readUint32()
+ })), d.createFullBoxCtor("stsc", (function(e) {
+ var t, i;
+ if (t = e.readUint32(), this.first_chunk = [], this.samples_per_chunk = [], this.sample_description_index = [], 0 === this.version)
+ for (i = 0; i < t; i++) this.first_chunk.push(e.readUint32()), this.samples_per_chunk.push(e.readUint32()), this.sample_description_index.push(e.readUint32())
+ })), d.createFullBoxCtor("stsd", (function(e) {
+ var t, i, n, r;
+ for (this.entries = [], n = e.readUint32(), t = 1; t <= n; t++) {
+ if ((i = d.parseOneBox(e, !0, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ d[i.type + "SampleEntry"] ? ((r = new d[i.type + "SampleEntry"](i.size)).hdr_size = i.hdr_size, r.start = i.start) : (a.warn("BoxParser", "Unknown sample entry type: " + i.type), r = new d.SampleEntry(i.type, i.size, i.hdr_size, i.start)), r.write === d.SampleEntry.prototype.write && (a.info("BoxParser", "SampleEntry " + r.type + " box writing not yet implemented, keeping unparsed data in memory for later write"), r.parseDataAndRewind(e)), r.parse(e), this.entries.push(r)
+ }
+ })), d.createFullBoxCtor("stsg", (function(e) {
+ this.grouping_type = e.readUint32();
+ var t = e.readUint16();
+ this.group_description_index = [];
+ for (var i = 0; i < t; i++) this.group_description_index[i] = e.readUint32()
+ })), d.createFullBoxCtor("stsh", (function(e) {
+ var t, i;
+ if (t = e.readUint32(), this.shadowed_sample_numbers = [], this.sync_sample_numbers = [], 0 === this.version)
+ for (i = 0; i < t; i++) this.shadowed_sample_numbers.push(e.readUint32()), this.sync_sample_numbers.push(e.readUint32())
+ })), d.createFullBoxCtor("stss", (function(e) {
+ var t, i;
+ if (i = e.readUint32(), 0 === this.version)
+ for (this.sample_numbers = [], t = 0; t < i; t++) this.sample_numbers.push(e.readUint32())
+ })), d.createFullBoxCtor("stsz", (function(e) {
+ var t;
+ if (this.sample_sizes = [], 0 === this.version)
+ for (this.sample_size = e.readUint32(), this.sample_count = e.readUint32(), t = 0; t < this.sample_count; t++) 0 === this.sample_size ? this.sample_sizes.push(e.readUint32()) : this.sample_sizes[t] = this.sample_size
+ })), d.createFullBoxCtor("stts", (function(e) {
+ var t, i, n;
+ if (t = e.readUint32(), this.sample_counts = [], this.sample_deltas = [], 0 === this.version)
+ for (i = 0; i < t; i++) this.sample_counts.push(e.readUint32()), (n = e.readInt32()) < 0 && (a.warn("BoxParser", "File uses negative stts sample delta, using value 1 instead, sync may be lost!"), n = 1), this.sample_deltas.push(n)
+ })), d.createFullBoxCtor("stvi", (function(e) {
+ var t = e.readUint32();
+ this.single_view_allowed = 3 & t, this.stereo_scheme = e.readUint32();
+ var i, n, r = e.readUint32();
+ for (this.stereo_indication_type = e.readString(r), this.boxes = []; e.getPosition() < this.start + this.size;) {
+ if ((i = d.parseOneBox(e, !1, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ n = i.box, this.boxes.push(n), this[n.type] = n
+ }
+ })), d.createBoxCtor("styp", (function(e) {
+ d.ftypBox.prototype.parse.call(this, e)
+ })), d.createFullBoxCtor("stz2", (function(e) {
+ var t, i;
+ if (this.sample_sizes = [], 0 === this.version)
+ if (this.reserved = e.readUint24(), this.field_size = e.readUint8(), i = e.readUint32(), 4 === this.field_size)
+ for (t = 0; t < i; t += 2) {
+ var n = e.readUint8();
+ this.sample_sizes[t] = n >> 4 & 15, this.sample_sizes[t + 1] = 15 & n
+ } else if (8 === this.field_size)
+ for (t = 0; t < i; t++) this.sample_sizes[t] = e.readUint8();
+ else if (16 === this.field_size)
+ for (t = 0; t < i; t++) this.sample_sizes[t] = e.readUint16();
+ else a.error("BoxParser", "Error in length field in stz2 box")
+ })), d.createFullBoxCtor("subs", (function(e) {
+ var t, i, n, r;
+ for (n = e.readUint32(), this.entries = [], t = 0; t < n; t++) {
+ var a = {};
+ if (this.entries[t] = a, a.sample_delta = e.readUint32(), a.subsamples = [], (r = e.readUint16()) > 0)
+ for (i = 0; i < r; i++) {
+ var s = {};
+ a.subsamples.push(s), 1 == this.version ? s.size = e.readUint32() : s.size = e.readUint16(), s.priority = e.readUint8(), s.discardable = e.readUint8(), s.codec_specific_parameters = e.readUint32()
+ }
+ }
+ })), d.createFullBoxCtor("tenc", (function(e) {
+ if (e.readUint8(), 0 === this.version) e.readUint8();
+ else {
+ var t = e.readUint8();
+ this.default_crypt_byte_block = t >> 4 & 15, this.default_skip_byte_block = 15 & t
+ }
+ this.default_isProtected = e.readUint8(), this.default_Per_Sample_IV_Size = e.readUint8(), this.default_KID = d.parseHex16(e), 1 === this.default_isProtected && 0 === this.default_Per_Sample_IV_Size && (this.default_constant_IV_size = e.readUint8(), this.default_constant_IV = e.readUint8Array(this.default_constant_IV_size))
+ })), d.createFullBoxCtor("tfdt", (function(e) {
+ 1 == this.version ? this.baseMediaDecodeTime = e.readUint64() : this.baseMediaDecodeTime = e.readUint32()
+ })), d.createFullBoxCtor("tfhd", (function(e) {
+ var t = 0;
+ this.track_id = e.readUint32(), this.size - this.hdr_size > t && this.flags & d.TFHD_FLAG_BASE_DATA_OFFSET ? (this.base_data_offset = e.readUint64(), t += 8) : this.base_data_offset = 0, this.size - this.hdr_size > t && this.flags & d.TFHD_FLAG_SAMPLE_DESC ? (this.default_sample_description_index = e.readUint32(), t += 4) : this.default_sample_description_index = 0, this.size - this.hdr_size > t && this.flags & d.TFHD_FLAG_SAMPLE_DUR ? (this.default_sample_duration = e.readUint32(), t += 4) : this.default_sample_duration = 0, this.size - this.hdr_size > t && this.flags & d.TFHD_FLAG_SAMPLE_SIZE ? (this.default_sample_size = e.readUint32(), t += 4) : this.default_sample_size = 0, this.size - this.hdr_size > t && this.flags & d.TFHD_FLAG_SAMPLE_FLAGS ? (this.default_sample_flags = e.readUint32(), t += 4) : this.default_sample_flags = 0
+ })), d.createFullBoxCtor("tfra", (function(e) {
+ this.track_ID = e.readUint32(), e.readUint24();
+ var t = e.readUint8();
+ this.length_size_of_traf_num = t >> 4 & 3, this.length_size_of_trun_num = t >> 2 & 3, this.length_size_of_sample_num = 3 & t, this.entries = [];
+ for (var i = e.readUint32(), n = 0; n < i; n++) 1 === this.version ? (this.time = e.readUint64(), this.moof_offset = e.readUint64()) : (this.time = e.readUint32(), this.moof_offset = e.readUint32()), this.traf_number = e["readUint" + 8 * (this.length_size_of_traf_num + 1)](), this.trun_number = e["readUint" + 8 * (this.length_size_of_trun_num + 1)](), this.sample_number = e["readUint" + 8 * (this.length_size_of_sample_num + 1)]()
+ })), d.createFullBoxCtor("tkhd", (function(e) {
+ 1 == this.version ? (this.creation_time = e.readUint64(), this.modification_time = e.readUint64(), this.track_id = e.readUint32(), e.readUint32(), this.duration = e.readUint64()) : (this.creation_time = e.readUint32(), this.modification_time = e.readUint32(), this.track_id = e.readUint32(), e.readUint32(), this.duration = e.readUint32()), e.readUint32Array(2), this.layer = e.readInt16(), this.alternate_group = e.readInt16(), this.volume = e.readInt16() >> 8, e.readUint16(), this.matrix = e.readInt32Array(9), this.width = e.readUint32(), this.height = e.readUint32()
+ })), d.createBoxCtor("tmax", (function(e) {
+ this.time = e.readUint32()
+ })), d.createBoxCtor("tmin", (function(e) {
+ this.time = e.readUint32()
+ })), d.createBoxCtor("totl", (function(e) {
+ this.bytessent = e.readUint32()
+ })), d.createBoxCtor("tpay", (function(e) {
+ this.bytessent = e.readUint32()
+ })), d.createBoxCtor("tpyl", (function(e) {
+ this.bytessent = e.readUint64()
+ })), d.TrackGroupTypeBox.prototype.parse = function(e) {
+ this.parseFullHeader(e), this.track_group_id = e.readUint32()
+ }, d.createTrackGroupCtor("msrc"), d.TrackReferenceTypeBox = function(e, t, i, n) {
+ d.Box.call(this, e, t), this.hdr_size = i, this.start = n
+ }, d.TrackReferenceTypeBox.prototype = new d.Box, d.TrackReferenceTypeBox.prototype.parse = function(e) {
+ this.track_ids = e.readUint32Array((this.size - this.hdr_size) / 4)
+ }, d.trefBox.prototype.parse = function(e) {
+ for (var t, i; e.getPosition() < this.start + this.size;) {
+ if ((t = d.parseOneBox(e, !0, this.size - (e.getPosition() - this.start))).code !== d.OK) return;
+ (i = new d.TrackReferenceTypeBox(t.type, t.size, t.hdr_size, t.start)).write === d.Box.prototype.write && "mdat" !== i.type && (a.info("BoxParser", "TrackReference " + i.type + " box writing not yet implemented, keeping unparsed data in memory for later write"), i.parseDataAndRewind(e)), i.parse(e), this.boxes.push(i)
+ }
+ }, d.createFullBoxCtor("trep", (function(e) {
+ for (this.track_ID = e.readUint32(), this.boxes = []; e.getPosition() < this.start + this.size;) {
+ if (ret = d.parseOneBox(e, !1, this.size - (e.getPosition() - this.start)), ret.code !== d.OK) return;
+ box = ret.box, this.boxes.push(box)
+ }
+ })), d.createFullBoxCtor("trex", (function(e) {
+ this.track_id = e.readUint32(), this.default_sample_description_index = e.readUint32(), this.default_sample_duration = e.readUint32(), this.default_sample_size = e.readUint32(), this.default_sample_flags = e.readUint32()
+ })), d.createBoxCtor("trpy", (function(e) {
+ this.bytessent = e.readUint64()
+ })), d.createFullBoxCtor("trun", (function(e) {
+ var t = 0;
+ if (this.sample_count = e.readUint32(), t += 4, this.size - this.hdr_size > t && this.flags & d.TRUN_FLAGS_DATA_OFFSET ? (this.data_offset = e.readInt32(), t += 4) : this.data_offset = 0, this.size - this.hdr_size > t && this.flags & d.TRUN_FLAGS_FIRST_FLAG ? (this.first_sample_flags = e.readUint32(), t += 4) : this.first_sample_flags = 0, this.sample_duration = [], this.sample_size = [], this.sample_flags = [], this.sample_composition_time_offset = [], this.size - this.hdr_size > t)
+ for (var i = 0; i < this.sample_count; i++) this.flags & d.TRUN_FLAGS_DURATION && (this.sample_duration[i] = e.readUint32()), this.flags & d.TRUN_FLAGS_SIZE && (this.sample_size[i] = e.readUint32()), this.flags & d.TRUN_FLAGS_FLAGS && (this.sample_flags[i] = e.readUint32()), this.flags & d.TRUN_FLAGS_CTS_OFFSET && (0 === this.version ? this.sample_composition_time_offset[i] = e.readUint32() : this.sample_composition_time_offset[i] = e.readInt32())
+ })), d.createFullBoxCtor("tsel", (function(e) {
+ this.switch_group = e.readUint32();
+ var t = (this.size - this.hdr_size - 4) / 4;
+ this.attribute_list = [];
+ for (var i = 0; i < t; i++) this.attribute_list[i] = e.readUint32()
+ })), d.createFullBoxCtor("txtC", (function(e) {
+ this.config = e.readCString()
+ })), d.createFullBoxCtor("url ", (function(e) {
+ 1 !== this.flags && (this.location = e.readCString())
+ })), d.createFullBoxCtor("urn ", (function(e) {
+ this.name = e.readCString(), this.size - this.hdr_size - this.name.length - 1 > 0 && (this.location = e.readCString())
+ })), d.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66", !0, !1, (function(e) {
+ this.LiveServerManifest = e.readString(this.size - this.hdr_size).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")
+ })), d.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3", !0, !1, (function(e) {
+ this.system_id = d.parseHex16(e);
+ var t = e.readUint32();
+ t > 0 && (this.data = e.readUint8Array(t))
+ })), d.createUUIDBox("a2394f525a9b4f14a2446c427c648df4", !0, !1), d.createUUIDBox("8974dbce7be74c5184f97148f9882554", !0, !1, (function(e) {
+ this.default_AlgorithmID = e.readUint24(), this.default_IV_size = e.readUint8(), this.default_KID = d.parseHex16(e)
+ })), d.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f", !0, !1, (function(e) {
+ this.fragment_count = e.readUint8(), this.entries = [];
+ for (var t = 0; t < this.fragment_count; t++) {
+ var i = {},
+ n = 0,
+ r = 0;
+ 1 === this.version ? (n = e.readUint64(), r = e.readUint64()) : (n = e.readUint32(), r = e.readUint32()), i.absolute_time = n, i.absolute_duration = r, this.entries.push(i)
+ }
+ })), d.createUUIDBox("6d1d9b0542d544e680e2141daff757b2", !0, !1, (function(e) {
+ 1 === this.version ? (this.absolute_time = e.readUint64(), this.duration = e.readUint64()) : (this.absolute_time = e.readUint32(), this.duration = e.readUint32())
+ })), d.createFullBoxCtor("vmhd", (function(e) {
+ this.graphicsmode = e.readUint16(), this.opcolor = e.readUint16Array(3)
+ })), d.createFullBoxCtor("vpcC", (function(e) {
+ var t;
+ 1 === this.version ? (this.profile = e.readUint8(), this.level = e.readUint8(), t = e.readUint8(), this.bitDepth = t >> 4, this.chromaSubsampling = t >> 1 & 7, this.videoFullRangeFlag = 1 & t, this.colourPrimaries = e.readUint8(), this.transferCharacteristics = e.readUint8(), this.matrixCoefficients = e.readUint8(), this.codecIntializationDataSize = e.readUint16(), this.codecIntializationData = e.readUint8Array(this.codecIntializationDataSize)) : (this.profile = e.readUint8(), this.level = e.readUint8(), t = e.readUint8(), this.bitDepth = t >> 4 & 15, this.colorSpace = 15 & t, t = e.readUint8(), this.chromaSubsampling = t >> 4 & 15, this.transferFunction = t >> 1 & 7, this.videoFullRangeFlag = 1 & t, this.codecIntializationDataSize = e.readUint16(), this.codecIntializationData = e.readUint8Array(this.codecIntializationDataSize))
+ })), d.createBoxCtor("vttC", (function(e) {
+ this.text = e.readString(this.size - this.hdr_size)
+ })), d.SampleEntry.prototype.isVideo = function() {
+ return !1
+ }, d.SampleEntry.prototype.isAudio = function() {
+ return !1
+ }, d.SampleEntry.prototype.isSubtitle = function() {
+ return !1
+ }, d.SampleEntry.prototype.isMetadata = function() {
+ return !1
+ }, d.SampleEntry.prototype.isHint = function() {
+ return !1
+ }, d.SampleEntry.prototype.getCodec = function() {
+ return this.type.replace(".", "")
+ }, d.SampleEntry.prototype.getWidth = function() {
+ return ""
+ }, d.SampleEntry.prototype.getHeight = function() {
+ return ""
+ }, d.SampleEntry.prototype.getChannelCount = function() {
+ return ""
+ }, d.SampleEntry.prototype.getSampleRate = function() {
+ return ""
+ }, d.SampleEntry.prototype.getSampleSize = function() {
+ return ""
+ }, d.VisualSampleEntry.prototype.isVideo = function() {
+ return !0
+ }, d.VisualSampleEntry.prototype.getWidth = function() {
+ return this.width
+ }, d.VisualSampleEntry.prototype.getHeight = function() {
+ return this.height
+ }, d.AudioSampleEntry.prototype.isAudio = function() {
+ return !0
+ }, d.AudioSampleEntry.prototype.getChannelCount = function() {
+ return this.channel_count
+ }, d.AudioSampleEntry.prototype.getSampleRate = function() {
+ return this.samplerate
+ }, d.AudioSampleEntry.prototype.getSampleSize = function() {
+ return this.samplesize
+ }, d.SubtitleSampleEntry.prototype.isSubtitle = function() {
+ return !0
+ }, d.MetadataSampleEntry.prototype.isMetadata = function() {
+ return !0
+ }, d.decimalToHex = function(e, t) {
+ var i = Number(e).toString(16);
+ for (t = null == t ? t = 2 : t; i.length < t;) i = "0" + i;
+ return i
+ }, d.avc1SampleEntry.prototype.getCodec = d.avc2SampleEntry.prototype.getCodec = d.avc3SampleEntry.prototype.getCodec = d.avc4SampleEntry.prototype.getCodec = function() {
+ var e = d.SampleEntry.prototype.getCodec.call(this);
+ return this.avcC ? e + "." + d.decimalToHex(this.avcC.AVCProfileIndication) + d.decimalToHex(this.avcC.profile_compatibility) + d.decimalToHex(this.avcC.AVCLevelIndication) : e
+ }, d.hev1SampleEntry.prototype.getCodec = d.hvc1SampleEntry.prototype.getCodec = function() {
+ var e, t = d.SampleEntry.prototype.getCodec.call(this);
+ if (this.hvcC) {
+ switch (t += ".", this.hvcC.general_profile_space) {
+ case 0:
+ t += "";
+ break;
+ case 1:
+ t += "A";
+ break;
+ case 2:
+ t += "B";
+ break;
+ case 3:
+ t += "C"
+ }
+ t += this.hvcC.general_profile_idc, t += ".";
+ var i = this.hvcC.general_profile_compatibility,
+ n = 0;
+ for (e = 0; e < 32 && (n |= 1 & i, 31 != e); e++) n <<= 1, i >>= 1;
+ t += d.decimalToHex(n, 0), t += ".", 0 === this.hvcC.general_tier_flag ? t += "L" : t += "H", t += this.hvcC.general_level_idc;
+ var r = !1,
+ a = "";
+ for (e = 5; e >= 0; e--)(this.hvcC.general_constraint_indicator[e] || r) && (a = "." + d.decimalToHex(this.hvcC.general_constraint_indicator[e], 0) + a, r = !0);
+ t += a
+ }
+ return t
+ }, d.mp4aSampleEntry.prototype.getCodec = function() {
+ var e = d.SampleEntry.prototype.getCodec.call(this);
+ if (this.esds && this.esds.esd) {
+ var t = this.esds.esd.getOTI(),
+ i = this.esds.esd.getAudioConfig();
+ return e + "." + d.decimalToHex(t) + (i ? "." + i : "")
+ }
+ return e
+ }, d.stxtSampleEntry.prototype.getCodec = function() {
+ var e = d.SampleEntry.prototype.getCodec.call(this);
+ return this.mime_format ? e + "." + this.mime_format : e
+ }, d.av01SampleEntry.prototype.getCodec = function() {
+ var e, t = d.SampleEntry.prototype.getCodec.call(this);
+ return 2 === this.av1C.seq_profile && 1 === this.av1C.high_bitdepth ? e = 1 === this.av1C.twelve_bit ? "12" : "10" : this.av1C.seq_profile <= 2 && (e = 1 === this.av1C.high_bitdepth ? "10" : "08"), t + "." + this.av1C.seq_profile + "." + this.av1C.seq_level_idx_0 + (this.av1C.seq_tier_0 ? "H" : "M") + "." + e
+ }, d.Box.prototype.writeHeader = function(e, t) {
+ this.size += 8, this.size > u && (this.size += 8), "uuid" === this.type && (this.size += 16), a.debug("BoxWriter", "Writing box " + this.type + " of size: " + this.size + " at position " + e.getPosition() + (t || "")), this.size > u ? e.writeUint32(1) : (this.sizePosition = e.getPosition(), e.writeUint32(this.size)), e.writeString(this.type, null, 4), "uuid" === this.type && e.writeUint8Array(this.uuid), this.size > u && e.writeUint64(this.size)
+ }, d.FullBox.prototype.writeHeader = function(e) {
+ this.size += 4, d.Box.prototype.writeHeader.call(this, e, " v=" + this.version + " f=" + this.flags), e.writeUint8(this.version), e.writeUint24(this.flags)
+ }, d.Box.prototype.write = function(e) {
+ "mdat" === this.type ? this.data && (this.size = this.data.length, this.writeHeader(e), e.writeUint8Array(this.data)) : (this.size = this.data ? this.data.length : 0, this.writeHeader(e), this.data && e.writeUint8Array(this.data))
+ }, d.ContainerBox.prototype.write = function(e) {
+ this.size = 0, this.writeHeader(e);
+ for (var t = 0; t < this.boxes.length; t++) this.boxes[t] && (this.boxes[t].write(e), this.size += this.boxes[t].size);
+ a.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), e.adjustUint32(this.sizePosition, this.size)
+ }, d.TrackReferenceTypeBox.prototype.write = function(e) {
+ this.size = 4 * this.track_ids.length, this.writeHeader(e), e.writeUint32Array(this.track_ids)
+ }, d.avcCBox.prototype.write = function(e) {
+ var t;
+ for (this.size = 7, t = 0; t < this.SPS.length; t++) this.size += 2 + this.SPS[t].length;
+ for (t = 0; t < this.PPS.length; t++) this.size += 2 + this.PPS[t].length;
+ for (this.ext && (this.size += this.ext.length), this.writeHeader(e), e.writeUint8(this.configurationVersion), e.writeUint8(this.AVCProfileIndication), e.writeUint8(this.profile_compatibility), e.writeUint8(this.AVCLevelIndication), e.writeUint8(this.lengthSizeMinusOne + 252), e.writeUint8(this.SPS.length + 224), t = 0; t < this.SPS.length; t++) e.writeUint16(this.SPS[t].length), e.writeUint8Array(this.SPS[t].nalu);
+ for (e.writeUint8(this.PPS.length), t = 0; t < this.PPS.length; t++) e.writeUint16(this.PPS[t].length), e.writeUint8Array(this.PPS[t].nalu);
+ this.ext && e.writeUint8Array(this.ext)
+ }, d.co64Box.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 4 + 8 * this.chunk_offsets.length, this.writeHeader(e), e.writeUint32(this.chunk_offsets.length), t = 0; t < this.chunk_offsets.length; t++) e.writeUint64(this.chunk_offsets[t])
+ }, d.cslgBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 20, this.writeHeader(e), e.writeInt32(this.compositionToDTSShift), e.writeInt32(this.leastDecodeToDisplayDelta), e.writeInt32(this.greatestDecodeToDisplayDelta), e.writeInt32(this.compositionStartTime), e.writeInt32(this.compositionEndTime)
+ }, d.cttsBox.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 4 + 8 * this.sample_counts.length, this.writeHeader(e), e.writeUint32(this.sample_counts.length), t = 0; t < this.sample_counts.length; t++) e.writeUint32(this.sample_counts[t]), 1 === this.version ? e.writeInt32(this.sample_offsets[t]) : e.writeUint32(this.sample_offsets[t])
+ }, d.drefBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4, this.writeHeader(e), e.writeUint32(this.entries.length);
+ for (var t = 0; t < this.entries.length; t++) this.entries[t].write(e), this.size += this.entries[t].size;
+ a.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), e.adjustUint32(this.sizePosition, this.size)
+ }, d.elngBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = this.extended_language.length, this.writeHeader(e), e.writeString(this.extended_language)
+ }, d.elstBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4 + 12 * this.entries.length, this.writeHeader(e), e.writeUint32(this.entries.length);
+ for (var t = 0; t < this.entries.length; t++) {
+ var i = this.entries[t];
+ e.writeUint32(i.segment_duration), e.writeInt32(i.media_time), e.writeInt16(i.media_rate_integer), e.writeInt16(i.media_rate_fraction)
+ }
+ }, d.emsgBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 16 + this.message_data.length + (this.scheme_id_uri.length + 1) + (this.value.length + 1), this.writeHeader(e), e.writeCString(this.scheme_id_uri), e.writeCString(this.value), e.writeUint32(this.timescale), e.writeUint32(this.presentation_time_delta), e.writeUint32(this.event_duration), e.writeUint32(this.id), e.writeUint8Array(this.message_data)
+ }, d.ftypBox.prototype.write = function(e) {
+ this.size = 8 + 4 * this.compatible_brands.length, this.writeHeader(e), e.writeString(this.major_brand, null, 4), e.writeUint32(this.minor_version);
+ for (var t = 0; t < this.compatible_brands.length; t++) e.writeString(this.compatible_brands[t], null, 4)
+ }, d.hdlrBox.prototype.write = function(e) {
+ this.size = 20 + this.name.length + 1, this.version = 0, this.flags = 0, this.writeHeader(e), e.writeUint32(0), e.writeString(this.handler, null, 4), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeCString(this.name)
+ }, d.kindBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = this.schemeURI.length + 1 + (this.value.length + 1), this.writeHeader(e), e.writeCString(this.schemeURI), e.writeCString(this.value)
+ }, d.mdhdBox.prototype.write = function(e) {
+ this.size = 20, this.flags = 0, this.version = 0, this.writeHeader(e), e.writeUint32(this.creation_time), e.writeUint32(this.modification_time), e.writeUint32(this.timescale), e.writeUint32(this.duration), e.writeUint16(this.language), e.writeUint16(0)
+ }, d.mehdBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4, this.writeHeader(e), e.writeUint32(this.fragment_duration)
+ }, d.mfhdBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4, this.writeHeader(e), e.writeUint32(this.sequence_number)
+ }, d.mvhdBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 96, this.writeHeader(e), e.writeUint32(this.creation_time), e.writeUint32(this.modification_time), e.writeUint32(this.timescale), e.writeUint32(this.duration), e.writeUint32(this.rate), e.writeUint16(this.volume << 8), e.writeUint16(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32Array(this.matrix), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32(this.next_track_id)
+ }, d.SampleEntry.prototype.writeHeader = function(e) {
+ this.size = 8, d.Box.prototype.writeHeader.call(this, e), e.writeUint8(0), e.writeUint8(0), e.writeUint8(0), e.writeUint8(0), e.writeUint8(0), e.writeUint8(0), e.writeUint16(this.data_reference_index)
+ }, d.SampleEntry.prototype.writeFooter = function(e) {
+ for (var t = 0; t < this.boxes.length; t++) this.boxes[t].write(e), this.size += this.boxes[t].size;
+ a.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), e.adjustUint32(this.sizePosition, this.size)
+ }, d.SampleEntry.prototype.write = function(e) {
+ this.writeHeader(e), e.writeUint8Array(this.data), this.size += this.data.length, a.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), e.adjustUint32(this.sizePosition, this.size)
+ }, d.VisualSampleEntry.prototype.write = function(e) {
+ this.writeHeader(e), this.size += 70, e.writeUint16(0), e.writeUint16(0), e.writeUint32(0), e.writeUint32(0), e.writeUint32(0), e.writeUint16(this.width), e.writeUint16(this.height), e.writeUint32(this.horizresolution), e.writeUint32(this.vertresolution), e.writeUint32(0), e.writeUint16(this.frame_count), e.writeUint8(Math.min(31, this.compressorname.length)), e.writeString(this.compressorname, null, 31), e.writeUint16(this.depth), e.writeInt16(-1), this.writeFooter(e)
+ }, d.AudioSampleEntry.prototype.write = function(e) {
+ this.writeHeader(e), this.size += 20, e.writeUint32(0), e.writeUint32(0), e.writeUint16(this.channel_count), e.writeUint16(this.samplesize), e.writeUint16(0), e.writeUint16(0), e.writeUint32(this.samplerate << 16), this.writeFooter(e)
+ }, d.stppSampleEntry.prototype.write = function(e) {
+ this.writeHeader(e), this.size += this.namespace.length + 1 + this.schema_location.length + 1 + this.auxiliary_mime_types.length + 1, e.writeCString(this.namespace), e.writeCString(this.schema_location), e.writeCString(this.auxiliary_mime_types), this.writeFooter(e)
+ }, d.SampleGroupEntry.prototype.write = function(e) {
+ e.writeUint8Array(this.data)
+ }, d.sbgpBox.prototype.write = function(e) {
+ this.version = 1, this.flags = 0, this.size = 12 + 8 * this.entries.length, this.writeHeader(e), e.writeString(this.grouping_type, null, 4), e.writeUint32(this.grouping_type_parameter), e.writeUint32(this.entries.length);
+ for (var t = 0; t < this.entries.length; t++) {
+ var i = this.entries[t];
+ e.writeInt32(i.sample_count), e.writeInt32(i.group_description_index)
+ }
+ }, d.sgpdBox.prototype.write = function(e) {
+ var t, i;
+ for (this.flags = 0, this.size = 12, t = 0; t < this.entries.length; t++) i = this.entries[t], 1 === this.version && (0 === this.default_length && (this.size += 4), this.size += i.data.length);
+ for (this.writeHeader(e), e.writeString(this.grouping_type, null, 4), 1 === this.version && e.writeUint32(this.default_length), this.version >= 2 && e.writeUint32(this.default_sample_description_index), e.writeUint32(this.entries.length), t = 0; t < this.entries.length; t++) i = this.entries[t], 1 === this.version && 0 === this.default_length && e.writeUint32(i.description_length), i.write(e)
+ }, d.sidxBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 20 + 12 * this.references.length, this.writeHeader(e), e.writeUint32(this.reference_ID), e.writeUint32(this.timescale), e.writeUint32(this.earliest_presentation_time), e.writeUint32(this.first_offset), e.writeUint16(0), e.writeUint16(this.references.length);
+ for (var t = 0; t < this.references.length; t++) {
+ var i = this.references[t];
+ e.writeUint32(i.reference_type << 31 | i.referenced_size), e.writeUint32(i.subsegment_duration), e.writeUint32(i.starts_with_SAP << 31 | i.SAP_type << 28 | i.SAP_delta_time)
+ }
+ }, d.stcoBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4 + 4 * this.chunk_offsets.length, this.writeHeader(e), e.writeUint32(this.chunk_offsets.length), e.writeUint32Array(this.chunk_offsets)
+ }, d.stscBox.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 4 + 12 * this.first_chunk.length, this.writeHeader(e), e.writeUint32(this.first_chunk.length), t = 0; t < this.first_chunk.length; t++) e.writeUint32(this.first_chunk[t]), e.writeUint32(this.samples_per_chunk[t]), e.writeUint32(this.sample_description_index[t])
+ }, d.stsdBox.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 0, this.writeHeader(e), e.writeUint32(this.entries.length), this.size += 4, t = 0; t < this.entries.length; t++) this.entries[t].write(e), this.size += this.entries[t].size;
+ a.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), e.adjustUint32(this.sizePosition, this.size)
+ }, d.stshBox.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 4 + 8 * this.shadowed_sample_numbers.length, this.writeHeader(e), e.writeUint32(this.shadowed_sample_numbers.length), t = 0; t < this.shadowed_sample_numbers.length; t++) e.writeUint32(this.shadowed_sample_numbers[t]), e.writeUint32(this.sync_sample_numbers[t])
+ }, d.stssBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4 + 4 * this.sample_numbers.length, this.writeHeader(e), e.writeUint32(this.sample_numbers.length), e.writeUint32Array(this.sample_numbers)
+ }, d.stszBox.prototype.write = function(e) {
+ var t, i = !0;
+ if (this.version = 0, this.flags = 0, this.sample_sizes.length > 0)
+ for (t = 0; t + 1 < this.sample_sizes.length;) {
+ if (this.sample_sizes[t + 1] !== this.sample_sizes[0]) {
+ i = !1;
+ break
+ }
+ t++
+ } else i = !1;
+ this.size = 8, i || (this.size += 4 * this.sample_sizes.length), this.writeHeader(e), i ? e.writeUint32(this.sample_sizes[0]) : e.writeUint32(0), e.writeUint32(this.sample_sizes.length), i || e.writeUint32Array(this.sample_sizes)
+ }, d.sttsBox.prototype.write = function(e) {
+ var t;
+ for (this.version = 0, this.flags = 0, this.size = 4 + 8 * this.sample_counts.length, this.writeHeader(e), e.writeUint32(this.sample_counts.length), t = 0; t < this.sample_counts.length; t++) e.writeUint32(this.sample_counts[t]), e.writeUint32(this.sample_deltas[t])
+ }, d.tfdtBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 4, 1 === this.version && (this.size += 4), this.writeHeader(e), 1 === this.version ? e.writeUint64(this.baseMediaDecodeTime) : e.writeUint32(this.baseMediaDecodeTime)
+ }, d.tfhdBox.prototype.write = function(e) {
+ this.version = 0, this.size = 4, this.flags & d.TFHD_FLAG_BASE_DATA_OFFSET && (this.size += 8), this.flags & d.TFHD_FLAG_SAMPLE_DESC && (this.size += 4), this.flags & d.TFHD_FLAG_SAMPLE_DUR && (this.size += 4), this.flags & d.TFHD_FLAG_SAMPLE_SIZE && (this.size += 4), this.flags & d.TFHD_FLAG_SAMPLE_FLAGS && (this.size += 4), this.writeHeader(e), e.writeUint32(this.track_id), this.flags & d.TFHD_FLAG_BASE_DATA_OFFSET && e.writeUint64(this.base_data_offset), this.flags & d.TFHD_FLAG_SAMPLE_DESC && e.writeUint32(this.default_sample_description_index), this.flags & d.TFHD_FLAG_SAMPLE_DUR && e.writeUint32(this.default_sample_duration), this.flags & d.TFHD_FLAG_SAMPLE_SIZE && e.writeUint32(this.default_sample_size), this.flags & d.TFHD_FLAG_SAMPLE_FLAGS && e.writeUint32(this.default_sample_flags)
+ }, d.tkhdBox.prototype.write = function(e) {
+ this.version = 0, this.size = 80, this.writeHeader(e), e.writeUint32(this.creation_time), e.writeUint32(this.modification_time), e.writeUint32(this.track_id), e.writeUint32(0), e.writeUint32(this.duration), e.writeUint32(0), e.writeUint32(0), e.writeInt16(this.layer), e.writeInt16(this.alternate_group), e.writeInt16(this.volume << 8), e.writeUint16(0), e.writeInt32Array(this.matrix), e.writeUint32(this.width), e.writeUint32(this.height)
+ }, d.trexBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = 20, this.writeHeader(e), e.writeUint32(this.track_id), e.writeUint32(this.default_sample_description_index), e.writeUint32(this.default_sample_duration), e.writeUint32(this.default_sample_size), e.writeUint32(this.default_sample_flags)
+ }, d.trunBox.prototype.write = function(e) {
+ this.version = 0, this.size = 4, this.flags & d.TRUN_FLAGS_DATA_OFFSET && (this.size += 4), this.flags & d.TRUN_FLAGS_FIRST_FLAG && (this.size += 4), this.flags & d.TRUN_FLAGS_DURATION && (this.size += 4 * this.sample_duration.length), this.flags & d.TRUN_FLAGS_SIZE && (this.size += 4 * this.sample_size.length), this.flags & d.TRUN_FLAGS_FLAGS && (this.size += 4 * this.sample_flags.length), this.flags & d.TRUN_FLAGS_CTS_OFFSET && (this.size += 4 * this.sample_composition_time_offset.length), this.writeHeader(e), e.writeUint32(this.sample_count), this.flags & d.TRUN_FLAGS_DATA_OFFSET && (this.data_offset_position = e.getPosition(), e.writeInt32(this.data_offset)), this.flags & d.TRUN_FLAGS_FIRST_FLAG && e.writeUint32(this.first_sample_flags);
+ for (var t = 0; t < this.sample_count; t++) this.flags & d.TRUN_FLAGS_DURATION && e.writeUint32(this.sample_duration[t]), this.flags & d.TRUN_FLAGS_SIZE && e.writeUint32(this.sample_size[t]), this.flags & d.TRUN_FLAGS_FLAGS && e.writeUint32(this.sample_flags[t]), this.flags & d.TRUN_FLAGS_CTS_OFFSET && (0 === this.version ? e.writeUint32(this.sample_composition_time_offset[t]) : e.writeInt32(this.sample_composition_time_offset[t]))
+ }, d["url Box"].prototype.write = function(e) {
+ this.version = 0, this.location ? (this.flags = 0, this.size = this.location.length + 1) : (this.flags = 1, this.size = 0), this.writeHeader(e), this.location && e.writeCString(this.location)
+ }, d["urn Box"].prototype.write = function(e) {
+ this.version = 0, this.flags = 0, this.size = this.name.length + 1 + (this.location ? this.location.length + 1 : 0), this.writeHeader(e), e.writeCString(this.name), this.location && e.writeCString(this.location)
+ }, d.vmhdBox.prototype.write = function(e) {
+ this.version = 0, this.flags = 1, this.size = 8, this.writeHeader(e), e.writeUint16(this.graphicsmode), e.writeUint16Array(this.opcolor)
+ }, d.cttsBox.prototype.unpack = function(e) {
+ var t, i, n;
+ for (n = 0, t = 0; t < this.sample_counts.length; t++)
+ for (i = 0; i < this.sample_counts[t]; i++) e[n].pts = e[n].dts + this.sample_offsets[t], n++
+ }, d.sttsBox.prototype.unpack = function(e) {
+ var t, i, n;
+ for (n = 0, t = 0; t < this.sample_counts.length; t++)
+ for (i = 0; i < this.sample_counts[t]; i++) e[n].dts = 0 === n ? 0 : e[n - 1].dts + this.sample_deltas[t], n++
+ }, d.stcoBox.prototype.unpack = function(e) {
+ var t;
+ for (t = 0; t < this.chunk_offsets.length; t++) e[t].offset = this.chunk_offsets[t]
+ }, d.stscBox.prototype.unpack = function(e) {
+ var t, i, n, r, a;
+ for (r = 0, a = 0, t = 0; t < this.first_chunk.length; t++)
+ for (i = 0; i < (t + 1 < this.first_chunk.length ? this.first_chunk[t + 1] : 1 / 0); i++)
+ for (a++, n = 0; n < this.samples_per_chunk[t]; n++) {
+ if (!e[r]) return;
+ e[r].description_index = this.sample_description_index[t], e[r].chunk_index = a, r++
+ }
+ }, d.stszBox.prototype.unpack = function(e) {
+ var t;
+ for (t = 0; t < this.sample_sizes.length; t++) e[t].size = this.sample_sizes[t]
+ }, d.DIFF_BOXES_PROP_NAMES = ["boxes", "entries", "references", "subsamples", "items", "item_infos", "extents", "associations", "subsegments", "ranges", "seekLists", "seekPoints", "esd", "levels"], d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES = ["compatible_brands", "matrix", "opcolor", "sample_counts", "sample_counts", "sample_deltas", "first_chunk", "samples_per_chunk", "sample_sizes", "chunk_offsets", "sample_offsets", "sample_description_index", "sample_duration"], d.boxEqualFields = function(e, t) {
+ if (e && !t) return !1;
+ var i;
+ for (i in e)
+ if (!(d.DIFF_BOXES_PROP_NAMES.indexOf(i) > -1 || e[i] instanceof d.Box || t[i] instanceof d.Box || void 0 === e[i] || void 0 === t[i] || "function" == typeof e[i] || "function" == typeof t[i] || e.subBoxNames && e.subBoxNames.indexOf(i.slice(0, 4)) > -1 || t.subBoxNames && t.subBoxNames.indexOf(i.slice(0, 4)) > -1 || "data" === i || "start" === i || "size" === i || "creation_time" === i || "modification_time" === i || d.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i) > -1 || e[i] === t[i])) return !1;
+ return !0
+ }, d.boxEqual = function(e, t) {
+ if (!d.boxEqualFields(e, t)) return !1;
+ for (var i = 0; i < d.DIFF_BOXES_PROP_NAMES.length; i++) {
+ var n = d.DIFF_BOXES_PROP_NAMES[i];
+ if (e[n] && t[n] && !d.boxEqual(e[n], t[n])) return !1
+ }
+ return !0
+ };
+ var c = function() {};
+ c.prototype.parseSample = function(e) {
+ var t, i, n = new s(e.buffer);
+ for (t = []; !n.isEos();)(i = d.parseOneBox(n, !1)).code === d.OK && "vttc" === i.box.type && t.push(i.box);
+ return t
+ }, c.prototype.getText = function(e, t, i) {
+ function n(e, t, i) {
+ return i = i || "0", (e += "").length >= t ? e : new Array(t - e.length + 1).join(i) + e
+ }
+
+ function r(e) {
+ var t = Math.floor(e / 3600),
+ i = Math.floor((e - 3600 * t) / 60),
+ r = Math.floor(e - 3600 * t - 60 * i),
+ a = Math.floor(1e3 * (e - 3600 * t - 60 * i - r));
+ return n(t, 2) + ":" + n(i, 2) + ":" + n(r, 2) + "." + n(a, 3)
+ }
+ for (var a = this.parseSample(i), s = "", o = 0; o < a.length; o++) {
+ var u = a[o];
+ s += r(e) + " --\x3e " + r(t) + "\r\n", s += u.payl.text
+ }
+ return s
+ };
+ var f = function() {};
+ f.prototype.parseSample = function(e) {
+ var t, i = {};
+ i.resources = [];
+ var n = new s(e.data.buffer);
+ if (e.subsamples && 0 !== e.subsamples.length) {
+ if (i.documentString = n.readString(e.subsamples[0].size), e.subsamples.length > 1)
+ for (t = 1; t < e.subsamples.length; t++) i.resources[t] = n.readUint8Array(e.subsamples[t].size)
+ } else i.documentString = n.readString(e.data.length);
+ return "undefined" != typeof DOMParser && (i.document = (new DOMParser).parseFromString(i.documentString, "application/xml")), i
+ };
+ var p = function() {};
+ p.prototype.parseSample = function(e) {
+ return new s(e.data.buffer).readString(e.data.length)
+ }, p.prototype.parseConfig = function(e) {
+ var t = new s(e.buffer);
+ return t.readUint32(), t.readCString()
+ }, void 0 !== i && (i.XMLSubtitlein4Parser = f, i.Textin4Parser = p);
+ var m = function(e) {
+ this.stream = e || new l, this.boxes = [], this.mdats = [], this.moofs = [], this.isProgressive = !1, this.moovStartFound = !1, this.onMoovStart = null, this.moovStartSent = !1, this.onReady = null, this.readySent = !1, this.onSegment = null, this.onSamples = null, this.onError = null, this.sampleListBuilt = !1, this.fragmentedTracks = [], this.extractedTracks = [], this.isFragmentationInitialized = !1, this.sampleProcessingStarted = !1, this.nextMoofNumber = 0, this.itemListBuilt = !1, this.onSidx = null, this.sidxSent = !1
+ };
+ m.prototype.setSegmentOptions = function(e, t, i) {
+ var n = this.getTrackById(e);
+ if (n) {
+ var r = {};
+ this.fragmentedTracks.push(r), r.id = e, r.user = t, r.trak = n, n.nextSample = 0, r.segmentStream = null, r.nb_samples = 1e3, r.rapAlignement = !0, i && (i.nbSamples && (r.nb_samples = i.nbSamples), i.rapAlignement && (r.rapAlignement = i.rapAlignement))
+ }
+ }, m.prototype.unsetSegmentOptions = function(e) {
+ for (var t = -1, i = 0; i < this.fragmentedTracks.length; i++) {
+ this.fragmentedTracks[i].id == e && (t = i)
+ }
+ t > -1 && this.fragmentedTracks.splice(t, 1)
+ }, m.prototype.setExtractionOptions = function(e, t, i) {
+ var n = this.getTrackById(e);
+ if (n) {
+ var r = {};
+ this.extractedTracks.push(r), r.id = e, r.user = t, r.trak = n, n.nextSample = 0, r.nb_samples = 1e3, r.samples = [], i && i.nbSamples && (r.nb_samples = i.nbSamples)
+ }
+ }, m.prototype.unsetExtractionOptions = function(e) {
+ for (var t = -1, i = 0; i < this.extractedTracks.length; i++) {
+ this.extractedTracks[i].id == e && (t = i)
+ }
+ t > -1 && this.extractedTracks.splice(t, 1)
+ }, m.prototype.parse = function() {
+ var e, t;
+ if (!this.restoreParsePosition || this.restoreParsePosition())
+ for (;;) {
+ if (this.hasIncompleteMdat && this.hasIncompleteMdat()) {
+ if (this.processIncompleteMdat()) continue;
+ return
+ }
+ if (this.saveParsePosition && this.saveParsePosition(), (e = d.parseOneBox(this.stream, !1)).code === d.ERR_NOT_ENOUGH_DATA) {
+ if (this.processIncompleteBox) {
+ if (this.processIncompleteBox(e)) continue;
+ return
+ }
+ return
+ }
+ var i;
+ switch (i = "uuid" !== (t = e.box).type ? t.type : t.uuid, this.boxes.push(t), i) {
+ case "mdat":
+ this.mdats.push(t);
+ break;
+ case "moof":
+ this.moofs.push(t);
+ break;
+ case "moov":
+ this.moovStartFound = !0, 0 === this.mdats.length && (this.isProgressive = !0);
+ default:
+ void 0 !== this[i] && a.warn("ISOFile", "Duplicate Box of type: " + i + ", overriding previous occurrence"), this[i] = t
+ }
+ this.updateUsedBytes && this.updateUsedBytes(t, e)
+ }
+ }, m.prototype.checkBuffer = function(e) {
+ if (null == e) throw "Buffer must be defined and non empty";
+ if (void 0 === e.fileStart) throw "Buffer must have a fileStart property";
+ return 0 === e.byteLength ? (a.warn("ISOFile", "Ignoring empty buffer (fileStart: " + e.fileStart + ")"), this.stream.logBufferLevel(), !1) : (a.info("ISOFile", "Processing buffer (fileStart: " + e.fileStart + ")"), e.usedBytes = 0, this.stream.insertBuffer(e), this.stream.logBufferLevel(), !!this.stream.initialized() || (a.warn("ISOFile", "Not ready to start parsing"), !1))
+ }, m.prototype.appendBuffer = function(e, t) {
+ var i;
+ if (this.checkBuffer(e)) return this.parse(), this.moovStartFound && !this.moovStartSent && (this.moovStartSent = !0, this.onMoovStart && this.onMoovStart()), this.moov ? (this.sampleListBuilt || (this.buildSampleLists(), this.sampleListBuilt = !0), this.updateSampleLists(), this.onReady && !this.readySent && (this.readySent = !0, this.onReady(this.getInfo())), this.processSamples(t), this.nextSeekPosition ? (i = this.nextSeekPosition, this.nextSeekPosition = void 0) : i = this.nextParsePosition, this.stream.getEndFilePositionAfter && (i = this.stream.getEndFilePositionAfter(i))) : i = this.nextParsePosition ? this.nextParsePosition : 0, this.sidx && this.onSidx && !this.sidxSent && (this.onSidx(this.sidx), this.sidxSent = !0), this.meta && (this.flattenItemInfo && !this.itemListBuilt && (this.flattenItemInfo(), this.itemListBuilt = !0), this.processItems && this.processItems(this.onItem)), this.stream.cleanBuffers && (a.info("ISOFile", "Done processing buffer (fileStart: " + e.fileStart + ") - next buffer to fetch should have a fileStart position of " + i), this.stream.logBufferLevel(), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0), a.info("ISOFile", "Sample data size in memory: " + this.getAllocatedSampleDataSize())), i
+ }, m.prototype.getInfo = function() {
+ var e, t, i, n, r, a = {},
+ s = new Date("1904-01-01T00:00:00Z").getTime();
+ if (this.moov)
+ for (a.hasMoov = !0, a.duration = this.moov.mvhd.duration, a.timescale = this.moov.mvhd.timescale, a.isFragmented = null != this.moov.mvex, a.isFragmented && this.moov.mvex.mehd && (a.fragment_duration = this.moov.mvex.mehd.fragment_duration), a.isProgressive = this.isProgressive, a.hasIOD = null != this.moov.iods, a.brands = [], a.brands.push(this.ftyp.major_brand), a.brands = a.brands.concat(this.ftyp.compatible_brands), a.created = new Date(s + 1e3 * this.moov.mvhd.creation_time), a.modified = new Date(s + 1e3 * this.moov.mvhd.modification_time), a.tracks = [], a.audioTracks = [], a.videoTracks = [], a.subtitleTracks = [], a.metadataTracks = [], a.hintTracks = [], a.otherTracks = [], e = 0; e < this.moov.traks.length; e++) {
+ if (r = (i = this.moov.traks[e]).mdia.minf.stbl.stsd.entries[0], n = {}, a.tracks.push(n), n.id = i.tkhd.track_id, n.name = i.mdia.hdlr.name, n.references = [], i.tref)
+ for (t = 0; t < i.tref.boxes.length; t++) ref = {}, n.references.push(ref), ref.type = i.tref.boxes[t].type, ref.track_ids = i.tref.boxes[t].track_ids;
+ i.edts && (n.edits = i.edts.elst.entries), n.created = new Date(s + 1e3 * i.tkhd.creation_time), n.modified = new Date(s + 1e3 * i.tkhd.modification_time), n.movie_duration = i.tkhd.duration, n.movie_timescale = a.timescale, n.layer = i.tkhd.layer, n.alternate_group = i.tkhd.alternate_group, n.volume = i.tkhd.volume, n.matrix = i.tkhd.matrix, n.track_width = i.tkhd.width / 65536, n.track_height = i.tkhd.height / 65536, n.timescale = i.mdia.mdhd.timescale, n.cts_shift = i.mdia.minf.stbl.cslg, n.duration = i.mdia.mdhd.duration, n.samples_duration = i.samples_duration, n.codec = r.getCodec(), n.kind = i.udta && i.udta.kinds.length ? i.udta.kinds[0] : {
+ schemeURI: "",
+ value: ""
+ }, n.language = i.mdia.elng ? i.mdia.elng.extended_language : i.mdia.mdhd.languageString, n.nb_samples = i.samples.length, n.size = i.samples_size, n.bitrate = 8 * n.size * n.timescale / n.samples_duration, r.isAudio() ? (n.type = "audio", a.audioTracks.push(n), n.audio = {}, n.audio.sample_rate = r.getSampleRate(), n.audio.channel_count = r.getChannelCount(), n.audio.sample_size = r.getSampleSize()) : r.isVideo() ? (n.type = "video", a.videoTracks.push(n), n.video = {}, n.video.width = r.getWidth(), n.video.height = r.getHeight()) : r.isSubtitle() ? (n.type = "subtitles", a.subtitleTracks.push(n)) : r.isHint() ? (n.type = "metadata", a.hintTracks.push(n)) : r.isMetadata() ? (n.type = "metadata", a.metadataTracks.push(n)) : (n.type = "metadata", a.otherTracks.push(n))
+ } else a.hasMoov = !1;
+ if (a.mime = "", a.hasMoov && a.tracks) {
+ for (a.videoTracks && a.videoTracks.length > 0 ? a.mime += 'video/mp4; codecs="' : a.audioTracks && a.audioTracks.length > 0 ? a.mime += 'audio/mp4; codecs="' : a.mime += 'application/mp4; codecs="', e = 0; e < a.tracks.length; e++) 0 !== e && (a.mime += ","), a.mime += a.tracks[e].codec;
+ a.mime += '"; profiles="', a.mime += this.ftyp.compatible_brands.join(), a.mime += '"'
+ }
+ return a
+ }, m.prototype.processSamples = function(e) {
+ var t, i;
+ if (this.sampleProcessingStarted) {
+ if (this.isFragmentationInitialized && null !== this.onSegment)
+ for (t = 0; t < this.fragmentedTracks.length; t++) {
+ var n = this.fragmentedTracks[t];
+ for (i = n.trak; i.nextSample < i.samples.length && this.sampleProcessingStarted;) {
+ a.debug("ISOFile", "Creating media fragment on track #" + n.id + " for sample " + i.nextSample);
+ var r = this.createFragment(n.id, i.nextSample, n.segmentStream);
+ if (!r) break;
+ if (n.segmentStream = r, i.nextSample++, (i.nextSample % n.nb_samples == 0 || e || i.nextSample >= i.samples.length) && (a.info("ISOFile", "Sending fragmented data on track #" + n.id + " for samples [" + Math.max(0, i.nextSample - n.nb_samples) + "," + (i.nextSample - 1) + "]"), a.info("ISOFile", "Sample data size in memory: " + this.getAllocatedSampleDataSize()), this.onSegment && this.onSegment(n.id, n.user, n.segmentStream.buffer, i.nextSample, e || i.nextSample >= i.samples.length), n.segmentStream = null, n !== this.fragmentedTracks[t])) break
+ }
+ }
+ if (null !== this.onSamples)
+ for (t = 0; t < this.extractedTracks.length; t++) {
+ var s = this.extractedTracks[t];
+ for (i = s.trak; i.nextSample < i.samples.length && this.sampleProcessingStarted;) {
+ a.debug("ISOFile", "Exporting on track #" + s.id + " sample #" + i.nextSample);
+ var o = this.getSample(i, i.nextSample);
+ if (!o) break;
+ if (i.nextSample++, s.samples.push(o), (i.nextSample % s.nb_samples == 0 || i.nextSample >= i.samples.length) && (a.debug("ISOFile", "Sending samples on track #" + s.id + " for sample " + i.nextSample), this.onSamples && this.onSamples(s.id, s.user, s.samples), s.samples = [], s !== this.extractedTracks[t])) break
+ }
+ }
+ }
+ }, m.prototype.getBox = function(e) {
+ var t = this.getBoxes(e, !0);
+ return t.length ? t[0] : null
+ }, m.prototype.getBoxes = function(e, t) {
+ var i = [];
+ return m._sweep.call(this, e, i, t), i
+ }, m._sweep = function(e, t, i) {
+ for (var n in this.type && this.type == e && t.push(this), this.boxes) {
+ if (t.length && i) return;
+ m._sweep.call(this.boxes[n], e, t, i)
+ }
+ }, m.prototype.getTrackSamplesInfo = function(e) {
+ var t = this.getTrackById(e);
+ return t ? t.samples : void 0
+ }, m.prototype.getTrackSample = function(e, t) {
+ var i = this.getTrackById(e);
+ return this.getSample(i, t)
+ }, m.prototype.releaseUsedSamples = function(e, t) {
+ var i = 0,
+ n = this.getTrackById(e);
+ n.lastValidSample || (n.lastValidSample = 0);
+ for (var r = n.lastValidSample; r < t; r++) i += this.releaseSample(n, r);
+ a.info("ISOFile", "Track #" + e + " released samples up to " + t + " (released size: " + i + ", remaining: " + this.samplesDataSize + ")"), n.lastValidSample = t
+ }, m.prototype.start = function() {
+ this.sampleProcessingStarted = !0, this.processSamples(!1)
+ }, m.prototype.stop = function() {
+ this.sampleProcessingStarted = !1
+ }, m.prototype.flush = function() {
+ a.info("ISOFile", "Flushing remaining samples"), this.updateSampleLists(), this.processSamples(!0), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0)
+ }, m.prototype.seekTrack = function(e, t, i) {
+ var n, r, s, o, u = 0,
+ l = 0;
+ if (0 === i.samples.length) return a.info("ISOFile", "No sample in track, cannot seek! Using time " + a.getDurationString(0, 1) + " and offset: 0"), {
+ offset: 0,
+ time: 0
+ };
+ for (n = 0; n < i.samples.length; n++) {
+ if (r = i.samples[n], 0 === n) l = 0, o = r.timescale;
+ else if (r.cts > e * r.timescale) {
+ l = n - 1;
+ break
+ }
+ t && r.is_sync && (u = n)
+ }
+ for (t && (l = u), e = i.samples[l].cts, i.nextSample = l; i.samples[l].alreadyRead === i.samples[l].size && i.samples[l + 1];) l++;
+ return s = i.samples[l].offset + i.samples[l].alreadyRead, a.info("ISOFile", "Seeking to " + (t ? "RAP" : "") + " sample #" + i.nextSample + " on track " + i.tkhd.track_id + ", time " + a.getDurationString(e, o) + " and offset: " + s), {
+ offset: s,
+ time: e / o
+ }
+ }, m.prototype.seek = function(e, t) {
+ var i, n, r, s = this.moov,
+ o = {
+ offset: 1 / 0,
+ time: 1 / 0
+ };
+ if (this.moov) {
+ for (r = 0; r < s.traks.length; r++) i = s.traks[r], (n = this.seekTrack(e, t, i)).offset < o.offset && (o.offset = n.offset), n.time < o.time && (o.time = n.time);
+ return a.info("ISOFile", "Seeking at time " + a.getDurationString(o.time, 1) + " needs a buffer with a fileStart position of " + o.offset), o.offset === 1 / 0 ? o = {
+ offset: this.nextParsePosition,
+ time: 0
+ } : o.offset = this.stream.getEndFilePositionAfter(o.offset), a.info("ISOFile", "Adjusted seek position (after checking data already in buffer): " + o.offset), o
+ }
+ throw "Cannot seek: moov not received!"
+ }, m.prototype.equal = function(e) {
+ for (var t = 0; t < this.boxes.length && t < e.boxes.length;) {
+ var i = this.boxes[t],
+ n = e.boxes[t];
+ if (!d.boxEqual(i, n)) return !1;
+ t++
+ }
+ return !0
+ }, void 0 !== i && (i.ISOFile = m), m.prototype.lastBoxStartPosition = 0, m.prototype.parsingMdat = null, m.prototype.nextParsePosition = 0, m.prototype.discardMdatData = !1, m.prototype.processIncompleteBox = function(e) {
+ var t;
+ return "mdat" === e.type ? (t = new d[e.type + "Box"](e.size), this.parsingMdat = t, this.boxes.push(t), this.mdats.push(t), t.start = e.start, t.hdr_size = e.hdr_size, this.stream.addUsedBytes(t.hdr_size), this.lastBoxStartPosition = t.start + t.size, this.stream.seek(t.start + t.size, !1, this.discardMdatData) ? (this.parsingMdat = null, !0) : (this.moovStartFound ? this.nextParsePosition = this.stream.findEndContiguousBuf() : this.nextParsePosition = t.start + t.size, !1)) : ("moov" === e.type && (this.moovStartFound = !0, 0 === this.mdats.length && (this.isProgressive = !0)), !!this.stream.mergeNextBuffer && this.stream.mergeNextBuffer() ? (this.nextParsePosition = this.stream.getEndPosition(), !0) : (e.type ? this.moovStartFound ? this.nextParsePosition = this.stream.getEndPosition() : this.nextParsePosition = this.stream.getPosition() + e.size : this.nextParsePosition = this.stream.getEndPosition(), !1))
+ }, m.prototype.hasIncompleteMdat = function() {
+ return null !== this.parsingMdat
+ }, m.prototype.processIncompleteMdat = function() {
+ var e;
+ return e = this.parsingMdat, this.stream.seek(e.start + e.size, !1, this.discardMdatData) ? (a.debug("ISOFile", "Found 'mdat' end in buffered data"), this.parsingMdat = null, !0) : (this.nextParsePosition = this.stream.findEndContiguousBuf(), !1)
+ }, m.prototype.restoreParsePosition = function() {
+ return this.stream.seek(this.lastBoxStartPosition, !0, this.discardMdatData)
+ }, m.prototype.saveParsePosition = function() {
+ this.lastBoxStartPosition = this.stream.getPosition()
+ }, m.prototype.updateUsedBytes = function(e, t) {
+ this.stream.addUsedBytes && ("mdat" === e.type ? (this.stream.addUsedBytes(e.hdr_size), this.discardMdatData && this.stream.addUsedBytes(e.size - e.hdr_size)) : this.stream.addUsedBytes(e.size))
+ }, m.prototype.add = d.Box.prototype.add, m.prototype.addBox = d.Box.prototype.addBox, m.prototype.init = function(e) {
+ var t = e || {},
+ i = (this.add("ftyp").set("major_brand", t.brands && t.brands[0] || "iso4").set("minor_version", 0).set("compatible_brands", t.brands || ["iso4"]), this.add("moov"));
+ return i.add("mvhd").set("timescale", t.timescale || 600).set("rate", t.rate || 1).set("creation_time", 0).set("modification_time", 0).set("duration", t.duration || 0).set("volume", 1).set("matrix", [0, 0, 0, 0, 0, 0, 0, 0, 0]).set("next_track_id", 1), i.add("mvex"), this
+ }, m.prototype.addTrack = function(e) {
+ this.moov || this.init(e);
+ var t = e || {};
+ t.width = t.width || 320, t.height = t.height || 320, t.id = t.id || this.moov.mvhd.next_track_id, t.type = t.type || "avc1";
+ var i = this.moov.add("trak");
+ this.moov.mvhd.next_track_id = t.id + 1, i.add("tkhd").set("flags", d.TKHD_FLAG_ENABLED | d.TKHD_FLAG_IN_MOVIE | d.TKHD_FLAG_IN_PREVIEW).set("creation_time", 0).set("modification_time", 0).set("track_id", t.id).set("duration", t.duration || 0).set("layer", t.layer || 0).set("alternate_group", 0).set("volume", 1).set("matrix", [0, 0, 0, 0, 0, 0, 0, 0, 0]).set("width", t.width).set("height", t.height);
+ var n = i.add("mdia");
+ n.add("mdhd").set("creation_time", 0).set("modification_time", 0).set("timescale", t.timescale || 1).set("duration", t.media_duration || 0).set("language", t.language || 0), n.add("hdlr").set("handler", t.hdlr || "vide").set("name", t.name || "Track created with MP4Box.js"), n.add("elng").set("extended_language", t.language || "fr-FR");
+ var r = n.add("minf");
+ if (void 0 !== d[t.type + "SampleEntry"]) {
+ var a = new d[t.type + "SampleEntry"];
+ a.data_reference_index = 1;
+ var s = "";
+ for (var o in d.sampleEntryCodes)
+ for (var u = d.sampleEntryCodes[o], l = 0; l < u.length; l++)
+ if (u.indexOf(t.type) > -1) {
+ s = o;
+ break
+ } switch (s) {
+ case "Visual":
+ r.add("vmhd").set("graphicsmode", 0).set("opcolor", [0, 0, 0]), a.set("width", t.width).set("height", t.height).set("horizresolution", 72 << 16).set("vertresolution", 72 << 16).set("frame_count", 1).set("compressorname", t.type + " Compressor").set("depth", 24);
+ break;
+ case "Audio":
+ r.add("smhd").set("balance", t.balance || 0), a.set("channel_count", t.channel_count || 2).set("samplesize", t.samplesize || 16).set("samplerate", t.samplerate || 65536);
+ break;
+ case "Hint":
+ r.add("hmhd");
+ break;
+ case "Subtitle":
+ switch (r.add("sthd"), t.type) {
+ case "stpp":
+ a.set("namespace", t.namespace || "nonamespace").set("schema_location", t.schema_location || "").set("auxiliary_mime_types", t.auxiliary_mime_types || "")
+ }
+ break;
+ case "Metadata":
+ case "System":
+ default:
+ r.add("nmhd")
+ }
+ t.description && a.addBox(t.description), t.description_boxes && t.description_boxes.forEach((function(e) {
+ a.addBox(e)
+ })), r.add("dinf").add("dref").addEntry((new d["url Box"]).set("flags", 1));
+ var h = r.add("stbl");
+ return h.add("stsd").addEntry(a), h.add("stts").set("sample_counts", []).set("sample_deltas", []), h.add("stsc").set("first_chunk", []).set("samples_per_chunk", []).set("sample_description_index", []), h.add("stco").set("chunk_offsets", []), h.add("stsz").set("sample_sizes", []), this.moov.mvex.add("trex").set("track_id", t.id).set("default_sample_description_index", t.default_sample_description_index || 1).set("default_sample_duration", t.default_sample_duration || 0).set("default_sample_size", t.default_sample_size || 0).set("default_sample_flags", t.default_sample_flags || 0), this.buildTrakSampleLists(i), t.id
+ }
+ }, d.Box.prototype.computeSize = function(e) {
+ var t = e || new o;
+ t.endianness = o.BIG_ENDIAN, this.write(t)
+ }, m.prototype.addSample = function(e, t, i) {
+ var n = i || {},
+ r = {},
+ a = this.getTrackById(e);
+ if (null !== a) {
+ r.number = a.samples.length, r.track_id = a.tkhd.track_id, r.timescale = a.mdia.mdhd.timescale, r.description_index = n.sample_description_index ? n.sample_description_index - 1 : 0, r.description = a.mdia.minf.stbl.stsd.entries[r.description_index], r.data = t, r.size = t.length, r.alreadyRead = r.size, r.duration = n.duration || 1, r.cts = n.cts || 0, r.dts = n.dts || 0, r.is_sync = n.is_sync || !1, r.is_leading = n.is_leading || 0, r.depends_on = n.depends_on || 0, r.is_depended_on = n.is_depended_on || 0, r.has_redundancy = n.has_redundancy || 0, r.degradation_priority = n.degradation_priority || 0, r.offset = 0, r.subsamples = n.subsamples, a.samples.push(r), a.samples_size += r.size, a.samples_duration += r.duration, this.processSamples();
+ var s = m.createSingleSampleMoof(r);
+ return this.addBox(s), s.computeSize(), s.trafs[0].truns[0].data_offset = s.size + 8, this.add("mdat").data = t, r
+ }
+ }, m.createSingleSampleMoof = function(e) {
+ var t = new d.moofBox;
+ t.add("mfhd").set("sequence_number", this.nextMoofNumber), this.nextMoofNumber++;
+ var i = t.add("traf");
+ return i.add("tfhd").set("track_id", e.track_id).set("flags", d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF), i.add("tfdt").set("baseMediaDecodeTime", e.dts), i.add("trun").set("flags", d.TRUN_FLAGS_DATA_OFFSET | d.TRUN_FLAGS_DURATION | d.TRUN_FLAGS_SIZE | d.TRUN_FLAGS_FLAGS | d.TRUN_FLAGS_CTS_OFFSET).set("data_offset", 0).set("first_sample_flags", 0).set("sample_count", 1).set("sample_duration", [e.duration]).set("sample_size", [e.size]).set("sample_flags", [0]).set("sample_composition_time_offset", [e.cts - e.dts]), t
+ }, m.prototype.lastMoofIndex = 0, m.prototype.samplesDataSize = 0, m.prototype.resetTables = function() {
+ var e, t, i, n, r, a;
+ for (this.initial_duration = this.moov.mvhd.duration, this.moov.mvhd.duration = 0, e = 0; e < this.moov.traks.length; e++) {
+ (t = this.moov.traks[e]).tkhd.duration = 0, t.mdia.mdhd.duration = 0, (t.mdia.minf.stbl.stco || t.mdia.minf.stbl.co64).chunk_offsets = [], (i = t.mdia.minf.stbl.stsc).first_chunk = [], i.samples_per_chunk = [], i.sample_description_index = [], (t.mdia.minf.stbl.stsz || t.mdia.minf.stbl.stz2).sample_sizes = [], (n = t.mdia.minf.stbl.stts).sample_counts = [], n.sample_deltas = [], (r = t.mdia.minf.stbl.ctts) && (r.sample_counts = [], r.sample_offsets = []), a = t.mdia.minf.stbl.stss;
+ var s = t.mdia.minf.stbl.boxes.indexOf(a); - 1 != s && (t.mdia.minf.stbl.boxes[s] = null)
+ }
+ }, m.initSampleGroups = function(e, t, i, n, r) {
+ var a, s, o, u;
+
+ function l(e, t, i) {
+ this.grouping_type = e, this.grouping_type_parameter = t, this.sbgp = i, this.last_sample_in_run = -1, this.entry_index = -1
+ }
+ for (t && (t.sample_groups_info = []), e.sample_groups_info || (e.sample_groups_info = []), s = 0; s < i.length; s++) {
+ for (u = i[s].grouping_type + "/" + i[s].grouping_type_parameter, o = new l(i[s].grouping_type, i[s].grouping_type_parameter, i[s]), t && (t.sample_groups_info[u] = o), e.sample_groups_info[u] || (e.sample_groups_info[u] = o), a = 0; a < n.length; a++) n[a].grouping_type === i[s].grouping_type && (o.description = n[a], o.description.used = !0);
+ if (r)
+ for (a = 0; a < r.length; a++) r[a].grouping_type === i[s].grouping_type && (o.fragment_description = r[a], o.fragment_description.used = !0, o.is_fragment = !0)
+ }
+ if (t) {
+ if (r)
+ for (s = 0; s < r.length; s++) !r[s].used && r[s].version >= 2 && (u = r[s].grouping_type + "/0", (o = new l(r[s].grouping_type, 0)).is_fragment = !0, t.sample_groups_info[u] || (t.sample_groups_info[u] = o))
+ } else
+ for (s = 0; s < n.length; s++) !n[s].used && n[s].version >= 2 && (u = n[s].grouping_type + "/0", o = new l(n[s].grouping_type, 0), e.sample_groups_info[u] || (e.sample_groups_info[u] = o))
+ }, m.setSampleGroupProperties = function(e, t, i, n) {
+ var r, a;
+ for (r in t.sample_groups = [], n) {
+ var s;
+ if (t.sample_groups[r] = {}, t.sample_groups[r].grouping_type = n[r].grouping_type, t.sample_groups[r].grouping_type_parameter = n[r].grouping_type_parameter, i >= n[r].last_sample_in_run && (n[r].last_sample_in_run < 0 && (n[r].last_sample_in_run = 0), n[r].entry_index++, n[r].entry_index <= n[r].sbgp.entries.length - 1 && (n[r].last_sample_in_run += n[r].sbgp.entries[n[r].entry_index].sample_count)), n[r].entry_index <= n[r].sbgp.entries.length - 1 ? t.sample_groups[r].group_description_index = n[r].sbgp.entries[n[r].entry_index].group_description_index : t.sample_groups[r].group_description_index = -1, 0 !== t.sample_groups[r].group_description_index) s = n[r].fragment_description ? n[r].fragment_description : n[r].description, t.sample_groups[r].group_description_index > 0 ? (a = t.sample_groups[r].group_description_index > 65535 ? (t.sample_groups[r].group_description_index >> 16) - 1 : t.sample_groups[r].group_description_index - 1, s && a >= 0 && (t.sample_groups[r].description = s.entries[a])) : s && s.version >= 2 && s.default_group_description_index > 0 && (t.sample_groups[r].description = s.entries[s.default_group_description_index - 1])
+ }
+ }, m.process_sdtp = function(e, t, i) {
+ t && (e ? (t.is_leading = e.is_leading[i], t.depends_on = e.sample_depends_on[i], t.is_depended_on = e.sample_is_depended_on[i], t.has_redundancy = e.sample_has_redundancy[i]) : (t.is_leading = 0, t.depends_on = 0, t.is_depended_on = 0, t.has_redundancy = 0))
+ }, m.prototype.buildSampleLists = function() {
+ var e, t;
+ for (e = 0; e < this.moov.traks.length; e++) t = this.moov.traks[e], this.buildTrakSampleLists(t)
+ }, m.prototype.buildTrakSampleLists = function(e) {
+ var t, i, n, r, a, s, o, u, l, h, d, c, f, p, _, g, v, y, b, S, T, E, w, A;
+ if (e.samples = [], e.samples_duration = 0, e.samples_size = 0, i = e.mdia.minf.stbl.stco || e.mdia.minf.stbl.co64, n = e.mdia.minf.stbl.stsc, r = e.mdia.minf.stbl.stsz || e.mdia.minf.stbl.stz2, a = e.mdia.minf.stbl.stts, s = e.mdia.minf.stbl.ctts, o = e.mdia.minf.stbl.stss, u = e.mdia.minf.stbl.stsd, l = e.mdia.minf.stbl.subs, c = e.mdia.minf.stbl.stdp, h = e.mdia.minf.stbl.sbgps, d = e.mdia.minf.stbl.sgpds, y = -1, b = -1, S = -1, T = -1, E = 0, w = 0, A = 0, m.initSampleGroups(e, null, h, d), void 0 !== r) {
+ for (t = 0; t < r.sample_sizes.length; t++) {
+ var C = {};
+ C.number = t, C.track_id = e.tkhd.track_id, C.timescale = e.mdia.mdhd.timescale, C.alreadyRead = 0, e.samples[t] = C, C.size = r.sample_sizes[t], e.samples_size += C.size, 0 === t ? (p = 1, f = 0, C.chunk_index = p, C.chunk_run_index = f, v = n.samples_per_chunk[f], g = 0, _ = f + 1 < n.first_chunk.length ? n.first_chunk[f + 1] - 1 : 1 / 0) : t < v ? (C.chunk_index = p, C.chunk_run_index = f) : (p++, C.chunk_index = p, g = 0, p <= _ || (_ = ++f + 1 < n.first_chunk.length ? n.first_chunk[f + 1] - 1 : 1 / 0), C.chunk_run_index = f, v += n.samples_per_chunk[f]), C.description_index = n.sample_description_index[C.chunk_run_index] - 1, C.description = u.entries[C.description_index], C.offset = i.chunk_offsets[C.chunk_index - 1] + g, g += C.size, t > y && (b++, y < 0 && (y = 0), y += a.sample_counts[b]), t > 0 ? (e.samples[t - 1].duration = a.sample_deltas[b], e.samples_duration += e.samples[t - 1].duration, C.dts = e.samples[t - 1].dts + e.samples[t - 1].duration) : C.dts = 0, s ? (t >= S && (T++, S < 0 && (S = 0), S += s.sample_counts[T]), C.cts = e.samples[t].dts + s.sample_offsets[T]) : C.cts = C.dts, o ? (t == o.sample_numbers[E] - 1 ? (C.is_sync = !0, E++) : (C.is_sync = !1, C.degradation_priority = 0), l && l.entries[w].sample_delta + A == t + 1 && (C.subsamples = l.entries[w].subsamples, A += l.entries[w].sample_delta, w++)) : C.is_sync = !0, m.process_sdtp(e.mdia.minf.stbl.sdtp, C, C.number), C.degradation_priority = c ? c.priority[t] : 0, l && l.entries[w].sample_delta + A == t && (C.subsamples = l.entries[w].subsamples, A += l.entries[w].sample_delta), (h.length > 0 || d.length > 0) && m.setSampleGroupProperties(e, C, t, e.sample_groups_info)
+ }
+ t > 0 && (e.samples[t - 1].duration = Math.max(e.mdia.mdhd.duration - e.samples[t - 1].dts, 0), e.samples_duration += e.samples[t - 1].duration)
+ }
+ }, m.prototype.updateSampleLists = function() {
+ var e, t, i, n, r, a, s, o, u, l, h, c, f, p, _;
+ if (void 0 !== this.moov)
+ for (; this.lastMoofIndex < this.moofs.length;)
+ if (u = this.moofs[this.lastMoofIndex], this.lastMoofIndex++, "moof" == u.type)
+ for (l = u, e = 0; e < l.trafs.length; e++) {
+ for (h = l.trafs[e], c = this.getTrackById(h.tfhd.track_id), f = this.getTrexById(h.tfhd.track_id), n = h.tfhd.flags & d.TFHD_FLAG_SAMPLE_DESC ? h.tfhd.default_sample_description_index : f ? f.default_sample_description_index : 1, r = h.tfhd.flags & d.TFHD_FLAG_SAMPLE_DUR ? h.tfhd.default_sample_duration : f ? f.default_sample_duration : 0, a = h.tfhd.flags & d.TFHD_FLAG_SAMPLE_SIZE ? h.tfhd.default_sample_size : f ? f.default_sample_size : 0, s = h.tfhd.flags & d.TFHD_FLAG_SAMPLE_FLAGS ? h.tfhd.default_sample_flags : f ? f.default_sample_flags : 0, h.sample_number = 0, h.sbgps.length > 0 && m.initSampleGroups(c, h, h.sbgps, c.mdia.minf.stbl.sgpds, h.sgpds), t = 0; t < h.truns.length; t++) {
+ var g = h.truns[t];
+ for (i = 0; i < g.sample_count; i++) {
+ (p = {}).moof_number = this.lastMoofIndex, p.number_in_traf = h.sample_number, h.sample_number++, p.number = c.samples.length, h.first_sample_index = c.samples.length, c.samples.push(p), p.track_id = c.tkhd.track_id, p.timescale = c.mdia.mdhd.timescale, p.description_index = n - 1, p.description = c.mdia.minf.stbl.stsd.entries[p.description_index], p.size = a, g.flags & d.TRUN_FLAGS_SIZE && (p.size = g.sample_size[i]), c.samples_size += p.size, p.duration = r, g.flags & d.TRUN_FLAGS_DURATION && (p.duration = g.sample_duration[i]), c.samples_duration += p.duration, c.first_traf_merged || i > 0 ? p.dts = c.samples[c.samples.length - 2].dts + c.samples[c.samples.length - 2].duration : (h.tfdt ? p.dts = h.tfdt.baseMediaDecodeTime : p.dts = 0, c.first_traf_merged = !0), p.cts = p.dts, g.flags & d.TRUN_FLAGS_CTS_OFFSET && (p.cts = p.dts + g.sample_composition_time_offset[i]), _ = s, g.flags & d.TRUN_FLAGS_FLAGS ? _ = g.sample_flags[i] : 0 === i && g.flags & d.TRUN_FLAGS_FIRST_FLAG && (_ = g.first_sample_flags), p.is_sync = !(_ >> 16 & 1), p.is_leading = _ >> 26 & 3, p.depends_on = _ >> 24 & 3, p.is_depended_on = _ >> 22 & 3, p.has_redundancy = _ >> 20 & 3, p.degradation_priority = 65535 & _;
+ var v = !!(h.tfhd.flags & d.TFHD_FLAG_BASE_DATA_OFFSET),
+ y = !!(h.tfhd.flags & d.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),
+ b = !!(g.flags & d.TRUN_FLAGS_DATA_OFFSET),
+ S = 0;
+ S = v ? h.tfhd.base_data_offset : y || 0 === t ? l.start : o, p.offset = 0 === t && 0 === i ? b ? S + g.data_offset : S : o, o = p.offset + p.size, (h.sbgps.length > 0 || h.sgpds.length > 0 || c.mdia.minf.stbl.sbgps.length > 0 || c.mdia.minf.stbl.sgpds.length > 0) && m.setSampleGroupProperties(c, p, p.number_in_traf, h.sample_groups_info)
+ }
+ }
+ if (h.subs) {
+ c.has_fragment_subsamples = !0;
+ var T = h.first_sample_index;
+ for (t = 0; t < h.subs.entries.length; t++) T += h.subs.entries[t].sample_delta, (p = c.samples[T - 1]).subsamples = h.subs.entries[t].subsamples
+ }
+ }
+ }, m.prototype.getSample = function(e, t) {
+ var i, n = e.samples[t];
+ if (!this.moov) return null;
+ if (n.data) {
+ if (n.alreadyRead == n.size) return n
+ } else n.data = new Uint8Array(n.size), n.alreadyRead = 0, this.samplesDataSize += n.size, a.debug("ISOFile", "Allocating sample #" + t + " on track #" + e.tkhd.track_id + " of size " + n.size + " (total: " + this.samplesDataSize + ")");
+ for (;;) {
+ var r = this.stream.findPosition(!0, n.offset + n.alreadyRead, !1);
+ if (!(r > -1)) return null;
+ var s = (i = this.stream.buffers[r]).byteLength - (n.offset + n.alreadyRead - i.fileStart);
+ if (n.size - n.alreadyRead <= s) return a.debug("ISOFile", "Getting sample #" + t + " data (alreadyRead: " + n.alreadyRead + " offset: " + (n.offset + n.alreadyRead - i.fileStart) + " read size: " + (n.size - n.alreadyRead) + " full size: " + n.size + ")"), o.memcpy(n.data.buffer, n.alreadyRead, i, n.offset + n.alreadyRead - i.fileStart, n.size - n.alreadyRead), i.usedBytes += n.size - n.alreadyRead, this.stream.logBufferLevel(), n.alreadyRead = n.size, n;
+ if (0 === s) return null;
+ a.debug("ISOFile", "Getting sample #" + t + " partial data (alreadyRead: " + n.alreadyRead + " offset: " + (n.offset + n.alreadyRead - i.fileStart) + " read size: " + s + " full size: " + n.size + ")"), o.memcpy(n.data.buffer, n.alreadyRead, i, n.offset + n.alreadyRead - i.fileStart, s), n.alreadyRead += s, i.usedBytes += s, this.stream.logBufferLevel()
+ }
+ }, m.prototype.releaseSample = function(e, t) {
+ var i = e.samples[t];
+ return i.data ? (this.samplesDataSize -= i.size, i.data = null, i.alreadyRead = 0, i.size) : 0
+ }, m.prototype.getAllocatedSampleDataSize = function() {
+ return this.samplesDataSize
+ }, m.prototype.getCodecs = function() {
+ var e, t = "";
+ for (e = 0; e < this.moov.traks.length; e++) {
+ e > 0 && (t += ","), t += this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()
+ }
+ return t
+ }, m.prototype.getTrexById = function(e) {
+ var t;
+ if (!this.moov || !this.moov.mvex) return null;
+ for (t = 0; t < this.moov.mvex.trexs.length; t++) {
+ var i = this.moov.mvex.trexs[t];
+ if (i.track_id == e) return i
+ }
+ return null
+ }, m.prototype.getTrackById = function(e) {
+ if (void 0 === this.moov) return null;
+ for (var t = 0; t < this.moov.traks.length; t++) {
+ var i = this.moov.traks[t];
+ if (i.tkhd.track_id == e) return i
+ }
+ return null
+ }, m.prototype.items = [], m.prototype.itemsDataSize = 0, m.prototype.flattenItemInfo = function() {
+ var e, t, i, n = this.items,
+ r = this.meta;
+ if (null != r && void 0 !== r.hdlr && void 0 !== r.iinf) {
+ for (e = 0; e < r.iinf.item_infos.length; e++)(i = {}).id = r.iinf.item_infos[e].item_ID, n[i.id] = i, i.ref_to = [], i.name = r.iinf.item_infos[e].item_name, r.iinf.item_infos[e].protection_index > 0 && (i.protection = r.ipro.protections[r.iinf.item_infos[e].protection_index - 1]), r.iinf.item_infos[e].item_type ? i.type = r.iinf.item_infos[e].item_type : i.type = "mime", i.content_type = r.iinf.item_infos[e].content_type, i.content_encoding = r.iinf.item_infos[e].content_encoding;
+ if (r.iloc)
+ for (e = 0; e < r.iloc.items.length; e++) {
+ var s = r.iloc.items[e];
+ switch (i = n[s.item_ID], 0 !== s.data_reference_index && (a.warn("Item storage with reference to other files: not supported"), i.source = r.dinf.boxes[s.data_reference_index - 1]), s.construction_method) {
+ case 0:
+ break;
+ case 1:
+ case 2:
+ a.warn("Item storage with construction_method : not supported")
+ }
+ for (i.extents = [], i.size = 0, t = 0; t < s.extents.length; t++) i.extents[t] = {}, i.extents[t].offset = s.extents[t].extent_offset + s.base_offset, i.extents[t].length = s.extents[t].extent_length, i.extents[t].alreadyRead = 0, i.size += i.extents[t].length
+ }
+ if (r.pitm && (n[r.pitm.item_id].primary = !0), r.iref)
+ for (e = 0; e < r.iref.references.length; e++) {
+ var o = r.iref.references[e];
+ for (t = 0; t < o.references.length; t++) n[o.from_item_ID].ref_to.push({
+ type: o.type,
+ id: o.references[t]
+ })
+ }
+ if (r.iprp)
+ for (var u = 0; u < r.iprp.ipmas.length; u++) {
+ var l = r.iprp.ipmas[u];
+ for (e = 0; e < l.associations.length; e++) {
+ var h = l.associations[e];
+ for (void 0 === (i = n[h.id]).properties && (i.properties = {}, i.properties.boxes = []), t = 0; t < h.props.length; t++) {
+ var d = h.props[t];
+ if (d.property_index > 0) {
+ var c = r.iprp.ipco.boxes[d.property_index - 1];
+ i.properties[c.type] = c, i.properties.boxes.push(c)
+ }
+ }
+ }
+ }
+ }
+ }, m.prototype.getItem = function(e) {
+ var t, i;
+ if (!this.meta) return null;
+ if (!(i = this.items[e]).data && i.size) i.data = new Uint8Array(i.size), i.alreadyRead = 0, this.itemsDataSize += i.size, a.debug("ISOFile", "Allocating item #" + e + " of size " + i.size + " (total: " + this.itemsDataSize + ")");
+ else if (i.alreadyRead === i.size) return i;
+ for (var n = 0; n < i.extents.length; n++) {
+ var r = i.extents[n];
+ if (r.alreadyRead !== r.length) {
+ var s = this.stream.findPosition(!0, r.offset + r.alreadyRead, !1);
+ if (!(s > -1)) return null;
+ var u = (t = this.stream.buffers[s]).byteLength - (r.offset + r.alreadyRead - t.fileStart);
+ if (!(r.length - r.alreadyRead <= u)) return a.debug("ISOFile", "Getting item #" + e + " extent #" + n + " partial data (alreadyRead: " + r.alreadyRead + " offset: " + (r.offset + r.alreadyRead - t.fileStart) + " read size: " + u + " full extent size: " + r.length + " full item size: " + i.size + ")"), o.memcpy(i.data.buffer, i.alreadyRead, t, r.offset + r.alreadyRead - t.fileStart, u), r.alreadyRead += u, i.alreadyRead += u, t.usedBytes += u, this.stream.logBufferLevel(), null;
+ a.debug("ISOFile", "Getting item #" + e + " extent #" + n + " data (alreadyRead: " + r.alreadyRead + " offset: " + (r.offset + r.alreadyRead - t.fileStart) + " read size: " + (r.length - r.alreadyRead) + " full extent size: " + r.length + " full item size: " + i.size + ")"), o.memcpy(i.data.buffer, i.alreadyRead, t, r.offset + r.alreadyRead - t.fileStart, r.length - r.alreadyRead), t.usedBytes += r.length - r.alreadyRead, this.stream.logBufferLevel(), i.alreadyRead += r.length - r.alreadyRead, r.alreadyRead = r.length
+ }
+ }
+ return i.alreadyRead === i.size ? i : null
+ }, m.prototype.releaseItem = function(e) {
+ var t = this.items[e];
+ if (t.data) {
+ this.itemsDataSize -= t.size, t.data = null, t.alreadyRead = 0;
+ for (var i = 0; i < t.extents.length; i++) {
+ t.extents[i].alreadyRead = 0
+ }
+ return t.size
+ }
+ return 0
+ }, m.prototype.processItems = function(e) {
+ for (var t in this.items) {
+ var i = this.items[t];
+ this.getItem(i.id), e && !i.sent && (e(i), i.sent = !0, i.data = null)
+ }
+ }, m.prototype.hasItem = function(e) {
+ for (var t in this.items) {
+ var i = this.items[t];
+ if (i.name === e) return i.id
+ }
+ return -1
+ }, m.prototype.getMetaHandler = function() {
+ return this.meta ? this.meta.hdlr.handler : null
+ }, m.prototype.getPrimaryItem = function() {
+ return this.meta && this.meta.pitm ? this.getItem(this.meta.pitm.item_id) : null
+ }, m.prototype.itemToFragmentedTrackFile = function(e) {
+ var t = e || {},
+ i = null;
+ if (null == (i = t.itemId ? this.getItem(t.itemId) : this.getPrimaryItem())) return null;
+ var n = new m;
+ n.discardMdatData = !1;
+ var r = {
+ type: i.type,
+ description_boxes: i.properties.boxes
+ };
+ i.properties.ispe && (r.width = i.properties.ispe.image_width, r.height = i.properties.ispe.image_height);
+ var a = n.addTrack(r);
+ return a ? (n.addSample(a, i.data), n) : null
+ }, m.prototype.write = function(e) {
+ for (var t = 0; t < this.boxes.length; t++) this.boxes[t].write(e)
+ }, m.prototype.createFragment = function(e, t, i) {
+ var n = this.getTrackById(e),
+ r = this.getSample(n, t);
+ if (null == r) return r = n.samples[t], this.nextSeekPosition ? this.nextSeekPosition = Math.min(r.offset + r.alreadyRead, this.nextSeekPosition) : this.nextSeekPosition = n.samples[t].offset + r.alreadyRead, null;
+ var s = i || new o;
+ s.endianness = o.BIG_ENDIAN;
+ var u = m.createSingleSampleMoof(r);
+ u.write(s), u.trafs[0].truns[0].data_offset = u.size + 8, a.debug("MP4Box", "Adjusting data_offset with new value " + u.trafs[0].truns[0].data_offset), s.adjustUint32(u.trafs[0].truns[0].data_offset_position, u.trafs[0].truns[0].data_offset);
+ var l = new d.mdatBox;
+ return l.data = r.data, l.write(s), s
+ }, m.writeInitializationSegment = function(e, t, i, n) {
+ var r;
+ a.debug("ISOFile", "Generating initialization segment");
+ var s = new o;
+ s.endianness = o.BIG_ENDIAN, e.write(s);
+ var u = t.add("mvex");
+ for (i && u.add("mehd").set("fragment_duration", i), r = 0; r < t.traks.length; r++) u.add("trex").set("track_id", t.traks[r].tkhd.track_id).set("default_sample_description_index", 1).set("default_sample_duration", n).set("default_sample_size", 0).set("default_sample_flags", 65536);
+ return t.write(s), s.buffer
+ }, m.prototype.save = function(e) {
+ var t = new o;
+ t.endianness = o.BIG_ENDIAN, this.write(t), t.save(e)
+ }, m.prototype.getBuffer = function() {
+ var e = new o;
+ return e.endianness = o.BIG_ENDIAN, this.write(e), e.buffer
+ }, m.prototype.initializeSegmentation = function() {
+ var e, t, i, n;
+ for (null === this.onSegment && a.warn("MP4Box", "No segmentation callback set!"), this.isFragmentationInitialized || (this.isFragmentationInitialized = !0, this.nextMoofNumber = 0, this.resetTables()), t = [], e = 0; e < this.fragmentedTracks.length; e++) {
+ var r = new d.moovBox;
+ r.mvhd = this.moov.mvhd, r.boxes.push(r.mvhd), i = this.getTrackById(this.fragmentedTracks[e].id), r.boxes.push(i), r.traks.push(i), (n = {}).id = i.tkhd.track_id, n.user = this.fragmentedTracks[e].user, n.buffer = m.writeInitializationSegment(this.ftyp, r, this.moov.mvex && this.moov.mvex.mehd ? this.moov.mvex.mehd.fragment_duration : void 0, this.moov.traks[e].samples.length > 0 ? this.moov.traks[e].samples[0].duration : 0), t.push(n)
+ }
+ return t
+ }, d.Box.prototype.printHeader = function(e) {
+ this.size += 8, this.size > u && (this.size += 8), "uuid" === this.type && (this.size += 16), e.log(e.indent + "size:" + this.size), e.log(e.indent + "type:" + this.type)
+ }, d.FullBox.prototype.printHeader = function(e) {
+ this.size += 4, d.Box.prototype.printHeader.call(this, e), e.log(e.indent + "version:" + this.version), e.log(e.indent + "flags:" + this.flags)
+ }, d.Box.prototype.print = function(e) {
+ this.printHeader(e)
+ }, d.ContainerBox.prototype.print = function(e) {
+ this.printHeader(e);
+ for (var t = 0; t < this.boxes.length; t++)
+ if (this.boxes[t]) {
+ var i = e.indent;
+ e.indent += " ", this.boxes[t].print(e), e.indent = i
+ }
+ }, m.prototype.print = function(e) {
+ e.indent = "";
+ for (var t = 0; t < this.boxes.length; t++) this.boxes[t] && this.boxes[t].print(e)
+ }, d.mvhdBox.prototype.print = function(e) {
+ d.FullBox.prototype.printHeader.call(this, e), e.log(e.indent + "creation_time: " + this.creation_time), e.log(e.indent + "modification_time: " + this.modification_time), e.log(e.indent + "timescale: " + this.timescale), e.log(e.indent + "duration: " + this.duration), e.log(e.indent + "rate: " + this.rate), e.log(e.indent + "volume: " + (this.volume >> 8)), e.log(e.indent + "matrix: " + this.matrix.join(", ")), e.log(e.indent + "next_track_id: " + this.next_track_id)
+ }, d.tkhdBox.prototype.print = function(e) {
+ d.FullBox.prototype.printHeader.call(this, e), e.log(e.indent + "creation_time: " + this.creation_time), e.log(e.indent + "modification_time: " + this.modification_time), e.log(e.indent + "track_id: " + this.track_id), e.log(e.indent + "duration: " + this.duration), e.log(e.indent + "volume: " + (this.volume >> 8)), e.log(e.indent + "matrix: " + this.matrix.join(", ")), e.log(e.indent + "layer: " + this.layer), e.log(e.indent + "alternate_group: " + this.alternate_group), e.log(e.indent + "width: " + this.width), e.log(e.indent + "height: " + this.height)
+ };
+ var _ = {
+ createFile: function(e, t) {
+ var i = void 0 === e || e,
+ n = new m(t);
+ return n.discardMdatData = !i, n
+ }
+ };
+ void 0 !== i && (i.createFile = _.createFile)
+ }, {}],
+ 40: [function(e, t, i) {
+ /*! @name mpd-parser @version 0.19.0 @license Apache-2.0 */
+ "use strict";
+ Object.defineProperty(i, "__esModule", {
+ value: !0
+ });
+ var n = e("@videojs/vhs-utils/cjs/resolve-url"),
+ r = e("global/window"),
+ a = e("@videojs/vhs-utils/cjs/decode-b64-to-uint8-array"),
+ s = e("@xmldom/xmldom");
+
+ function o(e) {
+ return e && "object" == typeof e && "default" in e ? e : {
+ default: e
+ }
+ }
+ var u = o(n),
+ l = o(r),
+ h = o(a),
+ d = function(e) {
+ return !!e && "object" == typeof e
+ },
+ c = function e() {
+ for (var t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
+ return i.reduce((function(t, i) {
+ return "object" != typeof i || Object.keys(i).forEach((function(n) {
+ Array.isArray(t[n]) && Array.isArray(i[n]) ? t[n] = t[n].concat(i[n]) : d(t[n]) && d(i[n]) ? t[n] = e(t[n], i[n]) : t[n] = i[n]
+ })), t
+ }), {})
+ },
+ f = function(e) {
+ return e.reduce((function(e, t) {
+ return e.concat(t)
+ }), [])
+ },
+ p = function(e) {
+ if (!e.length) return [];
+ for (var t = [], i = 0; i < e.length; i++) t.push(e[i]);
+ return t
+ },
+ m = "INVALID_NUMBER_OF_PERIOD",
+ _ = "DASH_EMPTY_MANIFEST",
+ g = "DASH_INVALID_XML",
+ v = "NO_BASE_URL",
+ y = "SEGMENT_TIME_UNSPECIFIED",
+ b = "UNSUPPORTED_UTC_TIMING_SCHEME",
+ S = function(e) {
+ var t = e.baseUrl,
+ i = void 0 === t ? "" : t,
+ n = e.source,
+ r = void 0 === n ? "" : n,
+ a = e.range,
+ s = void 0 === a ? "" : a,
+ o = e.indexRange,
+ l = void 0 === o ? "" : o,
+ h = {
+ uri: r,
+ resolvedUri: u.default(i || "", r)
+ };
+ if (s || l) {
+ var d = (s || l).split("-"),
+ c = parseInt(d[0], 10),
+ f = parseInt(d[1], 10);
+ h.byterange = {
+ length: f - c + 1,
+ offset: c
+ }
+ }
+ return h
+ },
+ T = function(e) {
+ return e && "number" != typeof e && (e = parseInt(e, 10)), isNaN(e) ? null : e
+ },
+ E = {
+ static: function(e) {
+ var t = e.duration,
+ i = e.timescale,
+ n = void 0 === i ? 1 : i,
+ r = e.sourceDuration,
+ a = e.periodDuration,
+ s = T(e.endNumber),
+ o = t / n;
+ return "number" == typeof s ? {
+ start: 0,
+ end: s
+ } : "number" == typeof a ? {
+ start: 0,
+ end: a / o
+ } : {
+ start: 0,
+ end: r / o
+ }
+ },
+ dynamic: function(e) {
+ var t = e.NOW,
+ i = e.clientOffset,
+ n = e.availabilityStartTime,
+ r = e.timescale,
+ a = void 0 === r ? 1 : r,
+ s = e.duration,
+ o = e.start,
+ u = void 0 === o ? 0 : o,
+ l = e.minimumUpdatePeriod,
+ h = void 0 === l ? 0 : l,
+ d = e.timeShiftBufferDepth,
+ c = void 0 === d ? 1 / 0 : d,
+ f = T(e.endNumber),
+ p = (t + i) / 1e3,
+ m = n + u,
+ _ = p + h - m,
+ g = Math.ceil(_ * a / s),
+ v = Math.floor((p - m - c) * a / s),
+ y = Math.floor((p - m) * a / s);
+ return {
+ start: Math.max(0, v),
+ end: "number" == typeof f ? f : Math.min(g, y)
+ }
+ }
+ },
+ w = function(e) {
+ var t = e.type,
+ i = e.duration,
+ n = e.timescale,
+ r = void 0 === n ? 1 : n,
+ a = e.periodDuration,
+ s = e.sourceDuration,
+ o = E[t](e),
+ u = function(e, t) {
+ for (var i = [], n = e; n < t; n++) i.push(n);
+ return i
+ }(o.start, o.end).map(function(e) {
+ return function(t, i) {
+ var n = e.duration,
+ r = e.timescale,
+ a = void 0 === r ? 1 : r,
+ s = e.periodIndex,
+ o = e.startNumber;
+ return {
+ number: (void 0 === o ? 1 : o) + t,
+ duration: n / a,
+ timeline: s,
+ time: i * n
+ }
+ }
+ }(e));
+ if ("static" === t) {
+ var l = u.length - 1,
+ h = "number" == typeof a ? a : s;
+ u[l].duration = h - i / r * l
+ }
+ return u
+ },
+ A = function(e) {
+ var t = e.baseUrl,
+ i = e.initialization,
+ n = void 0 === i ? {} : i,
+ r = e.sourceDuration,
+ a = e.indexRange,
+ s = void 0 === a ? "" : a,
+ o = e.duration;
+ if (!t) throw new Error(v);
+ var u = S({
+ baseUrl: t,
+ source: n.sourceURL,
+ range: n.range
+ }),
+ l = S({
+ baseUrl: t,
+ source: t,
+ indexRange: s
+ });
+ if (l.map = u, o) {
+ var h = w(e);
+ h.length && (l.duration = h[0].duration, l.timeline = h[0].timeline)
+ } else r && (l.duration = r, l.timeline = 0);
+ return l.number = 0, [l]
+ },
+ C = function(e, t, i) {
+ for (var n = e.sidx.map ? e.sidx.map : null, r = e.sidx.duration, a = e.timeline || 0, s = e.sidx.byterange, o = s.offset + s.length, u = t.timescale, l = t.references.filter((function(e) {
+ return 1 !== e.referenceType
+ })), h = [], d = e.endList ? "static" : "dynamic", c = o + t.firstOffset, f = 0; f < l.length; f++) {
+ var p = t.references[f],
+ m = p.referencedSize,
+ _ = p.subsegmentDuration,
+ g = A({
+ baseUrl: i,
+ timescale: u,
+ timeline: a,
+ periodIndex: a,
+ duration: _,
+ sourceDuration: r,
+ indexRange: c + "-" + (c + m - 1),
+ type: d
+ })[0];
+ n && (g.map = n), h.push(g), c += m
+ }
+ return e.segments = h, e
+ },
+ k = function(e) {
+ return e && e.uri + "-" + (t = e.byterange, i = t.offset + t.length - 1, t.offset + "-" + i);
+ var t, i
+ },
+ P = function(e) {
+ var t;
+ return (t = e.reduce((function(e, t) {
+ var i, n = t.attributes.id + (t.attributes.lang || "");
+ return e[n] ? (t.segments[0] && (t.segments[0].discontinuity = !0), (i = e[n].segments).push.apply(i, t.segments), t.attributes.contentProtection && (e[n].attributes.contentProtection = t.attributes.contentProtection)) : e[n] = t, e
+ }), {}), Object.keys(t).map((function(e) {
+ return t[e]
+ }))).map((function(e) {
+ var t, i;
+ return e.discontinuityStarts = (t = e.segments, i = "discontinuity", t.reduce((function(e, t, n) {
+ return t[i] && e.push(n), e
+ }), [])), e
+ }))
+ },
+ I = function(e, t) {
+ var i = k(e.sidx),
+ n = i && t[i] && t[i].sidx;
+ return n && C(e, n, e.sidx.resolvedUri), e
+ },
+ L = function(e, t) {
+ if (void 0 === t && (t = {}), !Object.keys(t).length) return e;
+ for (var i in e) e[i] = I(e[i], t);
+ return e
+ },
+ x = function(e) {
+ var t, i = e.attributes,
+ n = e.segments,
+ r = e.sidx,
+ a = {
+ attributes: (t = {
+ NAME: i.id,
+ AUDIO: "audio",
+ SUBTITLES: "subs",
+ RESOLUTION: {
+ width: i.width,
+ height: i.height
+ },
+ CODECS: i.codecs,
+ BANDWIDTH: i.bandwidth
+ }, t["PROGRAM-ID"] = 1, t),
+ uri: "",
+ endList: "static" === i.type,
+ timeline: i.periodIndex,
+ resolvedUri: "",
+ targetDuration: i.duration,
+ segments: n,
+ mediaSequence: n.length ? n[0].number : 1
+ };
+ return i.contentProtection && (a.contentProtection = i.contentProtection), r && (a.sidx = r), a
+ },
+ R = function(e) {
+ var t = e.attributes;
+ return "video/mp4" === t.mimeType || "video/webm" === t.mimeType || "video" === t.contentType
+ },
+ D = function(e) {
+ var t = e.attributes;
+ return "audio/mp4" === t.mimeType || "audio/webm" === t.mimeType || "audio" === t.contentType
+ },
+ O = function(e) {
+ var t = e.attributes;
+ return "text/vtt" === t.mimeType || "text" === t.contentType
+ },
+ U = function(e, t, i) {
+ var n;
+ if (void 0 === i && (i = {}), !e.length) return {};
+ var r = e[0].attributes,
+ a = r.sourceDuration,
+ s = r.type,
+ o = r.suggestedPresentationDelay,
+ u = r.minimumUpdatePeriod,
+ l = P(e.filter(R)).map(x),
+ h = P(e.filter(D)),
+ d = e.filter(O),
+ c = e.map((function(e) {
+ return e.attributes.captionServices
+ })).filter(Boolean),
+ f = {
+ allowCache: !0,
+ discontinuityStarts: [],
+ segments: [],
+ endList: !0,
+ mediaGroups: (n = {
+ AUDIO: {},
+ VIDEO: {}
+ }, n["CLOSED-CAPTIONS"] = {}, n.SUBTITLES = {}, n),
+ uri: "",
+ duration: a,
+ playlists: L(l, i)
+ };
+ u >= 0 && (f.minimumUpdatePeriod = 1e3 * u), t && (f.locations = t), "dynamic" === s && (f.suggestedPresentationDelay = o);
+ var p = 0 === f.playlists.length;
+ return h.length && (f.mediaGroups.AUDIO.audio = function(e, t, i) {
+ var n;
+ void 0 === t && (t = {}), void 0 === i && (i = !1);
+ var r = e.reduce((function(e, r) {
+ var a = r.attributes.role && r.attributes.role.value || "",
+ s = r.attributes.lang || "",
+ o = r.attributes.label || "main";
+ if (s && !r.attributes.label) {
+ var u = a ? " (" + a + ")" : "";
+ o = "" + r.attributes.lang + u
+ }
+ e[o] || (e[o] = {
+ language: s,
+ autoselect: !0,
+ default: "main" === a,
+ playlists: [],
+ uri: ""
+ });
+ var l = I(function(e, t) {
+ var i, n = e.attributes,
+ r = e.segments,
+ a = e.sidx,
+ s = {
+ attributes: (i = {
+ NAME: n.id,
+ BANDWIDTH: n.bandwidth,
+ CODECS: n.codecs
+ }, i["PROGRAM-ID"] = 1, i),
+ uri: "",
+ endList: "static" === n.type,
+ timeline: n.periodIndex,
+ resolvedUri: "",
+ targetDuration: n.duration,
+ segments: r,
+ mediaSequence: r.length ? r[0].number : 1
+ };
+ return n.contentProtection && (s.contentProtection = n.contentProtection), a && (s.sidx = a), t && (s.attributes.AUDIO = "audio", s.attributes.SUBTITLES = "subs"), s
+ }(r, i), t);
+ return e[o].playlists.push(l), void 0 === n && "main" === a && ((n = r).default = !0), e
+ }), {});
+ n || (r[Object.keys(r)[0]].default = !0);
+ return r
+ }(h, i, p)), d.length && (f.mediaGroups.SUBTITLES.subs = function(e, t) {
+ return void 0 === t && (t = {}), e.reduce((function(e, i) {
+ var n = i.attributes.lang || "text";
+ return e[n] || (e[n] = {
+ language: n,
+ default: !1,
+ autoselect: !1,
+ playlists: [],
+ uri: ""
+ }), e[n].playlists.push(I(function(e) {
+ var t, i = e.attributes,
+ n = e.segments;
+ void 0 === n && (n = [{
+ uri: i.baseUrl,
+ timeline: i.periodIndex,
+ resolvedUri: i.baseUrl || "",
+ duration: i.sourceDuration,
+ number: 0
+ }], i.duration = i.sourceDuration);
+ var r = ((t = {
+ NAME: i.id,
+ BANDWIDTH: i.bandwidth
+ })["PROGRAM-ID"] = 1, t);
+ return i.codecs && (r.CODECS = i.codecs), {
+ attributes: r,
+ uri: "",
+ endList: "static" === i.type,
+ timeline: i.periodIndex,
+ resolvedUri: i.baseUrl || "",
+ targetDuration: i.duration,
+ segments: n,
+ mediaSequence: n.length ? n[0].number : 1
+ }
+ }(i), t)), e
+ }), {})
+ }(d, i)), c.length && (f.mediaGroups["CLOSED-CAPTIONS"].cc = c.reduce((function(e, t) {
+ return t ? (t.forEach((function(t) {
+ var i = t.channel,
+ n = t.language;
+ e[n] = {
+ autoselect: !1,
+ default: !1,
+ instreamId: i,
+ language: n
+ }, t.hasOwnProperty("aspectRatio") && (e[n].aspectRatio = t.aspectRatio), t.hasOwnProperty("easyReader") && (e[n].easyReader = t.easyReader), t.hasOwnProperty("3D") && (e[n]["3D"] = t["3D"])
+ })), e) : e
+ }), {})), f
+ },
+ M = function(e, t, i) {
+ var n = e.NOW,
+ r = e.clientOffset,
+ a = e.availabilityStartTime,
+ s = e.timescale,
+ o = void 0 === s ? 1 : s,
+ u = e.start,
+ l = void 0 === u ? 0 : u,
+ h = e.minimumUpdatePeriod,
+ d = (n + r) / 1e3 + (void 0 === h ? 0 : h) - (a + l);
+ return Math.ceil((d * o - t) / i)
+ },
+ F = function(e, t) {
+ for (var i = e.type, n = e.minimumUpdatePeriod, r = void 0 === n ? 0 : n, a = e.media, s = void 0 === a ? "" : a, o = e.sourceDuration, u = e.timescale, l = void 0 === u ? 1 : u, h = e.startNumber, d = void 0 === h ? 1 : h, c = e.periodIndex, f = [], p = -1, m = 0; m < t.length; m++) {
+ var _ = t[m],
+ g = _.d,
+ v = _.r || 0,
+ y = _.t || 0;
+ p < 0 && (p = y), y && y > p && (p = y);
+ var b = void 0;
+ if (v < 0) {
+ var S = m + 1;
+ b = S === t.length ? "dynamic" === i && r > 0 && s.indexOf("$Number$") > 0 ? M(e, p, g) : (o * l - p) / g : (t[S].t - p) / g
+ } else b = v + 1;
+ for (var T = d + f.length + b, E = d + f.length; E < T;) f.push({
+ number: E,
+ duration: g / l,
+ time: p,
+ timeline: c
+ }), p += g, E++
+ }
+ return f
+ },
+ B = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,
+ N = function(e, t) {
+ return e.replace(B, function(e) {
+ return function(t, i, n, r) {
+ if ("$$" === t) return "$";
+ if (void 0 === e[i]) return t;
+ var a = "" + e[i];
+ return "RepresentationID" === i ? a : (r = n ? parseInt(r, 10) : 1, a.length >= r ? a : "" + new Array(r - a.length + 1).join("0") + a)
+ }
+ }(t))
+ },
+ j = function(e, t) {
+ var i = {
+ RepresentationID: e.id,
+ Bandwidth: e.bandwidth || 0
+ },
+ n = e.initialization,
+ r = void 0 === n ? {
+ sourceURL: "",
+ range: ""
+ } : n,
+ a = S({
+ baseUrl: e.baseUrl,
+ source: N(r.sourceURL, i),
+ range: r.range
+ });
+ return function(e, t) {
+ return e.duration || t ? e.duration ? w(e) : F(e, t) : [{
+ number: e.startNumber || 1,
+ duration: e.sourceDuration,
+ time: 0,
+ timeline: e.periodIndex
+ }]
+ }(e, t).map((function(t) {
+ i.Number = t.number, i.Time = t.time;
+ var n = N(e.media || "", i),
+ r = e.timescale || 1,
+ s = e.presentationTimeOffset || 0,
+ o = e.periodStart + (t.time - s) / r;
+ return {
+ uri: n,
+ timeline: t.timeline,
+ duration: t.duration,
+ resolvedUri: u.default(e.baseUrl || "", n),
+ map: a,
+ number: t.number,
+ presentationTime: o
+ }
+ }))
+ },
+ V = function(e, t) {
+ var i = e.duration,
+ n = e.segmentUrls,
+ r = void 0 === n ? [] : n,
+ a = e.periodStart;
+ if (!i && !t || i && t) throw new Error(y);
+ var s, o = r.map((function(t) {
+ return function(e, t) {
+ var i = e.baseUrl,
+ n = e.initialization,
+ r = void 0 === n ? {} : n,
+ a = S({
+ baseUrl: i,
+ source: r.sourceURL,
+ range: r.range
+ }),
+ s = S({
+ baseUrl: i,
+ source: t.media,
+ range: t.mediaRange
+ });
+ return s.map = a, s
+ }(e, t)
+ }));
+ return i && (s = w(e)), t && (s = F(e, t)), s.map((function(t, i) {
+ if (o[i]) {
+ var n = o[i],
+ r = e.timescale || 1,
+ s = e.presentationTimeOffset || 0;
+ return n.timeline = t.timeline, n.duration = t.duration, n.number = t.number, n.presentationTime = a + (t.time - s) / r, n
+ }
+ })).filter((function(e) {
+ return e
+ }))
+ },
+ H = function(e) {
+ var t, i, n = e.attributes,
+ r = e.segmentInfo;
+ r.template ? (i = j, t = c(n, r.template)) : r.base ? (i = A, t = c(n, r.base)) : r.list && (i = V, t = c(n, r.list));
+ var a = {
+ attributes: n
+ };
+ if (!i) return a;
+ var s = i(t, r.segmentTimeline);
+ if (t.duration) {
+ var o = t,
+ u = o.duration,
+ l = o.timescale,
+ h = void 0 === l ? 1 : l;
+ t.duration = u / h
+ } else s.length ? t.duration = s.reduce((function(e, t) {
+ return Math.max(e, Math.ceil(t.duration))
+ }), 0) : t.duration = 0;
+ return a.attributes = t, a.segments = s, r.base && t.indexRange && (a.sidx = s[0], a.segments = []), a
+ },
+ z = function(e) {
+ return e.map(H)
+ },
+ G = function(e, t) {
+ return p(e.childNodes).filter((function(e) {
+ return e.tagName === t
+ }))
+ },
+ W = function(e) {
+ return e.textContent.trim()
+ },
+ Y = function(e) {
+ var t = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);
+ if (!t) return 0;
+ var i = t.slice(1),
+ n = i[0],
+ r = i[1],
+ a = i[2],
+ s = i[3],
+ o = i[4],
+ u = i[5];
+ return 31536e3 * parseFloat(n || 0) + 2592e3 * parseFloat(r || 0) + 86400 * parseFloat(a || 0) + 3600 * parseFloat(s || 0) + 60 * parseFloat(o || 0) + parseFloat(u || 0)
+ },
+ q = {
+ mediaPresentationDuration: function(e) {
+ return Y(e)
+ },
+ availabilityStartTime: function(e) {
+ return /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t = e) && (t += "Z"), Date.parse(t) / 1e3;
+ var t
+ },
+ minimumUpdatePeriod: function(e) {
+ return Y(e)
+ },
+ suggestedPresentationDelay: function(e) {
+ return Y(e)
+ },
+ type: function(e) {
+ return e
+ },
+ timeShiftBufferDepth: function(e) {
+ return Y(e)
+ },
+ start: function(e) {
+ return Y(e)
+ },
+ width: function(e) {
+ return parseInt(e, 10)
+ },
+ height: function(e) {
+ return parseInt(e, 10)
+ },
+ bandwidth: function(e) {
+ return parseInt(e, 10)
+ },
+ startNumber: function(e) {
+ return parseInt(e, 10)
+ },
+ timescale: function(e) {
+ return parseInt(e, 10)
+ },
+ presentationTimeOffset: function(e) {
+ return parseInt(e, 10)
+ },
+ duration: function(e) {
+ var t = parseInt(e, 10);
+ return isNaN(t) ? Y(e) : t
+ },
+ d: function(e) {
+ return parseInt(e, 10)
+ },
+ t: function(e) {
+ return parseInt(e, 10)
+ },
+ r: function(e) {
+ return parseInt(e, 10)
+ },
+ DEFAULT: function(e) {
+ return e
+ }
+ },
+ K = function(e) {
+ return e && e.attributes ? p(e.attributes).reduce((function(e, t) {
+ var i = q[t.name] || q.DEFAULT;
+ return e[t.name] = i(t.value), e
+ }), {}) : {}
+ },
+ X = {
+ "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
+ "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
+ "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
+ "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
+ },
+ Q = function(e, t) {
+ return t.length ? f(e.map((function(e) {
+ return t.map((function(t) {
+ return u.default(e, W(t))
+ }))
+ }))) : e
+ },
+ $ = function(e) {
+ var t = G(e, "SegmentTemplate")[0],
+ i = G(e, "SegmentList")[0],
+ n = i && G(i, "SegmentURL").map((function(e) {
+ return c({
+ tag: "SegmentURL"
+ }, K(e))
+ })),
+ r = G(e, "SegmentBase")[0],
+ a = i || t,
+ s = a && G(a, "SegmentTimeline")[0],
+ o = i || r || t,
+ u = o && G(o, "Initialization")[0],
+ l = t && K(t);
+ l && u ? l.initialization = u && K(u) : l && l.initialization && (l.initialization = {
+ sourceURL: l.initialization
+ });
+ var h = {
+ template: l,
+ segmentTimeline: s && G(s, "S").map((function(e) {
+ return K(e)
+ })),
+ list: i && c(K(i), {
+ segmentUrls: n,
+ initialization: K(u)
+ }),
+ base: r && c(K(r), {
+ initialization: K(u)
+ })
+ };
+ return Object.keys(h).forEach((function(e) {
+ h[e] || delete h[e]
+ })), h
+ },
+ J = function(e, t, i) {
+ return function(n) {
+ var r, a = K(n),
+ s = Q(t, G(n, "BaseURL")),
+ o = G(n, "Role")[0],
+ u = {
+ role: K(o)
+ },
+ l = c(e, a, u),
+ d = G(n, "Accessibility")[0],
+ p = "urn:scte:dash:cc:cea-608:2015" === (r = K(d)).schemeIdUri ? r.value.split(";").map((function(e) {
+ var t, i;
+ if (i = e, /^CC\d=/.test(e)) {
+ var n = e.split("=");
+ t = n[0], i = n[1]
+ } else /^CC\d$/.test(e) && (t = e);
+ return {
+ channel: t,
+ language: i
+ }
+ })) : "urn:scte:dash:cc:cea-708:2015" === r.schemeIdUri ? r.value.split(";").map((function(e) {
+ var t = {
+ channel: void 0,
+ language: void 0,
+ aspectRatio: 1,
+ easyReader: 0,
+ "3D": 0
+ };
+ if (/=/.test(e)) {
+ var i = e.split("="),
+ n = i[0],
+ r = i[1],
+ a = void 0 === r ? "" : r;
+ t.channel = n, t.language = e, a.split(",").forEach((function(e) {
+ var i = e.split(":"),
+ n = i[0],
+ r = i[1];
+ "lang" === n ? t.language = r : "er" === n ? t.easyReader = Number(r) : "war" === n ? t.aspectRatio = Number(r) : "3D" === n && (t["3D"] = Number(r))
+ }))
+ } else t.language = e;
+ return t.channel && (t.channel = "SERVICE" + t.channel), t
+ })) : void 0;
+ p && (l = c(l, {
+ captionServices: p
+ }));
+ var m = G(n, "Label")[0];
+ if (m && m.childNodes.length) {
+ var _ = m.childNodes[0].nodeValue.trim();
+ l = c(l, {
+ label: _
+ })
+ }
+ var g = G(n, "ContentProtection").reduce((function(e, t) {
+ var i = K(t),
+ n = X[i.schemeIdUri];
+ if (n) {
+ e[n] = {
+ attributes: i
+ };
+ var r = G(t, "cenc:pssh")[0];
+ if (r) {
+ var a = W(r),
+ s = a && h.default(a);
+ e[n].pssh = s
+ }
+ }
+ return e
+ }), {});
+ Object.keys(g).length && (l = c(l, {
+ contentProtection: g
+ }));
+ var v = $(n),
+ y = G(n, "Representation"),
+ b = c(i, v);
+ return f(y.map(function(e, t, i) {
+ return function(n) {
+ var r = G(n, "BaseURL"),
+ a = Q(t, r),
+ s = c(e, K(n)),
+ o = $(n);
+ return a.map((function(e) {
+ return {
+ segmentInfo: c(i, o),
+ attributes: c(s, {
+ baseUrl: e
+ })
+ }
+ }))
+ }
+ }(l, s, b)))
+ }
+ },
+ Z = function(e, t) {
+ return function(i, n) {
+ var r = Q(t, G(i.node, "BaseURL")),
+ a = parseInt(i.attributes.id, 10),
+ s = l.default.isNaN(a) ? n : a,
+ o = c(e, {
+ periodIndex: s,
+ periodStart: i.attributes.start
+ });
+ "number" == typeof i.attributes.duration && (o.periodDuration = i.attributes.duration);
+ var u = G(i.node, "AdaptationSet"),
+ h = $(i.node);
+ return f(u.map(J(o, r, h)))
+ }
+ },
+ ee = function(e, t) {
+ void 0 === t && (t = {});
+ var i = t,
+ n = i.manifestUri,
+ r = void 0 === n ? "" : n,
+ a = i.NOW,
+ s = void 0 === a ? Date.now() : a,
+ o = i.clientOffset,
+ u = void 0 === o ? 0 : o,
+ l = G(e, "Period");
+ if (!l.length) throw new Error(m);
+ var h = G(e, "Location"),
+ d = K(e),
+ c = Q([r], G(e, "BaseURL"));
+ d.type = d.type || "static", d.sourceDuration = d.mediaPresentationDuration || 0, d.NOW = s, d.clientOffset = u, h.length && (d.locations = h.map(W));
+ var p = [];
+ return l.forEach((function(e, t) {
+ var i = K(e),
+ n = p[t - 1];
+ i.start = function(e) {
+ var t = e.attributes,
+ i = e.priorPeriodAttributes,
+ n = e.mpdType;
+ return "number" == typeof t.start ? t.start : i && "number" == typeof i.start && "number" == typeof i.duration ? i.start + i.duration : i || "static" !== n ? null : 0
+ }({
+ attributes: i,
+ priorPeriodAttributes: n ? n.attributes : null,
+ mpdType: d.type
+ }), p.push({
+ node: e,
+ attributes: i
+ })
+ })), {
+ locations: d.locations,
+ representationInfo: f(p.map(Z(d, c)))
+ }
+ },
+ te = function(e) {
+ if ("" === e) throw new Error(_);
+ var t, i, n = new s.DOMParser;
+ try {
+ i = (t = n.parseFromString(e, "application/xml")) && "MPD" === t.documentElement.tagName ? t.documentElement : null
+ } catch (e) {}
+ if (!i || i && i.getElementsByTagName("parsererror").length > 0) throw new Error(g);
+ return i
+ };
+ i.VERSION = "0.19.0", i.addSidxSegmentsToPlaylist = C, i.generateSidxKey = k, i.inheritAttributes = ee, i.parse = function(e, t) {
+ void 0 === t && (t = {});
+ var i = ee(te(e), t),
+ n = z(i.representationInfo);
+ return U(n, i.locations, t.sidxMapping)
+ }, i.parseUTCTiming = function(e) {
+ return function(e) {
+ var t = G(e, "UTCTiming")[0];
+ if (!t) return null;
+ var i = K(t);
+ switch (i.schemeIdUri) {
+ case "urn:mpeg:dash:utc:http-head:2014":
+ case "urn:mpeg:dash:utc:http-head:2012":
+ i.method = "HEAD";
+ break;
+ case "urn:mpeg:dash:utc:http-xsdate:2014":
+ case "urn:mpeg:dash:utc:http-iso:2014":
+ case "urn:mpeg:dash:utc:http-xsdate:2012":
+ case "urn:mpeg:dash:utc:http-iso:2012":
+ i.method = "GET";
+ break;
+ case "urn:mpeg:dash:utc:direct:2014":
+ case "urn:mpeg:dash:utc:direct:2012":
+ i.method = "DIRECT", i.value = Date.parse(i.value);
+ break;
+ case "urn:mpeg:dash:utc:http-ntp:2014":
+ case "urn:mpeg:dash:utc:ntp:2014":
+ case "urn:mpeg:dash:utc:sntp:2014":
+ default:
+ throw new Error(b)
+ }
+ return i
+ }(te(e))
+ }, i.stringToMpdXml = te, i.toM3u8 = U, i.toPlaylists = z
+ }, {
+ "@videojs/vhs-utils/cjs/decode-b64-to-uint8-array": 13,
+ "@videojs/vhs-utils/cjs/resolve-url": 20,
+ "@xmldom/xmldom": 28,
+ "global/window": 34
+ }],
+ 41: [function(e, t, i) {
+ var n, r;
+ n = window, r = function() {
+ return function(e) {
+ var t = {};
+
+ function i(n) {
+ if (t[n]) return t[n].exports;
+ var r = t[n] = {
+ i: n,
+ l: !1,
+ exports: {}
+ };
+ return e[n].call(r.exports, r, r.exports, i), r.l = !0, r.exports
+ }
+ return i.m = e, i.c = t, i.d = function(e, t, n) {
+ i.o(e, t) || Object.defineProperty(e, t, {
+ enumerable: !0,
+ get: n
+ })
+ }, i.r = function(e) {
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
+ value: "Module"
+ }), Object.defineProperty(e, "__esModule", {
+ value: !0
+ })
+ }, i.t = function(e, t) {
+ if (1 & t && (e = i(e)), 8 & t) return e;
+ if (4 & t && "object" == typeof e && e && e.__esModule) return e;
+ var n = Object.create(null);
+ if (i.r(n), Object.defineProperty(n, "default", {
+ enumerable: !0,
+ value: e
+ }), 2 & t && "string" != typeof e)
+ for (var r in e) i.d(n, r, function(t) {
+ return e[t]
+ }.bind(null, r));
+ return n
+ }, i.n = function(e) {
+ var t = e && e.__esModule ? function() {
+ return e.default
+ } : function() {
+ return e
+ };
+ return i.d(t, "a", t), t
+ }, i.o = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }, i.p = "", i(i.s = 14)
+ }([function(e, t, i) {
+ "use strict";
+ var n = i(6),
+ r = i.n(n),
+ a = function() {
+ function e() {}
+ return e.e = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "error", n), e.ENABLE_ERROR && (console.error ? console.error(n) : console.warn)
+ }, e.i = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "info", n), e.ENABLE_INFO && console.info && console.info(n)
+ }, e.w = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "warn", n), e.ENABLE_WARN && console.warn
+ }, e.d = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "debug", n), e.ENABLE_DEBUG && console.debug && console.debug(n)
+ }, e.v = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "verbose", n), e.ENABLE_VERBOSE
+ }, e
+ }();
+ a.GLOBAL_TAG = "mpegts.js", a.FORCE_GLOBAL_TAG = !1, a.ENABLE_ERROR = !0, a.ENABLE_INFO = !0, a.ENABLE_WARN = !0, a.ENABLE_DEBUG = !0, a.ENABLE_VERBOSE = !0, a.ENABLE_CALLBACK = !1, a.emitter = new r.a, t.a = a
+ }, function(e, t, i) {
+ "use strict";
+ t.a = {
+ IO_ERROR: "io_error",
+ DEMUX_ERROR: "demux_error",
+ INIT_SEGMENT: "init_segment",
+ MEDIA_SEGMENT: "media_segment",
+ LOADING_COMPLETE: "loading_complete",
+ RECOVERED_EARLY_EOF: "recovered_early_eof",
+ MEDIA_INFO: "media_info",
+ METADATA_ARRIVED: "metadata_arrived",
+ SCRIPTDATA_ARRIVED: "scriptdata_arrived",
+ TIMED_ID3_METADATA_ARRIVED: "timed_id3_metadata_arrived",
+ PES_PRIVATE_DATA_DESCRIPTOR: "pes_private_data_descriptor",
+ PES_PRIVATE_DATA_ARRIVED: "pes_private_data_arrived",
+ STATISTICS_INFO: "statistics_info",
+ RECOMMEND_SEEKPOINT: "recommend_seekpoint"
+ }
+ }, function(e, t, i) {
+ "use strict";
+ i.d(t, "c", (function() {
+ return r
+ })), i.d(t, "b", (function() {
+ return a
+ })), i.d(t, "a", (function() {
+ return s
+ }));
+ var n = i(3),
+ r = {
+ kIdle: 0,
+ kConnecting: 1,
+ kBuffering: 2,
+ kError: 3,
+ kComplete: 4
+ },
+ a = {
+ OK: "OK",
+ EXCEPTION: "Exception",
+ HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
+ CONNECTING_TIMEOUT: "ConnectingTimeout",
+ EARLY_EOF: "EarlyEof",
+ UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
+ },
+ s = function() {
+ function e(e) {
+ this._type = e || "undefined", this._status = r.kIdle, this._needStash = !1, this._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this._onError = null, this._onComplete = null
+ }
+ return e.prototype.destroy = function() {
+ this._status = r.kIdle, this._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this._onError = null, this._onComplete = null
+ }, e.prototype.isWorking = function() {
+ return this._status === r.kConnecting || this._status === r.kBuffering
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "status", {
+ get: function() {
+ return this._status
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "needStashBuffer", {
+ get: function() {
+ return this._needStash
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onContentLengthKnown", {
+ get: function() {
+ return this._onContentLengthKnown
+ },
+ set: function(e) {
+ this._onContentLengthKnown = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onURLRedirect", {
+ get: function() {
+ return this._onURLRedirect
+ },
+ set: function(e) {
+ this._onURLRedirect = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataArrival", {
+ get: function() {
+ return this._onDataArrival
+ },
+ set: function(e) {
+ this._onDataArrival = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onComplete", {
+ get: function() {
+ return this._onComplete
+ },
+ set: function(e) {
+ this._onComplete = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.open = function(e, t) {
+ throw new n.c("Unimplemented abstract function!")
+ }, e.prototype.abort = function() {
+ throw new n.c("Unimplemented abstract function!")
+ }, e
+ }()
+ }, function(e, t, i) {
+ "use strict";
+ i.d(t, "d", (function() {
+ return a
+ })), i.d(t, "a", (function() {
+ return s
+ })), i.d(t, "b", (function() {
+ return o
+ })), i.d(t, "c", (function() {
+ return u
+ }));
+ var n, r = (n = function(e, t) {
+ return (n = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ function i() {
+ this.constructor = e
+ }
+ n(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ a = function() {
+ function e(e) {
+ this._message = e
+ }
+ return Object.defineProperty(e.prototype, "name", {
+ get: function() {
+ return "RuntimeException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "message", {
+ get: function() {
+ return this._message
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.toString = function() {
+ return this.name + ": " + this.message
+ }, e
+ }(),
+ s = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "IllegalStateException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a),
+ o = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "InvalidArgumentException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a),
+ u = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "NotImplementedException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a)
+ }, function(e, t, i) {
+ "use strict";
+ var n = {};
+ ! function() {
+ var e = self.navigator.userAgent.toLowerCase(),
+ t = /(edge)\/([\w.]+)/.exec(e) || /(opr)[\/]([\w.]+)/.exec(e) || /(chrome)[ \/]([\w.]+)/.exec(e) || /(iemobile)[\/]([\w.]+)/.exec(e) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/.exec(e) || e.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 && /(firefox)[ \/]([\w.]+)/.exec(e) || [],
+ i = /(ipad)/.exec(e) || /(ipod)/.exec(e) || /(windows phone)/.exec(e) || /(iphone)/.exec(e) || /(kindle)/.exec(e) || /(android)/.exec(e) || /(windows)/.exec(e) || /(mac)/.exec(e) || /(linux)/.exec(e) || /(cros)/.exec(e) || [],
+ r = {
+ browser: t[5] || t[3] || t[1] || "",
+ version: t[2] || t[4] || "0",
+ majorVersion: t[4] || t[2] || "0",
+ platform: i[0] || ""
+ },
+ a = {};
+ if (r.browser) {
+ a[r.browser] = !0;
+ var s = r.majorVersion.split(".");
+ a.version = {
+ major: parseInt(r.majorVersion, 10),
+ string: r.version
+ }, s.length > 1 && (a.version.minor = parseInt(s[1], 10)), s.length > 2 && (a.version.build = parseInt(s[2], 10))
+ }
+ for (var o in r.platform && (a[r.platform] = !0), (a.chrome || a.opr || a.safari) && (a.webkit = !0), (a.rv || a.iemobile) && (a.rv && delete a.rv, r.browser = "msie", a.msie = !0), a.edge && (delete a.edge, r.browser = "msedge", a.msedge = !0), a.opr && (r.browser = "opera", a.opera = !0), a.safari && a.android && (r.browser = "android", a.android = !0), a.name = r.browser, a.platform = r.platform, n) n.hasOwnProperty(o) && delete n[o];
+ Object.assign(n, a)
+ }(), t.a = n
+ }, function(e, t, i) {
+ "use strict";
+ t.a = {
+ OK: "OK",
+ FORMAT_ERROR: "FormatError",
+ FORMAT_UNSUPPORTED: "FormatUnsupported",
+ CODEC_UNSUPPORTED: "CodecUnsupported"
+ }
+ }, function(e, t, i) {
+ "use strict";
+ var n, r = "object" == typeof Reflect ? Reflect : null,
+ a = r && "function" == typeof r.apply ? r.apply : function(e, t, i) {
+ return Function.prototype.apply.call(e, t, i)
+ };
+ n = r && "function" == typeof r.ownKeys ? r.ownKeys : Object.getOwnPropertySymbols ? function(e) {
+ return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))
+ } : function(e) {
+ return Object.getOwnPropertyNames(e)
+ };
+ var s = Number.isNaN || function(e) {
+ return e != e
+ };
+
+ function o() {
+ o.init.call(this)
+ }
+ e.exports = o, e.exports.once = function(e, t) {
+ return new Promise((function(i, n) {
+ function r(i) {
+ e.removeListener(t, a), n(i)
+ }
+
+ function a() {
+ "function" == typeof e.removeListener && e.removeListener("error", r), i([].slice.call(arguments))
+ }
+ g(e, t, a, {
+ once: !0
+ }), "error" !== t && function(e, t, i) {
+ "function" == typeof e.on && g(e, "error", t, {
+ once: !0
+ })
+ }(e, r)
+ }))
+ }, o.EventEmitter = o, o.prototype._events = void 0, o.prototype._eventsCount = 0, o.prototype._maxListeners = void 0;
+ var u = 10;
+
+ function l(e) {
+ if ("function" != typeof e) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof e)
+ }
+
+ function h(e) {
+ return void 0 === e._maxListeners ? o.defaultMaxListeners : e._maxListeners
+ }
+
+ function d(e, t, i, n) {
+ var r, a, s;
+ if (l(i), void 0 === (a = e._events) ? (a = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== a.newListener && (e.emit("newListener", t, i.listener ? i.listener : i), a = e._events), s = a[t]), void 0 === s) s = a[t] = i, ++e._eventsCount;
+ else if ("function" == typeof s ? s = a[t] = n ? [i, s] : [s, i] : n ? s.unshift(i) : s.push(i), (r = h(e)) > 0 && s.length > r && !s.warned) {
+ s.warned = !0;
+ var o = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
+ o.name = "MaxListenersExceededWarning", o.emitter = e, o.type = t, o.count = s.length, console && console.warn
+ }
+ return e
+ }
+
+ function c() {
+ if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments)
+ }
+
+ function f(e, t, i) {
+ var n = {
+ fired: !1,
+ wrapFn: void 0,
+ target: e,
+ type: t,
+ listener: i
+ },
+ r = c.bind(n);
+ return r.listener = i, n.wrapFn = r, r
+ }
+
+ function p(e, t, i) {
+ var n = e._events;
+ if (void 0 === n) return [];
+ var r = n[t];
+ return void 0 === r ? [] : "function" == typeof r ? i ? [r.listener || r] : [r] : i ? function(e) {
+ for (var t = new Array(e.length), i = 0; i < t.length; ++i) t[i] = e[i].listener || e[i];
+ return t
+ }(r) : _(r, r.length)
+ }
+
+ function m(e) {
+ var t = this._events;
+ if (void 0 !== t) {
+ var i = t[e];
+ if ("function" == typeof i) return 1;
+ if (void 0 !== i) return i.length
+ }
+ return 0
+ }
+
+ function _(e, t) {
+ for (var i = new Array(t), n = 0; n < t; ++n) i[n] = e[n];
+ return i
+ }
+
+ function g(e, t, i, n) {
+ if ("function" == typeof e.on) n.once ? e.once(t, i) : e.on(t, i);
+ else {
+ if ("function" != typeof e.addEventListener) throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
+ e.addEventListener(t, (function r(a) {
+ n.once && e.removeEventListener(t, r), i(a)
+ }))
+ }
+ }
+ Object.defineProperty(o, "defaultMaxListeners", {
+ enumerable: !0,
+ get: function() {
+ return u
+ },
+ set: function(e) {
+ if ("number" != typeof e || e < 0 || s(e)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
+ u = e
+ }
+ }), o.init = function() {
+ void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0
+ }, o.prototype.setMaxListeners = function(e) {
+ if ("number" != typeof e || e < 0 || s(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
+ return this._maxListeners = e, this
+ }, o.prototype.getMaxListeners = function() {
+ return h(this)
+ }, o.prototype.emit = function(e) {
+ for (var t = [], i = 1; i < arguments.length; i++) t.push(arguments[i]);
+ var n = "error" === e,
+ r = this._events;
+ if (void 0 !== r) n = n && void 0 === r.error;
+ else if (!n) return !1;
+ if (n) {
+ var s;
+ if (t.length > 0 && (s = t[0]), s instanceof Error) throw s;
+ var o = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
+ throw o.context = s, o
+ }
+ var u = r[e];
+ if (void 0 === u) return !1;
+ if ("function" == typeof u) a(u, this, t);
+ else {
+ var l = u.length,
+ h = _(u, l);
+ for (i = 0; i < l; ++i) a(h[i], this, t)
+ }
+ return !0
+ }, o.prototype.addListener = function(e, t) {
+ return d(this, e, t, !1)
+ }, o.prototype.on = o.prototype.addListener, o.prototype.prependListener = function(e, t) {
+ return d(this, e, t, !0)
+ }, o.prototype.once = function(e, t) {
+ return l(t), this.on(e, f(this, e, t)), this
+ }, o.prototype.prependOnceListener = function(e, t) {
+ return l(t), this.prependListener(e, f(this, e, t)), this
+ }, o.prototype.removeListener = function(e, t) {
+ var i, n, r, a, s;
+ if (l(t), void 0 === (n = this._events)) return this;
+ if (void 0 === (i = n[e])) return this;
+ if (i === t || i.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete n[e], n.removeListener && this.emit("removeListener", e, i.listener || t));
+ else if ("function" != typeof i) {
+ for (r = -1, a = i.length - 1; a >= 0; a--)
+ if (i[a] === t || i[a].listener === t) {
+ s = i[a].listener, r = a;
+ break
+ } if (r < 0) return this;
+ 0 === r ? i.shift() : function(e, t) {
+ for (; t + 1 < e.length; t++) e[t] = e[t + 1];
+ e.pop()
+ }(i, r), 1 === i.length && (n[e] = i[0]), void 0 !== n.removeListener && this.emit("removeListener", e, s || t)
+ }
+ return this
+ }, o.prototype.off = o.prototype.removeListener, o.prototype.removeAllListeners = function(e) {
+ var t, i, n;
+ if (void 0 === (i = this._events)) return this;
+ if (void 0 === i.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== i[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete i[e]), this;
+ if (0 === arguments.length) {
+ var r, a = Object.keys(i);
+ for (n = 0; n < a.length; ++n) "removeListener" !== (r = a[n]) && this.removeAllListeners(r);
+ return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this
+ }
+ if ("function" == typeof(t = i[e])) this.removeListener(e, t);
+ else if (void 0 !== t)
+ for (n = t.length - 1; n >= 0; n--) this.removeListener(e, t[n]);
+ return this
+ }, o.prototype.listeners = function(e) {
+ return p(this, e, !0)
+ }, o.prototype.rawListeners = function(e) {
+ return p(this, e, !1)
+ }, o.listenerCount = function(e, t) {
+ return "function" == typeof e.listenerCount ? e.listenerCount(t) : m.call(e, t)
+ }, o.prototype.listenerCount = m, o.prototype.eventNames = function() {
+ return this._eventsCount > 0 ? n(this._events) : []
+ }
+ }, function(e, t, i) {
+ "use strict";
+ i.d(t, "d", (function() {
+ return n
+ })), i.d(t, "b", (function() {
+ return r
+ })), i.d(t, "a", (function() {
+ return a
+ })), i.d(t, "c", (function() {
+ return s
+ }));
+ var n = function(e, t, i, n, r) {
+ this.dts = e, this.pts = t, this.duration = i, this.originalDts = n, this.isSyncPoint = r, this.fileposition = null
+ },
+ r = function() {
+ function e() {
+ this.beginDts = 0, this.endDts = 0, this.beginPts = 0, this.endPts = 0, this.originalBeginDts = 0, this.originalEndDts = 0, this.syncPoints = [], this.firstSample = null, this.lastSample = null
+ }
+ return e.prototype.appendSyncPoint = function(e) {
+ e.isSyncPoint = !0, this.syncPoints.push(e)
+ }, e
+ }(),
+ a = function() {
+ function e() {
+ this._list = []
+ }
+ return e.prototype.clear = function() {
+ this._list = []
+ }, e.prototype.appendArray = function(e) {
+ var t = this._list;
+ 0 !== e.length && (t.length > 0 && e[0].originalDts < t[t.length - 1].originalDts && this.clear(), Array.prototype.push.apply(t, e))
+ }, e.prototype.getLastSyncPointBeforeDts = function(e) {
+ if (0 == this._list.length) return null;
+ var t = this._list,
+ i = 0,
+ n = t.length - 1,
+ r = 0,
+ a = 0,
+ s = n;
+ for (e < t[0].dts && (i = 0, a = s + 1); a <= s;) {
+ if ((r = a + Math.floor((s - a) / 2)) === n || e >= t[r].dts && e < t[r + 1].dts) {
+ i = r;
+ break
+ }
+ t[r].dts < e ? a = r + 1 : s = r - 1
+ }
+ return this._list[i]
+ }, e
+ }(),
+ s = function() {
+ function e(e) {
+ this._type = e, this._list = [], this._lastAppendLocation = -1
+ }
+ return Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "length", {
+ get: function() {
+ return this._list.length
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.isEmpty = function() {
+ return 0 === this._list.length
+ }, e.prototype.clear = function() {
+ this._list = [], this._lastAppendLocation = -1
+ }, e.prototype._searchNearestSegmentBefore = function(e) {
+ var t = this._list;
+ if (0 === t.length) return -2;
+ var i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i,
+ s = 0;
+ if (e < t[0].originalBeginDts) return -1;
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e > t[n].lastSample.originalDts && e < t[n + 1].originalBeginDts) {
+ s = n;
+ break
+ }
+ t[n].originalBeginDts < e ? r = n + 1 : a = n - 1
+ }
+ return s
+ }, e.prototype._searchNearestSegmentAfter = function(e) {
+ return this._searchNearestSegmentBefore(e) + 1
+ }, e.prototype.append = function(e) {
+ var t = this._list,
+ i = e,
+ n = this._lastAppendLocation,
+ r = 0; - 1 !== n && n < t.length && i.originalBeginDts >= t[n].lastSample.originalDts && (n === t.length - 1 || n < t.length - 1 && i.originalBeginDts < t[n + 1].originalBeginDts) ? r = n + 1 : t.length > 0 && (r = this._searchNearestSegmentBefore(i.originalBeginDts) + 1), this._lastAppendLocation = r, this._list.splice(r, 0, i)
+ }, e.prototype.getLastSegmentBefore = function(e) {
+ var t = this._searchNearestSegmentBefore(e);
+ return t >= 0 ? this._list[t] : null
+ }, e.prototype.getLastSampleBefore = function(e) {
+ var t = this.getLastSegmentBefore(e);
+ return null != t ? t.lastSample : null
+ }, e.prototype.getLastSyncPointBefore = function(e) {
+ for (var t = this._searchNearestSegmentBefore(e), i = this._list[t].syncPoints; 0 === i.length && t > 0;) t--, i = this._list[t].syncPoints;
+ return i.length > 0 ? i[i.length - 1] : null
+ }, e
+ }()
+ }, function(e, t, i) {
+ "use strict";
+ var n = function() {
+ function e() {
+ this.mimeType = null, this.duration = null, this.hasAudio = null, this.hasVideo = null, this.audioCodec = null, this.videoCodec = null, this.audioDataRate = null, this.videoDataRate = null, this.audioSampleRate = null, this.audioChannelCount = null, this.width = null, this.height = null, this.fps = null, this.profile = null, this.level = null, this.refFrames = null, this.chromaFormat = null, this.sarNum = null, this.sarDen = null, this.metadata = null, this.segments = null, this.segmentCount = null, this.hasKeyframesIndex = null, this.keyframesIndex = null
+ }
+ return e.prototype.isComplete = function() {
+ var e = !1 === this.hasAudio || !0 === this.hasAudio && null != this.audioCodec && null != this.audioSampleRate && null != this.audioChannelCount,
+ t = !1 === this.hasVideo || !0 === this.hasVideo && null != this.videoCodec && null != this.width && null != this.height && null != this.fps && null != this.profile && null != this.level && null != this.refFrames && null != this.chromaFormat && null != this.sarNum && null != this.sarDen;
+ return null != this.mimeType && e && t
+ }, e.prototype.isSeekable = function() {
+ return !0 === this.hasKeyframesIndex
+ }, e.prototype.getNearestKeyframe = function(e) {
+ if (null == this.keyframesIndex) return null;
+ var t = this.keyframesIndex,
+ i = this._search(t.times, e);
+ return {
+ index: i,
+ milliseconds: t.times[i],
+ fileposition: t.filepositions[i]
+ }
+ }, e.prototype._search = function(e, t) {
+ var i = 0,
+ n = e.length - 1,
+ r = 0,
+ a = 0,
+ s = n;
+ for (t < e[0] && (i = 0, a = s + 1); a <= s;) {
+ if ((r = a + Math.floor((s - a) / 2)) === n || t >= e[r] && t < e[r + 1]) {
+ i = r;
+ break
+ }
+ e[r] < t ? a = r + 1 : s = r - 1
+ }
+ return i
+ }, e
+ }();
+ t.a = n
+ }, function(e, t, i) {
+ "use strict";
+ var n = i(6),
+ r = i.n(n),
+ a = i(0),
+ s = function() {
+ function e() {}
+ return Object.defineProperty(e, "forceGlobalTag", {
+ get: function() {
+ return a.a.FORCE_GLOBAL_TAG
+ },
+ set: function(t) {
+ a.a.FORCE_GLOBAL_TAG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "globalTag", {
+ get: function() {
+ return a.a.GLOBAL_TAG
+ },
+ set: function(t) {
+ a.a.GLOBAL_TAG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableAll", {
+ get: function() {
+ return a.a.ENABLE_VERBOSE && a.a.ENABLE_DEBUG && a.a.ENABLE_INFO && a.a.ENABLE_WARN && a.a.ENABLE_ERROR
+ },
+ set: function(t) {
+ a.a.ENABLE_VERBOSE = t, a.a.ENABLE_DEBUG = t, a.a.ENABLE_INFO = t, a.a.ENABLE_WARN = t, a.a.ENABLE_ERROR = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableDebug", {
+ get: function() {
+ return a.a.ENABLE_DEBUG
+ },
+ set: function(t) {
+ a.a.ENABLE_DEBUG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableVerbose", {
+ get: function() {
+ return a.a.ENABLE_VERBOSE
+ },
+ set: function(t) {
+ a.a.ENABLE_VERBOSE = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableInfo", {
+ get: function() {
+ return a.a.ENABLE_INFO
+ },
+ set: function(t) {
+ a.a.ENABLE_INFO = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableWarn", {
+ get: function() {
+ return a.a.ENABLE_WARN
+ },
+ set: function(t) {
+ a.a.ENABLE_WARN = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableError", {
+ get: function() {
+ return a.a.ENABLE_ERROR
+ },
+ set: function(t) {
+ a.a.ENABLE_ERROR = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.getConfig = function() {
+ return {
+ globalTag: a.a.GLOBAL_TAG,
+ forceGlobalTag: a.a.FORCE_GLOBAL_TAG,
+ enableVerbose: a.a.ENABLE_VERBOSE,
+ enableDebug: a.a.ENABLE_DEBUG,
+ enableInfo: a.a.ENABLE_INFO,
+ enableWarn: a.a.ENABLE_WARN,
+ enableError: a.a.ENABLE_ERROR,
+ enableCallback: a.a.ENABLE_CALLBACK
+ }
+ }, e.applyConfig = function(e) {
+ a.a.GLOBAL_TAG = e.globalTag, a.a.FORCE_GLOBAL_TAG = e.forceGlobalTag, a.a.ENABLE_VERBOSE = e.enableVerbose, a.a.ENABLE_DEBUG = e.enableDebug, a.a.ENABLE_INFO = e.enableInfo, a.a.ENABLE_WARN = e.enableWarn, a.a.ENABLE_ERROR = e.enableError, a.a.ENABLE_CALLBACK = e.enableCallback
+ }, e._notifyChange = function() {
+ var t = e.emitter;
+ if (t.listenerCount("change") > 0) {
+ var i = e.getConfig();
+ t.emit("change", i)
+ }
+ }, e.registerListener = function(t) {
+ e.emitter.addListener("change", t)
+ }, e.removeListener = function(t) {
+ e.emitter.removeListener("change", t)
+ }, e.addLogListener = function(t) {
+ a.a.emitter.addListener("log", t), a.a.emitter.listenerCount("log") > 0 && (a.a.ENABLE_CALLBACK = !0, e._notifyChange())
+ }, e.removeLogListener = function(t) {
+ a.a.emitter.removeListener("log", t), 0 === a.a.emitter.listenerCount("log") && (a.a.ENABLE_CALLBACK = !1, e._notifyChange())
+ }, e
+ }();
+ s.emitter = new r.a, t.a = s
+ }, function(e, t, i) {
+ "use strict";
+ var n = i(6),
+ r = i.n(n),
+ a = i(0),
+ s = i(4),
+ o = i(8);
+
+ function u(e, t, i) {
+ var n = e;
+ if (t + i < n.length) {
+ for (; i--;)
+ if (128 != (192 & n[++t])) return !1;
+ return !0
+ }
+ return !1
+ }
+ var l, h, d = function(e) {
+ for (var t = [], i = e, n = 0, r = e.length; n < r;)
+ if (i[n] < 128) t.push(String.fromCharCode(i[n])), ++n;
+ else {
+ if (i[n] < 192);
+ else if (i[n] < 224) {
+ if (u(i, n, 1) && (a = (31 & i[n]) << 6 | 63 & i[n + 1]) >= 128) {
+ t.push(String.fromCharCode(65535 & a)), n += 2;
+ continue
+ }
+ } else if (i[n] < 240) {
+ if (u(i, n, 2) && (a = (15 & i[n]) << 12 | (63 & i[n + 1]) << 6 | 63 & i[n + 2]) >= 2048 && 55296 != (63488 & a)) {
+ t.push(String.fromCharCode(65535 & a)), n += 3;
+ continue
+ }
+ } else if (i[n] < 248) {
+ var a;
+ if (u(i, n, 3) && (a = (7 & i[n]) << 18 | (63 & i[n + 1]) << 12 | (63 & i[n + 2]) << 6 | 63 & i[n + 3]) > 65536 && a < 1114112) {
+ a -= 65536, t.push(String.fromCharCode(a >>> 10 | 55296)), t.push(String.fromCharCode(1023 & a | 56320)), n += 4;
+ continue
+ }
+ }
+ t.push(String.fromCharCode(65533)), ++n
+ } return t.join("")
+ },
+ c = i(3),
+ f = (l = new ArrayBuffer(2), new DataView(l).setInt16(0, 256, !0), 256 === new Int16Array(l)[0]),
+ p = function() {
+ function e() {}
+ return e.parseScriptData = function(t, i, n) {
+ var r = {};
+ try {
+ var s = e.parseValue(t, i, n),
+ o = e.parseValue(t, i + s.size, n - s.size);
+ r[s.data] = o.data
+ } catch (e) {
+ a.a.e("AMF", e.toString())
+ }
+ return r
+ }, e.parseObject = function(t, i, n) {
+ if (n < 3) throw new c.a("Data not enough when parse ScriptDataObject");
+ var r = e.parseString(t, i, n),
+ a = e.parseValue(t, i + r.size, n - r.size),
+ s = a.objectEnd;
+ return {
+ data: {
+ name: r.data,
+ value: a.data
+ },
+ size: r.size + a.size,
+ objectEnd: s
+ }
+ }, e.parseVariable = function(t, i, n) {
+ return e.parseObject(t, i, n)
+ }, e.parseString = function(e, t, i) {
+ if (i < 2) throw new c.a("Data not enough when parse String");
+ var n = new DataView(e, t, i).getUint16(0, !f);
+ return {
+ data: n > 0 ? d(new Uint8Array(e, t + 2, n)) : "",
+ size: 2 + n
+ }
+ }, e.parseLongString = function(e, t, i) {
+ if (i < 4) throw new c.a("Data not enough when parse LongString");
+ var n = new DataView(e, t, i).getUint32(0, !f);
+ return {
+ data: n > 0 ? d(new Uint8Array(e, t + 4, n)) : "",
+ size: 4 + n
+ }
+ }, e.parseDate = function(e, t, i) {
+ if (i < 10) throw new c.a("Data size invalid when parse Date");
+ var n = new DataView(e, t, i),
+ r = n.getFloat64(0, !f),
+ a = n.getInt16(8, !f);
+ return {
+ data: new Date(r += 60 * a * 1e3),
+ size: 10
+ }
+ }, e.parseValue = function(t, i, n) {
+ if (n < 1) throw new c.a("Data not enough when parse Value");
+ var r, s = new DataView(t, i, n),
+ o = 1,
+ u = s.getUint8(0),
+ l = !1;
+ try {
+ switch (u) {
+ case 0:
+ r = s.getFloat64(1, !f), o += 8;
+ break;
+ case 1:
+ r = !!s.getUint8(1), o += 1;
+ break;
+ case 2:
+ var h = e.parseString(t, i + 1, n - 1);
+ r = h.data, o += h.size;
+ break;
+ case 3:
+ r = {};
+ var d = 0;
+ for (9 == (16777215 & s.getUint32(n - 4, !f)) && (d = 3); o < n - 4;) {
+ var p = e.parseObject(t, i + o, n - o - d);
+ if (p.objectEnd) break;
+ r[p.data.name] = p.data.value, o += p.size
+ }
+ o <= n - 3 && 9 == (16777215 & s.getUint32(o - 1, !f)) && (o += 3);
+ break;
+ case 8:
+ for (r = {}, o += 4, d = 0, 9 == (16777215 & s.getUint32(n - 4, !f)) && (d = 3); o < n - 8;) {
+ var m = e.parseVariable(t, i + o, n - o - d);
+ if (m.objectEnd) break;
+ r[m.data.name] = m.data.value, o += m.size
+ }
+ o <= n - 3 && 9 == (16777215 & s.getUint32(o - 1, !f)) && (o += 3);
+ break;
+ case 9:
+ r = void 0, o = 1, l = !0;
+ break;
+ case 10:
+ r = [];
+ var _ = s.getUint32(1, !f);
+ o += 4;
+ for (var g = 0; g < _; g++) {
+ var v = e.parseValue(t, i + o, n - o);
+ r.push(v.data), o += v.size
+ }
+ break;
+ case 11:
+ var y = e.parseDate(t, i + 1, n - 1);
+ r = y.data, o += y.size;
+ break;
+ case 12:
+ var b = e.parseString(t, i + 1, n - 1);
+ r = b.data, o += b.size;
+ break;
+ default:
+ o = n, a.a.w("AMF", "Unsupported AMF value type " + u)
+ }
+ } catch (e) {
+ a.a.e("AMF", e.toString())
+ }
+ return {
+ data: r,
+ size: o,
+ objectEnd: l
+ }
+ }, e
+ }(),
+ m = function() {
+ function e(e) {
+ this.TAG = "ExpGolomb", this._buffer = e, this._buffer_index = 0, this._total_bytes = e.byteLength, this._total_bits = 8 * e.byteLength, this._current_word = 0, this._current_word_bits_left = 0
+ }
+ return e.prototype.destroy = function() {
+ this._buffer = null
+ }, e.prototype._fillCurrentWord = function() {
+ var e = this._total_bytes - this._buffer_index;
+ if (e <= 0) throw new c.a("ExpGolomb: _fillCurrentWord() but no bytes available");
+ var t = Math.min(4, e),
+ i = new Uint8Array(4);
+ i.set(this._buffer.subarray(this._buffer_index, this._buffer_index + t)), this._current_word = new DataView(i.buffer).getUint32(0, !1), this._buffer_index += t, this._current_word_bits_left = 8 * t
+ }, e.prototype.readBits = function(e) {
+ if (e > 32) throw new c.b("ExpGolomb: readBits() bits exceeded max 32bits!");
+ if (e <= this._current_word_bits_left) {
+ var t = this._current_word >>> 32 - e;
+ return this._current_word <<= e, this._current_word_bits_left -= e, t
+ }
+ var i = this._current_word_bits_left ? this._current_word : 0;
+ i >>>= 32 - this._current_word_bits_left;
+ var n = e - this._current_word_bits_left;
+ this._fillCurrentWord();
+ var r = Math.min(n, this._current_word_bits_left),
+ a = this._current_word >>> 32 - r;
+ return this._current_word <<= r, this._current_word_bits_left -= r, i << r | a
+ }, e.prototype.readBool = function() {
+ return 1 === this.readBits(1)
+ }, e.prototype.readByte = function() {
+ return this.readBits(8)
+ }, e.prototype._skipLeadingZero = function() {
+ var e;
+ for (e = 0; e < this._current_word_bits_left; e++)
+ if (0 != (this._current_word & 2147483648 >>> e)) return this._current_word <<= e, this._current_word_bits_left -= e, e;
+ return this._fillCurrentWord(), e + this._skipLeadingZero()
+ }, e.prototype.readUEG = function() {
+ var e = this._skipLeadingZero();
+ return this.readBits(e + 1) - 1
+ }, e.prototype.readSEG = function() {
+ var e = this.readUEG();
+ return 1 & e ? e + 1 >>> 1 : -1 * (e >>> 1)
+ }, e
+ }(),
+ _ = function() {
+ function e() {}
+ return e._ebsp2rbsp = function(e) {
+ for (var t = e, i = t.byteLength, n = new Uint8Array(i), r = 0, a = 0; a < i; a++) a >= 2 && 3 === t[a] && 0 === t[a - 1] && 0 === t[a - 2] || (n[r] = t[a], r++);
+ return new Uint8Array(n.buffer, 0, r)
+ }, e.parseSPS = function(t) {
+ for (var i = t.subarray(1, 4), n = "avc1.", r = 0; r < 3; r++) {
+ var a = i[r].toString(16);
+ a.length < 2 && (a = "0" + a), n += a
+ }
+ var s = e._ebsp2rbsp(t),
+ o = new m(s);
+ o.readByte();
+ var u = o.readByte();
+ o.readByte();
+ var l = o.readByte();
+ o.readUEG();
+ var h = e.getProfileString(u),
+ d = e.getLevelString(l),
+ c = 1,
+ f = 420,
+ p = 8,
+ _ = 8;
+ if ((100 === u || 110 === u || 122 === u || 244 === u || 44 === u || 83 === u || 86 === u || 118 === u || 128 === u || 138 === u || 144 === u) && (3 === (c = o.readUEG()) && o.readBits(1), c <= 3 && (f = [0, 420, 422, 444][c]), p = o.readUEG() + 8, _ = o.readUEG() + 8, o.readBits(1), o.readBool()))
+ for (var g = 3 !== c ? 8 : 12, v = 0; v < g; v++) o.readBool() && (v < 6 ? e._skipScalingList(o, 16) : e._skipScalingList(o, 64));
+ o.readUEG();
+ var y = o.readUEG();
+ if (0 === y) o.readUEG();
+ else if (1 === y) {
+ o.readBits(1), o.readSEG(), o.readSEG();
+ var b = o.readUEG();
+ for (v = 0; v < b; v++) o.readSEG()
+ }
+ var S = o.readUEG();
+ o.readBits(1);
+ var T = o.readUEG(),
+ E = o.readUEG(),
+ w = o.readBits(1);
+ 0 === w && o.readBits(1), o.readBits(1);
+ var A = 0,
+ C = 0,
+ k = 0,
+ P = 0;
+ o.readBool() && (A = o.readUEG(), C = o.readUEG(), k = o.readUEG(), P = o.readUEG());
+ var I = 1,
+ L = 1,
+ x = 0,
+ R = !0,
+ D = 0,
+ O = 0;
+ if (o.readBool()) {
+ if (o.readBool()) {
+ var U = o.readByte();
+ U > 0 && U < 16 ? (I = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2][U - 1], L = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1][U - 1]) : 255 === U && (I = o.readByte() << 8 | o.readByte(), L = o.readByte() << 8 | o.readByte())
+ }
+ if (o.readBool() && o.readBool(), o.readBool() && (o.readBits(4), o.readBool() && o.readBits(24)), o.readBool() && (o.readUEG(), o.readUEG()), o.readBool()) {
+ var M = o.readBits(32),
+ F = o.readBits(32);
+ R = o.readBool(), x = (D = F) / (O = 2 * M)
+ }
+ }
+ var B = 1;
+ 1 === I && 1 === L || (B = I / L);
+ var N = 0,
+ j = 0;
+ 0 === c ? (N = 1, j = 2 - w) : (N = 3 === c ? 1 : 2, j = (1 === c ? 2 : 1) * (2 - w));
+ var V = 16 * (T + 1),
+ H = 16 * (E + 1) * (2 - w);
+ V -= (A + C) * N, H -= (k + P) * j;
+ var z = Math.ceil(V * B);
+ return o.destroy(), o = null, {
+ codec_mimetype: n,
+ profile_idc: u,
+ level_idc: l,
+ profile_string: h,
+ level_string: d,
+ chroma_format_idc: c,
+ bit_depth: p,
+ bit_depth_luma: p,
+ bit_depth_chroma: _,
+ ref_frames: S,
+ chroma_format: f,
+ chroma_format_string: e.getChromaFormatString(f),
+ frame_rate: {
+ fixed: R,
+ fps: x,
+ fps_den: O,
+ fps_num: D
+ },
+ sar_ratio: {
+ width: I,
+ height: L
+ },
+ codec_size: {
+ width: V,
+ height: H
+ },
+ present_size: {
+ width: z,
+ height: H
+ }
+ }
+ }, e._skipScalingList = function(e, t) {
+ for (var i = 8, n = 8, r = 0; r < t; r++) 0 !== n && (n = (i + e.readSEG() + 256) % 256), i = 0 === n ? i : n
+ }, e.getProfileString = function(e) {
+ switch (e) {
+ case 66:
+ return "Baseline";
+ case 77:
+ return "Main";
+ case 88:
+ return "Extended";
+ case 100:
+ return "High";
+ case 110:
+ return "High10";
+ case 122:
+ return "High422";
+ case 244:
+ return "High444";
+ default:
+ return "Unknown"
+ }
+ }, e.getLevelString = function(e) {
+ return (e / 10).toFixed(1)
+ }, e.getChromaFormatString = function(e) {
+ switch (e) {
+ case 420:
+ return "4:2:0";
+ case 422:
+ return "4:2:2";
+ case 444:
+ return "4:4:4";
+ default:
+ return "Unknown"
+ }
+ }, e
+ }(),
+ g = i(5),
+ v = function() {
+ function e(e, t) {
+ this.TAG = "FLVDemuxer", this._config = t, this._onError = null, this._onMediaInfo = null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this._onDataAvailable = null, this._dataOffset = e.dataOffset, this._firstParse = !0, this._dispatch = !1, this._hasAudio = e.hasAudioTrack, this._hasVideo = e.hasVideoTrack, this._hasAudioFlagOverrided = !1, this._hasVideoFlagOverrided = !1, this._audioInitialMetadataDispatched = !1, this._videoInitialMetadataDispatched = !1, this._mediaInfo = new o.a, this._mediaInfo.hasAudio = this._hasAudio, this._mediaInfo.hasVideo = this._hasVideo, this._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._naluLengthSize = 4, this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1, this._referenceFrameRate = {
+ fixed: !0,
+ fps: 23.976,
+ fps_num: 23976,
+ fps_den: 1e3
+ }, this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3], this._mpegSamplingRates = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0], this._mpegAudioV20SampleRateTable = [22050, 24e3, 16e3, 0], this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0], this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1], this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1], this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1], this._videoTrack = {
+ type: "video",
+ id: 1,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, this._audioTrack = {
+ type: "audio",
+ id: 2,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, this._littleEndian = function() {
+ var e = new ArrayBuffer(2);
+ return new DataView(e).setInt16(0, 256, !0), 256 === new Int16Array(e)[0]
+ }()
+ }
+ return e.prototype.destroy = function() {
+ this._mediaInfo = null, this._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._videoTrack = null, this._audioTrack = null, this._onError = null, this._onMediaInfo = null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this._onDataAvailable = null
+ }, e.probe = function(e) {
+ var t = new Uint8Array(e),
+ i = {
+ match: !1
+ };
+ if (70 !== t[0] || 76 !== t[1] || 86 !== t[2] || 1 !== t[3]) return i;
+ var n, r = (4 & t[4]) >>> 2 != 0,
+ a = 0 != (1 & t[4]),
+ s = (n = t)[5] << 24 | n[6] << 16 | n[7] << 8 | n[8];
+ return s < 9 ? i : {
+ match: !0,
+ consumed: s,
+ dataOffset: s,
+ hasAudioTrack: r,
+ hasVideoTrack: a
+ }
+ }, e.prototype.bindDataSource = function(e) {
+ return e.onDataArrival = this.parseChunks.bind(this), this
+ }, Object.defineProperty(e.prototype, "onTrackMetadata", {
+ get: function() {
+ return this._onTrackMetadata
+ },
+ set: function(e) {
+ this._onTrackMetadata = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMediaInfo", {
+ get: function() {
+ return this._onMediaInfo
+ },
+ set: function(e) {
+ this._onMediaInfo = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMetaDataArrived", {
+ get: function() {
+ return this._onMetaDataArrived
+ },
+ set: function(e) {
+ this._onMetaDataArrived = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onScriptDataArrived", {
+ get: function() {
+ return this._onScriptDataArrived
+ },
+ set: function(e) {
+ this._onScriptDataArrived = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataAvailable", {
+ get: function() {
+ return this._onDataAvailable
+ },
+ set: function(e) {
+ this._onDataAvailable = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "timestampBase", {
+ get: function() {
+ return this._timestampBase
+ },
+ set: function(e) {
+ this._timestampBase = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedDuration", {
+ get: function() {
+ return this._duration
+ },
+ set: function(e) {
+ this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedHasAudio", {
+ set: function(e) {
+ this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedHasVideo", {
+ set: function(e) {
+ this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.resetMediaInfo = function() {
+ this._mediaInfo = new o.a
+ }, e.prototype._isInitialMetadataDispatched = function() {
+ return this._hasAudio && this._hasVideo ? this._audioInitialMetadataDispatched && this._videoInitialMetadataDispatched : this._hasAudio && !this._hasVideo ? this._audioInitialMetadataDispatched : !(this._hasAudio || !this._hasVideo) && this._videoInitialMetadataDispatched
+ }, e.prototype.parseChunks = function(t, i) {
+ if (!(this._onError && this._onMediaInfo && this._onTrackMetadata && this._onDataAvailable)) throw new c.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
+ var n = 0,
+ r = this._littleEndian;
+ if (0 === i) {
+ if (!(t.byteLength > 13)) return 0;
+ n = e.probe(t).dataOffset
+ }
+ for (this._firstParse && (this._firstParse = !1, i + n !== this._dataOffset && a.a.w(this.TAG, "First time parsing but chunk byteStart invalid!"), 0 !== (s = new DataView(t, n)).getUint32(0, !r) && a.a.w(this.TAG, "PrevTagSize0 !== 0 !!!"), n += 4); n < t.byteLength;) {
+ this._dispatch = !0;
+ var s = new DataView(t, n);
+ if (n + 11 + 4 > t.byteLength) break;
+ var o = s.getUint8(0),
+ u = 16777215 & s.getUint32(0, !r);
+ if (n + 11 + u + 4 > t.byteLength) break;
+ if (8 === o || 9 === o || 18 === o) {
+ var l = s.getUint8(4),
+ h = s.getUint8(5),
+ d = s.getUint8(6) | h << 8 | l << 16 | s.getUint8(7) << 24;
+ 0 != (16777215 & s.getUint32(7, !r)) && a.a.w(this.TAG, "Meet tag which has StreamID != 0!");
+ var f = n + 11;
+ switch (o) {
+ case 8:
+ this._parseAudioData(t, f, u, d);
+ break;
+ case 9:
+ this._parseVideoData(t, f, u, d, i + n);
+ break;
+ case 18:
+ this._parseScriptData(t, f, u)
+ }
+ var p = s.getUint32(11 + u, !r);
+ p !== 11 + u && a.a.w(this.TAG, "Invalid PrevTagSize " + p), n += 11 + u + 4
+ } else a.a.w(this.TAG, "Unsupported tag type " + o + ", skipped"), n += 11 + u + 4
+ }
+ return this._isInitialMetadataDispatched() && this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack), n
+ }, e.prototype._parseScriptData = function(e, t, i) {
+ var n = p.parseScriptData(e, t, i);
+ if (n.hasOwnProperty("onMetaData")) {
+ if (null == n.onMetaData || "object" != typeof n.onMetaData) return void a.a.w(this.TAG, "Invalid onMetaData structure!");
+ this._metadata && a.a.w(this.TAG, "Found another onMetaData tag!"), this._metadata = n;
+ var r = this._metadata.onMetaData;
+ if (this._onMetaDataArrived && this._onMetaDataArrived(Object.assign({}, r)), "boolean" == typeof r.hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = r.hasAudio, this._mediaInfo.hasAudio = this._hasAudio), "boolean" == typeof r.hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = r.hasVideo, this._mediaInfo.hasVideo = this._hasVideo), "number" == typeof r.audiodatarate && (this._mediaInfo.audioDataRate = r.audiodatarate), "number" == typeof r.videodatarate && (this._mediaInfo.videoDataRate = r.videodatarate), "number" == typeof r.width && (this._mediaInfo.width = r.width), "number" == typeof r.height && (this._mediaInfo.height = r.height), "number" == typeof r.duration) {
+ if (!this._durationOverrided) {
+ var s = Math.floor(r.duration * this._timescale);
+ this._duration = s, this._mediaInfo.duration = s
+ }
+ } else this._mediaInfo.duration = 0;
+ if ("number" == typeof r.framerate) {
+ var o = Math.floor(1e3 * r.framerate);
+ if (o > 0) {
+ var u = o / 1e3;
+ this._referenceFrameRate.fixed = !0, this._referenceFrameRate.fps = u, this._referenceFrameRate.fps_num = o, this._referenceFrameRate.fps_den = 1e3, this._mediaInfo.fps = u
+ }
+ }
+ if ("object" == typeof r.keyframes) {
+ this._mediaInfo.hasKeyframesIndex = !0;
+ var l = r.keyframes;
+ this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(l), r.keyframes = null
+ } else this._mediaInfo.hasKeyframesIndex = !1;
+ this._dispatch = !1, this._mediaInfo.metadata = r, a.a.v(this.TAG, "Parsed onMetaData"), this._mediaInfo.isComplete() && this._onMediaInfo(this._mediaInfo)
+ }
+ Object.keys(n).length > 0 && this._onScriptDataArrived && this._onScriptDataArrived(Object.assign({}, n))
+ }, e.prototype._parseKeyframesIndex = function(e) {
+ for (var t = [], i = [], n = 1; n < e.times.length; n++) {
+ var r = this._timestampBase + Math.floor(1e3 * e.times[n]);
+ t.push(r), i.push(e.filepositions[n])
+ }
+ return {
+ times: t,
+ filepositions: i
+ }
+ }, e.prototype._parseAudioData = function(e, t, i, n) {
+ if (i <= 1) a.a.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!");
+ else if (!0 !== this._hasAudioFlagOverrided || !1 !== this._hasAudio) {
+ this._littleEndian;
+ var r = new DataView(e, t, i).getUint8(0),
+ s = r >>> 4;
+ if (2 === s || 10 === s) {
+ var o = 0,
+ u = (12 & r) >>> 2;
+ if (u >= 0 && u <= 4) {
+ o = this._flvSoundRateTable[u];
+ var l = 1 & r,
+ h = this._audioMetadata,
+ d = this._audioTrack;
+ if (h || (!1 === this._hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = !0, this._mediaInfo.hasAudio = !0), (h = this._audioMetadata = {}).type = "audio", h.id = d.id, h.timescale = this._timescale, h.duration = this._duration, h.audioSampleRate = o, h.channelCount = 0 === l ? 1 : 2), 10 === s) {
+ var c = this._parseAACAudioData(e, t + 1, i - 1);
+ if (null == c) return;
+ if (0 === c.packetType) {
+ h.config && a.a.w(this.TAG, "Found another AudioSpecificConfig!");
+ var f = c.data;
+ h.audioSampleRate = f.samplingRate, h.channelCount = f.channelCount, h.codec = f.codec, h.originalCodec = f.originalCodec, h.config = f.config, h.refSampleDuration = 1024 / h.audioSampleRate * h.timescale, a.a.v(this.TAG, "Parsed AudioSpecificConfig"), this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._audioInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("audio", h), (_ = this._mediaInfo).audioCodec = h.originalCodec, _.audioSampleRate = h.audioSampleRate, _.audioChannelCount = h.channelCount, _.hasVideo ? null != _.videoCodec && (_.mimeType = 'video/x-flv; codecs="' + _.videoCodec + "," + _.audioCodec + '"') : _.mimeType = 'video/x-flv; codecs="' + _.audioCodec + '"', _.isComplete() && this._onMediaInfo(_)
+ } else if (1 === c.packetType) {
+ var p = this._timestampBase + n,
+ m = {
+ unit: c.data,
+ length: c.data.byteLength,
+ dts: p,
+ pts: p
+ };
+ d.samples.push(m), d.length += c.data.length
+ } else a.a.e(this.TAG, "Flv: Unsupported AAC data type " + c.packetType)
+ } else if (2 === s) {
+ if (!h.codec) {
+ var _;
+ if (null == (f = this._parseMP3AudioData(e, t + 1, i - 1, !0))) return;
+ h.audioSampleRate = f.samplingRate, h.channelCount = f.channelCount, h.codec = f.codec, h.originalCodec = f.originalCodec, h.refSampleDuration = 1152 / h.audioSampleRate * h.timescale, a.a.v(this.TAG, "Parsed MPEG Audio Frame Header"), this._audioInitialMetadataDispatched = !0, this._onTrackMetadata("audio", h), (_ = this._mediaInfo).audioCodec = h.codec, _.audioSampleRate = h.audioSampleRate, _.audioChannelCount = h.channelCount, _.audioDataRate = f.bitRate, _.hasVideo ? null != _.videoCodec && (_.mimeType = 'video/x-flv; codecs="' + _.videoCodec + "," + _.audioCodec + '"') : _.mimeType = 'video/x-flv; codecs="' + _.audioCodec + '"', _.isComplete() && this._onMediaInfo(_)
+ }
+ var v = this._parseMP3AudioData(e, t + 1, i - 1, !1);
+ if (null == v) return;
+ p = this._timestampBase + n;
+ var y = {
+ unit: v,
+ length: v.byteLength,
+ dts: p,
+ pts: p
+ };
+ d.samples.push(y), d.length += v.length
+ }
+ } else this._onError(g.a.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + u)
+ } else this._onError(g.a.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + s)
+ }
+ }, e.prototype._parseAACAudioData = function(e, t, i) {
+ if (!(i <= 1)) {
+ var n = {},
+ r = new Uint8Array(e, t, i);
+ return n.packetType = r[0], 0 === r[0] ? n.data = this._parseAACAudioSpecificConfig(e, t + 1, i - 1) : n.data = r.subarray(1), n
+ }
+ a.a.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!")
+ }, e.prototype._parseAACAudioSpecificConfig = function(e, t, i) {
+ var n, r, a = new Uint8Array(e, t, i),
+ s = null,
+ o = 0,
+ u = null;
+ if (o = n = a[0] >>> 3, (r = (7 & a[0]) << 1 | a[1] >>> 7) < 0 || r >= this._mpegSamplingRates.length) this._onError(g.a.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
+ else {
+ var l = this._mpegSamplingRates[r],
+ h = (120 & a[1]) >>> 3;
+ if (!(h < 0 || h >= 8)) {
+ 5 === o && (u = (7 & a[1]) << 1 | a[2] >>> 7, a[2]);
+ var d = self.navigator.userAgent.toLowerCase();
+ return -1 !== d.indexOf("firefox") ? r >= 6 ? (o = 5, s = new Array(4), u = r - 3) : (o = 2, s = new Array(2), u = r) : -1 !== d.indexOf("android") ? (o = 2, s = new Array(2), u = r) : (o = 5, u = r, s = new Array(4), r >= 6 ? u = r - 3 : 1 === h && (o = 2, s = new Array(2), u = r)), s[0] = o << 3, s[0] |= (15 & r) >>> 1, s[1] = (15 & r) << 7, s[1] |= (15 & h) << 3, 5 === o && (s[1] |= (15 & u) >>> 1, s[2] = (1 & u) << 7, s[2] |= 8, s[3] = 0), {
+ config: s,
+ samplingRate: l,
+ channelCount: h,
+ codec: "mp4a.40." + o,
+ originalCodec: "mp4a.40." + n
+ }
+ }
+ this._onError(g.a.FORMAT_ERROR, "Flv: AAC invalid channel configuration")
+ }
+ }, e.prototype._parseMP3AudioData = function(e, t, i, n) {
+ if (!(i < 4)) {
+ this._littleEndian;
+ var r = new Uint8Array(e, t, i),
+ s = null;
+ if (n) {
+ if (255 !== r[0]) return;
+ var o = r[1] >>> 3 & 3,
+ u = (6 & r[1]) >> 1,
+ l = (240 & r[2]) >>> 4,
+ h = (12 & r[2]) >>> 2,
+ d = 3 != (r[3] >>> 6 & 3) ? 2 : 1,
+ c = 0,
+ f = 0;
+ switch (o) {
+ case 0:
+ c = this._mpegAudioV25SampleRateTable[h];
+ break;
+ case 2:
+ c = this._mpegAudioV20SampleRateTable[h];
+ break;
+ case 3:
+ c = this._mpegAudioV10SampleRateTable[h]
+ }
+ switch (u) {
+ case 1:
+ l < this._mpegAudioL3BitRateTable.length && (f = this._mpegAudioL3BitRateTable[l]);
+ break;
+ case 2:
+ l < this._mpegAudioL2BitRateTable.length && (f = this._mpegAudioL2BitRateTable[l]);
+ break;
+ case 3:
+ l < this._mpegAudioL1BitRateTable.length && (f = this._mpegAudioL1BitRateTable[l])
+ }
+ s = {
+ bitRate: f,
+ samplingRate: c,
+ channelCount: d,
+ codec: "mp3",
+ originalCodec: "mp3"
+ }
+ } else s = r;
+ return s
+ }
+ a.a.w(this.TAG, "Flv: Invalid MP3 packet, header missing!")
+ }, e.prototype._parseVideoData = function(e, t, i, n, r) {
+ if (i <= 1) a.a.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
+ else if (!0 !== this._hasVideoFlagOverrided || !1 !== this._hasVideo) {
+ var s = new Uint8Array(e, t, i)[0],
+ o = (240 & s) >>> 4,
+ u = 15 & s;
+ 7 === u ? this._parseAVCVideoPacket(e, t + 1, i - 1, n, r, o) : this._onError(g.a.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + u)
+ }
+ }, e.prototype._parseAVCVideoPacket = function(e, t, i, n, r, s) {
+ if (i < 4) a.a.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
+ else {
+ var o = this._littleEndian,
+ u = new DataView(e, t, i),
+ l = u.getUint8(0),
+ h = (16777215 & u.getUint32(0, !o)) << 8 >> 8;
+ if (0 === l) this._parseAVCDecoderConfigurationRecord(e, t + 4, i - 4);
+ else if (1 === l) this._parseAVCVideoData(e, t + 4, i - 4, n, r, s, h);
+ else if (2 !== l) return void this._onError(g.a.FORMAT_ERROR, "Flv: Invalid video packet type " + l)
+ }
+ }, e.prototype._parseAVCDecoderConfigurationRecord = function(e, t, i) {
+ if (i < 7) a.a.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
+ else {
+ var n = this._videoMetadata,
+ r = this._videoTrack,
+ s = this._littleEndian,
+ o = new DataView(e, t, i);
+ n ? void 0 !== n.avcc && a.a.w(this.TAG, "Found another AVCDecoderConfigurationRecord!") : (!1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this._mediaInfo.hasVideo = !0), (n = this._videoMetadata = {}).type = "video", n.id = r.id, n.timescale = this._timescale, n.duration = this._duration);
+ var u = o.getUint8(0),
+ l = o.getUint8(1);
+ if (o.getUint8(2), o.getUint8(3), 1 === u && 0 !== l)
+ if (this._naluLengthSize = 1 + (3 & o.getUint8(4)), 3 === this._naluLengthSize || 4 === this._naluLengthSize) {
+ var h = 31 & o.getUint8(5);
+ if (0 !== h) {
+ h > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + h);
+ for (var d = 6, c = 0; c < h; c++) {
+ var f = o.getUint16(d, !s);
+ if (d += 2, 0 !== f) {
+ var p = new Uint8Array(e, t + d, f);
+ d += f;
+ var m = _.parseSPS(p);
+ if (0 === c) {
+ n.codecWidth = m.codec_size.width, n.codecHeight = m.codec_size.height, n.presentWidth = m.present_size.width, n.presentHeight = m.present_size.height, n.profile = m.profile_string, n.level = m.level_string, n.bitDepth = m.bit_depth, n.chromaFormat = m.chroma_format, n.sarRatio = m.sar_ratio, n.frameRate = m.frame_rate, !1 !== m.frame_rate.fixed && 0 !== m.frame_rate.fps_num && 0 !== m.frame_rate.fps_den || (n.frameRate = this._referenceFrameRate);
+ var v = n.frameRate.fps_den,
+ y = n.frameRate.fps_num;
+ n.refSampleDuration = n.timescale * (v / y);
+ for (var b = p.subarray(1, 4), S = "avc1.", T = 0; T < 3; T++) {
+ var E = b[T].toString(16);
+ E.length < 2 && (E = "0" + E), S += E
+ }
+ n.codec = S;
+ var w = this._mediaInfo;
+ w.width = n.codecWidth, w.height = n.codecHeight, w.fps = n.frameRate.fps, w.profile = n.profile, w.level = n.level, w.refFrames = m.ref_frames, w.chromaFormat = m.chroma_format_string, w.sarNum = n.sarRatio.width, w.sarDen = n.sarRatio.height, w.videoCodec = S, w.hasAudio ? null != w.audioCodec && (w.mimeType = 'video/x-flv; codecs="' + w.videoCodec + "," + w.audioCodec + '"') : w.mimeType = 'video/x-flv; codecs="' + w.videoCodec + '"', w.isComplete() && this._onMediaInfo(w)
+ }
+ }
+ }
+ var A = o.getUint8(d);
+ if (0 !== A) {
+ for (A > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + A), d++, c = 0; c < A; c++) f = o.getUint16(d, !s), d += 2, 0 !== f && (d += f);
+ n.avcc = new Uint8Array(i), n.avcc.set(new Uint8Array(e, t, i), 0), a.a.v(this.TAG, "Parsed AVCDecoderConfigurationRecord"), this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._videoInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("video", n)
+ } else this._onError(g.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS")
+ } else this._onError(g.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS")
+ } else this._onError(g.a.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
+ else this._onError(g.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord")
+ }
+ }, e.prototype._parseAVCVideoData = function(e, t, i, n, r, s, o) {
+ for (var u = this._littleEndian, l = new DataView(e, t, i), h = [], d = 0, c = 0, f = this._naluLengthSize, p = this._timestampBase + n, m = 1 === s; c < i;) {
+ if (c + 4 >= i) {
+ a.a.w(this.TAG, "Malformed Nalu near timestamp " + p + ", offset = " + c + ", dataSize = " + i);
+ break
+ }
+ var _ = l.getUint32(c, !u);
+ if (3 === f && (_ >>>= 8), _ > i - f) return void a.a.w(this.TAG, "Malformed Nalus near timestamp " + p + ", NaluSize > DataSize!");
+ var g = 31 & l.getUint8(c + f);
+ 5 === g && (m = !0);
+ var v = new Uint8Array(e, t + c, f + _),
+ y = {
+ type: g,
+ data: v
+ };
+ h.push(y), d += v.byteLength, c += f + _
+ }
+ if (h.length) {
+ var b = this._videoTrack,
+ S = {
+ units: h,
+ length: d,
+ isKeyframe: m,
+ dts: p,
+ cts: o,
+ pts: p + o
+ };
+ m && (S.fileposition = r), b.samples.push(S), b.length += d
+ }
+ }, e
+ }(),
+ y = function() {
+ function e() {}
+ return e.prototype.destroy = function() {
+ this.onError = null, this.onMediaInfo = null, this.onMetaDataArrived = null, this.onTrackMetadata = null, this.onDataAvailable = null, this.onTimedID3Metadata = null, this.onPESPrivateData = null, this.onPESPrivateDataDescriptor = null
+ }, e
+ }(),
+ b = function() {
+ this.program_pmt_pid = {}
+ };
+ ! function(e) {
+ e[e.kMPEG1Audio = 3] = "kMPEG1Audio", e[e.kMPEG2Audio = 4] = "kMPEG2Audio", e[e.kPESPrivateData = 6] = "kPESPrivateData", e[e.kADTSAAC = 15] = "kADTSAAC", e[e.kID3 = 21] = "kID3", e[e.kH264 = 27] = "kH264", e[e.kH265 = 36] = "kH265"
+ }(h || (h = {}));
+ var S, T = function() {
+ this.pid_stream_type = {}, this.common_pids = {
+ h264: void 0,
+ adts_aac: void 0
+ }, this.pes_private_data_pids = {}, this.timed_id3_pids = {}
+ },
+ E = function() {},
+ w = function() {
+ this.slices = [], this.total_length = 0, this.expected_length = 0, this.file_position = 0
+ };
+ ! function(e) {
+ e[e.kUnspecified = 0] = "kUnspecified", e[e.kSliceNonIDR = 1] = "kSliceNonIDR", e[e.kSliceDPA = 2] = "kSliceDPA", e[e.kSliceDPB = 3] = "kSliceDPB", e[e.kSliceDPC = 4] = "kSliceDPC", e[e.kSliceIDR = 5] = "kSliceIDR", e[e.kSliceSEI = 6] = "kSliceSEI", e[e.kSliceSPS = 7] = "kSliceSPS", e[e.kSlicePPS = 8] = "kSlicePPS", e[e.kSliceAUD = 9] = "kSliceAUD", e[e.kEndOfSequence = 10] = "kEndOfSequence", e[e.kEndOfStream = 11] = "kEndOfStream", e[e.kFiller = 12] = "kFiller", e[e.kSPSExt = 13] = "kSPSExt", e[e.kReserved0 = 14] = "kReserved0"
+ }(S || (S = {}));
+ var A, C, k = function() {},
+ P = function(e) {
+ var t = e.data.byteLength;
+ this.type = e.type, this.data = new Uint8Array(4 + t), new DataView(this.data.buffer).setUint32(0, t), this.data.set(e.data, 4)
+ },
+ I = function() {
+ function e(e) {
+ this.TAG = "H264AnnexBParser", this.current_startcode_offset_ = 0, this.eof_flag_ = !1, this.data_ = e, this.current_startcode_offset_ = this.findNextStartCodeOffset(0), this.eof_flag_ && a.a.e(this.TAG, "Could not found H264 startcode until payload end!")
+ }
+ return e.prototype.findNextStartCodeOffset = function(e) {
+ for (var t = e, i = this.data_;;) {
+ if (t + 3 >= i.byteLength) return this.eof_flag_ = !0, i.byteLength;
+ var n = i[t + 0] << 24 | i[t + 1] << 16 | i[t + 2] << 8 | i[t + 3],
+ r = i[t + 0] << 16 | i[t + 1] << 8 | i[t + 2];
+ if (1 === n || 1 === r) return t;
+ t++
+ }
+ }, e.prototype.readNextNaluPayload = function() {
+ for (var e = this.data_, t = null; null == t && !this.eof_flag_;) {
+ var i = this.current_startcode_offset_,
+ n = 31 & e[i += 1 == (e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]) ? 4 : 3],
+ r = (128 & e[i]) >>> 7,
+ a = this.findNextStartCodeOffset(i);
+ if (this.current_startcode_offset_ = a, !(n >= S.kReserved0) && 0 === r) {
+ var s = e.subarray(i, a);
+ (t = new k).type = n, t.data = s
+ }
+ }
+ return t
+ }, e
+ }(),
+ L = function() {
+ function e(e, t, i) {
+ var n = 8 + e.byteLength + 1 + 2 + t.byteLength,
+ r = !1;
+ 66 !== e[3] && 77 !== e[3] && 88 !== e[3] && (r = !0, n += 4);
+ var a = this.data = new Uint8Array(n);
+ a[0] = 1, a[1] = e[1], a[2] = e[2], a[3] = e[3], a[4] = 255, a[5] = 225;
+ var s = e.byteLength;
+ a[6] = s >>> 8, a[7] = 255 & s;
+ var o = 8;
+ a.set(e, 8), a[o += s] = 1;
+ var u = t.byteLength;
+ a[o + 1] = u >>> 8, a[o + 2] = 255 & u, a.set(t, o + 3), o += 3 + u, r && (a[o] = 252 | i.chroma_format_idc, a[o + 1] = 248 | i.bit_depth_luma - 8, a[o + 2] = 248 | i.bit_depth_chroma - 8, a[o + 3] = 0, o += 4)
+ }
+ return e.prototype.getData = function() {
+ return this.data
+ }, e
+ }();
+ ! function(e) {
+ e[e.kNull = 0] = "kNull", e[e.kAACMain = 1] = "kAACMain", e[e.kAAC_LC = 2] = "kAAC_LC", e[e.kAAC_SSR = 3] = "kAAC_SSR", e[e.kAAC_LTP = 4] = "kAAC_LTP", e[e.kAAC_SBR = 5] = "kAAC_SBR", e[e.kAAC_Scalable = 6] = "kAAC_Scalable", e[e.kLayer1 = 32] = "kLayer1", e[e.kLayer2 = 33] = "kLayer2", e[e.kLayer3 = 34] = "kLayer3"
+ }(A || (A = {})),
+ function(e) {
+ e[e.k96000Hz = 0] = "k96000Hz", e[e.k88200Hz = 1] = "k88200Hz", e[e.k64000Hz = 2] = "k64000Hz", e[e.k48000Hz = 3] = "k48000Hz", e[e.k44100Hz = 4] = "k44100Hz", e[e.k32000Hz = 5] = "k32000Hz", e[e.k24000Hz = 6] = "k24000Hz", e[e.k22050Hz = 7] = "k22050Hz", e[e.k16000Hz = 8] = "k16000Hz", e[e.k12000Hz = 9] = "k12000Hz", e[e.k11025Hz = 10] = "k11025Hz", e[e.k8000Hz = 11] = "k8000Hz", e[e.k7350Hz = 12] = "k7350Hz"
+ }(C || (C = {}));
+ var x, R = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350],
+ D = function() {},
+ O = function() {
+ function e(e) {
+ this.TAG = "AACADTSParser", this.data_ = e, this.current_syncword_offset_ = this.findNextSyncwordOffset(0), this.eof_flag_ && a.a.e(this.TAG, "Could not found ADTS syncword until payload end")
+ }
+ return e.prototype.findNextSyncwordOffset = function(e) {
+ for (var t = e, i = this.data_;;) {
+ if (t + 7 >= i.byteLength) return this.eof_flag_ = !0, i.byteLength;
+ if (4095 == (i[t + 0] << 8 | i[t + 1]) >>> 4) return t;
+ t++
+ }
+ }, e.prototype.readNextAACFrame = function() {
+ for (var e = this.data_, t = null; null == t && !this.eof_flag_;) {
+ var i = this.current_syncword_offset_,
+ n = (8 & e[i + 1]) >>> 3,
+ r = (6 & e[i + 1]) >>> 1,
+ a = 1 & e[i + 1],
+ s = (192 & e[i + 2]) >>> 6,
+ o = (60 & e[i + 2]) >>> 2,
+ u = (1 & e[i + 2]) << 2 | (192 & e[i + 3]) >>> 6,
+ l = (3 & e[i + 3]) << 11 | e[i + 4] << 3 | (224 & e[i + 5]) >>> 5;
+ if (e[i + 6], i + l > this.data_.byteLength) {
+ this.eof_flag_ = !0, this.has_last_incomplete_data = !0;
+ break
+ }
+ var h = 1 === a ? 7 : 9,
+ d = l - h;
+ i += h;
+ var c = this.findNextSyncwordOffset(i + d);
+ if (this.current_syncword_offset_ = c, (0 === n || 1 === n) && 0 === r) {
+ var f = e.subarray(i, i + d);
+ (t = new D).audio_object_type = s + 1, t.sampling_freq_index = o, t.sampling_frequency = R[o], t.channel_config = u, t.data = f
+ }
+ }
+ return t
+ }, e.prototype.hasIncompleteData = function() {
+ return this.has_last_incomplete_data
+ }, e.prototype.getIncompleteData = function() {
+ return this.has_last_incomplete_data ? this.data_.subarray(this.current_syncword_offset_) : null
+ }, e
+ }(),
+ U = function(e) {
+ var t = null,
+ i = e.audio_object_type,
+ n = e.audio_object_type,
+ r = e.sampling_freq_index,
+ a = e.channel_config,
+ s = 0,
+ o = navigator.userAgent.toLowerCase(); - 1 !== o.indexOf("firefox") ? r >= 6 ? (n = 5, t = new Array(4), s = r - 3) : (n = 2, t = new Array(2), s = r) : -1 !== o.indexOf("android") ? (n = 2, t = new Array(2), s = r) : (n = 5, s = r, t = new Array(4), r >= 6 ? s = r - 3 : 1 === a && (n = 2, t = new Array(2), s = r)), t[0] = n << 3, t[0] |= (15 & r) >>> 1, t[1] = (15 & r) << 7, t[1] |= (15 & a) << 3, 5 === n && (t[1] |= (15 & s) >>> 1, t[2] = (1 & s) << 7, t[2] |= 8, t[3] = 0), this.config = t, this.sampling_rate = R[r], this.channel_count = a, this.codec_mimetype = "mp4a.40." + n, this.original_codec_mimetype = "mp4a.40." + i
+ },
+ M = function() {},
+ F = function() {},
+ B = (x = function(e, t) {
+ return (x = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ function i() {
+ this.constructor = e
+ }
+ x(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ N = function(e) {
+ function t(t, i) {
+ var n = e.call(this) || this;
+ return n.TAG = "TSDemuxer", n.first_parse_ = !0, n.media_info_ = new o.a, n.timescale_ = 90, n.duration_ = 0, n.current_pmt_pid_ = -1, n.program_pmt_map_ = {}, n.pes_slice_queues_ = {}, n.video_metadata_ = {
+ sps: void 0,
+ pps: void 0,
+ sps_details: void 0
+ }, n.audio_metadata_ = {
+ audio_object_type: void 0,
+ sampling_freq_index: void 0,
+ sampling_frequency: void 0,
+ channel_config: void 0
+ }, n.aac_last_sample_pts_ = void 0, n.aac_last_incomplete_data_ = null, n.has_video_ = !1, n.has_audio_ = !1, n.video_init_segment_dispatched_ = !1, n.audio_init_segment_dispatched_ = !1, n.video_metadata_changed_ = !1, n.audio_metadata_changed_ = !1, n.video_track_ = {
+ type: "video",
+ id: 1,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, n.audio_track_ = {
+ type: "audio",
+ id: 2,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, n.ts_packet_size_ = t.ts_packet_size, n.sync_offset_ = t.sync_offset, n.config_ = i, n
+ }
+ return B(t, e), t.prototype.destroy = function() {
+ this.media_info_ = null, this.pes_slice_queues_ = null, this.video_metadata_ = null, this.audio_metadata_ = null, this.aac_last_incomplete_data_ = null, this.video_track_ = null, this.audio_track_ = null, e.prototype.destroy.call(this)
+ }, t.probe = function(e) {
+ var t = new Uint8Array(e),
+ i = -1,
+ n = 188;
+ if (t.byteLength <= 3 * n) return a.a.e("TSDemuxer", "Probe data " + t.byteLength + " bytes is too few for judging MPEG-TS stream format!"), {
+ match: !1
+ };
+ for (; - 1 === i;) {
+ for (var r = Math.min(1e3, t.byteLength - 3 * n), s = 0; s < r;) {
+ if (71 === t[s] && 71 === t[s + n] && 71 === t[s + 2 * n]) {
+ i = s;
+ break
+ }
+ s++
+ }
+ if (-1 === i)
+ if (188 === n) n = 192;
+ else {
+ if (192 !== n) break;
+ n = 204
+ }
+ }
+ return -1 === i ? {
+ match: !1
+ } : (192 === n && i >= 4 ? (a.a.v("TSDemuxer", "ts_packet_size = 192, m2ts mode"), i -= 4) : 204 === n && a.a.v("TSDemuxer", "ts_packet_size = 204, RS encoded MPEG2-TS stream"), {
+ match: !0,
+ consumed: 0,
+ ts_packet_size: n,
+ sync_offset: i
+ })
+ }, t.prototype.bindDataSource = function(e) {
+ return e.onDataArrival = this.parseChunks.bind(this), this
+ }, t.prototype.resetMediaInfo = function() {
+ this.media_info_ = new o.a
+ }, t.prototype.parseChunks = function(e, t) {
+ if (!(this.onError && this.onMediaInfo && this.onTrackMetadata && this.onDataAvailable)) throw new c.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
+ var i = 0;
+ for (this.first_parse_ && (this.first_parse_ = !1, i = this.sync_offset_); i + this.ts_packet_size_ <= e.byteLength;) {
+ var n = t + i;
+ 192 === this.ts_packet_size_ && (i += 4);
+ var r = new Uint8Array(e, i, 188),
+ s = r[0];
+ if (71 !== s) {
+ a.a.e(this.TAG, "sync_byte = " + s + ", not 0x47");
+ break
+ }
+ var o = (64 & r[1]) >>> 6,
+ u = (r[1], (31 & r[1]) << 8 | r[2]),
+ l = (48 & r[3]) >>> 4,
+ h = 15 & r[3],
+ d = {},
+ f = 4;
+ if (2 == l || 3 == l) {
+ var p = r[4];
+ if (5 + p === 188) {
+ i += 188, 204 === this.ts_packet_size_ && (i += 16);
+ continue
+ }
+ p > 0 && (d = this.parseAdaptationField(e, i + 4, 1 + p)), f = 5 + p
+ }
+ if (1 == l || 3 == l)
+ if (0 === u || u === this.current_pmt_pid_) {
+ o && (f += 1 + r[f]);
+ var m = 188 - f;
+ 0 === u ? this.parsePAT(e, i + f, m, {
+ payload_unit_start_indicator: o,
+ continuity_conunter: h
+ }) : this.parsePMT(e, i + f, m, {
+ payload_unit_start_indicator: o,
+ continuity_conunter: h
+ })
+ } else if (null != this.pmt_ && null != this.pmt_.pid_stream_type[u]) {
+ m = 188 - f;
+ var _ = this.pmt_.pid_stream_type[u];
+ u !== this.pmt_.common_pids.h264 && u !== this.pmt_.common_pids.adts_aac && !0 !== this.pmt_.pes_private_data_pids[u] && !0 !== this.pmt_.timed_id3_pids[u] || this.handlePESSlice(e, i + f, m, {
+ pid: u,
+ stream_type: _,
+ file_position: n,
+ payload_unit_start_indicator: o,
+ continuity_conunter: h,
+ random_access_indicator: d.random_access_indicator
+ })
+ }
+ i += 188, 204 === this.ts_packet_size_ && (i += 16)
+ }
+ return this.dispatchAudioVideoMediaSegment(), i
+ }, t.prototype.parseAdaptationField = function(e, t, i) {
+ var n = new Uint8Array(e, t, i),
+ r = n[0];
+ return r > 0 ? r > 183 ? (a.a.w(this.TAG, "Illegal adaptation_field_length: " + r), {}) : {
+ discontinuity_indicator: (128 & n[1]) >>> 7,
+ random_access_indicator: (64 & n[1]) >>> 6,
+ elementary_stream_priority_indicator: (32 & n[1]) >>> 5
+ } : {}
+ }, t.prototype.parsePAT = function(e, t, i, n) {
+ var r = new Uint8Array(e, t, i),
+ s = r[0];
+ if (0 === s) {
+ var o = (15 & r[1]) << 8 | r[2],
+ u = (r[3], r[4], (62 & r[5]) >>> 1),
+ l = 1 & r[5],
+ h = r[6],
+ d = (r[7], null);
+ if (1 === l && 0 === h)(d = new b).version_number = u;
+ else if (null == (d = this.pat_)) return;
+ for (var c = o - 5 - 4, f = -1, p = -1, m = 8; m < 8 + c; m += 4) {
+ var _ = r[m] << 8 | r[m + 1],
+ g = (31 & r[m + 2]) << 8 | r[m + 3];
+ 0 === _ ? d.network_pid = g : (d.program_pmt_pid[_] = g, -1 === f && (f = _), -1 === p && (p = g))
+ }
+ 1 === l && 0 === h && (null == this.pat_ && a.a.v(this.TAG, "Parsed first PAT: " + JSON.stringify(d)), this.pat_ = d, this.current_program_ = f, this.current_pmt_pid_ = p)
+ } else a.a.e(this.TAG, "parsePAT: table_id " + s + " is not corresponded to PAT!")
+ }, t.prototype.parsePMT = function(e, t, i, n) {
+ var r = new Uint8Array(e, t, i),
+ s = r[0];
+ if (2 === s) {
+ var o = (15 & r[1]) << 8 | r[2],
+ u = r[3] << 8 | r[4],
+ l = (62 & r[5]) >>> 1,
+ d = 1 & r[5],
+ c = r[6],
+ f = (r[7], null);
+ if (1 === d && 0 === c)(f = new T).program_number = u, f.version_number = l, this.program_pmt_map_[u] = f;
+ else if (null == (f = this.program_pmt_map_[u])) return;
+ r[8], r[9];
+ for (var p = (15 & r[10]) << 8 | r[11], m = 12 + p, _ = o - 9 - p - 4, g = m; g < m + _;) {
+ var v = r[g],
+ y = (31 & r[g + 1]) << 8 | r[g + 2],
+ b = (15 & r[g + 3]) << 8 | r[g + 4];
+ if (f.pid_stream_type[y] = v, v !== h.kH264 || f.common_pids.h264)
+ if (v !== h.kADTSAAC || f.common_pids.adts_aac)
+ if (v === h.kPESPrivateData) {
+ if (f.pes_private_data_pids[y] = !0, b > 0) {
+ var S = r.subarray(g + 5, g + 5 + b);
+ this.dispatchPESPrivateDataDescriptor(y, v, S)
+ }
+ } else v === h.kID3 && (f.timed_id3_pids[y] = !0);
+ else f.common_pids.adts_aac = y;
+ else f.common_pids.h264 = y;
+ g += 5 + b
+ }
+ u === this.current_program_ && (null == this.pmt_ && a.a.v(this.TAG, "Parsed first PMT: " + JSON.stringify(f)), this.pmt_ = f, f.common_pids.h264 && (this.has_video_ = !0), f.common_pids.adts_aac && (this.has_audio_ = !0))
+ } else a.a.e(this.TAG, "parsePMT: table_id " + s + " is not corresponded to PMT!")
+ }, t.prototype.handlePESSlice = function(e, t, i, n) {
+ var r = new Uint8Array(e, t, i),
+ s = r[0] << 16 | r[1] << 8 | r[2],
+ o = (r[3], r[4] << 8 | r[5]);
+ if (n.payload_unit_start_indicator) {
+ if (1 !== s) return void a.a.e(this.TAG, "handlePESSlice: packet_start_code_prefix should be 1 but with value " + s);
+ var u = this.pes_slice_queues_[n.pid];
+ u && (0 === u.expected_length || u.expected_length === u.total_length ? this.emitPESSlices(u, n) : this.cleanPESSlices(u, n)), this.pes_slice_queues_[n.pid] = new w, this.pes_slice_queues_[n.pid].file_position = n.file_position, this.pes_slice_queues_[n.pid].random_access_indicator = n.random_access_indicator
+ }
+ if (null != this.pes_slice_queues_[n.pid]) {
+ var l = this.pes_slice_queues_[n.pid];
+ l.slices.push(r), n.payload_unit_start_indicator && (l.expected_length = 0 === o ? 0 : o + 6), l.total_length += r.byteLength, l.expected_length > 0 && l.expected_length === l.total_length ? this.emitPESSlices(l, n) : l.expected_length > 0 && l.expected_length < l.total_length && this.cleanPESSlices(l, n)
+ }
+ }, t.prototype.emitPESSlices = function(e, t) {
+ for (var i = new Uint8Array(e.total_length), n = 0, r = 0; n < e.slices.length; n++) {
+ var a = e.slices[n];
+ i.set(a, r), r += a.byteLength
+ }
+ e.slices = [], e.expected_length = -1, e.total_length = 0;
+ var s = new E;
+ s.pid = t.pid, s.data = i, s.stream_type = t.stream_type, s.file_position = e.file_position, s.random_access_indicator = e.random_access_indicator, this.parsePES(s)
+ }, t.prototype.cleanPESSlices = function(e, t) {
+ e.slices = [], e.expected_length = -1, e.total_length = 0
+ }, t.prototype.parsePES = function(e) {
+ var t = e.data,
+ i = t[0] << 16 | t[1] << 8 | t[2],
+ n = t[3],
+ r = t[4] << 8 | t[5];
+ if (1 === i)
+ if (188 !== n && 190 !== n && 191 !== n && 240 !== n && 241 !== n && 255 !== n && 242 !== n && 248 !== n) {
+ t[6];
+ var s = (192 & t[7]) >>> 6,
+ o = t[8],
+ u = void 0,
+ l = void 0;
+ 2 !== s && 3 !== s || (u = 536870912 * (14 & t[9]) + 4194304 * (255 & t[10]) + 16384 * (254 & t[11]) + 128 * (255 & t[12]) + (254 & t[13]) / 2, l = 3 === s ? 536870912 * (14 & t[14]) + 4194304 * (255 & t[15]) + 16384 * (254 & t[16]) + 128 * (255 & t[17]) + (254 & t[18]) / 2 : u);
+ var d = 9 + o,
+ c = void 0;
+ if (0 !== r) {
+ if (r < 3 + o) return void a.a.v(this.TAG, "Malformed PES: PES_packet_length < 3 + PES_header_data_length");
+ c = r - 3 - o
+ } else c = t.byteLength - d;
+ var f = t.subarray(d, d + c);
+ switch (e.stream_type) {
+ case h.kMPEG1Audio:
+ case h.kMPEG2Audio:
+ break;
+ case h.kPESPrivateData:
+ this.parsePESPrivateDataPayload(f, u, l, e.pid, n);
+ break;
+ case h.kADTSAAC:
+ this.parseAACPayload(f, u);
+ break;
+ case h.kID3:
+ this.parseTimedID3MetadataPayload(f, u, l, e.pid, n);
+ break;
+ case h.kH264:
+ this.parseH264Payload(f, u, l, e.file_position, e.random_access_indicator);
+ break;
+ case h.kH265:
+ }
+ } else 188 !== n && 191 !== n && 240 !== n && 241 !== n && 255 !== n && 242 !== n && 248 !== n || e.stream_type !== h.kPESPrivateData || (d = 6, c = void 0, c = 0 !== r ? r : t.byteLength - d, f = t.subarray(d, d + c), this.parsePESPrivateDataPayload(f, void 0, void 0, e.pid, n));
+ else a.a.e(this.TAG, "parsePES: packet_start_code_prefix should be 1 but with value " + i)
+ }, t.prototype.parseH264Payload = function(e, t, i, n, r) {
+ for (var s = new I(e), o = null, u = [], l = 0, h = !1; null != (o = s.readNextNaluPayload());) {
+ var d = new P(o);
+ if (d.type === S.kSliceSPS) {
+ var c = _.parseSPS(o.data);
+ this.video_init_segment_dispatched_ ? !0 === this.detectVideoMetadataChange(d, c) && (a.a.v(this.TAG, "H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"), this.video_metadata_changed_ = !0, this.video_metadata_ = {
+ sps: d,
+ pps: void 0,
+ sps_details: c
+ }) : (this.video_metadata_.sps = d, this.video_metadata_.sps_details = c)
+ } else d.type === S.kSlicePPS ? this.video_init_segment_dispatched_ && !this.video_metadata_changed_ || (this.video_metadata_.pps = d, this.video_metadata_.sps && this.video_metadata_.pps && (this.video_metadata_changed_ && this.dispatchVideoMediaSegment(), this.dispatchVideoInitSegment())) : (d.type === S.kSliceIDR || d.type === S.kSliceNonIDR && 1 === r) && (h = !0);
+ this.video_init_segment_dispatched_ && (u.push(d), l += d.data.byteLength)
+ }
+ var f = Math.floor(t / this.timescale_),
+ p = Math.floor(i / this.timescale_);
+ if (u.length) {
+ var m = this.video_track_,
+ g = {
+ units: u,
+ length: l,
+ isKeyframe: h,
+ dts: p,
+ pts: f,
+ cts: f - p,
+ file_position: n
+ };
+ m.samples.push(g), m.length += l
+ }
+ }, t.prototype.detectVideoMetadataChange = function(e, t) {
+ if (t.codec_mimetype !== this.video_metadata_.sps_details.codec_mimetype) return a.a.v(this.TAG, "H264: Codec mimeType changed from " + this.video_metadata_.sps_details.codec_mimetype + " to " + t.codec_mimetype), !0;
+ if (t.codec_size.width !== this.video_metadata_.sps_details.codec_size.width || t.codec_size.height !== this.video_metadata_.sps_details.codec_size.height) {
+ var i = this.video_metadata_.sps_details.codec_size,
+ n = t.codec_size;
+ return a.a.v(this.TAG, "H264: Coded Resolution changed from " + i.width + "x" + i.height + " to " + n.width + "x" + n.height), !0
+ }
+ return t.present_size.width !== this.video_metadata_.sps_details.present_size.width && (a.a.v(this.TAG, "H264: Present resolution width changed from " + this.video_metadata_.sps_details.present_size.width + " to " + t.present_size.width), !0)
+ }, t.prototype.isInitSegmentDispatched = function() {
+ return this.has_video_ && this.has_audio_ ? this.video_init_segment_dispatched_ && this.audio_init_segment_dispatched_ : this.has_video_ && !this.has_audio_ ? this.video_init_segment_dispatched_ : !(this.has_video_ || !this.has_audio_) && this.audio_init_segment_dispatched_
+ }, t.prototype.dispatchVideoInitSegment = function() {
+ var e = this.video_metadata_.sps_details,
+ t = {
+ type: "video"
+ };
+ t.id = this.video_track_.id, t.timescale = 1e3, t.duration = this.duration_, t.codecWidth = e.codec_size.width, t.codecHeight = e.codec_size.height, t.presentWidth = e.present_size.width, t.presentHeight = e.present_size.height, t.profile = e.profile_string, t.level = e.level_string, t.bitDepth = e.bit_depth, t.chromaFormat = e.chroma_format, t.sarRatio = e.sar_ratio, t.frameRate = e.frame_rate;
+ var i = t.frameRate.fps_den,
+ n = t.frameRate.fps_num;
+ t.refSampleDuration = i / n * 1e3, t.codec = e.codec_mimetype;
+ var r = this.video_metadata_.sps.data.subarray(4),
+ s = this.video_metadata_.pps.data.subarray(4),
+ o = new L(r, s, e);
+ t.avcc = o.getData(), 0 == this.video_init_segment_dispatched_ && a.a.v(this.TAG, "Generated first AVCDecoderConfigurationRecord for mimeType: " + t.codec), this.onTrackMetadata("video", t), this.video_init_segment_dispatched_ = !0, this.video_metadata_changed_ = !1;
+ var u = this.media_info_;
+ u.hasVideo = !0, u.width = t.codecWidth, u.height = t.codecHeight, u.fps = t.frameRate.fps, u.profile = t.profile, u.level = t.level, u.refFrames = e.ref_frames, u.chromaFormat = e.chroma_format_string, u.sarNum = t.sarRatio.width, u.sarDen = t.sarRatio.height, u.videoCodec = t.codec, u.hasAudio && u.audioCodec ? u.mimeType = 'video/mp2t; codecs="' + u.videoCodec + "," + u.audioCodec + '"' : u.mimeType = 'video/mp2t; codecs="' + u.videoCodec + '"', u.isComplete() && this.onMediaInfo(u)
+ }, t.prototype.dispatchVideoMediaSegment = function() {
+ this.isInitSegmentDispatched() && this.video_track_.length && this.onDataAvailable(null, this.video_track_)
+ }, t.prototype.dispatchAudioMediaSegment = function() {
+ this.isInitSegmentDispatched() && this.audio_track_.length && this.onDataAvailable(this.audio_track_, null)
+ }, t.prototype.dispatchAudioVideoMediaSegment = function() {
+ this.isInitSegmentDispatched() && (this.audio_track_.length || this.video_track_.length) && this.onDataAvailable(this.audio_track_, this.video_track_)
+ }, t.prototype.parseAACPayload = function(e, t) {
+ if (!this.has_video_ || this.video_init_segment_dispatched_) {
+ if (this.aac_last_incomplete_data_) {
+ var i = new Uint8Array(e.byteLength + this.aac_last_incomplete_data_.byteLength);
+ i.set(this.aac_last_incomplete_data_, 0), i.set(e, this.aac_last_incomplete_data_.byteLength), e = i
+ }
+ var n, r;
+ if (null != t) r = t / this.timescale_;
+ else {
+ if (null == this.aac_last_sample_pts_) return void a.a.w(this.TAG, "AAC: Unknown pts");
+ n = 1024 / this.audio_metadata_.sampling_frequency * 1e3, r = this.aac_last_sample_pts_ + n
+ }
+ if (this.aac_last_incomplete_data_ && this.aac_last_sample_pts_) {
+ n = 1024 / this.audio_metadata_.sampling_frequency * 1e3;
+ var s = this.aac_last_sample_pts_ + n;
+ Math.abs(s - r) > 1 && (a.a.w(this.TAG, "AAC: Detected pts overlapped, expected: " + s + "ms, PES pts: " + r + "ms"), r = s)
+ }
+ for (var o, u = new O(e), l = null, h = r; null != (l = u.readNextAACFrame());) {
+ n = 1024 / l.sampling_frequency * 1e3, 0 == this.audio_init_segment_dispatched_ ? (this.audio_metadata_.audio_object_type = l.audio_object_type, this.audio_metadata_.sampling_freq_index = l.sampling_freq_index, this.audio_metadata_.sampling_frequency = l.sampling_frequency, this.audio_metadata_.channel_config = l.channel_config, this.dispatchAudioInitSegment(l)) : this.detectAudioMetadataChange(l) && (this.dispatchAudioMediaSegment(), this.dispatchAudioInitSegment(l)), o = h;
+ var d = Math.floor(h),
+ c = {
+ unit: l.data,
+ length: l.data.byteLength,
+ pts: d,
+ dts: d
+ };
+ this.audio_track_.samples.push(c), this.audio_track_.length += l.data.byteLength, h += n
+ }
+ u.hasIncompleteData() && (this.aac_last_incomplete_data_ = u.getIncompleteData()), o && (this.aac_last_sample_pts_ = o)
+ }
+ }, t.prototype.detectAudioMetadataChange = function(e) {
+ return e.audio_object_type !== this.audio_metadata_.audio_object_type ? (a.a.v(this.TAG, "AAC: AudioObjectType changed from " + this.audio_metadata_.audio_object_type + " to " + e.audio_object_type), !0) : e.sampling_freq_index !== this.audio_metadata_.sampling_freq_index ? (a.a.v(this.TAG, "AAC: SamplingFrequencyIndex changed from " + this.audio_metadata_.sampling_freq_index + " to " + e.sampling_freq_index), !0) : e.channel_config !== this.audio_metadata_.channel_config && (a.a.v(this.TAG, "AAC: Channel configuration changed from " + this.audio_metadata_.channel_config + " to " + e.channel_config), !0)
+ }, t.prototype.dispatchAudioInitSegment = function(e) {
+ var t = new U(e),
+ i = {
+ type: "audio"
+ };
+ i.id = this.audio_track_.id, i.timescale = 1e3, i.duration = this.duration_, i.audioSampleRate = t.sampling_rate, i.channelCount = t.channel_count, i.codec = t.codec_mimetype, i.originalCodec = t.original_codec_mimetype, i.config = t.config, i.refSampleDuration = 1024 / i.audioSampleRate * i.timescale, 0 == this.audio_init_segment_dispatched_ && a.a.v(this.TAG, "Generated first AudioSpecificConfig for mimeType: " + i.codec), this.onTrackMetadata("audio", i), this.audio_init_segment_dispatched_ = !0, this.video_metadata_changed_ = !1;
+ var n = this.media_info_;
+ n.hasAudio = !0, n.audioCodec = i.originalCodec, n.audioSampleRate = i.audioSampleRate, n.audioChannelCount = i.channelCount, n.hasVideo && n.videoCodec ? n.mimeType = 'video/mp2t; codecs="' + n.videoCodec + "," + n.audioCodec + '"' : n.mimeType = 'video/mp2t; codecs="' + n.audioCodec + '"', n.isComplete() && this.onMediaInfo(n)
+ }, t.prototype.dispatchPESPrivateDataDescriptor = function(e, t, i) {
+ var n = new F;
+ n.pid = e, n.stream_type = t, n.descriptor = i, this.onPESPrivateDataDescriptor && this.onPESPrivateDataDescriptor(n)
+ }, t.prototype.parsePESPrivateDataPayload = function(e, t, i, n, r) {
+ var a = new M;
+ if (a.pid = n, a.stream_id = r, a.len = e.byteLength, a.data = e, null != t) {
+ var s = Math.floor(t / this.timescale_);
+ a.pts = s
+ } else a.nearest_pts = this.aac_last_sample_pts_;
+ if (null != i) {
+ var o = Math.floor(i / this.timescale_);
+ a.dts = o
+ }
+ this.onPESPrivateData && this.onPESPrivateData(a)
+ }, t.prototype.parseTimedID3MetadataPayload = function(e, t, i, n, r) {
+ var a = new M;
+ if (a.pid = n, a.stream_id = r, a.len = e.byteLength, a.data = e, null != t) {
+ var s = Math.floor(t / this.timescale_);
+ a.pts = s
+ }
+ if (null != i) {
+ var o = Math.floor(i / this.timescale_);
+ a.dts = o
+ }
+ this.onTimedID3Metadata && this.onTimedID3Metadata(a)
+ }, t
+ }(y),
+ j = function() {
+ function e() {}
+ return e.init = function() {
+ for (var t in e.types = {
+ avc1: [],
+ avcC: [],
+ btrt: [],
+ dinf: [],
+ dref: [],
+ esds: [],
+ ftyp: [],
+ hdlr: [],
+ mdat: [],
+ mdhd: [],
+ mdia: [],
+ mfhd: [],
+ minf: [],
+ moof: [],
+ moov: [],
+ mp4a: [],
+ mvex: [],
+ mvhd: [],
+ sdtp: [],
+ stbl: [],
+ stco: [],
+ stsc: [],
+ stsd: [],
+ stsz: [],
+ stts: [],
+ tfdt: [],
+ tfhd: [],
+ traf: [],
+ trak: [],
+ trun: [],
+ trex: [],
+ tkhd: [],
+ vmhd: [],
+ smhd: [],
+ ".mp3": []
+ }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t.charCodeAt(2), t.charCodeAt(3)]);
+ var i = e.constants = {};
+ i.FTYP = new Uint8Array([105, 115, 111, 109, 0, 0, 0, 1, 105, 115, 111, 109, 97, 118, 99, 49]), i.STSD_PREFIX = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), i.STTS = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.STSC = i.STCO = i.STTS, i.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), i.HDLR_VIDEO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]), i.HDLR_AUDIO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]), i.DREF = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), i.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
+ }, e.box = function(e) {
+ for (var t = 8, i = null, n = Array.prototype.slice.call(arguments, 1), r = n.length, a = 0; a < r; a++) t += n[a].byteLength;
+ (i = new Uint8Array(t))[0] = t >>> 24 & 255, i[1] = t >>> 16 & 255, i[2] = t >>> 8 & 255, i[3] = 255 & t, i.set(e, 4);
+ var s = 8;
+ for (a = 0; a < r; a++) i.set(n[a], s), s += n[a].byteLength;
+ return i
+ }, e.generateInitSegment = function(t) {
+ var i = e.box(e.types.ftyp, e.constants.FTYP),
+ n = e.moov(t),
+ r = new Uint8Array(i.byteLength + n.byteLength);
+ return r.set(i, 0), r.set(n, i.byteLength), r
+ }, e.moov = function(t) {
+ var i = e.mvhd(t.timescale, t.duration),
+ n = e.trak(t),
+ r = e.mvex(t);
+ return e.box(e.types.moov, i, n, r)
+ }, e.mvhd = function(t, i) {
+ return e.box(e.types.mvhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]))
+ }, e.trak = function(t) {
+ return e.box(e.types.trak, e.tkhd(t), e.mdia(t))
+ }, e.tkhd = function(t) {
+ var i = t.id,
+ n = t.duration,
+ r = t.presentWidth,
+ a = t.presentHeight;
+ return e.box(e.types.tkhd, new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 0, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, r >>> 8 & 255, 255 & r, 0, 0, a >>> 8 & 255, 255 & a, 0, 0]))
+ }, e.mdia = function(t) {
+ return e.box(e.types.mdia, e.mdhd(t), e.hdlr(t), e.minf(t))
+ }, e.mdhd = function(t) {
+ var i = t.timescale,
+ n = t.duration;
+ return e.box(e.types.mdhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, 85, 196, 0, 0]))
+ }, e.hdlr = function(t) {
+ var i;
+ return i = "audio" === t.type ? e.constants.HDLR_AUDIO : e.constants.HDLR_VIDEO, e.box(e.types.hdlr, i)
+ }, e.minf = function(t) {
+ var i;
+ return i = "audio" === t.type ? e.box(e.types.smhd, e.constants.SMHD) : e.box(e.types.vmhd, e.constants.VMHD), e.box(e.types.minf, i, e.dinf(), e.stbl(t))
+ }, e.dinf = function() {
+ return e.box(e.types.dinf, e.box(e.types.dref, e.constants.DREF))
+ }, e.stbl = function(t) {
+ return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.constants.STTS), e.box(e.types.stsc, e.constants.STSC), e.box(e.types.stsz, e.constants.STSZ), e.box(e.types.stco, e.constants.STCO))
+ }, e.stsd = function(t) {
+ return "audio" === t.type ? "mp3" === t.codec ? e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp3(t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp4a(t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.avc1(t))
+ }, e.mp3 = function(t) {
+ var i = t.channelCount,
+ n = t.audioSampleRate,
+ r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, 0, 0]);
+ return e.box(e.types[".mp3"], r)
+ }, e.mp4a = function(t) {
+ var i = t.channelCount,
+ n = t.audioSampleRate,
+ r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, 0, 0]);
+ return e.box(e.types.mp4a, r, e.esds(t))
+ }, e.esds = function(t) {
+ var i = t.config || [],
+ n = i.length,
+ r = new Uint8Array([0, 0, 0, 0, 3, 23 + n, 0, 1, 0, 4, 15 + n, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5].concat([n]).concat(i).concat([6, 1, 2]));
+ return e.box(e.types.esds, r)
+ }, e.avc1 = function(t) {
+ var i = t.avcc,
+ n = t.codecWidth,
+ r = t.codecHeight,
+ a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, r >>> 8 & 255, 255 & r, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 10, 120, 113, 113, 47, 102, 108, 118, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 255, 255]);
+ return e.box(e.types.avc1, a, e.box(e.types.avcC, i))
+ }, e.mvex = function(t) {
+ return e.box(e.types.mvex, e.trex(t))
+ }, e.trex = function(t) {
+ var i = t.id,
+ n = new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]);
+ return e.box(e.types.trex, n)
+ }, e.moof = function(t, i) {
+ return e.box(e.types.moof, e.mfhd(t.sequenceNumber), e.traf(t, i))
+ }, e.mfhd = function(t) {
+ var i = new Uint8Array([0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t]);
+ return e.box(e.types.mfhd, i)
+ }, e.traf = function(t, i) {
+ var n = t.id,
+ r = e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n])),
+ a = e.box(e.types.tfdt, new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i])),
+ s = e.sdtp(t),
+ o = e.trun(t, s.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
+ return e.box(e.types.traf, r, a, o, s)
+ }, e.sdtp = function(t) {
+ for (var i = t.samples || [], n = i.length, r = new Uint8Array(4 + n), a = 0; a < n; a++) {
+ var s = i[a].flags;
+ r[a + 4] = s.isLeading << 6 | s.dependsOn << 4 | s.isDependedOn << 2 | s.hasRedundancy
+ }
+ return e.box(e.types.sdtp, r)
+ }, e.trun = function(t, i) {
+ var n = t.samples || [],
+ r = n.length,
+ a = 12 + 16 * r,
+ s = new Uint8Array(a);
+ i += 8 + a, s.set([0, 0, 15, 1, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i], 0);
+ for (var o = 0; o < r; o++) {
+ var u = n[o].duration,
+ l = n[o].size,
+ h = n[o].flags,
+ d = n[o].cts;
+ s.set([u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u, l >>> 24 & 255, l >>> 16 & 255, l >>> 8 & 255, 255 & l, h.isLeading << 2 | h.dependsOn, h.isDependedOn << 6 | h.hasRedundancy << 4 | h.isNonSync, 0, 0, d >>> 24 & 255, d >>> 16 & 255, d >>> 8 & 255, 255 & d], 12 + 16 * o)
+ }
+ return e.box(e.types.trun, s)
+ }, e.mdat = function(t) {
+ return e.box(e.types.mdat, t)
+ }, e
+ }();
+ j.init();
+ var V = j,
+ H = function() {
+ function e() {}
+ return e.getSilentFrame = function(e, t) {
+ if ("mp4a.40.2" === e) {
+ if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]);
+ if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
+ if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
+ if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
+ if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
+ if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224])
+ } else {
+ if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
+ if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
+ if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94])
+ }
+ return null
+ }, e
+ }(),
+ z = i(7),
+ G = function() {
+ function e(e) {
+ this.TAG = "MP4Remuxer", this._config = e, this._isLive = !0 === e.isLive, this._dtsBase = -1, this._dtsBaseInited = !1, this._audioDtsBase = 1 / 0, this._videoDtsBase = 1 / 0, this._audioNextDts = void 0, this._videoNextDts = void 0, this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._audioMeta = null, this._videoMeta = null, this._audioSegmentInfoList = new z.c("audio"), this._videoSegmentInfoList = new z.c("video"), this._onInitSegment = null, this._onMediaSegment = null, this._forceFirstIDR = !(!s.a.chrome || !(s.a.version.major < 50 || 50 === s.a.version.major && s.a.version.build < 2661)), this._fillSilentAfterSeek = s.a.msedge || s.a.msie, this._mp3UseMpegAudio = !s.a.firefox, this._fillAudioTimestampGap = this._config.fixAudioTimestampGap
+ }
+ return e.prototype.destroy = function() {
+ this._dtsBase = -1, this._dtsBaseInited = !1, this._audioMeta = null, this._videoMeta = null, this._audioSegmentInfoList.clear(), this._audioSegmentInfoList = null, this._videoSegmentInfoList.clear(), this._videoSegmentInfoList = null, this._onInitSegment = null, this._onMediaSegment = null
+ }, e.prototype.bindDataSource = function(e) {
+ return e.onDataAvailable = this.remux.bind(this), e.onTrackMetadata = this._onTrackMetadataReceived.bind(this), this
+ }, Object.defineProperty(e.prototype, "onInitSegment", {
+ get: function() {
+ return this._onInitSegment
+ },
+ set: function(e) {
+ this._onInitSegment = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMediaSegment", {
+ get: function() {
+ return this._onMediaSegment
+ },
+ set: function(e) {
+ this._onMediaSegment = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.insertDiscontinuity = function() {
+ this._audioNextDts = this._videoNextDts = void 0
+ }, e.prototype.seek = function(e) {
+ this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._videoSegmentInfoList.clear(), this._audioSegmentInfoList.clear()
+ }, e.prototype.remux = function(e, t) {
+ if (!this._onMediaSegment) throw new c.a("MP4Remuxer: onMediaSegment callback must be specificed!");
+ this._dtsBaseInited || this._calculateDtsBase(e, t), t && this._remuxVideo(t), e && this._remuxAudio(e)
+ }, e.prototype._onTrackMetadataReceived = function(e, t) {
+ var i = null,
+ n = "mp4",
+ r = t.codec;
+ if ("audio" === e) this._audioMeta = t, "mp3" === t.codec && this._mp3UseMpegAudio ? (n = "mpeg", r = "", i = new Uint8Array) : i = V.generateInitSegment(t);
+ else {
+ if ("video" !== e) return;
+ this._videoMeta = t, i = V.generateInitSegment(t)
+ }
+ if (!this._onInitSegment) throw new c.a("MP4Remuxer: onInitSegment callback must be specified!");
+ this._onInitSegment(e, {
+ type: e,
+ data: i.buffer,
+ codec: r,
+ container: e + "/" + n,
+ mediaDuration: t.duration
+ })
+ }, e.prototype._calculateDtsBase = function(e, t) {
+ this._dtsBaseInited || (e && e.samples && e.samples.length && (this._audioDtsBase = e.samples[0].dts), t && t.samples && t.samples.length && (this._videoDtsBase = t.samples[0].dts), this._dtsBase = Math.min(this._audioDtsBase, this._videoDtsBase), this._dtsBaseInited = !0)
+ }, e.prototype.getTimestampBase = function() {
+ if (this._dtsBaseInited) return this._dtsBase
+ }, e.prototype.flushStashedSamples = function() {
+ var e = this._videoStashedLastSample,
+ t = this._audioStashedLastSample,
+ i = {
+ type: "video",
+ id: 1,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ };
+ null != e && (i.samples.push(e), i.length = e.length);
+ var n = {
+ type: "audio",
+ id: 2,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ };
+ null != t && (n.samples.push(t), n.length = t.length), this._videoStashedLastSample = null, this._audioStashedLastSample = null, this._remuxVideo(i, !0), this._remuxAudio(n, !0)
+ }, e.prototype._remuxAudio = function(e, t) {
+ if (null != this._audioMeta) {
+ var i, n = e,
+ r = n.samples,
+ o = void 0,
+ u = -1,
+ l = this._audioMeta.refSampleDuration,
+ h = "mp3" === this._audioMeta.codec && this._mp3UseMpegAudio,
+ d = this._dtsBaseInited && void 0 === this._audioNextDts,
+ c = !1;
+ if (r && 0 !== r.length && (1 !== r.length || t)) {
+ var f = 0,
+ p = null,
+ m = 0;
+ h ? (f = 0, m = n.length) : (f = 8, m = 8 + n.length);
+ var _ = null;
+ if (r.length > 1 && (m -= (_ = r.pop()).length), null != this._audioStashedLastSample) {
+ var g = this._audioStashedLastSample;
+ this._audioStashedLastSample = null, r.unshift(g), m += g.length
+ }
+ null != _ && (this._audioStashedLastSample = _);
+ var v = r[0].dts - this._dtsBase;
+ if (this._audioNextDts) o = v - this._audioNextDts;
+ else if (this._audioSegmentInfoList.isEmpty()) o = 0, this._fillSilentAfterSeek && !this._videoSegmentInfoList.isEmpty() && "mp3" !== this._audioMeta.originalCodec && (c = !0);
+ else {
+ var y = this._audioSegmentInfoList.getLastSampleBefore(v);
+ if (null != y) {
+ var b = v - (y.originalDts + y.duration);
+ b <= 3 && (b = 0), o = v - (y.dts + y.duration + b)
+ } else o = 0
+ }
+ if (c) {
+ var S = v - o,
+ T = this._videoSegmentInfoList.getLastSegmentBefore(v);
+ if (null != T && T.beginDts < S) {
+ if (D = H.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount)) {
+ var E = T.beginDts,
+ w = S - T.beginDts;
+ a.a.v(this.TAG, "InsertPrefixSilentAudio: dts: " + E + ", duration: " + w), r.unshift({
+ unit: D,
+ dts: E,
+ pts: E
+ }), m += D.byteLength
+ }
+ } else c = !1
+ }
+ for (var A = [], C = 0; C < r.length; C++) {
+ var k = (g = r[C]).unit,
+ P = g.dts - this._dtsBase,
+ I = (E = P, !1),
+ L = null,
+ x = 0;
+ if (!(P < -.001)) {
+ if ("mp3" !== this._audioMeta.codec) {
+ var R = P;
+ if (this._audioNextDts && (R = this._audioNextDts), (o = P - R) <= -3 * l) {
+ a.a.w(this.TAG, "Dropping 1 audio frame (originalDts: " + P + " ms ,curRefDts: " + R + " ms) due to dtsCorrection: " + o + " ms overlap.");
+ continue
+ }
+ if (o >= 3 * l && this._fillAudioTimestampGap && !s.a.safari) {
+ I = !0;
+ var D, O = Math.floor(o / l);
+ a.a.w(this.TAG, "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: " + P + " ms, curRefDts: " + R + " ms, dtsCorrection: " + Math.round(o) + " ms, generate: " + O + " frames"), E = Math.floor(R), x = Math.floor(R + l) - E, null == (D = H.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount)) && (a.a.w(this.TAG, "Unable to generate silent frame for " + this._audioMeta.originalCodec + " with " + this._audioMeta.channelCount + " channels, repeat last frame"), D = k), L = [];
+ for (var U = 0; U < O; U++) {
+ R += l;
+ var M = Math.floor(R),
+ F = Math.floor(R + l) - M,
+ B = {
+ dts: M,
+ pts: M,
+ cts: 0,
+ unit: D,
+ size: D.byteLength,
+ duration: F,
+ originalDts: P,
+ flags: {
+ isLeading: 0,
+ dependsOn: 1,
+ isDependedOn: 0,
+ hasRedundancy: 0
+ }
+ };
+ L.push(B), m += B.size
+ }
+ this._audioNextDts = R + l
+ } else E = Math.floor(R), x = Math.floor(R + l) - E, this._audioNextDts = R + l
+ } else E = P - o, x = C !== r.length - 1 ? r[C + 1].dts - this._dtsBase - o - E : null != _ ? _.dts - this._dtsBase - o - E : A.length >= 1 ? A[A.length - 1].duration : Math.floor(l), this._audioNextDts = E + x; - 1 === u && (u = E), A.push({
+ dts: E,
+ pts: E,
+ cts: 0,
+ unit: g.unit,
+ size: g.unit.byteLength,
+ duration: x,
+ originalDts: P,
+ flags: {
+ isLeading: 0,
+ dependsOn: 1,
+ isDependedOn: 0,
+ hasRedundancy: 0
+ }
+ }), I && A.push.apply(A, L)
+ }
+ }
+ if (0 === A.length) return n.samples = [], void(n.length = 0);
+ for (h ? p = new Uint8Array(m) : ((p = new Uint8Array(m))[0] = m >>> 24 & 255, p[1] = m >>> 16 & 255, p[2] = m >>> 8 & 255, p[3] = 255 & m, p.set(V.types.mdat, 4)), C = 0; C < A.length; C++) k = A[C].unit, p.set(k, f), f += k.byteLength;
+ var N = A[A.length - 1];
+ i = N.dts + N.duration;
+ var j, G = new z.b;
+ G.beginDts = u, G.endDts = i, G.beginPts = u, G.endPts = i, G.originalBeginDts = A[0].originalDts, G.originalEndDts = N.originalDts + N.duration, G.firstSample = new z.d(A[0].dts, A[0].pts, A[0].duration, A[0].originalDts, !1), G.lastSample = new z.d(N.dts, N.pts, N.duration, N.originalDts, !1), this._isLive || this._audioSegmentInfoList.append(G), n.samples = A, n.sequenceNumber++, j = h ? new Uint8Array : V.moof(n, u), n.samples = [], n.length = 0;
+ var W = {
+ type: "audio",
+ data: this._mergeBoxes(j, p).buffer,
+ sampleCount: A.length,
+ info: G
+ };
+ h && d && (W.timestampOffset = u), this._onMediaSegment("audio", W)
+ }
+ }
+ }, e.prototype._remuxVideo = function(e, t) {
+ if (null != this._videoMeta) {
+ var i, n, r = e,
+ a = r.samples,
+ s = void 0,
+ o = -1,
+ u = -1;
+ if (a && 0 !== a.length && (1 !== a.length || t)) {
+ var l = 8,
+ h = null,
+ d = 8 + e.length,
+ c = null;
+ if (a.length > 1 && (d -= (c = a.pop()).length), null != this._videoStashedLastSample) {
+ var f = this._videoStashedLastSample;
+ this._videoStashedLastSample = null, a.unshift(f), d += f.length
+ }
+ null != c && (this._videoStashedLastSample = c);
+ var p = a[0].dts - this._dtsBase;
+ if (this._videoNextDts) s = p - this._videoNextDts;
+ else if (this._videoSegmentInfoList.isEmpty()) s = 0;
+ else {
+ var m = this._videoSegmentInfoList.getLastSampleBefore(p);
+ if (null != m) {
+ var _ = p - (m.originalDts + m.duration);
+ _ <= 3 && (_ = 0), s = p - (m.dts + m.duration + _)
+ } else s = 0
+ }
+ for (var g = new z.b, v = [], y = 0; y < a.length; y++) {
+ var b = (f = a[y]).dts - this._dtsBase,
+ S = f.isKeyframe,
+ T = b - s,
+ E = f.cts,
+ w = T + E; - 1 === o && (o = T, u = w);
+ var A = 0;
+ if (A = y !== a.length - 1 ? a[y + 1].dts - this._dtsBase - s - T : null != c ? c.dts - this._dtsBase - s - T : v.length >= 1 ? v[v.length - 1].duration : Math.floor(this._videoMeta.refSampleDuration), S) {
+ var C = new z.d(T, w, A, f.dts, !0);
+ C.fileposition = f.fileposition, g.appendSyncPoint(C)
+ }
+ v.push({
+ dts: T,
+ pts: w,
+ cts: E,
+ units: f.units,
+ size: f.length,
+ isKeyframe: S,
+ duration: A,
+ originalDts: b,
+ flags: {
+ isLeading: 0,
+ dependsOn: S ? 2 : 1,
+ isDependedOn: S ? 1 : 0,
+ hasRedundancy: 0,
+ isNonSync: S ? 0 : 1
+ }
+ })
+ }
+ for ((h = new Uint8Array(d))[0] = d >>> 24 & 255, h[1] = d >>> 16 & 255, h[2] = d >>> 8 & 255, h[3] = 255 & d, h.set(V.types.mdat, 4), y = 0; y < v.length; y++)
+ for (var k = v[y].units; k.length;) {
+ var P = k.shift().data;
+ h.set(P, l), l += P.byteLength
+ }
+ var I = v[v.length - 1];
+ if (i = I.dts + I.duration, n = I.pts + I.duration, this._videoNextDts = i, g.beginDts = o, g.endDts = i, g.beginPts = u, g.endPts = n, g.originalBeginDts = v[0].originalDts, g.originalEndDts = I.originalDts + I.duration, g.firstSample = new z.d(v[0].dts, v[0].pts, v[0].duration, v[0].originalDts, v[0].isKeyframe), g.lastSample = new z.d(I.dts, I.pts, I.duration, I.originalDts, I.isKeyframe), this._isLive || this._videoSegmentInfoList.append(g), r.samples = v, r.sequenceNumber++, this._forceFirstIDR) {
+ var L = v[0].flags;
+ L.dependsOn = 2, L.isNonSync = 0
+ }
+ var x = V.moof(r, o);
+ r.samples = [], r.length = 0, this._onMediaSegment("video", {
+ type: "video",
+ data: this._mergeBoxes(x, h).buffer,
+ sampleCount: v.length,
+ info: g
+ })
+ }
+ }
+ }, e.prototype._mergeBoxes = function(e, t) {
+ var i = new Uint8Array(e.byteLength + t.byteLength);
+ return i.set(e, 0), i.set(t, e.byteLength), i
+ }, e
+ }(),
+ W = i(11),
+ Y = i(1),
+ q = function() {
+ function e(e, t) {
+ this.TAG = "TransmuxingController", this._emitter = new r.a, this._config = t, e.segments || (e.segments = [{
+ duration: e.duration,
+ filesize: e.filesize,
+ url: e.url
+ }]), "boolean" != typeof e.cors && (e.cors = !0), "boolean" != typeof e.withCredentials && (e.withCredentials = !1), this._mediaDataSource = e, this._currentSegmentIndex = 0;
+ var i = 0;
+ this._mediaDataSource.segments.forEach((function(n) {
+ n.timestampBase = i, i += n.duration, n.cors = e.cors, n.withCredentials = e.withCredentials, t.referrerPolicy && (n.referrerPolicy = t.referrerPolicy)
+ })), isNaN(i) || this._mediaDataSource.duration === i || (this._mediaDataSource.duration = i), this._mediaInfo = null, this._demuxer = null, this._remuxer = null, this._ioctl = null, this._pendingSeekTime = null, this._pendingResolveSeekPoint = null, this._statisticsReporter = null
+ }
+ return e.prototype.destroy = function() {
+ this._mediaInfo = null, this._mediaDataSource = null, this._statisticsReporter && this._disableStatisticsReporter(), this._ioctl && (this._ioctl.destroy(), this._ioctl = null), this._demuxer && (this._demuxer.destroy(), this._demuxer = null), this._remuxer && (this._remuxer.destroy(), this._remuxer = null), this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.start = function() {
+ this._loadSegment(0), this._enableStatisticsReporter()
+ }, e.prototype._loadSegment = function(e, t) {
+ this._currentSegmentIndex = e;
+ var i = this._mediaDataSource.segments[e],
+ n = this._ioctl = new W.a(i, this._config, e);
+ n.onError = this._onIOException.bind(this), n.onSeeked = this._onIOSeeked.bind(this), n.onComplete = this._onIOComplete.bind(this), n.onRedirect = this._onIORedirect.bind(this), n.onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this), t ? this._demuxer.bindDataSource(this._ioctl) : n.onDataArrival = this._onInitChunkArrival.bind(this), n.open(t)
+ }, e.prototype.stop = function() {
+ this._internalAbort(), this._disableStatisticsReporter()
+ }, e.prototype._internalAbort = function() {
+ this._ioctl && (this._ioctl.destroy(), this._ioctl = null)
+ }, e.prototype.pause = function() {
+ this._ioctl && this._ioctl.isWorking() && (this._ioctl.pause(), this._disableStatisticsReporter())
+ }, e.prototype.resume = function() {
+ this._ioctl && this._ioctl.isPaused() && (this._ioctl.resume(), this._enableStatisticsReporter())
+ }, e.prototype.seek = function(e) {
+ if (null != this._mediaInfo && this._mediaInfo.isSeekable()) {
+ var t = this._searchSegmentIndexContains(e);
+ if (t === this._currentSegmentIndex) {
+ var i = this._mediaInfo.segments[t];
+ if (null == i) this._pendingSeekTime = e;
+ else {
+ var n = i.getNearestKeyframe(e);
+ this._remuxer.seek(n.milliseconds), this._ioctl.seek(n.fileposition), this._pendingResolveSeekPoint = n.milliseconds
+ }
+ } else {
+ var r = this._mediaInfo.segments[t];
+ null == r ? (this._pendingSeekTime = e, this._internalAbort(), this._remuxer.seek(), this._remuxer.insertDiscontinuity(), this._loadSegment(t)) : (n = r.getNearestKeyframe(e), this._internalAbort(), this._remuxer.seek(e), this._remuxer.insertDiscontinuity(), this._demuxer.resetMediaInfo(), this._demuxer.timestampBase = this._mediaDataSource.segments[t].timestampBase, this._loadSegment(t, n.fileposition), this._pendingResolveSeekPoint = n.milliseconds, this._reportSegmentMediaInfo(t))
+ }
+ this._enableStatisticsReporter()
+ }
+ }, e.prototype._searchSegmentIndexContains = function(e) {
+ for (var t = this._mediaDataSource.segments, i = t.length - 1, n = 0; n < t.length; n++)
+ if (e < t[n].timestampBase) {
+ i = n - 1;
+ break
+ } return i
+ }, e.prototype._onInitChunkArrival = function(e, t) {
+ var i = this,
+ n = null,
+ r = 0;
+ if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, r = this._demuxer.parseChunks(e, t);
+ else if ((n = N.probe(e)).match) {
+ var s = this._demuxer = new N(n, this._config);
+ this._remuxer || (this._remuxer = new G(this._config)), s.onError = this._onDemuxException.bind(this), s.onMediaInfo = this._onMediaInfo.bind(this), s.onMetaDataArrived = this._onMetaDataArrived.bind(this), s.onTimedID3Metadata = this._onTimedID3Metadata.bind(this), s.onPESPrivateDataDescriptor = this._onPESPrivateDataDescriptor.bind(this), s.onPESPrivateData = this._onPESPrivateData.bind(this), this._remuxer.bindDataSource(this._demuxer), this._demuxer.bindDataSource(this._ioctl), this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this), r = this._demuxer.parseChunks(e, t)
+ } else if ((n = v.probe(e)).match) {
+ this._demuxer = new v(n, this._config), this._remuxer || (this._remuxer = new G(this._config));
+ var o = this._mediaDataSource;
+ null == o.duration || isNaN(o.duration) || (this._demuxer.overridedDuration = o.duration), "boolean" == typeof o.hasAudio && (this._demuxer.overridedHasAudio = o.hasAudio), "boolean" == typeof o.hasVideo && (this._demuxer.overridedHasVideo = o.hasVideo), this._demuxer.timestampBase = o.segments[this._currentSegmentIndex].timestampBase, this._demuxer.onError = this._onDemuxException.bind(this), this._demuxer.onMediaInfo = this._onMediaInfo.bind(this), this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this), this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this), r = this._demuxer.parseChunks(e, t)
+ } else n = null, a.a.e(this.TAG, "Non MPEG-TS/FLV, Unsupported media type!"), Promise.resolve().then((function() {
+ i._internalAbort()
+ })), this._emitter.emit(Y.a.DEMUX_ERROR, g.a.FORMAT_UNSUPPORTED, "Non MPEG-TS/FLV, Unsupported media type!"), r = 0;
+ return r
+ }, e.prototype._onMediaInfo = function(e) {
+ var t = this;
+ null == this._mediaInfo && (this._mediaInfo = Object.assign({}, e), this._mediaInfo.keyframesIndex = null, this._mediaInfo.segments = [], this._mediaInfo.segmentCount = this._mediaDataSource.segments.length, Object.setPrototypeOf(this._mediaInfo, o.a.prototype));
+ var i = Object.assign({}, e);
+ Object.setPrototypeOf(i, o.a.prototype), this._mediaInfo.segments[this._currentSegmentIndex] = i, this._reportSegmentMediaInfo(this._currentSegmentIndex), null != this._pendingSeekTime && Promise.resolve().then((function() {
+ var e = t._pendingSeekTime;
+ t._pendingSeekTime = null, t.seek(e)
+ }))
+ }, e.prototype._onMetaDataArrived = function(e) {
+ this._emitter.emit(Y.a.METADATA_ARRIVED, e)
+ }, e.prototype._onScriptDataArrived = function(e) {
+ this._emitter.emit(Y.a.SCRIPTDATA_ARRIVED, e)
+ }, e.prototype._onTimedID3Metadata = function(e) {
+ var t = this._remuxer.getTimestampBase();
+ null != t && (null != e.pts && (e.pts -= t), null != e.dts && (e.dts -= t), this._emitter.emit(Y.a.TIMED_ID3_METADATA_ARRIVED, e))
+ }, e.prototype._onPESPrivateDataDescriptor = function(e) {
+ this._emitter.emit(Y.a.PES_PRIVATE_DATA_DESCRIPTOR, e)
+ }, e.prototype._onPESPrivateData = function(e) {
+ var t = this._remuxer.getTimestampBase();
+ null != t && (null != e.pts && (e.pts -= t), null != e.nearest_pts && (e.nearest_pts -= t), null != e.dts && (e.dts -= t), this._emitter.emit(Y.a.PES_PRIVATE_DATA_ARRIVED, e))
+ }, e.prototype._onIOSeeked = function() {
+ this._remuxer.insertDiscontinuity()
+ }, e.prototype._onIOComplete = function(e) {
+ var t = e + 1;
+ t < this._mediaDataSource.segments.length ? (this._internalAbort(), this._remuxer && this._remuxer.flushStashedSamples(), this._loadSegment(t)) : (this._remuxer && this._remuxer.flushStashedSamples(), this._emitter.emit(Y.a.LOADING_COMPLETE), this._disableStatisticsReporter())
+ }, e.prototype._onIORedirect = function(e) {
+ var t = this._ioctl.extraData;
+ this._mediaDataSource.segments[t].redirectedURL = e
+ }, e.prototype._onIORecoveredEarlyEof = function() {
+ this._emitter.emit(Y.a.RECOVERED_EARLY_EOF)
+ }, e.prototype._onIOException = function(e, t) {
+ a.a.e(this.TAG, "IOException: type = " + e + ", code = " + t.code + ", msg = " + t.msg), this._emitter.emit(Y.a.IO_ERROR, e, t), this._disableStatisticsReporter()
+ }, e.prototype._onDemuxException = function(e, t) {
+ a.a.e(this.TAG, "DemuxException: type = " + e + ", info = " + t), this._emitter.emit(Y.a.DEMUX_ERROR, e, t)
+ }, e.prototype._onRemuxerInitSegmentArrival = function(e, t) {
+ this._emitter.emit(Y.a.INIT_SEGMENT, e, t)
+ }, e.prototype._onRemuxerMediaSegmentArrival = function(e, t) {
+ if (null == this._pendingSeekTime && (this._emitter.emit(Y.a.MEDIA_SEGMENT, e, t), null != this._pendingResolveSeekPoint && "video" === e)) {
+ var i = t.info.syncPoints,
+ n = this._pendingResolveSeekPoint;
+ this._pendingResolveSeekPoint = null, s.a.safari && i.length > 0 && i[0].originalDts === n && (n = i[0].pts), this._emitter.emit(Y.a.RECOMMEND_SEEKPOINT, n)
+ }
+ }, e.prototype._enableStatisticsReporter = function() {
+ null == this._statisticsReporter && (this._statisticsReporter = self.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval))
+ }, e.prototype._disableStatisticsReporter = function() {
+ this._statisticsReporter && (self.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype._reportSegmentMediaInfo = function(e) {
+ var t = this._mediaInfo.segments[e],
+ i = Object.assign({}, t);
+ i.duration = this._mediaInfo.duration, i.segmentCount = this._mediaInfo.segmentCount, delete i.segments, delete i.keyframesIndex, this._emitter.emit(Y.a.MEDIA_INFO, i)
+ }, e.prototype._reportStatisticsInfo = function() {
+ var e = {};
+ e.url = this._ioctl.currentURL, e.hasRedirect = this._ioctl.hasRedirect, e.hasRedirect && (e.redirectedURL = this._ioctl.currentRedirectedURL), e.speed = this._ioctl.currentSpeed, e.loaderType = this._ioctl.loaderType, e.currentSegmentIndex = this._currentSegmentIndex, e.totalSegmentCount = this._mediaDataSource.segments.length, this._emitter.emit(Y.a.STATISTICS_INFO, e)
+ }, e
+ }();
+ t.a = q
+ }, function(e, t, i) {
+ "use strict";
+ var n, r = i(0),
+ a = function() {
+ function e() {
+ this._firstCheckpoint = 0, this._lastCheckpoint = 0, this._intervalBytes = 0, this._totalBytes = 0, this._lastSecondBytes = 0, self.performance && self.performance.now ? this._now = self.performance.now.bind(self.performance) : this._now = Date.now
+ }
+ return e.prototype.reset = function() {
+ this._firstCheckpoint = this._lastCheckpoint = 0, this._totalBytes = this._intervalBytes = 0, this._lastSecondBytes = 0
+ }, e.prototype.addBytes = function(e) {
+ 0 === this._firstCheckpoint ? (this._firstCheckpoint = this._now(), this._lastCheckpoint = this._firstCheckpoint, this._intervalBytes += e, this._totalBytes += e) : this._now() - this._lastCheckpoint < 1e3 ? (this._intervalBytes += e, this._totalBytes += e) : (this._lastSecondBytes = this._intervalBytes, this._intervalBytes = e, this._totalBytes += e, this._lastCheckpoint = this._now())
+ }, Object.defineProperty(e.prototype, "currentKBps", {
+ get: function() {
+ this.addBytes(0);
+ var e = (this._now() - this._lastCheckpoint) / 1e3;
+ return 0 == e && (e = 1), this._intervalBytes / e / 1024
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "lastSecondKBps", {
+ get: function() {
+ return this.addBytes(0), 0 !== this._lastSecondBytes ? this._lastSecondBytes / 1024 : this._now() - this._lastCheckpoint >= 500 ? this.currentKBps : 0
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "averageKBps", {
+ get: function() {
+ var e = (this._now() - this._firstCheckpoint) / 1e3;
+ return this._totalBytes / e / 1024
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e
+ }(),
+ s = i(2),
+ o = i(4),
+ u = i(3),
+ l = (n = function(e, t) {
+ return (n = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ function i() {
+ this.constructor = e
+ }
+ n(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ h = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "fetch-stream-loader") || this;
+ return n.TAG = "FetchStreamLoader", n._seekHandler = t, n._config = i, n._needStash = !0, n._requestAbort = !1, n._abortController = null, n._contentLength = null, n._receivedLength = 0, n
+ }
+ return l(t, e), t.isSupported = function() {
+ try {
+ var e = o.a.msedge && o.a.version.minor >= 15048,
+ t = !o.a.msedge || e;
+ return self.fetch && self.ReadableStream && t
+ } catch (e) {
+ return !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e, t) {
+ var i = this;
+ this._dataSource = e, this._range = t;
+ var n = e.url;
+ this._config.reuseRedirectedURL && null != e.redirectedURL && (n = e.redirectedURL);
+ var r = this._seekHandler.getConfig(n, t),
+ a = new self.Headers;
+ if ("object" == typeof r.headers) {
+ var o = r.headers;
+ for (var l in o) o.hasOwnProperty(l) && a.append(l, o[l])
+ }
+ var h = {
+ method: "GET",
+ headers: a,
+ mode: "cors",
+ cache: "default",
+ referrerPolicy: "no-referrer-when-downgrade"
+ };
+ if ("object" == typeof this._config.headers)
+ for (var l in this._config.headers) a.append(l, this._config.headers[l]);
+ !1 === e.cors && (h.mode = "same-origin"), e.withCredentials && (h.credentials = "include"), e.referrerPolicy && (h.referrerPolicy = e.referrerPolicy), self.AbortController && (this._abortController = new self.AbortController, h.signal = this._abortController.signal), this._status = s.c.kConnecting, self.fetch(r.url, h).then((function(e) {
+ if (i._requestAbort) return i._status = s.c.kIdle, void e.body.cancel();
+ if (e.ok && e.status >= 200 && e.status <= 299) {
+ if (e.url !== r.url && i._onURLRedirect) {
+ var t = i._seekHandler.removeURLParameters(e.url);
+ i._onURLRedirect(t)
+ }
+ var n = e.headers.get("Content-Length");
+ return null != n && (i._contentLength = parseInt(n), 0 !== i._contentLength && i._onContentLengthKnown && i._onContentLengthKnown(i._contentLength)), i._pump.call(i, e.body.getReader())
+ }
+ if (i._status = s.c.kError, !i._onError) throw new u.d("FetchStreamLoader: Http code invalid, " + e.status + " " + e.statusText);
+ i._onError(s.b.HTTP_STATUS_CODE_INVALID, {
+ code: e.status,
+ msg: e.statusText
+ })
+ })).catch((function(e) {
+ if (!i._abortController || !i._abortController.signal.aborted) {
+ if (i._status = s.c.kError, !i._onError) throw e;
+ i._onError(s.b.EXCEPTION, {
+ code: -1,
+ msg: e.message
+ })
+ }
+ }))
+ }, t.prototype.abort = function() {
+ if (this._requestAbort = !0, (this._status !== s.c.kBuffering || !o.a.chrome) && this._abortController) try {
+ this._abortController.abort()
+ } catch (e) {}
+ }, t.prototype._pump = function(e) {
+ var t = this;
+ return e.read().then((function(i) {
+ if (i.done)
+ if (null !== t._contentLength && t._receivedLength < t._contentLength) {
+ t._status = s.c.kError;
+ var n = s.b.EARLY_EOF,
+ r = {
+ code: -1,
+ msg: "Fetch stream meet Early-EOF"
+ };
+ if (!t._onError) throw new u.d(r.msg);
+ t._onError(n, r)
+ } else t._status = s.c.kComplete, t._onComplete && t._onComplete(t._range.from, t._range.from + t._receivedLength - 1);
+ else {
+ if (t._abortController && t._abortController.signal.aborted) return void(t._status = s.c.kComplete);
+ if (!0 === t._requestAbort) return t._status = s.c.kComplete, e.cancel();
+ t._status = s.c.kBuffering;
+ var a = i.value.buffer,
+ o = t._range.from + t._receivedLength;
+ t._receivedLength += a.byteLength, t._onDataArrival && t._onDataArrival(a, o, t._receivedLength), t._pump(e)
+ }
+ })).catch((function(e) {
+ if (t._abortController && t._abortController.signal.aborted) t._status = s.c.kComplete;
+ else if (11 !== e.code || !o.a.msedge) {
+ t._status = s.c.kError;
+ var i = 0,
+ n = null;
+ if (19 !== e.code && "network error" !== e.message || !(null === t._contentLength || null !== t._contentLength && t._receivedLength < t._contentLength) ? (i = s.b.EXCEPTION, n = {
+ code: e.code,
+ msg: e.message
+ }) : (i = s.b.EARLY_EOF, n = {
+ code: e.code,
+ msg: "Fetch stream meet Early-EOF"
+ }), !t._onError) throw new u.d(n.msg);
+ t._onError(i, n)
+ }
+ }))
+ }, t
+ }(s.a),
+ d = function() {
+ var e = function(t, i) {
+ return (e = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(t, i)
+ };
+ return function(t, i) {
+ function n() {
+ this.constructor = t
+ }
+ e(t, i), t.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n)
+ }
+ }(),
+ c = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "xhr-moz-chunked-loader") || this;
+ return n.TAG = "MozChunkedLoader", n._seekHandler = t, n._config = i, n._needStash = !0, n._xhr = null, n._requestAbort = !1, n._contentLength = null, n._receivedLength = 0, n
+ }
+ return d(t, e), t.isSupported = function() {
+ try {
+ var e = new XMLHttpRequest;
+ return e.open("GET", "https://example.com", !0), e.responseType = "moz-chunked-arraybuffer", "moz-chunked-arraybuffer" === e.responseType
+ } catch (e) {
+ return r.a.w("MozChunkedLoader", e.message), !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onloadend = null, this._xhr.onerror = null, this._xhr = null), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e, t) {
+ this._dataSource = e, this._range = t;
+ var i = e.url;
+ this._config.reuseRedirectedURL && null != e.redirectedURL && (i = e.redirectedURL);
+ var n = this._seekHandler.getConfig(i, t);
+ this._requestURL = n.url;
+ var r = this._xhr = new XMLHttpRequest;
+ if (r.open("GET", n.url, !0), r.responseType = "moz-chunked-arraybuffer", r.onreadystatechange = this._onReadyStateChange.bind(this), r.onprogress = this._onProgress.bind(this), r.onloadend = this._onLoadEnd.bind(this), r.onerror = this._onXhrError.bind(this), e.withCredentials && (r.withCredentials = !0), "object" == typeof n.headers) {
+ var a = n.headers;
+ for (var o in a) a.hasOwnProperty(o) && r.setRequestHeader(o, a[o])
+ }
+ if ("object" == typeof this._config.headers)
+ for (var o in a = this._config.headers) a.hasOwnProperty(o) && r.setRequestHeader(o, a[o]);
+ this._status = s.c.kConnecting, r.send()
+ }, t.prototype.abort = function() {
+ this._requestAbort = !0, this._xhr && this._xhr.abort(), this._status = s.c.kComplete
+ }, t.prototype._onReadyStateChange = function(e) {
+ var t = e.target;
+ if (2 === t.readyState) {
+ if (null != t.responseURL && t.responseURL !== this._requestURL && this._onURLRedirect) {
+ var i = this._seekHandler.removeURLParameters(t.responseURL);
+ this._onURLRedirect(i)
+ }
+ if (0 !== t.status && (t.status < 200 || t.status > 299)) {
+ if (this._status = s.c.kError, !this._onError) throw new u.d("MozChunkedLoader: Http code invalid, " + t.status + " " + t.statusText);
+ this._onError(s.b.HTTP_STATUS_CODE_INVALID, {
+ code: t.status,
+ msg: t.statusText
+ })
+ } else this._status = s.c.kBuffering
+ }
+ }, t.prototype._onProgress = function(e) {
+ if (this._status !== s.c.kError) {
+ null === this._contentLength && null !== e.total && 0 !== e.total && (this._contentLength = e.total, this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength));
+ var t = e.target.response,
+ i = this._range.from + this._receivedLength;
+ this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this._receivedLength)
+ }
+ }, t.prototype._onLoadEnd = function(e) {
+ !0 !== this._requestAbort ? this._status !== s.c.kError && (this._status = s.c.kComplete, this._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1)) : this._requestAbort = !1
+ }, t.prototype._onXhrError = function(e) {
+ this._status = s.c.kError;
+ var t = 0,
+ i = null;
+ if (this._contentLength && e.loaded < this._contentLength ? (t = s.b.EARLY_EOF, i = {
+ code: -1,
+ msg: "Moz-Chunked stream meet Early-Eof"
+ }) : (t = s.b.EXCEPTION, i = {
+ code: -1,
+ msg: e.constructor.name + " " + e.type
+ }), !this._onError) throw new u.d(i.msg);
+ this._onError(t, i)
+ }, t
+ }(s.a),
+ f = function() {
+ var e = function(t, i) {
+ return (e = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(t, i)
+ };
+ return function(t, i) {
+ function n() {
+ this.constructor = t
+ }
+ e(t, i), t.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n)
+ }
+ }(),
+ p = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "xhr-range-loader") || this;
+ return n.TAG = "RangeLoader", n._seekHandler = t, n._config = i, n._needStash = !1, n._chunkSizeKBList = [128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 5120, 6144, 7168, 8192], n._currentChunkSizeKB = 384, n._currentSpeedNormalized = 0, n._zeroSpeedChunkCount = 0, n._xhr = null, n._speedSampler = new a, n._requestAbort = !1, n._waitForTotalLength = !1, n._totalLengthReceived = !1, n._currentRequestURL = null, n._currentRedirectedURL = null, n._currentRequestRange = null, n._totalLength = null, n._contentLength = null, n._receivedLength = 0, n._lastTimeLoaded = 0, n
+ }
+ return f(t, e), t.isSupported = function() {
+ try {
+ var e = new XMLHttpRequest;
+ return e.open("GET", "https://example.com", !0), e.responseType = "arraybuffer", "arraybuffer" === e.responseType
+ } catch (e) {
+ return r.a.w("RangeLoader", e.message), !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr = null), e.prototype.destroy.call(this)
+ }, Object.defineProperty(t.prototype, "currentSpeed", {
+ get: function() {
+ return this._speedSampler.lastSecondKBps
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t.prototype.open = function(e, t) {
+ this._dataSource = e, this._range = t, this._status = s.c.kConnecting;
+ var i = !1;
+ null != this._dataSource.filesize && 0 !== this._dataSource.filesize && (i = !0, this._totalLength = this._dataSource.filesize), this._totalLengthReceived || i ? this._openSubRange() : (this._waitForTotalLength = !0, this._internalOpen(this._dataSource, {
+ from: 0,
+ to: -1
+ }))
+ }, t.prototype._openSubRange = function() {
+ var e = 1024 * this._currentChunkSizeKB,
+ t = this._range.from + this._receivedLength,
+ i = t + e;
+ null != this._contentLength && i - this._range.from >= this._contentLength && (i = this._range.from + this._contentLength - 1), this._currentRequestRange = {
+ from: t,
+ to: i
+ }, this._internalOpen(this._dataSource, this._currentRequestRange)
+ }, t.prototype._internalOpen = function(e, t) {
+ this._lastTimeLoaded = 0;
+ var i = e.url;
+ this._config.reuseRedirectedURL && (null != this._currentRedirectedURL ? i = this._currentRedirectedURL : null != e.redirectedURL && (i = e.redirectedURL));
+ var n = this._seekHandler.getConfig(i, t);
+ this._currentRequestURL = n.url;
+ var r = this._xhr = new XMLHttpRequest;
+ if (r.open("GET", n.url, !0), r.responseType = "arraybuffer", r.onreadystatechange = this._onReadyStateChange.bind(this), r.onprogress = this._onProgress.bind(this), r.onload = this._onLoad.bind(this), r.onerror = this._onXhrError.bind(this), e.withCredentials && (r.withCredentials = !0), "object" == typeof n.headers) {
+ var a = n.headers;
+ for (var s in a) a.hasOwnProperty(s) && r.setRequestHeader(s, a[s])
+ }
+ if ("object" == typeof this._config.headers)
+ for (var s in a = this._config.headers) a.hasOwnProperty(s) && r.setRequestHeader(s, a[s]);
+ r.send()
+ }, t.prototype.abort = function() {
+ this._requestAbort = !0, this._internalAbort(), this._status = s.c.kComplete
+ }, t.prototype._internalAbort = function() {
+ this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr.abort(), this._xhr = null)
+ }, t.prototype._onReadyStateChange = function(e) {
+ var t = e.target;
+ if (2 === t.readyState) {
+ if (null != t.responseURL) {
+ var i = this._seekHandler.removeURLParameters(t.responseURL);
+ t.responseURL !== this._currentRequestURL && i !== this._currentRedirectedURL && (this._currentRedirectedURL = i, this._onURLRedirect && this._onURLRedirect(i))
+ }
+ if (t.status >= 200 && t.status <= 299) {
+ if (this._waitForTotalLength) return;
+ this._status = s.c.kBuffering
+ } else {
+ if (this._status = s.c.kError, !this._onError) throw new u.d("RangeLoader: Http code invalid, " + t.status + " " + t.statusText);
+ this._onError(s.b.HTTP_STATUS_CODE_INVALID, {
+ code: t.status,
+ msg: t.statusText
+ })
+ }
+ }
+ }, t.prototype._onProgress = function(e) {
+ if (this._status !== s.c.kError) {
+ if (null === this._contentLength) {
+ var t = !1;
+ if (this._waitForTotalLength) {
+ this._waitForTotalLength = !1, this._totalLengthReceived = !0, t = !0;
+ var i = e.total;
+ this._internalAbort(), null != i & 0 !== i && (this._totalLength = i)
+ }
+ if (-1 === this._range.to ? this._contentLength = this._totalLength - this._range.from : this._contentLength = this._range.to - this._range.from + 1, t) return void this._openSubRange();
+ this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength)
+ }
+ var n = e.loaded - this._lastTimeLoaded;
+ this._lastTimeLoaded = e.loaded, this._speedSampler.addBytes(n)
+ }
+ }, t.prototype._normalizeSpeed = function(e) {
+ var t = this._chunkSizeKBList,
+ i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i;
+ if (e < t[0]) return t[0];
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e >= t[n] && e < t[n + 1]) return t[n];
+ t[n] < e ? r = n + 1 : a = n - 1
+ }
+ }, t.prototype._onLoad = function(e) {
+ if (this._status !== s.c.kError)
+ if (this._waitForTotalLength) this._waitForTotalLength = !1;
+ else {
+ this._lastTimeLoaded = 0;
+ var t = this._speedSampler.lastSecondKBps;
+ if (0 === t && (this._zeroSpeedChunkCount++, this._zeroSpeedChunkCount >= 3 && (t = this._speedSampler.currentKBps)), 0 !== t) {
+ var i = this._normalizeSpeed(t);
+ this._currentSpeedNormalized !== i && (this._currentSpeedNormalized = i, this._currentChunkSizeKB = i)
+ }
+ var n = e.target.response,
+ r = this._range.from + this._receivedLength;
+ this._receivedLength += n.byteLength;
+ var a = !1;
+ null != this._contentLength && this._receivedLength < this._contentLength ? this._openSubRange() : a = !0, this._onDataArrival && this._onDataArrival(n, r, this._receivedLength), a && (this._status = s.c.kComplete, this._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1))
+ }
+ }, t.prototype._onXhrError = function(e) {
+ this._status = s.c.kError;
+ var t = 0,
+ i = null;
+ if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength ? (t = s.b.EARLY_EOF, i = {
+ code: -1,
+ msg: "RangeLoader meet Early-Eof"
+ }) : (t = s.b.EXCEPTION, i = {
+ code: -1,
+ msg: e.constructor.name + " " + e.type
+ }), !this._onError) throw new u.d(i.msg);
+ this._onError(t, i)
+ }, t
+ }(s.a),
+ m = function() {
+ var e = function(t, i) {
+ return (e = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i])
+ })(t, i)
+ };
+ return function(t, i) {
+ function n() {
+ this.constructor = t
+ }
+ e(t, i), t.prototype = null === i ? Object.create(i) : (n.prototype = i.prototype, new n)
+ }
+ }(),
+ _ = function(e) {
+ function t() {
+ var t = e.call(this, "websocket-loader") || this;
+ return t.TAG = "WebSocketLoader", t._needStash = !0, t._ws = null, t._requestAbort = !1, t._receivedLength = 0, t
+ }
+ return m(t, e), t.isSupported = function() {
+ try {
+ return void 0 !== self.WebSocket
+ } catch (e) {
+ return !1
+ }
+ }, t.prototype.destroy = function() {
+ this._ws && this.abort(), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e) {
+ try {
+ var t = this._ws = new self.WebSocket(e.url);
+ t.binaryType = "arraybuffer", t.onopen = this._onWebSocketOpen.bind(this), t.onclose = this._onWebSocketClose.bind(this), t.onmessage = this._onWebSocketMessage.bind(this), t.onerror = this._onWebSocketError.bind(this), this._status = s.c.kConnecting
+ } catch (e) {
+ this._status = s.c.kError;
+ var i = {
+ code: e.code,
+ msg: e.message
+ };
+ if (!this._onError) throw new u.d(i.msg);
+ this._onError(s.b.EXCEPTION, i)
+ }
+ }, t.prototype.abort = function() {
+ var e = this._ws;
+ !e || 0 !== e.readyState && 1 !== e.readyState || (this._requestAbort = !0, e.close()), this._ws = null, this._status = s.c.kComplete
+ }, t.prototype._onWebSocketOpen = function(e) {
+ this._status = s.c.kBuffering
+ }, t.prototype._onWebSocketClose = function(e) {
+ !0 !== this._requestAbort ? (this._status = s.c.kComplete, this._onComplete && this._onComplete(0, this._receivedLength - 1)) : this._requestAbort = !1
+ }, t.prototype._onWebSocketMessage = function(e) {
+ var t = this;
+ if (e.data instanceof ArrayBuffer) this._dispatchArrayBuffer(e.data);
+ else if (e.data instanceof Blob) {
+ var i = new FileReader;
+ i.onload = function() {
+ t._dispatchArrayBuffer(i.result)
+ }, i.readAsArrayBuffer(e.data)
+ } else {
+ this._status = s.c.kError;
+ var n = {
+ code: -1,
+ msg: "Unsupported WebSocket message type: " + e.data.constructor.name
+ };
+ if (!this._onError) throw new u.d(n.msg);
+ this._onError(s.b.EXCEPTION, n)
+ }
+ }, t.prototype._dispatchArrayBuffer = function(e) {
+ var t = e,
+ i = this._receivedLength;
+ this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this._receivedLength)
+ }, t.prototype._onWebSocketError = function(e) {
+ this._status = s.c.kError;
+ var t = {
+ code: e.code,
+ msg: e.message
+ };
+ if (!this._onError) throw new u.d(t.msg);
+ this._onError(s.b.EXCEPTION, t)
+ }, t
+ }(s.a),
+ g = function() {
+ function e(e) {
+ this._zeroStart = e || !1
+ }
+ return e.prototype.getConfig = function(e, t) {
+ var i, n = {};
+ 0 !== t.from || -1 !== t.to ? (i = -1 !== t.to ? "bytes=" + t.from.toString() + "-" + t.to.toString() : "bytes=" + t.from.toString() + "-", n.Range = i) : this._zeroStart && (n.Range = "bytes=0-");
+ return {
+ url: e,
+ headers: n
+ }
+ }, e.prototype.removeURLParameters = function(e) {
+ return e
+ }, e
+ }(),
+ v = function() {
+ function e(e, t) {
+ this._startName = e, this._endName = t
+ }
+ return e.prototype.getConfig = function(e, t) {
+ var i = e;
+ if (0 !== t.from || -1 !== t.to) {
+ var n = !0; - 1 === i.indexOf("?") && (i += "?", n = !1), n && (i += "&"), i += this._startName + "=" + t.from.toString(), -1 !== t.to && (i += "&" + this._endName + "=" + t.to.toString())
+ }
+ return {
+ url: i,
+ headers: {}
+ }
+ }, e.prototype.removeURLParameters = function(e) {
+ var t = e.split("?")[0],
+ i = void 0,
+ n = e.indexOf("?"); - 1 !== n && (i = e.substring(n + 1));
+ var r = "";
+ if (null != i && i.length > 0)
+ for (var a = i.split("&"), s = 0; s < a.length; s++) {
+ var o = a[s].split("="),
+ u = s > 0;
+ o[0] !== this._startName && o[0] !== this._endName && (u && (r += "&"), r += a[s])
+ }
+ return 0 === r.length ? t : t + "?" + r
+ }, e
+ }(),
+ y = function() {
+ function e(e, t, i) {
+ this.TAG = "IOController", this._config = t, this._extraData = i, this._stashInitialSize = 65536, null != t.stashInitialSize && t.stashInitialSize > 0 && (this._stashInitialSize = t.stashInitialSize), this._stashUsed = 0, this._stashSize = this._stashInitialSize, this._bufferSize = 3145728, this._stashBuffer = new ArrayBuffer(this._bufferSize), this._stashByteStart = 0, this._enableStash = !0, !1 === t.enableStashBuffer && (this._enableStash = !1), this._loader = null, this._loaderClass = null, this._seekHandler = null, this._dataSource = e, this._isWebSocketURL = /wss?:\/\/(.+?)/.test(e.url), this._refTotalLength = e.filesize ? e.filesize : null, this._totalLength = this._refTotalLength, this._fullRequestFlag = !1, this._currentRange = null, this._redirectedURL = null, this._speedNormalized = 0, this._speedSampler = new a, this._speedNormalizeList = [32, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096], this._isEarlyEofReconnecting = !1, this._paused = !1, this._resumeFrom = 0, this._onDataArrival = null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this._onRecoveredEarlyEof = null, this._selectSeekHandler(), this._selectLoader(), this._createLoader()
+ }
+ return e.prototype.destroy = function() {
+ this._loader.isWorking() && this._loader.abort(), this._loader.destroy(), this._loader = null, this._loaderClass = null, this._dataSource = null, this._stashBuffer = null, this._stashUsed = this._stashSize = this._bufferSize = this._stashByteStart = 0, this._currentRange = null, this._speedSampler = null, this._isEarlyEofReconnecting = !1, this._onDataArrival = null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this._onRecoveredEarlyEof = null, this._extraData = null
+ }, e.prototype.isWorking = function() {
+ return this._loader && this._loader.isWorking() && !this._paused
+ }, e.prototype.isPaused = function() {
+ return this._paused
+ }, Object.defineProperty(e.prototype, "status", {
+ get: function() {
+ return this._loader.status
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "extraData", {
+ get: function() {
+ return this._extraData
+ },
+ set: function(e) {
+ this._extraData = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataArrival", {
+ get: function() {
+ return this._onDataArrival
+ },
+ set: function(e) {
+ this._onDataArrival = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onSeeked", {
+ get: function() {
+ return this._onSeeked
+ },
+ set: function(e) {
+ this._onSeeked = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onComplete", {
+ get: function() {
+ return this._onComplete
+ },
+ set: function(e) {
+ this._onComplete = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onRedirect", {
+ get: function() {
+ return this._onRedirect
+ },
+ set: function(e) {
+ this._onRedirect = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onRecoveredEarlyEof", {
+ get: function() {
+ return this._onRecoveredEarlyEof
+ },
+ set: function(e) {
+ this._onRecoveredEarlyEof = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentURL", {
+ get: function() {
+ return this._dataSource.url
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "hasRedirect", {
+ get: function() {
+ return null != this._redirectedURL || null != this._dataSource.redirectedURL
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentRedirectedURL", {
+ get: function() {
+ return this._redirectedURL || this._dataSource.redirectedURL
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentSpeed", {
+ get: function() {
+ return this._loaderClass === p ? this._loader.currentSpeed : this._speedSampler.lastSecondKBps
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "loaderType", {
+ get: function() {
+ return this._loader.type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._selectSeekHandler = function() {
+ var e = this._config;
+ if ("range" === e.seekType) this._seekHandler = new g(this._config.rangeLoadZeroStart);
+ else if ("param" === e.seekType) {
+ var t = e.seekParamStart || "bstart",
+ i = e.seekParamEnd || "bend";
+ this._seekHandler = new v(t, i)
+ } else {
+ if ("custom" !== e.seekType) throw new u.b("Invalid seekType in config: " + e.seekType);
+ if ("function" != typeof e.customSeekHandler) throw new u.b("Custom seekType specified in config but invalid customSeekHandler!");
+ this._seekHandler = new e.customSeekHandler
+ }
+ }, e.prototype._selectLoader = function() {
+ if (null != this._config.customLoader) this._loaderClass = this._config.customLoader;
+ else if (this._isWebSocketURL) this._loaderClass = _;
+ else if (h.isSupported()) this._loaderClass = h;
+ else if (c.isSupported()) this._loaderClass = c;
+ else {
+ if (!p.isSupported()) throw new u.d("Your browser doesn't support xhr with arraybuffer responseType!");
+ this._loaderClass = p
+ }
+ }, e.prototype._createLoader = function() {
+ this._loader = new this._loaderClass(this._seekHandler, this._config), !1 === this._loader.needStashBuffer && (this._enableStash = !1), this._loader.onContentLengthKnown = this._onContentLengthKnown.bind(this), this._loader.onURLRedirect = this._onURLRedirect.bind(this), this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this), this._loader.onComplete = this._onLoaderComplete.bind(this), this._loader.onError = this._onLoaderError.bind(this)
+ }, e.prototype.open = function(e) {
+ this._currentRange = {
+ from: 0,
+ to: -1
+ }, e && (this._currentRange.from = e), this._speedSampler.reset(), e || (this._fullRequestFlag = !0), this._loader.open(this._dataSource, Object.assign({}, this._currentRange))
+ }, e.prototype.abort = function() {
+ this._loader.abort(), this._paused && (this._paused = !1, this._resumeFrom = 0)
+ }, e.prototype.pause = function() {
+ this.isWorking() && (this._loader.abort(), 0 !== this._stashUsed ? (this._resumeFrom = this._stashByteStart, this._currentRange.to = this._stashByteStart - 1) : this._resumeFrom = this._currentRange.to + 1, this._stashUsed = 0, this._stashByteStart = 0, this._paused = !0)
+ }, e.prototype.resume = function() {
+ if (this._paused) {
+ this._paused = !1;
+ var e = this._resumeFrom;
+ this._resumeFrom = 0, this._internalSeek(e, !0)
+ }
+ }, e.prototype.seek = function(e) {
+ this._paused = !1, this._stashUsed = 0, this._stashByteStart = 0, this._internalSeek(e, !0)
+ }, e.prototype._internalSeek = function(e, t) {
+ this._loader.isWorking() && this._loader.abort(), this._flushStashBuffer(t), this._loader.destroy(), this._loader = null;
+ var i = {
+ from: e,
+ to: -1
+ };
+ this._currentRange = {
+ from: i.from,
+ to: -1
+ }, this._speedSampler.reset(), this._stashSize = this._stashInitialSize, this._createLoader(), this._loader.open(this._dataSource, i), this._onSeeked && this._onSeeked()
+ }, e.prototype.updateUrl = function(e) {
+ if (!e || "string" != typeof e || 0 === e.length) throw new u.b("Url must be a non-empty string!");
+ this._dataSource.url = e
+ }, e.prototype._expandBuffer = function(e) {
+ for (var t = this._stashSize; t + 1048576 < e;) t *= 2;
+ if ((t += 1048576) !== this._bufferSize) {
+ var i = new ArrayBuffer(t);
+ if (this._stashUsed > 0) {
+ var n = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
+ new Uint8Array(i, 0, t).set(n, 0)
+ }
+ this._stashBuffer = i, this._bufferSize = t
+ }
+ }, e.prototype._normalizeSpeed = function(e) {
+ var t = this._speedNormalizeList,
+ i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i;
+ if (e < t[0]) return t[0];
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e >= t[n] && e < t[n + 1]) return t[n];
+ t[n] < e ? r = n + 1 : a = n - 1
+ }
+ }, e.prototype._adjustStashSize = function(e) {
+ var t = 0;
+ (t = this._config.isLive ? e / 8 : e < 512 ? e : e >= 512 && e <= 1024 ? Math.floor(1.5 * e) : 2 * e) > 8192 && (t = 8192);
+ var i = 1024 * t + 1048576;
+ this._bufferSize < i && this._expandBuffer(i), this._stashSize = 1024 * t
+ }, e.prototype._dispatchChunks = function(e, t) {
+ return this._currentRange.to = t + e.byteLength - 1, this._onDataArrival(e, t)
+ }, e.prototype._onURLRedirect = function(e) {
+ this._redirectedURL = e, this._onRedirect && this._onRedirect(e)
+ }, e.prototype._onContentLengthKnown = function(e) {
+ e && this._fullRequestFlag && (this._totalLength = e, this._fullRequestFlag = !1)
+ }, e.prototype._onLoaderChunkArrival = function(e, t, i) {
+ if (!this._onDataArrival) throw new u.a("IOController: No existing consumer (onDataArrival) callback!");
+ if (!this._paused) {
+ this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, this._onRecoveredEarlyEof && this._onRecoveredEarlyEof()), this._speedSampler.addBytes(e.byteLength);
+ var n = this._speedSampler.lastSecondKBps;
+ if (0 !== n) {
+ var r = this._normalizeSpeed(n);
+ this._speedNormalized !== r && (this._speedNormalized = r, this._adjustStashSize(r))
+ }
+ if (this._enableStash)
+ if (0 === this._stashUsed && 0 === this._stashByteStart && (this._stashByteStart = t), this._stashUsed + e.byteLength <= this._stashSize)(o = new Uint8Array(this._stashBuffer, 0, this._stashSize)).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength;
+ else if (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize), this._stashUsed > 0) {
+ var a = this._stashBuffer.slice(0, this._stashUsed);
+ (l = this._dispatchChunks(a, this._stashByteStart)) < a.byteLength ? l > 0 && (h = new Uint8Array(a, l), o.set(h, 0), this._stashUsed = h.byteLength, this._stashByteStart += l) : (this._stashUsed = 0, this._stashByteStart += l), this._stashUsed + e.byteLength > this._bufferSize && (this._expandBuffer(this._stashUsed + e.byteLength), o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), o.set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength
+ } else(l = this._dispatchChunks(e, t)) < e.byteLength && ((s = e.byteLength - l) > this._bufferSize && (this._expandBuffer(s), o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), o.set(new Uint8Array(e, l), 0), this._stashUsed += s, this._stashByteStart = t + l);
+ else if (0 === this._stashUsed) {
+ var s;
+ (l = this._dispatchChunks(e, t)) < e.byteLength && ((s = e.byteLength - l) > this._bufferSize && this._expandBuffer(s), (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)).set(new Uint8Array(e, l), 0), this._stashUsed += s, this._stashByteStart = t + l)
+ } else {
+ var o, l;
+ if (this._stashUsed + e.byteLength > this._bufferSize && this._expandBuffer(this._stashUsed + e.byteLength), (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength, (l = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart)) < this._stashUsed && l > 0) {
+ var h = new Uint8Array(this._stashBuffer, l);
+ o.set(h, 0)
+ }
+ this._stashUsed -= l, this._stashByteStart += l
+ }
+ }
+ }, e.prototype._flushStashBuffer = function(e) {
+ if (this._stashUsed > 0) {
+ var t = this._stashBuffer.slice(0, this._stashUsed),
+ i = this._dispatchChunks(t, this._stashByteStart),
+ n = t.byteLength - i;
+ if (i < t.byteLength) {
+ if (!e) {
+ if (i > 0) {
+ var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize),
+ s = new Uint8Array(t, i);
+ a.set(s, 0), this._stashUsed = s.byteLength, this._stashByteStart += i
+ }
+ return 0
+ }
+ r.a.w(this.TAG, n + " bytes unconsumed data remain when flush buffer, dropped")
+ }
+ return this._stashUsed = 0, this._stashByteStart = 0, n
+ }
+ return 0
+ }, e.prototype._onLoaderComplete = function(e, t) {
+ this._flushStashBuffer(!0), this._onComplete && this._onComplete(this._extraData)
+ }, e.prototype._onLoaderError = function(e, t) {
+ switch (r.a.e(this.TAG, "Loader error, code = " + t.code + ", msg = " + t.msg), this._flushStashBuffer(!1), this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, e = s.b.UNRECOVERABLE_EARLY_EOF), e) {
+ case s.b.EARLY_EOF:
+ if (!this._config.isLive && this._totalLength) {
+ var i = this._currentRange.to + 1;
+ return void(i < this._totalLength && (r.a.w(this.TAG, "Connection lost, trying reconnect..."), this._isEarlyEofReconnecting = !0, this._internalSeek(i, !1)))
+ }
+ e = s.b.UNRECOVERABLE_EARLY_EOF;
+ break;
+ case s.b.UNRECOVERABLE_EARLY_EOF:
+ case s.b.CONNECTING_TIMEOUT:
+ case s.b.HTTP_STATUS_CODE_INVALID:
+ case s.b.EXCEPTION:
+ }
+ if (!this._onError) throw new u.d("IOException: " + t.msg);
+ this._onError(e, t)
+ }, e
+ }();
+ t.a = y
+ }, function(e, t, i) {
+ "use strict";
+ var n = function() {
+ function e() {}
+ return e.install = function() {
+ Object.setPrototypeOf = Object.setPrototypeOf || function(e, t) {
+ return e.__proto__ = t, e
+ }, Object.assign = Object.assign || function(e) {
+ if (null == e) throw new TypeError("Cannot convert undefined or null to object");
+ for (var t = Object(e), i = 1; i < arguments.length; i++) {
+ var n = arguments[i];
+ if (null != n)
+ for (var r in n) n.hasOwnProperty(r) && (t[r] = n[r])
+ }
+ return t
+ }, "function" != typeof self.Promise && i(15).polyfill()
+ }, e
+ }();
+ n.install(), t.a = n
+ }, function(e, t, i) {
+ function n(e) {
+ var t = {};
+
+ function i(n) {
+ if (t[n]) return t[n].exports;
+ var r = t[n] = {
+ i: n,
+ l: !1,
+ exports: {}
+ };
+ return e[n].call(r.exports, r, r.exports, i), r.l = !0, r.exports
+ }
+ i.m = e, i.c = t, i.i = function(e) {
+ return e
+ }, i.d = function(e, t, n) {
+ i.o(e, t) || Object.defineProperty(e, t, {
+ configurable: !1,
+ enumerable: !0,
+ get: n
+ })
+ }, i.r = function(e) {
+ Object.defineProperty(e, "__esModule", {
+ value: !0
+ })
+ }, i.n = function(e) {
+ var t = e && e.__esModule ? function() {
+ return e.default
+ } : function() {
+ return e
+ };
+ return i.d(t, "a", t), t
+ }, i.o = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }, i.p = "/", i.oe = function(e) {
+ throw console.error(e), e
+ };
+ var n = i(i.s = ENTRY_MODULE);
+ return n.default || n
+ }
+
+ function r(e) {
+ return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
+ }
+
+ function a(e, t, n) {
+ var a = {};
+ a[n] = [];
+ var s = t.toString(),
+ o = s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
+ if (!o) return a;
+ for (var u, l = o[1], h = new RegExp("(\\\\n|\\W)" + r(l) + "\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)", "g"); u = h.exec(s);) "dll-reference" !== u[3] && a[n].push(u[3]);
+ for (h = new RegExp("\\(" + r(l) + '\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)', "g"); u = h.exec(s);) e[u[2]] || (a[n].push(u[1]), e[u[2]] = i(u[1]).m), a[u[2]] = a[u[2]] || [], a[u[2]].push(u[4]);
+ for (var d, c = Object.keys(a), f = 0; f < c.length; f++)
+ for (var p = 0; p < a[c[f]].length; p++) d = a[c[f]][p], isNaN(1 * d) || (a[c[f]][p] = 1 * a[c[f]][p]);
+ return a
+ }
+
+ function s(e) {
+ return Object.keys(e).reduce((function(t, i) {
+ return t || e[i].length > 0
+ }), !1)
+ }
+ e.exports = function(e, t) {
+ t = t || {};
+ var r = {
+ main: i.m
+ },
+ o = t.all ? {
+ main: Object.keys(r.main)
+ } : function(e, t) {
+ for (var i = {
+ main: [t]
+ }, n = {
+ main: []
+ }, r = {
+ main: {}
+ }; s(i);)
+ for (var o = Object.keys(i), u = 0; u < o.length; u++) {
+ var l = o[u],
+ h = i[l].pop();
+ if (r[l] = r[l] || {}, !r[l][h] && e[l][h]) {
+ r[l][h] = !0, n[l] = n[l] || [], n[l].push(h);
+ for (var d = a(e, e[l][h], l), c = Object.keys(d), f = 0; f < c.length; f++) i[c[f]] = i[c[f]] || [], i[c[f]] = i[c[f]].concat(d[c[f]])
+ }
+ }
+ return n
+ }(r, e),
+ u = "";
+ Object.keys(o).filter((function(e) {
+ return "main" !== e
+ })).forEach((function(e) {
+ for (var t = 0; o[e][t];) t++;
+ o[e].push(t), r[e][t] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", u = u + "var " + e + " = (" + n.toString().replace("ENTRY_MODULE", JSON.stringify(t)) + ")({" + o[e].map((function(t) {
+ return JSON.stringify(t) + ": " + r[e][t].toString()
+ })).join(",") + "});\n"
+ })), u = u + "new ((" + n.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + o.main.map((function(e) {
+ return JSON.stringify(e) + ": " + r.main[e].toString()
+ })).join(",") + "}))(self);";
+ var l = new window.Blob([u], {
+ type: "text/javascript"
+ });
+ if (t.bare) return l;
+ var h = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l),
+ d = new window.Worker(h);
+ return d.objectURL = h, d
+ }
+ }, function(e, t, i) {
+ e.exports = i(19).default
+ }, function(e, t, i) {
+ (function(t, i) {
+ /*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
+ * @version v4.2.8+1e68dce6
+ */
+ var n;
+ n = function() {
+ "use strict";
+
+ function e(e) {
+ return "function" == typeof e
+ }
+ var n = Array.isArray ? Array.isArray : function(e) {
+ return "[object Array]" === Object.prototype.toString.call(e)
+ },
+ r = 0,
+ a = void 0,
+ s = void 0,
+ o = function(e, t) {
+ p[r] = e, p[r + 1] = t, 2 === (r += 2) && (s ? s(m) : b())
+ },
+ u = "undefined" != typeof window ? window : void 0,
+ l = u || {},
+ h = l.MutationObserver || l.WebKitMutationObserver,
+ d = "undefined" == typeof self && void 0 !== t && "[object process]" === {}.toString.call(t),
+ c = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel;
+
+ function f() {
+ var e = setTimeout;
+ return function() {
+ return e(m, 1)
+ }
+ }
+ var p = new Array(1e3);
+
+ function m() {
+ for (var e = 0; e < r; e += 2)(0, p[e])(p[e + 1]), p[e] = void 0, p[e + 1] = void 0;
+ r = 0
+ }
+ var _, g, v, y, b = void 0;
+
+ function S(e, t) {
+ var i = this,
+ n = new this.constructor(w);
+ void 0 === n[E] && O(n);
+ var r = i._state;
+ if (r) {
+ var a = arguments[r - 1];
+ o((function() {
+ return R(r, n, a, i._result)
+ }))
+ } else L(i, n, e, t);
+ return n
+ }
+
+ function T(e) {
+ if (e && "object" == typeof e && e.constructor === this) return e;
+ var t = new this(w);
+ return C(t, e), t
+ }
+ d ? b = function() {
+ return t.nextTick(m)
+ } : h ? (g = 0, v = new h(m), y = document.createTextNode(""), v.observe(y, {
+ characterData: !0
+ }), b = function() {
+ y.data = g = ++g % 2
+ }) : c ? ((_ = new MessageChannel).port1.onmessage = m, b = function() {
+ return _.port2.postMessage(0)
+ }) : b = void 0 === u ? function() {
+ try {
+ var e = Function("return this")().require("vertx");
+ return void 0 !== (a = e.runOnLoop || e.runOnContext) ? function() {
+ a(m)
+ } : f()
+ } catch (e) {
+ return f()
+ }
+ }() : f();
+ var E = Math.random().toString(36).substring(2);
+
+ function w() {}
+
+ function A(t, i, n) {
+ i.constructor === t.constructor && n === S && i.constructor.resolve === T ? function(e, t) {
+ 1 === t._state ? P(e, t._result) : 2 === t._state ? I(e, t._result) : L(t, void 0, (function(t) {
+ return C(e, t)
+ }), (function(t) {
+ return I(e, t)
+ }))
+ }(t, i) : void 0 === n ? P(t, i) : e(n) ? function(e, t, i) {
+ o((function(e) {
+ var n = !1,
+ r = function(e, t, i, n) {
+ try {
+ e.call(t, i, n)
+ } catch (e) {
+ return e
+ }
+ }(i, t, (function(i) {
+ n || (n = !0, t !== i ? C(e, i) : P(e, i))
+ }), (function(t) {
+ n || (n = !0, I(e, t))
+ }), e._label);
+ !n && r && (n = !0, I(e, r))
+ }), e)
+ }(t, i, n) : P(t, i)
+ }
+
+ function C(e, t) {
+ if (e === t) I(e, new TypeError("You cannot resolve a promise with itself"));
+ else if (r = typeof(n = t), null === n || "object" !== r && "function" !== r) P(e, t);
+ else {
+ var i = void 0;
+ try {
+ i = t.then
+ } catch (t) {
+ return void I(e, t)
+ }
+ A(e, t, i)
+ }
+ var n, r
+ }
+
+ function k(e) {
+ e._onerror && e._onerror(e._result), x(e)
+ }
+
+ function P(e, t) {
+ void 0 === e._state && (e._result = t, e._state = 1, 0 !== e._subscribers.length && o(x, e))
+ }
+
+ function I(e, t) {
+ void 0 === e._state && (e._state = 2, e._result = t, o(k, e))
+ }
+
+ function L(e, t, i, n) {
+ var r = e._subscribers,
+ a = r.length;
+ e._onerror = null, r[a] = t, r[a + 1] = i, r[a + 2] = n, 0 === a && e._state && o(x, e)
+ }
+
+ function x(e) {
+ var t = e._subscribers,
+ i = e._state;
+ if (0 !== t.length) {
+ for (var n = void 0, r = void 0, a = e._result, s = 0; s < t.length; s += 3) n = t[s], r = t[s + i], n ? R(i, n, r, a) : r(a);
+ e._subscribers.length = 0
+ }
+ }
+
+ function R(t, i, n, r) {
+ var a = e(n),
+ s = void 0,
+ o = void 0,
+ u = !0;
+ if (a) {
+ try {
+ s = n(r)
+ } catch (e) {
+ u = !1, o = e
+ }
+ if (i === s) return void I(i, new TypeError("A promises callback cannot return that same promise."))
+ } else s = r;
+ void 0 !== i._state || (a && u ? C(i, s) : !1 === u ? I(i, o) : 1 === t ? P(i, s) : 2 === t && I(i, s))
+ }
+ var D = 0;
+
+ function O(e) {
+ e[E] = D++, e._state = void 0, e._result = void 0, e._subscribers = []
+ }
+ var U = function() {
+ function e(e, t) {
+ this._instanceConstructor = e, this.promise = new e(w), this.promise[E] || O(this.promise), n(t) ? (this.length = t.length, this._remaining = t.length, this._result = new Array(this.length), 0 === this.length ? P(this.promise, this._result) : (this.length = this.length || 0, this._enumerate(t), 0 === this._remaining && P(this.promise, this._result))) : I(this.promise, new Error("Array Methods must be provided an Array"))
+ }
+ return e.prototype._enumerate = function(e) {
+ for (var t = 0; void 0 === this._state && t < e.length; t++) this._eachEntry(e[t], t)
+ }, e.prototype._eachEntry = function(e, t) {
+ var i = this._instanceConstructor,
+ n = i.resolve;
+ if (n === T) {
+ var r = void 0,
+ a = void 0,
+ s = !1;
+ try {
+ r = e.then
+ } catch (e) {
+ s = !0, a = e
+ }
+ if (r === S && void 0 !== e._state) this._settledAt(e._state, t, e._result);
+ else if ("function" != typeof r) this._remaining--, this._result[t] = e;
+ else if (i === M) {
+ var o = new i(w);
+ s ? I(o, a) : A(o, e, r), this._willSettleAt(o, t)
+ } else this._willSettleAt(new i((function(t) {
+ return t(e)
+ })), t)
+ } else this._willSettleAt(n(e), t)
+ }, e.prototype._settledAt = function(e, t, i) {
+ var n = this.promise;
+ void 0 === n._state && (this._remaining--, 2 === e ? I(n, i) : this._result[t] = i), 0 === this._remaining && P(n, this._result)
+ }, e.prototype._willSettleAt = function(e, t) {
+ var i = this;
+ L(e, void 0, (function(e) {
+ return i._settledAt(1, t, e)
+ }), (function(e) {
+ return i._settledAt(2, t, e)
+ }))
+ }, e
+ }(),
+ M = function() {
+ function t(e) {
+ this[E] = D++, this._result = this._state = void 0, this._subscribers = [], w !== e && ("function" != typeof e && function() {
+ throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")
+ }(), this instanceof t ? function(e, t) {
+ try {
+ t((function(t) {
+ C(e, t)
+ }), (function(t) {
+ I(e, t)
+ }))
+ } catch (t) {
+ I(e, t)
+ }
+ }(this, e) : function() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")
+ }())
+ }
+ return t.prototype.catch = function(e) {
+ return this.then(null, e)
+ }, t.prototype.finally = function(t) {
+ var i = this.constructor;
+ return e(t) ? this.then((function(e) {
+ return i.resolve(t()).then((function() {
+ return e
+ }))
+ }), (function(e) {
+ return i.resolve(t()).then((function() {
+ throw e
+ }))
+ })) : this.then(t, t)
+ }, t
+ }();
+ return M.prototype.then = S, M.all = function(e) {
+ return new U(this, e).promise
+ }, M.race = function(e) {
+ var t = this;
+ return n(e) ? new t((function(i, n) {
+ for (var r = e.length, a = 0; a < r; a++) t.resolve(e[a]).then(i, n)
+ })) : new t((function(e, t) {
+ return t(new TypeError("You must pass an array to race."))
+ }))
+ }, M.resolve = T, M.reject = function(e) {
+ var t = new this(w);
+ return I(t, e), t
+ }, M._setScheduler = function(e) {
+ s = e
+ }, M._setAsap = function(e) {
+ o = e
+ }, M._asap = o, M.polyfill = function() {
+ var e = void 0;
+ if (void 0 !== i) e = i;
+ else if ("undefined" != typeof self) e = self;
+ else try {
+ e = Function("return this")()
+ } catch (e) {
+ throw new Error("polyfill failed because global object is unavailable in this environment")
+ }
+ var t = e.Promise;
+ if (t) {
+ var n = null;
+ try {
+ n = Object.prototype.toString.call(t.resolve())
+ } catch (e) {}
+ if ("[object Promise]" === n && !t.cast) return
+ }
+ e.Promise = M
+ }, M.Promise = M, M
+ }, e.exports = n()
+ }).call(this, i(16), i(17))
+ }, function(e, t) {
+ var i, n, r = e.exports = {};
+
+ function a() {
+ throw new Error("setTimeout has not been defined")
+ }
+
+ function s() {
+ throw new Error("clearTimeout has not been defined")
+ }
+
+ function o(e) {
+ if (i === setTimeout) return setTimeout(e, 0);
+ if ((i === a || !i) && setTimeout) return i = setTimeout, setTimeout(e, 0);
+ try {
+ return i(e, 0)
+ } catch (t) {
+ try {
+ return i.call(null, e, 0)
+ } catch (t) {
+ return i.call(this, e, 0)
+ }
+ }
+ }! function() {
+ try {
+ i = "function" == typeof setTimeout ? setTimeout : a
+ } catch (e) {
+ i = a
+ }
+ try {
+ n = "function" == typeof clearTimeout ? clearTimeout : s
+ } catch (e) {
+ n = s
+ }
+ }();
+ var u, l = [],
+ h = !1,
+ d = -1;
+
+ function c() {
+ h && u && (h = !1, u.length ? l = u.concat(l) : d = -1, l.length && f())
+ }
+
+ function f() {
+ if (!h) {
+ var e = o(c);
+ h = !0;
+ for (var t = l.length; t;) {
+ for (u = l, l = []; ++d < t;) u && u[d].run();
+ d = -1, t = l.length
+ }
+ u = null, h = !1,
+ function(e) {
+ if (n === clearTimeout) return clearTimeout(e);
+ if ((n === s || !n) && clearTimeout) return n = clearTimeout, clearTimeout(e);
+ try {
+ n(e)
+ } catch (t) {
+ try {
+ return n.call(null, e)
+ } catch (t) {
+ return n.call(this, e)
+ }
+ }
+ }(e)
+ }
+ }
+
+ function p(e, t) {
+ this.fun = e, this.array = t
+ }
+
+ function m() {}
+ r.nextTick = function(e) {
+ var t = new Array(arguments.length - 1);
+ if (arguments.length > 1)
+ for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i];
+ l.push(new p(e, t)), 1 !== l.length || h || o(f)
+ }, p.prototype.run = function() {
+ this.fun.apply(null, this.array)
+ }, r.title = "browser", r.browser = !0, r.env = {}, r.argv = [], r.version = "", r.versions = {}, r.on = m, r.addListener = m, r.once = m, r.off = m, r.removeListener = m, r.removeAllListeners = m, r.emit = m, r.prependListener = m, r.prependOnceListener = m, r.listeners = function(e) {
+ return []
+ }, r.binding = function(e) {
+ throw new Error("process.binding is not supported")
+ }, r.cwd = function() {
+ return "/"
+ }, r.chdir = function(e) {
+ throw new Error("process.chdir is not supported")
+ }, r.umask = function() {
+ return 0
+ }
+ }, function(e, t) {
+ var i;
+ i = function() {
+ return this
+ }();
+ try {
+ i = i || new Function("return this")()
+ } catch (e) {
+ "object" == typeof window && (i = window)
+ }
+ e.exports = i
+ }, function(e, t, i) {
+ "use strict";
+ i.r(t);
+ var n = i(9),
+ r = i(12),
+ a = i(10),
+ s = i(1);
+ t.default = function(e) {
+ var t = null,
+ i = function(t, i) {
+ e.postMessage({
+ msg: "logcat_callback",
+ data: {
+ type: t,
+ logcat: i
+ }
+ })
+ }.bind(this);
+
+ function o(t, i) {
+ var n = {
+ msg: s.a.INIT_SEGMENT,
+ data: {
+ type: t,
+ data: i
+ }
+ };
+ e.postMessage(n, [i.data])
+ }
+
+ function u(t, i) {
+ var n = {
+ msg: s.a.MEDIA_SEGMENT,
+ data: {
+ type: t,
+ data: i
+ }
+ };
+ e.postMessage(n, [i.data])
+ }
+
+ function l() {
+ var t = {
+ msg: s.a.LOADING_COMPLETE
+ };
+ e.postMessage(t)
+ }
+
+ function h() {
+ var t = {
+ msg: s.a.RECOVERED_EARLY_EOF
+ };
+ e.postMessage(t)
+ }
+
+ function d(t) {
+ var i = {
+ msg: s.a.MEDIA_INFO,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function c(t) {
+ var i = {
+ msg: s.a.METADATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function f(t) {
+ var i = {
+ msg: s.a.SCRIPTDATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function p(t) {
+ var i = {
+ msg: s.a.TIMED_ID3_METADATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function m(t) {
+ var i = {
+ msg: s.a.PES_PRIVATE_DATA_DESCRIPTOR,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function _(t) {
+ var i = {
+ msg: s.a.PES_PRIVATE_DATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function g(t) {
+ var i = {
+ msg: s.a.STATISTICS_INFO,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function v(t, i) {
+ e.postMessage({
+ msg: s.a.IO_ERROR,
+ data: {
+ type: t,
+ info: i
+ }
+ })
+ }
+
+ function y(t, i) {
+ e.postMessage({
+ msg: s.a.DEMUX_ERROR,
+ data: {
+ type: t,
+ info: i
+ }
+ })
+ }
+
+ function b(t) {
+ e.postMessage({
+ msg: s.a.RECOMMEND_SEEKPOINT,
+ data: t
+ })
+ }
+ r.a.install(), e.addEventListener("message", (function(r) {
+ switch (r.data.cmd) {
+ case "init":
+ (t = new a.a(r.data.param[0], r.data.param[1])).on(s.a.IO_ERROR, v.bind(this)), t.on(s.a.DEMUX_ERROR, y.bind(this)), t.on(s.a.INIT_SEGMENT, o.bind(this)), t.on(s.a.MEDIA_SEGMENT, u.bind(this)), t.on(s.a.LOADING_COMPLETE, l.bind(this)), t.on(s.a.RECOVERED_EARLY_EOF, h.bind(this)), t.on(s.a.MEDIA_INFO, d.bind(this)), t.on(s.a.METADATA_ARRIVED, c.bind(this)), t.on(s.a.SCRIPTDATA_ARRIVED, f.bind(this)), t.on(s.a.TIMED_ID3_METADATA_ARRIVED, p.bind(this)), t.on(s.a.PES_PRIVATE_DATA_DESCRIPTOR, m.bind(this)), t.on(s.a.PES_PRIVATE_DATA_ARRIVED, _.bind(this)), t.on(s.a.STATISTICS_INFO, g.bind(this)), t.on(s.a.RECOMMEND_SEEKPOINT, b.bind(this));
+ break;
+ case "destroy":
+ t && (t.destroy(), t = null), e.postMessage({
+ msg: "destroyed"
+ });
+ break;
+ case "start":
+ t.start();
+ break;
+ case "stop":
+ t.stop();
+ break;
+ case "seek":
+ t.seek(r.data.param);
+ break;
+ case "pause":
+ t.pause();
+ break;
+ case "resume":
+ t.resume();
+ break;
+ case "logging_config":
+ var S = r.data.param;
+ n.a.applyConfig(S), !0 === S.enableCallback ? n.a.addLogListener(i) : n.a.removeLogListener(i)
+ }
+ }))
+ }
+ }, function(e, t, i) {
+ "use strict";
+ i.r(t);
+ var n = i(12),
+ r = i(11),
+ a = {
+ enableWorker: !1,
+ enableStashBuffer: !0,
+ stashInitialSize: void 0,
+ isLive: !1,
+ liveBufferLatencyChasing: !1,
+ liveBufferLatencyMaxLatency: 1.5,
+ liveBufferLatencyMinRemain: .5,
+ lazyLoad: !0,
+ lazyLoadMaxDuration: 180,
+ lazyLoadRecoverDuration: 30,
+ deferLoadAfterSourceOpen: !0,
+ autoCleanupMaxBackwardDuration: 180,
+ autoCleanupMinBackwardDuration: 120,
+ statisticsInfoReportInterval: 600,
+ fixAudioTimestampGap: !0,
+ accurateSeek: !1,
+ seekType: "range",
+ seekParamStart: "bstart",
+ seekParamEnd: "bend",
+ rangeLoadZeroStart: !1,
+ customSeekHandler: void 0,
+ reuseRedirectedURL: !1,
+ headers: void 0,
+ customLoader: void 0
+ };
+
+ function s() {
+ return Object.assign({}, a)
+ }
+ var o = function() {
+ function e() {}
+ return e.supportMSEH264Playback = function() {
+ return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')
+ }, e.supportNetworkStreamIO = function() {
+ var e = new r.a({}, s()),
+ t = e.loaderType;
+ return e.destroy(), "fetch-stream-loader" == t || "xhr-moz-chunked-loader" == t
+ }, e.getNetworkLoaderTypeName = function() {
+ var e = new r.a({}, s()),
+ t = e.loaderType;
+ return e.destroy(), t
+ }, e.supportNativeMediaPlayback = function(t) {
+ null == e.videoElement && (e.videoElement = window.document.createElement("video"));
+ var i = e.videoElement.canPlayType(t);
+ return "probably" === i || "maybe" == i
+ }, e.getFeatureList = function() {
+ var t = {
+ msePlayback: !1,
+ mseLivePlayback: !1,
+ networkStreamIO: !1,
+ networkLoaderName: "",
+ nativeMP4H264Playback: !1,
+ nativeWebmVP8Playback: !1,
+ nativeWebmVP9Playback: !1
+ };
+ return t.msePlayback = e.supportMSEH264Playback(), t.networkStreamIO = e.supportNetworkStreamIO(), t.networkLoaderName = e.getNetworkLoaderTypeName(), t.mseLivePlayback = t.msePlayback && t.networkStreamIO, t.nativeMP4H264Playback = e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'), t.nativeWebmVP8Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'), t.nativeWebmVP9Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp9"'), t
+ }, e
+ }(),
+ u = i(2),
+ l = i(6),
+ h = i.n(l),
+ d = i(0),
+ c = i(4),
+ f = {
+ ERROR: "error",
+ LOADING_COMPLETE: "loading_complete",
+ RECOVERED_EARLY_EOF: "recovered_early_eof",
+ MEDIA_INFO: "media_info",
+ METADATA_ARRIVED: "metadata_arrived",
+ SCRIPTDATA_ARRIVED: "scriptdata_arrived",
+ TIMED_ID3_METADATA_ARRIVED: "timed_id3_metadata_arrived",
+ PES_PRIVATE_DATA_DESCRIPTOR: "pes_private_data_descriptor",
+ PES_PRIVATE_DATA_ARRIVED: "pes_private_data_arrived",
+ STATISTICS_INFO: "statistics_info"
+ },
+ p = i(13),
+ m = i.n(p),
+ _ = i(9),
+ g = i(10),
+ v = i(1),
+ y = i(8),
+ b = function() {
+ function e(e, t) {
+ if (this.TAG = "Transmuxer", this._emitter = new h.a, t.enableWorker && "undefined" != typeof Worker) try {
+ this._worker = m()(18), this._workerDestroying = !1, this._worker.addEventListener("message", this._onWorkerMessage.bind(this)), this._worker.postMessage({
+ cmd: "init",
+ param: [e, t]
+ }), this.e = {
+ onLoggingConfigChanged: this._onLoggingConfigChanged.bind(this)
+ }, _.a.registerListener(this.e.onLoggingConfigChanged), this._worker.postMessage({
+ cmd: "logging_config",
+ param: _.a.getConfig()
+ })
+ } catch (i) {
+ d.a.e(this.TAG, "Error while initialize transmuxing worker, fallback to inline transmuxing"), this._worker = null, this._controller = new g.a(e, t)
+ } else this._controller = new g.a(e, t);
+ if (this._controller) {
+ var i = this._controller;
+ i.on(v.a.IO_ERROR, this._onIOError.bind(this)), i.on(v.a.DEMUX_ERROR, this._onDemuxError.bind(this)), i.on(v.a.INIT_SEGMENT, this._onInitSegment.bind(this)), i.on(v.a.MEDIA_SEGMENT, this._onMediaSegment.bind(this)), i.on(v.a.LOADING_COMPLETE, this._onLoadingComplete.bind(this)), i.on(v.a.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this)), i.on(v.a.MEDIA_INFO, this._onMediaInfo.bind(this)), i.on(v.a.METADATA_ARRIVED, this._onMetaDataArrived.bind(this)), i.on(v.a.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this)), i.on(v.a.TIMED_ID3_METADATA_ARRIVED, this._onTimedID3MetadataArrived.bind(this)), i.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR, this._onPESPrivateDataDescriptor.bind(this)), i.on(v.a.PES_PRIVATE_DATA_ARRIVED, this._onPESPrivateDataArrived.bind(this)), i.on(v.a.STATISTICS_INFO, this._onStatisticsInfo.bind(this)), i.on(v.a.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this))
+ }
+ }
+ return e.prototype.destroy = function() {
+ this._worker ? this._workerDestroying || (this._workerDestroying = !0, this._worker.postMessage({
+ cmd: "destroy"
+ }), _.a.removeListener(this.e.onLoggingConfigChanged), this.e = null) : (this._controller.destroy(), this._controller = null), this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.hasWorker = function() {
+ return null != this._worker
+ }, e.prototype.open = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "start"
+ }) : this._controller.start()
+ }, e.prototype.close = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "stop"
+ }) : this._controller.stop()
+ }, e.prototype.seek = function(e) {
+ this._worker ? this._worker.postMessage({
+ cmd: "seek",
+ param: e
+ }) : this._controller.seek(e)
+ }, e.prototype.pause = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "pause"
+ }) : this._controller.pause()
+ }, e.prototype.resume = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "resume"
+ }) : this._controller.resume()
+ }, e.prototype._onInitSegment = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(v.a.INIT_SEGMENT, e, t)
+ }))
+ }, e.prototype._onMediaSegment = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(v.a.MEDIA_SEGMENT, e, t)
+ }))
+ }, e.prototype._onLoadingComplete = function() {
+ var e = this;
+ Promise.resolve().then((function() {
+ e._emitter.emit(v.a.LOADING_COMPLETE)
+ }))
+ }, e.prototype._onRecoveredEarlyEof = function() {
+ var e = this;
+ Promise.resolve().then((function() {
+ e._emitter.emit(v.a.RECOVERED_EARLY_EOF)
+ }))
+ }, e.prototype._onMediaInfo = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.MEDIA_INFO, e)
+ }))
+ }, e.prototype._onMetaDataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.METADATA_ARRIVED, e)
+ }))
+ }, e.prototype._onScriptDataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.SCRIPTDATA_ARRIVED, e)
+ }))
+ }, e.prototype._onTimedID3MetadataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.TIMED_ID3_METADATA_ARRIVED, e)
+ }))
+ }, e.prototype._onPESPrivateDataDescriptor = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.PES_PRIVATE_DATA_DESCRIPTOR, e)
+ }))
+ }, e.prototype._onPESPrivateDataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.PES_PRIVATE_DATA_ARRIVED, e)
+ }))
+ }, e.prototype._onStatisticsInfo = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.STATISTICS_INFO, e)
+ }))
+ }, e.prototype._onIOError = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(v.a.IO_ERROR, e, t)
+ }))
+ }, e.prototype._onDemuxError = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(v.a.DEMUX_ERROR, e, t)
+ }))
+ }, e.prototype._onRecommendSeekpoint = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(v.a.RECOMMEND_SEEKPOINT, e)
+ }))
+ }, e.prototype._onLoggingConfigChanged = function(e) {
+ this._worker && this._worker.postMessage({
+ cmd: "logging_config",
+ param: e
+ })
+ }, e.prototype._onWorkerMessage = function(e) {
+ var t = e.data,
+ i = t.data;
+ if ("destroyed" === t.msg || this._workerDestroying) return this._workerDestroying = !1, this._worker.terminate(), void(this._worker = null);
+ switch (t.msg) {
+ case v.a.INIT_SEGMENT:
+ case v.a.MEDIA_SEGMENT:
+ this._emitter.emit(t.msg, i.type, i.data);
+ break;
+ case v.a.LOADING_COMPLETE:
+ case v.a.RECOVERED_EARLY_EOF:
+ this._emitter.emit(t.msg);
+ break;
+ case v.a.MEDIA_INFO:
+ Object.setPrototypeOf(i, y.a.prototype), this._emitter.emit(t.msg, i);
+ break;
+ case v.a.METADATA_ARRIVED:
+ case v.a.SCRIPTDATA_ARRIVED:
+ case v.a.TIMED_ID3_METADATA_ARRIVED:
+ case v.a.PES_PRIVATE_DATA_DESCRIPTOR:
+ case v.a.PES_PRIVATE_DATA_ARRIVED:
+ case v.a.STATISTICS_INFO:
+ this._emitter.emit(t.msg, i);
+ break;
+ case v.a.IO_ERROR:
+ case v.a.DEMUX_ERROR:
+ this._emitter.emit(t.msg, i.type, i.info);
+ break;
+ case v.a.RECOMMEND_SEEKPOINT:
+ this._emitter.emit(t.msg, i);
+ break;
+ case "logcat_callback":
+ d.a.emitter.emit("log", i.type, i.logcat)
+ }
+ }, e
+ }(),
+ S = "error",
+ T = "source_open",
+ E = "update_end",
+ w = "buffer_full",
+ A = i(7),
+ C = i(3),
+ k = function() {
+ function e(e) {
+ this.TAG = "MSEController", this._config = e, this._emitter = new h.a, this._config.isLive && null == this._config.autoCleanupSourceBuffer && (this._config.autoCleanupSourceBuffer = !0), this.e = {
+ onSourceOpen: this._onSourceOpen.bind(this),
+ onSourceEnded: this._onSourceEnded.bind(this),
+ onSourceClose: this._onSourceClose.bind(this),
+ onSourceBufferError: this._onSourceBufferError.bind(this),
+ onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
+ }, this._mediaSource = null, this._mediaSourceObjectURL = null, this._mediaElement = null, this._isBufferFull = !1, this._hasPendingEos = !1, this._requireSetMediaDuration = !1, this._pendingMediaDuration = 0, this._pendingSourceBufferInit = [], this._mimeTypes = {
+ video: null,
+ audio: null
+ }, this._sourceBuffers = {
+ video: null,
+ audio: null
+ }, this._lastInitSegments = {
+ video: null,
+ audio: null
+ }, this._pendingSegments = {
+ video: [],
+ audio: []
+ }, this._pendingRemoveRanges = {
+ video: [],
+ audio: []
+ }, this._idrList = new A.a
+ }
+ return e.prototype.destroy = function() {
+ (this._mediaElement || this._mediaSource) && this.detachMediaElement(), this.e = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ if (this._mediaSource) throw new C.a("MediaSource has been attached to an HTMLMediaElement!");
+ var t = this._mediaSource = new window.MediaSource;
+ t.addEventListener("sourceopen", this.e.onSourceOpen), t.addEventListener("sourceended", this.e.onSourceEnded), t.addEventListener("sourceclose", this.e.onSourceClose), this._mediaElement = e, this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource), e.src = this._mediaSourceObjectURL
+ }, e.prototype.detachMediaElement = function() {
+ if (this._mediaSource) {
+ var e = this._mediaSource;
+ for (var t in this._sourceBuffers) {
+ var i = this._pendingSegments[t];
+ i.splice(0, i.length), this._pendingSegments[t] = null, this._pendingRemoveRanges[t] = null, this._lastInitSegments[t] = null;
+ var n = this._sourceBuffers[t];
+ if (n) {
+ if ("closed" !== e.readyState) {
+ try {
+ e.removeSourceBuffer(n)
+ } catch (e) {
+ d.a.e(this.TAG, e.message)
+ }
+ n.removeEventListener("error", this.e.onSourceBufferError), n.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd)
+ }
+ this._mimeTypes[t] = null, this._sourceBuffers[t] = null
+ }
+ }
+ if ("open" === e.readyState) try {
+ e.endOfStream()
+ } catch (e) {
+ d.a.e(this.TAG, e.message)
+ }
+ e.removeEventListener("sourceopen", this.e.onSourceOpen), e.removeEventListener("sourceended", this.e.onSourceEnded), e.removeEventListener("sourceclose", this.e.onSourceClose), this._pendingSourceBufferInit = [], this._isBufferFull = !1, this._idrList.clear(), this._mediaSource = null
+ }
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this._mediaElement = null), this._mediaSourceObjectURL && (window.URL.revokeObjectURL(this._mediaSourceObjectURL), this._mediaSourceObjectURL = null)
+ }, e.prototype.appendInitSegment = function(e, t) {
+ if (!this._mediaSource || "open" !== this._mediaSource.readyState) return this._pendingSourceBufferInit.push(e), void this._pendingSegments[e.type].push(e);
+ var i = e,
+ n = "" + i.container;
+ i.codec && i.codec.length > 0 && (n += ";codecs=" + i.codec);
+ var r = !1;
+ if (d.a.v(this.TAG, "Received Initialization Segment, mimeType: " + n), this._lastInitSegments[i.type] = i, n !== this._mimeTypes[i.type]) {
+ if (this._mimeTypes[i.type]) d.a.v(this.TAG, "Notice: " + i.type + " mimeType changed, origin: " + this._mimeTypes[i.type] + ", target: " + n);
+ else {
+ r = !0;
+ try {
+ var a = this._sourceBuffers[i.type] = this._mediaSource.addSourceBuffer(n);
+ a.addEventListener("error", this.e.onSourceBufferError), a.addEventListener("updateend", this.e.onSourceBufferUpdateEnd)
+ } catch (e) {
+ return d.a.e(this.TAG, e.message), void this._emitter.emit(S, {
+ code: e.code,
+ msg: e.message
+ })
+ }
+ }
+ this._mimeTypes[i.type] = n
+ }
+ t || this._pendingSegments[i.type].push(i), r || this._sourceBuffers[i.type] && !this._sourceBuffers[i.type].updating && this._doAppendSegments(), c.a.safari && "audio/mpeg" === i.container && i.mediaDuration > 0 && (this._requireSetMediaDuration = !0, this._pendingMediaDuration = i.mediaDuration / 1e3, this._updateMediaSourceDuration())
+ }, e.prototype.appendMediaSegment = function(e) {
+ var t = e;
+ this._pendingSegments[t.type].push(t), this._config.autoCleanupSourceBuffer && this._needCleanupSourceBuffer() && this._doCleanupSourceBuffer();
+ var i = this._sourceBuffers[t.type];
+ !i || i.updating || this._hasPendingRemoveRanges() || this._doAppendSegments()
+ }, e.prototype.seek = function(e) {
+ for (var t in this._sourceBuffers)
+ if (this._sourceBuffers[t]) {
+ var i = this._sourceBuffers[t];
+ if ("open" === this._mediaSource.readyState) try {
+ i.abort()
+ } catch (e) {
+ d.a.e(this.TAG, e.message)
+ }
+ this._idrList.clear();
+ var n = this._pendingSegments[t];
+ if (n.splice(0, n.length), "closed" !== this._mediaSource.readyState) {
+ for (var r = 0; r < i.buffered.length; r++) {
+ var a = i.buffered.start(r),
+ s = i.buffered.end(r);
+ this._pendingRemoveRanges[t].push({
+ start: a,
+ end: s
+ })
+ }
+ if (i.updating || this._doRemoveRanges(), c.a.safari) {
+ var o = this._lastInitSegments[t];
+ o && (this._pendingSegments[t].push(o), i.updating || this._doAppendSegments())
+ }
+ }
+ }
+ }, e.prototype.endOfStream = function() {
+ var e = this._mediaSource,
+ t = this._sourceBuffers;
+ e && "open" === e.readyState ? t.video && t.video.updating || t.audio && t.audio.updating ? this._hasPendingEos = !0 : (this._hasPendingEos = !1, e.endOfStream()) : e && "closed" === e.readyState && this._hasPendingSegments() && (this._hasPendingEos = !0)
+ }, e.prototype.getNearestKeyframe = function(e) {
+ return this._idrList.getLastSyncPointBeforeDts(e)
+ }, e.prototype._needCleanupSourceBuffer = function() {
+ if (!this._config.autoCleanupSourceBuffer) return !1;
+ var e = this._mediaElement.currentTime;
+ for (var t in this._sourceBuffers) {
+ var i = this._sourceBuffers[t];
+ if (i) {
+ var n = i.buffered;
+ if (n.length >= 1 && e - n.start(0) >= this._config.autoCleanupMaxBackwardDuration) return !0
+ }
+ }
+ return !1
+ }, e.prototype._doCleanupSourceBuffer = function() {
+ var e = this._mediaElement.currentTime;
+ for (var t in this._sourceBuffers) {
+ var i = this._sourceBuffers[t];
+ if (i) {
+ for (var n = i.buffered, r = !1, a = 0; a < n.length; a++) {
+ var s = n.start(a),
+ o = n.end(a);
+ if (s <= e && e < o + 3) {
+ if (e - s >= this._config.autoCleanupMaxBackwardDuration) {
+ r = !0;
+ var u = e - this._config.autoCleanupMinBackwardDuration;
+ this._pendingRemoveRanges[t].push({
+ start: s,
+ end: u
+ })
+ }
+ } else o < e && (r = !0, this._pendingRemoveRanges[t].push({
+ start: s,
+ end: o
+ }))
+ }
+ r && !i.updating && this._doRemoveRanges()
+ }
+ }
+ }, e.prototype._updateMediaSourceDuration = function() {
+ var e = this._sourceBuffers;
+ if (0 !== this._mediaElement.readyState && "open" === this._mediaSource.readyState && !(e.video && e.video.updating || e.audio && e.audio.updating)) {
+ var t = this._mediaSource.duration,
+ i = this._pendingMediaDuration;
+ i > 0 && (isNaN(t) || i > t) && (d.a.v(this.TAG, "Update MediaSource duration from " + t + " to " + i), this._mediaSource.duration = i), this._requireSetMediaDuration = !1, this._pendingMediaDuration = 0
+ }
+ }, e.prototype._doRemoveRanges = function() {
+ for (var e in this._pendingRemoveRanges)
+ if (this._sourceBuffers[e] && !this._sourceBuffers[e].updating)
+ for (var t = this._sourceBuffers[e], i = this._pendingRemoveRanges[e]; i.length && !t.updating;) {
+ var n = i.shift();
+ t.remove(n.start, n.end)
+ }
+ }, e.prototype._doAppendSegments = function() {
+ var e = this._pendingSegments;
+ for (var t in e)
+ if (this._sourceBuffers[t] && !this._sourceBuffers[t].updating && e[t].length > 0) {
+ var i = e[t].shift();
+ if (i.timestampOffset) {
+ var n = this._sourceBuffers[t].timestampOffset,
+ r = i.timestampOffset / 1e3;
+ Math.abs(n - r) > .1 && (d.a.v(this.TAG, "Update MPEG audio timestampOffset from " + n + " to " + r), this._sourceBuffers[t].timestampOffset = r), delete i.timestampOffset
+ }
+ if (!i.data || 0 === i.data.byteLength) continue;
+ try {
+ this._sourceBuffers[t].appendBuffer(i.data), this._isBufferFull = !1, "video" === t && i.hasOwnProperty("info") && this._idrList.appendArray(i.info.syncPoints)
+ } catch (e) {
+ this._pendingSegments[t].unshift(i), 22 === e.code ? (this._isBufferFull || this._emitter.emit(w), this._isBufferFull = !0) : (d.a.e(this.TAG, e.message), this._emitter.emit(S, {
+ code: e.code,
+ msg: e.message
+ }))
+ }
+ }
+ }, e.prototype._onSourceOpen = function() {
+ if (d.a.v(this.TAG, "MediaSource onSourceOpen"), this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen), this._pendingSourceBufferInit.length > 0)
+ for (var e = this._pendingSourceBufferInit; e.length;) {
+ var t = e.shift();
+ this.appendInitSegment(t, !0)
+ }
+ this._hasPendingSegments() && this._doAppendSegments(), this._emitter.emit(T)
+ }, e.prototype._onSourceEnded = function() {
+ d.a.v(this.TAG, "MediaSource onSourceEnded")
+ }, e.prototype._onSourceClose = function() {
+ d.a.v(this.TAG, "MediaSource onSourceClose"), this._mediaSource && null != this.e && (this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen), this._mediaSource.removeEventListener("sourceended", this.e.onSourceEnded), this._mediaSource.removeEventListener("sourceclose", this.e.onSourceClose))
+ }, e.prototype._hasPendingSegments = function() {
+ var e = this._pendingSegments;
+ return e.video.length > 0 || e.audio.length > 0
+ }, e.prototype._hasPendingRemoveRanges = function() {
+ var e = this._pendingRemoveRanges;
+ return e.video.length > 0 || e.audio.length > 0
+ }, e.prototype._onSourceBufferUpdateEnd = function() {
+ this._requireSetMediaDuration ? this._updateMediaSourceDuration() : this._hasPendingRemoveRanges() ? this._doRemoveRanges() : this._hasPendingSegments() ? this._doAppendSegments() : this._hasPendingEos && this.endOfStream(), this._emitter.emit(E)
+ }, e.prototype._onSourceBufferError = function(e) {
+ d.a.e(this.TAG, "SourceBuffer Error: " + e)
+ }, e
+ }(),
+ P = i(5),
+ I = {
+ NETWORK_ERROR: "NetworkError",
+ MEDIA_ERROR: "MediaError",
+ OTHER_ERROR: "OtherError"
+ },
+ L = {
+ NETWORK_EXCEPTION: u.b.EXCEPTION,
+ NETWORK_STATUS_CODE_INVALID: u.b.HTTP_STATUS_CODE_INVALID,
+ NETWORK_TIMEOUT: u.b.CONNECTING_TIMEOUT,
+ NETWORK_UNRECOVERABLE_EARLY_EOF: u.b.UNRECOVERABLE_EARLY_EOF,
+ MEDIA_MSE_ERROR: "MediaMSEError",
+ MEDIA_FORMAT_ERROR: P.a.FORMAT_ERROR,
+ MEDIA_FORMAT_UNSUPPORTED: P.a.FORMAT_UNSUPPORTED,
+ MEDIA_CODEC_UNSUPPORTED: P.a.CODEC_UNSUPPORTED
+ },
+ x = function() {
+ function e(e, t) {
+ this.TAG = "MSEPlayer", this._type = "MSEPlayer", this._emitter = new h.a, this._config = s(), "object" == typeof t && Object.assign(this._config, t);
+ var i = e.type.toLowerCase();
+ if ("mse" !== i && "mpegts" !== i && "m2ts" !== i && "flv" !== i) throw new C.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");
+ !0 === e.isLive && (this._config.isLive = !0), this.e = {
+ onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
+ onvSeeking: this._onvSeeking.bind(this),
+ onvCanPlay: this._onvCanPlay.bind(this),
+ onvStalled: this._onvStalled.bind(this),
+ onvProgress: this._onvProgress.bind(this)
+ }, self.performance && self.performance.now ? this._now = self.performance.now.bind(self.performance) : this._now = Date.now, this._pendingSeekTime = null, this._requestSetTime = !1, this._seekpointRecord = null, this._progressChecker = null, this._mediaDataSource = e, this._mediaElement = null, this._msectl = null, this._transmuxer = null, this._mseSourceOpened = !1, this._hasPendingLoad = !1, this._receivedCanPlay = !1, this._mediaInfo = null, this._statisticsInfo = null;
+ var n = c.a.chrome && (c.a.version.major < 50 || 50 === c.a.version.major && c.a.version.build < 2661);
+ this._alwaysSeekKeyframe = !!(n || c.a.msedge || c.a.msie), this._alwaysSeekKeyframe && (this._config.accurateSeek = !1)
+ }
+ return e.prototype.destroy = function() {
+ null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker = null), this._transmuxer && this.unload(), this._mediaElement && this.detachMediaElement(), this.e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ var i = this;
+ e === f.MEDIA_INFO ? null != this._mediaInfo && Promise.resolve().then((function() {
+ i._emitter.emit(f.MEDIA_INFO, i.mediaInfo)
+ })) : e === f.STATISTICS_INFO && null != this._statisticsInfo && Promise.resolve().then((function() {
+ i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo)
+ })), this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ var t = this;
+ if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), e.addEventListener("seeking", this.e.onvSeeking), e.addEventListener("canplay", this.e.onvCanPlay), e.addEventListener("stalled", this.e.onvStalled), e.addEventListener("progress", this.e.onvProgress), this._msectl = new k(this._config), this._msectl.on(E, this._onmseUpdateEnd.bind(this)), this._msectl.on(w, this._onmseBufferFull.bind(this)), this._msectl.on(T, (function() {
+ t._mseSourceOpened = !0, t._hasPendingLoad && (t._hasPendingLoad = !1, t.load())
+ })), this._msectl.on(S, (function(e) {
+ t._emitter.emit(f.ERROR, I.MEDIA_ERROR, L.MEDIA_MSE_ERROR, e)
+ })), this._msectl.attachMediaElement(e), null != this._pendingSeekTime) try {
+ e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
+ } catch (e) {}
+ }, e.prototype.detachMediaElement = function() {
+ this._mediaElement && (this._msectl.detachMediaElement(), this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement.removeEventListener("seeking", this.e.onvSeeking), this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay), this._mediaElement.removeEventListener("stalled", this.e.onvStalled), this._mediaElement.removeEventListener("progress", this.e.onvProgress), this._mediaElement = null), this._msectl && (this._msectl.destroy(), this._msectl = null)
+ }, e.prototype.load = function() {
+ var e = this;
+ if (!this._mediaElement) throw new C.a("HTMLMediaElement must be attached before load()!");
+ if (this._transmuxer) throw new C.a("MSEPlayer.load() has been called, please call unload() first!");
+ this._hasPendingLoad || (this._config.deferLoadAfterSourceOpen && !1 === this._mseSourceOpened ? this._hasPendingLoad = !0 : (this._mediaElement.readyState > 0 && (this._requestSetTime = !0, this._mediaElement.currentTime = 0), this._transmuxer = new b(this._mediaDataSource, this._config), this._transmuxer.on(v.a.INIT_SEGMENT, (function(t, i) {
+ e._msectl.appendInitSegment(i)
+ })), this._transmuxer.on(v.a.MEDIA_SEGMENT, (function(t, i) {
+ if (e._msectl.appendMediaSegment(i), e._config.lazyLoad && !e._config.isLive) {
+ var n = e._mediaElement.currentTime;
+ i.info.endDts >= 1e3 * (n + e._config.lazyLoadMaxDuration) && null == e._progressChecker && (d.a.v(e.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), e._suspendTransmuxer())
+ }
+ })), this._transmuxer.on(v.a.LOADING_COMPLETE, (function() {
+ e._msectl.endOfStream(), e._emitter.emit(f.LOADING_COMPLETE)
+ })), this._transmuxer.on(v.a.RECOVERED_EARLY_EOF, (function() {
+ e._emitter.emit(f.RECOVERED_EARLY_EOF)
+ })), this._transmuxer.on(v.a.IO_ERROR, (function(t, i) {
+ e._emitter.emit(f.ERROR, I.NETWORK_ERROR, t, i)
+ })), this._transmuxer.on(v.a.DEMUX_ERROR, (function(t, i) {
+ e._emitter.emit(f.ERROR, I.MEDIA_ERROR, t, {
+ code: -1,
+ msg: i
+ })
+ })), this._transmuxer.on(v.a.MEDIA_INFO, (function(t) {
+ e._mediaInfo = t, e._emitter.emit(f.MEDIA_INFO, Object.assign({}, t))
+ })), this._transmuxer.on(v.a.METADATA_ARRIVED, (function(t) {
+ e._emitter.emit(f.METADATA_ARRIVED, t)
+ })), this._transmuxer.on(v.a.SCRIPTDATA_ARRIVED, (function(t) {
+ e._emitter.emit(f.SCRIPTDATA_ARRIVED, t)
+ })), this._transmuxer.on(v.a.TIMED_ID3_METADATA_ARRIVED, (function(t) {
+ e._emitter.emit(f.TIMED_ID3_METADATA_ARRIVED, t)
+ })), this._transmuxer.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR, (function(t) {
+ e._emitter.emit(f.PES_PRIVATE_DATA_DESCRIPTOR, t)
+ })), this._transmuxer.on(v.a.PES_PRIVATE_DATA_ARRIVED, (function(t) {
+ e._emitter.emit(f.PES_PRIVATE_DATA_ARRIVED, t)
+ })), this._transmuxer.on(v.a.STATISTICS_INFO, (function(t) {
+ e._statisticsInfo = e._fillStatisticsInfo(t), e._emitter.emit(f.STATISTICS_INFO, Object.assign({}, e._statisticsInfo))
+ })), this._transmuxer.on(v.a.RECOMMEND_SEEKPOINT, (function(t) {
+ e._mediaElement && !e._config.accurateSeek && (e._requestSetTime = !0, e._mediaElement.currentTime = t / 1e3)
+ })), this._transmuxer.open()))
+ }, e.prototype.unload = function() {
+ this._mediaElement && this._mediaElement.pause(), this._msectl && this._msectl.seek(0), this._transmuxer && (this._transmuxer.close(), this._transmuxer.destroy(), this._transmuxer = null)
+ }, e.prototype.play = function() {
+ return this._mediaElement.play()
+ }, e.prototype.pause = function() {
+ this._mediaElement.pause()
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "buffered", {
+ get: function() {
+ return this._mediaElement.buffered
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "duration", {
+ get: function() {
+ return this._mediaElement.duration
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "volume", {
+ get: function() {
+ return this._mediaElement.volume
+ },
+ set: function(e) {
+ this._mediaElement.volume = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "muted", {
+ get: function() {
+ return this._mediaElement.muted
+ },
+ set: function(e) {
+ this._mediaElement.muted = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentTime", {
+ get: function() {
+ return this._mediaElement ? this._mediaElement.currentTime : 0
+ },
+ set: function(e) {
+ this._mediaElement ? this._internalSeek(e) : this._pendingSeekTime = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "mediaInfo", {
+ get: function() {
+ return Object.assign({}, this._mediaInfo)
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "statisticsInfo", {
+ get: function() {
+ return null == this._statisticsInfo && (this._statisticsInfo = {}), this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo), Object.assign({}, this._statisticsInfo)
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._fillStatisticsInfo = function(e) {
+ if (e.playerType = this._type, !(this._mediaElement instanceof HTMLVideoElement)) return e;
+ var t = !0,
+ i = 0,
+ n = 0;
+ if (this._mediaElement.getVideoPlaybackQuality) {
+ var r = this._mediaElement.getVideoPlaybackQuality();
+ i = r.totalVideoFrames, n = r.droppedVideoFrames
+ } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement.webkitDecodedFrameCount, n = this._mediaElement.webkitDroppedFrameCount) : t = !1;
+ return t && (e.decodedFrames = i, e.droppedFrames = n), e
+ }, e.prototype._onmseUpdateEnd = function() {
+ var e = this._mediaElement.buffered,
+ t = this._mediaElement.currentTime;
+ if (this._config.isLive && this._config.liveBufferLatencyChasing && e.length > 0 && !this._mediaElement.paused) {
+ var i = e.end(e.length - 1);
+ if (i > this._config.liveBufferLatencyMaxLatency && i - t > this._config.liveBufferLatencyMaxLatency) {
+ var n = i - this._config.liveBufferLatencyMinRemain;
+ this.currentTime = n
+ }
+ }
+ if (this._config.lazyLoad && !this._config.isLive) {
+ for (var r = 0, a = 0; a < e.length; a++) {
+ var s = e.start(a),
+ o = e.end(a);
+ if (s <= t && t < o) {
+ r = o;
+ break
+ }
+ }
+ r >= t + this._config.lazyLoadMaxDuration && null == this._progressChecker && (d.a.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), this._suspendTransmuxer())
+ }
+ }, e.prototype._onmseBufferFull = function() {
+ d.a.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task"), null == this._progressChecker && this._suspendTransmuxer()
+ }, e.prototype._suspendTransmuxer = function() {
+ this._transmuxer && (this._transmuxer.pause(), null == this._progressChecker && (this._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3)))
+ }, e.prototype._checkProgressAndResume = function() {
+ for (var e = this._mediaElement.currentTime, t = this._mediaElement.buffered, i = !1, n = 0; n < t.length; n++) {
+ var r = t.start(n),
+ a = t.end(n);
+ if (e >= r && e < a) {
+ e >= a - this._config.lazyLoadRecoverDuration && (i = !0);
+ break
+ }
+ }
+ i && (window.clearInterval(this._progressChecker), this._progressChecker = null, i && (d.a.v(this.TAG, "Continue loading from paused position"), this._transmuxer.resume()))
+ }, e.prototype._isTimepointBuffered = function(e) {
+ for (var t = this._mediaElement.buffered, i = 0; i < t.length; i++) {
+ var n = t.start(i),
+ r = t.end(i);
+ if (e >= n && e < r) return !0
+ }
+ return !1
+ }, e.prototype._internalSeek = function(e) {
+ var t = this._isTimepointBuffered(e),
+ i = !1,
+ n = 0;
+ if (e < 1 && this._mediaElement.buffered.length > 0) {
+ var r = this._mediaElement.buffered.start(0);
+ (r < 1 && e < r || c.a.safari) && (i = !0, n = c.a.safari ? .1 : r)
+ }
+ if (i) this._requestSetTime = !0, this._mediaElement.currentTime = n;
+ else if (t) {
+ if (this._alwaysSeekKeyframe) {
+ var a = this._msectl.getNearestKeyframe(Math.floor(1e3 * e));
+ this._requestSetTime = !0, this._mediaElement.currentTime = null != a ? a.dts / 1e3 : e
+ } else this._requestSetTime = !0, this._mediaElement.currentTime = e;
+ null != this._progressChecker && this._checkProgressAndResume()
+ } else null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e)
+ }, e.prototype._checkAndApplyUnbufferedSeekpoint = function() {
+ if (this._seekpointRecord)
+ if (this._seekpointRecord.recordTime <= this._now() - 100) {
+ var e = this._mediaElement.currentTime;
+ this._seekpointRecord = null, this._isTimepointBuffered(e) || (null != this._progressChecker && (window.clearTimeout(this._progressChecker), this._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e))
+ } else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
+ }, e.prototype._checkAndResumeStuckPlayback = function(e) {
+ var t = this._mediaElement;
+ if (e || !this._receivedCanPlay || t.readyState < 2) {
+ var i = t.buffered;
+ i.length > 0 && t.currentTime < i.start(0) && (d.a.w(this.TAG, "Playback seems stuck at " + t.currentTime + ", seek to " + i.start(0)), this._requestSetTime = !0, this._mediaElement.currentTime = i.start(0), this._mediaElement.removeEventListener("progress", this.e.onvProgress))
+ } else this._mediaElement.removeEventListener("progress", this.e.onvProgress)
+ }, e.prototype._onvLoadedMetadata = function(e) {
+ null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this._pendingSeekTime = null)
+ }, e.prototype._onvSeeking = function(e) {
+ var t = this._mediaElement.currentTime,
+ i = this._mediaElement.buffered;
+ if (this._requestSetTime) this._requestSetTime = !1;
+ else {
+ if (t < 1 && i.length > 0) {
+ var n = i.start(0);
+ if (n < 1 && t < n || c.a.safari) return this._requestSetTime = !0, void(this._mediaElement.currentTime = c.a.safari ? .1 : n)
+ }
+ if (this._isTimepointBuffered(t)) {
+ if (this._alwaysSeekKeyframe) {
+ var r = this._msectl.getNearestKeyframe(Math.floor(1e3 * t));
+ null != r && (this._requestSetTime = !0, this._mediaElement.currentTime = r.dts / 1e3)
+ }
+ null != this._progressChecker && this._checkProgressAndResume()
+ } else this._seekpointRecord = {
+ seekPoint: t,
+ recordTime: this._now()
+ }, window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
+ }
+ }, e.prototype._onvCanPlay = function(e) {
+ this._receivedCanPlay = !0, this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay)
+ }, e.prototype._onvStalled = function(e) {
+ this._checkAndResumeStuckPlayback(!0)
+ }, e.prototype._onvProgress = function(e) {
+ this._checkAndResumeStuckPlayback()
+ }, e
+ }(),
+ R = function() {
+ function e(e, t) {
+ this.TAG = "NativePlayer", this._type = "NativePlayer", this._emitter = new h.a, this._config = s(), "object" == typeof t && Object.assign(this._config, t);
+ var i = e.type.toLowerCase();
+ if ("mse" === i || "mpegts" === i || "m2ts" === i || "flv" === i) throw new C.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");
+ if (e.hasOwnProperty("segments")) throw new C.b("NativePlayer(" + e.type + ") doesn't support multipart playback!");
+ this.e = {
+ onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
+ }, this._pendingSeekTime = null, this._statisticsReporter = null, this._mediaDataSource = e, this._mediaElement = null
+ }
+ return e.prototype.destroy = function() {
+ this._mediaElement && (this.unload(), this.detachMediaElement()), this.e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ var i = this;
+ e === f.MEDIA_INFO ? null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise.resolve().then((function() {
+ i._emitter.emit(f.MEDIA_INFO, i.mediaInfo)
+ })) : e === f.STATISTICS_INFO && null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise.resolve().then((function() {
+ i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo)
+ })), this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), null != this._pendingSeekTime) try {
+ e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
+ } catch (e) {}
+ }, e.prototype.detachMediaElement = function() {
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement = null), null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype.load = function() {
+ if (!this._mediaElement) throw new C.a("HTMLMediaElement must be attached before load()!");
+ this._mediaElement.src = this._mediaDataSource.url, this._mediaElement.readyState > 0 && (this._mediaElement.currentTime = 0), this._mediaElement.preload = "auto", this._mediaElement.load(), this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval)
+ }, e.prototype.unload = function() {
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src")), null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype.play = function() {
+ return this._mediaElement.play()
+ }, e.prototype.pause = function() {
+ this._mediaElement.pause()
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "buffered", {
+ get: function() {
+ return this._mediaElement.buffered
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "duration", {
+ get: function() {
+ return this._mediaElement.duration
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "volume", {
+ get: function() {
+ return this._mediaElement.volume
+ },
+ set: function(e) {
+ this._mediaElement.volume = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "muted", {
+ get: function() {
+ return this._mediaElement.muted
+ },
+ set: function(e) {
+ this._mediaElement.muted = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentTime", {
+ get: function() {
+ return this._mediaElement ? this._mediaElement.currentTime : 0
+ },
+ set: function(e) {
+ this._mediaElement ? this._mediaElement.currentTime = e : this._pendingSeekTime = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "mediaInfo", {
+ get: function() {
+ var e = {
+ mimeType: (this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/") + this._mediaDataSource.type
+ };
+ return this._mediaElement && (e.duration = Math.floor(1e3 * this._mediaElement.duration), this._mediaElement instanceof HTMLVideoElement && (e.width = this._mediaElement.videoWidth, e.height = this._mediaElement.videoHeight)), e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "statisticsInfo", {
+ get: function() {
+ var e = {
+ playerType: this._type,
+ url: this._mediaDataSource.url
+ };
+ if (!(this._mediaElement instanceof HTMLVideoElement)) return e;
+ var t = !0,
+ i = 0,
+ n = 0;
+ if (this._mediaElement.getVideoPlaybackQuality) {
+ var r = this._mediaElement.getVideoPlaybackQuality();
+ i = r.totalVideoFrames, n = r.droppedVideoFrames
+ } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement.webkitDecodedFrameCount, n = this._mediaElement.webkitDroppedFrameCount) : t = !1;
+ return t && (e.decodedFrames = i, e.droppedFrames = n), e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._onvLoadedMetadata = function(e) {
+ null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this._pendingSeekTime = null), this._emitter.emit(f.MEDIA_INFO, this.mediaInfo)
+ }, e.prototype._reportStatisticsInfo = function() {
+ this._emitter.emit(f.STATISTICS_INFO, this.statisticsInfo)
+ }, e
+ }();
+ n.a.install();
+ var D = {
+ createPlayer: function(e, t) {
+ var i = e;
+ if (null == i || "object" != typeof i) throw new C.b("MediaDataSource must be an javascript object!");
+ if (!i.hasOwnProperty("type")) throw new C.b("MediaDataSource must has type field to indicate video file type!");
+ switch (i.type) {
+ case "mse":
+ case "mpegts":
+ case "m2ts":
+ case "flv":
+ return new x(i, t);
+ default:
+ return new R(i, t)
+ }
+ },
+ isSupported: function() {
+ return o.supportMSEH264Playback()
+ },
+ getFeatureList: function() {
+ return o.getFeatureList()
+ }
+ };
+ D.BaseLoader = u.a, D.LoaderStatus = u.c, D.LoaderErrors = u.b, D.Events = f, D.ErrorTypes = I, D.ErrorDetails = L, D.MSEPlayer = x, D.NativePlayer = R, D.LoggingControl = _.a, Object.defineProperty(D, "version", {
+ enumerable: !0,
+ get: function() {
+ return "1.6.10"
+ }
+ }), t.default = D
+ }])
+ }, "object" == typeof i && "object" == typeof t ? t.exports = r() : "function" == typeof define && define.amd ? define([], r) : "object" == typeof i ? i.mpegts = r() : n.mpegts = r()
+ }, {}],
+ 42: [function(e, t, i) {
+ var n = Math.pow(2, 32);
+ t.exports = function(e) {
+ var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ i = {
+ version: e[0],
+ flags: new Uint8Array(e.subarray(1, 4)),
+ references: [],
+ referenceId: t.getUint32(4),
+ timescale: t.getUint32(8)
+ },
+ r = 12;
+ 0 === i.version ? (i.earliestPresentationTime = t.getUint32(r), i.firstOffset = t.getUint32(r + 4), r += 8) : (i.earliestPresentationTime = t.getUint32(r) * n + t.getUint32(r + 4), i.firstOffset = t.getUint32(r + 8) * n + t.getUint32(r + 12), r += 16), r += 2;
+ var a = t.getUint16(r);
+ for (r += 2; a > 0; r += 12, a--) i.references.push({
+ referenceType: (128 & e[r]) >>> 7,
+ referencedSize: 2147483647 & t.getUint32(r),
+ subsegmentDuration: t.getUint32(r + 4),
+ startsWithSap: !!(128 & e[r + 8]),
+ sapType: (112 & e[r + 8]) >>> 4,
+ sapDeltaTime: 268435455 & t.getUint32(r + 8)
+ });
+ return i
+ }
+ }, {}],
+ 43: [function(e, t, i) {
+ var n, r, a, s, o, u, l;
+ n = function(e) {
+ return 9e4 * e
+ }, r = function(e, t) {
+ return e * t
+ }, a = function(e) {
+ return e / 9e4
+ }, s = function(e, t) {
+ return e / t
+ }, o = function(e, t) {
+ return n(s(e, t))
+ }, u = function(e, t) {
+ return r(a(e), t)
+ }, l = function(e, t, i) {
+ return a(i ? e : e - t)
+ }, t.exports = {
+ ONE_SECOND_IN_TS: 9e4,
+ secondsToVideoTs: n,
+ secondsToAudioTs: r,
+ videoTsToSeconds: a,
+ audioTsToSeconds: s,
+ audioTsToVideoTs: o,
+ videoTsToAudioTs: u,
+ metadataTsToSeconds: l
+ }
+ }, {}],
+ 44: [function(e, t, i) {
+ var n, r, a = t.exports = {};
+
+ function s() {
+ throw new Error("setTimeout has not been defined")
+ }
+
+ function o() {
+ throw new Error("clearTimeout has not been defined")
+ }
+
+ function u(e) {
+ if (n === setTimeout) return setTimeout(e, 0);
+ if ((n === s || !n) && setTimeout) return n = setTimeout, setTimeout(e, 0);
+ try {
+ return n(e, 0)
+ } catch (t) {
+ try {
+ return n.call(null, e, 0)
+ } catch (t) {
+ return n.call(this, e, 0)
+ }
+ }
+ }! function() {
+ try {
+ n = "function" == typeof setTimeout ? setTimeout : s
+ } catch (e) {
+ n = s
+ }
+ try {
+ r = "function" == typeof clearTimeout ? clearTimeout : o
+ } catch (e) {
+ r = o
+ }
+ }();
+ var l, h = [],
+ d = !1,
+ c = -1;
+
+ function f() {
+ d && l && (d = !1, l.length ? h = l.concat(h) : c = -1, h.length && p())
+ }
+
+ function p() {
+ if (!d) {
+ var e = u(f);
+ d = !0;
+ for (var t = h.length; t;) {
+ for (l = h, h = []; ++c < t;) l && l[c].run();
+ c = -1, t = h.length
+ }
+ l = null, d = !1,
+ function(e) {
+ if (r === clearTimeout) return clearTimeout(e);
+ if ((r === o || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e);
+ try {
+ r(e)
+ } catch (t) {
+ try {
+ return r.call(null, e)
+ } catch (t) {
+ return r.call(this, e)
+ }
+ }
+ }(e)
+ }
+ }
+
+ function m(e, t) {
+ this.fun = e, this.array = t
+ }
+
+ function _() {}
+ a.nextTick = function(e) {
+ var t = new Array(arguments.length - 1);
+ if (arguments.length > 1)
+ for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i];
+ h.push(new m(e, t)), 1 !== h.length || d || u(p)
+ }, m.prototype.run = function() {
+ this.fun.apply(null, this.array)
+ }, a.title = "browser", a.browser = !0, a.env = {}, a.argv = [], a.version = "", a.versions = {}, a.on = _, a.addListener = _, a.once = _, a.off = _, a.removeListener = _, a.removeAllListeners = _, a.emit = _, a.prependListener = _, a.prependOnceListener = _, a.listeners = function(e) {
+ return []
+ }, a.binding = function(e) {
+ throw new Error("process.binding is not supported")
+ }, a.cwd = function() {
+ return "/"
+ }, a.chdir = function(e) {
+ throw new Error("process.chdir is not supported")
+ }, a.umask = function() {
+ return 0
+ }
+ }, {}],
+ 45: [function(e, t, i) {
+ t.exports = function(e, t) {
+ var i, n = null;
+ try {
+ i = JSON.parse(e, t)
+ } catch (e) {
+ n = e
+ }
+ return [n, i]
+ }
+ }, {}],
+ 46: [function(e, t, i) {
+ var n, r, a, s, o, u;
+ n = this, r = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/, a = /^([^\/?#]*)([^]*)$/, s = /(?:\/|^)\.(?=\/)/g, o = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, u = {
+ buildAbsoluteURL: function(e, t, i) {
+ if (i = i || {}, e = e.trim(), !(t = t.trim())) {
+ if (!i.alwaysNormalize) return e;
+ var n = u.parseURL(e);
+ if (!n) throw new Error("Error trying to parse base URL.");
+ return n.path = u.normalizePath(n.path), u.buildURLFromParts(n)
+ }
+ var r = u.parseURL(t);
+ if (!r) throw new Error("Error trying to parse relative URL.");
+ if (r.scheme) return i.alwaysNormalize ? (r.path = u.normalizePath(r.path), u.buildURLFromParts(r)) : t;
+ var s = u.parseURL(e);
+ if (!s) throw new Error("Error trying to parse base URL.");
+ if (!s.netLoc && s.path && "/" !== s.path[0]) {
+ var o = a.exec(s.path);
+ s.netLoc = o[1], s.path = o[2]
+ }
+ s.netLoc && !s.path && (s.path = "/");
+ var l = {
+ scheme: s.scheme,
+ netLoc: r.netLoc,
+ path: null,
+ params: r.params,
+ query: r.query,
+ fragment: r.fragment
+ };
+ if (!r.netLoc && (l.netLoc = s.netLoc, "/" !== r.path[0]))
+ if (r.path) {
+ var h = s.path,
+ d = h.substring(0, h.lastIndexOf("/") + 1) + r.path;
+ l.path = u.normalizePath(d)
+ } else l.path = s.path, r.params || (l.params = s.params, r.query || (l.query = s.query));
+ return null === l.path && (l.path = i.alwaysNormalize ? u.normalizePath(r.path) : r.path), u.buildURLFromParts(l)
+ },
+ parseURL: function(e) {
+ var t = r.exec(e);
+ return t ? {
+ scheme: t[1] || "",
+ netLoc: t[2] || "",
+ path: t[3] || "",
+ params: t[4] || "",
+ query: t[5] || "",
+ fragment: t[6] || ""
+ } : null
+ },
+ normalizePath: function(e) {
+ for (e = e.split("").reverse().join("").replace(s, ""); e.length !== (e = e.replace(o, "")).length;);
+ return e.split("").reverse().join("")
+ },
+ buildURLFromParts: function(e) {
+ return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment
+ }
+ }, "object" == typeof i && "object" == typeof t ? t.exports = u : "function" == typeof define && define.amd ? define([], (function() {
+ return u
+ })) : "object" == typeof i ? i.URLToolkit = u : n.URLToolkit = u
+ }, {}],
+ 47: [function(e, t, i) {
+ /**
+ * @license
+ * Video.js 7.15.4 <http://videojs.com/>
+ * Copyright Brightcove, Inc. <https://www.brightcove.com/>
+ * Available under Apache License Version 2.0
+ * <https://github.com/videojs/video.js/blob/main/LICENSE>
+ *
+ * Includes vtt.js <https://github.com/mozilla/vtt.js>
+ * Available under Apache License Version 2.0
+ * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
+ */
+ "use strict";
+ var n = e("global/window"),
+ r = e("global/document"),
+ a = e("@babel/runtime/helpers/extends"),
+ s = e("@babel/runtime/helpers/assertThisInitialized"),
+ o = e("@babel/runtime/helpers/inheritsLoose"),
+ u = e("safe-json-parse/tuple"),
+ l = e("keycode"),
+ h = e("@videojs/xhr"),
+ d = e("videojs-vtt.js"),
+ c = e("@babel/runtime/helpers/construct"),
+ f = e("@babel/runtime/helpers/inherits"),
+ p = e("@videojs/vhs-utils/cjs/resolve-url.js"),
+ m = e("m3u8-parser"),
+ _ = e("@videojs/vhs-utils/cjs/codecs.js"),
+ g = e("@videojs/vhs-utils/cjs/media-types.js"),
+ v = e("mpd-parser"),
+ y = e("mux.js/lib/tools/parse-sidx"),
+ b = e("@videojs/vhs-utils/cjs/id3-helpers"),
+ S = e("@videojs/vhs-utils/cjs/containers"),
+ T = e("@videojs/vhs-utils/cjs/byte-helpers"),
+ E = e("mux.js/lib/utils/clock");
+
+ function w(e) {
+ return e && "object" == typeof e && "default" in e ? e : {
+ default: e
+ }
+ }
+ for (var A, C = w(n), k = w(r), P = w(a), I = w(s), L = w(o), x = w(u), R = w(l), D = w(h), O = w(d), U = w(c), M = w(f), F = w(p), B = w(y), N = {}, j = function(e, t) {
+ return N[e] = N[e] || [], t && (N[e] = N[e].concat(t)), N[e]
+ }, V = function(e, t) {
+ var i = j(e).indexOf(t);
+ return !(i <= -1) && (N[e] = N[e].slice(), N[e].splice(i, 1), !0)
+ }, H = {
+ prefixed: !0
+ }, z = [
+ ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
+ ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
+ ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
+ ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
+ ], G = z[0], W = 0; W < z.length; W++)
+ if (z[W][1] in k.default) {
+ A = z[W];
+ break
+ } if (A) {
+ for (var Y = 0; Y < A.length; Y++) H[G[Y]] = A[Y];
+ H.prefixed = A[0] !== G[0]
+ }
+ var q = [];
+ var K = function e(t) {
+ var i, n = "info",
+ r = function() {
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
+ i("log", n, t)
+ };
+ return i = function(e, t) {
+ return function(i, n, r) {
+ var a = t.levels[n],
+ s = new RegExp("^(" + a + ")$");
+ if ("log" !== i && r.unshift(i.toUpperCase() + ":"), r.unshift(e + ":"), q) {
+ q.push([].concat(r));
+ var o = q.length - 1e3;
+ q.splice(0, o > 0 ? o : 0)
+ }
+ if (C.default.console) {
+ var u = C.default.console[i];
+ u || "debug" !== i || (u = C.default.console.info || C.default.console.log), u && a && s.test(i) && u[Array.isArray(r) ? "apply" : "call"](C.default.console, r)
+ }
+ }
+ }(t, r), r.createLogger = function(i) {
+ return e(t + ": " + i)
+ }, r.levels = {
+ all: "debug|log|warn|error",
+ off: "",
+ debug: "debug|log|warn|error",
+ info: "log|warn|error",
+ warn: "warn|error",
+ error: "error",
+ DEFAULT: n
+ }, r.level = function(e) {
+ if ("string" == typeof e) {
+ if (!r.levels.hasOwnProperty(e)) throw new Error('"' + e + '" in not a valid log level');
+ n = e
+ }
+ return n
+ }, (r.history = function() {
+ return q ? [].concat(q) : []
+ }).filter = function(e) {
+ return (q || []).filter((function(t) {
+ return new RegExp(".*" + e + ".*").test(t[0])
+ }))
+ }, r.history.clear = function() {
+ q && (q.length = 0)
+ }, r.history.disable = function() {
+ null !== q && (q.length = 0, q = null)
+ }, r.history.enable = function() {
+ null === q && (q = [])
+ }, r.error = function() {
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
+ return i("error", n, t)
+ }, r.warn = function() {
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
+ return i("warn", n, t)
+ }, r.debug = function() {
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r];
+ return i("debug", n, t)
+ }, r
+ }("VIDEOJS"),
+ X = K.createLogger,
+ Q = Object.prototype.toString,
+ $ = function(e) {
+ return ee(e) ? Object.keys(e) : []
+ };
+
+ function J(e, t) {
+ $(e).forEach((function(i) {
+ return t(e[i], i)
+ }))
+ }
+
+ function Z(e) {
+ for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) i[n - 1] = arguments[n];
+ return Object.assign ? P.default.apply(void 0, [e].concat(i)) : (i.forEach((function(t) {
+ t && J(t, (function(t, i) {
+ e[i] = t
+ }))
+ })), e)
+ }
+
+ function ee(e) {
+ return !!e && "object" == typeof e
+ }
+
+ function te(e) {
+ return ee(e) && "[object Object]" === Q.call(e) && e.constructor === Object
+ }
+
+ function ie(e, t) {
+ if (!e || !t) return "";
+ if ("function" == typeof C.default.getComputedStyle) {
+ var i;
+ try {
+ i = C.default.getComputedStyle(e)
+ } catch (e) {
+ return ""
+ }
+ return i ? i.getPropertyValue(t) || i[t] : ""
+ }
+ return ""
+ }
+ var ne, re = C.default.navigator && C.default.navigator.userAgent || "",
+ ae = /AppleWebKit\/([\d.]+)/i.exec(re),
+ se = ae ? parseFloat(ae.pop()) : null,
+ oe = /iPod/i.test(re),
+ ue = (ne = re.match(/OS (\d+)_/i)) && ne[1] ? ne[1] : null,
+ le = /Android/i.test(re),
+ he = function() {
+ var e = re.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
+ if (!e) return null;
+ var t = e[1] && parseFloat(e[1]),
+ i = e[2] && parseFloat(e[2]);
+ return t && i ? parseFloat(e[1] + "." + e[2]) : t || null
+ }(),
+ de = le && he < 5 && se < 537,
+ ce = /Firefox/i.test(re),
+ fe = /Edg/i.test(re),
+ pe = !fe && (/Chrome/i.test(re) || /CriOS/i.test(re)),
+ me = function() {
+ var e = re.match(/(Chrome|CriOS)\/(\d+)/);
+ return e && e[2] ? parseFloat(e[2]) : null
+ }(),
+ _e = function() {
+ var e = /MSIE\s(\d+)\.\d/.exec(re),
+ t = e && parseFloat(e[1]);
+ return !t && /Trident\/7.0/i.test(re) && /rv:11.0/.test(re) && (t = 11), t
+ }(),
+ ge = /Safari/i.test(re) && !pe && !le && !fe,
+ ve = /Windows/i.test(re),
+ ye = Boolean(ke() && ("ontouchstart" in C.default || C.default.navigator.maxTouchPoints || C.default.DocumentTouch && C.default.document instanceof C.default.DocumentTouch)),
+ be = /iPad/i.test(re) || ge && ye && !/iPhone/i.test(re),
+ Se = /iPhone/i.test(re) && !be,
+ Te = Se || be || oe,
+ Ee = (ge || Te) && !pe,
+ we = Object.freeze({
+ __proto__: null,
+ IS_IPOD: oe,
+ IOS_VERSION: ue,
+ IS_ANDROID: le,
+ ANDROID_VERSION: he,
+ IS_NATIVE_ANDROID: de,
+ IS_FIREFOX: ce,
+ IS_EDGE: fe,
+ IS_CHROME: pe,
+ CHROME_VERSION: me,
+ IE_VERSION: _e,
+ IS_SAFARI: ge,
+ IS_WINDOWS: ve,
+ TOUCH_ENABLED: ye,
+ IS_IPAD: be,
+ IS_IPHONE: Se,
+ IS_IOS: Te,
+ IS_ANY_SAFARI: Ee
+ });
+
+ function Ae(e) {
+ return "string" == typeof e && Boolean(e.trim())
+ }
+
+ function Ce(e) {
+ if (e.indexOf(" ") >= 0) throw new Error("class has illegal whitespace characters")
+ }
+
+ function ke() {
+ return k.default === C.default.document
+ }
+
+ function Pe(e) {
+ return ee(e) && 1 === e.nodeType
+ }
+
+ function Ie() {
+ try {
+ return C.default.parent !== C.default.self
+ } catch (e) {
+ return !0
+ }
+ }
+
+ function Le(e) {
+ return function(t, i) {
+ if (!Ae(t)) return k.default[e](null);
+ Ae(i) && (i = k.default.querySelector(i));
+ var n = Pe(i) ? i : k.default;
+ return n[e] && n[e](t)
+ }
+ }
+
+ function xe(e, t, i, n) {
+ void 0 === e && (e = "div"), void 0 === t && (t = {}), void 0 === i && (i = {});
+ var r = k.default.createElement(e);
+ return Object.getOwnPropertyNames(t).forEach((function(e) {
+ var i = t[e]; - 1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (K.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set " + e + " to " + i + "."), r.setAttribute(e, i)) : "textContent" === e ? Re(r, i) : r[e] === i && "tabIndex" !== e || (r[e] = i)
+ })), Object.getOwnPropertyNames(i).forEach((function(e) {
+ r.setAttribute(e, i[e])
+ })), n && $e(r, n), r
+ }
+
+ function Re(e, t) {
+ return void 0 === e.textContent ? e.innerText = t : e.textContent = t, e
+ }
+
+ function De(e, t) {
+ t.firstChild ? t.insertBefore(e, t.firstChild) : t.appendChild(e)
+ }
+
+ function Oe(e, t) {
+ return Ce(t), e.classList ? e.classList.contains(t) : (i = t, new RegExp("(^|\\s)" + i + "($|\\s)")).test(e.className);
+ var i
+ }
+
+ function Ue(e, t) {
+ return e.classList ? e.classList.add(t) : Oe(e, t) || (e.className = (e.className + " " + t).trim()), e
+ }
+
+ function Me(e, t) {
+ return e ? (e.classList ? e.classList.remove(t) : (Ce(t), e.className = e.className.split(/\s+/).filter((function(e) {
+ return e !== t
+ })).join(" ")), e) : (K.warn("removeClass was called with an element that doesn't exist"), null)
+ }
+
+ function Fe(e, t, i) {
+ var n = Oe(e, t);
+ if ("function" == typeof i && (i = i(e, t)), "boolean" != typeof i && (i = !n), i !== n) return i ? Ue(e, t) : Me(e, t), e
+ }
+
+ function Be(e, t) {
+ Object.getOwnPropertyNames(t).forEach((function(i) {
+ var n = t[i];
+ null == n || !1 === n ? e.removeAttribute(i) : e.setAttribute(i, !0 === n ? "" : n)
+ }))
+ }
+
+ function Ne(e) {
+ var t = {},
+ i = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
+ if (e && e.attributes && e.attributes.length > 0)
+ for (var n = e.attributes, r = n.length - 1; r >= 0; r--) {
+ var a = n[r].name,
+ s = n[r].value;
+ "boolean" != typeof e[a] && -1 === i.indexOf("," + a + ",") || (s = null !== s), t[a] = s
+ }
+ return t
+ }
+
+ function je(e, t) {
+ return e.getAttribute(t)
+ }
+
+ function Ve(e, t, i) {
+ e.setAttribute(t, i)
+ }
+
+ function He(e, t) {
+ e.removeAttribute(t)
+ }
+
+ function ze() {
+ k.default.body.focus(), k.default.onselectstart = function() {
+ return !1
+ }
+ }
+
+ function Ge() {
+ k.default.onselectstart = function() {
+ return !0
+ }
+ }
+
+ function We(e) {
+ if (e && e.getBoundingClientRect && e.parentNode) {
+ var t = e.getBoundingClientRect(),
+ i = {};
+ return ["bottom", "height", "left", "right", "top", "width"].forEach((function(e) {
+ void 0 !== t[e] && (i[e] = t[e])
+ })), i.height || (i.height = parseFloat(ie(e, "height"))), i.width || (i.width = parseFloat(ie(e, "width"))), i
+ }
+ }
+
+ function Ye(e) {
+ if (!e || e && !e.offsetParent) return {
+ left: 0,
+ top: 0,
+ width: 0,
+ height: 0
+ };
+ for (var t = e.offsetWidth, i = e.offsetHeight, n = 0, r = 0; e.offsetParent && e !== k.default[H.fullscreenElement];) n += e.offsetLeft, r += e.offsetTop, e = e.offsetParent;
+ return {
+ left: n,
+ top: r,
+ width: t,
+ height: i
+ }
+ }
+
+ function qe(e, t) {
+ var i = {
+ x: 0,
+ y: 0
+ };
+ if (Te)
+ for (var n = e; n && "html" !== n.nodeName.toLowerCase();) {
+ var r = ie(n, "transform");
+ if (/^matrix/.test(r)) {
+ var a = r.slice(7, -1).split(/,\s/).map(Number);
+ i.x += a[4], i.y += a[5]
+ } else if (/^matrix3d/.test(r)) {
+ var s = r.slice(9, -1).split(/,\s/).map(Number);
+ i.x += s[12], i.y += s[13]
+ }
+ n = n.parentNode
+ }
+ var o = {},
+ u = Ye(t.target),
+ l = Ye(e),
+ h = l.width,
+ d = l.height,
+ c = t.offsetY - (l.top - u.top),
+ f = t.offsetX - (l.left - u.left);
+ return t.changedTouches && (f = t.changedTouches[0].pageX - l.left, c = t.changedTouches[0].pageY + l.top, Te && (f -= i.x, c -= i.y)), o.y = 1 - Math.max(0, Math.min(1, c / d)), o.x = Math.max(0, Math.min(1, f / h)), o
+ }
+
+ function Ke(e) {
+ return ee(e) && 3 === e.nodeType
+ }
+
+ function Xe(e) {
+ for (; e.firstChild;) e.removeChild(e.firstChild);
+ return e
+ }
+
+ function Qe(e) {
+ return "function" == typeof e && (e = e()), (Array.isArray(e) ? e : [e]).map((function(e) {
+ return "function" == typeof e && (e = e()), Pe(e) || Ke(e) ? e : "string" == typeof e && /\S/.test(e) ? k.default.createTextNode(e) : void 0
+ })).filter((function(e) {
+ return e
+ }))
+ }
+
+ function $e(e, t) {
+ return Qe(t).forEach((function(t) {
+ return e.appendChild(t)
+ })), e
+ }
+
+ function Je(e, t) {
+ return $e(Xe(e), t)
+ }
+
+ function Ze(e) {
+ return void 0 === e.button && void 0 === e.buttons || (0 === e.button && void 0 === e.buttons || ("mouseup" === e.type && 0 === e.button && 0 === e.buttons || 0 === e.button && 1 === e.buttons))
+ }
+ var et, tt = Le("querySelector"),
+ it = Le("querySelectorAll"),
+ nt = Object.freeze({
+ __proto__: null,
+ isReal: ke,
+ isEl: Pe,
+ isInFrame: Ie,
+ createEl: xe,
+ textContent: Re,
+ prependTo: De,
+ hasClass: Oe,
+ addClass: Ue,
+ removeClass: Me,
+ toggleClass: Fe,
+ setAttributes: Be,
+ getAttributes: Ne,
+ getAttribute: je,
+ setAttribute: Ve,
+ removeAttribute: He,
+ blockTextSelection: ze,
+ unblockTextSelection: Ge,
+ getBoundingClientRect: We,
+ findPosition: Ye,
+ getPointerPosition: qe,
+ isTextNode: Ke,
+ emptyEl: Xe,
+ normalizeContent: Qe,
+ appendContent: $e,
+ insertContent: Je,
+ isSingleLeftClick: Ze,
+ $: tt,
+ $$: it
+ }),
+ rt = !1,
+ at = function() {
+ if (!1 !== et.options.autoSetup) {
+ var e = Array.prototype.slice.call(k.default.getElementsByTagName("video")),
+ t = Array.prototype.slice.call(k.default.getElementsByTagName("audio")),
+ i = Array.prototype.slice.call(k.default.getElementsByTagName("video-js")),
+ n = e.concat(t, i);
+ if (n && n.length > 0)
+ for (var r = 0, a = n.length; r < a; r++) {
+ var s = n[r];
+ if (!s || !s.getAttribute) {
+ st(1);
+ break
+ }
+ void 0 === s.player && null !== s.getAttribute("data-setup") && et(s)
+ } else rt || st(1)
+ }
+ };
+
+ function st(e, t) {
+ ke() && (t && (et = t), C.default.setTimeout(at, e))
+ }
+
+ function ot() {
+ rt = !0, C.default.removeEventListener("load", ot)
+ }
+ ke() && ("complete" === k.default.readyState ? ot() : C.default.addEventListener("load", ot));
+ var ut, lt = function(e) {
+ var t = k.default.createElement("style");
+ return t.className = e, t
+ },
+ ht = function(e, t) {
+ e.styleSheet ? e.styleSheet.cssText = t : e.textContent = t
+ },
+ dt = 3;
+
+ function ct() {
+ return dt++
+ }
+ C.default.WeakMap || (ut = function() {
+ function e() {
+ this.vdata = "vdata" + Math.floor(C.default.performance && C.default.performance.now() || Date.now()), this.data = {}
+ }
+ var t = e.prototype;
+ return t.set = function(e, t) {
+ var i = e[this.vdata] || ct();
+ return e[this.vdata] || (e[this.vdata] = i), this.data[i] = t, this
+ }, t.get = function(e) {
+ var t = e[this.vdata];
+ if (t) return this.data[t];
+ K("We have no data for this element", e)
+ }, t.has = function(e) {
+ return e[this.vdata] in this.data
+ }, t.delete = function(e) {
+ var t = e[this.vdata];
+ t && (delete this.data[t], delete e[this.vdata])
+ }, e
+ }());
+ var ft, pt = C.default.WeakMap ? new WeakMap : new ut;
+
+ function mt(e, t) {
+ if (pt.has(e)) {
+ var i = pt.get(e);
+ 0 === i.handlers[t].length && (delete i.handlers[t], e.removeEventListener ? e.removeEventListener(t, i.dispatcher, !1) : e.detachEvent && e.detachEvent("on" + t, i.dispatcher)), Object.getOwnPropertyNames(i.handlers).length <= 0 && (delete i.handlers, delete i.dispatcher, delete i.disabled), 0 === Object.getOwnPropertyNames(i).length && pt.delete(e)
+ }
+ }
+
+ function _t(e, t, i, n) {
+ i.forEach((function(i) {
+ e(t, i, n)
+ }))
+ }
+
+ function gt(e) {
+ if (e.fixed_) return e;
+
+ function t() {
+ return !0
+ }
+
+ function i() {
+ return !1
+ }
+ if (!e || !e.isPropagationStopped || !e.isImmediatePropagationStopped) {
+ var n = e || C.default.event;
+ for (var r in e = {}, n) "layerX" !== r && "layerY" !== r && "keyLocation" !== r && "webkitMovementX" !== r && "webkitMovementY" !== r && ("returnValue" === r && n.preventDefault || (e[r] = n[r]));
+ if (e.target || (e.target = e.srcElement || k.default), e.relatedTarget || (e.relatedTarget = e.fromElement === e.target ? e.toElement : e.fromElement), e.preventDefault = function() {
+ n.preventDefault && n.preventDefault(), e.returnValue = !1, n.returnValue = !1, e.defaultPrevented = !0
+ }, e.defaultPrevented = !1, e.stopPropagation = function() {
+ n.stopPropagation && n.stopPropagation(), e.cancelBubble = !0, n.cancelBubble = !0, e.isPropagationStopped = t
+ }, e.isPropagationStopped = i, e.stopImmediatePropagation = function() {
+ n.stopImmediatePropagation && n.stopImmediatePropagation(), e.isImmediatePropagationStopped = t, e.stopPropagation()
+ }, e.isImmediatePropagationStopped = i, null !== e.clientX && void 0 !== e.clientX) {
+ var a = k.default.documentElement,
+ s = k.default.body;
+ e.pageX = e.clientX + (a && a.scrollLeft || s && s.scrollLeft || 0) - (a && a.clientLeft || s && s.clientLeft || 0), e.pageY = e.clientY + (a && a.scrollTop || s && s.scrollTop || 0) - (a && a.clientTop || s && s.clientTop || 0)
+ }
+ e.which = e.charCode || e.keyCode, null !== e.button && void 0 !== e.button && (e.button = 1 & e.button ? 0 : 4 & e.button ? 1 : 2 & e.button ? 2 : 0)
+ }
+ return e.fixed_ = !0, e
+ }
+ var vt = ["touchstart", "touchmove"];
+
+ function yt(e, t, i) {
+ if (Array.isArray(t)) return _t(yt, e, t, i);
+ pt.has(e) || pt.set(e, {});
+ var n = pt.get(e);
+ if (n.handlers || (n.handlers = {}), n.handlers[t] || (n.handlers[t] = []), i.guid || (i.guid = ct()), n.handlers[t].push(i), n.dispatcher || (n.disabled = !1, n.dispatcher = function(t, i) {
+ if (!n.disabled) {
+ t = gt(t);
+ var r = n.handlers[t.type];
+ if (r)
+ for (var a = r.slice(0), s = 0, o = a.length; s < o && !t.isImmediatePropagationStopped(); s++) try {
+ a[s].call(e, t, i)
+ } catch (e) {
+ K.error(e)
+ }
+ }
+ }), 1 === n.handlers[t].length)
+ if (e.addEventListener) {
+ var r = !1;
+ (function() {
+ if ("boolean" != typeof ft) {
+ ft = !1;
+ try {
+ var e = Object.defineProperty({}, "passive", {
+ get: function() {
+ ft = !0
+ }
+ });
+ C.default.addEventListener("test", null, e), C.default.removeEventListener("test", null, e)
+ } catch (e) {}
+ }
+ return ft
+ })() && vt.indexOf(t) > -1 && (r = {
+ passive: !0
+ }), e.addEventListener(t, n.dispatcher, r)
+ } else e.attachEvent && e.attachEvent("on" + t, n.dispatcher)
+ }
+
+ function bt(e, t, i) {
+ if (pt.has(e)) {
+ var n = pt.get(e);
+ if (n.handlers) {
+ if (Array.isArray(t)) return _t(bt, e, t, i);
+ var r = function(e, t) {
+ n.handlers[t] = [], mt(e, t)
+ };
+ if (void 0 !== t) {
+ var a = n.handlers[t];
+ if (a)
+ if (i) {
+ if (i.guid)
+ for (var s = 0; s < a.length; s++) a[s].guid === i.guid && a.splice(s--, 1);
+ mt(e, t)
+ } else r(e, t)
+ } else
+ for (var o in n.handlers) Object.prototype.hasOwnProperty.call(n.handlers || {}, o) && r(e, o)
+ }
+ }
+ }
+
+ function St(e, t, i) {
+ var n = pt.has(e) ? pt.get(e) : {},
+ r = e.parentNode || e.ownerDocument;
+ if ("string" == typeof t ? t = {
+ type: t,
+ target: e
+ } : t.target || (t.target = e), t = gt(t), n.dispatcher && n.dispatcher.call(e, t, i), r && !t.isPropagationStopped() && !0 === t.bubbles) St.call(null, r, t, i);
+ else if (!r && !t.defaultPrevented && t.target && t.target[t.type]) {
+ pt.has(t.target) || pt.set(t.target, {});
+ var a = pt.get(t.target);
+ t.target[t.type] && (a.disabled = !0, "function" == typeof t.target[t.type] && t.target[t.type](), a.disabled = !1)
+ }
+ return !t.defaultPrevented
+ }
+
+ function Tt(e, t, i) {
+ if (Array.isArray(t)) return _t(Tt, e, t, i);
+ var n = function n() {
+ bt(e, t, n), i.apply(this, arguments)
+ };
+ n.guid = i.guid = i.guid || ct(), yt(e, t, n)
+ }
+
+ function Et(e, t, i) {
+ var n = function n() {
+ bt(e, t, n), i.apply(this, arguments)
+ };
+ n.guid = i.guid = i.guid || ct(), yt(e, t, n)
+ }
+ var wt, At = Object.freeze({
+ __proto__: null,
+ fixEvent: gt,
+ on: yt,
+ off: bt,
+ trigger: St,
+ one: Tt,
+ any: Et
+ }),
+ Ct = function(e, t, i) {
+ t.guid || (t.guid = ct());
+ var n = t.bind(e);
+ return n.guid = i ? i + "_" + t.guid : t.guid, n
+ },
+ kt = function(e, t) {
+ var i = C.default.performance.now();
+ return function() {
+ var n = C.default.performance.now();
+ n - i >= t && (e.apply(void 0, arguments), i = n)
+ }
+ },
+ Pt = function() {};
+ Pt.prototype.allowedEvents_ = {}, Pt.prototype.on = function(e, t) {
+ var i = this.addEventListener;
+ this.addEventListener = function() {}, yt(this, e, t), this.addEventListener = i
+ }, Pt.prototype.addEventListener = Pt.prototype.on, Pt.prototype.off = function(e, t) {
+ bt(this, e, t)
+ }, Pt.prototype.removeEventListener = Pt.prototype.off, Pt.prototype.one = function(e, t) {
+ var i = this.addEventListener;
+ this.addEventListener = function() {}, Tt(this, e, t), this.addEventListener = i
+ }, Pt.prototype.any = function(e, t) {
+ var i = this.addEventListener;
+ this.addEventListener = function() {}, Et(this, e, t), this.addEventListener = i
+ }, Pt.prototype.trigger = function(e) {
+ var t = e.type || e;
+ "string" == typeof e && (e = {
+ type: t
+ }), e = gt(e), this.allowedEvents_[t] && this["on" + t] && this["on" + t](e), St(this, e)
+ }, Pt.prototype.dispatchEvent = Pt.prototype.trigger, Pt.prototype.queueTrigger = function(e) {
+ var t = this;
+ wt || (wt = new Map);
+ var i = e.type || e,
+ n = wt.get(this);
+ n || (n = new Map, wt.set(this, n));
+ var r = n.get(i);
+ n.delete(i), C.default.clearTimeout(r);
+ var a = C.default.setTimeout((function() {
+ 0 === n.size && (n = null, wt.delete(t)), t.trigger(e)
+ }), 0);
+ n.set(i, a)
+ };
+ var It = function(e) {
+ return "function" == typeof e.name ? e.name() : "string" == typeof e.name ? e.name : e.name_ ? e.name_ : e.constructor && e.constructor.name ? e.constructor.name : typeof e
+ },
+ Lt = function(e) {
+ return e instanceof Pt || !!e.eventBusEl_ && ["on", "one", "off", "trigger"].every((function(t) {
+ return "function" == typeof e[t]
+ }))
+ },
+ xt = function(e) {
+ return "string" == typeof e && /\S/.test(e) || Array.isArray(e) && !!e.length
+ },
+ Rt = function(e, t, i) {
+ if (!e || !e.nodeName && !Lt(e)) throw new Error("Invalid target for " + It(t) + "#" + i + "; must be a DOM node or evented object.")
+ },
+ Dt = function(e, t, i) {
+ if (!xt(e)) throw new Error("Invalid event type for " + It(t) + "#" + i + "; must be a non-empty string or array.")
+ },
+ Ot = function(e, t, i) {
+ if ("function" != typeof e) throw new Error("Invalid listener for " + It(t) + "#" + i + "; must be a function.")
+ },
+ Ut = function(e, t, i) {
+ var n, r, a, s = t.length < 3 || t[0] === e || t[0] === e.eventBusEl_;
+ return s ? (n = e.eventBusEl_, t.length >= 3 && t.shift(), r = t[0], a = t[1]) : (n = t[0], r = t[1], a = t[2]), Rt(n, e, i), Dt(r, e, i), Ot(a, e, i), {
+ isTargetingSelf: s,
+ target: n,
+ type: r,
+ listener: a = Ct(e, a)
+ }
+ },
+ Mt = function(e, t, i, n) {
+ Rt(e, e, t), e.nodeName ? At[t](e, i, n) : e[t](i, n)
+ },
+ Ft = {
+ on: function() {
+ for (var e = this, t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
+ var r = Ut(this, i, "on"),
+ a = r.isTargetingSelf,
+ s = r.target,
+ o = r.type,
+ u = r.listener;
+ if (Mt(s, "on", o, u), !a) {
+ var l = function() {
+ return e.off(s, o, u)
+ };
+ l.guid = u.guid;
+ var h = function() {
+ return e.off("dispose", l)
+ };
+ h.guid = u.guid, Mt(this, "on", "dispose", l), Mt(s, "on", "dispose", h)
+ }
+ },
+ one: function() {
+ for (var e = this, t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
+ var r = Ut(this, i, "one"),
+ a = r.isTargetingSelf,
+ s = r.target,
+ o = r.type,
+ u = r.listener;
+ if (a) Mt(s, "one", o, u);
+ else {
+ var l = function t() {
+ e.off(s, o, t);
+ for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) n[r] = arguments[r];
+ u.apply(null, n)
+ };
+ l.guid = u.guid, Mt(s, "one", o, l)
+ }
+ },
+ any: function() {
+ for (var e = this, t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
+ var r = Ut(this, i, "any"),
+ a = r.isTargetingSelf,
+ s = r.target,
+ o = r.type,
+ u = r.listener;
+ if (a) Mt(s, "any", o, u);
+ else {
+ var l = function t() {
+ e.off(s, o, t);
+ for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) n[r] = arguments[r];
+ u.apply(null, n)
+ };
+ l.guid = u.guid, Mt(s, "any", o, l)
+ }
+ },
+ off: function(e, t, i) {
+ if (!e || xt(e)) bt(this.eventBusEl_, e, t);
+ else {
+ var n = e,
+ r = t;
+ Rt(n, this, "off"), Dt(r, this, "off"), Ot(i, this, "off"), i = Ct(this, i), this.off("dispose", i), n.nodeName ? (bt(n, r, i), bt(n, "dispose", i)) : Lt(n) && (n.off(r, i), n.off("dispose", i))
+ }
+ },
+ trigger: function(e, t) {
+ Rt(this.eventBusEl_, this, "trigger");
+ var i = e && "string" != typeof e ? e.type : e;
+ if (!xt(i)) {
+ var n = "Invalid event type for " + It(this) + "#trigger; must be a non-empty string or object with a type key that has a non-empty value.";
+ if (!e) throw new Error(n);
+ (this.log || K).error(n)
+ }
+ return St(this.eventBusEl_, e, t)
+ }
+ };
+
+ function Bt(e, t) {
+ void 0 === t && (t = {});
+ var i = t.eventBusKey;
+ if (i) {
+ if (!e[i].nodeName) throw new Error('The eventBusKey "' + i + '" does not refer to an element.');
+ e.eventBusEl_ = e[i]
+ } else e.eventBusEl_ = xe("span", {
+ className: "vjs-event-bus"
+ });
+ return Z(e, Ft), e.eventedCallbacks && e.eventedCallbacks.forEach((function(e) {
+ e()
+ })), e.on("dispose", (function() {
+ e.off(), [e, e.el_, e.eventBusEl_].forEach((function(e) {
+ e && pt.has(e) && pt.delete(e)
+ })), C.default.setTimeout((function() {
+ e.eventBusEl_ = null
+ }), 0)
+ })), e
+ }
+ var Nt = {
+ state: {},
+ setState: function(e) {
+ var t, i = this;
+ return "function" == typeof e && (e = e()), J(e, (function(e, n) {
+ i.state[n] !== e && ((t = t || {})[n] = {
+ from: i.state[n],
+ to: e
+ }), i.state[n] = e
+ })), t && Lt(this) && this.trigger({
+ changes: t,
+ type: "statechanged"
+ }), t
+ }
+ };
+
+ function jt(e, t) {
+ return Z(e, Nt), e.state = Z({}, e.state, t), "function" == typeof e.handleStateChanged && Lt(e) && e.on("statechanged", e.handleStateChanged), e
+ }
+ var Vt = function(e) {
+ return "string" != typeof e ? e : e.replace(/./, (function(e) {
+ return e.toLowerCase()
+ }))
+ },
+ Ht = function(e) {
+ return "string" != typeof e ? e : e.replace(/./, (function(e) {
+ return e.toUpperCase()
+ }))
+ };
+
+ function zt() {
+ for (var e = {}, t = arguments.length, i = new Array(t), n = 0; n < t; n++) i[n] = arguments[n];
+ return i.forEach((function(t) {
+ t && J(t, (function(t, i) {
+ te(t) ? (te(e[i]) || (e[i] = {}), e[i] = zt(e[i], t)) : e[i] = t
+ }))
+ })), e
+ }
+ var Gt = function() {
+ function e() {
+ this.map_ = {}
+ }
+ var t = e.prototype;
+ return t.has = function(e) {
+ return e in this.map_
+ }, t.delete = function(e) {
+ var t = this.has(e);
+ return delete this.map_[e], t
+ }, t.set = function(e, t) {
+ return this.map_[e] = t, this
+ }, t.forEach = function(e, t) {
+ for (var i in this.map_) e.call(t, this.map_[i], i, this)
+ }, e
+ }(),
+ Wt = C.default.Map ? C.default.Map : Gt,
+ Yt = function() {
+ function e() {
+ this.set_ = {}
+ }
+ var t = e.prototype;
+ return t.has = function(e) {
+ return e in this.set_
+ }, t.delete = function(e) {
+ var t = this.has(e);
+ return delete this.set_[e], t
+ }, t.add = function(e) {
+ return this.set_[e] = 1, this
+ }, t.forEach = function(e, t) {
+ for (var i in this.set_) e.call(t, i, i, this)
+ }, e
+ }(),
+ qt = C.default.Set ? C.default.Set : Yt,
+ Kt = function() {
+ function e(e, t, i) {
+ if (!e && this.play ? this.player_ = e = this : this.player_ = e, this.isDisposed_ = !1, this.parentComponent_ = null, this.options_ = zt({}, this.options_), t = this.options_ = zt(this.options_, t), this.id_ = t.id || t.el && t.el.id, !this.id_) {
+ var n = e && e.id && e.id() || "no_player";
+ this.id_ = n + "_component_" + ct()
+ }
+ this.name_ = t.name || null, t.el ? this.el_ = t.el : !1 !== t.createEl && (this.el_ = this.createEl()), !1 !== t.evented && (Bt(this, {
+ eventBusKey: this.el_ ? "el_" : null
+ }), this.handleLanguagechange = this.handleLanguagechange.bind(this), this.on(this.player_, "languagechange", this.handleLanguagechange)), jt(this, this.constructor.defaultState), this.children_ = [], this.childIndex_ = {}, this.childNameIndex_ = {}, this.setTimeoutIds_ = new qt, this.setIntervalIds_ = new qt, this.rafIds_ = new qt, this.namedRafs_ = new Wt, this.clearingTimersOnDispose_ = !1, !1 !== t.initChildren && this.initChildren(), this.ready(i), !1 !== t.reportTouchActivity && this.enableTouchActivity()
+ }
+ var t = e.prototype;
+ return t.dispose = function() {
+ if (!this.isDisposed_) {
+ if (this.readyQueue_ && (this.readyQueue_.length = 0), this.trigger({
+ type: "dispose",
+ bubbles: !1
+ }), this.isDisposed_ = !0, this.children_)
+ for (var e = this.children_.length - 1; e >= 0; e--) this.children_[e].dispose && this.children_[e].dispose();
+ this.children_ = null, this.childIndex_ = null, this.childNameIndex_ = null, this.parentComponent_ = null, this.el_ && (this.el_.parentNode && this.el_.parentNode.removeChild(this.el_), this.el_ = null), this.player_ = null
+ }
+ }, t.isDisposed = function() {
+ return Boolean(this.isDisposed_)
+ }, t.player = function() {
+ return this.player_
+ }, t.options = function(e) {
+ return e ? (this.options_ = zt(this.options_, e), this.options_) : this.options_
+ }, t.el = function() {
+ return this.el_
+ }, t.createEl = function(e, t, i) {
+ return xe(e, t, i)
+ }, t.localize = function(e, t, i) {
+ void 0 === i && (i = e);
+ var n = this.player_.language && this.player_.language(),
+ r = this.player_.languages && this.player_.languages(),
+ a = r && r[n],
+ s = n && n.split("-")[0],
+ o = r && r[s],
+ u = i;
+ return a && a[e] ? u = a[e] : o && o[e] && (u = o[e]), t && (u = u.replace(/\{(\d+)\}/g, (function(e, i) {
+ var n = t[i - 1],
+ r = n;
+ return void 0 === n && (r = e), r
+ }))), u
+ }, t.handleLanguagechange = function() {}, t.contentEl = function() {
+ return this.contentEl_ || this.el_
+ }, t.id = function() {
+ return this.id_
+ }, t.name = function() {
+ return this.name_
+ }, t.children = function() {
+ return this.children_
+ }, t.getChildById = function(e) {
+ return this.childIndex_[e]
+ }, t.getChild = function(e) {
+ if (e) return this.childNameIndex_[e]
+ }, t.getDescendant = function() {
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
+ t = t.reduce((function(e, t) {
+ return e.concat(t)
+ }), []);
+ for (var n = this, r = 0; r < t.length; r++)
+ if (!(n = n.getChild(t[r])) || !n.getChild) return;
+ return n
+ }, t.addChild = function(t, i, n) {
+ var r, a;
+ if (void 0 === i && (i = {}), void 0 === n && (n = this.children_.length), "string" == typeof t) {
+ a = Ht(t);
+ var s = i.componentClass || a;
+ i.name = a;
+ var o = e.getComponent(s);
+ if (!o) throw new Error("Component " + s + " does not exist");
+ if ("function" != typeof o) return null;
+ r = new o(this.player_ || this, i)
+ } else r = t;
+ if (r.parentComponent_ && r.parentComponent_.removeChild(r), this.children_.splice(n, 0, r), r.parentComponent_ = this, "function" == typeof r.id && (this.childIndex_[r.id()] = r), (a = a || r.name && Ht(r.name())) && (this.childNameIndex_[a] = r, this.childNameIndex_[Vt(a)] = r), "function" == typeof r.el && r.el()) {
+ var u = null;
+ this.children_[n + 1] && (this.children_[n + 1].el_ ? u = this.children_[n + 1].el_ : Pe(this.children_[n + 1]) && (u = this.children_[n + 1])), this.contentEl().insertBefore(r.el(), u)
+ }
+ return r
+ }, t.removeChild = function(e) {
+ if ("string" == typeof e && (e = this.getChild(e)), e && this.children_) {
+ for (var t = !1, i = this.children_.length - 1; i >= 0; i--)
+ if (this.children_[i] === e) {
+ t = !0, this.children_.splice(i, 1);
+ break
+ } if (t) {
+ e.parentComponent_ = null, this.childIndex_[e.id()] = null, this.childNameIndex_[Ht(e.name())] = null, this.childNameIndex_[Vt(e.name())] = null;
+ var n = e.el();
+ n && n.parentNode === this.contentEl() && this.contentEl().removeChild(e.el())
+ }
+ }
+ }, t.initChildren = function() {
+ var t = this,
+ i = this.options_.children;
+ if (i) {
+ var n, r = this.options_,
+ a = e.getComponent("Tech");
+ (n = Array.isArray(i) ? i : Object.keys(i)).concat(Object.keys(this.options_).filter((function(e) {
+ return !n.some((function(t) {
+ return "string" == typeof t ? e === t : e === t.name
+ }))
+ }))).map((function(e) {
+ var n, r;
+ return "string" == typeof e ? r = i[n = e] || t.options_[n] || {} : (n = e.name, r = e), {
+ name: n,
+ opts: r
+ }
+ })).filter((function(t) {
+ var i = e.getComponent(t.opts.componentClass || Ht(t.name));
+ return i && !a.isTech(i)
+ })).forEach((function(e) {
+ var i = e.name,
+ n = e.opts;
+ if (void 0 !== r[i] && (n = r[i]), !1 !== n) {
+ !0 === n && (n = {}), n.playerOptions = t.options_.playerOptions;
+ var a = t.addChild(i, n);
+ a && (t[i] = a)
+ }
+ }))
+ }
+ }, t.buildCSSClass = function() {
+ return ""
+ }, t.ready = function(e, t) {
+ if (void 0 === t && (t = !1), e) return this.isReady_ ? void(t ? e.call(this) : this.setTimeout(e, 1)) : (this.readyQueue_ = this.readyQueue_ || [], void this.readyQueue_.push(e))
+ }, t.triggerReady = function() {
+ this.isReady_ = !0, this.setTimeout((function() {
+ var e = this.readyQueue_;
+ this.readyQueue_ = [], e && e.length > 0 && e.forEach((function(e) {
+ e.call(this)
+ }), this), this.trigger("ready")
+ }), 1)
+ }, t.$ = function(e, t) {
+ return tt(e, t || this.contentEl())
+ }, t.$$ = function(e, t) {
+ return it(e, t || this.contentEl())
+ }, t.hasClass = function(e) {
+ return Oe(this.el_, e)
+ }, t.addClass = function(e) {
+ Ue(this.el_, e)
+ }, t.removeClass = function(e) {
+ Me(this.el_, e)
+ }, t.toggleClass = function(e, t) {
+ Fe(this.el_, e, t)
+ }, t.show = function() {
+ this.removeClass("vjs-hidden")
+ }, t.hide = function() {
+ this.addClass("vjs-hidden")
+ }, t.lockShowing = function() {
+ this.addClass("vjs-lock-showing")
+ }, t.unlockShowing = function() {
+ this.removeClass("vjs-lock-showing")
+ }, t.getAttribute = function(e) {
+ return je(this.el_, e)
+ }, t.setAttribute = function(e, t) {
+ Ve(this.el_, e, t)
+ }, t.removeAttribute = function(e) {
+ He(this.el_, e)
+ }, t.width = function(e, t) {
+ return this.dimension("width", e, t)
+ }, t.height = function(e, t) {
+ return this.dimension("height", e, t)
+ }, t.dimensions = function(e, t) {
+ this.width(e, !0), this.height(t)
+ }, t.dimension = function(e, t, i) {
+ if (void 0 !== t) return null !== t && t == t || (t = 0), -1 !== ("" + t).indexOf("%") || -1 !== ("" + t).indexOf("px") ? this.el_.style[e] = t : this.el_.style[e] = "auto" === t ? "" : t + "px", void(i || this.trigger("componentresize"));
+ if (!this.el_) return 0;
+ var n = this.el_.style[e],
+ r = n.indexOf("px");
+ return -1 !== r ? parseInt(n.slice(0, r), 10) : parseInt(this.el_["offset" + Ht(e)], 10)
+ }, t.currentDimension = function(e) {
+ var t = 0;
+ if ("width" !== e && "height" !== e) throw new Error("currentDimension only accepts width or height value");
+ if (t = ie(this.el_, e), 0 === (t = parseFloat(t)) || isNaN(t)) {
+ var i = "offset" + Ht(e);
+ t = this.el_[i]
+ }
+ return t
+ }, t.currentDimensions = function() {
+ return {
+ width: this.currentDimension("width"),
+ height: this.currentDimension("height")
+ }
+ }, t.currentWidth = function() {
+ return this.currentDimension("width")
+ }, t.currentHeight = function() {
+ return this.currentDimension("height")
+ }, t.focus = function() {
+ this.el_.focus()
+ }, t.blur = function() {
+ this.el_.blur()
+ }, t.handleKeyDown = function(e) {
+ this.player_ && (e.stopPropagation(), this.player_.handleKeyDown(e))
+ }, t.handleKeyPress = function(e) {
+ this.handleKeyDown(e)
+ }, t.emitTapEvents = function() {
+ var e, t = 0,
+ i = null;
+ this.on("touchstart", (function(n) {
+ 1 === n.touches.length && (i = {
+ pageX: n.touches[0].pageX,
+ pageY: n.touches[0].pageY
+ }, t = C.default.performance.now(), e = !0)
+ })), this.on("touchmove", (function(t) {
+ if (t.touches.length > 1) e = !1;
+ else if (i) {
+ var n = t.touches[0].pageX - i.pageX,
+ r = t.touches[0].pageY - i.pageY;
+ Math.sqrt(n * n + r * r) > 10 && (e = !1)
+ }
+ }));
+ var n = function() {
+ e = !1
+ };
+ this.on("touchleave", n), this.on("touchcancel", n), this.on("touchend", (function(n) {
+ (i = null, !0 === e) && (C.default.performance.now() - t < 200 && (n.preventDefault(), this.trigger("tap")))
+ }))
+ }, t.enableTouchActivity = function() {
+ if (this.player() && this.player().reportUserActivity) {
+ var e, t = Ct(this.player(), this.player().reportUserActivity);
+ this.on("touchstart", (function() {
+ t(), this.clearInterval(e), e = this.setInterval(t, 250)
+ }));
+ var i = function(i) {
+ t(), this.clearInterval(e)
+ };
+ this.on("touchmove", t), this.on("touchend", i), this.on("touchcancel", i)
+ }
+ }, t.setTimeout = function(e, t) {
+ var i, n = this;
+ return e = Ct(this, e), this.clearTimersOnDispose_(), i = C.default.setTimeout((function() {
+ n.setTimeoutIds_.has(i) && n.setTimeoutIds_.delete(i), e()
+ }), t), this.setTimeoutIds_.add(i), i
+ }, t.clearTimeout = function(e) {
+ return this.setTimeoutIds_.has(e) && (this.setTimeoutIds_.delete(e), C.default.clearTimeout(e)), e
+ }, t.setInterval = function(e, t) {
+ e = Ct(this, e), this.clearTimersOnDispose_();
+ var i = C.default.setInterval(e, t);
+ return this.setIntervalIds_.add(i), i
+ }, t.clearInterval = function(e) {
+ return this.setIntervalIds_.has(e) && (this.setIntervalIds_.delete(e), C.default.clearInterval(e)), e
+ }, t.requestAnimationFrame = function(e) {
+ var t, i = this;
+ return this.supportsRaf_ ? (this.clearTimersOnDispose_(), e = Ct(this, e), t = C.default.requestAnimationFrame((function() {
+ i.rafIds_.has(t) && i.rafIds_.delete(t), e()
+ })), this.rafIds_.add(t), t) : this.setTimeout(e, 1e3 / 60)
+ }, t.requestNamedAnimationFrame = function(e, t) {
+ var i = this;
+ if (!this.namedRafs_.has(e)) {
+ this.clearTimersOnDispose_(), t = Ct(this, t);
+ var n = this.requestAnimationFrame((function() {
+ t(), i.namedRafs_.has(e) && i.namedRafs_.delete(e)
+ }));
+ return this.namedRafs_.set(e, n), e
+ }
+ }, t.cancelNamedAnimationFrame = function(e) {
+ this.namedRafs_.has(e) && (this.cancelAnimationFrame(this.namedRafs_.get(e)), this.namedRafs_.delete(e))
+ }, t.cancelAnimationFrame = function(e) {
+ return this.supportsRaf_ ? (this.rafIds_.has(e) && (this.rafIds_.delete(e), C.default.cancelAnimationFrame(e)), e) : this.clearTimeout(e)
+ }, t.clearTimersOnDispose_ = function() {
+ var e = this;
+ this.clearingTimersOnDispose_ || (this.clearingTimersOnDispose_ = !0, this.one("dispose", (function() {
+ [
+ ["namedRafs_", "cancelNamedAnimationFrame"],
+ ["rafIds_", "cancelAnimationFrame"],
+ ["setTimeoutIds_", "clearTimeout"],
+ ["setIntervalIds_", "clearInterval"]
+ ].forEach((function(t) {
+ var i = t[0],
+ n = t[1];
+ e[i].forEach((function(t, i) {
+ return e[n](i)
+ }))
+ })), e.clearingTimersOnDispose_ = !1
+ })))
+ }, e.registerComponent = function(t, i) {
+ if ("string" != typeof t || !t) throw new Error('Illegal component name, "' + t + '"; must be a non-empty string.');
+ var n, r = e.getComponent("Tech"),
+ a = r && r.isTech(i),
+ s = e === i || e.prototype.isPrototypeOf(i.prototype);
+ if (a || !s) throw n = a ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass", new Error('Illegal component, "' + t + '"; ' + n + ".");
+ t = Ht(t), e.components_ || (e.components_ = {});
+ var o = e.getComponent("Player");
+ if ("Player" === t && o && o.players) {
+ var u = o.players,
+ l = Object.keys(u);
+ if (u && l.length > 0 && l.map((function(e) {
+ return u[e]
+ })).every(Boolean)) throw new Error("Can not register Player component after player has been created.")
+ }
+ return e.components_[t] = i, e.components_[Vt(t)] = i, i
+ }, e.getComponent = function(t) {
+ if (t && e.components_) return e.components_[t]
+ }, e
+ }();
+
+ function Xt(e, t, i, n) {
+ return function(e, t, i) {
+ if ("number" != typeof t || t < 0 || t > i) throw new Error("Failed to execute '" + e + "' on 'TimeRanges': The index provided (" + t + ") is non-numeric or out of bounds (0-" + i + ").")
+ }(e, n, i.length - 1), i[n][t]
+ }
+
+ function Qt(e) {
+ var t;
+ return t = void 0 === e || 0 === e.length ? {
+ length: 0,
+ start: function() {
+ throw new Error("This TimeRanges object is empty")
+ },
+ end: function() {
+ throw new Error("This TimeRanges object is empty")
+ }
+ } : {
+ length: e.length,
+ start: Xt.bind(null, "start", 0, e),
+ end: Xt.bind(null, "end", 1, e)
+ }, C.default.Symbol && C.default.Symbol.iterator && (t[C.default.Symbol.iterator] = function() {
+ return (e || []).values()
+ }), t
+ }
+
+ function $t(e, t) {
+ return Array.isArray(e) ? Qt(e) : void 0 === e || void 0 === t ? Qt() : Qt([
+ [e, t]
+ ])
+ }
+
+ function Jt(e, t) {
+ var i, n, r = 0;
+ if (!t) return 0;
+ e && e.length || (e = $t(0, 0));
+ for (var a = 0; a < e.length; a++) i = e.start(a), (n = e.end(a)) > t && (n = t), r += n - i;
+ return r / t
+ }
+
+ function Zt(e) {
+ if (e instanceof Zt) return e;
+ "number" == typeof e ? this.code = e : "string" == typeof e ? this.message = e : ee(e) && ("number" == typeof e.code && (this.code = e.code), Z(this, e)), this.message || (this.message = Zt.defaultMessages[this.code] || "")
+ }
+ Kt.prototype.supportsRaf_ = "function" == typeof C.default.requestAnimationFrame && "function" == typeof C.default.cancelAnimationFrame, Kt.registerComponent("Component", Kt), Zt.prototype.code = 0, Zt.prototype.message = "", Zt.prototype.status = null, Zt.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"], Zt.defaultMessages = {
+ 1: "You aborted the media playback",
+ 2: "A network error caused the media download to fail part-way.",
+ 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
+ 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
+ 5: "The media is encrypted and we do not have the keys to decrypt it."
+ };
+ for (var ei = 0; ei < Zt.errorTypes.length; ei++) Zt[Zt.errorTypes[ei]] = ei, Zt.prototype[Zt.errorTypes[ei]] = ei;
+
+ function ti(e) {
+ return null != e && "function" == typeof e.then
+ }
+
+ function ii(e) {
+ ti(e) && e.then(null, (function(e) {}))
+ }
+ var ni = function(e) {
+ return ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce((function(t, i, n) {
+ return e[i] && (t[i] = e[i]), t
+ }), {
+ cues: e.cues && Array.prototype.map.call(e.cues, (function(e) {
+ return {
+ startTime: e.startTime,
+ endTime: e.endTime,
+ text: e.text,
+ id: e.id
+ }
+ }))
+ })
+ },
+ ri = function(e) {
+ var t = e.$$("track"),
+ i = Array.prototype.map.call(t, (function(e) {
+ return e.track
+ }));
+ return Array.prototype.map.call(t, (function(e) {
+ var t = ni(e.track);
+ return e.src && (t.src = e.src), t
+ })).concat(Array.prototype.filter.call(e.textTracks(), (function(e) {
+ return -1 === i.indexOf(e)
+ })).map(ni))
+ },
+ ai = function(e, t) {
+ return e.forEach((function(e) {
+ var i = t.addRemoteTextTrack(e).track;
+ !e.src && e.cues && e.cues.forEach((function(e) {
+ return i.addCue(e)
+ }))
+ })), t.textTracks()
+ },
+ si = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).handleKeyDown_ = function(e) {
+ return n.handleKeyDown(e)
+ }, n.close_ = function(e) {
+ return n.close(e)
+ }, n.opened_ = n.hasBeenOpened_ = n.hasBeenFilled_ = !1, n.closeable(!n.options_.uncloseable), n.content(n.options_.content), n.contentEl_ = xe("div", {
+ className: "vjs-modal-dialog-content"
+ }, {
+ role: "document"
+ }), n.descEl_ = xe("p", {
+ className: "vjs-modal-dialog-description vjs-control-text",
+ id: n.el().getAttribute("aria-describedby")
+ }), Re(n.descEl_, n.description()), n.el_.appendChild(n.descEl_), n.el_.appendChild(n.contentEl_), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: this.buildCSSClass(),
+ tabIndex: -1
+ }, {
+ "aria-describedby": this.id() + "_description",
+ "aria-hidden": "true",
+ "aria-label": this.label(),
+ role: "dialog"
+ })
+ }, i.dispose = function() {
+ this.contentEl_ = null, this.descEl_ = null, this.previouslyActiveEl_ = null, e.prototype.dispose.call(this)
+ }, i.buildCSSClass = function() {
+ return "vjs-modal-dialog vjs-hidden " + e.prototype.buildCSSClass.call(this)
+ }, i.label = function() {
+ return this.localize(this.options_.label || "Modal Window")
+ }, i.description = function() {
+ var e = this.options_.description || this.localize("This is a modal window.");
+ return this.closeable() && (e += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.")), e
+ }, i.open = function() {
+ if (!this.opened_) {
+ var e = this.player();
+ this.trigger("beforemodalopen"), this.opened_ = !0, (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) && this.fill(), this.wasPlaying_ = !e.paused(), this.options_.pauseOnOpen && this.wasPlaying_ && e.pause(), this.on("keydown", this.handleKeyDown_), this.hadControls_ = e.controls(), e.controls(!1), this.show(), this.conditionalFocus_(), this.el().setAttribute("aria-hidden", "false"), this.trigger("modalopen"), this.hasBeenOpened_ = !0
+ }
+ }, i.opened = function(e) {
+ return "boolean" == typeof e && this[e ? "open" : "close"](), this.opened_
+ }, i.close = function() {
+ if (this.opened_) {
+ var e = this.player();
+ this.trigger("beforemodalclose"), this.opened_ = !1, this.wasPlaying_ && this.options_.pauseOnOpen && e.play(), this.off("keydown", this.handleKeyDown_), this.hadControls_ && e.controls(!0), this.hide(), this.el().setAttribute("aria-hidden", "true"), this.trigger("modalclose"), this.conditionalBlur_(), this.options_.temporary && this.dispose()
+ }
+ }, i.closeable = function(e) {
+ if ("boolean" == typeof e) {
+ var t = this.closeable_ = !!e,
+ i = this.getChild("closeButton");
+ if (t && !i) {
+ var n = this.contentEl_;
+ this.contentEl_ = this.el_, i = this.addChild("closeButton", {
+ controlText: "Close Modal Dialog"
+ }), this.contentEl_ = n, this.on(i, "close", this.close_)
+ }!t && i && (this.off(i, "close", this.close_), this.removeChild(i), i.dispose())
+ }
+ return this.closeable_
+ }, i.fill = function() {
+ this.fillWith(this.content())
+ }, i.fillWith = function(e) {
+ var t = this.contentEl(),
+ i = t.parentNode,
+ n = t.nextSibling;
+ this.trigger("beforemodalfill"), this.hasBeenFilled_ = !0, i.removeChild(t), this.empty(), Je(t, e), this.trigger("modalfill"), n ? i.insertBefore(t, n) : i.appendChild(t);
+ var r = this.getChild("closeButton");
+ r && i.appendChild(r.el_)
+ }, i.empty = function() {
+ this.trigger("beforemodalempty"), Xe(this.contentEl()), this.trigger("modalempty")
+ }, i.content = function(e) {
+ return void 0 !== e && (this.content_ = e), this.content_
+ }, i.conditionalFocus_ = function() {
+ var e = k.default.activeElement,
+ t = this.player_.el_;
+ this.previouslyActiveEl_ = null, (t.contains(e) || t === e) && (this.previouslyActiveEl_ = e, this.focus())
+ }, i.conditionalBlur_ = function() {
+ this.previouslyActiveEl_ && (this.previouslyActiveEl_.focus(), this.previouslyActiveEl_ = null)
+ }, i.handleKeyDown = function(e) {
+ if (e.stopPropagation(), R.default.isEventKey(e, "Escape") && this.closeable()) return e.preventDefault(), void this.close();
+ if (R.default.isEventKey(e, "Tab")) {
+ for (var t, i = this.focusableEls_(), n = this.el_.querySelector(":focus"), r = 0; r < i.length; r++)
+ if (n === i[r]) {
+ t = r;
+ break
+ } k.default.activeElement === this.el_ && (t = 0), e.shiftKey && 0 === t ? (i[i.length - 1].focus(), e.preventDefault()) : e.shiftKey || t !== i.length - 1 || (i[0].focus(), e.preventDefault())
+ }
+ }, i.focusableEls_ = function() {
+ var e = this.el_.querySelectorAll("*");
+ return Array.prototype.filter.call(e, (function(e) {
+ return (e instanceof C.default.HTMLAnchorElement || e instanceof C.default.HTMLAreaElement) && e.hasAttribute("href") || (e instanceof C.default.HTMLInputElement || e instanceof C.default.HTMLSelectElement || e instanceof C.default.HTMLTextAreaElement || e instanceof C.default.HTMLButtonElement) && !e.hasAttribute("disabled") || e instanceof C.default.HTMLIFrameElement || e instanceof C.default.HTMLObjectElement || e instanceof C.default.HTMLEmbedElement || e.hasAttribute("tabindex") && -1 !== e.getAttribute("tabindex") || e.hasAttribute("contenteditable")
+ }))
+ }, t
+ }(Kt);
+ si.prototype.options_ = {
+ pauseOnOpen: !0,
+ temporary: !0
+ }, Kt.registerComponent("ModalDialog", si);
+ var oi = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = []), (i = e.call(this) || this).tracks_ = [], Object.defineProperty(I.default(i), "length", {
+ get: function() {
+ return this.tracks_.length
+ }
+ });
+ for (var n = 0; n < t.length; n++) i.addTrack(t[n]);
+ return i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addTrack = function(e) {
+ var t = this,
+ i = this.tracks_.length;
+ "" + i in this || Object.defineProperty(this, i, {
+ get: function() {
+ return this.tracks_[i]
+ }
+ }), -1 === this.tracks_.indexOf(e) && (this.tracks_.push(e), this.trigger({
+ track: e,
+ type: "addtrack",
+ target: this
+ })), e.labelchange_ = function() {
+ t.trigger({
+ track: e,
+ type: "labelchange",
+ target: t
+ })
+ }, Lt(e) && e.addEventListener("labelchange", e.labelchange_)
+ }, i.removeTrack = function(e) {
+ for (var t, i = 0, n = this.length; i < n; i++)
+ if (this[i] === e) {
+ (t = this[i]).off && t.off(), this.tracks_.splice(i, 1);
+ break
+ } t && this.trigger({
+ track: t,
+ type: "removetrack",
+ target: this
+ })
+ }, i.getTrackById = function(e) {
+ for (var t = null, i = 0, n = this.length; i < n; i++) {
+ var r = this[i];
+ if (r.id === e) {
+ t = r;
+ break
+ }
+ }
+ return t
+ }, t
+ }(Pt);
+ for (var ui in oi.prototype.allowedEvents_ = {
+ change: "change",
+ addtrack: "addtrack",
+ removetrack: "removetrack",
+ labelchange: "labelchange"
+ }, oi.prototype.allowedEvents_) oi.prototype["on" + ui] = null;
+ var li = function(e, t) {
+ for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].enabled = !1)
+ },
+ hi = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = []);
+ for (var n = t.length - 1; n >= 0; n--)
+ if (t[n].enabled) {
+ li(t, t[n]);
+ break
+ } return (i = e.call(this, t) || this).changing_ = !1, i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addTrack = function(t) {
+ var i = this;
+ t.enabled && li(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && (t.enabledChange_ = function() {
+ i.changing_ || (i.changing_ = !0, li(i, t), i.changing_ = !1, i.trigger("change"))
+ }, t.addEventListener("enabledchange", t.enabledChange_))
+ }, i.removeTrack = function(t) {
+ e.prototype.removeTrack.call(this, t), t.removeEventListener && t.enabledChange_ && (t.removeEventListener("enabledchange", t.enabledChange_), t.enabledChange_ = null)
+ }, t
+ }(oi),
+ di = function(e, t) {
+ for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].selected = !1)
+ },
+ ci = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = []);
+ for (var n = t.length - 1; n >= 0; n--)
+ if (t[n].selected) {
+ di(t, t[n]);
+ break
+ } return (i = e.call(this, t) || this).changing_ = !1, Object.defineProperty(I.default(i), "selectedIndex", {
+ get: function() {
+ for (var e = 0; e < this.length; e++)
+ if (this[e].selected) return e;
+ return -1
+ },
+ set: function() {}
+ }), i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addTrack = function(t) {
+ var i = this;
+ t.selected && di(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && (t.selectedChange_ = function() {
+ i.changing_ || (i.changing_ = !0, di(i, t), i.changing_ = !1, i.trigger("change"))
+ }, t.addEventListener("selectedchange", t.selectedChange_))
+ }, i.removeTrack = function(t) {
+ e.prototype.removeTrack.call(this, t), t.removeEventListener && t.selectedChange_ && (t.removeEventListener("selectedchange", t.selectedChange_), t.selectedChange_ = null)
+ }, t
+ }(oi),
+ fi = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addTrack = function(t) {
+ var i = this;
+ e.prototype.addTrack.call(this, t), this.queueChange_ || (this.queueChange_ = function() {
+ return i.queueTrigger("change")
+ }), this.triggerSelectedlanguagechange || (this.triggerSelectedlanguagechange_ = function() {
+ return i.trigger("selectedlanguagechange")
+ }), t.addEventListener("modechange", this.queueChange_); - 1 === ["metadata", "chapters"].indexOf(t.kind) && t.addEventListener("modechange", this.triggerSelectedlanguagechange_)
+ }, i.removeTrack = function(t) {
+ e.prototype.removeTrack.call(this, t), t.removeEventListener && (this.queueChange_ && t.removeEventListener("modechange", this.queueChange_), this.selectedlanguagechange_ && t.removeEventListener("modechange", this.triggerSelectedlanguagechange_))
+ }, t
+ }(oi),
+ pi = function() {
+ function e(e) {
+ void 0 === e && (e = []), this.trackElements_ = [], Object.defineProperty(this, "length", {
+ get: function() {
+ return this.trackElements_.length
+ }
+ });
+ for (var t = 0, i = e.length; t < i; t++) this.addTrackElement_(e[t])
+ }
+ var t = e.prototype;
+ return t.addTrackElement_ = function(e) {
+ var t = this.trackElements_.length;
+ "" + t in this || Object.defineProperty(this, t, {
+ get: function() {
+ return this.trackElements_[t]
+ }
+ }), -1 === this.trackElements_.indexOf(e) && this.trackElements_.push(e)
+ }, t.getTrackElementByTrack_ = function(e) {
+ for (var t, i = 0, n = this.trackElements_.length; i < n; i++)
+ if (e === this.trackElements_[i].track) {
+ t = this.trackElements_[i];
+ break
+ } return t
+ }, t.removeTrackElement_ = function(e) {
+ for (var t = 0, i = this.trackElements_.length; t < i; t++)
+ if (e === this.trackElements_[t]) {
+ this.trackElements_[t].track && "function" == typeof this.trackElements_[t].track.off && this.trackElements_[t].track.off(), "function" == typeof this.trackElements_[t].off && this.trackElements_[t].off(), this.trackElements_.splice(t, 1);
+ break
+ }
+ }, e
+ }(),
+ mi = function() {
+ function e(t) {
+ e.prototype.setCues_.call(this, t), Object.defineProperty(this, "length", {
+ get: function() {
+ return this.length_
+ }
+ })
+ }
+ var t = e.prototype;
+ return t.setCues_ = function(e) {
+ var t = this.length || 0,
+ i = 0,
+ n = e.length;
+ this.cues_ = e, this.length_ = e.length;
+ var r = function(e) {
+ "" + e in this || Object.defineProperty(this, "" + e, {
+ get: function() {
+ return this.cues_[e]
+ }
+ })
+ };
+ if (t < n)
+ for (i = t; i < n; i++) r.call(this, i)
+ }, t.getCueById = function(e) {
+ for (var t = null, i = 0, n = this.length; i < n; i++) {
+ var r = this[i];
+ if (r.id === e) {
+ t = r;
+ break
+ }
+ }
+ return t
+ }, e
+ }(),
+ _i = {
+ alternative: "alternative",
+ captions: "captions",
+ main: "main",
+ sign: "sign",
+ subtitles: "subtitles",
+ commentary: "commentary"
+ },
+ gi = {
+ alternative: "alternative",
+ descriptions: "descriptions",
+ main: "main",
+ "main-desc": "main-desc",
+ translation: "translation",
+ commentary: "commentary"
+ },
+ vi = {
+ subtitles: "subtitles",
+ captions: "captions",
+ descriptions: "descriptions",
+ chapters: "chapters",
+ metadata: "metadata"
+ },
+ yi = {
+ disabled: "disabled",
+ hidden: "hidden",
+ showing: "showing"
+ },
+ bi = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = {}), i = e.call(this) || this;
+ var n = {
+ id: t.id || "vjs_track_" + ct(),
+ kind: t.kind || "",
+ language: t.language || ""
+ },
+ r = t.label || "",
+ a = function(e) {
+ Object.defineProperty(I.default(i), e, {
+ get: function() {
+ return n[e]
+ },
+ set: function() {}
+ })
+ };
+ for (var s in n) a(s);
+ return Object.defineProperty(I.default(i), "label", {
+ get: function() {
+ return r
+ },
+ set: function(e) {
+ e !== r && (r = e, this.trigger("labelchange"))
+ }
+ }), i
+ }
+ return L.default(t, e), t
+ }(Pt),
+ Si = function(e) {
+ var t = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"],
+ i = k.default.createElement("a");
+ i.href = e;
+ for (var n = {}, r = 0; r < t.length; r++) n[t[r]] = i[t[r]];
+ return "http:" === n.protocol && (n.host = n.host.replace(/:80$/, "")), "https:" === n.protocol && (n.host = n.host.replace(/:443$/, "")), n.protocol || (n.protocol = C.default.location.protocol), n.host || (n.host = C.default.location.host), n
+ },
+ Ti = function(e) {
+ if (!e.match(/^https?:\/\//)) {
+ var t = k.default.createElement("a");
+ t.href = e, e = t.href
+ }
+ return e
+ },
+ Ei = function(e) {
+ if ("string" == typeof e) {
+ var t = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);
+ if (t) return t.pop().toLowerCase()
+ }
+ return ""
+ },
+ wi = function(e, t) {
+ void 0 === t && (t = C.default.location);
+ var i = Si(e);
+ return (":" === i.protocol ? t.protocol : i.protocol) + i.host !== t.protocol + t.host
+ },
+ Ai = Object.freeze({
+ __proto__: null,
+ parseUrl: Si,
+ getAbsoluteURL: Ti,
+ getFileExtension: Ei,
+ isCrossOrigin: wi
+ }),
+ Ci = function(e, t) {
+ var i = new C.default.WebVTT.Parser(C.default, C.default.vttjs, C.default.WebVTT.StringDecoder()),
+ n = [];
+ i.oncue = function(e) {
+ t.addCue(e)
+ }, i.onparsingerror = function(e) {
+ n.push(e)
+ }, i.onflush = function() {
+ t.trigger({
+ type: "loadeddata",
+ target: t
+ })
+ }, i.parse(e), n.length > 0 && (C.default.console && C.default.console.groupCollapsed && C.default.console.groupCollapsed("Text Track parsing errors for " + t.src), n.forEach((function(e) {
+ return K.error(e)
+ })), C.default.console && C.default.console.groupEnd && C.default.console.groupEnd()), i.flush()
+ },
+ ki = function(e, t) {
+ var i = {
+ uri: e
+ },
+ n = wi(e);
+ n && (i.cors = n);
+ var r = "use-credentials" === t.tech_.crossOrigin();
+ r && (i.withCredentials = r), D.default(i, Ct(this, (function(e, i, n) {
+ if (e) return K.error(e, i);
+ t.loaded_ = !0, "function" != typeof C.default.WebVTT ? t.tech_ && t.tech_.any(["vttjsloaded", "vttjserror"], (function(e) {
+ if ("vttjserror" !== e.type) return Ci(n, t);
+ K.error("vttjs failed to load, stopping trying to process " + t.src)
+ })) : Ci(n, t)
+ })))
+ },
+ Pi = function(e) {
+ function t(t) {
+ var i;
+ if (void 0 === t && (t = {}), !t.tech) throw new Error("A tech was not provided.");
+ var n = zt(t, {
+ kind: vi[t.kind] || "subtitles",
+ language: t.language || t.srclang || ""
+ }),
+ r = yi[n.mode] || "disabled",
+ a = n.default;
+ "metadata" !== n.kind && "chapters" !== n.kind || (r = "hidden"), (i = e.call(this, n) || this).tech_ = n.tech, i.cues_ = [], i.activeCues_ = [], i.preload_ = !1 !== i.tech_.preloadTextTracks;
+ var s = new mi(i.cues_),
+ o = new mi(i.activeCues_),
+ u = !1,
+ l = Ct(I.default(i), (function() {
+ this.tech_.isReady_ && !this.tech_.isDisposed() && (this.activeCues = this.activeCues, u && (this.trigger("cuechange"), u = !1))
+ }));
+ return i.tech_.one("dispose", (function() {
+ i.tech_.off("timeupdate", l)
+ })), "disabled" !== r && i.tech_.on("timeupdate", l), Object.defineProperties(I.default(i), {
+ default: {
+ get: function() {
+ return a
+ },
+ set: function() {}
+ },
+ mode: {
+ get: function() {
+ return r
+ },
+ set: function(e) {
+ yi[e] && r !== e && (r = e, this.preload_ || "disabled" === r || 0 !== this.cues.length || ki(this.src, this), this.tech_.off("timeupdate", l), "disabled" !== r && this.tech_.on("timeupdate", l), this.trigger("modechange"))
+ }
+ },
+ cues: {
+ get: function() {
+ return this.loaded_ ? s : null
+ },
+ set: function() {}
+ },
+ activeCues: {
+ get: function() {
+ if (!this.loaded_) return null;
+ if (0 === this.cues.length) return o;
+ for (var e = this.tech_.currentTime(), t = [], i = 0, n = this.cues.length; i < n; i++) {
+ var r = this.cues[i];
+ (r.startTime <= e && r.endTime >= e || r.startTime === r.endTime && r.startTime <= e && r.startTime + .5 >= e) && t.push(r)
+ }
+ if (u = !1, t.length !== this.activeCues_.length) u = !0;
+ else
+ for (var a = 0; a < t.length; a++) - 1 === this.activeCues_.indexOf(t[a]) && (u = !0);
+ return this.activeCues_ = t, o.setCues_(this.activeCues_), o
+ },
+ set: function() {}
+ }
+ }), n.src ? (i.src = n.src, i.preload_ || (i.loaded_ = !0), (i.preload_ || "subtitles" !== n.kind && "captions" !== n.kind) && ki(i.src, I.default(i))) : i.loaded_ = !0, i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addCue = function(e) {
+ var t = e;
+ if (C.default.vttjs && !(e instanceof C.default.vttjs.VTTCue)) {
+ for (var i in t = new C.default.vttjs.VTTCue(e.startTime, e.endTime, e.text), e) i in t || (t[i] = e[i]);
+ t.id = e.id, t.originalCue_ = e
+ }
+ for (var n = this.tech_.textTracks(), r = 0; r < n.length; r++) n[r] !== this && n[r].removeCue(t);
+ this.cues_.push(t), this.cues.setCues_(this.cues_)
+ }, i.removeCue = function(e) {
+ for (var t = this.cues_.length; t--;) {
+ var i = this.cues_[t];
+ if (i === e || i.originalCue_ && i.originalCue_ === e) {
+ this.cues_.splice(t, 1), this.cues.setCues_(this.cues_);
+ break
+ }
+ }
+ }, t
+ }(bi);
+ Pi.prototype.allowedEvents_ = {
+ cuechange: "cuechange"
+ };
+ var Ii = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = {});
+ var n = zt(t, {
+ kind: gi[t.kind] || ""
+ });
+ i = e.call(this, n) || this;
+ var r = !1;
+ return Object.defineProperty(I.default(i), "enabled", {
+ get: function() {
+ return r
+ },
+ set: function(e) {
+ "boolean" == typeof e && e !== r && (r = e, this.trigger("enabledchange"))
+ }
+ }), n.enabled && (i.enabled = n.enabled), i.loaded_ = !0, i
+ }
+ return L.default(t, e), t
+ }(bi),
+ Li = function(e) {
+ function t(t) {
+ var i;
+ void 0 === t && (t = {});
+ var n = zt(t, {
+ kind: _i[t.kind] || ""
+ });
+ i = e.call(this, n) || this;
+ var r = !1;
+ return Object.defineProperty(I.default(i), "selected", {
+ get: function() {
+ return r
+ },
+ set: function(e) {
+ "boolean" == typeof e && e !== r && (r = e, this.trigger("selectedchange"))
+ }
+ }), n.selected && (i.selected = n.selected), i
+ }
+ return L.default(t, e), t
+ }(bi),
+ xi = function(e) {
+ function t(t) {
+ var i, n;
+ void 0 === t && (t = {}), i = e.call(this) || this;
+ var r = new Pi(t);
+ return i.kind = r.kind, i.src = r.src, i.srclang = r.language, i.label = r.label, i.default = r.default, Object.defineProperties(I.default(i), {
+ readyState: {
+ get: function() {
+ return n
+ }
+ },
+ track: {
+ get: function() {
+ return r
+ }
+ }
+ }), n = 0, r.addEventListener("loadeddata", (function() {
+ n = 2, i.trigger({
+ type: "load",
+ target: I.default(i)
+ })
+ })), i
+ }
+ return L.default(t, e), t
+ }(Pt);
+ xi.prototype.allowedEvents_ = {
+ load: "load"
+ }, xi.NONE = 0, xi.LOADING = 1, xi.LOADED = 2, xi.ERROR = 3;
+ var Ri = {
+ audio: {
+ ListClass: hi,
+ TrackClass: Ii,
+ capitalName: "Audio"
+ },
+ video: {
+ ListClass: ci,
+ TrackClass: Li,
+ capitalName: "Video"
+ },
+ text: {
+ ListClass: fi,
+ TrackClass: Pi,
+ capitalName: "Text"
+ }
+ };
+ Object.keys(Ri).forEach((function(e) {
+ Ri[e].getterName = e + "Tracks", Ri[e].privateName = e + "Tracks_"
+ }));
+ var Di = {
+ remoteText: {
+ ListClass: fi,
+ TrackClass: Pi,
+ capitalName: "RemoteText",
+ getterName: "remoteTextTracks",
+ privateName: "remoteTextTracks_"
+ },
+ remoteTextEl: {
+ ListClass: pi,
+ TrackClass: xi,
+ capitalName: "RemoteTextTrackEls",
+ getterName: "remoteTextTrackEls",
+ privateName: "remoteTextTrackEls_"
+ }
+ },
+ Oi = P.default({}, Ri, Di);
+ Di.names = Object.keys(Di), Ri.names = Object.keys(Ri), Oi.names = [].concat(Di.names).concat(Ri.names);
+ var Ui = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === t && (t = {}), void 0 === i && (i = function() {}), t.reportTouchActivity = !1, (n = e.call(this, null, t, i) || this).onDurationChange_ = function(e) {
+ return n.onDurationChange(e)
+ }, n.trackProgress_ = function(e) {
+ return n.trackProgress(e)
+ }, n.trackCurrentTime_ = function(e) {
+ return n.trackCurrentTime(e)
+ }, n.stopTrackingCurrentTime_ = function(e) {
+ return n.stopTrackingCurrentTime(e)
+ }, n.disposeSourceHandler_ = function(e) {
+ return n.disposeSourceHandler(e)
+ }, n.hasStarted_ = !1, n.on("playing", (function() {
+ this.hasStarted_ = !0
+ })), n.on("loadstart", (function() {
+ this.hasStarted_ = !1
+ })), Oi.names.forEach((function(e) {
+ var i = Oi[e];
+ t && t[i.getterName] && (n[i.privateName] = t[i.getterName])
+ })), n.featuresProgressEvents || n.manualProgressOn(), n.featuresTimeupdateEvents || n.manualTimeUpdatesOn(), ["Text", "Audio", "Video"].forEach((function(e) {
+ !1 === t["native" + e + "Tracks"] && (n["featuresNative" + e + "Tracks"] = !1)
+ })), !1 === t.nativeCaptions || !1 === t.nativeTextTracks ? n.featuresNativeTextTracks = !1 : !0 !== t.nativeCaptions && !0 !== t.nativeTextTracks || (n.featuresNativeTextTracks = !0), n.featuresNativeTextTracks || n.emulateTextTracks(), n.preloadTextTracks = !1 !== t.preloadTextTracks, n.autoRemoteTextTracks_ = new Oi.text.ListClass, n.initTrackListeners(), t.nativeControlsForTouch || n.emitTapEvents(), n.constructor && (n.name_ = n.constructor.name || "Unknown Tech"), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.triggerSourceset = function(e) {
+ var t = this;
+ this.isReady_ || this.one("ready", (function() {
+ return t.setTimeout((function() {
+ return t.triggerSourceset(e)
+ }), 1)
+ })), this.trigger({
+ src: e,
+ type: "sourceset"
+ })
+ }, i.manualProgressOn = function() {
+ this.on("durationchange", this.onDurationChange_), this.manualProgress = !0, this.one("ready", this.trackProgress_)
+ }, i.manualProgressOff = function() {
+ this.manualProgress = !1, this.stopTrackingProgress(), this.off("durationchange", this.onDurationChange_)
+ }, i.trackProgress = function(e) {
+ this.stopTrackingProgress(), this.progressInterval = this.setInterval(Ct(this, (function() {
+ var e = this.bufferedPercent();
+ this.bufferedPercent_ !== e && this.trigger("progress"), this.bufferedPercent_ = e, 1 === e && this.stopTrackingProgress()
+ })), 500)
+ }, i.onDurationChange = function(e) {
+ this.duration_ = this.duration()
+ }, i.buffered = function() {
+ return $t(0, 0)
+ }, i.bufferedPercent = function() {
+ return Jt(this.buffered(), this.duration_)
+ }, i.stopTrackingProgress = function() {
+ this.clearInterval(this.progressInterval)
+ }, i.manualTimeUpdatesOn = function() {
+ this.manualTimeUpdates = !0, this.on("play", this.trackCurrentTime_), this.on("pause", this.stopTrackingCurrentTime_)
+ }, i.manualTimeUpdatesOff = function() {
+ this.manualTimeUpdates = !1, this.stopTrackingCurrentTime(), this.off("play", this.trackCurrentTime_), this.off("pause", this.stopTrackingCurrentTime_)
+ }, i.trackCurrentTime = function() {
+ this.currentTimeInterval && this.stopTrackingCurrentTime(), this.currentTimeInterval = this.setInterval((function() {
+ this.trigger({
+ type: "timeupdate",
+ target: this,
+ manuallyTriggered: !0
+ })
+ }), 250)
+ }, i.stopTrackingCurrentTime = function() {
+ this.clearInterval(this.currentTimeInterval), this.trigger({
+ type: "timeupdate",
+ target: this,
+ manuallyTriggered: !0
+ })
+ }, i.dispose = function() {
+ this.clearTracks(Ri.names), this.manualProgress && this.manualProgressOff(), this.manualTimeUpdates && this.manualTimeUpdatesOff(), e.prototype.dispose.call(this)
+ }, i.clearTracks = function(e) {
+ var t = this;
+ (e = [].concat(e)).forEach((function(e) {
+ for (var i = t[e + "Tracks"]() || [], n = i.length; n--;) {
+ var r = i[n];
+ "text" === e && t.removeRemoteTextTrack(r), i.removeTrack(r)
+ }
+ }))
+ }, i.cleanupAutoTextTracks = function() {
+ for (var e = this.autoRemoteTextTracks_ || [], t = e.length; t--;) {
+ var i = e[t];
+ this.removeRemoteTextTrack(i)
+ }
+ }, i.reset = function() {}, i.crossOrigin = function() {}, i.setCrossOrigin = function() {}, i.error = function(e) {
+ return void 0 !== e && (this.error_ = new Zt(e), this.trigger("error")), this.error_
+ }, i.played = function() {
+ return this.hasStarted_ ? $t(0, 0) : $t()
+ }, i.play = function() {}, i.setScrubbing = function() {}, i.scrubbing = function() {}, i.setCurrentTime = function() {
+ this.manualTimeUpdates && this.trigger({
+ type: "timeupdate",
+ target: this,
+ manuallyTriggered: !0
+ })
+ }, i.initTrackListeners = function() {
+ var e = this;
+ Ri.names.forEach((function(t) {
+ var i = Ri[t],
+ n = function() {
+ e.trigger(t + "trackchange")
+ },
+ r = e[i.getterName]();
+ r.addEventListener("removetrack", n), r.addEventListener("addtrack", n), e.on("dispose", (function() {
+ r.removeEventListener("removetrack", n), r.removeEventListener("addtrack", n)
+ }))
+ }))
+ }, i.addWebVttScript_ = function() {
+ var e = this;
+ if (!C.default.WebVTT)
+ if (k.default.body.contains(this.el())) {
+ if (!this.options_["vtt.js"] && te(O.default) && Object.keys(O.default).length > 0) return void this.trigger("vttjsloaded");
+ var t = k.default.createElement("script");
+ t.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js", t.onload = function() {
+ e.trigger("vttjsloaded")
+ }, t.onerror = function() {
+ e.trigger("vttjserror")
+ }, this.on("dispose", (function() {
+ t.onload = null, t.onerror = null
+ })), C.default.WebVTT = !0, this.el().parentNode.appendChild(t)
+ } else this.ready(this.addWebVttScript_)
+ }, i.emulateTextTracks = function() {
+ var e = this,
+ t = this.textTracks(),
+ i = this.remoteTextTracks(),
+ n = function(e) {
+ return t.addTrack(e.track)
+ },
+ r = function(e) {
+ return t.removeTrack(e.track)
+ };
+ i.on("addtrack", n), i.on("removetrack", r), this.addWebVttScript_();
+ var a = function() {
+ return e.trigger("texttrackchange")
+ },
+ s = function() {
+ a();
+ for (var e = 0; e < t.length; e++) {
+ var i = t[e];
+ i.removeEventListener("cuechange", a), "showing" === i.mode && i.addEventListener("cuechange", a)
+ }
+ };
+ s(), t.addEventListener("change", s), t.addEventListener("addtrack", s), t.addEventListener("removetrack", s), this.on("dispose", (function() {
+ i.off("addtrack", n), i.off("removetrack", r), t.removeEventListener("change", s), t.removeEventListener("addtrack", s), t.removeEventListener("removetrack", s);
+ for (var e = 0; e < t.length; e++) {
+ t[e].removeEventListener("cuechange", a)
+ }
+ }))
+ }, i.addTextTrack = function(e, t, i) {
+ if (!e) throw new Error("TextTrack kind is required but was not provided");
+ return function(e, t, i, n, r) {
+ void 0 === r && (r = {});
+ var a = e.textTracks();
+ r.kind = t, i && (r.label = i), n && (r.language = n), r.tech = e;
+ var s = new Oi.text.TrackClass(r);
+ return a.addTrack(s), s
+ }(this, e, t, i)
+ }, i.createRemoteTextTrack = function(e) {
+ var t = zt(e, {
+ tech: this
+ });
+ return new Di.remoteTextEl.TrackClass(t)
+ }, i.addRemoteTextTrack = function(e, t) {
+ var i = this;
+ void 0 === e && (e = {});
+ var n = this.createRemoteTextTrack(e);
+ return !0 !== t && !1 !== t && (K.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'), t = !0), this.remoteTextTrackEls().addTrackElement_(n), this.remoteTextTracks().addTrack(n.track), !0 !== t && this.ready((function() {
+ return i.autoRemoteTextTracks_.addTrack(n.track)
+ })), n
+ }, i.removeRemoteTextTrack = function(e) {
+ var t = this.remoteTextTrackEls().getTrackElementByTrack_(e);
+ this.remoteTextTrackEls().removeTrackElement_(t), this.remoteTextTracks().removeTrack(e), this.autoRemoteTextTracks_.removeTrack(e)
+ }, i.getVideoPlaybackQuality = function() {
+ return {}
+ }, i.requestPictureInPicture = function() {
+ var e = this.options_.Promise || C.default.Promise;
+ if (e) return e.reject()
+ }, i.disablePictureInPicture = function() {
+ return !0
+ }, i.setDisablePictureInPicture = function() {}, i.setPoster = function() {}, i.playsinline = function() {}, i.setPlaysinline = function() {}, i.overrideNativeAudioTracks = function() {}, i.overrideNativeVideoTracks = function() {}, i.canPlayType = function() {
+ return ""
+ }, t.canPlayType = function() {
+ return ""
+ }, t.canPlaySource = function(e, i) {
+ return t.canPlayType(e.type)
+ }, t.isTech = function(e) {
+ return e.prototype instanceof t || e instanceof t || e === t
+ }, t.registerTech = function(e, i) {
+ if (t.techs_ || (t.techs_ = {}), !t.isTech(i)) throw new Error("Tech " + e + " must be a Tech");
+ if (!t.canPlayType) throw new Error("Techs must have a static canPlayType method on them");
+ if (!t.canPlaySource) throw new Error("Techs must have a static canPlaySource method on them");
+ return e = Ht(e), t.techs_[e] = i, t.techs_[Vt(e)] = i, "Tech" !== e && t.defaultTechOrder_.push(e), i
+ }, t.getTech = function(e) {
+ if (e) return t.techs_ && t.techs_[e] ? t.techs_[e] : (e = Ht(e), C.default && C.default.videojs && C.default.videojs[e] ? (K.warn("The " + e + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"), C.default.videojs[e]) : void 0)
+ }, t
+ }(Kt);
+ Oi.names.forEach((function(e) {
+ var t = Oi[e];
+ Ui.prototype[t.getterName] = function() {
+ return this[t.privateName] = this[t.privateName] || new t.ListClass, this[t.privateName]
+ }
+ })), Ui.prototype.featuresVolumeControl = !0, Ui.prototype.featuresMuteControl = !0, Ui.prototype.featuresFullscreenResize = !1, Ui.prototype.featuresPlaybackRate = !1, Ui.prototype.featuresProgressEvents = !1, Ui.prototype.featuresSourceset = !1, Ui.prototype.featuresTimeupdateEvents = !1, Ui.prototype.featuresNativeTextTracks = !1, Ui.withSourceHandlers = function(e) {
+ e.registerSourceHandler = function(t, i) {
+ var n = e.sourceHandlers;
+ n || (n = e.sourceHandlers = []), void 0 === i && (i = n.length), n.splice(i, 0, t)
+ }, e.canPlayType = function(t) {
+ for (var i, n = e.sourceHandlers || [], r = 0; r < n.length; r++)
+ if (i = n[r].canPlayType(t)) return i;
+ return ""
+ }, e.selectSourceHandler = function(t, i) {
+ for (var n = e.sourceHandlers || [], r = 0; r < n.length; r++)
+ if (n[r].canHandleSource(t, i)) return n[r];
+ return null
+ }, e.canPlaySource = function(t, i) {
+ var n = e.selectSourceHandler(t, i);
+ return n ? n.canHandleSource(t, i) : ""
+ };
+ ["seekable", "seeking", "duration"].forEach((function(e) {
+ var t = this[e];
+ "function" == typeof t && (this[e] = function() {
+ return this.sourceHandler_ && this.sourceHandler_[e] ? this.sourceHandler_[e].apply(this.sourceHandler_, arguments) : t.apply(this, arguments)
+ })
+ }), e.prototype), e.prototype.setSource = function(t) {
+ var i = e.selectSourceHandler(t, this.options_);
+ i || (e.nativeSourceHandler ? i = e.nativeSourceHandler : K.error("No source handler found for the current source.")), this.disposeSourceHandler(), this.off("dispose", this.disposeSourceHandler_), i !== e.nativeSourceHandler && (this.currentSource_ = t), this.sourceHandler_ = i.handleSource(t, this, this.options_), this.one("dispose", this.disposeSourceHandler_)
+ }, e.prototype.disposeSourceHandler = function() {
+ this.currentSource_ && (this.clearTracks(["audio", "video"]), this.currentSource_ = null), this.cleanupAutoTextTracks(), this.sourceHandler_ && (this.sourceHandler_.dispose && this.sourceHandler_.dispose(), this.sourceHandler_ = null)
+ }
+ }, Kt.registerComponent("Tech", Ui), Ui.registerTech("Tech", Ui), Ui.defaultTechOrder_ = [];
+ var Mi = {},
+ Fi = {},
+ Bi = {};
+
+ function Ni(e, t, i) {
+ e.setTimeout((function() {
+ return function e(t, i, n, r, a, s) {
+ void 0 === t && (t = {});
+ void 0 === i && (i = []);
+ void 0 === a && (a = []);
+ void 0 === s && (s = !1);
+ var o = i,
+ u = o[0],
+ l = o.slice(1);
+ if ("string" == typeof u) e(t, Mi[u], n, r, a, s);
+ else if (u) {
+ var h = function(e, t) {
+ var i = Fi[e.id()],
+ n = null;
+ if (null == i) return n = t(e), Fi[e.id()] = [
+ [t, n]
+ ], n;
+ for (var r = 0; r < i.length; r++) {
+ var a = i[r],
+ s = a[0],
+ o = a[1];
+ s === t && (n = o)
+ }
+ null === n && (n = t(e), i.push([t, n]));
+ return n
+ }(r, u);
+ if (!h.setSource) return a.push(h), e(t, l, n, r, a, s);
+ h.setSource(Z({}, t), (function(i, o) {
+ if (i) return e(t, l, n, r, a, s);
+ a.push(h), e(o, t.type === o.type ? l : Mi[o.type], n, r, a, s)
+ }))
+ } else l.length ? e(t, l, n, r, a, s) : s ? n(t, a) : e(t, Mi["*"], n, r, a, !0)
+ }(t, Mi[t.type], i, e)
+ }), 1)
+ }
+
+ function ji(e, t, i, n) {
+ void 0 === n && (n = null);
+ var r = "call" + Ht(i),
+ a = e.reduce(Gi(r), n),
+ s = a === Bi,
+ o = s ? null : t[i](a);
+ return function(e, t, i, n) {
+ for (var r = e.length - 1; r >= 0; r--) {
+ var a = e[r];
+ a[t] && a[t](n, i)
+ }
+ }(e, i, o, s), o
+ }
+ var Vi = {
+ buffered: 1,
+ currentTime: 1,
+ duration: 1,
+ muted: 1,
+ played: 1,
+ paused: 1,
+ seekable: 1,
+ volume: 1,
+ ended: 1
+ },
+ Hi = {
+ setCurrentTime: 1,
+ setMuted: 1,
+ setVolume: 1
+ },
+ zi = {
+ play: 1,
+ pause: 1
+ };
+
+ function Gi(e) {
+ return function(t, i) {
+ return t === Bi ? Bi : i[e] ? i[e](t) : t
+ }
+ }
+ var Wi = {
+ opus: "video/ogg",
+ ogv: "video/ogg",
+ mp4: "video/mp4",
+ mov: "video/mp4",
+ m4v: "video/mp4",
+ mkv: "video/x-matroska",
+ m4a: "audio/mp4",
+ mp3: "audio/mpeg",
+ aac: "audio/aac",
+ caf: "audio/x-caf",
+ flac: "audio/flac",
+ oga: "audio/ogg",
+ wav: "audio/wav",
+ m3u8: "application/x-mpegURL",
+ jpg: "image/jpeg",
+ jpeg: "image/jpeg",
+ gif: "image/gif",
+ png: "image/png",
+ svg: "image/svg+xml",
+ webp: "image/webp"
+ },
+ Yi = function(e) {
+ void 0 === e && (e = "");
+ var t = Ei(e);
+ return Wi[t.toLowerCase()] || ""
+ };
+
+ function qi(e) {
+ if (!e.type) {
+ var t = Yi(e.src);
+ t && (e.type = t)
+ }
+ return e
+ }
+ var Ki = function(e) {
+ function t(t, i, n) {
+ var r, a = zt({
+ createEl: !1
+ }, i);
+ if (r = e.call(this, t, a, n) || this, i.playerOptions.sources && 0 !== i.playerOptions.sources.length) t.src(i.playerOptions.sources);
+ else
+ for (var s = 0, o = i.playerOptions.techOrder; s < o.length; s++) {
+ var u = Ht(o[s]),
+ l = Ui.getTech(u);
+ if (u || (l = Kt.getComponent(u)), l && l.isSupported()) {
+ t.loadTech_(u);
+ break
+ }
+ }
+ return r
+ }
+ return L.default(t, e), t
+ }(Kt);
+ Kt.registerComponent("MediaLoader", Ki);
+ var Xi = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).handleMouseOver_ = function(e) {
+ return n.handleMouseOver(e)
+ }, n.handleMouseOut_ = function(e) {
+ return n.handleMouseOut(e)
+ }, n.handleClick_ = function(e) {
+ return n.handleClick(e)
+ }, n.handleKeyDown_ = function(e) {
+ return n.handleKeyDown(e)
+ }, n.emitTapEvents(), n.enable(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function(e, t, i) {
+ void 0 === e && (e = "div"), void 0 === t && (t = {}), void 0 === i && (i = {}), t = Z({
+ className: this.buildCSSClass(),
+ tabIndex: 0
+ }, t), "button" === e && K.error("Creating a ClickableComponent with an HTML element of " + e + " is not supported; use a Button instead."), i = Z({
+ role: "button"
+ }, i), this.tabIndex_ = t.tabIndex;
+ var n = xe(e, t, i);
+ return n.appendChild(xe("span", {
+ className: "vjs-icon-placeholder"
+ }, {
+ "aria-hidden": !0
+ })), this.createControlTextEl(n), n
+ }, i.dispose = function() {
+ this.controlTextEl_ = null, e.prototype.dispose.call(this)
+ }, i.createControlTextEl = function(e) {
+ return this.controlTextEl_ = xe("span", {
+ className: "vjs-control-text"
+ }, {
+ "aria-live": "polite"
+ }), e && e.appendChild(this.controlTextEl_), this.controlText(this.controlText_, e), this.controlTextEl_
+ }, i.controlText = function(e, t) {
+ if (void 0 === t && (t = this.el()), void 0 === e) return this.controlText_ || "Need Text";
+ var i = this.localize(e);
+ this.controlText_ = e, Re(this.controlTextEl_, i), this.nonIconControl || this.player_.options_.noUITitleAttributes || t.setAttribute("title", i)
+ }, i.buildCSSClass = function() {
+ return "vjs-control vjs-button " + e.prototype.buildCSSClass.call(this)
+ }, i.enable = function() {
+ this.enabled_ || (this.enabled_ = !0, this.removeClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "false"), void 0 !== this.tabIndex_ && this.el_.setAttribute("tabIndex", this.tabIndex_), this.on(["tap", "click"], this.handleClick_), this.on("keydown", this.handleKeyDown_))
+ }, i.disable = function() {
+ this.enabled_ = !1, this.addClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "true"), void 0 !== this.tabIndex_ && this.el_.removeAttribute("tabIndex"), this.off("mouseover", this.handleMouseOver_), this.off("mouseout", this.handleMouseOut_), this.off(["tap", "click"], this.handleClick_), this.off("keydown", this.handleKeyDown_)
+ }, i.handleLanguagechange = function() {
+ this.controlText(this.controlText_)
+ }, i.handleClick = function(e) {
+ this.options_.clickHandler && this.options_.clickHandler.call(this, arguments)
+ }, i.handleKeyDown = function(t) {
+ R.default.isEventKey(t, "Space") || R.default.isEventKey(t, "Enter") ? (t.preventDefault(), t.stopPropagation(), this.trigger("click")) : e.prototype.handleKeyDown.call(this, t)
+ }, t
+ }(Kt);
+ Kt.registerComponent("ClickableComponent", Xi);
+ var Qi = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update(), n.update_ = function(e) {
+ return n.update(e)
+ }, t.on("posterchange", n.update_), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.dispose = function() {
+ this.player().off("posterchange", this.update_), e.prototype.dispose.call(this)
+ }, i.createEl = function() {
+ return xe("div", {
+ className: "vjs-poster",
+ tabIndex: -1
+ })
+ }, i.update = function(e) {
+ var t = this.player().poster();
+ this.setSrc(t), t ? this.show() : this.hide()
+ }, i.setSrc = function(e) {
+ var t = "";
+ e && (t = 'url("' + e + '")'), this.el_.style.backgroundImage = t
+ }, i.handleClick = function(e) {
+ if (this.player_.controls()) {
+ var t = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
+ !this.player_.tech(!0) || (_e || fe) && t || this.player_.tech(!0).focus(), this.player_.paused() ? ii(this.player_.play()) : this.player_.pause()
+ }
+ }, t
+ }(Xi);
+ Kt.registerComponent("PosterImage", Qi);
+ var $i = {
+ monospace: "monospace",
+ sansSerif: "sans-serif",
+ serif: "serif",
+ monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
+ monospaceSerif: '"Courier New", monospace',
+ proportionalSansSerif: "sans-serif",
+ proportionalSerif: "serif",
+ casual: '"Comic Sans MS", Impact, fantasy',
+ script: '"Monotype Corsiva", cursive',
+ smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
+ };
+
+ function Ji(e, t) {
+ var i;
+ if (4 === e.length) i = e[1] + e[1] + e[2] + e[2] + e[3] + e[3];
+ else {
+ if (7 !== e.length) throw new Error("Invalid color code provided, " + e + "; must be formatted as e.g. #f0e or #f604e2.");
+ i = e.slice(1)
+ }
+ return "rgba(" + parseInt(i.slice(0, 2), 16) + "," + parseInt(i.slice(2, 4), 16) + "," + parseInt(i.slice(4, 6), 16) + "," + t + ")"
+ }
+
+ function Zi(e, t, i) {
+ try {
+ e.style[t] = i
+ } catch (e) {
+ return
+ }
+ }
+ var en = function(e) {
+ function t(t, i, n) {
+ var r;
+ r = e.call(this, t, i, n) || this;
+ var a = function(e) {
+ return r.updateDisplay(e)
+ };
+ return t.on("loadstart", (function(e) {
+ return r.toggleDisplay(e)
+ })), t.on("texttrackchange", a), t.on("loadedmetadata", (function(e) {
+ return r.preselectTrack(e)
+ })), t.ready(Ct(I.default(r), (function() {
+ if (t.tech_ && t.tech_.featuresNativeTextTracks) this.hide();
+ else {
+ t.on("fullscreenchange", a), t.on("playerresize", a), C.default.addEventListener("orientationchange", a), t.on("dispose", (function() {
+ return C.default.removeEventListener("orientationchange", a)
+ }));
+ for (var e = this.options_.playerOptions.tracks || [], i = 0; i < e.length; i++) this.player_.addRemoteTextTrack(e[i], !0);
+ this.preselectTrack()
+ }
+ }))), r
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.preselectTrack = function() {
+ for (var e, t, i, n = {
+ captions: 1,
+ subtitles: 1
+ }, r = this.player_.textTracks(), a = this.player_.cache_.selectedLanguage, s = 0; s < r.length; s++) {
+ var o = r[s];
+ a && a.enabled && a.language && a.language === o.language && o.kind in n ? o.kind === a.kind ? i = o : i || (i = o) : a && !a.enabled ? (i = null, e = null, t = null) : o.default && ("descriptions" !== o.kind || e ? o.kind in n && !t && (t = o) : e = o)
+ }
+ i ? i.mode = "showing" : t ? t.mode = "showing" : e && (e.mode = "showing")
+ }, i.toggleDisplay = function() {
+ this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show()
+ }, i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-text-track-display"
+ }, {
+ "aria-live": "off",
+ "aria-atomic": "true"
+ })
+ }, i.clearDisplay = function() {
+ "function" == typeof C.default.WebVTT && C.default.WebVTT.processCues(C.default, [], this.el_)
+ }, i.updateDisplay = function() {
+ var e = this.player_.textTracks(),
+ t = this.options_.allowMultipleShowingTracks;
+ if (this.clearDisplay(), t) {
+ for (var i = [], n = 0; n < e.length; ++n) {
+ var r = e[n];
+ "showing" === r.mode && i.push(r)
+ }
+ this.updateForTrack(i)
+ } else {
+ for (var a = null, s = null, o = e.length; o--;) {
+ var u = e[o];
+ "showing" === u.mode && ("descriptions" === u.kind ? a = u : s = u)
+ }
+ s ? ("off" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "off"), this.updateForTrack(s)) : a && ("assertive" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "assertive"), this.updateForTrack(a))
+ }
+ }, i.updateDisplayState = function(e) {
+ for (var t = this.player_.textTrackSettings.getValues(), i = e.activeCues, n = i.length; n--;) {
+ var r = i[n];
+ if (r) {
+ var a = r.displayState;
+ if (t.color && (a.firstChild.style.color = t.color), t.textOpacity && Zi(a.firstChild, "color", Ji(t.color || "#fff", t.textOpacity)), t.backgroundColor && (a.firstChild.style.backgroundColor = t.backgroundColor), t.backgroundOpacity && Zi(a.firstChild, "backgroundColor", Ji(t.backgroundColor || "#000", t.backgroundOpacity)), t.windowColor && (t.windowOpacity ? Zi(a, "backgroundColor", Ji(t.windowColor, t.windowOpacity)) : a.style.backgroundColor = t.windowColor), t.edgeStyle && ("dropshadow" === t.edgeStyle ? a.firstChild.style.textShadow = "2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222" : "raised" === t.edgeStyle ? a.firstChild.style.textShadow = "1px 1px #222, 2px 2px #222, 3px 3px #222" : "depressed" === t.edgeStyle ? a.firstChild.style.textShadow = "1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222" : "uniform" === t.edgeStyle && (a.firstChild.style.textShadow = "0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")), t.fontPercent && 1 !== t.fontPercent) {
+ var s = C.default.parseFloat(a.style.fontSize);
+ a.style.fontSize = s * t.fontPercent + "px", a.style.height = "auto", a.style.top = "auto"
+ }
+ t.fontFamily && "default" !== t.fontFamily && ("small-caps" === t.fontFamily ? a.firstChild.style.fontVariant = "small-caps" : a.firstChild.style.fontFamily = $i[t.fontFamily])
+ }
+ }
+ }, i.updateForTrack = function(e) {
+ if (Array.isArray(e) || (e = [e]), "function" == typeof C.default.WebVTT && !e.every((function(e) {
+ return !e.activeCues
+ }))) {
+ for (var t = [], i = 0; i < e.length; ++i)
+ for (var n = e[i], r = 0; r < n.activeCues.length; ++r) t.push(n.activeCues[r]);
+ C.default.WebVTT.processCues(C.default, t, this.el_);
+ for (var a = 0; a < e.length; ++a) {
+ for (var s = e[a], o = 0; o < s.activeCues.length; ++o) {
+ var u = s.activeCues[o].displayState;
+ Ue(u, "vjs-text-track-cue"), Ue(u, "vjs-text-track-cue-" + (s.language ? s.language : a))
+ }
+ this.player_.textTrackSettings && this.updateDisplayState(s)
+ }
+ }
+ }, t
+ }(Kt);
+ Kt.registerComponent("TextTrackDisplay", en);
+ var tn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ return L.default(t, e), t.prototype.createEl = function() {
+ var t = this.player_.isAudio(),
+ i = this.localize(t ? "Audio Player" : "Video Player"),
+ n = xe("span", {
+ className: "vjs-control-text",
+ textContent: this.localize("{1} is loading.", [i])
+ }),
+ r = e.prototype.createEl.call(this, "div", {
+ className: "vjs-loading-spinner",
+ dir: "ltr"
+ });
+ return r.appendChild(n), r
+ }, t
+ }(Kt);
+ Kt.registerComponent("LoadingSpinner", tn);
+ var nn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function(e, t, i) {
+ void 0 === t && (t = {}), void 0 === i && (i = {});
+ var n = xe("button", t = Z({
+ className: this.buildCSSClass()
+ }, t), i = Z({
+ type: "button"
+ }, i));
+ return n.appendChild(xe("span", {
+ className: "vjs-icon-placeholder"
+ }, {
+ "aria-hidden": !0
+ })), this.createControlTextEl(n), n
+ }, i.addChild = function(e, t) {
+ void 0 === t && (t = {});
+ var i = this.constructor.name;
+ return K.warn("Adding an actionable (user controllable) child to a Button (" + i + ") is not supported; use a ClickableComponent instead."), Kt.prototype.addChild.call(this, e, t)
+ }, i.enable = function() {
+ e.prototype.enable.call(this), this.el_.removeAttribute("disabled")
+ }, i.disable = function() {
+ e.prototype.disable.call(this), this.el_.setAttribute("disabled", "disabled")
+ }, i.handleKeyDown = function(t) {
+ R.default.isEventKey(t, "Space") || R.default.isEventKey(t, "Enter") ? t.stopPropagation() : e.prototype.handleKeyDown.call(this, t)
+ }, t
+ }(Xi);
+ Kt.registerComponent("Button", nn);
+ var rn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).mouseused_ = !1, n.on("mousedown", (function(e) {
+ return n.handleMouseDown(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-big-play-button"
+ }, i.handleClick = function(e) {
+ var t = this.player_.play();
+ if (this.mouseused_ && e.clientX && e.clientY) {
+ var i = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
+ return ii(t), void(!this.player_.tech(!0) || (_e || fe) && i || this.player_.tech(!0).focus())
+ }
+ var n = this.player_.getChild("controlBar"),
+ r = n && n.getChild("playToggle");
+ if (r) {
+ var a = function() {
+ return r.focus()
+ };
+ ti(t) ? t.then(a, (function() {})) : this.setTimeout(a, 1)
+ } else this.player_.tech(!0).focus()
+ }, i.handleKeyDown = function(t) {
+ this.mouseused_ = !1, e.prototype.handleKeyDown.call(this, t)
+ }, i.handleMouseDown = function(e) {
+ this.mouseused_ = !0
+ }, t
+ }(nn);
+ rn.prototype.controlText_ = "Play Video", Kt.registerComponent("BigPlayButton", rn);
+ var an = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).controlText(i && i.controlText || n.localize("Close")), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-close-button " + e.prototype.buildCSSClass.call(this)
+ }, i.handleClick = function(e) {
+ this.trigger({
+ type: "close",
+ bubbles: !1
+ })
+ }, i.handleKeyDown = function(t) {
+ R.default.isEventKey(t, "Esc") ? (t.preventDefault(), t.stopPropagation(), this.trigger("click")) : e.prototype.handleKeyDown.call(this, t)
+ }, t
+ }(nn);
+ Kt.registerComponent("CloseButton", an);
+ var sn = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === i && (i = {}), n = e.call(this, t, i) || this, i.replay = void 0 === i.replay || i.replay, n.on(t, "play", (function(e) {
+ return n.handlePlay(e)
+ })), n.on(t, "pause", (function(e) {
+ return n.handlePause(e)
+ })), i.replay && n.on(t, "ended", (function(e) {
+ return n.handleEnded(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-play-control " + e.prototype.buildCSSClass.call(this)
+ }, i.handleClick = function(e) {
+ this.player_.paused() ? ii(this.player_.play()) : this.player_.pause()
+ }, i.handleSeeked = function(e) {
+ this.removeClass("vjs-ended"), this.player_.paused() ? this.handlePause(e) : this.handlePlay(e)
+ }, i.handlePlay = function(e) {
+ this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this.controlText("Pause")
+ }, i.handlePause = function(e) {
+ this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.controlText("Play")
+ }, i.handleEnded = function(e) {
+ var t = this;
+ this.removeClass("vjs-playing"), this.addClass("vjs-ended"), this.controlText("Replay"), this.one(this.player_, "seeked", (function(e) {
+ return t.handleSeeked(e)
+ }))
+ }, t
+ }(nn);
+ sn.prototype.controlText_ = "Play", Kt.registerComponent("PlayToggle", sn);
+ var on = function(e, t) {
+ e = e < 0 ? 0 : e;
+ var i = Math.floor(e % 60),
+ n = Math.floor(e / 60 % 60),
+ r = Math.floor(e / 3600),
+ a = Math.floor(t / 60 % 60),
+ s = Math.floor(t / 3600);
+ return (isNaN(e) || e === 1 / 0) && (r = n = i = "-"), (r = r > 0 || s > 0 ? r + ":" : "") + (n = ((r || a >= 10) && n < 10 ? "0" + n : n) + ":") + (i = i < 10 ? "0" + i : i)
+ },
+ un = on;
+
+ function ln(e, t) {
+ return void 0 === t && (t = e), un(e, t)
+ }
+ var hn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on(t, ["timeupdate", "ended"], (function(e) {
+ return n.updateContent(e)
+ })), n.updateTextNode_(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = this.buildCSSClass(),
+ i = e.prototype.createEl.call(this, "div", {
+ className: t + " vjs-time-control vjs-control"
+ }),
+ n = xe("span", {
+ className: "vjs-control-text",
+ textContent: this.localize(this.labelText_) + " "
+ }, {
+ role: "presentation"
+ });
+ return i.appendChild(n), this.contentEl_ = xe("span", {
+ className: t + "-display"
+ }, {
+ "aria-live": "off",
+ role: "presentation"
+ }), i.appendChild(this.contentEl_), i
+ }, i.dispose = function() {
+ this.contentEl_ = null, this.textNode_ = null, e.prototype.dispose.call(this)
+ }, i.updateTextNode_ = function(e) {
+ var t = this;
+ void 0 === e && (e = 0), e = ln(e), this.formattedTime_ !== e && (this.formattedTime_ = e, this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", (function() {
+ if (t.contentEl_) {
+ var e = t.textNode_;
+ e && t.contentEl_.firstChild !== e && (e = null, K.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")), t.textNode_ = k.default.createTextNode(t.formattedTime_), t.textNode_ && (e ? t.contentEl_.replaceChild(t.textNode_, e) : t.contentEl_.appendChild(t.textNode_))
+ }
+ })))
+ }, i.updateContent = function(e) {}, t
+ }(Kt);
+ hn.prototype.labelText_ = "Time", hn.prototype.controlText_ = "Time", Kt.registerComponent("TimeDisplay", hn);
+ var dn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-current-time"
+ }, i.updateContent = function(e) {
+ var t;
+ t = this.player_.ended() ? this.player_.duration() : this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(), this.updateTextNode_(t)
+ }, t
+ }(hn);
+ dn.prototype.labelText_ = "Current Time", dn.prototype.controlText_ = "Current Time", Kt.registerComponent("CurrentTimeDisplay", dn);
+ var cn = function(e) {
+ function t(t, i) {
+ var n, r = function(e) {
+ return n.updateContent(e)
+ };
+ return (n = e.call(this, t, i) || this).on(t, "durationchange", r), n.on(t, "loadstart", r), n.on(t, "loadedmetadata", r), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-duration"
+ }, i.updateContent = function(e) {
+ var t = this.player_.duration();
+ this.updateTextNode_(t)
+ }, t
+ }(hn);
+ cn.prototype.labelText_ = "Duration", cn.prototype.controlText_ = "Duration", Kt.registerComponent("DurationDisplay", cn);
+ var fn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ return L.default(t, e), t.prototype.createEl = function() {
+ var t = e.prototype.createEl.call(this, "div", {
+ className: "vjs-time-control vjs-time-divider"
+ }, {
+ "aria-hidden": !0
+ }),
+ i = e.prototype.createEl.call(this, "div"),
+ n = e.prototype.createEl.call(this, "span", {
+ textContent: "/"
+ });
+ return i.appendChild(n), t.appendChild(i), t
+ }, t
+ }(Kt);
+ Kt.registerComponent("TimeDivider", fn);
+ var pn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on(t, "durationchange", (function(e) {
+ return n.updateContent(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-remaining-time"
+ }, i.createEl = function() {
+ var t = e.prototype.createEl.call(this);
+ return t.insertBefore(xe("span", {}, {
+ "aria-hidden": !0
+ }, "-"), this.contentEl_), t
+ }, i.updateContent = function(e) {
+ var t;
+ "number" == typeof this.player_.duration() && (t = this.player_.ended() ? 0 : this.player_.remainingTimeDisplay ? this.player_.remainingTimeDisplay() : this.player_.remainingTime(), this.updateTextNode_(t))
+ }, t
+ }(hn);
+ pn.prototype.labelText_ = "Remaining Time", pn.prototype.controlText_ = "Remaining Time", Kt.registerComponent("RemainingTimeDisplay", pn);
+ var mn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).updateShowing(), n.on(n.player(), "durationchange", (function(e) {
+ return n.updateShowing(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = e.prototype.createEl.call(this, "div", {
+ className: "vjs-live-control vjs-control"
+ });
+ return this.contentEl_ = xe("div", {
+ className: "vjs-live-display"
+ }, {
+ "aria-live": "off"
+ }), this.contentEl_.appendChild(xe("span", {
+ className: "vjs-control-text",
+ textContent: this.localize("Stream Type") + " "
+ })), this.contentEl_.appendChild(k.default.createTextNode(this.localize("LIVE"))), t.appendChild(this.contentEl_), t
+ }, i.dispose = function() {
+ this.contentEl_ = null, e.prototype.dispose.call(this)
+ }, i.updateShowing = function(e) {
+ this.player().duration() === 1 / 0 ? this.show() : this.hide()
+ }, t
+ }(Kt);
+ Kt.registerComponent("LiveDisplay", mn);
+ var _n = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).updateLiveEdgeStatus(), n.player_.liveTracker && (n.updateLiveEdgeStatusHandler_ = function(e) {
+ return n.updateLiveEdgeStatus(e)
+ }, n.on(n.player_.liveTracker, "liveedgechange", n.updateLiveEdgeStatusHandler_)), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = e.prototype.createEl.call(this, "button", {
+ className: "vjs-seek-to-live-control vjs-control"
+ });
+ return this.textEl_ = xe("span", {
+ className: "vjs-seek-to-live-text",
+ textContent: this.localize("LIVE")
+ }, {
+ "aria-hidden": "true"
+ }), t.appendChild(this.textEl_), t
+ }, i.updateLiveEdgeStatus = function() {
+ !this.player_.liveTracker || this.player_.liveTracker.atLiveEdge() ? (this.setAttribute("aria-disabled", !0), this.addClass("vjs-at-live-edge"), this.controlText("Seek to live, currently playing live")) : (this.setAttribute("aria-disabled", !1), this.removeClass("vjs-at-live-edge"), this.controlText("Seek to live, currently behind live"))
+ }, i.handleClick = function() {
+ this.player_.liveTracker.seekToLiveEdge()
+ }, i.dispose = function() {
+ this.player_.liveTracker && this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_), this.textEl_ = null, e.prototype.dispose.call(this)
+ }, t
+ }(nn);
+ _n.prototype.controlText_ = "Seek to live, currently playing live", Kt.registerComponent("SeekToLive", _n);
+ var gn = function(e, t, i) {
+ return e = Number(e), Math.min(i, Math.max(t, isNaN(e) ? t : e))
+ },
+ vn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).handleMouseDown_ = function(e) {
+ return n.handleMouseDown(e)
+ }, n.handleMouseUp_ = function(e) {
+ return n.handleMouseUp(e)
+ }, n.handleKeyDown_ = function(e) {
+ return n.handleKeyDown(e)
+ }, n.handleClick_ = function(e) {
+ return n.handleClick(e)
+ }, n.handleMouseMove_ = function(e) {
+ return n.handleMouseMove(e)
+ }, n.update_ = function(e) {
+ return n.update(e)
+ }, n.bar = n.getChild(n.options_.barName), n.vertical(!!n.options_.vertical), n.enable(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.enabled = function() {
+ return this.enabled_
+ }, i.enable = function() {
+ this.enabled() || (this.on("mousedown", this.handleMouseDown_), this.on("touchstart", this.handleMouseDown_), this.on("keydown", this.handleKeyDown_), this.on("click", this.handleClick_), this.on(this.player_, "controlsvisible", this.update), this.playerEvent && this.on(this.player_, this.playerEvent, this.update), this.removeClass("disabled"), this.setAttribute("tabindex", 0), this.enabled_ = !0)
+ }, i.disable = function() {
+ if (this.enabled()) {
+ var e = this.bar.el_.ownerDocument;
+ this.off("mousedown", this.handleMouseDown_), this.off("touchstart", this.handleMouseDown_), this.off("keydown", this.handleKeyDown_), this.off("click", this.handleClick_), this.off(this.player_, "controlsvisible", this.update_), this.off(e, "mousemove", this.handleMouseMove_), this.off(e, "mouseup", this.handleMouseUp_), this.off(e, "touchmove", this.handleMouseMove_), this.off(e, "touchend", this.handleMouseUp_), this.removeAttribute("tabindex"), this.addClass("disabled"), this.playerEvent && this.off(this.player_, this.playerEvent, this.update), this.enabled_ = !1
+ }
+ }, i.createEl = function(t, i, n) {
+ return void 0 === i && (i = {}), void 0 === n && (n = {}), i.className = i.className + " vjs-slider", i = Z({
+ tabIndex: 0
+ }, i), n = Z({
+ role: "slider",
+ "aria-valuenow": 0,
+ "aria-valuemin": 0,
+ "aria-valuemax": 100,
+ tabIndex: 0
+ }, n), e.prototype.createEl.call(this, t, i, n)
+ }, i.handleMouseDown = function(e) {
+ var t = this.bar.el_.ownerDocument;
+ "mousedown" === e.type && e.preventDefault(), "touchstart" !== e.type || pe || e.preventDefault(), ze(), this.addClass("vjs-sliding"), this.trigger("slideractive"), this.on(t, "mousemove", this.handleMouseMove_), this.on(t, "mouseup", this.handleMouseUp_), this.on(t, "touchmove", this.handleMouseMove_), this.on(t, "touchend", this.handleMouseUp_), this.handleMouseMove(e)
+ }, i.handleMouseMove = function(e) {}, i.handleMouseUp = function() {
+ var e = this.bar.el_.ownerDocument;
+ Ge(), this.removeClass("vjs-sliding"), this.trigger("sliderinactive"), this.off(e, "mousemove", this.handleMouseMove_), this.off(e, "mouseup", this.handleMouseUp_), this.off(e, "touchmove", this.handleMouseMove_), this.off(e, "touchend", this.handleMouseUp_), this.update()
+ }, i.update = function() {
+ var e = this;
+ if (this.el_ && this.bar) {
+ var t = this.getProgress();
+ return t === this.progress_ || (this.progress_ = t, this.requestNamedAnimationFrame("Slider#update", (function() {
+ var i = e.vertical() ? "height" : "width";
+ e.bar.el().style[i] = (100 * t).toFixed(2) + "%"
+ }))), t
+ }
+ }, i.getProgress = function() {
+ return Number(gn(this.getPercent(), 0, 1).toFixed(4))
+ }, i.calculateDistance = function(e) {
+ var t = qe(this.el_, e);
+ return this.vertical() ? t.y : t.x
+ }, i.handleKeyDown = function(t) {
+ R.default.isEventKey(t, "Left") || R.default.isEventKey(t, "Down") ? (t.preventDefault(), t.stopPropagation(), this.stepBack()) : R.default.isEventKey(t, "Right") || R.default.isEventKey(t, "Up") ? (t.preventDefault(), t.stopPropagation(), this.stepForward()) : e.prototype.handleKeyDown.call(this, t)
+ }, i.handleClick = function(e) {
+ e.stopPropagation(), e.preventDefault()
+ }, i.vertical = function(e) {
+ if (void 0 === e) return this.vertical_ || !1;
+ this.vertical_ = !!e, this.vertical_ ? this.addClass("vjs-slider-vertical") : this.addClass("vjs-slider-horizontal")
+ }, t
+ }(Kt);
+ Kt.registerComponent("Slider", vn);
+ var yn = function(e, t) {
+ return gn(e / t * 100, 0, 100).toFixed(2) + "%"
+ },
+ bn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).partEls_ = [], n.on(t, "progress", (function(e) {
+ return n.update(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = e.prototype.createEl.call(this, "div", {
+ className: "vjs-load-progress"
+ }),
+ i = xe("span", {
+ className: "vjs-control-text"
+ }),
+ n = xe("span", {
+ textContent: this.localize("Loaded")
+ }),
+ r = k.default.createTextNode(": ");
+ return this.percentageEl_ = xe("span", {
+ className: "vjs-control-text-loaded-percentage",
+ textContent: "0%"
+ }), t.appendChild(i), i.appendChild(n), i.appendChild(r), i.appendChild(this.percentageEl_), t
+ }, i.dispose = function() {
+ this.partEls_ = null, this.percentageEl_ = null, e.prototype.dispose.call(this)
+ }, i.update = function(e) {
+ var t = this;
+ this.requestNamedAnimationFrame("LoadProgressBar#update", (function() {
+ var e = t.player_.liveTracker,
+ i = t.player_.buffered(),
+ n = e && e.isLive() ? e.seekableEnd() : t.player_.duration(),
+ r = t.player_.bufferedEnd(),
+ a = t.partEls_,
+ s = yn(r, n);
+ t.percent_ !== s && (t.el_.style.width = s, Re(t.percentageEl_, s), t.percent_ = s);
+ for (var o = 0; o < i.length; o++) {
+ var u = i.start(o),
+ l = i.end(o),
+ h = a[o];
+ h || (h = t.el_.appendChild(xe()), a[o] = h), h.dataset.start === u && h.dataset.end === l || (h.dataset.start = u, h.dataset.end = l, h.style.left = yn(u, r), h.style.width = yn(l - u, r))
+ }
+ for (var d = a.length; d > i.length; d--) t.el_.removeChild(a[d - 1]);
+ a.length = i.length
+ }))
+ }, t
+ }(Kt);
+ Kt.registerComponent("LoadProgressBar", bn);
+ var Sn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update = kt(Ct(I.default(n), n.update), 30), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-time-tooltip"
+ }, {
+ "aria-hidden": "true"
+ })
+ }, i.update = function(e, t, i) {
+ var n = Ye(this.el_),
+ r = We(this.player_.el()),
+ a = e.width * t;
+ if (r && n) {
+ var s = e.left - r.left + a,
+ o = e.width - a + (r.right - e.right),
+ u = n.width / 2;
+ s < u ? u += u - s : o < u && (u = o), u < 0 ? u = 0 : u > n.width && (u = n.width), u = Math.round(u), this.el_.style.right = "-" + u + "px", this.write(i)
+ }
+ }, i.write = function(e) {
+ Re(this.el_, e)
+ }, i.updateTime = function(e, t, i, n) {
+ var r = this;
+ this.requestNamedAnimationFrame("TimeTooltip#updateTime", (function() {
+ var a, s = r.player_.duration();
+ if (r.player_.liveTracker && r.player_.liveTracker.isLive()) {
+ var o = r.player_.liveTracker.liveWindow(),
+ u = o - t * o;
+ a = (u < 1 ? "" : "-") + ln(u, o)
+ } else a = ln(i, s);
+ r.update(e, t, a), n && n()
+ }))
+ }, t
+ }(Kt);
+ Kt.registerComponent("TimeTooltip", Sn);
+ var Tn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update = kt(Ct(I.default(n), n.update), 30), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-play-progress vjs-slider-bar"
+ }, {
+ "aria-hidden": "true"
+ })
+ }, i.update = function(e, t) {
+ var i = this.getChild("timeTooltip");
+ if (i) {
+ var n = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
+ i.updateTime(e, t, n)
+ }
+ }, t
+ }(Kt);
+ Tn.prototype.options_ = {
+ children: []
+ }, Te || le || Tn.prototype.options_.children.push("timeTooltip"), Kt.registerComponent("PlayProgressBar", Tn);
+ var En = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update = kt(Ct(I.default(n), n.update), 30), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-mouse-display"
+ })
+ }, i.update = function(e, t) {
+ var i = this,
+ n = t * this.player_.duration();
+ this.getChild("timeTooltip").updateTime(e, t, n, (function() {
+ i.el_.style.left = e.width * t + "px"
+ }))
+ }, t
+ }(Kt);
+ En.prototype.options_ = {
+ children: ["timeTooltip"]
+ }, Kt.registerComponent("MouseTimeDisplay", En);
+ var wn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).setEventHandlers_(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.setEventHandlers_ = function() {
+ var e = this;
+ this.update_ = Ct(this, this.update), this.update = kt(this.update_, 30), this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update), this.player_.liveTracker && this.on(this.player_.liveTracker, "liveedgechange", this.update), this.updateInterval = null, this.enableIntervalHandler_ = function(t) {
+ return e.enableInterval_(t)
+ }, this.disableIntervalHandler_ = function(t) {
+ return e.disableInterval_(t)
+ }, this.on(this.player_, ["playing"], this.enableIntervalHandler_), this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_), "hidden" in k.default && "visibilityState" in k.default && this.on(k.default, "visibilitychange", this.toggleVisibility_)
+ }, i.toggleVisibility_ = function(e) {
+ "hidden" === k.default.visibilityState ? (this.cancelNamedAnimationFrame("SeekBar#update"), this.cancelNamedAnimationFrame("Slider#update"), this.disableInterval_(e)) : (this.player_.ended() || this.player_.paused() || this.enableInterval_(), this.update())
+ }, i.enableInterval_ = function() {
+ this.updateInterval || (this.updateInterval = this.setInterval(this.update, 30))
+ }, i.disableInterval_ = function(e) {
+ this.player_.liveTracker && this.player_.liveTracker.isLive() && e && "ended" !== e.type || this.updateInterval && (this.clearInterval(this.updateInterval), this.updateInterval = null)
+ }, i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-progress-holder"
+ }, {
+ "aria-label": this.localize("Progress Bar")
+ })
+ }, i.update = function(t) {
+ var i = this;
+ if ("hidden" !== k.default.visibilityState) {
+ var n = e.prototype.update.call(this);
+ return this.requestNamedAnimationFrame("SeekBar#update", (function() {
+ var e = i.player_.ended() ? i.player_.duration() : i.getCurrentTime_(),
+ t = i.player_.liveTracker,
+ r = i.player_.duration();
+ t && t.isLive() && (r = i.player_.liveTracker.liveCurrentTime()), i.percent_ !== n && (i.el_.setAttribute("aria-valuenow", (100 * n).toFixed(2)), i.percent_ = n), i.currentTime_ === e && i.duration_ === r || (i.el_.setAttribute("aria-valuetext", i.localize("progress bar timing: currentTime={1} duration={2}", [ln(e, r), ln(r, r)], "{1} of {2}")), i.currentTime_ = e, i.duration_ = r), i.bar && i.bar.update(We(i.el()), i.getProgress())
+ })), n
+ }
+ }, i.userSeek_ = function(e) {
+ this.player_.liveTracker && this.player_.liveTracker.isLive() && this.player_.liveTracker.nextSeekedFromUser(), this.player_.currentTime(e)
+ }, i.getCurrentTime_ = function() {
+ return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime()
+ }, i.getPercent = function() {
+ var e, t = this.getCurrentTime_(),
+ i = this.player_.liveTracker;
+ return i && i.isLive() ? (e = (t - i.seekableStart()) / i.liveWindow(), i.atLiveEdge() && (e = 1)) : e = t / this.player_.duration(), e
+ }, i.handleMouseDown = function(t) {
+ Ze(t) && (t.stopPropagation(), this.player_.scrubbing(!0), this.videoWasPlaying = !this.player_.paused(), this.player_.pause(), e.prototype.handleMouseDown.call(this, t))
+ }, i.handleMouseMove = function(e) {
+ if (Ze(e)) {
+ var t, i = this.calculateDistance(e),
+ n = this.player_.liveTracker;
+ if (n && n.isLive()) {
+ if (i >= .99) return void n.seekToLiveEdge();
+ var r = n.seekableStart(),
+ a = n.liveCurrentTime();
+ if ((t = r + i * n.liveWindow()) >= a && (t = a), t <= r && (t = r + .1), t === 1 / 0) return
+ } else(t = i * this.player_.duration()) === this.player_.duration() && (t -= .1);
+ this.userSeek_(t)
+ }
+ }, i.enable = function() {
+ e.prototype.enable.call(this);
+ var t = this.getChild("mouseTimeDisplay");
+ t && t.show()
+ }, i.disable = function() {
+ e.prototype.disable.call(this);
+ var t = this.getChild("mouseTimeDisplay");
+ t && t.hide()
+ }, i.handleMouseUp = function(t) {
+ e.prototype.handleMouseUp.call(this, t), t && t.stopPropagation(), this.player_.scrubbing(!1), this.player_.trigger({
+ type: "timeupdate",
+ target: this,
+ manuallyTriggered: !0
+ }), this.videoWasPlaying ? ii(this.player_.play()) : this.update_()
+ }, i.stepForward = function() {
+ this.userSeek_(this.player_.currentTime() + 5)
+ }, i.stepBack = function() {
+ this.userSeek_(this.player_.currentTime() - 5)
+ }, i.handleAction = function(e) {
+ this.player_.paused() ? this.player_.play() : this.player_.pause()
+ }, i.handleKeyDown = function(t) {
+ var i = this.player_.liveTracker;
+ if (R.default.isEventKey(t, "Space") || R.default.isEventKey(t, "Enter")) t.preventDefault(), t.stopPropagation(), this.handleAction(t);
+ else if (R.default.isEventKey(t, "Home")) t.preventDefault(), t.stopPropagation(), this.userSeek_(0);
+ else if (R.default.isEventKey(t, "End")) t.preventDefault(), t.stopPropagation(), i && i.isLive() ? this.userSeek_(i.liveCurrentTime()) : this.userSeek_(this.player_.duration());
+ else if (/^[0-9]$/.test(R.default(t))) {
+ t.preventDefault(), t.stopPropagation();
+ var n = 10 * (R.default.codes[R.default(t)] - R.default.codes[0]) / 100;
+ i && i.isLive() ? this.userSeek_(i.seekableStart() + i.liveWindow() * n) : this.userSeek_(this.player_.duration() * n)
+ } else R.default.isEventKey(t, "PgDn") ? (t.preventDefault(), t.stopPropagation(), this.userSeek_(this.player_.currentTime() - 60)) : R.default.isEventKey(t, "PgUp") ? (t.preventDefault(), t.stopPropagation(), this.userSeek_(this.player_.currentTime() + 60)) : e.prototype.handleKeyDown.call(this, t)
+ }, i.dispose = function() {
+ this.disableInterval_(), this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update), this.player_.liveTracker && this.off(this.player_.liveTracker, "liveedgechange", this.update), this.off(this.player_, ["playing"], this.enableIntervalHandler_), this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_), "hidden" in k.default && "visibilityState" in k.default && this.off(k.default, "visibilitychange", this.toggleVisibility_), e.prototype.dispose.call(this)
+ }, t
+ }(vn);
+ wn.prototype.options_ = {
+ children: ["loadProgressBar", "playProgressBar"],
+ barName: "playProgressBar"
+ }, Te || le || wn.prototype.options_.children.splice(1, 0, "mouseTimeDisplay"), Kt.registerComponent("SeekBar", wn);
+ var An = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).handleMouseMove = kt(Ct(I.default(n), n.handleMouseMove), 30), n.throttledHandleMouseSeek = kt(Ct(I.default(n), n.handleMouseSeek), 30), n.handleMouseUpHandler_ = function(e) {
+ return n.handleMouseUp(e)
+ }, n.handleMouseDownHandler_ = function(e) {
+ return n.handleMouseDown(e)
+ }, n.enable(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-progress-control vjs-control"
+ })
+ }, i.handleMouseMove = function(e) {
+ var t = this.getChild("seekBar");
+ if (t) {
+ var i = t.getChild("playProgressBar"),
+ n = t.getChild("mouseTimeDisplay");
+ if (i || n) {
+ var r = t.el(),
+ a = Ye(r),
+ s = qe(r, e).x;
+ s = gn(s, 0, 1), n && n.update(a, s), i && i.update(a, t.getProgress())
+ }
+ }
+ }, i.handleMouseSeek = function(e) {
+ var t = this.getChild("seekBar");
+ t && t.handleMouseMove(e)
+ }, i.enabled = function() {
+ return this.enabled_
+ }, i.disable = function() {
+ if (this.children().forEach((function(e) {
+ return e.disable && e.disable()
+ })), this.enabled() && (this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_), this.off(this.el_, "mousemove", this.handleMouseMove), this.removeListenersAddedOnMousedownAndTouchstart(), this.addClass("disabled"), this.enabled_ = !1, this.player_.scrubbing())) {
+ var e = this.getChild("seekBar");
+ this.player_.scrubbing(!1), e.videoWasPlaying && ii(this.player_.play())
+ }
+ }, i.enable = function() {
+ this.children().forEach((function(e) {
+ return e.enable && e.enable()
+ })), this.enabled() || (this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_), this.on(this.el_, "mousemove", this.handleMouseMove), this.removeClass("disabled"), this.enabled_ = !0)
+ }, i.removeListenersAddedOnMousedownAndTouchstart = function() {
+ var e = this.el_.ownerDocument;
+ this.off(e, "mousemove", this.throttledHandleMouseSeek), this.off(e, "touchmove", this.throttledHandleMouseSeek), this.off(e, "mouseup", this.handleMouseUpHandler_), this.off(e, "touchend", this.handleMouseUpHandler_)
+ }, i.handleMouseDown = function(e) {
+ var t = this.el_.ownerDocument,
+ i = this.getChild("seekBar");
+ i && i.handleMouseDown(e), this.on(t, "mousemove", this.throttledHandleMouseSeek), this.on(t, "touchmove", this.throttledHandleMouseSeek), this.on(t, "mouseup", this.handleMouseUpHandler_), this.on(t, "touchend", this.handleMouseUpHandler_)
+ }, i.handleMouseUp = function(e) {
+ var t = this.getChild("seekBar");
+ t && t.handleMouseUp(e), this.removeListenersAddedOnMousedownAndTouchstart()
+ }, t
+ }(Kt);
+ An.prototype.options_ = {
+ children: ["seekBar"]
+ }, Kt.registerComponent("ProgressControl", An);
+ var Cn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on(t, ["enterpictureinpicture", "leavepictureinpicture"], (function(e) {
+ return n.handlePictureInPictureChange(e)
+ })), n.on(t, ["disablepictureinpicturechanged", "loadedmetadata"], (function(e) {
+ return n.handlePictureInPictureEnabledChange(e)
+ })), n.disable(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-picture-in-picture-control " + e.prototype.buildCSSClass.call(this)
+ }, i.handlePictureInPictureEnabledChange = function() {
+ k.default.pictureInPictureEnabled && !1 === this.player_.disablePictureInPicture() ? this.enable() : this.disable()
+ }, i.handlePictureInPictureChange = function(e) {
+ this.player_.isInPictureInPicture() ? this.controlText("Exit Picture-in-Picture") : this.controlText("Picture-in-Picture"), this.handlePictureInPictureEnabledChange()
+ }, i.handleClick = function(e) {
+ this.player_.isInPictureInPicture() ? this.player_.exitPictureInPicture() : this.player_.requestPictureInPicture()
+ }, t
+ }(nn);
+ Cn.prototype.controlText_ = "Picture-in-Picture", Kt.registerComponent("PictureInPictureToggle", Cn);
+ var kn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on(t, "fullscreenchange", (function(e) {
+ return n.handleFullscreenChange(e)
+ })), !1 === k.default[t.fsApi_.fullscreenEnabled] && n.disable(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-fullscreen-control " + e.prototype.buildCSSClass.call(this)
+ }, i.handleFullscreenChange = function(e) {
+ this.player_.isFullscreen() ? this.controlText("Non-Fullscreen") : this.controlText("Fullscreen")
+ }, i.handleClick = function(e) {
+ this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen()
+ }, t
+ }(nn);
+ kn.prototype.controlText_ = "Fullscreen", Kt.registerComponent("FullscreenToggle", kn);
+ var Pn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ return L.default(t, e), t.prototype.createEl = function() {
+ var t = e.prototype.createEl.call(this, "div", {
+ className: "vjs-volume-level"
+ });
+ return t.appendChild(e.prototype.createEl.call(this, "span", {
+ className: "vjs-control-text"
+ })), t
+ }, t
+ }(Kt);
+ Kt.registerComponent("VolumeLevel", Pn);
+ var In = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update = kt(Ct(I.default(n), n.update), 30), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-volume-tooltip"
+ }, {
+ "aria-hidden": "true"
+ })
+ }, i.update = function(e, t, i, n) {
+ if (!i) {
+ var r = We(this.el_),
+ a = We(this.player_.el()),
+ s = e.width * t;
+ if (!a || !r) return;
+ var o = e.left - a.left + s,
+ u = e.width - s + (a.right - e.right),
+ l = r.width / 2;
+ o < l ? l += l - o : u < l && (l = u), l < 0 ? l = 0 : l > r.width && (l = r.width), this.el_.style.right = "-" + l + "px"
+ }
+ this.write(n + "%")
+ }, i.write = function(e) {
+ Re(this.el_, e)
+ }, i.updateVolume = function(e, t, i, n, r) {
+ var a = this;
+ this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", (function() {
+ a.update(e, t, i, n.toFixed(0)), r && r()
+ }))
+ }, t
+ }(Kt);
+ Kt.registerComponent("VolumeLevelTooltip", In);
+ var Ln = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).update = kt(Ct(I.default(n), n.update), 30), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-mouse-display"
+ })
+ }, i.update = function(e, t, i) {
+ var n = this,
+ r = 100 * t;
+ this.getChild("volumeLevelTooltip").updateVolume(e, t, i, r, (function() {
+ i ? n.el_.style.bottom = e.height * t + "px" : n.el_.style.left = e.width * t + "px"
+ }))
+ }, t
+ }(Kt);
+ Ln.prototype.options_ = {
+ children: ["volumeLevelTooltip"]
+ }, Kt.registerComponent("MouseVolumeLevelDisplay", Ln);
+ var xn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on("slideractive", (function(e) {
+ return n.updateLastVolume_(e)
+ })), n.on(t, "volumechange", (function(e) {
+ return n.updateARIAAttributes(e)
+ })), t.ready((function() {
+ return n.updateARIAAttributes()
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-volume-bar vjs-slider-bar"
+ }, {
+ "aria-label": this.localize("Volume Level"),
+ "aria-live": "polite"
+ })
+ }, i.handleMouseDown = function(t) {
+ Ze(t) && e.prototype.handleMouseDown.call(this, t)
+ }, i.handleMouseMove = function(e) {
+ var t = this.getChild("mouseVolumeLevelDisplay");
+ if (t) {
+ var i = this.el(),
+ n = We(i),
+ r = this.vertical(),
+ a = qe(i, e);
+ a = r ? a.y : a.x, a = gn(a, 0, 1), t.update(n, a, r)
+ }
+ Ze(e) && (this.checkMuted(), this.player_.volume(this.calculateDistance(e)))
+ }, i.checkMuted = function() {
+ this.player_.muted() && this.player_.muted(!1)
+ }, i.getPercent = function() {
+ return this.player_.muted() ? 0 : this.player_.volume()
+ }, i.stepForward = function() {
+ this.checkMuted(), this.player_.volume(this.player_.volume() + .1)
+ }, i.stepBack = function() {
+ this.checkMuted(), this.player_.volume(this.player_.volume() - .1)
+ }, i.updateARIAAttributes = function(e) {
+ var t = this.player_.muted() ? 0 : this.volumeAsPercentage_();
+ this.el_.setAttribute("aria-valuenow", t), this.el_.setAttribute("aria-valuetext", t + "%")
+ }, i.volumeAsPercentage_ = function() {
+ return Math.round(100 * this.player_.volume())
+ }, i.updateLastVolume_ = function() {
+ var e = this,
+ t = this.player_.volume();
+ this.one("sliderinactive", (function() {
+ 0 === e.player_.volume() && e.player_.lastVolume_(t)
+ }))
+ }, t
+ }(vn);
+ xn.prototype.options_ = {
+ children: ["volumeLevel"],
+ barName: "volumeLevel"
+ }, Te || le || xn.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay"), xn.prototype.playerEvent = "volumechange", Kt.registerComponent("VolumeBar", xn);
+ var Rn = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === i && (i = {}), i.vertical = i.vertical || !1, (void 0 === i.volumeBar || te(i.volumeBar)) && (i.volumeBar = i.volumeBar || {}, i.volumeBar.vertical = i.vertical), n = e.call(this, t, i) || this,
+ function(e, t) {
+ t.tech_ && !t.tech_.featuresVolumeControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", (function() {
+ t.tech_.featuresVolumeControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
+ }))
+ }(I.default(n), t), n.throttledHandleMouseMove = kt(Ct(I.default(n), n.handleMouseMove), 30), n.handleMouseUpHandler_ = function(e) {
+ return n.handleMouseUp(e)
+ }, n.on("mousedown", (function(e) {
+ return n.handleMouseDown(e)
+ })), n.on("touchstart", (function(e) {
+ return n.handleMouseDown(e)
+ })), n.on("mousemove", (function(e) {
+ return n.handleMouseMove(e)
+ })), n.on(n.volumeBar, ["focus", "slideractive"], (function() {
+ n.volumeBar.addClass("vjs-slider-active"), n.addClass("vjs-slider-active"), n.trigger("slideractive")
+ })), n.on(n.volumeBar, ["blur", "sliderinactive"], (function() {
+ n.volumeBar.removeClass("vjs-slider-active"), n.removeClass("vjs-slider-active"), n.trigger("sliderinactive")
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = "vjs-volume-horizontal";
+ return this.options_.vertical && (t = "vjs-volume-vertical"), e.prototype.createEl.call(this, "div", {
+ className: "vjs-volume-control vjs-control " + t
+ })
+ }, i.handleMouseDown = function(e) {
+ var t = this.el_.ownerDocument;
+ this.on(t, "mousemove", this.throttledHandleMouseMove), this.on(t, "touchmove", this.throttledHandleMouseMove), this.on(t, "mouseup", this.handleMouseUpHandler_), this.on(t, "touchend", this.handleMouseUpHandler_)
+ }, i.handleMouseUp = function(e) {
+ var t = this.el_.ownerDocument;
+ this.off(t, "mousemove", this.throttledHandleMouseMove), this.off(t, "touchmove", this.throttledHandleMouseMove), this.off(t, "mouseup", this.handleMouseUpHandler_), this.off(t, "touchend", this.handleMouseUpHandler_)
+ }, i.handleMouseMove = function(e) {
+ this.volumeBar.handleMouseMove(e)
+ }, t
+ }(Kt);
+ Rn.prototype.options_ = {
+ children: ["volumeBar"]
+ }, Kt.registerComponent("VolumeControl", Rn);
+ var Dn = function(e) {
+ function t(t, i) {
+ var n;
+ return n = e.call(this, t, i) || this,
+ function(e, t) {
+ t.tech_ && !t.tech_.featuresMuteControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", (function() {
+ t.tech_.featuresMuteControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
+ }))
+ }(I.default(n), t), n.on(t, ["loadstart", "volumechange"], (function(e) {
+ return n.update(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-mute-control " + e.prototype.buildCSSClass.call(this)
+ }, i.handleClick = function(e) {
+ var t = this.player_.volume(),
+ i = this.player_.lastVolume_();
+ if (0 === t) {
+ var n = i < .1 ? .1 : i;
+ this.player_.volume(n), this.player_.muted(!1)
+ } else this.player_.muted(!this.player_.muted())
+ }, i.update = function(e) {
+ this.updateIcon_(), this.updateControlText_()
+ }, i.updateIcon_ = function() {
+ var e = this.player_.volume(),
+ t = 3;
+ Te && this.player_.tech_ && this.player_.tech_.el_ && this.player_.muted(this.player_.tech_.el_.muted), 0 === e || this.player_.muted() ? t = 0 : e < .33 ? t = 1 : e < .67 && (t = 2);
+ for (var i = 0; i < 4; i++) Me(this.el_, "vjs-vol-" + i);
+ Ue(this.el_, "vjs-vol-" + t)
+ }, i.updateControlText_ = function() {
+ var e = this.player_.muted() || 0 === this.player_.volume() ? "Unmute" : "Mute";
+ this.controlText() !== e && this.controlText(e)
+ }, t
+ }(nn);
+ Dn.prototype.controlText_ = "Mute", Kt.registerComponent("MuteToggle", Dn);
+ var On = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === i && (i = {}), void 0 !== i.inline ? i.inline = i.inline : i.inline = !0, (void 0 === i.volumeControl || te(i.volumeControl)) && (i.volumeControl = i.volumeControl || {}, i.volumeControl.vertical = !i.inline), (n = e.call(this, t, i) || this).handleKeyPressHandler_ = function(e) {
+ return n.handleKeyPress(e)
+ }, n.on(t, ["loadstart"], (function(e) {
+ return n.volumePanelState_(e)
+ })), n.on(n.muteToggle, "keyup", (function(e) {
+ return n.handleKeyPress(e)
+ })), n.on(n.volumeControl, "keyup", (function(e) {
+ return n.handleVolumeControlKeyUp(e)
+ })), n.on("keydown", (function(e) {
+ return n.handleKeyPress(e)
+ })), n.on("mouseover", (function(e) {
+ return n.handleMouseOver(e)
+ })), n.on("mouseout", (function(e) {
+ return n.handleMouseOut(e)
+ })), n.on(n.volumeControl, ["slideractive"], n.sliderActive_), n.on(n.volumeControl, ["sliderinactive"], n.sliderInactive_), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.sliderActive_ = function() {
+ this.addClass("vjs-slider-active")
+ }, i.sliderInactive_ = function() {
+ this.removeClass("vjs-slider-active")
+ }, i.volumePanelState_ = function() {
+ this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden") && this.addClass("vjs-hidden"), this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden") && this.addClass("vjs-mute-toggle-only")
+ }, i.createEl = function() {
+ var t = "vjs-volume-panel-horizontal";
+ return this.options_.inline || (t = "vjs-volume-panel-vertical"), e.prototype.createEl.call(this, "div", {
+ className: "vjs-volume-panel vjs-control " + t
+ })
+ }, i.dispose = function() {
+ this.handleMouseOut(), e.prototype.dispose.call(this)
+ }, i.handleVolumeControlKeyUp = function(e) {
+ R.default.isEventKey(e, "Esc") && this.muteToggle.focus()
+ }, i.handleMouseOver = function(e) {
+ this.addClass("vjs-hover"), yt(k.default, "keyup", this.handleKeyPressHandler_)
+ }, i.handleMouseOut = function(e) {
+ this.removeClass("vjs-hover"), bt(k.default, "keyup", this.handleKeyPressHandler_)
+ }, i.handleKeyPress = function(e) {
+ R.default.isEventKey(e, "Esc") && this.handleMouseOut()
+ }, t
+ }(Kt);
+ On.prototype.options_ = {
+ children: ["muteToggle", "volumeControl"]
+ }, Kt.registerComponent("VolumePanel", On);
+ var Un = function(e) {
+ function t(t, i) {
+ var n;
+ return n = e.call(this, t, i) || this, i && (n.menuButton_ = i.menuButton), n.focusedChild_ = -1, n.on("keydown", (function(e) {
+ return n.handleKeyDown(e)
+ })), n.boundHandleBlur_ = function(e) {
+ return n.handleBlur(e)
+ }, n.boundHandleTapClick_ = function(e) {
+ return n.handleTapClick(e)
+ }, n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.addEventListenerForItem = function(e) {
+ e instanceof Kt && (this.on(e, "blur", this.boundHandleBlur_), this.on(e, ["tap", "click"], this.boundHandleTapClick_))
+ }, i.removeEventListenerForItem = function(e) {
+ e instanceof Kt && (this.off(e, "blur", this.boundHandleBlur_), this.off(e, ["tap", "click"], this.boundHandleTapClick_))
+ }, i.removeChild = function(t) {
+ "string" == typeof t && (t = this.getChild(t)), this.removeEventListenerForItem(t), e.prototype.removeChild.call(this, t)
+ }, i.addItem = function(e) {
+ var t = this.addChild(e);
+ t && this.addEventListenerForItem(t)
+ }, i.createEl = function() {
+ var t = this.options_.contentElType || "ul";
+ this.contentEl_ = xe(t, {
+ className: "vjs-menu-content"
+ }), this.contentEl_.setAttribute("role", "menu");
+ var i = e.prototype.createEl.call(this, "div", {
+ append: this.contentEl_,
+ className: "vjs-menu"
+ });
+ return i.appendChild(this.contentEl_), yt(i, "click", (function(e) {
+ e.preventDefault(), e.stopImmediatePropagation()
+ })), i
+ }, i.dispose = function() {
+ this.contentEl_ = null, this.boundHandleBlur_ = null, this.boundHandleTapClick_ = null, e.prototype.dispose.call(this)
+ }, i.handleBlur = function(e) {
+ var t = e.relatedTarget || k.default.activeElement;
+ if (!this.children().some((function(e) {
+ return e.el() === t
+ }))) {
+ var i = this.menuButton_;
+ i && i.buttonPressed_ && t !== i.el().firstChild && i.unpressButton()
+ }
+ }, i.handleTapClick = function(e) {
+ if (this.menuButton_) {
+ this.menuButton_.unpressButton();
+ var t = this.children();
+ if (!Array.isArray(t)) return;
+ var i = t.filter((function(t) {
+ return t.el() === e.target
+ }))[0];
+ if (!i) return;
+ "CaptionSettingsMenuItem" !== i.name() && this.menuButton_.focus()
+ }
+ }, i.handleKeyDown = function(e) {
+ R.default.isEventKey(e, "Left") || R.default.isEventKey(e, "Down") ? (e.preventDefault(), e.stopPropagation(), this.stepForward()) : (R.default.isEventKey(e, "Right") || R.default.isEventKey(e, "Up")) && (e.preventDefault(), e.stopPropagation(), this.stepBack())
+ }, i.stepForward = function() {
+ var e = 0;
+ void 0 !== this.focusedChild_ && (e = this.focusedChild_ + 1), this.focus(e)
+ }, i.stepBack = function() {
+ var e = 0;
+ void 0 !== this.focusedChild_ && (e = this.focusedChild_ - 1), this.focus(e)
+ }, i.focus = function(e) {
+ void 0 === e && (e = 0);
+ var t = this.children().slice();
+ t.length && t[0].hasClass("vjs-menu-title") && t.shift(), t.length > 0 && (e < 0 ? e = 0 : e >= t.length && (e = t.length - 1), this.focusedChild_ = e, t[e].el_.focus())
+ }, t
+ }(Kt);
+ Kt.registerComponent("Menu", Un);
+ var Mn = function(e) {
+ function t(t, i) {
+ var n;
+ void 0 === i && (i = {}), (n = e.call(this, t, i) || this).menuButton_ = new nn(t, i), n.menuButton_.controlText(n.controlText_), n.menuButton_.el_.setAttribute("aria-haspopup", "true");
+ var r = nn.prototype.buildCSSClass();
+ n.menuButton_.el_.className = n.buildCSSClass() + " " + r, n.menuButton_.removeClass("vjs-control"), n.addChild(n.menuButton_), n.update(), n.enabled_ = !0;
+ var a = function(e) {
+ return n.handleClick(e)
+ };
+ return n.handleMenuKeyUp_ = function(e) {
+ return n.handleMenuKeyUp(e)
+ }, n.on(n.menuButton_, "tap", a), n.on(n.menuButton_, "click", a), n.on(n.menuButton_, "keydown", (function(e) {
+ return n.handleKeyDown(e)
+ })), n.on(n.menuButton_, "mouseenter", (function() {
+ n.addClass("vjs-hover"), n.menu.show(), yt(k.default, "keyup", n.handleMenuKeyUp_)
+ })), n.on("mouseleave", (function(e) {
+ return n.handleMouseLeave(e)
+ })), n.on("keydown", (function(e) {
+ return n.handleSubmenuKeyDown(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.update = function() {
+ var e = this.createMenu();
+ this.menu && (this.menu.dispose(), this.removeChild(this.menu)), this.menu = e, this.addChild(e), this.buttonPressed_ = !1, this.menuButton_.el_.setAttribute("aria-expanded", "false"), this.items && this.items.length <= this.hideThreshold_ ? this.hide() : this.show()
+ }, i.createMenu = function() {
+ var e = new Un(this.player_, {
+ menuButton: this
+ });
+ if (this.hideThreshold_ = 0, this.options_.title) {
+ var t = xe("li", {
+ className: "vjs-menu-title",
+ textContent: Ht(this.options_.title),
+ tabIndex: -1
+ }),
+ i = new Kt(this.player_, {
+ el: t
+ });
+ e.addItem(i)
+ }
+ if (this.items = this.createItems(), this.items)
+ for (var n = 0; n < this.items.length; n++) e.addItem(this.items[n]);
+ return e
+ }, i.createItems = function() {}, i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: this.buildWrapperCSSClass()
+ }, {})
+ }, i.buildWrapperCSSClass = function() {
+ var t = "vjs-menu-button";
+ return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + nn.prototype.buildCSSClass() + " " + e.prototype.buildCSSClass.call(this)
+ }, i.buildCSSClass = function() {
+ var t = "vjs-menu-button";
+ return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + e.prototype.buildCSSClass.call(this)
+ }, i.controlText = function(e, t) {
+ return void 0 === t && (t = this.menuButton_.el()), this.menuButton_.controlText(e, t)
+ }, i.dispose = function() {
+ this.handleMouseLeave(), e.prototype.dispose.call(this)
+ }, i.handleClick = function(e) {
+ this.buttonPressed_ ? this.unpressButton() : this.pressButton()
+ }, i.handleMouseLeave = function(e) {
+ this.removeClass("vjs-hover"), bt(k.default, "keyup", this.handleMenuKeyUp_)
+ }, i.focus = function() {
+ this.menuButton_.focus()
+ }, i.blur = function() {
+ this.menuButton_.blur()
+ }, i.handleKeyDown = function(e) {
+ R.default.isEventKey(e, "Esc") || R.default.isEventKey(e, "Tab") ? (this.buttonPressed_ && this.unpressButton(), R.default.isEventKey(e, "Tab") || (e.preventDefault(), this.menuButton_.focus())) : (R.default.isEventKey(e, "Up") || R.default.isEventKey(e, "Down")) && (this.buttonPressed_ || (e.preventDefault(), this.pressButton()))
+ }, i.handleMenuKeyUp = function(e) {
+ (R.default.isEventKey(e, "Esc") || R.default.isEventKey(e, "Tab")) && this.removeClass("vjs-hover")
+ }, i.handleSubmenuKeyPress = function(e) {
+ this.handleSubmenuKeyDown(e)
+ }, i.handleSubmenuKeyDown = function(e) {
+ (R.default.isEventKey(e, "Esc") || R.default.isEventKey(e, "Tab")) && (this.buttonPressed_ && this.unpressButton(), R.default.isEventKey(e, "Tab") || (e.preventDefault(), this.menuButton_.focus()))
+ }, i.pressButton = function() {
+ if (this.enabled_) {
+ if (this.buttonPressed_ = !0, this.menu.show(), this.menu.lockShowing(), this.menuButton_.el_.setAttribute("aria-expanded", "true"), Te && Ie()) return;
+ this.menu.focus()
+ }
+ }, i.unpressButton = function() {
+ this.enabled_ && (this.buttonPressed_ = !1, this.menu.unlockShowing(), this.menu.hide(), this.menuButton_.el_.setAttribute("aria-expanded", "false"))
+ }, i.disable = function() {
+ this.unpressButton(), this.enabled_ = !1, this.addClass("vjs-disabled"), this.menuButton_.disable()
+ }, i.enable = function() {
+ this.enabled_ = !0, this.removeClass("vjs-disabled"), this.menuButton_.enable()
+ }, t
+ }(Kt);
+ Kt.registerComponent("MenuButton", Mn);
+ var Fn = function(e) {
+ function t(t, i) {
+ var n, r = i.tracks;
+ if ((n = e.call(this, t, i) || this).items.length <= 1 && n.hide(), !r) return I.default(n);
+ var a = Ct(I.default(n), n.update);
+ return r.addEventListener("removetrack", a), r.addEventListener("addtrack", a), r.addEventListener("labelchange", a), n.player_.on("ready", a), n.player_.on("dispose", (function() {
+ r.removeEventListener("removetrack", a), r.removeEventListener("addtrack", a), r.removeEventListener("labelchange", a)
+ })), n
+ }
+ return L.default(t, e), t
+ }(Mn);
+ Kt.registerComponent("TrackButton", Fn);
+ var Bn = ["Tab", "Esc", "Up", "Down", "Right", "Left"],
+ Nn = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).selectable = i.selectable, n.isSelected_ = i.selected || !1, n.multiSelectable = i.multiSelectable, n.selected(n.isSelected_), n.selectable ? n.multiSelectable ? n.el_.setAttribute("role", "menuitemcheckbox") : n.el_.setAttribute("role", "menuitemradio") : n.el_.setAttribute("role", "menuitem"), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function(t, i, n) {
+ this.nonIconControl = !0;
+ var r = e.prototype.createEl.call(this, "li", Z({
+ className: "vjs-menu-item",
+ tabIndex: -1
+ }, i), n);
+ return r.replaceChild(xe("span", {
+ className: "vjs-menu-item-text",
+ textContent: this.localize(this.options_.label)
+ }), r.querySelector(".vjs-icon-placeholder")), r
+ }, i.handleKeyDown = function(t) {
+ Bn.some((function(e) {
+ return R.default.isEventKey(t, e)
+ })) || e.prototype.handleKeyDown.call(this, t)
+ }, i.handleClick = function(e) {
+ this.selected(!0)
+ }, i.selected = function(e) {
+ this.selectable && (e ? (this.addClass("vjs-selected"), this.el_.setAttribute("aria-checked", "true"), this.controlText(", selected"), this.isSelected_ = !0) : (this.removeClass("vjs-selected"), this.el_.setAttribute("aria-checked", "false"), this.controlText(""), this.isSelected_ = !1))
+ }, t
+ }(Xi);
+ Kt.registerComponent("MenuItem", Nn);
+ var jn = function(e) {
+ function t(t, i) {
+ var n, r = i.track,
+ a = t.textTracks();
+ i.label = r.label || r.language || "Unknown", i.selected = "showing" === r.mode, (n = e.call(this, t, i) || this).track = r, n.kinds = (i.kinds || [i.kind || n.track.kind]).filter(Boolean);
+ var s, o = function() {
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
+ n.handleTracksChange.apply(I.default(n), t)
+ },
+ u = function() {
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
+ n.handleSelectedLanguageChange.apply(I.default(n), t)
+ };
+ (t.on(["loadstart", "texttrackchange"], o), a.addEventListener("change", o), a.addEventListener("selectedlanguagechange", u), n.on("dispose", (function() {
+ t.off(["loadstart", "texttrackchange"], o), a.removeEventListener("change", o), a.removeEventListener("selectedlanguagechange", u)
+ })), void 0 === a.onchange) && n.on(["tap", "click"], (function() {
+ if ("object" != typeof C.default.Event) try {
+ s = new C.default.Event("change")
+ } catch (e) {}
+ s || (s = k.default.createEvent("Event")).initEvent("change", !0, !0), a.dispatchEvent(s)
+ }));
+ return n.handleTracksChange(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleClick = function(t) {
+ var i = this.track,
+ n = this.player_.textTracks();
+ if (e.prototype.handleClick.call(this, t), n)
+ for (var r = 0; r < n.length; r++) {
+ var a = n[r]; - 1 !== this.kinds.indexOf(a.kind) && (a === i ? "showing" !== a.mode && (a.mode = "showing") : "disabled" !== a.mode && (a.mode = "disabled"))
+ }
+ }, i.handleTracksChange = function(e) {
+ var t = "showing" === this.track.mode;
+ t !== this.isSelected_ && this.selected(t)
+ }, i.handleSelectedLanguageChange = function(e) {
+ if ("showing" === this.track.mode) {
+ var t = this.player_.cache_.selectedLanguage;
+ if (t && t.enabled && t.language === this.track.language && t.kind !== this.track.kind) return;
+ this.player_.cache_.selectedLanguage = {
+ enabled: !0,
+ language: this.track.language,
+ kind: this.track.kind
+ }
+ }
+ }, i.dispose = function() {
+ this.track = null, e.prototype.dispose.call(this)
+ }, t
+ }(Nn);
+ Kt.registerComponent("TextTrackMenuItem", jn);
+ var Vn = function(e) {
+ function t(t, i) {
+ return i.track = {
+ player: t,
+ kind: i.kind,
+ kinds: i.kinds,
+ default: !1,
+ mode: "disabled"
+ }, i.kinds || (i.kinds = [i.kind]), i.label ? i.track.label = i.label : i.track.label = i.kinds.join(" and ") + " off", i.selectable = !0, i.multiSelectable = !1, e.call(this, t, i) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleTracksChange = function(e) {
+ for (var t = this.player().textTracks(), i = !0, n = 0, r = t.length; n < r; n++) {
+ var a = t[n];
+ if (this.options_.kinds.indexOf(a.kind) > -1 && "showing" === a.mode) {
+ i = !1;
+ break
+ }
+ }
+ i !== this.isSelected_ && this.selected(i)
+ }, i.handleSelectedLanguageChange = function(e) {
+ for (var t = this.player().textTracks(), i = !0, n = 0, r = t.length; n < r; n++) {
+ var a = t[n];
+ if (["captions", "descriptions", "subtitles"].indexOf(a.kind) > -1 && "showing" === a.mode) {
+ i = !1;
+ break
+ }
+ }
+ i && (this.player_.cache_.selectedLanguage = {
+ enabled: !1
+ })
+ }, t
+ }(jn);
+ Kt.registerComponent("OffTextTrackMenuItem", Vn);
+ var Hn = function(e) {
+ function t(t, i) {
+ return void 0 === i && (i = {}), i.tracks = t.textTracks(), e.call(this, t, i) || this
+ }
+ return L.default(t, e), t.prototype.createItems = function(e, t) {
+ var i;
+ void 0 === e && (e = []), void 0 === t && (t = jn), this.label_ && (i = this.label_ + " off"), e.push(new Vn(this.player_, {
+ kinds: this.kinds_,
+ kind: this.kind_,
+ label: i
+ })), this.hideThreshold_ += 1;
+ var n = this.player_.textTracks();
+ Array.isArray(this.kinds_) || (this.kinds_ = [this.kind_]);
+ for (var r = 0; r < n.length; r++) {
+ var a = n[r];
+ if (this.kinds_.indexOf(a.kind) > -1) {
+ var s = new t(this.player_, {
+ track: a,
+ kinds: this.kinds_,
+ kind: this.kind_,
+ selectable: !0,
+ multiSelectable: !1
+ });
+ s.addClass("vjs-" + a.kind + "-menu-item"), e.push(s)
+ }
+ }
+ return e
+ }, t
+ }(Fn);
+ Kt.registerComponent("TextTrackButton", Hn);
+ var zn = function(e) {
+ function t(t, i) {
+ var n, r = i.track,
+ a = i.cue,
+ s = t.currentTime();
+ return i.selectable = !0, i.multiSelectable = !1, i.label = a.text, i.selected = a.startTime <= s && s < a.endTime, (n = e.call(this, t, i) || this).track = r, n.cue = a, r.addEventListener("cuechange", Ct(I.default(n), n.update)), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleClick = function(t) {
+ e.prototype.handleClick.call(this), this.player_.currentTime(this.cue.startTime), this.update(this.cue.startTime)
+ }, i.update = function(e) {
+ var t = this.cue,
+ i = this.player_.currentTime();
+ this.selected(t.startTime <= i && i < t.endTime)
+ }, t
+ }(Nn);
+ Kt.registerComponent("ChaptersTrackMenuItem", zn);
+ var Gn = function(e) {
+ function t(t, i, n) {
+ return e.call(this, t, i, n) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-chapters-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-chapters-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, i.update = function(t) {
+ this.track_ && (!t || "addtrack" !== t.type && "removetrack" !== t.type) || this.setTrack(this.findChaptersTrack()), e.prototype.update.call(this)
+ }, i.setTrack = function(e) {
+ if (this.track_ !== e) {
+ if (this.updateHandler_ || (this.updateHandler_ = this.update.bind(this)), this.track_) {
+ var t = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
+ t && t.removeEventListener("load", this.updateHandler_), this.track_ = null
+ }
+ if (this.track_ = e, this.track_) {
+ this.track_.mode = "hidden";
+ var i = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
+ i && i.addEventListener("load", this.updateHandler_)
+ }
+ }
+ }, i.findChaptersTrack = function() {
+ for (var e = this.player_.textTracks() || [], t = e.length - 1; t >= 0; t--) {
+ var i = e[t];
+ if (i.kind === this.kind_) return i
+ }
+ }, i.getMenuCaption = function() {
+ return this.track_ && this.track_.label ? this.track_.label : this.localize(Ht(this.kind_))
+ }, i.createMenu = function() {
+ return this.options_.title = this.getMenuCaption(), e.prototype.createMenu.call(this)
+ }, i.createItems = function() {
+ var e = [];
+ if (!this.track_) return e;
+ var t = this.track_.cues;
+ if (!t) return e;
+ for (var i = 0, n = t.length; i < n; i++) {
+ var r = t[i],
+ a = new zn(this.player_, {
+ track: this.track_,
+ cue: r
+ });
+ e.push(a)
+ }
+ return e
+ }, t
+ }(Hn);
+ Gn.prototype.kind_ = "chapters", Gn.prototype.controlText_ = "Chapters", Kt.registerComponent("ChaptersButton", Gn);
+ var Wn = function(e) {
+ function t(t, i, n) {
+ var r;
+ r = e.call(this, t, i, n) || this;
+ var a = t.textTracks(),
+ s = Ct(I.default(r), r.handleTracksChange);
+ return a.addEventListener("change", s), r.on("dispose", (function() {
+ a.removeEventListener("change", s)
+ })), r
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleTracksChange = function(e) {
+ for (var t = this.player().textTracks(), i = !1, n = 0, r = t.length; n < r; n++) {
+ var a = t[n];
+ if (a.kind !== this.kind_ && "showing" === a.mode) {
+ i = !0;
+ break
+ }
+ }
+ i ? this.disable() : this.enable()
+ }, i.buildCSSClass = function() {
+ return "vjs-descriptions-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-descriptions-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, t
+ }(Hn);
+ Wn.prototype.kind_ = "descriptions", Wn.prototype.controlText_ = "Descriptions", Kt.registerComponent("DescriptionsButton", Wn);
+ var Yn = function(e) {
+ function t(t, i, n) {
+ return e.call(this, t, i, n) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-subtitles-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-subtitles-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, t
+ }(Hn);
+ Yn.prototype.kind_ = "subtitles", Yn.prototype.controlText_ = "Subtitles", Kt.registerComponent("SubtitlesButton", Yn);
+ var qn = function(e) {
+ function t(t, i) {
+ var n;
+ return i.track = {
+ player: t,
+ kind: i.kind,
+ label: i.kind + " settings",
+ selectable: !1,
+ default: !1,
+ mode: "disabled"
+ }, i.selectable = !1, i.name = "CaptionSettingsMenuItem", (n = e.call(this, t, i) || this).addClass("vjs-texttrack-settings"), n.controlText(", opens " + i.kind + " settings dialog"), n
+ }
+ return L.default(t, e), t.prototype.handleClick = function(e) {
+ this.player().getChild("textTrackSettings").open()
+ }, t
+ }(jn);
+ Kt.registerComponent("CaptionSettingsMenuItem", qn);
+ var Kn = function(e) {
+ function t(t, i, n) {
+ return e.call(this, t, i, n) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-captions-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-captions-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, i.createItems = function() {
+ var t = [];
+ return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild("textTrackSettings") || (t.push(new qn(this.player_, {
+ kind: this.kind_
+ })), this.hideThreshold_ += 1), e.prototype.createItems.call(this, t)
+ }, t
+ }(Hn);
+ Kn.prototype.kind_ = "captions", Kn.prototype.controlText_ = "Captions", Kt.registerComponent("CaptionsButton", Kn);
+ var Xn = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ return L.default(t, e), t.prototype.createEl = function(t, i, n) {
+ var r = e.prototype.createEl.call(this, t, i, n),
+ a = r.querySelector(".vjs-menu-item-text");
+ return "captions" === this.options_.track.kind && (a.appendChild(xe("span", {
+ className: "vjs-icon-placeholder"
+ }, {
+ "aria-hidden": !0
+ })), a.appendChild(xe("span", {
+ className: "vjs-control-text",
+ textContent: " " + this.localize("Captions")
+ }))), r
+ }, t
+ }(jn);
+ Kt.registerComponent("SubsCapsMenuItem", Xn);
+ var Qn = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === i && (i = {}), (n = e.call(this, t, i) || this).label_ = "subtitles", ["en", "en-us", "en-ca", "fr-ca"].indexOf(n.player_.language_) > -1 && (n.label_ = "captions"), n.menuButton_.controlText(Ht(n.label_)), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-subs-caps-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-subs-caps-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, i.createItems = function() {
+ var t = [];
+ return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild("textTrackSettings") || (t.push(new qn(this.player_, {
+ kind: this.label_
+ })), this.hideThreshold_ += 1), t = e.prototype.createItems.call(this, t, Xn)
+ }, t
+ }(Hn);
+ Qn.prototype.kinds_ = ["captions", "subtitles"], Qn.prototype.controlText_ = "Subtitles", Kt.registerComponent("SubsCapsButton", Qn);
+ var $n = function(e) {
+ function t(t, i) {
+ var n, r = i.track,
+ a = t.audioTracks();
+ i.label = r.label || r.language || "Unknown", i.selected = r.enabled, (n = e.call(this, t, i) || this).track = r, n.addClass("vjs-" + r.kind + "-menu-item");
+ var s = function() {
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
+ n.handleTracksChange.apply(I.default(n), t)
+ };
+ return a.addEventListener("change", s), n.on("dispose", (function() {
+ a.removeEventListener("change", s)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function(t, i, n) {
+ var r = e.prototype.createEl.call(this, t, i, n),
+ a = r.querySelector(".vjs-menu-item-text");
+ return "main-desc" === this.options_.track.kind && (a.appendChild(e.prototype.createEl.call(this, "span", {
+ className: "vjs-icon-placeholder"
+ }, {
+ "aria-hidden": !0
+ })), a.appendChild(e.prototype.createEl.call(this, "span", {
+ className: "vjs-control-text",
+ textContent: this.localize("Descriptions")
+ }))), r
+ }, i.handleClick = function(t) {
+ e.prototype.handleClick.call(this, t), this.track.enabled = !0
+ }, i.handleTracksChange = function(e) {
+ this.selected(this.track.enabled)
+ }, t
+ }(Nn);
+ Kt.registerComponent("AudioTrackMenuItem", $n);
+ var Jn = function(e) {
+ function t(t, i) {
+ return void 0 === i && (i = {}), i.tracks = t.audioTracks(), e.call(this, t, i) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-audio-button " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-audio-button " + e.prototype.buildWrapperCSSClass.call(this)
+ }, i.createItems = function(e) {
+ void 0 === e && (e = []), this.hideThreshold_ = 1;
+ for (var t = this.player_.audioTracks(), i = 0; i < t.length; i++) {
+ var n = t[i];
+ e.push(new $n(this.player_, {
+ track: n,
+ selectable: !0,
+ multiSelectable: !1
+ }))
+ }
+ return e
+ }, t
+ }(Fn);
+ Jn.prototype.controlText_ = "Audio Track", Kt.registerComponent("AudioTrackButton", Jn);
+ var Zn = function(e) {
+ function t(t, i) {
+ var n, r = i.rate,
+ a = parseFloat(r, 10);
+ return i.label = r, i.selected = a === t.playbackRate(), i.selectable = !0, i.multiSelectable = !1, (n = e.call(this, t, i) || this).label = r, n.rate = a, n.on(t, "ratechange", (function(e) {
+ return n.update(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleClick = function(t) {
+ e.prototype.handleClick.call(this), this.player().playbackRate(this.rate)
+ }, i.update = function(e) {
+ this.selected(this.player().playbackRate() === this.rate)
+ }, t
+ }(Nn);
+ Zn.prototype.contentElType = "button", Kt.registerComponent("PlaybackRateMenuItem", Zn);
+ var er = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).menuButton_.el_.setAttribute("aria-describedby", n.labelElId_), n.updateVisibility(), n.updateLabel(), n.on(t, "loadstart", (function(e) {
+ return n.updateVisibility(e)
+ })), n.on(t, "ratechange", (function(e) {
+ return n.updateLabel(e)
+ })), n.on(t, "playbackrateschange", (function(e) {
+ return n.handlePlaybackRateschange(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ var t = e.prototype.createEl.call(this);
+ return this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_, this.labelEl_ = xe("div", {
+ className: "vjs-playback-rate-value",
+ id: this.labelElId_,
+ textContent: "1x"
+ }), t.appendChild(this.labelEl_), t
+ }, i.dispose = function() {
+ this.labelEl_ = null, e.prototype.dispose.call(this)
+ }, i.buildCSSClass = function() {
+ return "vjs-playback-rate " + e.prototype.buildCSSClass.call(this)
+ }, i.buildWrapperCSSClass = function() {
+ return "vjs-playback-rate " + e.prototype.buildWrapperCSSClass.call(this)
+ }, i.createItems = function() {
+ for (var e = this.playbackRates(), t = [], i = e.length - 1; i >= 0; i--) t.push(new Zn(this.player(), {
+ rate: e[i] + "x"
+ }));
+ return t
+ }, i.updateARIAAttributes = function() {
+ this.el().setAttribute("aria-valuenow", this.player().playbackRate())
+ }, i.handleClick = function(e) {
+ for (var t = this.player().playbackRate(), i = this.playbackRates(), n = i[0], r = 0; r < i.length; r++)
+ if (i[r] > t) {
+ n = i[r];
+ break
+ } this.player().playbackRate(n)
+ }, i.handlePlaybackRateschange = function(e) {
+ this.update()
+ }, i.playbackRates = function() {
+ var e = this.player();
+ return e.playbackRates && e.playbackRates() || []
+ }, i.playbackRateSupported = function() {
+ return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0
+ }, i.updateVisibility = function(e) {
+ this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden")
+ }, i.updateLabel = function(e) {
+ this.playbackRateSupported() && (this.labelEl_.textContent = this.player().playbackRate() + "x")
+ }, t
+ }(Mn);
+ er.prototype.controlText_ = "Playback Rate", Kt.registerComponent("PlaybackRateMenuButton", er);
+ var tr = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-spacer " + e.prototype.buildCSSClass.call(this)
+ }, i.createEl = function(t, i, n) {
+ return void 0 === t && (t = "div"), void 0 === i && (i = {}), void 0 === n && (n = {}), i.className || (i.className = this.buildCSSClass()), e.prototype.createEl.call(this, t, i, n)
+ }, t
+ }(Kt);
+ Kt.registerComponent("Spacer", tr);
+ var ir = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-custom-control-spacer " + e.prototype.buildCSSClass.call(this)
+ }, i.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: this.buildCSSClass(),
+ textContent: " "
+ })
+ }, t
+ }(tr);
+ Kt.registerComponent("CustomControlSpacer", ir);
+ var nr = function(e) {
+ function t() {
+ return e.apply(this, arguments) || this
+ }
+ return L.default(t, e), t.prototype.createEl = function() {
+ return e.prototype.createEl.call(this, "div", {
+ className: "vjs-control-bar",
+ dir: "ltr"
+ })
+ }, t
+ }(Kt);
+ nr.prototype.options_ = {
+ children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
+ }, "exitPictureInPicture" in k.default && nr.prototype.options_.children.splice(nr.prototype.options_.children.length - 1, 0, "pictureInPictureToggle"), Kt.registerComponent("ControlBar", nr);
+ var rr = function(e) {
+ function t(t, i) {
+ var n;
+ return (n = e.call(this, t, i) || this).on(t, "error", (function(e) {
+ return n.open(e)
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.buildCSSClass = function() {
+ return "vjs-error-display " + e.prototype.buildCSSClass.call(this)
+ }, i.content = function() {
+ var e = this.player().error();
+ return e ? this.localize(e.message) : ""
+ }, t
+ }(si);
+ rr.prototype.options_ = P.default({}, si.prototype.options_, {
+ pauseOnOpen: !1,
+ fillAlways: !0,
+ temporary: !1,
+ uncloseable: !0
+ }), Kt.registerComponent("ErrorDisplay", rr);
+ var ar = ["#000", "Black"],
+ sr = ["#00F", "Blue"],
+ or = ["#0FF", "Cyan"],
+ ur = ["#0F0", "Green"],
+ lr = ["#F0F", "Magenta"],
+ hr = ["#F00", "Red"],
+ dr = ["#FFF", "White"],
+ cr = ["#FF0", "Yellow"],
+ fr = ["1", "Opaque"],
+ pr = ["0.5", "Semi-Transparent"],
+ mr = ["0", "Transparent"],
+ _r = {
+ backgroundColor: {
+ selector: ".vjs-bg-color > select",
+ id: "captions-background-color-%s",
+ label: "Color",
+ options: [ar, dr, hr, ur, sr, cr, lr, or]
+ },
+ backgroundOpacity: {
+ selector: ".vjs-bg-opacity > select",
+ id: "captions-background-opacity-%s",
+ label: "Transparency",
+ options: [fr, pr, mr]
+ },
+ color: {
+ selector: ".vjs-fg-color > select",
+ id: "captions-foreground-color-%s",
+ label: "Color",
+ options: [dr, ar, hr, ur, sr, cr, lr, or]
+ },
+ edgeStyle: {
+ selector: ".vjs-edge-style > select",
+ id: "%s",
+ label: "Text Edge Style",
+ options: [
+ ["none", "None"],
+ ["raised", "Raised"],
+ ["depressed", "Depressed"],
+ ["uniform", "Uniform"],
+ ["dropshadow", "Dropshadow"]
+ ]
+ },
+ fontFamily: {
+ selector: ".vjs-font-family > select",
+ id: "captions-font-family-%s",
+ label: "Font Family",
+ options: [
+ ["proportionalSansSerif", "Proportional Sans-Serif"],
+ ["monospaceSansSerif", "Monospace Sans-Serif"],
+ ["proportionalSerif", "Proportional Serif"],
+ ["monospaceSerif", "Monospace Serif"],
+ ["casual", "Casual"],
+ ["script", "Script"],
+ ["small-caps", "Small Caps"]
+ ]
+ },
+ fontPercent: {
+ selector: ".vjs-font-percent > select",
+ id: "captions-font-size-%s",
+ label: "Font Size",
+ options: [
+ ["0.50", "50%"],
+ ["0.75", "75%"],
+ ["1.00", "100%"],
+ ["1.25", "125%"],
+ ["1.50", "150%"],
+ ["1.75", "175%"],
+ ["2.00", "200%"],
+ ["3.00", "300%"],
+ ["4.00", "400%"]
+ ],
+ default: 2,
+ parser: function(e) {
+ return "1.00" === e ? null : Number(e)
+ }
+ },
+ textOpacity: {
+ selector: ".vjs-text-opacity > select",
+ id: "captions-foreground-opacity-%s",
+ label: "Transparency",
+ options: [fr, pr]
+ },
+ windowColor: {
+ selector: ".vjs-window-color > select",
+ id: "captions-window-color-%s",
+ label: "Color"
+ },
+ windowOpacity: {
+ selector: ".vjs-window-opacity > select",
+ id: "captions-window-opacity-%s",
+ label: "Transparency",
+ options: [mr, pr, fr]
+ }
+ };
+
+ function gr(e, t) {
+ if (t && (e = t(e)), e && "none" !== e) return e
+ }
+ _r.windowColor.options = _r.backgroundColor.options;
+ var vr = function(e) {
+ function t(t, i) {
+ var n;
+ return i.temporary = !1, (n = e.call(this, t, i) || this).updateDisplay = n.updateDisplay.bind(I.default(n)), n.fill(), n.hasBeenOpened_ = n.hasBeenFilled_ = !0, n.endDialog = xe("p", {
+ className: "vjs-control-text",
+ textContent: n.localize("End of dialog window.")
+ }), n.el().appendChild(n.endDialog), n.setDefaults(), void 0 === i.persistTextTrackSettings && (n.options_.persistTextTrackSettings = n.options_.playerOptions.persistTextTrackSettings), n.on(n.$(".vjs-done-button"), "click", (function() {
+ n.saveSettings(), n.close()
+ })), n.on(n.$(".vjs-default-button"), "click", (function() {
+ n.setDefaults(), n.updateDisplay()
+ })), J(_r, (function(e) {
+ n.on(n.$(e.selector), "change", n.updateDisplay)
+ })), n.options_.persistTextTrackSettings && n.restoreSettings(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.dispose = function() {
+ this.endDialog = null, e.prototype.dispose.call(this)
+ }, i.createElSelect_ = function(e, t, i) {
+ var n = this;
+ void 0 === t && (t = ""), void 0 === i && (i = "label");
+ var r = _r[e],
+ a = r.id.replace("%s", this.id_),
+ s = [t, a].join(" ").trim();
+ return ["<" + i + ' id="' + a + '" class="' + ("label" === i ? "vjs-label" : "") + '">', this.localize(r.label), "</" + i + ">", '<select aria-labelledby="' + s + '">'].concat(r.options.map((function(e) {
+ var t = a + "-" + e[1].replace(/\W+/g, "");
+ return ['<option id="' + t + '" value="' + e[0] + '" ', 'aria-labelledby="' + s + " " + t + '">', n.localize(e[1]), "</option>"].join("")
+ }))).concat("</select>").join("")
+ }, i.createElFgColor_ = function() {
+ var e = "captions-text-legend-" + this.id_;
+ return ['<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Text"), "</legend>", this.createElSelect_("color", e), '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", e), "</span>", "</fieldset>"].join("")
+ }, i.createElBgColor_ = function() {
+ var e = "captions-background-" + this.id_;
+ return ['<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Background"), "</legend>", this.createElSelect_("backgroundColor", e), '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", e), "</span>", "</fieldset>"].join("")
+ }, i.createElWinColor_ = function() {
+ var e = "captions-window-" + this.id_;
+ return ['<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + e + '">', this.localize("Window"), "</legend>", this.createElSelect_("windowColor", e), '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", e), "</span>", "</fieldset>"].join("")
+ }, i.createElColors_ = function() {
+ return xe("div", {
+ className: "vjs-track-settings-colors",
+ innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
+ })
+ }, i.createElFont_ = function() {
+ return xe("div", {
+ className: "vjs-track-settings-font",
+ innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>"].join("")
+ })
+ }, i.createElControls_ = function() {
+ var e = this.localize("restore all settings to the default values");
+ return xe("div", {
+ className: "vjs-track-settings-controls",
+ innerHTML: ['<button type="button" class="vjs-default-button" title="' + e + '">', this.localize("Reset"), '<span class="vjs-control-text"> ' + e + "</span>", "</button>", '<button type="button" class="vjs-done-button">' + this.localize("Done") + "</button>"].join("")
+ })
+ }, i.content = function() {
+ return [this.createElColors_(), this.createElFont_(), this.createElControls_()]
+ }, i.label = function() {
+ return this.localize("Caption Settings Dialog")
+ }, i.description = function() {
+ return this.localize("Beginning of dialog window. Escape will cancel and close the window.")
+ }, i.buildCSSClass = function() {
+ return e.prototype.buildCSSClass.call(this) + " vjs-text-track-settings"
+ }, i.getValues = function() {
+ var e, t, i, n = this;
+ return t = function(e, t, i) {
+ var r, a, s = (r = n.$(t.selector), a = t.parser, gr(r.options[r.options.selectedIndex].value, a));
+ return void 0 !== s && (e[i] = s), e
+ }, void 0 === (i = {}) && (i = 0), $(e = _r).reduce((function(i, n) {
+ return t(i, e[n], n)
+ }), i)
+ }, i.setValues = function(e) {
+ var t = this;
+ J(_r, (function(i, n) {
+ ! function(e, t, i) {
+ if (t)
+ for (var n = 0; n < e.options.length; n++)
+ if (gr(e.options[n].value, i) === t) {
+ e.selectedIndex = n;
+ break
+ }
+ }(t.$(i.selector), e[n], i.parser)
+ }))
+ }, i.setDefaults = function() {
+ var e = this;
+ J(_r, (function(t) {
+ var i = t.hasOwnProperty("default") ? t.default : 0;
+ e.$(t.selector).selectedIndex = i
+ }))
+ }, i.restoreSettings = function() {
+ var e;
+ try {
+ e = JSON.parse(C.default.localStorage.getItem("vjs-text-track-settings"))
+ } catch (e) {
+ K.warn(e)
+ }
+ e && this.setValues(e)
+ }, i.saveSettings = function() {
+ if (this.options_.persistTextTrackSettings) {
+ var e = this.getValues();
+ try {
+ Object.keys(e).length ? C.default.localStorage.setItem("vjs-text-track-settings", JSON.stringify(e)) : C.default.localStorage.removeItem("vjs-text-track-settings")
+ } catch (e) {
+ K.warn(e)
+ }
+ }
+ }, i.updateDisplay = function() {
+ var e = this.player_.getChild("textTrackDisplay");
+ e && e.updateDisplay()
+ }, i.conditionalBlur_ = function() {
+ this.previouslyActiveEl_ = null;
+ var e = this.player_.controlBar,
+ t = e && e.subsCapsButton,
+ i = e && e.captionsButton;
+ t ? t.focus() : i && i.focus()
+ }, t
+ }(si);
+ Kt.registerComponent("TextTrackSettings", vr);
+ var yr = function(e) {
+ function t(t, i) {
+ var n, r = i.ResizeObserver || C.default.ResizeObserver;
+ null === i.ResizeObserver && (r = !1);
+ var a = zt({
+ createEl: !r,
+ reportTouchActivity: !1
+ }, i);
+ return (n = e.call(this, t, a) || this).ResizeObserver = i.ResizeObserver || C.default.ResizeObserver, n.loadListener_ = null, n.resizeObserver_ = null, n.debouncedHandler_ = function(e, t, i, n) {
+ var r;
+ void 0 === n && (n = C.default);
+ var a = function() {
+ var a = this,
+ s = arguments,
+ o = function() {
+ r = null, o = null, i || e.apply(a, s)
+ };
+ !r && i && e.apply(a, s), n.clearTimeout(r), r = n.setTimeout(o, t)
+ };
+ return a.cancel = function() {
+ n.clearTimeout(r), r = null
+ }, a
+ }((function() {
+ n.resizeHandler()
+ }), 100, !1, I.default(n)), r ? (n.resizeObserver_ = new n.ResizeObserver(n.debouncedHandler_), n.resizeObserver_.observe(t.el())) : (n.loadListener_ = function() {
+ if (n.el_ && n.el_.contentWindow) {
+ var e = n.debouncedHandler_,
+ t = n.unloadListener_ = function() {
+ bt(this, "resize", e), bt(this, "unload", t), t = null
+ };
+ yt(n.el_.contentWindow, "unload", t), yt(n.el_.contentWindow, "resize", e)
+ }
+ }, n.one("load", n.loadListener_)), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createEl = function() {
+ return e.prototype.createEl.call(this, "iframe", {
+ className: "vjs-resize-manager",
+ tabIndex: -1
+ }, {
+ "aria-hidden": "true"
+ })
+ }, i.resizeHandler = function() {
+ this.player_ && this.player_.trigger && this.player_.trigger("playerresize")
+ }, i.dispose = function() {
+ this.debouncedHandler_ && this.debouncedHandler_.cancel(), this.resizeObserver_ && (this.player_.el() && this.resizeObserver_.unobserve(this.player_.el()), this.resizeObserver_.disconnect()), this.loadListener_ && this.off("load", this.loadListener_), this.el_ && this.el_.contentWindow && this.unloadListener_ && this.unloadListener_.call(this.el_.contentWindow), this.ResizeObserver = null, this.resizeObserver = null, this.debouncedHandler_ = null, this.loadListener_ = null, e.prototype.dispose.call(this)
+ }, t
+ }(Kt);
+ Kt.registerComponent("ResizeManager", yr);
+ var br = {
+ trackingThreshold: 30,
+ liveTolerance: 15
+ },
+ Sr = function(e) {
+ function t(t, i) {
+ var n, r = zt(br, i, {
+ createEl: !1
+ });
+ return (n = e.call(this, t, r) || this).handleVisibilityChange_ = function(e) {
+ return n.handleVisibilityChange(e)
+ }, n.trackLiveHandler_ = function() {
+ return n.trackLive_()
+ }, n.handlePlay_ = function(e) {
+ return n.handlePlay(e)
+ }, n.handleFirstTimeupdate_ = function(e) {
+ return n.handleFirstTimeupdate(e)
+ }, n.handleSeeked_ = function(e) {
+ return n.handleSeeked(e)
+ }, n.seekToLiveEdge_ = function(e) {
+ return n.seekToLiveEdge(e)
+ }, n.reset_(), n.on(n.player_, "durationchange", (function(e) {
+ return n.handleDurationchange(e)
+ })), n.one(n.player_, "canplay", (function() {
+ return n.toggleTracking()
+ })), _e && "hidden" in k.default && "visibilityState" in k.default && n.on(k.default, "visibilitychange", n.handleVisibilityChange_), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleVisibilityChange = function() {
+ this.player_.duration() === 1 / 0 && (k.default.hidden ? this.stopTracking() : this.startTracking())
+ }, i.trackLive_ = function() {
+ var e = this.player_.seekable();
+ if (e && e.length) {
+ var t = Number(C.default.performance.now().toFixed(4)),
+ i = -1 === this.lastTime_ ? 0 : (t - this.lastTime_) / 1e3;
+ this.lastTime_ = t, this.pastSeekEnd_ = this.pastSeekEnd() + i;
+ var n = this.liveCurrentTime(),
+ r = this.player_.currentTime(),
+ a = this.player_.paused() || this.seekedBehindLive_ || Math.abs(n - r) > this.options_.liveTolerance;
+ this.timeupdateSeen_ && n !== 1 / 0 || (a = !1), a !== this.behindLiveEdge_ && (this.behindLiveEdge_ = a, this.trigger("liveedgechange"))
+ }
+ }, i.handleDurationchange = function() {
+ this.toggleTracking()
+ }, i.toggleTracking = function() {
+ this.player_.duration() === 1 / 0 && this.liveWindow() >= this.options_.trackingThreshold ? (this.player_.options_.liveui && this.player_.addClass("vjs-liveui"), this.startTracking()) : (this.player_.removeClass("vjs-liveui"), this.stopTracking())
+ }, i.startTracking = function() {
+ this.isTracking() || (this.timeupdateSeen_ || (this.timeupdateSeen_ = this.player_.hasStarted()), this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, 30), this.trackLive_(), this.on(this.player_, ["play", "pause"], this.trackLiveHandler_), this.timeupdateSeen_ ? this.on(this.player_, "seeked", this.handleSeeked_) : (this.one(this.player_, "play", this.handlePlay_), this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_)))
+ }, i.handleFirstTimeupdate = function() {
+ this.timeupdateSeen_ = !0, this.on(this.player_, "seeked", this.handleSeeked_)
+ }, i.handleSeeked = function() {
+ var e = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
+ this.seekedBehindLive_ = this.nextSeekedFromUser_ && e > 2, this.nextSeekedFromUser_ = !1, this.trackLive_()
+ }, i.handlePlay = function() {
+ this.one(this.player_, "timeupdate", this.seekToLiveEdge_)
+ }, i.reset_ = function() {
+ this.lastTime_ = -1, this.pastSeekEnd_ = 0, this.lastSeekEnd_ = -1, this.behindLiveEdge_ = !0, this.timeupdateSeen_ = !1, this.seekedBehindLive_ = !1, this.nextSeekedFromUser_ = !1, this.clearInterval(this.trackingInterval_), this.trackingInterval_ = null, this.off(this.player_, ["play", "pause"], this.trackLiveHandler_), this.off(this.player_, "seeked", this.handleSeeked_), this.off(this.player_, "play", this.handlePlay_), this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_), this.off(this.player_, "timeupdate", this.seekToLiveEdge_)
+ }, i.nextSeekedFromUser = function() {
+ this.nextSeekedFromUser_ = !0
+ }, i.stopTracking = function() {
+ this.isTracking() && (this.reset_(), this.trigger("liveedgechange"))
+ }, i.seekableEnd = function() {
+ for (var e = this.player_.seekable(), t = [], i = e ? e.length : 0; i--;) t.push(e.end(i));
+ return t.length ? t.sort()[t.length - 1] : 1 / 0
+ }, i.seekableStart = function() {
+ for (var e = this.player_.seekable(), t = [], i = e ? e.length : 0; i--;) t.push(e.start(i));
+ return t.length ? t.sort()[0] : 0
+ }, i.liveWindow = function() {
+ var e = this.liveCurrentTime();
+ return e === 1 / 0 ? 0 : e - this.seekableStart()
+ }, i.isLive = function() {
+ return this.isTracking()
+ }, i.atLiveEdge = function() {
+ return !this.behindLiveEdge()
+ }, i.liveCurrentTime = function() {
+ return this.pastSeekEnd() + this.seekableEnd()
+ }, i.pastSeekEnd = function() {
+ var e = this.seekableEnd();
+ return -1 !== this.lastSeekEnd_ && e !== this.lastSeekEnd_ && (this.pastSeekEnd_ = 0), this.lastSeekEnd_ = e, this.pastSeekEnd_
+ }, i.behindLiveEdge = function() {
+ return this.behindLiveEdge_
+ }, i.isTracking = function() {
+ return "number" == typeof this.trackingInterval_
+ }, i.seekToLiveEdge = function() {
+ this.seekedBehindLive_ = !1, this.atLiveEdge() || (this.nextSeekedFromUser_ = !1, this.player_.currentTime(this.liveCurrentTime()))
+ }, i.dispose = function() {
+ this.off(k.default, "visibilitychange", this.handleVisibilityChange_), this.stopTracking(), e.prototype.dispose.call(this)
+ }, t
+ }(Kt);
+ Kt.registerComponent("LiveTracker", Sr);
+ var Tr, Er = function(e) {
+ var t = e.el();
+ if (t.hasAttribute("src")) return e.triggerSourceset(t.src), !0;
+ var i = e.$$("source"),
+ n = [],
+ r = "";
+ if (!i.length) return !1;
+ for (var a = 0; a < i.length; a++) {
+ var s = i[a].src;
+ s && -1 === n.indexOf(s) && n.push(s)
+ }
+ return !!n.length && (1 === n.length && (r = n[0]), e.triggerSourceset(r), !0)
+ },
+ wr = Object.defineProperty({}, "innerHTML", {
+ get: function() {
+ return this.cloneNode(!0).innerHTML
+ },
+ set: function(e) {
+ var t = k.default.createElement(this.nodeName.toLowerCase());
+ t.innerHTML = e;
+ for (var i = k.default.createDocumentFragment(); t.childNodes.length;) i.appendChild(t.childNodes[0]);
+ return this.innerText = "", C.default.Element.prototype.appendChild.call(this, i), this.innerHTML
+ }
+ }),
+ Ar = function(e, t) {
+ for (var i = {}, n = 0; n < e.length && !((i = Object.getOwnPropertyDescriptor(e[n], t)) && i.set && i.get); n++);
+ return i.enumerable = !0, i.configurable = !0, i
+ },
+ Cr = function(e) {
+ var t = e.el();
+ if (!t.resetSourceWatch_) {
+ var i = {},
+ n = function(e) {
+ return Ar([e.el(), C.default.HTMLMediaElement.prototype, C.default.Element.prototype, wr], "innerHTML")
+ }(e),
+ r = function(i) {
+ return function() {
+ for (var n = arguments.length, r = new Array(n), a = 0; a < n; a++) r[a] = arguments[a];
+ var s = i.apply(t, r);
+ return Er(e), s
+ }
+ };
+ ["append", "appendChild", "insertAdjacentHTML"].forEach((function(e) {
+ t[e] && (i[e] = t[e], t[e] = r(i[e]))
+ })), Object.defineProperty(t, "innerHTML", zt(n, {
+ set: r(n.set)
+ })), t.resetSourceWatch_ = function() {
+ t.resetSourceWatch_ = null, Object.keys(i).forEach((function(e) {
+ t[e] = i[e]
+ })), Object.defineProperty(t, "innerHTML", n)
+ }, e.one("sourceset", t.resetSourceWatch_)
+ }
+ },
+ kr = Object.defineProperty({}, "src", {
+ get: function() {
+ return this.hasAttribute("src") ? Ti(C.default.Element.prototype.getAttribute.call(this, "src")) : ""
+ },
+ set: function(e) {
+ return C.default.Element.prototype.setAttribute.call(this, "src", e), e
+ }
+ }),
+ Pr = function(e) {
+ if (e.featuresSourceset) {
+ var t = e.el();
+ if (!t.resetSourceset_) {
+ var i = function(e) {
+ return Ar([e.el(), C.default.HTMLMediaElement.prototype, kr], "src")
+ }(e),
+ n = t.setAttribute,
+ r = t.load;
+ Object.defineProperty(t, "src", zt(i, {
+ set: function(n) {
+ var r = i.set.call(t, n);
+ return e.triggerSourceset(t.src), r
+ }
+ })), t.setAttribute = function(i, r) {
+ var a = n.call(t, i, r);
+ return /src/i.test(i) && e.triggerSourceset(t.src), a
+ }, t.load = function() {
+ var i = r.call(t);
+ return Er(e) || (e.triggerSourceset(""), Cr(e)), i
+ }, t.currentSrc ? e.triggerSourceset(t.currentSrc) : Er(e) || Cr(e), t.resetSourceset_ = function() {
+ t.resetSourceset_ = null, t.load = r, t.setAttribute = n, Object.defineProperty(t, "src", i), t.resetSourceWatch_ && t.resetSourceWatch_()
+ }
+ }
+ }
+ },
+ Ir = function(e, t, i, n) {
+ void 0 === n && (n = !0);
+ var r = function(i) {
+ return Object.defineProperty(e, t, {
+ value: i,
+ enumerable: !0,
+ writable: !0
+ })
+ },
+ a = {
+ configurable: !0,
+ enumerable: !0,
+ get: function() {
+ var e = i();
+ return r(e), e
+ }
+ };
+ return n && (a.set = r), Object.defineProperty(e, t, a)
+ },
+ Lr = function(e) {
+ function t(t, i) {
+ var n;
+ n = e.call(this, t, i) || this;
+ var r = t.source,
+ a = !1;
+ if (r && (n.el_.currentSrc !== r.src || t.tag && 3 === t.tag.initNetworkState_) ? n.setSource(r) : n.handleLateInit_(n.el_), t.enableSourceset && n.setupSourcesetHandling_(), n.isScrubbing_ = !1, n.el_.hasChildNodes()) {
+ for (var s = n.el_.childNodes, o = s.length, u = []; o--;) {
+ var l = s[o];
+ "track" === l.nodeName.toLowerCase() && (n.featuresNativeTextTracks ? (n.remoteTextTrackEls().addTrackElement_(l), n.remoteTextTracks().addTrack(l.track), n.textTracks().addTrack(l.track), a || n.el_.hasAttribute("crossorigin") || !wi(l.src) || (a = !0)) : u.push(l))
+ }
+ for (var h = 0; h < u.length; h++) n.el_.removeChild(u[h])
+ }
+ return n.proxyNativeTracks_(), n.featuresNativeTextTracks && a && K.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."), n.restoreMetadataTracksInIOSNativePlayer_(), (ye || Se || de) && !0 === t.nativeControlsForTouch && n.setControls(!0), n.proxyWebkitFullscreen_(), n.triggerReady(), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.dispose = function() {
+ this.el_ && this.el_.resetSourceset_ && this.el_.resetSourceset_(), t.disposeMediaElement(this.el_), this.options_ = null, e.prototype.dispose.call(this)
+ }, i.setupSourcesetHandling_ = function() {
+ Pr(this)
+ }, i.restoreMetadataTracksInIOSNativePlayer_ = function() {
+ var e, t = this.textTracks(),
+ i = function() {
+ e = [];
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ "metadata" === n.kind && e.push({
+ track: n,
+ storedMode: n.mode
+ })
+ }
+ };
+ i(), t.addEventListener("change", i), this.on("dispose", (function() {
+ return t.removeEventListener("change", i)
+ }));
+ var n = function i() {
+ for (var n = 0; n < e.length; n++) {
+ var r = e[n];
+ "disabled" === r.track.mode && r.track.mode !== r.storedMode && (r.track.mode = r.storedMode)
+ }
+ t.removeEventListener("change", i)
+ };
+ this.on("webkitbeginfullscreen", (function() {
+ t.removeEventListener("change", i), t.removeEventListener("change", n), t.addEventListener("change", n)
+ })), this.on("webkitendfullscreen", (function() {
+ t.removeEventListener("change", i), t.addEventListener("change", i), t.removeEventListener("change", n)
+ }))
+ }, i.overrideNative_ = function(e, t) {
+ var i = this;
+ if (t === this["featuresNative" + e + "Tracks"]) {
+ var n = e.toLowerCase();
+ this[n + "TracksListeners_"] && Object.keys(this[n + "TracksListeners_"]).forEach((function(e) {
+ i.el()[n + "Tracks"].removeEventListener(e, i[n + "TracksListeners_"][e])
+ })), this["featuresNative" + e + "Tracks"] = !t, this[n + "TracksListeners_"] = null, this.proxyNativeTracksForType_(n)
+ }
+ }, i.overrideNativeAudioTracks = function(e) {
+ this.overrideNative_("Audio", e)
+ }, i.overrideNativeVideoTracks = function(e) {
+ this.overrideNative_("Video", e)
+ }, i.proxyNativeTracksForType_ = function(e) {
+ var t = this,
+ i = Ri[e],
+ n = this.el()[i.getterName],
+ r = this[i.getterName]();
+ if (this["featuresNative" + i.capitalName + "Tracks"] && n && n.addEventListener) {
+ var a = {
+ change: function(i) {
+ var n = {
+ type: "change",
+ target: r,
+ currentTarget: r,
+ srcElement: r
+ };
+ r.trigger(n), "text" === e && t[Di.remoteText.getterName]().trigger(n)
+ },
+ addtrack: function(e) {
+ r.addTrack(e.track)
+ },
+ removetrack: function(e) {
+ r.removeTrack(e.track)
+ }
+ },
+ s = function() {
+ for (var e = [], t = 0; t < r.length; t++) {
+ for (var i = !1, a = 0; a < n.length; a++)
+ if (n[a] === r[t]) {
+ i = !0;
+ break
+ } i || e.push(r[t])
+ }
+ for (; e.length;) r.removeTrack(e.shift())
+ };
+ this[i.getterName + "Listeners_"] = a, Object.keys(a).forEach((function(e) {
+ var i = a[e];
+ n.addEventListener(e, i), t.on("dispose", (function(t) {
+ return n.removeEventListener(e, i)
+ }))
+ })), this.on("loadstart", s), this.on("dispose", (function(e) {
+ return t.off("loadstart", s)
+ }))
+ }
+ }, i.proxyNativeTracks_ = function() {
+ var e = this;
+ Ri.names.forEach((function(t) {
+ e.proxyNativeTracksForType_(t)
+ }))
+ }, i.createEl = function() {
+ var e = this.options_.tag;
+ if (!e || !this.options_.playerElIngest && !this.movingMediaElementInDOM) {
+ if (e) {
+ var i = e.cloneNode(!0);
+ e.parentNode && e.parentNode.insertBefore(i, e), t.disposeMediaElement(e), e = i
+ } else {
+ e = k.default.createElement("video");
+ var n = zt({}, this.options_.tag && Ne(this.options_.tag));
+ ye && !0 === this.options_.nativeControlsForTouch || delete n.controls, Be(e, Z(n, {
+ id: this.options_.techId,
+ class: "vjs-tech"
+ }))
+ }
+ e.playerId = this.options_.playerId
+ }
+ void 0 !== this.options_.preload && Ve(e, "preload", this.options_.preload), void 0 !== this.options_.disablePictureInPicture && (e.disablePictureInPicture = this.options_.disablePictureInPicture);
+ for (var r = ["loop", "muted", "playsinline", "autoplay"], a = 0; a < r.length; a++) {
+ var s = r[a],
+ o = this.options_[s];
+ void 0 !== o && (o ? Ve(e, s, s) : He(e, s), e[s] = o)
+ }
+ return e
+ }, i.handleLateInit_ = function(e) {
+ if (0 !== e.networkState && 3 !== e.networkState) {
+ if (0 === e.readyState) {
+ var t = !1,
+ i = function() {
+ t = !0
+ };
+ this.on("loadstart", i);
+ var n = function() {
+ t || this.trigger("loadstart")
+ };
+ return this.on("loadedmetadata", n), void this.ready((function() {
+ this.off("loadstart", i), this.off("loadedmetadata", n), t || this.trigger("loadstart")
+ }))
+ }
+ var r = ["loadstart"];
+ r.push("loadedmetadata"), e.readyState >= 2 && r.push("loadeddata"), e.readyState >= 3 && r.push("canplay"), e.readyState >= 4 && r.push("canplaythrough"), this.ready((function() {
+ r.forEach((function(e) {
+ this.trigger(e)
+ }), this)
+ }))
+ }
+ }, i.setScrubbing = function(e) {
+ this.isScrubbing_ = e
+ }, i.scrubbing = function() {
+ return this.isScrubbing_
+ }, i.setCurrentTime = function(e) {
+ try {
+ this.isScrubbing_ && this.el_.fastSeek && Ee ? this.el_.fastSeek(e) : this.el_.currentTime = e
+ } catch (e) {
+ K(e, "Video is not ready. (Video.js)")
+ }
+ }, i.duration = function() {
+ var e = this;
+ if (this.el_.duration === 1 / 0 && le && pe && 0 === this.el_.currentTime) {
+ return this.on("timeupdate", (function t() {
+ e.el_.currentTime > 0 && (e.el_.duration === 1 / 0 && e.trigger("durationchange"), e.off("timeupdate", t))
+ })), NaN
+ }
+ return this.el_.duration || NaN
+ }, i.width = function() {
+ return this.el_.offsetWidth
+ }, i.height = function() {
+ return this.el_.offsetHeight
+ }, i.proxyWebkitFullscreen_ = function() {
+ var e = this;
+ if ("webkitDisplayingFullscreen" in this.el_) {
+ var t = function() {
+ this.trigger("fullscreenchange", {
+ isFullscreen: !1
+ })
+ },
+ i = function() {
+ "webkitPresentationMode" in this.el_ && "picture-in-picture" !== this.el_.webkitPresentationMode && (this.one("webkitendfullscreen", t), this.trigger("fullscreenchange", {
+ isFullscreen: !0,
+ nativeIOSFullscreen: !0
+ }))
+ };
+ this.on("webkitbeginfullscreen", i), this.on("dispose", (function() {
+ e.off("webkitbeginfullscreen", i), e.off("webkitendfullscreen", t)
+ }))
+ }
+ }, i.supportsFullScreen = function() {
+ if ("function" == typeof this.el_.webkitEnterFullScreen) {
+ var e = C.default.navigator && C.default.navigator.userAgent || "";
+ if (/Android/.test(e) || !/Chrome|Mac OS X 10.5/.test(e)) return !0
+ }
+ return !1
+ }, i.enterFullScreen = function() {
+ var e = this.el_;
+ if (e.paused && e.networkState <= e.HAVE_METADATA) ii(this.el_.play()), this.setTimeout((function() {
+ e.pause();
+ try {
+ e.webkitEnterFullScreen()
+ } catch (e) {
+ this.trigger("fullscreenerror", e)
+ }
+ }), 0);
+ else try {
+ e.webkitEnterFullScreen()
+ } catch (e) {
+ this.trigger("fullscreenerror", e)
+ }
+ }, i.exitFullScreen = function() {
+ this.el_.webkitDisplayingFullscreen ? this.el_.webkitExitFullScreen() : this.trigger("fullscreenerror", new Error("The video is not fullscreen"))
+ }, i.requestPictureInPicture = function() {
+ return this.el_.requestPictureInPicture()
+ }, i.src = function(e) {
+ if (void 0 === e) return this.el_.src;
+ this.setSrc(e)
+ }, i.reset = function() {
+ t.resetMediaElement(this.el_)
+ }, i.currentSrc = function() {
+ return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc
+ }, i.setControls = function(e) {
+ this.el_.controls = !!e
+ }, i.addTextTrack = function(t, i, n) {
+ return this.featuresNativeTextTracks ? this.el_.addTextTrack(t, i, n) : e.prototype.addTextTrack.call(this, t, i, n)
+ }, i.createRemoteTextTrack = function(t) {
+ if (!this.featuresNativeTextTracks) return e.prototype.createRemoteTextTrack.call(this, t);
+ var i = k.default.createElement("track");
+ return t.kind && (i.kind = t.kind), t.label && (i.label = t.label), (t.language || t.srclang) && (i.srclang = t.language || t.srclang), t.default && (i.default = t.default), t.id && (i.id = t.id), t.src && (i.src = t.src), i
+ }, i.addRemoteTextTrack = function(t, i) {
+ var n = e.prototype.addRemoteTextTrack.call(this, t, i);
+ return this.featuresNativeTextTracks && this.el().appendChild(n), n
+ }, i.removeRemoteTextTrack = function(t) {
+ if (e.prototype.removeRemoteTextTrack.call(this, t), this.featuresNativeTextTracks)
+ for (var i = this.$$("track"), n = i.length; n--;) t !== i[n] && t !== i[n].track || this.el().removeChild(i[n])
+ }, i.getVideoPlaybackQuality = function() {
+ if ("function" == typeof this.el().getVideoPlaybackQuality) return this.el().getVideoPlaybackQuality();
+ var e = {};
+ return void 0 !== this.el().webkitDroppedFrameCount && void 0 !== this.el().webkitDecodedFrameCount && (e.droppedVideoFrames = this.el().webkitDroppedFrameCount, e.totalVideoFrames = this.el().webkitDecodedFrameCount), C.default.performance && "function" == typeof C.default.performance.now ? e.creationTime = C.default.performance.now() : C.default.performance && C.default.performance.timing && "number" == typeof C.default.performance.timing.navigationStart && (e.creationTime = C.default.Date.now() - C.default.performance.timing.navigationStart), e
+ }, t
+ }(Ui);
+ Ir(Lr, "TEST_VID", (function() {
+ if (ke()) {
+ var e = k.default.createElement("video"),
+ t = k.default.createElement("track");
+ return t.kind = "captions", t.srclang = "en", t.label = "English", e.appendChild(t), e
+ }
+ })), Lr.isSupported = function() {
+ try {
+ Lr.TEST_VID.volume = .5
+ } catch (e) {
+ return !1
+ }
+ return !(!Lr.TEST_VID || !Lr.TEST_VID.canPlayType)
+ }, Lr.canPlayType = function(e) {
+ return Lr.TEST_VID.canPlayType(e)
+ }, Lr.canPlaySource = function(e, t) {
+ return Lr.canPlayType(e.type)
+ }, Lr.canControlVolume = function() {
+ try {
+ var e = Lr.TEST_VID.volume;
+ return Lr.TEST_VID.volume = e / 2 + .1, e !== Lr.TEST_VID.volume
+ } catch (e) {
+ return !1
+ }
+ }, Lr.canMuteVolume = function() {
+ try {
+ var e = Lr.TEST_VID.muted;
+ return Lr.TEST_VID.muted = !e, Lr.TEST_VID.muted ? Ve(Lr.TEST_VID, "muted", "muted") : He(Lr.TEST_VID, "muted"), e !== Lr.TEST_VID.muted
+ } catch (e) {
+ return !1
+ }
+ }, Lr.canControlPlaybackRate = function() {
+ if (le && pe && me < 58) return !1;
+ try {
+ var e = Lr.TEST_VID.playbackRate;
+ return Lr.TEST_VID.playbackRate = e / 2 + .1, e !== Lr.TEST_VID.playbackRate
+ } catch (e) {
+ return !1
+ }
+ }, Lr.canOverrideAttributes = function() {
+ try {
+ var e = function() {};
+ Object.defineProperty(k.default.createElement("video"), "src", {
+ get: e,
+ set: e
+ }), Object.defineProperty(k.default.createElement("audio"), "src", {
+ get: e,
+ set: e
+ }), Object.defineProperty(k.default.createElement("video"), "innerHTML", {
+ get: e,
+ set: e
+ }), Object.defineProperty(k.default.createElement("audio"), "innerHTML", {
+ get: e,
+ set: e
+ })
+ } catch (e) {
+ return !1
+ }
+ return !0
+ }, Lr.supportsNativeTextTracks = function() {
+ return Ee || Te && pe
+ }, Lr.supportsNativeVideoTracks = function() {
+ return !(!Lr.TEST_VID || !Lr.TEST_VID.videoTracks)
+ }, Lr.supportsNativeAudioTracks = function() {
+ return !(!Lr.TEST_VID || !Lr.TEST_VID.audioTracks)
+ }, Lr.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"], [
+ ["featuresVolumeControl", "canControlVolume"],
+ ["featuresMuteControl", "canMuteVolume"],
+ ["featuresPlaybackRate", "canControlPlaybackRate"],
+ ["featuresSourceset", "canOverrideAttributes"],
+ ["featuresNativeTextTracks", "supportsNativeTextTracks"],
+ ["featuresNativeVideoTracks", "supportsNativeVideoTracks"],
+ ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]
+ ].forEach((function(e) {
+ var t = e[0],
+ i = e[1];
+ Ir(Lr.prototype, t, (function() {
+ return Lr[i]()
+ }), !0)
+ })), Lr.prototype.movingMediaElementInDOM = !Te, Lr.prototype.featuresFullscreenResize = !0, Lr.prototype.featuresProgressEvents = !0, Lr.prototype.featuresTimeupdateEvents = !0, Lr.patchCanPlayType = function() {
+ he >= 4 && !ce && !pe && (Tr = Lr.TEST_VID && Lr.TEST_VID.constructor.prototype.canPlayType, Lr.TEST_VID.constructor.prototype.canPlayType = function(e) {
+ return e && /^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e) ? "maybe" : Tr.call(this, e)
+ })
+ }, Lr.unpatchCanPlayType = function() {
+ var e = Lr.TEST_VID.constructor.prototype.canPlayType;
+ return Tr && (Lr.TEST_VID.constructor.prototype.canPlayType = Tr), e
+ }, Lr.patchCanPlayType(), Lr.disposeMediaElement = function(e) {
+ if (e) {
+ for (e.parentNode && e.parentNode.removeChild(e); e.hasChildNodes();) e.removeChild(e.firstChild);
+ e.removeAttribute("src"), "function" == typeof e.load && function() {
+ try {
+ e.load()
+ } catch (e) {}
+ }()
+ }
+ }, Lr.resetMediaElement = function(e) {
+ if (e) {
+ for (var t = e.querySelectorAll("source"), i = t.length; i--;) e.removeChild(t[i]);
+ e.removeAttribute("src"), "function" == typeof e.load && function() {
+ try {
+ e.load()
+ } catch (e) {}
+ }()
+ }
+ }, ["muted", "defaultMuted", "autoplay", "controls", "loop", "playsinline"].forEach((function(e) {
+ Lr.prototype[e] = function() {
+ return this.el_[e] || this.el_.hasAttribute(e)
+ }
+ })), ["muted", "defaultMuted", "autoplay", "loop", "playsinline"].forEach((function(e) {
+ Lr.prototype["set" + Ht(e)] = function(t) {
+ this.el_[e] = t, t ? this.el_.setAttribute(e, e) : this.el_.removeAttribute(e)
+ }
+ })), ["paused", "currentTime", "buffered", "volume", "poster", "preload", "error", "seeking", "seekable", "ended", "playbackRate", "defaultPlaybackRate", "disablePictureInPicture", "played", "networkState", "readyState", "videoWidth", "videoHeight", "crossOrigin"].forEach((function(e) {
+ Lr.prototype[e] = function() {
+ return this.el_[e]
+ }
+ })), ["volume", "src", "poster", "preload", "playbackRate", "defaultPlaybackRate", "disablePictureInPicture", "crossOrigin"].forEach((function(e) {
+ Lr.prototype["set" + Ht(e)] = function(t) {
+ this.el_[e] = t
+ }
+ })), ["pause", "load", "play"].forEach((function(e) {
+ Lr.prototype[e] = function() {
+ return this.el_[e]()
+ }
+ })), Ui.withSourceHandlers(Lr), Lr.nativeSourceHandler = {}, Lr.nativeSourceHandler.canPlayType = function(e) {
+ try {
+ return Lr.TEST_VID.canPlayType(e)
+ } catch (e) {
+ return ""
+ }
+ }, Lr.nativeSourceHandler.canHandleSource = function(e, t) {
+ if (e.type) return Lr.nativeSourceHandler.canPlayType(e.type);
+ if (e.src) {
+ var i = Ei(e.src);
+ return Lr.nativeSourceHandler.canPlayType("video/" + i)
+ }
+ return ""
+ }, Lr.nativeSourceHandler.handleSource = function(e, t, i) {
+ t.setSrc(e.src)
+ }, Lr.nativeSourceHandler.dispose = function() {}, Lr.registerSourceHandler(Lr.nativeSourceHandler), Ui.registerTech("Html5", Lr);
+ var xr = ["progress", "abort", "suspend", "emptied", "stalled", "loadedmetadata", "loadeddata", "timeupdate", "resize", "volumechange", "texttrackchange"],
+ Rr = {
+ canplay: "CanPlay",
+ canplaythrough: "CanPlayThrough",
+ playing: "Playing",
+ seeked: "Seeked"
+ },
+ Dr = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"],
+ Or = {};
+ Dr.forEach((function(e) {
+ var t = "x" === e.charAt(0) ? "x-" + e.substring(1) : e;
+ Or[e] = "vjs-layout-" + t
+ }));
+ var Ur = {
+ tiny: 210,
+ xsmall: 320,
+ small: 425,
+ medium: 768,
+ large: 1440,
+ xlarge: 2560,
+ huge: 1 / 0
+ },
+ Mr = function(e) {
+ function t(i, n, r) {
+ var a;
+ if (i.id = i.id || n.id || "vjs_video_" + ct(), (n = Z(t.getTagSettings(i), n)).initChildren = !1, n.createEl = !1, n.evented = !1, n.reportTouchActivity = !1, !n.language)
+ if ("function" == typeof i.closest) {
+ var s = i.closest("[lang]");
+ s && s.getAttribute && (n.language = s.getAttribute("lang"))
+ } else
+ for (var o = i; o && 1 === o.nodeType;) {
+ if (Ne(o).hasOwnProperty("lang")) {
+ n.language = o.getAttribute("lang");
+ break
+ }
+ o = o.parentNode
+ }
+ if ((a = e.call(this, null, n, r) || this).boundDocumentFullscreenChange_ = function(e) {
+ return a.documentFullscreenChange_(e)
+ }, a.boundFullWindowOnEscKey_ = function(e) {
+ return a.fullWindowOnEscKey(e)
+ }, a.boundUpdateStyleEl_ = function(e) {
+ return a.updateStyleEl_(e)
+ }, a.boundApplyInitTime_ = function(e) {
+ return a.applyInitTime_(e)
+ }, a.boundUpdateCurrentBreakpoint_ = function(e) {
+ return a.updateCurrentBreakpoint_(e)
+ }, a.boundHandleTechClick_ = function(e) {
+ return a.handleTechClick_(e)
+ }, a.boundHandleTechDoubleClick_ = function(e) {
+ return a.handleTechDoubleClick_(e)
+ }, a.boundHandleTechTouchStart_ = function(e) {
+ return a.handleTechTouchStart_(e)
+ }, a.boundHandleTechTouchMove_ = function(e) {
+ return a.handleTechTouchMove_(e)
+ }, a.boundHandleTechTouchEnd_ = function(e) {
+ return a.handleTechTouchEnd_(e)
+ }, a.boundHandleTechTap_ = function(e) {
+ return a.handleTechTap_(e)
+ }, a.isFullscreen_ = !1, a.log = X(a.id_), a.fsApi_ = H, a.isPosterFromTech_ = !1, a.queuedCallbacks_ = [], a.isReady_ = !1, a.hasStarted_ = !1, a.userActive_ = !1, a.debugEnabled_ = !1, !a.options_ || !a.options_.techOrder || !a.options_.techOrder.length) throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
+ if (a.tag = i, a.tagAttributes = i && Ne(i), a.language(a.options_.language), n.languages) {
+ var u = {};
+ Object.getOwnPropertyNames(n.languages).forEach((function(e) {
+ u[e.toLowerCase()] = n.languages[e]
+ })), a.languages_ = u
+ } else a.languages_ = t.prototype.options_.languages;
+ a.resetCache_(), a.poster_ = n.poster || "", a.controls_ = !!n.controls, i.controls = !1, i.removeAttribute("controls"), a.changingSrc_ = !1, a.playCallbacks_ = [], a.playTerminatedQueue_ = [], i.hasAttribute("autoplay") ? a.autoplay(!0) : a.autoplay(a.options_.autoplay), n.plugins && Object.keys(n.plugins).forEach((function(e) {
+ if ("function" != typeof a[e]) throw new Error('plugin "' + e + '" does not exist')
+ })), a.scrubbing_ = !1, a.el_ = a.createEl(), Bt(I.default(a), {
+ eventBusKey: "el_"
+ }), a.fsApi_.requestFullscreen && (yt(k.default, a.fsApi_.fullscreenchange, a.boundDocumentFullscreenChange_), a.on(a.fsApi_.fullscreenchange, a.boundDocumentFullscreenChange_)), a.fluid_ && a.on(["playerreset", "resize"], a.boundUpdateStyleEl_);
+ var l = zt(a.options_);
+ n.plugins && Object.keys(n.plugins).forEach((function(e) {
+ a[e](n.plugins[e])
+ })), n.debug && a.debug(!0), a.options_.playerOptions = l, a.middleware_ = [], a.playbackRates(n.playbackRates), a.initChildren(), a.isAudio("audio" === i.nodeName.toLowerCase()), a.controls() ? a.addClass("vjs-controls-enabled") : a.addClass("vjs-controls-disabled"), a.el_.setAttribute("role", "region"), a.isAudio() ? a.el_.setAttribute("aria-label", a.localize("Audio Player")) : a.el_.setAttribute("aria-label", a.localize("Video Player")), a.isAudio() && a.addClass("vjs-audio"), a.flexNotSupported_() && a.addClass("vjs-no-flex"), ye && a.addClass("vjs-touch-enabled"), Te || a.addClass("vjs-workinghover"), t.players[a.id_] = I.default(a);
+ var h = "7.15.4".split(".")[0];
+ return a.addClass("vjs-v" + h), a.userActive(!0), a.reportUserActivity(), a.one("play", (function(e) {
+ return a.listenForUserActivity_(e)
+ })), a.on("stageclick", (function(e) {
+ return a.handleStageClick_(e)
+ })), a.on("keydown", (function(e) {
+ return a.handleKeyDown(e)
+ })), a.on("languagechange", (function(e) {
+ return a.handleLanguagechange(e)
+ })), a.breakpoints(a.options_.breakpoints), a.responsive(a.options_.responsive), a
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.dispose = function() {
+ var i = this;
+ this.trigger("dispose"), this.off("dispose"), bt(k.default, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_), bt(k.default, "keydown", this.boundFullWindowOnEscKey_), this.styleEl_ && this.styleEl_.parentNode && (this.styleEl_.parentNode.removeChild(this.styleEl_), this.styleEl_ = null), t.players[this.id_] = null, this.tag && this.tag.player && (this.tag.player = null), this.el_ && this.el_.player && (this.el_.player = null), this.tech_ && (this.tech_.dispose(), this.isPosterFromTech_ = !1, this.poster_ = ""), this.playerElIngest_ && (this.playerElIngest_ = null), this.tag && (this.tag = null), Fi[this.id()] = null, Oi.names.forEach((function(e) {
+ var t = Oi[e],
+ n = i[t.getterName]();
+ n && n.off && n.off()
+ })), e.prototype.dispose.call(this)
+ }, i.createEl = function() {
+ var t, i = this.tag,
+ n = this.playerElIngest_ = i.parentNode && i.parentNode.hasAttribute && i.parentNode.hasAttribute("data-vjs-player"),
+ r = "video-js" === this.tag.tagName.toLowerCase();
+ n ? t = this.el_ = i.parentNode : r || (t = this.el_ = e.prototype.createEl.call(this, "div"));
+ var a = Ne(i);
+ if (r) {
+ for (t = this.el_ = i, i = this.tag = k.default.createElement("video"); t.children.length;) i.appendChild(t.firstChild);
+ Oe(t, "video-js") || Ue(t, "video-js"), t.appendChild(i), n = this.playerElIngest_ = t, Object.keys(t).forEach((function(e) {
+ try {
+ i[e] = t[e]
+ } catch (e) {}
+ }))
+ }
+ if (i.setAttribute("tabindex", "-1"), a.tabindex = "-1", (_e || pe && ve) && (i.setAttribute("role", "application"), a.role = "application"), i.removeAttribute("width"), i.removeAttribute("height"), "width" in a && delete a.width, "height" in a && delete a.height, Object.getOwnPropertyNames(a).forEach((function(e) {
+ r && "class" === e || t.setAttribute(e, a[e]), r && i.setAttribute(e, a[e])
+ })), i.playerId = i.id, i.id += "_html5_api", i.className = "vjs-tech", i.player = t.player = this, this.addClass("vjs-paused"), !0 !== C.default.VIDEOJS_NO_DYNAMIC_STYLE) {
+ this.styleEl_ = lt("vjs-styles-dimensions");
+ var s = tt(".vjs-styles-defaults"),
+ o = tt("head");
+ o.insertBefore(this.styleEl_, s ? s.nextSibling : o.firstChild)
+ }
+ this.fill_ = !1, this.fluid_ = !1, this.width(this.options_.width), this.height(this.options_.height), this.fill(this.options_.fill), this.fluid(this.options_.fluid), this.aspectRatio(this.options_.aspectRatio), this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
+ for (var u = i.getElementsByTagName("a"), l = 0; l < u.length; l++) {
+ var h = u.item(l);
+ Ue(h, "vjs-hidden"), h.setAttribute("hidden", "hidden")
+ }
+ return i.initNetworkState_ = i.networkState, i.parentNode && !n && i.parentNode.insertBefore(t, i), De(i, t), this.children_.unshift(i), this.el_.setAttribute("lang", this.language_), this.el_ = t, t
+ }, i.crossOrigin = function(e) {
+ if (!e) return this.techGet_("crossOrigin");
+ "anonymous" === e || "use-credentials" === e ? this.techCall_("setCrossOrigin", e) : K.warn('crossOrigin must be "anonymous" or "use-credentials", given "' + e + '"')
+ }, i.width = function(e) {
+ return this.dimension("width", e)
+ }, i.height = function(e) {
+ return this.dimension("height", e)
+ }, i.dimension = function(e, t) {
+ var i = e + "_";
+ if (void 0 === t) return this[i] || 0;
+ if ("" === t || "auto" === t) return this[i] = void 0, void this.updateStyleEl_();
+ var n = parseFloat(t);
+ isNaN(n) ? K.error('Improper value "' + t + '" supplied for for ' + e) : (this[i] = n, this.updateStyleEl_())
+ }, i.fluid = function(e) {
+ var t, i, n = this;
+ if (void 0 === e) return !!this.fluid_;
+ this.fluid_ = !!e, Lt(this) && this.off(["playerreset", "resize"], this.boundUpdateStyleEl_), e ? (this.addClass("vjs-fluid"), this.fill(!1), i = function() {
+ n.on(["playerreset", "resize"], n.boundUpdateStyleEl_)
+ }, Lt(t = this) ? i() : (t.eventedCallbacks || (t.eventedCallbacks = []), t.eventedCallbacks.push(i))) : this.removeClass("vjs-fluid"), this.updateStyleEl_()
+ }, i.fill = function(e) {
+ if (void 0 === e) return !!this.fill_;
+ this.fill_ = !!e, e ? (this.addClass("vjs-fill"), this.fluid(!1)) : this.removeClass("vjs-fill")
+ }, i.aspectRatio = function(e) {
+ if (void 0 === e) return this.aspectRatio_;
+ if (!/^\d+\:\d+$/.test(e)) throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
+ this.aspectRatio_ = e, this.fluid(!0), this.updateStyleEl_()
+ }, i.updateStyleEl_ = function() {
+ if (!0 !== C.default.VIDEOJS_NO_DYNAMIC_STYLE) {
+ var e, t, i, n = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"),
+ r = n[1] / n[0];
+ e = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / r : this.videoWidth() || 300, t = void 0 !== this.height_ ? this.height_ : e * r, i = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(i), ht(this.styleEl_, "\n ." + i + " {\n width: " + e + "px;\n height: " + t + "px;\n }\n\n ." + i + ".vjs-fluid {\n padding-top: " + 100 * r + "%;\n }\n ")
+ } else {
+ var a = "number" == typeof this.width_ ? this.width_ : this.options_.width,
+ s = "number" == typeof this.height_ ? this.height_ : this.options_.height,
+ o = this.tech_ && this.tech_.el();
+ o && (a >= 0 && (o.width = a), s >= 0 && (o.height = s))
+ }
+ }, i.loadTech_ = function(e, t) {
+ var i = this;
+ this.tech_ && this.unloadTech_();
+ var n = Ht(e),
+ r = e.charAt(0).toLowerCase() + e.slice(1);
+ "Html5" !== n && this.tag && (Ui.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = n, this.isReady_ = !1;
+ var a = this.autoplay();
+ ("string" == typeof this.autoplay() || !0 === this.autoplay() && this.options_.normalizeAutoplay) && (a = !1);
+ var s = {
+ source: t,
+ autoplay: a,
+ nativeControlsForTouch: this.options_.nativeControlsForTouch,
+ playerId: this.id(),
+ techId: this.id() + "_" + r + "_api",
+ playsinline: this.options_.playsinline,
+ preload: this.options_.preload,
+ loop: this.options_.loop,
+ disablePictureInPicture: this.options_.disablePictureInPicture,
+ muted: this.options_.muted,
+ poster: this.poster(),
+ language: this.language(),
+ playerElIngest: this.playerElIngest_ || !1,
+ "vtt.js": this.options_["vtt.js"],
+ canOverridePoster: !!this.options_.techCanOverridePoster,
+ enableSourceset: this.options_.enableSourceset,
+ Promise: this.options_.Promise
+ };
+ Oi.names.forEach((function(e) {
+ var t = Oi[e];
+ s[t.getterName] = i[t.privateName]
+ })), Z(s, this.options_[n]), Z(s, this.options_[r]), Z(s, this.options_[e.toLowerCase()]), this.tag && (s.tag = this.tag), t && t.src === this.cache_.src && this.cache_.currentTime > 0 && (s.startTime = this.cache_.currentTime);
+ var o = Ui.getTech(e);
+ if (!o) throw new Error("No Tech named '" + n + "' exists! '" + n + "' should be registered using videojs.registerTech()'");
+ this.tech_ = new o(s), this.tech_.ready(Ct(this, this.handleTechReady_), !0), ai(this.textTracksJson_ || [], this.tech_), xr.forEach((function(e) {
+ i.on(i.tech_, e, (function(t) {
+ return i["handleTech" + Ht(e) + "_"](t)
+ }))
+ })), Object.keys(Rr).forEach((function(e) {
+ i.on(i.tech_, e, (function(t) {
+ 0 === i.tech_.playbackRate() && i.tech_.seeking() ? i.queuedCallbacks_.push({
+ callback: i["handleTech" + Rr[e] + "_"].bind(i),
+ event: t
+ }) : i["handleTech" + Rr[e] + "_"](t)
+ }))
+ })), this.on(this.tech_, "loadstart", (function(e) {
+ return i.handleTechLoadStart_(e)
+ })), this.on(this.tech_, "sourceset", (function(e) {
+ return i.handleTechSourceset_(e)
+ })), this.on(this.tech_, "waiting", (function(e) {
+ return i.handleTechWaiting_(e)
+ })), this.on(this.tech_, "ended", (function(e) {
+ return i.handleTechEnded_(e)
+ })), this.on(this.tech_, "seeking", (function(e) {
+ return i.handleTechSeeking_(e)
+ })), this.on(this.tech_, "play", (function(e) {
+ return i.handleTechPlay_(e)
+ })), this.on(this.tech_, "firstplay", (function(e) {
+ return i.handleTechFirstPlay_(e)
+ })), this.on(this.tech_, "pause", (function(e) {
+ return i.handleTechPause_(e)
+ })), this.on(this.tech_, "durationchange", (function(e) {
+ return i.handleTechDurationChange_(e)
+ })), this.on(this.tech_, "fullscreenchange", (function(e, t) {
+ return i.handleTechFullscreenChange_(e, t)
+ })), this.on(this.tech_, "fullscreenerror", (function(e, t) {
+ return i.handleTechFullscreenError_(e, t)
+ })), this.on(this.tech_, "enterpictureinpicture", (function(e) {
+ return i.handleTechEnterPictureInPicture_(e)
+ })), this.on(this.tech_, "leavepictureinpicture", (function(e) {
+ return i.handleTechLeavePictureInPicture_(e)
+ })), this.on(this.tech_, "error", (function(e) {
+ return i.handleTechError_(e)
+ })), this.on(this.tech_, "posterchange", (function(e) {
+ return i.handleTechPosterChange_(e)
+ })), this.on(this.tech_, "textdata", (function(e) {
+ return i.handleTechTextData_(e)
+ })), this.on(this.tech_, "ratechange", (function(e) {
+ return i.handleTechRateChange_(e)
+ })), this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_), this.usingNativeControls(this.techGet_("controls")), this.controls() && !this.usingNativeControls() && this.addTechControlsListeners_(), this.tech_.el().parentNode === this.el() || "Html5" === n && this.tag || De(this.tech_.el(), this.el()), this.tag && (this.tag.player = null, this.tag = null)
+ }, i.unloadTech_ = function() {
+ var e = this;
+ Oi.names.forEach((function(t) {
+ var i = Oi[t];
+ e[i.privateName] = e[i.getterName]()
+ })), this.textTracksJson_ = ri(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this.isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1
+ }, i.tech = function(e) {
+ return void 0 === e && K.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"), this.tech_
+ }, i.addTechControlsListeners_ = function() {
+ this.removeTechControlsListeners_(), this.on(this.tech_, "click", this.boundHandleTechClick_), this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_), this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_), this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_), this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_), this.on(this.tech_, "tap", this.boundHandleTechTap_)
+ }, i.removeTechControlsListeners_ = function() {
+ this.off(this.tech_, "tap", this.boundHandleTechTap_), this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_), this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_), this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_), this.off(this.tech_, "click", this.boundHandleTechClick_), this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_)
+ }, i.handleTechReady_ = function() {
+ this.triggerReady(), this.cache_.volume && this.techCall_("setVolume", this.cache_.volume), this.handleTechPosterChange_(), this.handleTechDurationChange_()
+ }, i.handleTechLoadStart_ = function() {
+ this.removeClass("vjs-ended"), this.removeClass("vjs-seeking"), this.error(null), this.handleTechDurationChange_(), this.paused() ? (this.hasStarted(!1), this.trigger("loadstart")) : (this.trigger("loadstart"), this.trigger("firstplay")), this.manualAutoplay_(!0 === this.autoplay() && this.options_.normalizeAutoplay ? "play" : this.autoplay())
+ }, i.manualAutoplay_ = function(e) {
+ var t = this;
+ if (this.tech_ && "string" == typeof e) {
+ var i, n = function() {
+ var e = t.muted();
+ t.muted(!0);
+ var i = function() {
+ t.muted(e)
+ };
+ t.playTerminatedQueue_.push(i);
+ var n = t.play();
+ if (ti(n)) return n.catch((function(e) {
+ throw i(), new Error("Rejection at manualAutoplay. Restoring muted value. " + (e || ""))
+ }))
+ };
+ if ("any" !== e || this.muted() ? i = "muted" !== e || this.muted() ? this.play() : n() : ti(i = this.play()) && (i = i.catch(n)), ti(i)) return i.then((function() {
+ t.trigger({
+ type: "autoplay-success",
+ autoplay: e
+ })
+ })).catch((function() {
+ t.trigger({
+ type: "autoplay-failure",
+ autoplay: e
+ })
+ }))
+ }
+ }, i.updateSourceCaches_ = function(e) {
+ void 0 === e && (e = "");
+ var t = e,
+ i = "";
+ "string" != typeof t && (t = e.src, i = e.type), this.cache_.source = this.cache_.source || {}, this.cache_.sources = this.cache_.sources || [], t && !i && (i = function(e, t) {
+ if (!t) return "";
+ if (e.cache_.source.src === t && e.cache_.source.type) return e.cache_.source.type;
+ var i = e.cache_.sources.filter((function(e) {
+ return e.src === t
+ }));
+ if (i.length) return i[0].type;
+ for (var n = e.$$("source"), r = 0; r < n.length; r++) {
+ var a = n[r];
+ if (a.type && a.src && a.src === t) return a.type
+ }
+ return Yi(t)
+ }(this, t)), this.cache_.source = zt({}, e, {
+ src: t,
+ type: i
+ });
+ for (var n = this.cache_.sources.filter((function(e) {
+ return e.src && e.src === t
+ })), r = [], a = this.$$("source"), s = [], o = 0; o < a.length; o++) {
+ var u = Ne(a[o]);
+ r.push(u), u.src && u.src === t && s.push(u.src)
+ }
+ s.length && !n.length ? this.cache_.sources = r : n.length || (this.cache_.sources = [this.cache_.source]), this.cache_.src = t
+ }, i.handleTechSourceset_ = function(e) {
+ var t = this;
+ if (!this.changingSrc_) {
+ var i = function(e) {
+ return t.updateSourceCaches_(e)
+ },
+ n = this.currentSource().src,
+ r = e.src;
+ n && !/^blob:/.test(n) && /^blob:/.test(r) && (!this.lastSource_ || this.lastSource_.tech !== r && this.lastSource_.player !== n) && (i = function() {}), i(r), e.src || this.tech_.any(["sourceset", "loadstart"], (function(e) {
+ if ("sourceset" !== e.type) {
+ var i = t.techGet("currentSrc");
+ t.lastSource_.tech = i, t.updateSourceCaches_(i)
+ }
+ }))
+ }
+ this.lastSource_ = {
+ player: this.currentSource().src,
+ tech: e.src
+ }, this.trigger({
+ src: e.src,
+ type: "sourceset"
+ })
+ }, i.hasStarted = function(e) {
+ if (void 0 === e) return this.hasStarted_;
+ e !== this.hasStarted_ && (this.hasStarted_ = e, this.hasStarted_ ? (this.addClass("vjs-has-started"), this.trigger("firstplay")) : this.removeClass("vjs-has-started"))
+ }, i.handleTechPlay_ = function() {
+ this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this.hasStarted(!0), this.trigger("play")
+ }, i.handleTechRateChange_ = function() {
+ this.tech_.playbackRate() > 0 && 0 === this.cache_.lastPlaybackRate && (this.queuedCallbacks_.forEach((function(e) {
+ return e.callback(e.event)
+ })), this.queuedCallbacks_ = []), this.cache_.lastPlaybackRate = this.tech_.playbackRate(), this.trigger("ratechange")
+ }, i.handleTechWaiting_ = function() {
+ var e = this;
+ this.addClass("vjs-waiting"), this.trigger("waiting");
+ var t = this.currentTime();
+ this.on("timeupdate", (function i() {
+ t !== e.currentTime() && (e.removeClass("vjs-waiting"), e.off("timeupdate", i))
+ }))
+ }, i.handleTechCanPlay_ = function() {
+ this.removeClass("vjs-waiting"), this.trigger("canplay")
+ }, i.handleTechCanPlayThrough_ = function() {
+ this.removeClass("vjs-waiting"), this.trigger("canplaythrough")
+ }, i.handleTechPlaying_ = function() {
+ this.removeClass("vjs-waiting"), this.trigger("playing")
+ }, i.handleTechSeeking_ = function() {
+ this.addClass("vjs-seeking"), this.trigger("seeking")
+ }, i.handleTechSeeked_ = function() {
+ this.removeClass("vjs-seeking"), this.removeClass("vjs-ended"), this.trigger("seeked")
+ }, i.handleTechFirstPlay_ = function() {
+ this.options_.starttime && (K.warn("Passing the `starttime` option to the player will be deprecated in 6.0"), this.currentTime(this.options_.starttime)), this.addClass("vjs-has-started"), this.trigger("firstplay")
+ }, i.handleTechPause_ = function() {
+ this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.trigger("pause")
+ }, i.handleTechEnded_ = function() {
+ this.addClass("vjs-ended"), this.removeClass("vjs-waiting"), this.options_.loop ? (this.currentTime(0), this.play()) : this.paused() || this.pause(), this.trigger("ended")
+ }, i.handleTechDurationChange_ = function() {
+ this.duration(this.techGet_("duration"))
+ }, i.handleTechClick_ = function(e) {
+ this.controls_ && (this.paused() ? ii(this.play()) : this.pause())
+ }, i.handleTechDoubleClick_ = function(e) {
+ this.controls_ && (Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), (function(t) {
+ return t.contains(e.target)
+ })) || void 0 !== this.options_ && void 0 !== this.options_.userActions && void 0 !== this.options_.userActions.doubleClick && !1 === this.options_.userActions.doubleClick || (void 0 !== this.options_ && void 0 !== this.options_.userActions && "function" == typeof this.options_.userActions.doubleClick ? this.options_.userActions.doubleClick.call(this, e) : this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen()))
+ }, i.handleTechTap_ = function() {
+ this.userActive(!this.userActive())
+ }, i.handleTechTouchStart_ = function() {
+ this.userWasActive = this.userActive()
+ }, i.handleTechTouchMove_ = function() {
+ this.userWasActive && this.reportUserActivity()
+ }, i.handleTechTouchEnd_ = function(e) {
+ e.cancelable && e.preventDefault()
+ }, i.handleStageClick_ = function() {
+ this.reportUserActivity()
+ }, i.toggleFullscreenClass_ = function() {
+ this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen")
+ }, i.documentFullscreenChange_ = function(e) {
+ var t = e.target.player;
+ if (!t || t === this) {
+ var i = this.el(),
+ n = k.default[this.fsApi_.fullscreenElement] === i;
+ !n && i.matches ? n = i.matches(":" + this.fsApi_.fullscreen) : !n && i.msMatchesSelector && (n = i.msMatchesSelector(":" + this.fsApi_.fullscreen)), this.isFullscreen(n)
+ }
+ }, i.handleTechFullscreenChange_ = function(e, t) {
+ t && (t.nativeIOSFullscreen && this.toggleClass("vjs-ios-native-fs"), this.isFullscreen(t.isFullscreen))
+ }, i.handleTechFullscreenError_ = function(e, t) {
+ this.trigger("fullscreenerror", t)
+ }, i.togglePictureInPictureClass_ = function() {
+ this.isInPictureInPicture() ? this.addClass("vjs-picture-in-picture") : this.removeClass("vjs-picture-in-picture")
+ }, i.handleTechEnterPictureInPicture_ = function(e) {
+ this.isInPictureInPicture(!0)
+ }, i.handleTechLeavePictureInPicture_ = function(e) {
+ this.isInPictureInPicture(!1)
+ }, i.handleTechError_ = function() {
+ var e = this.tech_.error();
+ this.error(e)
+ }, i.handleTechTextData_ = function() {
+ var e = null;
+ arguments.length > 1 && (e = arguments[1]), this.trigger("textdata", e)
+ }, i.getCache = function() {
+ return this.cache_
+ }, i.resetCache_ = function() {
+ this.cache_ = {
+ currentTime: 0,
+ initTime: 0,
+ inactivityTimeout: this.options_.inactivityTimeout,
+ duration: NaN,
+ lastVolume: 1,
+ lastPlaybackRate: this.defaultPlaybackRate(),
+ media: null,
+ src: "",
+ source: {},
+ sources: [],
+ playbackRates: [],
+ volume: 1
+ }
+ }, i.techCall_ = function(e, t) {
+ this.ready((function() {
+ if (e in Hi) return function(e, t, i, n) {
+ return t[i](e.reduce(Gi(i), n))
+ }(this.middleware_, this.tech_, e, t);
+ if (e in zi) return ji(this.middleware_, this.tech_, e, t);
+ try {
+ this.tech_ && this.tech_[e](t)
+ } catch (e) {
+ throw K(e), e
+ }
+ }), !0)
+ }, i.techGet_ = function(e) {
+ if (this.tech_ && this.tech_.isReady_) {
+ if (e in Vi) return function(e, t, i) {
+ return e.reduceRight(Gi(i), t[i]())
+ }(this.middleware_, this.tech_, e);
+ if (e in zi) return ji(this.middleware_, this.tech_, e);
+ try {
+ return this.tech_[e]()
+ } catch (t) {
+ if (void 0 === this.tech_[e]) throw K("Video.js: " + e + " method not defined for " + this.techName_ + " playback technology.", t), t;
+ if ("TypeError" === t.name) throw K("Video.js: " + e + " unavailable on " + this.techName_ + " playback technology element.", t), this.tech_.isReady_ = !1, t;
+ throw K(t), t
+ }
+ }
+ }, i.play = function() {
+ var e = this,
+ t = this.options_.Promise || C.default.Promise;
+ return t ? new t((function(t) {
+ e.play_(t)
+ })) : this.play_()
+ }, i.play_ = function(e) {
+ var t = this;
+ void 0 === e && (e = ii), this.playCallbacks_.push(e);
+ var i = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
+ if (this.waitToPlay_ && (this.off(["ready", "loadstart"], this.waitToPlay_), this.waitToPlay_ = null), !this.isReady_ || !i) return this.waitToPlay_ = function(e) {
+ t.play_()
+ }, this.one(["ready", "loadstart"], this.waitToPlay_), void(i || !Ee && !Te || this.load());
+ var n = this.techGet_("play");
+ null === n ? this.runPlayTerminatedQueue_() : this.runPlayCallbacks_(n)
+ }, i.runPlayTerminatedQueue_ = function() {
+ var e = this.playTerminatedQueue_.slice(0);
+ this.playTerminatedQueue_ = [], e.forEach((function(e) {
+ e()
+ }))
+ }, i.runPlayCallbacks_ = function(e) {
+ var t = this.playCallbacks_.slice(0);
+ this.playCallbacks_ = [], this.playTerminatedQueue_ = [], t.forEach((function(t) {
+ t(e)
+ }))
+ }, i.pause = function() {
+ this.techCall_("pause")
+ }, i.paused = function() {
+ return !1 !== this.techGet_("paused")
+ }, i.played = function() {
+ return this.techGet_("played") || $t(0, 0)
+ }, i.scrubbing = function(e) {
+ if (void 0 === e) return this.scrubbing_;
+ this.scrubbing_ = !!e, this.techCall_("setScrubbing", this.scrubbing_), e ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing")
+ }, i.currentTime = function(e) {
+ return void 0 !== e ? (e < 0 && (e = 0), this.isReady_ && !this.changingSrc_ && this.tech_ && this.tech_.isReady_ ? (this.techCall_("setCurrentTime", e), void(this.cache_.initTime = 0)) : (this.cache_.initTime = e, this.off("canplay", this.boundApplyInitTime_), void this.one("canplay", this.boundApplyInitTime_))) : (this.cache_.currentTime = this.techGet_("currentTime") || 0, this.cache_.currentTime)
+ }, i.applyInitTime_ = function() {
+ this.currentTime(this.cache_.initTime)
+ }, i.duration = function(e) {
+ if (void 0 === e) return void 0 !== this.cache_.duration ? this.cache_.duration : NaN;
+ (e = parseFloat(e)) < 0 && (e = 1 / 0), e !== this.cache_.duration && (this.cache_.duration = e, e === 1 / 0 ? this.addClass("vjs-live") : this.removeClass("vjs-live"), isNaN(e) || this.trigger("durationchange"))
+ }, i.remainingTime = function() {
+ return this.duration() - this.currentTime()
+ }, i.remainingTimeDisplay = function() {
+ return Math.floor(this.duration()) - Math.floor(this.currentTime())
+ }, i.buffered = function() {
+ var e = this.techGet_("buffered");
+ return e && e.length || (e = $t(0, 0)), e
+ }, i.bufferedPercent = function() {
+ return Jt(this.buffered(), this.duration())
+ }, i.bufferedEnd = function() {
+ var e = this.buffered(),
+ t = this.duration(),
+ i = e.end(e.length - 1);
+ return i > t && (i = t), i
+ }, i.volume = function(e) {
+ var t;
+ return void 0 !== e ? (t = Math.max(0, Math.min(1, parseFloat(e))), this.cache_.volume = t, this.techCall_("setVolume", t), void(t > 0 && this.lastVolume_(t))) : (t = parseFloat(this.techGet_("volume")), isNaN(t) ? 1 : t)
+ }, i.muted = function(e) {
+ if (void 0 === e) return this.techGet_("muted") || !1;
+ this.techCall_("setMuted", e)
+ }, i.defaultMuted = function(e) {
+ return void 0 !== e ? this.techCall_("setDefaultMuted", e) : this.techGet_("defaultMuted") || !1
+ }, i.lastVolume_ = function(e) {
+ if (void 0 === e || 0 === e) return this.cache_.lastVolume;
+ this.cache_.lastVolume = e
+ }, i.supportsFullScreen = function() {
+ return this.techGet_("supportsFullScreen") || !1
+ }, i.isFullscreen = function(e) {
+ if (void 0 !== e) {
+ var t = this.isFullscreen_;
+ return this.isFullscreen_ = Boolean(e), this.isFullscreen_ !== t && this.fsApi_.prefixed && this.trigger("fullscreenchange"), void this.toggleFullscreenClass_()
+ }
+ return this.isFullscreen_
+ }, i.requestFullscreen = function(e) {
+ var t = this.options_.Promise || C.default.Promise;
+ if (t) {
+ var i = this;
+ return new t((function(t, n) {
+ function r() {
+ i.off("fullscreenerror", s), i.off("fullscreenchange", a)
+ }
+
+ function a() {
+ r(), t()
+ }
+
+ function s(e, t) {
+ r(), n(t)
+ }
+ i.one("fullscreenchange", a), i.one("fullscreenerror", s);
+ var o = i.requestFullscreenHelper_(e);
+ o && (o.then(r, r), o.then(t, n))
+ }))
+ }
+ return this.requestFullscreenHelper_()
+ }, i.requestFullscreenHelper_ = function(e) {
+ var t, i = this;
+ if (this.fsApi_.prefixed || (t = this.options_.fullscreen && this.options_.fullscreen.options || {}, void 0 !== e && (t = e)), this.fsApi_.requestFullscreen) {
+ var n = this.el_[this.fsApi_.requestFullscreen](t);
+ return n && n.then((function() {
+ return i.isFullscreen(!0)
+ }), (function() {
+ return i.isFullscreen(!1)
+ })), n
+ }
+ this.tech_.supportsFullScreen() && !0 == !this.options_.preferFullWindow ? this.techCall_("enterFullScreen") : this.enterFullWindow()
+ }, i.exitFullscreen = function() {
+ var e = this.options_.Promise || C.default.Promise;
+ if (e) {
+ var t = this;
+ return new e((function(e, i) {
+ function n() {
+ t.off("fullscreenerror", a), t.off("fullscreenchange", r)
+ }
+
+ function r() {
+ n(), e()
+ }
+
+ function a(e, t) {
+ n(), i(t)
+ }
+ t.one("fullscreenchange", r), t.one("fullscreenerror", a);
+ var s = t.exitFullscreenHelper_();
+ s && (s.then(n, n), s.then(e, i))
+ }))
+ }
+ return this.exitFullscreenHelper_()
+ }, i.exitFullscreenHelper_ = function() {
+ var e = this;
+ if (this.fsApi_.requestFullscreen) {
+ var t = k.default[this.fsApi_.exitFullscreen]();
+ return t && ii(t.then((function() {
+ return e.isFullscreen(!1)
+ }))), t
+ }
+ this.tech_.supportsFullScreen() && !0 == !this.options_.preferFullWindow ? this.techCall_("exitFullScreen") : this.exitFullWindow()
+ }, i.enterFullWindow = function() {
+ this.isFullscreen(!0), this.isFullWindow = !0, this.docOrigOverflow = k.default.documentElement.style.overflow, yt(k.default, "keydown", this.boundFullWindowOnEscKey_), k.default.documentElement.style.overflow = "hidden", Ue(k.default.body, "vjs-full-window"), this.trigger("enterFullWindow")
+ }, i.fullWindowOnEscKey = function(e) {
+ R.default.isEventKey(e, "Esc") && !0 === this.isFullscreen() && (this.isFullWindow ? this.exitFullWindow() : this.exitFullscreen())
+ }, i.exitFullWindow = function() {
+ this.isFullscreen(!1), this.isFullWindow = !1, bt(k.default, "keydown", this.boundFullWindowOnEscKey_), k.default.documentElement.style.overflow = this.docOrigOverflow, Me(k.default.body, "vjs-full-window"), this.trigger("exitFullWindow")
+ }, i.disablePictureInPicture = function(e) {
+ if (void 0 === e) return this.techGet_("disablePictureInPicture");
+ this.techCall_("setDisablePictureInPicture", e), this.options_.disablePictureInPicture = e, this.trigger("disablepictureinpicturechanged")
+ }, i.isInPictureInPicture = function(e) {
+ return void 0 !== e ? (this.isInPictureInPicture_ = !!e, void this.togglePictureInPictureClass_()) : !!this.isInPictureInPicture_
+ }, i.requestPictureInPicture = function() {
+ if ("pictureInPictureEnabled" in k.default && !1 === this.disablePictureInPicture()) return this.techGet_("requestPictureInPicture")
+ }, i.exitPictureInPicture = function() {
+ if ("pictureInPictureEnabled" in k.default) return k.default.exitPictureInPicture()
+ }, i.handleKeyDown = function(e) {
+ var t = this.options_.userActions;
+ if (t && t.hotkeys) {
+ (function(e) {
+ var t = e.tagName.toLowerCase();
+ if (e.isContentEditable) return !0;
+ if ("input" === t) return -1 === ["button", "checkbox", "hidden", "radio", "reset", "submit"].indexOf(e.type);
+ return -1 !== ["textarea"].indexOf(t)
+ })(this.el_.ownerDocument.activeElement) || ("function" == typeof t.hotkeys ? t.hotkeys.call(this, e) : this.handleHotkeys(e))
+ }
+ }, i.handleHotkeys = function(e) {
+ var t = this.options_.userActions ? this.options_.userActions.hotkeys : {},
+ i = t.fullscreenKey,
+ n = void 0 === i ? function(e) {
+ return R.default.isEventKey(e, "f")
+ } : i,
+ r = t.muteKey,
+ a = void 0 === r ? function(e) {
+ return R.default.isEventKey(e, "m")
+ } : r,
+ s = t.playPauseKey,
+ o = void 0 === s ? function(e) {
+ return R.default.isEventKey(e, "k") || R.default.isEventKey(e, "Space")
+ } : s;
+ if (n.call(this, e)) {
+ e.preventDefault(), e.stopPropagation();
+ var u = Kt.getComponent("FullscreenToggle");
+ !1 !== k.default[this.fsApi_.fullscreenEnabled] && u.prototype.handleClick.call(this, e)
+ } else if (a.call(this, e)) {
+ e.preventDefault(), e.stopPropagation(), Kt.getComponent("MuteToggle").prototype.handleClick.call(this, e)
+ } else if (o.call(this, e)) {
+ e.preventDefault(), e.stopPropagation(), Kt.getComponent("PlayToggle").prototype.handleClick.call(this, e)
+ }
+ }, i.canPlayType = function(e) {
+ for (var t, i = 0, n = this.options_.techOrder; i < n.length; i++) {
+ var r = n[i],
+ a = Ui.getTech(r);
+ if (a || (a = Kt.getComponent(r)), a) {
+ if (a.isSupported() && (t = a.canPlayType(e))) return t
+ } else K.error('The "' + r + '" tech is undefined. Skipped browser support check for that tech.')
+ }
+ return ""
+ }, i.selectSource = function(e) {
+ var t, i = this,
+ n = this.options_.techOrder.map((function(e) {
+ return [e, Ui.getTech(e)]
+ })).filter((function(e) {
+ var t = e[0],
+ i = e[1];
+ return i ? i.isSupported() : (K.error('The "' + t + '" tech is undefined. Skipped browser support check for that tech.'), !1)
+ })),
+ r = function(e, t, i) {
+ var n;
+ return e.some((function(e) {
+ return t.some((function(t) {
+ if (n = i(e, t)) return !0
+ }))
+ })), n
+ },
+ a = function(e, t) {
+ var n = e[0];
+ if (e[1].canPlaySource(t, i.options_[n.toLowerCase()])) return {
+ source: t,
+ tech: n
+ }
+ };
+ return (this.options_.sourceOrder ? r(e, n, (t = a, function(e, i) {
+ return t(i, e)
+ })) : r(n, e, a)) || !1
+ }, i.handleSrc_ = function(e, t) {
+ var i = this;
+ if (void 0 === e) return this.cache_.src || "";
+ this.resetRetryOnError_ && this.resetRetryOnError_();
+ var n = function e(t) {
+ if (Array.isArray(t)) {
+ var i = [];
+ t.forEach((function(t) {
+ t = e(t), Array.isArray(t) ? i = i.concat(t) : ee(t) && i.push(t)
+ })), t = i
+ } else t = "string" == typeof t && t.trim() ? [qi({
+ src: t
+ })] : ee(t) && "string" == typeof t.src && t.src && t.src.trim() ? [qi(t)] : [];
+ return t
+ }(e);
+ if (n.length) {
+ if (this.changingSrc_ = !0, t || (this.cache_.sources = n), this.updateSourceCaches_(n[0]), Ni(this, n[0], (function(e, r) {
+ var a, s;
+ if (i.middleware_ = r, t || (i.cache_.sources = n), i.updateSourceCaches_(e), i.src_(e)) return n.length > 1 ? i.handleSrc_(n.slice(1)) : (i.changingSrc_ = !1, i.setTimeout((function() {
+ this.error({
+ code: 4,
+ message: this.localize(this.options_.notSupportedMessage)
+ })
+ }), 0), void i.triggerReady());
+ a = r, s = i.tech_, a.forEach((function(e) {
+ return e.setTech && e.setTech(s)
+ }))
+ })), this.options_.retryOnError && n.length > 1) {
+ var r = function() {
+ i.error(null), i.handleSrc_(n.slice(1), !0)
+ },
+ a = function() {
+ i.off("error", r)
+ };
+ this.one("error", r), this.one("playing", a), this.resetRetryOnError_ = function() {
+ i.off("error", r), i.off("playing", a)
+ }
+ }
+ } else this.setTimeout((function() {
+ this.error({
+ code: 4,
+ message: this.localize(this.options_.notSupportedMessage)
+ })
+ }), 0)
+ }, i.src = function(e) {
+ return this.handleSrc_(e, !1)
+ }, i.src_ = function(e) {
+ var t, i, n = this,
+ r = this.selectSource([e]);
+ return !r || (t = r.tech, i = this.techName_, Ht(t) !== Ht(i) ? (this.changingSrc_ = !0, this.loadTech_(r.tech, r.source), this.tech_.ready((function() {
+ n.changingSrc_ = !1
+ })), !1) : (this.ready((function() {
+ this.tech_.constructor.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", e) : this.techCall_("src", e.src), this.changingSrc_ = !1
+ }), !0), !1))
+ }, i.load = function() {
+ this.techCall_("load")
+ }, i.reset = function() {
+ var e = this,
+ t = this.options_.Promise || C.default.Promise;
+ this.paused() || !t ? this.doReset_() : ii(this.play().then((function() {
+ return e.doReset_()
+ })))
+ }, i.doReset_ = function() {
+ this.tech_ && this.tech_.clearTracks("text"), this.resetCache_(), this.poster(""), this.loadTech_(this.options_.techOrder[0], null), this.techCall_("reset"), this.resetControlBarUI_(), Lt(this) && this.trigger("playerreset")
+ }, i.resetControlBarUI_ = function() {
+ this.resetProgressBar_(), this.resetPlaybackRate_(), this.resetVolumeBar_()
+ }, i.resetProgressBar_ = function() {
+ this.currentTime(0);
+ var e = this.controlBar,
+ t = e.durationDisplay,
+ i = e.remainingTimeDisplay;
+ t && t.updateContent(), i && i.updateContent()
+ }, i.resetPlaybackRate_ = function() {
+ this.playbackRate(this.defaultPlaybackRate()), this.handleTechRateChange_()
+ }, i.resetVolumeBar_ = function() {
+ this.volume(1), this.trigger("volumechange")
+ }, i.currentSources = function() {
+ var e = this.currentSource(),
+ t = [];
+ return 0 !== Object.keys(e).length && t.push(e), this.cache_.sources || t
+ }, i.currentSource = function() {
+ return this.cache_.source || {}
+ }, i.currentSrc = function() {
+ return this.currentSource() && this.currentSource().src || ""
+ }, i.currentType = function() {
+ return this.currentSource() && this.currentSource().type || ""
+ }, i.preload = function(e) {
+ return void 0 !== e ? (this.techCall_("setPreload", e), void(this.options_.preload = e)) : this.techGet_("preload")
+ }, i.autoplay = function(e) {
+ if (void 0 === e) return this.options_.autoplay || !1;
+ var t;
+ "string" == typeof e && /(any|play|muted)/.test(e) || !0 === e && this.options_.normalizeAutoplay ? (this.options_.autoplay = e, this.manualAutoplay_("string" == typeof e ? e : "play"), t = !1) : this.options_.autoplay = !!e, t = void 0 === t ? this.options_.autoplay : t, this.tech_ && this.techCall_("setAutoplay", t)
+ }, i.playsinline = function(e) {
+ return void 0 !== e ? (this.techCall_("setPlaysinline", e), this.options_.playsinline = e, this) : this.techGet_("playsinline")
+ }, i.loop = function(e) {
+ return void 0 !== e ? (this.techCall_("setLoop", e), void(this.options_.loop = e)) : this.techGet_("loop")
+ }, i.poster = function(e) {
+ if (void 0 === e) return this.poster_;
+ e || (e = ""), e !== this.poster_ && (this.poster_ = e, this.techCall_("setPoster", e), this.isPosterFromTech_ = !1, this.trigger("posterchange"))
+ }, i.handleTechPosterChange_ = function() {
+ if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
+ var e = this.tech_.poster() || "";
+ e !== this.poster_ && (this.poster_ = e, this.isPosterFromTech_ = !0, this.trigger("posterchange"))
+ }
+ }, i.controls = function(e) {
+ if (void 0 === e) return !!this.controls_;
+ e = !!e, this.controls_ !== e && (this.controls_ = e, this.usingNativeControls() && this.techCall_("setControls", e), this.controls_ ? (this.removeClass("vjs-controls-disabled"), this.addClass("vjs-controls-enabled"), this.trigger("controlsenabled"), this.usingNativeControls() || this.addTechControlsListeners_()) : (this.removeClass("vjs-controls-enabled"), this.addClass("vjs-controls-disabled"), this.trigger("controlsdisabled"), this.usingNativeControls() || this.removeTechControlsListeners_()))
+ }, i.usingNativeControls = function(e) {
+ if (void 0 === e) return !!this.usingNativeControls_;
+ e = !!e, this.usingNativeControls_ !== e && (this.usingNativeControls_ = e, this.usingNativeControls_ ? (this.addClass("vjs-using-native-controls"), this.trigger("usingnativecontrols")) : (this.removeClass("vjs-using-native-controls"), this.trigger("usingcustomcontrols")))
+ }, i.error = function(e) {
+ var t = this;
+ if (void 0 === e) return this.error_ || null;
+ if (j("beforeerror").forEach((function(i) {
+ var n = i(t, e);
+ ee(n) && !Array.isArray(n) || "string" == typeof n || "number" == typeof n || null === n ? e = n : t.log.error("please return a value that MediaError expects in beforeerror hooks")
+ })), this.options_.suppressNotSupportedError && e && 4 === e.code) {
+ var i = function() {
+ this.error(e)
+ };
+ return this.options_.suppressNotSupportedError = !1, this.any(["click", "touchstart"], i), void this.one("loadstart", (function() {
+ this.off(["click", "touchstart"], i)
+ }))
+ }
+ if (null === e) return this.error_ = e, this.removeClass("vjs-error"), void(this.errorDisplay && this.errorDisplay.close());
+ this.error_ = new Zt(e), this.addClass("vjs-error"), K.error("(CODE:" + this.error_.code + " " + Zt.errorTypes[this.error_.code] + ")", this.error_.message, this.error_), this.trigger("error"), j("error").forEach((function(e) {
+ return e(t, t.error_)
+ }))
+ }, i.reportUserActivity = function(e) {
+ this.userActivity_ = !0
+ }, i.userActive = function(e) {
+ if (void 0 === e) return this.userActive_;
+ if ((e = !!e) !== this.userActive_) {
+ if (this.userActive_ = e, this.userActive_) return this.userActivity_ = !0, this.removeClass("vjs-user-inactive"), this.addClass("vjs-user-active"), void this.trigger("useractive");
+ this.tech_ && this.tech_.one("mousemove", (function(e) {
+ e.stopPropagation(), e.preventDefault()
+ })), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive")
+ }
+ }, i.listenForUserActivity_ = function() {
+ var e, t, i, n = Ct(this, this.reportUserActivity),
+ r = function(t) {
+ n(), this.clearInterval(e)
+ };
+ this.on("mousedown", (function() {
+ n(), this.clearInterval(e), e = this.setInterval(n, 250)
+ })), this.on("mousemove", (function(e) {
+ e.screenX === t && e.screenY === i || (t = e.screenX, i = e.screenY, n())
+ })), this.on("mouseup", r), this.on("mouseleave", r);
+ var a, s = this.getChild("controlBar");
+ !s || Te || le || (s.on("mouseenter", (function(e) {
+ 0 !== this.player().options_.inactivityTimeout && (this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout), this.player().options_.inactivityTimeout = 0
+ })), s.on("mouseleave", (function(e) {
+ this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout
+ }))), this.on("keydown", n), this.on("keyup", n), this.setInterval((function() {
+ if (this.userActivity_) {
+ this.userActivity_ = !1, this.userActive(!0), this.clearTimeout(a);
+ var e = this.options_.inactivityTimeout;
+ e <= 0 || (a = this.setTimeout((function() {
+ this.userActivity_ || this.userActive(!1)
+ }), e))
+ }
+ }), 250)
+ }, i.playbackRate = function(e) {
+ if (void 0 === e) return this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : 1;
+ this.techCall_("setPlaybackRate", e)
+ }, i.defaultPlaybackRate = function(e) {
+ return void 0 !== e ? this.techCall_("setDefaultPlaybackRate", e) : this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1
+ }, i.isAudio = function(e) {
+ if (void 0 === e) return !!this.isAudio_;
+ this.isAudio_ = !!e
+ }, i.addTextTrack = function(e, t, i) {
+ if (this.tech_) return this.tech_.addTextTrack(e, t, i)
+ }, i.addRemoteTextTrack = function(e, t) {
+ if (this.tech_) return this.tech_.addRemoteTextTrack(e, t)
+ }, i.removeRemoteTextTrack = function(e) {
+ void 0 === e && (e = {});
+ var t = e.track;
+ if (t || (t = e), this.tech_) return this.tech_.removeRemoteTextTrack(t)
+ }, i.getVideoPlaybackQuality = function() {
+ return this.techGet_("getVideoPlaybackQuality")
+ }, i.videoWidth = function() {
+ return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0
+ }, i.videoHeight = function() {
+ return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0
+ }, i.language = function(e) {
+ if (void 0 === e) return this.language_;
+ this.language_ !== String(e).toLowerCase() && (this.language_ = String(e).toLowerCase(), Lt(this) && this.trigger("languagechange"))
+ }, i.languages = function() {
+ return zt(t.prototype.options_.languages, this.languages_)
+ }, i.toJSON = function() {
+ var e = zt(this.options_),
+ t = e.tracks;
+ e.tracks = [];
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ (n = zt(n)).player = void 0, e.tracks[i] = n
+ }
+ return e
+ }, i.createModal = function(e, t) {
+ var i = this;
+ (t = t || {}).content = e || "";
+ var n = new si(this, t);
+ return this.addChild(n), n.on("dispose", (function() {
+ i.removeChild(n)
+ })), n.open(), n
+ }, i.updateCurrentBreakpoint_ = function() {
+ if (this.responsive())
+ for (var e = this.currentBreakpoint(), t = this.currentWidth(), i = 0; i < Dr.length; i++) {
+ var n = Dr[i];
+ if (t <= this.breakpoints_[n]) {
+ if (e === n) return;
+ e && this.removeClass(Or[e]), this.addClass(Or[n]), this.breakpoint_ = n;
+ break
+ }
+ }
+ }, i.removeCurrentBreakpoint_ = function() {
+ var e = this.currentBreakpointClass();
+ this.breakpoint_ = "", e && this.removeClass(e)
+ }, i.breakpoints = function(e) {
+ return void 0 === e || (this.breakpoint_ = "", this.breakpoints_ = Z({}, Ur, e), this.updateCurrentBreakpoint_()), Z(this.breakpoints_)
+ }, i.responsive = function(e) {
+ return void 0 === e ? this.responsive_ : (e = Boolean(e)) !== this.responsive_ ? (this.responsive_ = e, e ? (this.on("playerresize", this.boundUpdateCurrentBreakpoint_), this.updateCurrentBreakpoint_()) : (this.off("playerresize", this.boundUpdateCurrentBreakpoint_), this.removeCurrentBreakpoint_()), e) : void 0
+ }, i.currentBreakpoint = function() {
+ return this.breakpoint_
+ }, i.currentBreakpointClass = function() {
+ return Or[this.breakpoint_] || ""
+ }, i.loadMedia = function(e, t) {
+ var i = this;
+ if (e && "object" == typeof e) {
+ this.reset(), this.cache_.media = zt(e);
+ var n = this.cache_.media,
+ r = n.artwork,
+ a = n.poster,
+ s = n.src,
+ o = n.textTracks;
+ !r && a && (this.cache_.media.artwork = [{
+ src: a,
+ type: Yi(a)
+ }]), s && this.src(s), a && this.poster(a), Array.isArray(o) && o.forEach((function(e) {
+ return i.addRemoteTextTrack(e, !1)
+ })), this.ready(t)
+ }
+ }, i.getMedia = function() {
+ if (!this.cache_.media) {
+ var e = this.poster(),
+ t = {
+ src: this.currentSources(),
+ textTracks: Array.prototype.map.call(this.remoteTextTracks(), (function(e) {
+ return {
+ kind: e.kind,
+ label: e.label,
+ language: e.language,
+ src: e.src
+ }
+ }))
+ };
+ return e && (t.poster = e, t.artwork = [{
+ src: t.poster,
+ type: Yi(t.poster)
+ }]), t
+ }
+ return zt(this.cache_.media)
+ }, t.getTagSettings = function(e) {
+ var t = {
+ sources: [],
+ tracks: []
+ },
+ i = Ne(e),
+ n = i["data-setup"];
+ if (Oe(e, "vjs-fill") && (i.fill = !0), Oe(e, "vjs-fluid") && (i.fluid = !0), null !== n) {
+ var r = x.default(n || "{}"),
+ a = r[0],
+ s = r[1];
+ a && K.error(a), Z(i, s)
+ }
+ if (Z(t, i), e.hasChildNodes())
+ for (var o = e.childNodes, u = 0, l = o.length; u < l; u++) {
+ var h = o[u],
+ d = h.nodeName.toLowerCase();
+ "source" === d ? t.sources.push(Ne(h)) : "track" === d && t.tracks.push(Ne(h))
+ }
+ return t
+ }, i.flexNotSupported_ = function() {
+ var e = k.default.createElement("i");
+ return !("flexBasis" in e.style || "webkitFlexBasis" in e.style || "mozFlexBasis" in e.style || "msFlexBasis" in e.style || "msFlexOrder" in e.style)
+ }, i.debug = function(e) {
+ if (void 0 === e) return this.debugEnabled_;
+ e ? (this.trigger("debugon"), this.previousLogLevel_ = this.log.level, this.log.level("debug"), this.debugEnabled_ = !0) : (this.trigger("debugoff"), this.log.level(this.previousLogLevel_), this.previousLogLevel_ = void 0, this.debugEnabled_ = !1)
+ }, i.playbackRates = function(e) {
+ if (void 0 === e) return this.cache_.playbackRates;
+ Array.isArray(e) && e.every((function(e) {
+ return "number" == typeof e
+ })) && (this.cache_.playbackRates = e, this.trigger("playbackrateschange"))
+ }, t
+ }(Kt);
+ Oi.names.forEach((function(e) {
+ var t = Oi[e];
+ Mr.prototype[t.getterName] = function() {
+ return this.tech_ ? this.tech_[t.getterName]() : (this[t.privateName] = this[t.privateName] || new t.ListClass, this[t.privateName])
+ }
+ })), Mr.prototype.crossorigin = Mr.prototype.crossOrigin, Mr.players = {};
+ var Fr = C.default.navigator;
+ Mr.prototype.options_ = {
+ techOrder: Ui.defaultTechOrder_,
+ html5: {},
+ inactivityTimeout: 2e3,
+ playbackRates: [],
+ liveui: !1,
+ children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
+ language: Fr && (Fr.languages && Fr.languages[0] || Fr.userLanguage || Fr.language) || "en",
+ languages: {},
+ notSupportedMessage: "No compatible source was found for this media.",
+ normalizeAutoplay: !1,
+ fullscreen: {
+ options: {
+ navigationUI: "hide"
+ }
+ },
+ breakpoints: {},
+ responsive: !1
+ }, ["ended", "seeking", "seekable", "networkState", "readyState"].forEach((function(e) {
+ Mr.prototype[e] = function() {
+ return this.techGet_(e)
+ }
+ })), xr.forEach((function(e) {
+ Mr.prototype["handleTech" + Ht(e) + "_"] = function() {
+ return this.trigger(e)
+ }
+ })), Kt.registerComponent("Player", Mr);
+ var Br = {},
+ Nr = function(e) {
+ return Br.hasOwnProperty(e)
+ },
+ jr = function(e) {
+ return Nr(e) ? Br[e] : void 0
+ },
+ Vr = function(e, t) {
+ e.activePlugins_ = e.activePlugins_ || {}, e.activePlugins_[t] = !0
+ },
+ Hr = function(e, t, i) {
+ var n = (i ? "before" : "") + "pluginsetup";
+ e.trigger(n, t), e.trigger(n + ":" + t.name, t)
+ },
+ zr = function(e, t) {
+ return t.prototype.name = e,
+ function() {
+ Hr(this, {
+ name: e,
+ plugin: t,
+ instance: null
+ }, !0);
+ for (var i = arguments.length, n = new Array(i), r = 0; r < i; r++) n[r] = arguments[r];
+ var a = U.default(t, [this].concat(n));
+ return this[e] = function() {
+ return a
+ }, Hr(this, a.getEventHash()), a
+ }
+ },
+ Gr = function() {
+ function e(t) {
+ if (this.constructor === e) throw new Error("Plugin must be sub-classed; not directly instantiated.");
+ this.player = t, this.log || (this.log = this.player.log.createLogger(this.name)), Bt(this), delete this.trigger, jt(this, this.constructor.defaultState), Vr(t, this.name), this.dispose = this.dispose.bind(this), t.on("dispose", this.dispose)
+ }
+ var t = e.prototype;
+ return t.version = function() {
+ return this.constructor.VERSION
+ }, t.getEventHash = function(e) {
+ return void 0 === e && (e = {}), e.name = this.name, e.plugin = this.constructor, e.instance = this, e
+ }, t.trigger = function(e, t) {
+ return void 0 === t && (t = {}), St(this.eventBusEl_, e, this.getEventHash(t))
+ }, t.handleStateChanged = function(e) {}, t.dispose = function() {
+ var e = this.name,
+ t = this.player;
+ this.trigger("dispose"), this.off(), t.off("dispose", this.dispose), t.activePlugins_[e] = !1, this.player = this.state = null, t[e] = zr(e, Br[e])
+ }, e.isBasic = function(t) {
+ var i = "string" == typeof t ? jr(t) : t;
+ return "function" == typeof i && !e.prototype.isPrototypeOf(i.prototype)
+ }, e.registerPlugin = function(t, i) {
+ if ("string" != typeof t) throw new Error('Illegal plugin name, "' + t + '", must be a string, was ' + typeof t + ".");
+ if (Nr(t)) K.warn('A plugin named "' + t + '" already exists. You may want to avoid re-registering plugins!');
+ else if (Mr.prototype.hasOwnProperty(t)) throw new Error('Illegal plugin name, "' + t + '", cannot share a name with an existing player method!');
+ if ("function" != typeof i) throw new Error('Illegal plugin for "' + t + '", must be a function, was ' + typeof i + ".");
+ return Br[t] = i, "plugin" !== t && (e.isBasic(i) ? Mr.prototype[t] = function(e, t) {
+ var i = function() {
+ Hr(this, {
+ name: e,
+ plugin: t,
+ instance: null
+ }, !0);
+ var i = t.apply(this, arguments);
+ return Vr(this, e), Hr(this, {
+ name: e,
+ plugin: t,
+ instance: i
+ }), i
+ };
+ return Object.keys(t).forEach((function(e) {
+ i[e] = t[e]
+ })), i
+ }(t, i) : Mr.prototype[t] = zr(t, i)), i
+ }, e.deregisterPlugin = function(e) {
+ if ("plugin" === e) throw new Error("Cannot de-register base plugin.");
+ Nr(e) && (delete Br[e], delete Mr.prototype[e])
+ }, e.getPlugins = function(e) {
+ var t;
+ return void 0 === e && (e = Object.keys(Br)), e.forEach((function(e) {
+ var i = jr(e);
+ i && ((t = t || {})[e] = i)
+ })), t
+ }, e.getPluginVersion = function(e) {
+ var t = jr(e);
+ return t && t.VERSION || ""
+ }, e
+ }();
+ Gr.getPlugin = jr, Gr.BASE_PLUGIN_NAME = "plugin", Gr.registerPlugin("plugin", Gr), Mr.prototype.usingPlugin = function(e) {
+ return !!this.activePlugins_ && !0 === this.activePlugins_[e]
+ }, Mr.prototype.hasPlugin = function(e) {
+ return !!Nr(e)
+ };
+ var Wr = function(e) {
+ return 0 === e.indexOf("#") ? e.slice(1) : e
+ };
+
+ function Yr(e, t, i) {
+ var n = Yr.getPlayer(e);
+ if (n) return t && K.warn('Player "' + e + '" is already initialised. Options will not be applied.'), i && n.ready(i), n;
+ var r = "string" == typeof e ? tt("#" + Wr(e)) : e;
+ if (!Pe(r)) throw new TypeError("The element or ID supplied is not valid. (videojs)");
+ r.ownerDocument.defaultView && r.ownerDocument.body.contains(r) || K.warn("The element supplied is not included in the DOM"), t = t || {}, j("beforesetup").forEach((function(e) {
+ var i = e(r, zt(t));
+ ee(i) && !Array.isArray(i) ? t = zt(t, i) : K.error("please return an object in beforesetup hooks")
+ }));
+ var a = Kt.getComponent("Player");
+ return n = new a(r, t, i), j("setup").forEach((function(e) {
+ return e(n)
+ })), n
+ }
+ if (Yr.hooks_ = N, Yr.hooks = j, Yr.hook = function(e, t) {
+ j(e, t)
+ }, Yr.hookOnce = function(e, t) {
+ j(e, [].concat(t).map((function(t) {
+ return function i() {
+ return V(e, i), t.apply(void 0, arguments)
+ }
+ })))
+ }, Yr.removeHook = V, !0 !== C.default.VIDEOJS_NO_DYNAMIC_STYLE && ke()) {
+ var qr = tt(".vjs-styles-defaults");
+ if (!qr) {
+ qr = lt("vjs-styles-defaults");
+ var Kr = tt("head");
+ Kr && Kr.insertBefore(qr, Kr.firstChild), ht(qr, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")
+ }
+ }
+ st(1, Yr), Yr.VERSION = "7.15.4", Yr.options = Mr.prototype.options_, Yr.getPlayers = function() {
+ return Mr.players
+ }, Yr.getPlayer = function(e) {
+ var t, i = Mr.players;
+ if ("string" == typeof e) {
+ var n = Wr(e),
+ r = i[n];
+ if (r) return r;
+ t = tt("#" + n)
+ } else t = e;
+ if (Pe(t)) {
+ var a = t,
+ s = a.player,
+ o = a.playerId;
+ if (s || i[o]) return s || i[o]
+ }
+ }, Yr.getAllPlayers = function() {
+ return Object.keys(Mr.players).map((function(e) {
+ return Mr.players[e]
+ })).filter(Boolean)
+ }, Yr.players = Mr.players, Yr.getComponent = Kt.getComponent, Yr.registerComponent = function(e, t) {
+ Ui.isTech(t) && K.warn("The " + e + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"), Kt.registerComponent.call(Kt, e, t)
+ }, Yr.getTech = Ui.getTech, Yr.registerTech = Ui.registerTech, Yr.use = function(e, t) {
+ Mi[e] = Mi[e] || [], Mi[e].push(t)
+ }, Object.defineProperty(Yr, "middleware", {
+ value: {},
+ writeable: !1,
+ enumerable: !0
+ }), Object.defineProperty(Yr.middleware, "TERMINATOR", {
+ value: Bi,
+ writeable: !1,
+ enumerable: !0
+ }), Yr.browser = we, Yr.TOUCH_ENABLED = ye, Yr.extend = function(e, t) {
+ void 0 === t && (t = {});
+ var i = function() {
+ e.apply(this, arguments)
+ },
+ n = {};
+ for (var r in "object" == typeof t ? (t.constructor !== Object.prototype.constructor && (i = t.constructor), n = t) : "function" == typeof t && (i = t), M.default(i, e), e && (i.super_ = e), n) n.hasOwnProperty(r) && (i.prototype[r] = n[r]);
+ return i
+ }, Yr.mergeOptions = zt, Yr.bind = Ct, Yr.registerPlugin = Gr.registerPlugin, Yr.deregisterPlugin = Gr.deregisterPlugin, Yr.plugin = function(e, t) {
+ return K.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"), Gr.registerPlugin(e, t)
+ }, Yr.getPlugins = Gr.getPlugins, Yr.getPlugin = Gr.getPlugin, Yr.getPluginVersion = Gr.getPluginVersion, Yr.addLanguage = function(e, t) {
+ var i;
+ return e = ("" + e).toLowerCase(), Yr.options.languages = zt(Yr.options.languages, ((i = {})[e] = t, i)), Yr.options.languages[e]
+ }, Yr.log = K, Yr.createLogger = X, Yr.createTimeRange = Yr.createTimeRanges = $t, Yr.formatTime = ln, Yr.setFormatTime = function(e) {
+ un = e
+ }, Yr.resetFormatTime = function() {
+ un = on
+ }, Yr.parseUrl = Si, Yr.isCrossOrigin = wi, Yr.EventTarget = Pt, Yr.on = yt, Yr.one = Tt, Yr.off = bt, Yr.trigger = St, Yr.xhr = D.default, Yr.TextTrack = Pi, Yr.AudioTrack = Ii, Yr.VideoTrack = Li, ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach((function(e) {
+ Yr[e] = function() {
+ return K.warn("videojs." + e + "() is deprecated; use videojs.dom." + e + "() instead"), nt[e].apply(null, arguments)
+ }
+ })), Yr.computedStyle = ie, Yr.dom = nt, Yr.url = Ai, Yr.defineLazyProperty = Ir, Yr.addLanguage("en", {
+ "Non-Fullscreen": "Exit Fullscreen"
+ });
+ /*! @name @videojs/http-streaming @version 2.10.2 @license Apache-2.0 */
+ var Xr = F.default,
+ Qr = function(e, t, i) {
+ return e && i && i.responseURL && t !== i.responseURL ? i.responseURL : t
+ },
+ $r = function(e) {
+ return Yr.log.debug ? Yr.log.debug.bind(Yr, "VHS:", e + " >") : function() {}
+ },
+ Jr = function(e, t) {
+ var i, n = [];
+ if (e && e.length)
+ for (i = 0; i < e.length; i++) t(e.start(i), e.end(i)) && n.push([e.start(i), e.end(i)]);
+ return Yr.createTimeRanges(n)
+ },
+ Zr = function(e, t) {
+ return Jr(e, (function(e, i) {
+ return e - .1 <= t && i + .1 >= t
+ }))
+ },
+ ea = function(e, t) {
+ return Jr(e, (function(e) {
+ return e - 1 / 30 >= t
+ }))
+ },
+ ta = function(e) {
+ var t = [];
+ if (!e || !e.length) return "";
+ for (var i = 0; i < e.length; i++) t.push(e.start(i) + " => " + e.end(i));
+ return t.join(", ")
+ },
+ ia = function(e) {
+ for (var t = [], i = 0; i < e.length; i++) t.push({
+ start: e.start(i),
+ end: e.end(i)
+ });
+ return t
+ },
+ na = function(e) {
+ if (e && e.length && e.end) return e.end(e.length - 1)
+ },
+ ra = Yr.createTimeRange,
+ aa = function(e) {
+ return (e.segments || []).reduce((function(e, t, i) {
+ return t.parts ? t.parts.forEach((function(n, r) {
+ e.push({
+ duration: n.duration,
+ segmentIndex: i,
+ partIndex: r,
+ part: n,
+ segment: t
+ })
+ })) : e.push({
+ duration: t.duration,
+ segmentIndex: i,
+ partIndex: null,
+ segment: t,
+ part: null
+ }), e
+ }), [])
+ },
+ sa = function(e) {
+ var t = e.segments && e.segments.length && e.segments[e.segments.length - 1];
+ return t && t.parts || []
+ },
+ oa = function(e) {
+ var t = e.preloadSegment;
+ if (t) {
+ var i = t.parts,
+ n = (t.preloadHints || []).reduce((function(e, t) {
+ return e + ("PART" === t.type ? 1 : 0)
+ }), 0);
+ return n += i && i.length ? i.length : 0
+ }
+ },
+ ua = function(e, t) {
+ if (t.endList) return 0;
+ if (e && e.suggestedPresentationDelay) return e.suggestedPresentationDelay;
+ var i = sa(t).length > 0;
+ return i && t.serverControl && t.serverControl.partHoldBack ? t.serverControl.partHoldBack : i && t.partTargetDuration ? 3 * t.partTargetDuration : t.serverControl && t.serverControl.holdBack ? t.serverControl.holdBack : t.targetDuration ? 3 * t.targetDuration : 0
+ },
+ la = function(e, t, i) {
+ if (void 0 === t && (t = e.mediaSequence + e.segments.length), t < e.mediaSequence) return 0;
+ var n = function(e, t) {
+ var i = 0,
+ n = t - e.mediaSequence,
+ r = e.segments[n];
+ if (r) {
+ if (void 0 !== r.start) return {
+ result: r.start,
+ precise: !0
+ };
+ if (void 0 !== r.end) return {
+ result: r.end - r.duration,
+ precise: !0
+ }
+ }
+ for (; n--;) {
+ if (void 0 !== (r = e.segments[n]).end) return {
+ result: i + r.end,
+ precise: !0
+ };
+ if (i += r.duration, void 0 !== r.start) return {
+ result: i + r.start,
+ precise: !0
+ }
+ }
+ return {
+ result: i,
+ precise: !1
+ }
+ }(e, t);
+ if (n.precise) return n.result;
+ var r = function(e, t) {
+ for (var i, n = 0, r = t - e.mediaSequence; r < e.segments.length; r++) {
+ if (void 0 !== (i = e.segments[r]).start) return {
+ result: i.start - n,
+ precise: !0
+ };
+ if (n += i.duration, void 0 !== i.end) return {
+ result: i.end - n,
+ precise: !0
+ }
+ }
+ return {
+ result: -1,
+ precise: !1
+ }
+ }(e, t);
+ return r.precise ? r.result : n.result + i
+ },
+ ha = function(e, t, i) {
+ if (!e) return 0;
+ if ("number" != typeof i && (i = 0), void 0 === t) {
+ if (e.totalDuration) return e.totalDuration;
+ if (!e.endList) return C.default.Infinity
+ }
+ return la(e, t, i)
+ },
+ da = function(e) {
+ var t = e.defaultDuration,
+ i = e.durationList,
+ n = e.startIndex,
+ r = e.endIndex,
+ a = 0;
+ if (n > r) {
+ var s = [r, n];
+ n = s[0], r = s[1]
+ }
+ if (n < 0) {
+ for (var o = n; o < Math.min(0, r); o++) a += t;
+ n = 0
+ }
+ for (var u = n; u < r; u++) a += i[u].duration;
+ return a
+ },
+ ca = function(e, t, i, n) {
+ if (!e || !e.segments) return null;
+ if (e.endList) return ha(e);
+ if (null === t) return null;
+ t = t || 0;
+ var r = la(e, e.mediaSequence + e.segments.length, t);
+ return i && (r -= n = "number" == typeof n ? n : ua(null, e)), Math.max(0, r)
+ },
+ fa = function(e) {
+ return e.excludeUntil && e.excludeUntil > Date.now()
+ },
+ pa = function(e) {
+ return e.excludeUntil && e.excludeUntil === 1 / 0
+ },
+ ma = function(e) {
+ var t = fa(e);
+ return !e.disabled && !t
+ },
+ _a = function(e, t) {
+ return t.attributes && t.attributes[e]
+ },
+ ga = function(e, t) {
+ if (1 === e.playlists.length) return !0;
+ var i = t.attributes.BANDWIDTH || Number.MAX_VALUE;
+ return 0 === e.playlists.filter((function(e) {
+ return !!ma(e) && (e.attributes.BANDWIDTH || 0) < i
+ })).length
+ },
+ va = function(e, t) {
+ return !(!e && !t || !e && t || e && !t) && (e === t || (!(!e.id || !t.id || e.id !== t.id) || (!(!e.resolvedUri || !t.resolvedUri || e.resolvedUri !== t.resolvedUri) || !(!e.uri || !t.uri || e.uri !== t.uri))))
+ },
+ ya = function(e, t) {
+ var i = e && e.mediaGroups && e.mediaGroups.AUDIO || {},
+ n = !1;
+ for (var r in i) {
+ for (var a in i[r])
+ if (n = t(i[r][a])) break;
+ if (n) break
+ }
+ return !!n
+ },
+ ba = function(e) {
+ if (!e || !e.playlists || !e.playlists.length) return ya(e, (function(e) {
+ return e.playlists && e.playlists.length || e.uri
+ }));
+ for (var t = function(t) {
+ var i = e.playlists[t],
+ n = i.attributes && i.attributes.CODECS;
+ return n && n.split(",").every((function(e) {
+ return _.isAudioCodec(e)
+ })) || ya(e, (function(e) {
+ return va(i, e)
+ })) ? "continue" : {
+ v: !1
+ }
+ }, i = 0; i < e.playlists.length; i++) {
+ var n = t(i);
+ if ("continue" !== n && "object" == typeof n) return n.v
+ }
+ return !0
+ },
+ Sa = {
+ liveEdgeDelay: ua,
+ duration: ha,
+ seekable: function(e, t, i) {
+ var n = t || 0,
+ r = ca(e, t, !0, i);
+ return null === r ? ra() : ra(n, r)
+ },
+ getMediaInfoForTime: function(e) {
+ for (var t = e.playlist, i = e.currentTime, n = e.startingSegmentIndex, r = e.startingPartIndex, a = e.startTime, s = e.experimentalExactManifestTimings, o = i - a, u = aa(t), l = 0, h = 0; h < u.length; h++) {
+ var d = u[h];
+ if (n === d.segmentIndex && ("number" != typeof r || "number" != typeof d.partIndex || r === d.partIndex)) {
+ l = h;
+ break
+ }
+ }
+ if (o < 0) {
+ if (l > 0)
+ for (var c = l - 1; c >= 0; c--) {
+ var f = u[c];
+ if (o += f.duration, s) {
+ if (o < 0) continue
+ } else if (o + 1 / 30 <= 0) continue;
+ return {
+ partIndex: f.partIndex,
+ segmentIndex: f.segmentIndex,
+ startTime: a - da({
+ defaultDuration: t.targetDuration,
+ durationList: u,
+ startIndex: l,
+ endIndex: c
+ })
+ }
+ }
+ return {
+ partIndex: u[0] && u[0].partIndex || null,
+ segmentIndex: u[0] && u[0].segmentIndex || 0,
+ startTime: i
+ }
+ }
+ if (l < 0) {
+ for (var p = l; p < 0; p++)
+ if ((o -= t.targetDuration) < 0) return {
+ partIndex: u[0] && u[0].partIndex || null,
+ segmentIndex: u[0] && u[0].segmentIndex || 0,
+ startTime: i
+ };
+ l = 0
+ }
+ for (var m = l; m < u.length; m++) {
+ var _ = u[m];
+ if (o -= _.duration, s) {
+ if (o > 0) continue
+ } else if (o - 1 / 30 >= 0) continue;
+ return {
+ partIndex: _.partIndex,
+ segmentIndex: _.segmentIndex,
+ startTime: a + da({
+ defaultDuration: t.targetDuration,
+ durationList: u,
+ startIndex: l,
+ endIndex: m
+ })
+ }
+ }
+ return {
+ segmentIndex: u[u.length - 1].segmentIndex,
+ partIndex: u[u.length - 1].partIndex,
+ startTime: i
+ }
+ },
+ isEnabled: ma,
+ isDisabled: function(e) {
+ return e.disabled
+ },
+ isBlacklisted: fa,
+ isIncompatible: pa,
+ playlistEnd: ca,
+ isAes: function(e) {
+ for (var t = 0; t < e.segments.length; t++)
+ if (e.segments[t].key) return !0;
+ return !1
+ },
+ hasAttribute: _a,
+ estimateSegmentRequestTime: function(e, t, i, n) {
+ return void 0 === n && (n = 0), _a("BANDWIDTH", i) ? (e * i.attributes.BANDWIDTH - 8 * n) / t : NaN
+ },
+ isLowestEnabledRendition: ga,
+ isAudioOnly: ba,
+ playlistMatch: va
+ },
+ Ta = Yr.log,
+ Ea = function(e, t) {
+ return e + "-" + t
+ },
+ wa = function(e, t) {
+ e.mediaGroups && ["AUDIO", "SUBTITLES"].forEach((function(i) {
+ if (e.mediaGroups[i])
+ for (var n in e.mediaGroups[i])
+ for (var r in e.mediaGroups[i][n]) {
+ var a = e.mediaGroups[i][n][r];
+ t(a, i, n, r)
+ }
+ }))
+ },
+ Aa = function(e) {
+ var t = e.playlist,
+ i = e.uri,
+ n = e.id;
+ t.id = n, t.playlistErrors_ = 0, i && (t.uri = i), t.attributes = t.attributes || {}
+ },
+ Ca = function(e, t) {
+ e.uri = t;
+ for (var i = 0; i < e.playlists.length; i++)
+ if (!e.playlists[i].uri) {
+ var n = "placeholder-uri-" + i;
+ e.playlists[i].uri = n
+ } var r = ba(e);
+ wa(e, (function(t, i, n, a) {
+ var s = "placeholder-uri-" + i + "-" + n + "-" + a;
+ if (!t.playlists || !t.playlists.length) {
+ if (r && "AUDIO" === i && !t.uri)
+ for (var o = 0; o < e.playlists.length; o++) {
+ var u = e.playlists[o];
+ if (u.attributes && u.attributes.AUDIO && u.attributes.AUDIO === n) return
+ }
+ t.playlists = [P.default({}, t)]
+ }
+ t.playlists.forEach((function(t, i) {
+ var n = Ea(i, s);
+ t.uri ? t.resolvedUri = t.resolvedUri || Xr(e.uri, t.uri) : (t.uri = 0 === i ? s : n, t.resolvedUri = t.uri), t.id = t.id || n, t.attributes = t.attributes || {}, e.playlists[t.id] = t, e.playlists[t.uri] = t
+ }))
+ })),
+ function(e) {
+ for (var t = e.playlists.length; t--;) {
+ var i = e.playlists[t];
+ Aa({
+ playlist: i,
+ id: Ea(t, i.uri)
+ }), i.resolvedUri = Xr(e.uri, i.uri), e.playlists[i.id] = i, e.playlists[i.uri] = i, i.attributes.BANDWIDTH || Ta.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")
+ }
+ }(e),
+ function(e) {
+ wa(e, (function(t) {
+ t.uri && (t.resolvedUri = Xr(e.uri, t.uri))
+ }))
+ }(e)
+ },
+ ka = Yr.mergeOptions,
+ Pa = Yr.EventTarget,
+ Ia = function(e, t) {
+ if (!e) return t;
+ var i = ka(e, t);
+ if (e.preloadHints && !t.preloadHints && delete i.preloadHints, e.parts && !t.parts) delete i.parts;
+ else if (e.parts && t.parts)
+ for (var n = 0; n < t.parts.length; n++) e.parts && e.parts[n] && (i.parts[n] = ka(e.parts[n], t.parts[n]));
+ return !e.skipped && t.skipped && (i.skipped = !1), e.preload && !t.preload && (i.preload = !1), i
+ },
+ La = function(e, t) {
+ !e.resolvedUri && e.uri && (e.resolvedUri = Xr(t, e.uri)), e.key && !e.key.resolvedUri && (e.key.resolvedUri = Xr(t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map.resolvedUri = Xr(t, e.map.uri)), e.map && e.map.key && !e.map.key.resolvedUri && (e.map.key.resolvedUri = Xr(t, e.map.key.uri)), e.parts && e.parts.length && e.parts.forEach((function(e) {
+ e.resolvedUri || (e.resolvedUri = Xr(t, e.uri))
+ })), e.preloadHints && e.preloadHints.length && e.preloadHints.forEach((function(e) {
+ e.resolvedUri || (e.resolvedUri = Xr(t, e.uri))
+ }))
+ },
+ xa = function(e) {
+ var t = e.segments || [],
+ i = e.preloadSegment;
+ if (i && i.parts && i.parts.length) {
+ if (i.preloadHints)
+ for (var n = 0; n < i.preloadHints.length; n++)
+ if ("MAP" === i.preloadHints[n].type) return t;
+ i.duration = e.targetDuration, i.preload = !0, t.push(i)
+ }
+ return t
+ },
+ Ra = function(e, t) {
+ return e === t || e.segments && t.segments && e.segments.length === t.segments.length && e.endList === t.endList && e.mediaSequence === t.mediaSequence
+ },
+ Da = function(e, t, i) {
+ void 0 === i && (i = Ra);
+ var n = ka(e, {}),
+ r = n.playlists[t.id];
+ if (!r) return null;
+ if (i(r, t)) return null;
+ t.segments = xa(t);
+ var a = ka(r, t);
+ if (a.preloadSegment && !t.preloadSegment && delete a.preloadSegment, r.segments) {
+ if (t.skip) {
+ t.segments = t.segments || [];
+ for (var s = 0; s < t.skip.skippedSegments; s++) t.segments.unshift({
+ skipped: !0
+ })
+ }
+ a.segments = function(e, t, i) {
+ var n = e.slice(),
+ r = t.slice();
+ i = i || 0;
+ for (var a, s = [], o = 0; o < r.length; o++) {
+ var u = n[o + i],
+ l = r[o];
+ u ? (a = u.map || a, s.push(Ia(u, l))) : (a && !l.map && (l.map = a), s.push(l))
+ }
+ return s
+ }(r.segments, t.segments, t.mediaSequence - r.mediaSequence)
+ }
+ a.segments.forEach((function(e) {
+ La(e, a.resolvedUri)
+ }));
+ for (var o = 0; o < n.playlists.length; o++) n.playlists[o].id === t.id && (n.playlists[o] = a);
+ return n.playlists[t.id] = a, n.playlists[t.uri] = a, wa(e, (function(e, i, n, r) {
+ if (e.playlists)
+ for (var a = 0; a < e.playlists.length; a++) t.id === e.playlists[a].id && (e.playlists[a] = t)
+ })), n
+ },
+ Oa = function(e, t) {
+ var i = e.segments[e.segments.length - 1],
+ n = i && i.parts && i.parts[i.parts.length - 1],
+ r = n && n.duration || i && i.duration;
+ return t && r ? 1e3 * r : 500 * (e.partTargetDuration || e.targetDuration || 10)
+ },
+ Ua = function(e) {
+ function t(t, i, n) {
+ var r;
+ if (void 0 === n && (n = {}), r = e.call(this) || this, !t) throw new Error("A non-empty playlist URL or object is required");
+ r.logger_ = $r("PlaylistLoader");
+ var a = n,
+ s = a.withCredentials,
+ o = void 0 !== s && s,
+ u = a.handleManifestRedirects,
+ l = void 0 !== u && u;
+ r.src = t, r.vhs_ = i, r.withCredentials = o, r.handleManifestRedirects = l;
+ var h = i.options_;
+ return r.customTagParsers = h && h.customTagParsers || [], r.customTagMappers = h && h.customTagMappers || [], r.experimentalLLHLS = h && h.experimentalLLHLS || !1, r.state = "HAVE_NOTHING", r.handleMediaupdatetimeout_ = r.handleMediaupdatetimeout_.bind(I.default(r)), r.on("mediaupdatetimeout", r.handleMediaupdatetimeout_), r
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.handleMediaupdatetimeout_ = function() {
+ var e = this;
+ if ("HAVE_METADATA" === this.state) {
+ var t = this.media(),
+ i = Xr(this.master.uri, t.uri);
+ this.experimentalLLHLS && (i = function(e, t) {
+ if (t.endList) return e;
+ var i = [];
+ if (t.serverControl && t.serverControl.canBlockReload) {
+ var n = t.preloadSegment,
+ r = t.mediaSequence + t.segments.length;
+ if (n) {
+ var a = n.parts || [],
+ s = oa(t) - 1;
+ s > -1 && s !== a.length - 1 && i.push("_HLS_part=" + s), (s > -1 || a.length) && r--
+ }
+ i.unshift("_HLS_msn=" + r)
+ }
+ return t.serverControl && t.serverControl.canSkipUntil && i.unshift("_HLS_skip=" + (t.serverControl.canSkipDateranges ? "v2" : "YES")), i.forEach((function(t, i) {
+ e += "" + (0 === i ? "?" : "&") + t
+ })), e
+ }(i, t)), this.state = "HAVE_CURRENT_METADATA", this.request = this.vhs_.xhr({
+ uri: i,
+ withCredentials: this.withCredentials
+ }, (function(t, i) {
+ if (e.request) return t ? e.playlistRequestError(e.request, e.media(), "HAVE_METADATA") : void e.haveMetadata({
+ playlistString: e.request.responseText,
+ url: e.media().uri,
+ id: e.media().id
+ })
+ }))
+ }
+ }, i.playlistRequestError = function(e, t, i) {
+ var n = t.uri,
+ r = t.id;
+ this.request = null, i && (this.state = i), this.error = {
+ playlist: this.master.playlists[r],
+ status: e.status,
+ message: "HLS playlist request error at URL: " + n + ".",
+ responseText: e.responseText,
+ code: e.status >= 500 ? 4 : 2
+ }, this.trigger("error")
+ }, i.parseManifest_ = function(e) {
+ var t = this,
+ i = e.url;
+ return function(e) {
+ var t = e.onwarn,
+ i = e.oninfo,
+ n = e.manifestString,
+ r = e.customTagParsers,
+ a = void 0 === r ? [] : r,
+ s = e.customTagMappers,
+ o = void 0 === s ? [] : s,
+ u = e.experimentalLLHLS,
+ l = new m.Parser;
+ t && l.on("warn", t), i && l.on("info", i), a.forEach((function(e) {
+ return l.addParser(e)
+ })), o.forEach((function(e) {
+ return l.addTagMapper(e)
+ })), l.push(n), l.end();
+ var h = l.manifest;
+ if (u || (["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach((function(e) {
+ h.hasOwnProperty(e) && delete h[e]
+ })), h.segments && h.segments.forEach((function(e) {
+ ["parts", "preloadHints"].forEach((function(t) {
+ e.hasOwnProperty(t) && delete e[t]
+ }))
+ }))), !h.targetDuration) {
+ var d = 10;
+ h.segments && h.segments.length && (d = h.segments.reduce((function(e, t) {
+ return Math.max(e, t.duration)
+ }), 0)), t && t("manifest has no targetDuration defaulting to " + d), h.targetDuration = d
+ }
+ var c = sa(h);
+ if (c.length && !h.partTargetDuration) {
+ var f = c.reduce((function(e, t) {
+ return Math.max(e, t.duration)
+ }), 0);
+ t && (t("manifest has no partTargetDuration defaulting to " + f), Ta.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")), h.partTargetDuration = f
+ }
+ return h
+ }({
+ onwarn: function(e) {
+ var n = e.message;
+ return t.logger_("m3u8-parser warn for " + i + ": " + n)
+ },
+ oninfo: function(e) {
+ var n = e.message;
+ return t.logger_("m3u8-parser info for " + i + ": " + n)
+ },
+ manifestString: e.manifestString,
+ customTagParsers: this.customTagParsers,
+ customTagMappers: this.customTagMappers,
+ experimentalLLHLS: this.experimentalLLHLS
+ })
+ }, i.haveMetadata = function(e) {
+ var t = e.playlistString,
+ i = e.playlistObject,
+ n = e.url,
+ r = e.id;
+ this.request = null, this.state = "HAVE_METADATA";
+ var a = i || this.parseManifest_({
+ url: n,
+ manifestString: t
+ });
+ a.lastRequest = Date.now(), Aa({
+ playlist: a,
+ uri: n,
+ id: r
+ });
+ var s = Da(this.master, a);
+ this.targetDuration = a.partTargetDuration || a.targetDuration, s ? (this.master = s, this.media_ = this.master.playlists[r]) : this.trigger("playlistunchanged"), this.updateMediaUpdateTimeout_(Oa(this.media(), !!s)), this.trigger("loadedplaylist")
+ }, i.dispose = function() {
+ this.trigger("dispose"), this.stopRequest(), C.default.clearTimeout(this.mediaUpdateTimeout), C.default.clearTimeout(this.finalRenditionTimeout), this.off()
+ }, i.stopRequest = function() {
+ if (this.request) {
+ var e = this.request;
+ this.request = null, e.onreadystatechange = null, e.abort()
+ }
+ }, i.media = function(e, t) {
+ var i = this;
+ if (!e) return this.media_;
+ if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this.state);
+ if ("string" == typeof e) {
+ if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e);
+ e = this.master.playlists[e]
+ }
+ if (C.default.clearTimeout(this.finalRenditionTimeout), t) {
+ var n = (e.partTargetDuration || e.targetDuration) / 2 * 1e3 || 5e3;
+ this.finalRenditionTimeout = C.default.setTimeout(this.media.bind(this, e, !1), n)
+ } else {
+ var r = this.state,
+ a = !this.media_ || e.id !== this.media_.id,
+ s = this.master.playlists[e.id];
+ if (s && s.endList || e.endList && e.segments.length) return this.request && (this.request.onreadystatechange = null, this.request.abort(), this.request = null), this.state = "HAVE_METADATA", this.media_ = e, void(a && (this.trigger("mediachanging"), "HAVE_MASTER" === r ? this.trigger("loadedmetadata") : this.trigger("mediachange")));
+ if (this.updateMediaUpdateTimeout_(Oa(e, !0)), a) {
+ if (this.state = "SWITCHING_MEDIA", this.request) {
+ if (e.resolvedUri === this.request.url) return;
+ this.request.onreadystatechange = null, this.request.abort(), this.request = null
+ }
+ this.media_ && this.trigger("mediachanging"), this.request = this.vhs_.xhr({
+ uri: e.resolvedUri,
+ withCredentials: this.withCredentials
+ }, (function(t, n) {
+ if (i.request) {
+ if (e.lastRequest = Date.now(), e.resolvedUri = Qr(i.handleManifestRedirects, e.resolvedUri, n), t) return i.playlistRequestError(i.request, e, r);
+ i.haveMetadata({
+ playlistString: n.responseText,
+ url: e.uri,
+ id: e.id
+ }), "HAVE_MASTER" === r ? i.trigger("loadedmetadata") : i.trigger("mediachange")
+ }
+ }))
+ }
+ }
+ }, i.pause = function() {
+ this.mediaUpdateTimeout && (C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null), this.stopRequest(), "HAVE_NOTHING" === this.state && (this.started = !1), "SWITCHING_MEDIA" === this.state ? this.media_ ? this.state = "HAVE_METADATA" : this.state = "HAVE_MASTER" : "HAVE_CURRENT_METADATA" === this.state && (this.state = "HAVE_METADATA")
+ }, i.load = function(e) {
+ var t = this;
+ this.mediaUpdateTimeout && (C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null);
+ var i = this.media();
+ if (e) {
+ var n = i ? (i.partTargetDuration || i.targetDuration) / 2 * 1e3 : 5e3;
+ this.mediaUpdateTimeout = C.default.setTimeout((function() {
+ t.mediaUpdateTimeout = null, t.load()
+ }), n)
+ } else this.started ? i && !i.endList ? this.trigger("mediaupdatetimeout") : this.trigger("loadedplaylist") : this.start()
+ }, i.updateMediaUpdateTimeout_ = function(e) {
+ var t = this;
+ this.mediaUpdateTimeout && (C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null), this.media() && !this.media().endList && (this.mediaUpdateTimeout = C.default.setTimeout((function() {
+ t.mediaUpdateTimeout = null, t.trigger("mediaupdatetimeout"), t.updateMediaUpdateTimeout_(e)
+ }), e))
+ }, i.start = function() {
+ var e = this;
+ if (this.started = !0, "object" == typeof this.src) return this.src.uri || (this.src.uri = C.default.location.href), this.src.resolvedUri = this.src.uri, void setTimeout((function() {
+ e.setupInitialPlaylist(e.src)
+ }), 0);
+ this.request = this.vhs_.xhr({
+ uri: this.src,
+ withCredentials: this.withCredentials
+ }, (function(t, i) {
+ if (e.request) {
+ if (e.request = null, t) return e.error = {
+ status: i.status,
+ message: "HLS playlist request error at URL: " + e.src + ".",
+ responseText: i.responseText,
+ code: 2
+ }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error");
+ e.src = Qr(e.handleManifestRedirects, e.src, i);
+ var n = e.parseManifest_({
+ manifestString: i.responseText,
+ url: e.src
+ });
+ e.setupInitialPlaylist(n)
+ }
+ }))
+ }, i.srcUri = function() {
+ return "string" == typeof this.src ? this.src : this.src.uri
+ }, i.setupInitialPlaylist = function(e) {
+ if (this.state = "HAVE_MASTER", e.playlists) return this.master = e, Ca(this.master, this.srcUri()), e.playlists.forEach((function(e) {
+ e.segments = xa(e), e.segments.forEach((function(t) {
+ La(t, e.resolvedUri)
+ }))
+ })), this.trigger("loadedplaylist"), void(this.request || this.media(this.master.playlists[0]));
+ var t = this.srcUri() || C.default.location.href;
+ this.master = function(e, t) {
+ var i = Ea(0, t),
+ n = {
+ mediaGroups: {
+ AUDIO: {},
+ VIDEO: {},
+ "CLOSED-CAPTIONS": {},
+ SUBTITLES: {}
+ },
+ uri: C.default.location.href,
+ resolvedUri: C.default.location.href,
+ playlists: [{
+ uri: t,
+ id: i,
+ resolvedUri: t,
+ attributes: {}
+ }]
+ };
+ return n.playlists[i] = n.playlists[0], n.playlists[t] = n.playlists[0], n
+ }(0, t), this.haveMetadata({
+ playlistObject: e,
+ url: t,
+ id: this.master.playlists[0].id
+ }), this.trigger("loadedmetadata")
+ }, t
+ }(Pa),
+ Ma = Yr.xhr,
+ Fa = Yr.mergeOptions,
+ Ba = function(e, t, i, n) {
+ var r = "arraybuffer" === e.responseType ? e.response : e.responseText;
+ !t && r && (e.responseTime = Date.now(), e.roundTripTime = e.responseTime - e.requestTime, e.bytesReceived = r.byteLength || r.length, e.bandwidth || (e.bandwidth = Math.floor(e.bytesReceived / e.roundTripTime * 8 * 1e3))), i.headers && (e.responseHeaders = i.headers), t && "ETIMEDOUT" === t.code && (e.timedout = !0), t || e.aborted || 200 === i.statusCode || 206 === i.statusCode || 0 === i.statusCode || (t = new Error("XHR Failed with a response of: " + (e && (r || e.responseText)))), n(t, e)
+ },
+ Na = function() {
+ var e = function e(t, i) {
+ t = Fa({
+ timeout: 45e3
+ }, t);
+ var n = e.beforeRequest || Yr.Vhs.xhr.beforeRequest;
+ if (n && "function" == typeof n) {
+ var r = n(t);
+ r && (t = r)
+ }
+ var a = (!0 === Yr.Vhs.xhr.original ? Ma : Yr.Vhs.xhr)(t, (function(e, t) {
+ return Ba(a, e, t, i)
+ })),
+ s = a.abort;
+ return a.abort = function() {
+ return a.aborted = !0, s.apply(a, arguments)
+ }, a.uri = t.uri, a.requestTime = Date.now(), a
+ };
+ return e.original = !0, e
+ },
+ ja = function(e) {
+ var t, i, n = {};
+ return e.byterange && (n.Range = (t = e.byterange, i = t.offset + t.length - 1, "bytes=" + t.offset + "-" + i)), n
+ },
+ Va = function(e, t) {
+ return e.start(t) + "-" + e.end(t)
+ },
+ Ha = function(e, t) {
+ var i = e.toString(16);
+ return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "")
+ },
+ za = function(e) {
+ return e >= 32 && e < 126 ? String.fromCharCode(e) : "."
+ },
+ Ga = function(e) {
+ var t = {};
+ return Object.keys(e).forEach((function(i) {
+ var n = e[i];
+ ArrayBuffer.isView(n) ? t[i] = {
+ bytes: n.buffer,
+ byteOffset: n.byteOffset,
+ byteLength: n.byteLength
+ } : t[i] = n
+ })), t
+ },
+ Wa = function(e) {
+ var t = e.byterange || {
+ length: 1 / 0,
+ offset: 0
+ };
+ return [t.length, t.offset, e.resolvedUri].join(",")
+ },
+ Ya = function(e) {
+ return e.resolvedUri
+ },
+ qa = function(e) {
+ for (var t = Array.prototype.slice.call(e), i = "", n = 0; n < t.length / 16; n++) i += t.slice(16 * n, 16 * n + 16).map(Ha).join("") + " " + t.slice(16 * n, 16 * n + 16).map(za).join("") + "\n";
+ return i
+ },
+ Ka = Object.freeze({
+ __proto__: null,
+ createTransferableMessage: Ga,
+ initSegmentId: Wa,
+ segmentKeyId: Ya,
+ hexDump: qa,
+ tagDump: function(e) {
+ var t = e.bytes;
+ return qa(t)
+ },
+ textRanges: function(e) {
+ var t, i = "";
+ for (t = 0; t < e.length; t++) i += Va(e, t) + " ";
+ return i
+ }
+ }),
+ Xa = function(e) {
+ var t = e.playlist,
+ i = e.time,
+ n = void 0 === i ? void 0 : i,
+ r = e.callback;
+ if (!r) throw new Error("getProgramTime: callback must be provided");
+ if (!t || void 0 === n) return r({
+ message: "getProgramTime: playlist and time must be provided"
+ });
+ var a = function(e, t) {
+ if (!t || !t.segments || 0 === t.segments.length) return null;
+ for (var i, n = 0, r = 0; r < t.segments.length && !(e <= (n = (i = t.segments[r]).videoTimingInfo ? i.videoTimingInfo.transmuxedPresentationEnd : n + i.duration)); r++);
+ var a = t.segments[t.segments.length - 1];
+ if (a.videoTimingInfo && a.videoTimingInfo.transmuxedPresentationEnd < e) return null;
+ if (e > n) {
+ if (e > n + .25 * a.duration) return null;
+ i = a
+ }
+ return {
+ segment: i,
+ estimatedStart: i.videoTimingInfo ? i.videoTimingInfo.transmuxedPresentationStart : n - i.duration,
+ type: i.videoTimingInfo ? "accurate" : "estimate"
+ }
+ }(n, t);
+ if (!a) return r({
+ message: "valid programTime was not found"
+ });
+ if ("estimate" === a.type) return r({
+ message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
+ seekTime: a.estimatedStart
+ });
+ var s = {
+ mediaSeconds: n
+ },
+ o = function(e, t) {
+ if (!t.dateTimeObject) return null;
+ var i = t.videoTimingInfo.transmuxerPrependedSeconds,
+ n = e - (t.videoTimingInfo.transmuxedPresentationStart + i);
+ return new Date(t.dateTimeObject.getTime() + 1e3 * n)
+ }(n, a.segment);
+ return o && (s.programDateTime = o.toISOString()), r(null, s)
+ },
+ Qa = function e(t) {
+ var i = t.programTime,
+ n = t.playlist,
+ r = t.retryCount,
+ a = void 0 === r ? 2 : r,
+ s = t.seekTo,
+ o = t.pauseAfterSeek,
+ u = void 0 === o || o,
+ l = t.tech,
+ h = t.callback;
+ if (!h) throw new Error("seekToProgramTime: callback must be provided");
+ if (void 0 === i || !n || !s) return h({
+ message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
+ });
+ if (!n.endList && !l.hasStarted_) return h({
+ message: "player must be playing a live stream to start buffering"
+ });
+ if (! function(e) {
+ if (!e.segments || 0 === e.segments.length) return !1;
+ for (var t = 0; t < e.segments.length; t++) {
+ if (!e.segments[t].dateTimeObject) return !1
+ }
+ return !0
+ }(n)) return h({
+ message: "programDateTime tags must be provided in the manifest " + n.resolvedUri
+ });
+ var d = function(e, t) {
+ var i;
+ try {
+ i = new Date(e)
+ } catch (e) {
+ return null
+ }
+ if (!t || !t.segments || 0 === t.segments.length) return null;
+ var n = t.segments[0];
+ if (i < n.dateTimeObject) return null;
+ for (var r = 0; r < t.segments.length - 1; r++) {
+ if (n = t.segments[r], i < t.segments[r + 1].dateTimeObject) break
+ }
+ var a, s = t.segments[t.segments.length - 1],
+ o = s.dateTimeObject,
+ u = s.videoTimingInfo ? (a = s.videoTimingInfo).transmuxedPresentationEnd - a.transmuxedPresentationStart - a.transmuxerPrependedSeconds : s.duration + .25 * s.duration;
+ return i > new Date(o.getTime() + 1e3 * u) ? null : (i > o && (n = s), {
+ segment: n,
+ estimatedStart: n.videoTimingInfo ? n.videoTimingInfo.transmuxedPresentationStart : Sa.duration(t, t.mediaSequence + t.segments.indexOf(n)),
+ type: n.videoTimingInfo ? "accurate" : "estimate"
+ })
+ }(i, n);
+ if (!d) return h({
+ message: i + " was not found in the stream"
+ });
+ var c = d.segment,
+ f = function(e, t) {
+ var i, n;
+ try {
+ i = new Date(e), n = new Date(t)
+ } catch (e) {}
+ var r = i.getTime();
+ return (n.getTime() - r) / 1e3
+ }(c.dateTimeObject, i);
+ if ("estimate" === d.type) return 0 === a ? h({
+ message: i + " is not buffered yet. Try again"
+ }) : (s(d.estimatedStart + f), void l.one("seeked", (function() {
+ e({
+ programTime: i,
+ playlist: n,
+ retryCount: a - 1,
+ seekTo: s,
+ pauseAfterSeek: u,
+ tech: l,
+ callback: h
+ })
+ })));
+ var p = c.start + f;
+ l.one("seeked", (function() {
+ return h(null, l.currentTime())
+ })), u && l.pause(), s(p)
+ },
+ $a = function(e, t) {
+ if (4 === e.readyState) return t()
+ },
+ Ja = Yr.EventTarget,
+ Za = Yr.mergeOptions,
+ es = function(e, t) {
+ if (!Ra(e, t)) return !1;
+ if (e.sidx && t.sidx && (e.sidx.offset !== t.sidx.offset || e.sidx.length !== t.sidx.length)) return !1;
+ if (!e.sidx && t.sidx || e.sidx && !t.sidx) return !1;
+ if (e.segments && !t.segments || !e.segments && t.segments) return !1;
+ if (!e.segments && !t.segments) return !0;
+ for (var i = 0; i < e.segments.length; i++) {
+ var n = e.segments[i],
+ r = t.segments[i];
+ if (n.uri !== r.uri) return !1;
+ if (n.byterange || r.byterange) {
+ var a = n.byterange,
+ s = r.byterange;
+ if (a && !s || !a && s) return !1;
+ if (a.offset !== s.offset || a.length !== s.length) return !1
+ }
+ }
+ return !0
+ },
+ ts = function(e, t) {
+ var i, n, r = {};
+ for (var a in e) {
+ var s = e[a].sidx;
+ if (s) {
+ var o = v.generateSidxKey(s);
+ if (!t[o]) break;
+ var u = t[o].sidxInfo;
+ i = u, n = s, (Boolean(!i.map && !n.map) || Boolean(i.map && n.map && i.map.byterange.offset === n.map.byterange.offset && i.map.byterange.length === n.map.byterange.length)) && i.uri === n.uri && i.byterange.offset === n.byterange.offset && i.byterange.length === n.byterange.length && (r[o] = t[o])
+ }
+ }
+ return r
+ },
+ is = function(e) {
+ function t(t, i, n, r) {
+ var a;
+ void 0 === n && (n = {}), (a = e.call(this) || this).masterPlaylistLoader_ = r || I.default(a), r || (a.isMaster_ = !0);
+ var s = n,
+ o = s.withCredentials,
+ u = void 0 !== o && o,
+ l = s.handleManifestRedirects,
+ h = void 0 !== l && l;
+ if (a.vhs_ = i, a.withCredentials = u, a.handleManifestRedirects = h, !t) throw new Error("A non-empty playlist URL or object is required");
+ return a.on("minimumUpdatePeriod", (function() {
+ a.refreshXml_()
+ })), a.on("mediaupdatetimeout", (function() {
+ a.refreshMedia_(a.media().id)
+ })), a.state = "HAVE_NOTHING", a.loadedPlaylists_ = {}, a.logger_ = $r("DashPlaylistLoader"), a.isMaster_ ? (a.masterPlaylistLoader_.srcUrl = t, a.masterPlaylistLoader_.sidxMapping_ = {}) : a.childPlaylist_ = t, a
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.requestErrored_ = function(e, t, i) {
+ return !this.request || (this.request = null, e ? (this.error = "object" != typeof e || e instanceof Error ? {
+ status: t.status,
+ message: "DASH request error at URL: " + t.uri,
+ response: t.response,
+ code: 2
+ } : e, i && (this.state = i), this.trigger("error"), !0) : void 0)
+ }, i.addSidxSegments_ = function(e, t, i) {
+ var n = this,
+ r = e.sidx && v.generateSidxKey(e.sidx);
+ if (e.sidx && r && !this.masterPlaylistLoader_.sidxMapping_[r]) {
+ var a = Qr(this.handleManifestRedirects, e.sidx.resolvedUri),
+ s = function(a, s) {
+ if (!n.requestErrored_(a, s, t)) {
+ var o, u = n.masterPlaylistLoader_.sidxMapping_;
+ try {
+ o = B.default(T.toUint8(s.response).subarray(8))
+ } catch (e) {
+ return void n.requestErrored_(e, s, t)
+ }
+ return u[r] = {
+ sidxInfo: e.sidx,
+ sidx: o
+ }, v.addSidxSegmentsToPlaylist(e, o, e.sidx.resolvedUri), i(!0)
+ }
+ };
+ this.request = function(e, t, i) {
+ var n, r = [],
+ a = !1,
+ s = function(e, t, n, r) {
+ return t.abort(), a = !0, i(e, t, n, r)
+ },
+ o = function(e, t) {
+ if (!a) {
+ if (e) return s(e, t, "", r);
+ var i = t.responseText.substring(r && r.byteLength || 0, t.responseText.length);
+ if (r = T.concatTypedArrays(r, T.stringToBytes(i, !0)), n = n || b.getId3Offset(r), r.length < 10 || n && r.length < n + 2) return $a(t, (function() {
+ return s(e, t, "", r)
+ }));
+ var o = S.detectContainerForBytes(r);
+ return "ts" === o && r.length < 188 || !o && r.length < 376 ? $a(t, (function() {
+ return s(e, t, "", r)
+ })) : s(null, t, o, r)
+ }
+ },
+ u = t({
+ uri: e,
+ beforeSend: function(e) {
+ e.overrideMimeType("text/plain; charset=x-user-defined"), e.addEventListener("progress", (function(t) {
+ return t.total, t.loaded, Ba(e, null, {
+ statusCode: e.status
+ }, o)
+ }))
+ }
+ }, (function(e, t) {
+ return Ba(u, e, t, o)
+ }));
+ return u
+ }(a, this.vhs_.xhr, (function(t, i, r, o) {
+ if (t) return s(t, i);
+ if (!r || "mp4" !== r) return s({
+ status: i.status,
+ message: "Unsupported " + (r || "unknown") + " container type for sidx segment at URL: " + a,
+ response: "",
+ playlist: e,
+ internal: !0,
+ blacklistDuration: 1 / 0,
+ code: 2
+ }, i);
+ var u = e.sidx.byterange,
+ l = u.offset,
+ h = u.length;
+ if (o.length >= h + l) return s(t, {
+ response: o.subarray(l, l + h),
+ status: i.status,
+ uri: i.uri
+ });
+ n.request = n.vhs_.xhr({
+ uri: a,
+ responseType: "arraybuffer",
+ headers: ja({
+ byterange: e.sidx.byterange
+ })
+ }, s)
+ }))
+ } else this.mediaRequest_ = C.default.setTimeout((function() {
+ return i(!1)
+ }), 0)
+ }, i.dispose = function() {
+ this.trigger("dispose"), this.stopRequest(), this.loadedPlaylists_ = {}, C.default.clearTimeout(this.minimumUpdatePeriodTimeout_), C.default.clearTimeout(this.mediaRequest_), C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null, this.mediaRequest_ = null, this.minimumUpdatePeriodTimeout_ = null, this.masterPlaylistLoader_.createMupOnMedia_ && (this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_), this.masterPlaylistLoader_.createMupOnMedia_ = null), this.off()
+ }, i.hasPendingRequest = function() {
+ return this.request || this.mediaRequest_
+ }, i.stopRequest = function() {
+ if (this.request) {
+ var e = this.request;
+ this.request = null, e.onreadystatechange = null, e.abort()
+ }
+ }, i.media = function(e) {
+ var t = this;
+ if (!e) return this.media_;
+ if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this.state);
+ var i = this.state;
+ if ("string" == typeof e) {
+ if (!this.masterPlaylistLoader_.master.playlists[e]) throw new Error("Unknown playlist URI: " + e);
+ e = this.masterPlaylistLoader_.master.playlists[e]
+ }
+ var n = !this.media_ || e.id !== this.media_.id;
+ if (n && this.loadedPlaylists_[e.id] && this.loadedPlaylists_[e.id].endList) return this.state = "HAVE_METADATA", this.media_ = e, void(n && (this.trigger("mediachanging"), this.trigger("mediachange")));
+ n && (this.media_ && this.trigger("mediachanging"), this.addSidxSegments_(e, i, (function(n) {
+ t.haveMetadata({
+ startingState: i,
+ playlist: e
+ })
+ })))
+ }, i.haveMetadata = function(e) {
+ var t = e.startingState,
+ i = e.playlist;
+ this.state = "HAVE_METADATA", this.loadedPlaylists_[i.id] = i, this.mediaRequest_ = null, this.refreshMedia_(i.id), "HAVE_MASTER" === t ? this.trigger("loadedmetadata") : this.trigger("mediachange")
+ }, i.pause = function() {
+ this.masterPlaylistLoader_.createMupOnMedia_ && (this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_), this.masterPlaylistLoader_.createMupOnMedia_ = null), this.stopRequest(), C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null, this.isMaster_ && (C.default.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_), this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null), "HAVE_NOTHING" === this.state && (this.started = !1)
+ }, i.load = function(e) {
+ var t = this;
+ C.default.clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = null;
+ var i = this.media();
+ if (e) {
+ var n = i ? i.targetDuration / 2 * 1e3 : 5e3;
+ this.mediaUpdateTimeout = C.default.setTimeout((function() {
+ return t.load()
+ }), n)
+ } else this.started ? i && !i.endList ? (this.isMaster_ && !this.minimumUpdatePeriodTimeout_ && (this.trigger("minimumUpdatePeriod"), this.updateMinimumUpdatePeriodTimeout_()), this.trigger("mediaupdatetimeout")) : this.trigger("loadedplaylist") : this.start()
+ }, i.start = function() {
+ var e = this;
+ this.started = !0, this.isMaster_ ? this.requestMaster_((function(t, i) {
+ e.haveMaster_(), e.hasPendingRequest() || e.media_ || e.media(e.masterPlaylistLoader_.master.playlists[0])
+ })) : this.mediaRequest_ = C.default.setTimeout((function() {
+ return e.haveMaster_()
+ }), 0)
+ }, i.requestMaster_ = function(e) {
+ var t = this;
+ this.request = this.vhs_.xhr({
+ uri: this.masterPlaylistLoader_.srcUrl,
+ withCredentials: this.withCredentials
+ }, (function(i, n) {
+ if (!t.requestErrored_(i, n)) {
+ var r = n.responseText !== t.masterPlaylistLoader_.masterXml_;
+ return t.masterPlaylistLoader_.masterXml_ = n.responseText, n.responseHeaders && n.responseHeaders.date ? t.masterLoaded_ = Date.parse(n.responseHeaders.date) : t.masterLoaded_ = Date.now(), t.masterPlaylistLoader_.srcUrl = Qr(t.handleManifestRedirects, t.masterPlaylistLoader_.srcUrl, n), r ? (t.handleMaster_(), void t.syncClientServerClock_((function() {
+ return e(n, r)
+ }))) : e(n, r)
+ }
+ "HAVE_NOTHING" === t.state && (t.started = !1)
+ }))
+ }, i.syncClientServerClock_ = function(e) {
+ var t = this,
+ i = v.parseUTCTiming(this.masterPlaylistLoader_.masterXml_);
+ return null === i ? (this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now(), e()) : "DIRECT" === i.method ? (this.masterPlaylistLoader_.clientOffset_ = i.value - Date.now(), e()) : void(this.request = this.vhs_.xhr({
+ uri: Xr(this.masterPlaylistLoader_.srcUrl, i.value),
+ method: i.method,
+ withCredentials: this.withCredentials
+ }, (function(n, r) {
+ if (t.request) {
+ if (n) return t.masterPlaylistLoader_.clientOffset_ = t.masterLoaded_ - Date.now(), e();
+ var a;
+ a = "HEAD" === i.method ? r.responseHeaders && r.responseHeaders.date ? Date.parse(r.responseHeaders.date) : t.masterLoaded_ : Date.parse(r.responseText), t.masterPlaylistLoader_.clientOffset_ = a - Date.now(), e()
+ }
+ })))
+ }, i.haveMaster_ = function() {
+ this.state = "HAVE_MASTER", this.isMaster_ ? this.trigger("loadedplaylist") : this.media_ || this.media(this.childPlaylist_)
+ }, i.handleMaster_ = function() {
+ this.mediaRequest_ = null;
+ var e, t, i, n, r, a, s = (e = {
+ masterXml: this.masterPlaylistLoader_.masterXml_,
+ srcUrl: this.masterPlaylistLoader_.srcUrl,
+ clientOffset: this.masterPlaylistLoader_.clientOffset_,
+ sidxMapping: this.masterPlaylistLoader_.sidxMapping_
+ }, t = e.masterXml, i = e.srcUrl, n = e.clientOffset, r = e.sidxMapping, a = v.parse(t, {
+ manifestUri: i,
+ clientOffset: n,
+ sidxMapping: r
+ }), Ca(a, i), a),
+ o = this.masterPlaylistLoader_.master;
+ o && (s = function(e, t, i) {
+ for (var n = !0, r = Za(e, {
+ duration: t.duration,
+ minimumUpdatePeriod: t.minimumUpdatePeriod
+ }), a = 0; a < t.playlists.length; a++) {
+ var s = t.playlists[a];
+ if (s.sidx) {
+ var o = v.generateSidxKey(s.sidx);
+ i && i[o] && i[o].sidx && v.addSidxSegmentsToPlaylist(s, i[o].sidx, s.sidx.resolvedUri)
+ }
+ var u = Da(r, s, es);
+ u && (r = u, n = !1)
+ }
+ return wa(t, (function(e, t, i, a) {
+ if (e.playlists && e.playlists.length) {
+ var s = e.playlists[0].id,
+ o = Da(r, e.playlists[0], es);
+ o && ((r = o).mediaGroups[t][i][a].playlists[0] = r.playlists[s], n = !1)
+ }
+ })), t.minimumUpdatePeriod !== e.minimumUpdatePeriod && (n = !1), n ? null : r
+ }(o, s, this.masterPlaylistLoader_.sidxMapping_)), this.masterPlaylistLoader_.master = s || o;
+ var u = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0];
+ return u && u !== this.masterPlaylistLoader_.srcUrl && (this.masterPlaylistLoader_.srcUrl = u), (!o || s && s.minimumUpdatePeriod !== o.minimumUpdatePeriod) && this.updateMinimumUpdatePeriodTimeout_(), Boolean(s)
+ }, i.updateMinimumUpdatePeriodTimeout_ = function() {
+ var e = this.masterPlaylistLoader_;
+ e.createMupOnMedia_ && (e.off("loadedmetadata", e.createMupOnMedia_), e.createMupOnMedia_ = null), e.minimumUpdatePeriodTimeout_ && (C.default.clearTimeout(e.minimumUpdatePeriodTimeout_), e.minimumUpdatePeriodTimeout_ = null);
+ var t = e.master && e.master.minimumUpdatePeriod;
+ 0 === t && (e.media() ? t = 1e3 * e.media().targetDuration : (e.createMupOnMedia_ = e.updateMinimumUpdatePeriodTimeout_, e.one("loadedmetadata", e.createMupOnMedia_))), "number" != typeof t || t <= 0 ? t < 0 && this.logger_("found invalid minimumUpdatePeriod of " + t + ", not setting a timeout") : this.createMUPTimeout_(t)
+ }, i.createMUPTimeout_ = function(e) {
+ var t = this.masterPlaylistLoader_;
+ t.minimumUpdatePeriodTimeout_ = C.default.setTimeout((function() {
+ t.minimumUpdatePeriodTimeout_ = null, t.trigger("minimumUpdatePeriod"), t.createMUPTimeout_(e)
+ }), e)
+ }, i.refreshXml_ = function() {
+ var e = this;
+ this.requestMaster_((function(t, i) {
+ var n, r, a;
+ i && (e.media_ && (e.media_ = e.masterPlaylistLoader_.master.playlists[e.media_.id]), e.masterPlaylistLoader_.sidxMapping_ = (n = e.masterPlaylistLoader_.master, r = e.masterPlaylistLoader_.sidxMapping_, a = ts(n.playlists, r), wa(n, (function(e, t, i, n) {
+ if (e.playlists && e.playlists.length) {
+ var s = e.playlists;
+ a = Za(a, ts(s, r))
+ }
+ })), a), e.addSidxSegments_(e.media(), e.state, (function(t) {
+ e.refreshMedia_(e.media().id)
+ })))
+ }))
+ }, i.refreshMedia_ = function(e) {
+ var t = this;
+ if (!e) throw new Error("refreshMedia_ must take a media id");
+ this.media_ && this.isMaster_ && this.handleMaster_();
+ var i = this.masterPlaylistLoader_.master.playlists,
+ n = !this.media_ || this.media_ !== i[e];
+ if (n ? this.media_ = i[e] : this.trigger("playlistunchanged"), !this.mediaUpdateTimeout) {
+ ! function e() {
+ t.media().endList || (t.mediaUpdateTimeout = C.default.setTimeout((function() {
+ t.trigger("mediaupdatetimeout"), e()
+ }), Oa(t.media(), Boolean(n))))
+ }()
+ }
+ this.trigger("loadedplaylist")
+ }, t
+ }(Ja),
+ ns = {
+ GOAL_BUFFER_LENGTH: 30,
+ MAX_GOAL_BUFFER_LENGTH: 60,
+ BACK_BUFFER_LENGTH: 30,
+ GOAL_BUFFER_LENGTH_RATE: 1,
+ INITIAL_BANDWIDTH: 4194304,
+ BANDWIDTH_VARIANCE: 1.2,
+ BUFFER_LOW_WATER_LINE: 0,
+ MAX_BUFFER_LOW_WATER_LINE: 30,
+ EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
+ BUFFER_LOW_WATER_LINE_RATE: 1,
+ BUFFER_HIGH_WATER_LINE: 30
+ },
+ rs = function(e) {
+ return e.on = e.addEventListener, e.off = e.removeEventListener, e
+ },
+ as = function(e) {
+ return function() {
+ var t = function(e) {
+ try {
+ return URL.createObjectURL(new Blob([e], {
+ type: "application/javascript"
+ }))
+ } catch (i) {
+ var t = new BlobBuilder;
+ return t.append(e), URL.createObjectURL(t.getBlob())
+ }
+ }(e),
+ i = rs(new Worker(t));
+ i.objURL = t;
+ var n = i.terminate;
+ return i.on = i.addEventListener, i.off = i.removeEventListener, i.terminate = function() {
+ return URL.revokeObjectURL(t), n.call(this)
+ }, i
+ }
+ },
+ ss = function(e) {
+ return "var browserWorkerPolyFill = " + rs.toString() + ";\nbrowserWorkerPolyFill(self);\n" + e
+ },
+ os = function(e) {
+ return e.toString().replace(/^function.+?{/, "").slice(0, -1)
+ },
+ us = as(ss(os((function() {
+ var e = function() {
+ this.init = function() {
+ var e = {};
+ this.on = function(t, i) {
+ e[t] || (e[t] = []), e[t] = e[t].concat(i)
+ }, this.off = function(t, i) {
+ var n;
+ return !!e[t] && (n = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(n, 1), n > -1)
+ }, this.trigger = function(t) {
+ var i, n, r, a;
+ if (i = e[t])
+ if (2 === arguments.length)
+ for (r = i.length, n = 0; n < r; ++n) i[n].call(this, arguments[1]);
+ else {
+ for (a = [], n = arguments.length, n = 1; n < arguments.length; ++n) a.push(arguments[n]);
+ for (r = i.length, n = 0; n < r; ++n) i[n].apply(this, a)
+ }
+ }, this.dispose = function() {
+ e = {}
+ }
+ }
+ };
+ e.prototype.pipe = function(e) {
+ return this.on("data", (function(t) {
+ e.push(t)
+ })), this.on("done", (function(t) {
+ e.flush(t)
+ })), this.on("partialdone", (function(t) {
+ e.partialFlush(t)
+ })), this.on("endedtimeline", (function(t) {
+ e.endTimeline(t)
+ })), this.on("reset", (function(t) {
+ e.reset(t)
+ })), e
+ }, e.prototype.push = function(e) {
+ this.trigger("data", e)
+ }, e.prototype.flush = function(e) {
+ this.trigger("done", e)
+ }, e.prototype.partialFlush = function(e) {
+ this.trigger("partialdone", e)
+ }, e.prototype.endTimeline = function(e) {
+ this.trigger("endedtimeline", e)
+ }, e.prototype.reset = function(e) {
+ this.trigger("reset", e)
+ };
+ var t, i, n, r, a, s, o, u, l, h, d, c, f, p, m, _, g, v, y, b, S, T, E, w, A, C, k, P, I, L, x, R, D, O, U, M, F, B, N, j, V = e,
+ H = Math.pow(2, 32) - 1;
+ ! function() {
+ var e;
+ if (T = {
+ avc1: [],
+ avcC: [],
+ btrt: [],
+ dinf: [],
+ dref: [],
+ esds: [],
+ ftyp: [],
+ hdlr: [],
+ mdat: [],
+ mdhd: [],
+ mdia: [],
+ mfhd: [],
+ minf: [],
+ moof: [],
+ moov: [],
+ mp4a: [],
+ mvex: [],
+ mvhd: [],
+ pasp: [],
+ sdtp: [],
+ smhd: [],
+ stbl: [],
+ stco: [],
+ stsc: [],
+ stsd: [],
+ stsz: [],
+ stts: [],
+ styp: [],
+ tfdt: [],
+ tfhd: [],
+ traf: [],
+ trak: [],
+ trun: [],
+ trex: [],
+ tkhd: [],
+ vmhd: []
+ }, "undefined" != typeof Uint8Array) {
+ for (e in T) T.hasOwnProperty(e) && (T[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e.charCodeAt(3)]);
+ E = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), A = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), w = new Uint8Array([0, 0, 0, 1]), C = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]), k = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]), P = {
+ video: C,
+ audio: k
+ }, x = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), L = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), R = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), D = R, O = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), U = R, I = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
+ }
+ }(), t = function(e) {
+ var t, i, n = [],
+ r = 0;
+ for (t = 1; t < arguments.length; t++) n.push(arguments[t]);
+ for (t = n.length; t--;) r += n[t].byteLength;
+ for (i = new Uint8Array(r + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i.byteLength), i.set(e, 4), t = 0, r = 8; t < n.length; t++) i.set(n[t], r), r += n[t].byteLength;
+ return i
+ }, i = function() {
+ return t(T.dinf, t(T.dref, x))
+ }, n = function(e) {
+ return t(T.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0, 0, 218, 192, 5, 2, e.audioobjecttype << 3 | e.samplingfrequencyindex >>> 1, e.samplingfrequencyindex << 7 | e.channelcount << 3, 6, 1, 2]))
+ }, m = function(e) {
+ return t(T.hdlr, P[e])
+ }, p = function(e) {
+ var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, e.duration >>> 24 & 255, e.duration >>> 16 & 255, e.duration >>> 8 & 255, 255 & e.duration, 85, 196, 0, 0]);
+ return e.samplerate && (i[12] = e.samplerate >>> 24 & 255, i[13] = e.samplerate >>> 16 & 255, i[14] = e.samplerate >>> 8 & 255, i[15] = 255 & e.samplerate), t(T.mdhd, i)
+ }, f = function(e) {
+ return t(T.mdia, p(e), m(e.type), s(e))
+ }, a = function(e) {
+ return t(T.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e]))
+ }, s = function(e) {
+ return t(T.minf, "video" === e.type ? t(T.vmhd, I) : t(T.smhd, L), i(), g(e))
+ }, o = function(e, i) {
+ for (var n = [], r = i.length; r--;) n[r] = y(i[r]);
+ return t.apply(null, [T.moof, a(e)].concat(n))
+ }, u = function(e) {
+ for (var i = e.length, n = []; i--;) n[i] = d(e[i]);
+ return t.apply(null, [T.moov, h(4294967295)].concat(n).concat(l(e)))
+ }, l = function(e) {
+ for (var i = e.length, n = []; i--;) n[i] = b(e[i]);
+ return t.apply(null, [T.mvex].concat(n))
+ }, h = function(e) {
+ var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]);
+ return t(T.mvhd, i)
+ }, _ = function(e) {
+ var i, n, r = e.samples || [],
+ a = new Uint8Array(4 + r.length);
+ for (n = 0; n < r.length; n++) i = r[n].flags, a[n + 4] = i.dependsOn << 4 | i.isDependedOn << 2 | i.hasRedundancy;
+ return t(T.sdtp, a)
+ }, g = function(e) {
+ return t(T.stbl, v(e), t(T.stts, U), t(T.stsc, D), t(T.stsz, O), t(T.stco, R))
+ }, v = function(e) {
+ return t(T.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === e.type ? M(e) : F(e))
+ }, M = function(e) {
+ var i, n, r = e.sps || [],
+ a = e.pps || [],
+ s = [],
+ o = [];
+ for (i = 0; i < r.length; i++) s.push((65280 & r[i].byteLength) >>> 8), s.push(255 & r[i].byteLength), s = s.concat(Array.prototype.slice.call(r[i]));
+ for (i = 0; i < a.length; i++) o.push((65280 & a[i].byteLength) >>> 8), o.push(255 & a[i].byteLength), o = o.concat(Array.prototype.slice.call(a[i]));
+ if (n = [T.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e.width) >> 8, 255 & e.width, (65280 & e.height) >> 8, 255 & e.height, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114, 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17]), t(T.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([r.length], s, [a.length], o))), t(T.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192]))], e.sarRatio) {
+ var u = e.sarRatio[0],
+ l = e.sarRatio[1];
+ n.push(t(T.pasp, new Uint8Array([(4278190080 & u) >> 24, (16711680 & u) >> 16, (65280 & u) >> 8, 255 & u, (4278190080 & l) >> 24, (16711680 & l) >> 16, (65280 & l) >> 8, 255 & l])))
+ }
+ return t.apply(null, n)
+ }, F = function(e) {
+ return t(T.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e.channelcount) >> 8, 255 & e.channelcount, (65280 & e.samplesize) >> 8, 255 & e.samplesize, 0, 0, 0, 0, (65280 & e.samplerate) >> 8, 255 & e.samplerate, 0, 0]), n(e))
+ }, c = function(e) {
+ var i = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 0, (4278190080 & e.duration) >> 24, (16711680 & e.duration) >> 16, (65280 & e.duration) >> 8, 255 & e.duration, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (65280 & e.width) >> 8, 255 & e.width, 0, 0, (65280 & e.height) >> 8, 255 & e.height, 0, 0]);
+ return t(T.tkhd, i)
+ }, y = function(e) {
+ var i, n, r, a, s, o;
+ return i = t(T.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), s = Math.floor(e.baseMediaDecodeTime / (H + 1)), o = Math.floor(e.baseMediaDecodeTime % (H + 1)), n = t(T.tfdt, new Uint8Array([1, 0, 0, 0, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o])), 92, "audio" === e.type ? (r = S(e, 92), t(T.traf, i, n, r)) : (a = _(e), r = S(e, a.length + 92), t(T.traf, i, n, r, a))
+ }, d = function(e) {
+ return e.duration = e.duration || 4294967295, t(T.trak, c(e), f(e))
+ }, b = function(e) {
+ var i = new Uint8Array([0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]);
+ return "video" !== e.type && (i[i.length - 1] = 0), t(T.trex, i)
+ }, j = function(e, t) {
+ var i = 0,
+ n = 0,
+ r = 0,
+ a = 0;
+ return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (n = 2), void 0 !== e[0].flags && (r = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | n | r | a, 1, (4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e.length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t]
+ }, N = function(e, i) {
+ var n, r, a, s, o, u;
+ for (i += 20 + 16 * (s = e.samples || []).length, a = j(s, i), (r = new Uint8Array(a.length + 16 * s.length)).set(a), n = a.length, u = 0; u < s.length; u++) o = s[u], r[n++] = (4278190080 & o.duration) >>> 24, r[n++] = (16711680 & o.duration) >>> 16, r[n++] = (65280 & o.duration) >>> 8, r[n++] = 255 & o.duration, r[n++] = (4278190080 & o.size) >>> 24, r[n++] = (16711680 & o.size) >>> 16, r[n++] = (65280 & o.size) >>> 8, r[n++] = 255 & o.size, r[n++] = o.flags.isLeading << 2 | o.flags.dependsOn, r[n++] = o.flags.isDependedOn << 6 | o.flags.hasRedundancy << 4 | o.flags.paddingValue << 1 | o.flags.isNonSyncSample, r[n++] = 61440 & o.flags.degradationPriority, r[n++] = 15 & o.flags.degradationPriority, r[n++] = (4278190080 & o.compositionTimeOffset) >>> 24, r[n++] = (16711680 & o.compositionTimeOffset) >>> 16, r[n++] = (65280 & o.compositionTimeOffset) >>> 8, r[n++] = 255 & o.compositionTimeOffset;
+ return t(T.trun, r)
+ }, B = function(e, i) {
+ var n, r, a, s, o, u;
+ for (i += 20 + 8 * (s = e.samples || []).length, a = j(s, i), (n = new Uint8Array(a.length + 8 * s.length)).set(a), r = a.length, u = 0; u < s.length; u++) o = s[u], n[r++] = (4278190080 & o.duration) >>> 24, n[r++] = (16711680 & o.duration) >>> 16, n[r++] = (65280 & o.duration) >>> 8, n[r++] = 255 & o.duration, n[r++] = (4278190080 & o.size) >>> 24, n[r++] = (16711680 & o.size) >>> 16, n[r++] = (65280 & o.size) >>> 8, n[r++] = 255 & o.size;
+ return t(T.trun, n)
+ }, S = function(e, t) {
+ return "audio" === e.type ? B(e, t) : N(e, t)
+ };
+ r = function() {
+ return t(T.ftyp, E, w, E, A)
+ };
+ var z, G, W, Y, q, K, X, Q, $ = function(e) {
+ return t(T.mdat, e)
+ },
+ J = o,
+ Z = function(e) {
+ var t, i = r(),
+ n = u(e);
+ return (t = new Uint8Array(i.byteLength + n.byteLength)).set(i), t.set(n, i.byteLength), t
+ },
+ ee = function(e, t) {
+ var i = {
+ size: 0,
+ flags: {
+ isLeading: 0,
+ dependsOn: 1,
+ isDependedOn: 0,
+ hasRedundancy: 0,
+ degradationPriority: 0,
+ isNonSyncSample: 1
+ }
+ };
+ return i.dataOffset = t, i.compositionTimeOffset = e.pts - e.dts, i.duration = e.duration, i.size = 4 * e.length, i.size += e.byteLength, e.keyFrame && (i.flags.dependsOn = 2, i.flags.isNonSyncSample = 0), i
+ },
+ te = function(e) {
+ var t, i, n = [],
+ r = [];
+ for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, n.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t]).nalUnitType ? (n.length && (n.duration = i.dts - n.dts, r.byteLength += n.byteLength, r.nalCount += n.length, r.duration += n.duration, r.push(n)), (n = [i]).byteLength = i.data.byteLength, n.pts = i.pts, n.dts = i.dts) : ("slice_layer_without_partitioning_rbsp_idr" === i.nalUnitType && (n.keyFrame = !0), n.duration = i.dts - n.dts, n.byteLength += i.data.byteLength, n.push(i));
+ return r.length && (!n.duration || n.duration <= 0) && (n.duration = r[r.length - 1].duration), r.byteLength += n.byteLength, r.nalCount += n.length, r.duration += n.duration, r.push(n), r
+ },
+ ie = function(e) {
+ var t, i, n = [],
+ r = [];
+ for (n.byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, t = 0; t < e.length; t++)(i = e[t]).keyFrame ? (n.length && (r.push(n), r.byteLength += n.byteLength, r.nalCount += n.nalCount, r.duration += n.duration), (n = [i]).nalCount = i.length, n.byteLength = i.byteLength, n.pts = i.pts, n.dts = i.dts, n.duration = i.duration) : (n.duration += i.duration, n.nalCount += i.length, n.byteLength += i.byteLength, n.push(i));
+ return r.length && n.duration <= 0 && (n.duration = r[r.length - 1].duration), r.byteLength += n.byteLength, r.nalCount += n.nalCount, r.duration += n.duration, r.push(n), r
+ },
+ ne = function(e) {
+ var t;
+ return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e.nalCount -= t.nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t.duration), e
+ },
+ re = function(e, t) {
+ var i, n, r, a, s, o = t || 0,
+ u = [];
+ for (i = 0; i < e.length; i++)
+ for (a = e[i], n = 0; n < a.length; n++) s = a[n], o += (r = ee(s, o)).size, u.push(r);
+ return u
+ },
+ ae = function(e) {
+ var t, i, n, r, a, s, o = 0,
+ u = e.byteLength,
+ l = e.nalCount,
+ h = new Uint8Array(u + 4 * l),
+ d = new DataView(h.buffer);
+ for (t = 0; t < e.length; t++)
+ for (r = e[t], i = 0; i < r.length; i++)
+ for (a = r[i], n = 0; n < a.length; n++) s = a[n], d.setUint32(o, s.data.byteLength), o += 4, h.set(s.data, o), o += s.data.byteLength;
+ return h
+ },
+ se = [33, 16, 5, 32, 164, 27],
+ oe = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252],
+ ue = function(e) {
+ for (var t = []; e--;) t.push(0);
+ return t
+ },
+ le = function() {
+ if (!z) {
+ var e = {
+ 96e3: [se, [227, 64], ue(154), [56]],
+ 88200: [se, [231], ue(170), [56]],
+ 64e3: [se, [248, 192], ue(240), [56]],
+ 48e3: [se, [255, 192], ue(268), [55, 148, 128], ue(54), [112]],
+ 44100: [se, [255, 192], ue(268), [55, 163, 128], ue(84), [112]],
+ 32e3: [se, [255, 192], ue(268), [55, 234], ue(226), [112]],
+ 24e3: [se, [255, 192], ue(268), [55, 255, 128], ue(268), [111, 112], ue(126), [224]],
+ 16e3: [se, [255, 192], ue(268), [55, 255, 128], ue(268), [111, 255], ue(269), [223, 108], ue(195), [1, 192]],
+ 12e3: [oe, ue(268), [3, 127, 248], ue(268), [6, 255, 240], ue(268), [13, 255, 224], ue(268), [27, 253, 128], ue(259), [56]],
+ 11025: [oe, ue(268), [3, 127, 248], ue(268), [6, 255, 240], ue(268), [13, 255, 224], ue(268), [27, 255, 192], ue(268), [55, 175, 128], ue(108), [112]],
+ 8e3: [oe, ue(268), [3, 121, 16], ue(47), [7]]
+ };
+ t = e, z = Object.keys(t).reduce((function(e, i) {
+ return e[i] = new Uint8Array(t[i].reduce((function(e, t) {
+ return e.concat(t)
+ }), [])), e
+ }), {})
+ }
+ var t;
+ return z
+ };
+ K = function(e, t) {
+ return G(q(e, t))
+ }, X = function(e, t) {
+ return W(Y(e), t)
+ }, Q = function(e, t, i) {
+ return Y(i ? e : e - t)
+ };
+ var he = 9e4,
+ de = G = function(e) {
+ return 9e4 * e
+ },
+ ce = (W = function(e, t) {
+ return e * t
+ }, Y = function(e) {
+ return e / 9e4
+ }),
+ fe = (q = function(e, t) {
+ return e / t
+ }, K),
+ pe = X,
+ me = Q,
+ _e = function(e, t, i, n) {
+ var r, a, s, o, u, l = 0,
+ h = 0,
+ d = 0;
+ if (t.length && (r = fe(e.baseMediaDecodeTime, e.samplerate), a = Math.ceil(he / (e.samplerate / 1024)), i && n && (l = r - Math.max(i, n), d = (h = Math.floor(l / a)) * a), !(h < 1 || d > he / 2))) {
+ for ((s = le()[e.samplerate]) || (s = t[0].data), o = 0; o < h; o++) u = t[0], t.splice(0, 0, {
+ data: s,
+ dts: u.dts - a,
+ pts: u.pts - a
+ });
+ return e.baseMediaDecodeTime -= Math.floor(pe(d, e.samplerate)), d
+ }
+ },
+ ge = function(e, t, i) {
+ return t.minSegmentDts >= i ? e : (t.minSegmentDts = 1 / 0, e.filter((function(e) {
+ return e.dts >= i && (t.minSegmentDts = Math.min(t.minSegmentDts, e.dts), t.minSegmentPts = t.minSegmentDts, !0)
+ })))
+ },
+ ve = function(e) {
+ var t, i, n = [];
+ for (t = 0; t < e.length; t++) i = e[t], n.push({
+ size: i.data.byteLength,
+ duration: 1024
+ });
+ return n
+ },
+ ye = function(e) {
+ var t, i, n = 0,
+ r = new Uint8Array(function(e) {
+ var t, i = 0;
+ for (t = 0; t < e.length; t++) i += e[t].data.byteLength;
+ return i
+ }(e));
+ for (t = 0; t < e.length; t++) i = e[t], r.set(i.data, n), n += i.data.byteLength;
+ return r
+ },
+ be = he,
+ Se = function(e) {
+ delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts
+ },
+ Te = function(e, t) {
+ var i, n = e.minSegmentDts;
+ return t || (n -= e.timelineStartInfo.dts), i = e.timelineStartInfo.baseMediaDecodeTime, i += n, i = Math.max(0, i), "audio" === e.type && (i *= e.samplerate / be, i = Math.floor(i)), i
+ },
+ Ee = function(e, t) {
+ "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts), void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e.minSegmentPts, t.pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e.maxSegmentPts = Math.max(e.maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e.timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e.minSegmentDts = t.dts : e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e.maxSegmentDts ? e.maxSegmentDts = t.dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts))
+ },
+ we = function(e) {
+ for (var t = 0, i = {
+ payloadType: -1,
+ payloadSize: 0
+ }, n = 0, r = 0; t < e.byteLength && 128 !== e[t];) {
+ for (; 255 === e[t];) n += 255, t++;
+ for (n += e[t++]; 255 === e[t];) r += 255, t++;
+ if (r += e[t++], !i.payload && 4 === n) {
+ if ("GA94" === String.fromCharCode(e[t + 3], e[t + 4], e[t + 5], e[t + 6])) {
+ i.payloadType = n, i.payloadSize = r, i.payload = e.subarray(t, t + r);
+ break
+ }
+ i.payload = void 0
+ }
+ t += r, n = 0, r = 0
+ }
+ return i
+ },
+ Ae = function(e) {
+ return 181 !== e.payload[0] || 49 != (e.payload[1] << 8 | e.payload[2]) || "GA94" !== String.fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) || 3 !== e.payload[7] ? null : e.payload.subarray(8, e.payload.length - 1)
+ },
+ Ce = function(e, t) {
+ var i, n, r, a, s = [];
+ if (!(64 & t[0])) return s;
+ for (n = 31 & t[0], i = 0; i < n; i++) a = {
+ type: 3 & t[(r = 3 * i) + 2],
+ pts: e
+ }, 4 & t[r + 2] && (a.ccData = t[r + 3] << 8 | t[r + 4], s.push(a));
+ return s
+ },
+ ke = function(e) {
+ for (var t, i, n = e.byteLength, r = [], a = 1; a < n - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (r.push(a + 2), a += 2) : a++;
+ if (0 === r.length) return e;
+ t = n - r.length, i = new Uint8Array(t);
+ var s = 0;
+ for (a = 0; a < t; s++, a++) s === r[0] && (s++, r.shift()), i[a] = e[s];
+ return i
+ },
+ Pe = 4,
+ Ie = function e(t) {
+ t = t || {}, e.prototype.init.call(this), this.parse708captions_ = "boolean" != typeof t.parse708captions || t.parse708captions, this.captionPackets_ = [], this.ccStreams_ = [new Ne(0, 0), new Ne(0, 1), new Ne(1, 0), new Ne(1, 1)], this.parse708captions_ && (this.cc708Stream_ = new Oe), this.reset(), this.ccStreams_.forEach((function(e) {
+ e.on("data", this.trigger.bind(this, "data")), e.on("partialdone", this.trigger.bind(this, "partialdone")), e.on("done", this.trigger.bind(this, "done"))
+ }), this), this.parse708captions_ && (this.cc708Stream_.on("data", this.trigger.bind(this, "data")), this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone")), this.cc708Stream_.on("done", this.trigger.bind(this, "done")))
+ };
+ (Ie.prototype = new V).push = function(e) {
+ var t, i, n;
+ if ("sei_rbsp" === e.nalUnitType && (t = we(e.escapedRBSP)).payload && t.payloadType === Pe && (i = Ae(t)))
+ if (e.dts < this.latestDts_) this.ignoreNextEqualDts_ = !0;
+ else {
+ if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) return this.numSameDts_--, void(this.numSameDts_ || (this.ignoreNextEqualDts_ = !1));
+ n = Ce(e.pts, i), this.captionPackets_ = this.captionPackets_.concat(n), this.latestDts_ !== e.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts
+ }
+ }, Ie.prototype.flushCCStreams = function(e) {
+ this.ccStreams_.forEach((function(t) {
+ return "flush" === e ? t.flush() : t.partialFlush()
+ }), this)
+ }, Ie.prototype.flushStream = function(e) {
+ this.captionPackets_.length ? (this.captionPackets_.forEach((function(e, t) {
+ e.presortIndex = t
+ })), this.captionPackets_.sort((function(e, t) {
+ return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts
+ })), this.captionPackets_.forEach((function(e) {
+ e.type < 2 ? this.dispatchCea608Packet(e) : this.dispatchCea708Packet(e)
+ }), this), this.captionPackets_.length = 0, this.flushCCStreams(e)) : this.flushCCStreams(e)
+ }, Ie.prototype.flush = function() {
+ return this.flushStream("flush")
+ }, Ie.prototype.partialFlush = function() {
+ return this.flushStream("partialFlush")
+ }, Ie.prototype.reset = function() {
+ this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.numSameDts_ = 0, this.activeCea608Channel_ = [null, null], this.ccStreams_.forEach((function(e) {
+ e.reset()
+ }))
+ }, Ie.prototype.dispatchCea608Packet = function(e) {
+ this.setsTextOrXDSActive(e) ? this.activeCea608Channel_[e.type] = null : this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this.activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e.type << 1) + this.activeCea608Channel_[e.type]].push(e)
+ }, Ie.prototype.setsChannel1Active = function(e) {
+ return 4096 == (30720 & e.ccData)
+ }, Ie.prototype.setsChannel2Active = function(e) {
+ return 6144 == (30720 & e.ccData)
+ }, Ie.prototype.setsTextOrXDSActive = function(e) {
+ return 256 == (28928 & e.ccData) || 4138 == (30974 & e.ccData) || 6186 == (30974 & e.ccData)
+ }, Ie.prototype.dispatchCea708Packet = function(e) {
+ this.parse708captions_ && this.cc708Stream_.push(e)
+ };
+ var Le = {
+ 127: 9834,
+ 4128: 32,
+ 4129: 160,
+ 4133: 8230,
+ 4138: 352,
+ 4140: 338,
+ 4144: 9608,
+ 4145: 8216,
+ 4146: 8217,
+ 4147: 8220,
+ 4148: 8221,
+ 4149: 8226,
+ 4153: 8482,
+ 4154: 353,
+ 4156: 339,
+ 4157: 8480,
+ 4159: 376,
+ 4214: 8539,
+ 4215: 8540,
+ 4216: 8541,
+ 4217: 8542,
+ 4218: 9168,
+ 4219: 9124,
+ 4220: 9123,
+ 4221: 9135,
+ 4222: 9126,
+ 4223: 9121,
+ 4256: 12600
+ },
+ xe = function(e) {
+ return 32 <= e && e <= 127 || 160 <= e && e <= 255
+ },
+ Re = function(e) {
+ this.windowNum = e, this.reset()
+ };
+ Re.prototype.reset = function() {
+ this.clearText(), this.pendingNewLine = !1, this.winAttr = {}, this.penAttr = {}, this.penLoc = {}, this.penColor = {}, this.visible = 0, this.rowLock = 0, this.columnLock = 0, this.priority = 0, this.relativePositioning = 0, this.anchorVertical = 0, this.anchorHorizontal = 0, this.anchorPoint = 0, this.rowCount = 1, this.virtualRowCount = this.rowCount + 1, this.columnCount = 41, this.windowStyle = 0, this.penStyle = 0
+ }, Re.prototype.getText = function() {
+ return this.rows.join("\n")
+ }, Re.prototype.clearText = function() {
+ this.rows = [""], this.rowIdx = 0
+ }, Re.prototype.newLine = function(e) {
+ for (this.rows.length >= this.virtualRowCount && "function" == typeof this.beforeRowOverflow && this.beforeRowOverflow(e), this.rows.length > 0 && (this.rows.push(""), this.rowIdx++); this.rows.length > this.virtualRowCount;) this.rows.shift(), this.rowIdx--
+ }, Re.prototype.isEmpty = function() {
+ return 0 === this.rows.length || 1 === this.rows.length && "" === this.rows[0]
+ }, Re.prototype.addText = function(e) {
+ this.rows[this.rowIdx] += e
+ }, Re.prototype.backspace = function() {
+ if (!this.isEmpty()) {
+ var e = this.rows[this.rowIdx];
+ this.rows[this.rowIdx] = e.substr(0, e.length - 1)
+ }
+ };
+ var De = function(e) {
+ this.serviceNum = e, this.text = "", this.currentWindow = new Re(-1), this.windows = []
+ };
+ De.prototype.init = function(e, t) {
+ this.startPts = e;
+ for (var i = 0; i < 8; i++) this.windows[i] = new Re(i), "function" == typeof t && (this.windows[i].beforeRowOverflow = t)
+ }, De.prototype.setCurrentWindow = function(e) {
+ this.currentWindow = this.windows[e]
+ };
+ var Oe = function e() {
+ e.prototype.init.call(this);
+ var t = this;
+ this.current708Packet = null, this.services = {}, this.push = function(e) {
+ 3 === e.type ? (t.new708Packet(), t.add708Bytes(e)) : (null === t.current708Packet && t.new708Packet(), t.add708Bytes(e))
+ }
+ };
+ Oe.prototype = new V, Oe.prototype.new708Packet = function() {
+ null !== this.current708Packet && this.push708Packet(), this.current708Packet = {
+ data: [],
+ ptsVals: []
+ }
+ }, Oe.prototype.add708Bytes = function(e) {
+ var t = e.ccData,
+ i = t >>> 8,
+ n = 255 & t;
+ this.current708Packet.ptsVals.push(e.pts), this.current708Packet.data.push(i), this.current708Packet.data.push(n)
+ }, Oe.prototype.push708Packet = function() {
+ var e = this.current708Packet,
+ t = e.data,
+ i = null,
+ n = null,
+ r = 0,
+ a = t[r++];
+ for (e.seq = a >> 6, e.sizeCode = 63 & a; r < t.length; r++) n = 31 & (a = t[r++]), 7 === (i = a >> 5) && n > 0 && (i = a = t[r++]), this.pushServiceBlock(i, r, n), n > 0 && (r += n - 1)
+ }, Oe.prototype.pushServiceBlock = function(e, t, i) {
+ var n, r = t,
+ a = this.current708Packet.data,
+ s = this.services[e];
+ for (s || (s = this.initService(e, r)); r < t + i && r < a.length; r++) n = a[r], xe(n) ? r = this.handleText(r, s) : 16 === n ? r = this.extendedCommands(r, s) : 128 <= n && n <= 135 ? r = this.setCurrentWindow(r, s) : 152 <= n && n <= 159 ? r = this.defineWindow(r, s) : 136 === n ? r = this.clearWindows(r, s) : 140 === n ? r = this.deleteWindows(r, s) : 137 === n ? r = this.displayWindows(r, s) : 138 === n ? r = this.hideWindows(r, s) : 139 === n ? r = this.toggleWindows(r, s) : 151 === n ? r = this.setWindowAttributes(r, s) : 144 === n ? r = this.setPenAttributes(r, s) : 145 === n ? r = this.setPenColor(r, s) : 146 === n ? r = this.setPenLocation(r, s) : 143 === n ? s = this.reset(r, s) : 8 === n ? s.currentWindow.backspace() : 12 === n ? s.currentWindow.clearText() : 13 === n ? s.currentWindow.pendingNewLine = !0 : 14 === n ? s.currentWindow.clearText() : 141 === n && r++
+ }, Oe.prototype.extendedCommands = function(e, t) {
+ var i = this.current708Packet.data[++e];
+ return xe(i) && (e = this.handleText(e, t, !0)), e
+ }, Oe.prototype.getPts = function(e) {
+ return this.current708Packet.ptsVals[Math.floor(e / 2)]
+ }, Oe.prototype.initService = function(e, t) {
+ var i = this;
+ return this.services[e] = new De(e), this.services[e].init(this.getPts(t), (function(t) {
+ i.flushDisplayed(t, i.services[e])
+ })), this.services[e]
+ }, Oe.prototype.handleText = function(e, t, i) {
+ var n, r, a = this.current708Packet.data[e],
+ s = (r = Le[n = (i ? 4096 : 0) | a] || n, 4096 & n && n === r ? "" : String.fromCharCode(r)),
+ o = t.currentWindow;
+ return o.pendingNewLine && !o.isEmpty() && o.newLine(this.getPts(e)), o.pendingNewLine = !1, o.addText(s), e
+ }, Oe.prototype.setCurrentWindow = function(e, t) {
+ var i = 7 & this.current708Packet.data[e];
+ return t.setCurrentWindow(i), e
+ }, Oe.prototype.defineWindow = function(e, t) {
+ var i = this.current708Packet.data,
+ n = i[e],
+ r = 7 & n;
+ t.setCurrentWindow(r);
+ var a = t.currentWindow;
+ return n = i[++e], a.visible = (32 & n) >> 5, a.rowLock = (16 & n) >> 4, a.columnLock = (8 & n) >> 3, a.priority = 7 & n, n = i[++e], a.relativePositioning = (128 & n) >> 7, a.anchorVertical = 127 & n, n = i[++e], a.anchorHorizontal = n, n = i[++e], a.anchorPoint = (240 & n) >> 4, a.rowCount = 15 & n, n = i[++e], a.columnCount = 63 & n, n = i[++e], a.windowStyle = (56 & n) >> 3, a.penStyle = 7 & n, a.virtualRowCount = a.rowCount + 1, e
+ }, Oe.prototype.setWindowAttributes = function(e, t) {
+ var i = this.current708Packet.data,
+ n = i[e],
+ r = t.currentWindow.winAttr;
+ return n = i[++e], r.fillOpacity = (192 & n) >> 6, r.fillRed = (48 & n) >> 4, r.fillGreen = (12 & n) >> 2, r.fillBlue = 3 & n, n = i[++e], r.borderType = (192 & n) >> 6, r.borderRed = (48 & n) >> 4, r.borderGreen = (12 & n) >> 2, r.borderBlue = 3 & n, n = i[++e], r.borderType += (128 & n) >> 5, r.wordWrap = (64 & n) >> 6, r.printDirection = (48 & n) >> 4, r.scrollDirection = (12 & n) >> 2, r.justify = 3 & n, n = i[++e], r.effectSpeed = (240 & n) >> 4, r.effectDirection = (12 & n) >> 2, r.displayEffect = 3 & n, e
+ }, Oe.prototype.flushDisplayed = function(e, t) {
+ for (var i = [], n = 0; n < 8; n++) t.windows[n].visible && !t.windows[n].isEmpty() && i.push(t.windows[n].getText());
+ t.endPts = e, t.text = i.join("\n\n"), this.pushCaption(t), t.startPts = e
+ }, Oe.prototype.pushCaption = function(e) {
+ "" !== e.text && (this.trigger("data", {
+ startPts: e.startPts,
+ endPts: e.endPts,
+ text: e.text,
+ stream: "cc708_" + e.serviceNum
+ }), e.text = "", e.startPts = e.endPts)
+ }, Oe.prototype.displayWindows = function(e, t) {
+ var i = this.current708Packet.data[++e],
+ n = this.getPts(e);
+ this.flushDisplayed(n, t);
+ for (var r = 0; r < 8; r++) i & 1 << r && (t.windows[r].visible = 1);
+ return e
+ }, Oe.prototype.hideWindows = function(e, t) {
+ var i = this.current708Packet.data[++e],
+ n = this.getPts(e);
+ this.flushDisplayed(n, t);
+ for (var r = 0; r < 8; r++) i & 1 << r && (t.windows[r].visible = 0);
+ return e
+ }, Oe.prototype.toggleWindows = function(e, t) {
+ var i = this.current708Packet.data[++e],
+ n = this.getPts(e);
+ this.flushDisplayed(n, t);
+ for (var r = 0; r < 8; r++) i & 1 << r && (t.windows[r].visible ^= 1);
+ return e
+ }, Oe.prototype.clearWindows = function(e, t) {
+ var i = this.current708Packet.data[++e],
+ n = this.getPts(e);
+ this.flushDisplayed(n, t);
+ for (var r = 0; r < 8; r++) i & 1 << r && t.windows[r].clearText();
+ return e
+ }, Oe.prototype.deleteWindows = function(e, t) {
+ var i = this.current708Packet.data[++e],
+ n = this.getPts(e);
+ this.flushDisplayed(n, t);
+ for (var r = 0; r < 8; r++) i & 1 << r && t.windows[r].reset();
+ return e
+ }, Oe.prototype.setPenAttributes = function(e, t) {
+ var i = this.current708Packet.data,
+ n = i[e],
+ r = t.currentWindow.penAttr;
+ return n = i[++e], r.textTag = (240 & n) >> 4, r.offset = (12 & n) >> 2, r.penSize = 3 & n, n = i[++e], r.italics = (128 & n) >> 7, r.underline = (64 & n) >> 6, r.edgeType = (56 & n) >> 3, r.fontStyle = 7 & n, e
+ }, Oe.prototype.setPenColor = function(e, t) {
+ var i = this.current708Packet.data,
+ n = i[e],
+ r = t.currentWindow.penColor;
+ return n = i[++e], r.fgOpacity = (192 & n) >> 6, r.fgRed = (48 & n) >> 4, r.fgGreen = (12 & n) >> 2, r.fgBlue = 3 & n, n = i[++e], r.bgOpacity = (192 & n) >> 6, r.bgRed = (48 & n) >> 4, r.bgGreen = (12 & n) >> 2, r.bgBlue = 3 & n, n = i[++e], r.edgeRed = (48 & n) >> 4, r.edgeGreen = (12 & n) >> 2, r.edgeBlue = 3 & n, e
+ }, Oe.prototype.setPenLocation = function(e, t) {
+ var i = this.current708Packet.data,
+ n = i[e],
+ r = t.currentWindow.penLoc;
+ return t.currentWindow.pendingNewLine = !0, n = i[++e], r.row = 15 & n, n = i[++e], r.column = 63 & n, e
+ }, Oe.prototype.reset = function(e, t) {
+ var i = this.getPts(e);
+ return this.flushDisplayed(i, t), this.initService(t.serviceNum, e)
+ };
+ var Ue = {
+ 42: 225,
+ 92: 233,
+ 94: 237,
+ 95: 243,
+ 96: 250,
+ 123: 231,
+ 124: 247,
+ 125: 209,
+ 126: 241,
+ 127: 9608,
+ 304: 174,
+ 305: 176,
+ 306: 189,
+ 307: 191,
+ 308: 8482,
+ 309: 162,
+ 310: 163,
+ 311: 9834,
+ 312: 224,
+ 313: 160,
+ 314: 232,
+ 315: 226,
+ 316: 234,
+ 317: 238,
+ 318: 244,
+ 319: 251,
+ 544: 193,
+ 545: 201,
+ 546: 211,
+ 547: 218,
+ 548: 220,
+ 549: 252,
+ 550: 8216,
+ 551: 161,
+ 552: 42,
+ 553: 39,
+ 554: 8212,
+ 555: 169,
+ 556: 8480,
+ 557: 8226,
+ 558: 8220,
+ 559: 8221,
+ 560: 192,
+ 561: 194,
+ 562: 199,
+ 563: 200,
+ 564: 202,
+ 565: 203,
+ 566: 235,
+ 567: 206,
+ 568: 207,
+ 569: 239,
+ 570: 212,
+ 571: 217,
+ 572: 249,
+ 573: 219,
+ 574: 171,
+ 575: 187,
+ 800: 195,
+ 801: 227,
+ 802: 205,
+ 803: 204,
+ 804: 236,
+ 805: 210,
+ 806: 242,
+ 807: 213,
+ 808: 245,
+ 809: 123,
+ 810: 125,
+ 811: 92,
+ 812: 94,
+ 813: 95,
+ 814: 124,
+ 815: 126,
+ 816: 196,
+ 817: 228,
+ 818: 214,
+ 819: 246,
+ 820: 223,
+ 821: 165,
+ 822: 164,
+ 823: 9474,
+ 824: 197,
+ 825: 229,
+ 826: 216,
+ 827: 248,
+ 828: 9484,
+ 829: 9488,
+ 830: 9492,
+ 831: 9496
+ },
+ Me = function(e) {
+ return null === e ? "" : (e = Ue[e] || e, String.fromCharCode(e))
+ },
+ Fe = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152],
+ Be = function() {
+ for (var e = [], t = 15; t--;) e.push("");
+ return e
+ },
+ Ne = function e(t, i) {
+ e.prototype.init.call(this), this.field_ = t || 0, this.dataChannel_ = i || 0, this.name_ = "CC" + (1 + (this.field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function(e) {
+ var t, i, n, r, a;
+ if ((t = 32639 & e.ccData) !== this.lastControlCode_) {
+ if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ = null), n = t >>> 8, r = 255 & t, t !== this.PADDING_)
+ if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn";
+ else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this.flushDisplayed(e.pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = i, this.startPts_ = e.pts;
+ else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts);
+ else if (t === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(e.pts);
+ else if (t === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(e.pts);
+ else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts), this.shiftRowsUp_(), this.startPts_ = e.pts;
+ else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
+ else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = Be();
+ else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = Be();
+ else if (t === this.RESUME_DIRECT_CAPTIONING_) "paintOn" !== this.mode_ && (this.flushDisplayed(e.pts), this.displayed_ = Be()), this.mode_ = "paintOn", this.startPts_ = e.pts;
+ else if (this.isSpecialCharacter(n, r)) a = Me((n = (3 & n) << 8) | r), this[this.mode_](e.pts, a), this.column_++;
+ else if (this.isExtCharacter(n, r)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1), a = Me((n = (3 & n) << 8) | r), this[this.mode_](e.pts, a), this.column_++;
+ else if (this.isMidRowCode(n, r)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this.column_++, 14 == (14 & r) && this.addFormatting(e.pts, ["i"]), 1 == (1 & r) && this.addFormatting(e.pts, ["u"]);
+ else if (this.isOffsetControlCode(n, r)) this.column_ += 3 & r;
+ else if (this.isPAC(n, r)) {
+ var s = Fe.indexOf(7968 & t);
+ "rollUp" === this.mode_ && (s - this.rollUpRows_ + 1 < 0 && (s = this.rollUpRows_ - 1), this.setRollUp(e.pts, s)), s !== this.row_ && (this.clearFormatting(e.pts), this.row_ = s), 1 & r && -1 === this.formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]), 16 == (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(r) && 14 == (14 & r) && this.addFormatting(e.pts, ["i"])
+ } else this.isNormalChar(n) && (0 === r && (r = null), a = Me(n), a += Me(r), this[this.mode_](e.pts, a), this.column_ += a.length)
+ } else this.lastControlCode_ = null
+ }
+ };
+ Ne.prototype = new V, Ne.prototype.flushDisplayed = function(e) {
+ var t = this.displayed_.map((function(e, t) {
+ try {
+ return e.trim()
+ } catch (e) {
+ return this.trigger("log", {
+ level: "warn",
+ message: "Skipping a malformed 608 caption at index " + t + "."
+ }), ""
+ }
+ }), this).join("\n").replace(/^\n+|\n+$/g, "");
+ t.length && this.trigger("data", {
+ startPts: this.startPts_,
+ endPts: e,
+ text: t,
+ stream: this.name_
+ })
+ }, Ne.prototype.reset = function() {
+ this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = Be(), this.nonDisplayed_ = Be(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this.rollUpRows_ = 2, this.formatting_ = []
+ }, Ne.prototype.setConstants = function() {
+ 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8, this.OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this.CONTROL_ = (28 | this.field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this.RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this.ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this.ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this.CARRIAGE_RETURN_ = 45 | this.CONTROL_, this.RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this.BACKSPACE_ = 33 | this.CONTROL_, this.ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this.ERASE_NON_DISPLAYED_MEMORY_ = 46 | this.CONTROL_
+ }, Ne.prototype.isSpecialCharacter = function(e, t) {
+ return e === this.EXT_ && t >= 48 && t <= 63
+ }, Ne.prototype.isExtCharacter = function(e, t) {
+ return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63
+ }, Ne.prototype.isMidRowCode = function(e, t) {
+ return e === this.EXT_ && t >= 32 && t <= 47
+ }, Ne.prototype.isOffsetControlCode = function(e, t) {
+ return e === this.OFFSET_ && t >= 33 && t <= 35
+ }, Ne.prototype.isPAC = function(e, t) {
+ return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127
+ }, Ne.prototype.isColorPAC = function(e) {
+ return e >= 64 && e <= 79 || e >= 96 && e <= 127
+ }, Ne.prototype.isNormalChar = function(e) {
+ return e >= 32 && e <= 127
+ }, Ne.prototype.setRollUp = function(e, t) {
+ if ("rollUp" !== this.mode_ && (this.row_ = 14, this.mode_ = "rollUp", this.flushDisplayed(e), this.nonDisplayed_ = Be(), this.displayed_ = Be()), void 0 !== t && t !== this.row_)
+ for (var i = 0; i < this.rollUpRows_; i++) this.displayed_[t - i] = this.displayed_[this.row_ - i], this.displayed_[this.row_ - i] = "";
+ void 0 === t && (t = this.row_), this.topRow_ = t - this.rollUpRows_ + 1
+ }, Ne.prototype.addFormatting = function(e, t) {
+ this.formatting_ = this.formatting_.concat(t);
+ var i = t.reduce((function(e, t) {
+ return e + "<" + t + ">"
+ }), "");
+ this[this.mode_](e, i)
+ }, Ne.prototype.clearFormatting = function(e) {
+ if (this.formatting_.length) {
+ var t = this.formatting_.reverse().reduce((function(e, t) {
+ return e + "</" + t + ">"
+ }), "");
+ this.formatting_ = [], this[this.mode_](e, t)
+ }
+ }, Ne.prototype.popOn = function(e, t) {
+ var i = this.nonDisplayed_[this.row_];
+ i += t, this.nonDisplayed_[this.row_] = i
+ }, Ne.prototype.rollUp = function(e, t) {
+ var i = this.displayed_[this.row_];
+ i += t, this.displayed_[this.row_] = i
+ }, Ne.prototype.shiftRowsUp_ = function() {
+ var e;
+ for (e = 0; e < this.topRow_; e++) this.displayed_[e] = "";
+ for (e = this.row_ + 1; e < 15; e++) this.displayed_[e] = "";
+ for (e = this.topRow_; e < this.row_; e++) this.displayed_[e] = this.displayed_[e + 1];
+ this.displayed_[this.row_] = ""
+ }, Ne.prototype.paintOn = function(e, t) {
+ var i = this.displayed_[this.row_];
+ i += t, this.displayed_[this.row_] = i
+ };
+ var je = {
+ CaptionStream: Ie,
+ Cea608Stream: Ne,
+ Cea708Stream: Oe
+ },
+ Ve = {
+ H264_STREAM_TYPE: 27,
+ ADTS_STREAM_TYPE: 15,
+ METADATA_STREAM_TYPE: 21
+ },
+ He = function(e, t) {
+ var i = 1;
+ for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i;
+ return e
+ },
+ ze = function e(t) {
+ var i, n;
+ e.prototype.init.call(this), this.type_ = t || "shared", this.push = function(e) {
+ "shared" !== this.type_ && e.type !== this.type_ || (void 0 === n && (n = e.dts), e.dts = He(e.dts, n), e.pts = He(e.pts, n), i = e.dts, this.trigger("data", e))
+ }, this.flush = function() {
+ n = i, this.trigger("done")
+ }, this.endTimeline = function() {
+ this.flush(), this.trigger("endedtimeline")
+ }, this.discontinuity = function() {
+ n = void 0, i = void 0
+ }, this.reset = function() {
+ this.discontinuity(), this.trigger("reset")
+ }
+ };
+ ze.prototype = new V;
+ var Ge, We = ze,
+ Ye = He,
+ qe = function(e, t, i) {
+ var n, r = "";
+ for (n = t; n < i; n++) r += "%" + ("00" + e[n].toString(16)).slice(-2);
+ return r
+ },
+ Ke = function(e, t, i) {
+ return decodeURIComponent(qe(e, t, i))
+ },
+ Xe = function(e) {
+ return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
+ },
+ Qe = {
+ TXXX: function(e) {
+ var t;
+ if (3 === e.data[0]) {
+ for (t = 1; t < e.data.length; t++)
+ if (0 === e.data[t]) {
+ e.description = Ke(e.data, 1, t), e.value = Ke(e.data, t + 1, e.data.length).replace(/\0*$/, "");
+ break
+ } e.data = e.value
+ }
+ },
+ WXXX: function(e) {
+ var t;
+ if (3 === e.data[0])
+ for (t = 1; t < e.data.length; t++)
+ if (0 === e.data[t]) {
+ e.description = Ke(e.data, 1, t), e.url = Ke(e.data, t + 1, e.data.length);
+ break
+ }
+ },
+ PRIV: function(e) {
+ var t, i;
+ for (t = 0; t < e.data.length; t++)
+ if (0 === e.data[t]) {
+ e.owner = (i = e.data, unescape(qe(i, 0, t)));
+ break
+ } e.privateData = e.data.subarray(t + 1), e.data = e.privateData
+ }
+ };
+ (Ge = function(e) {
+ var t, i = {
+ descriptor: e && e.descriptor
+ },
+ n = 0,
+ r = [],
+ a = 0;
+ if (Ge.prototype.init.call(this), this.dispatchType = Ve.METADATA_STREAM_TYPE.toString(16), i.descriptor)
+ for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(16)).slice(-2);
+ this.push = function(e) {
+ var t, i, s, o, u;
+ if ("timed-metadata" === e.type)
+ if (e.dataAlignmentIndicator && (a = 0, r.length = 0), 0 === r.length && (e.data.length < 10 || e.data[0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3".charCodeAt(0))) this.trigger("log", {
+ level: "warn",
+ message: "Skipping unrecognized metadata packet"
+ });
+ else if (r.push(e), a += e.data.byteLength, 1 === r.length && (n = Xe(e.data.subarray(6, 10)), n += 10), !(a < n)) {
+ for (t = {
+ data: new Uint8Array(n),
+ frames: [],
+ pts: r[0].pts,
+ dts: r[0].dts
+ }, u = 0; u < n;) t.data.set(r[0].data.subarray(0, n - u), u), u += r[0].data.byteLength, a -= r[0].data.byteLength, r.shift();
+ i = 10, 64 & t.data[5] && (i += 4, i += Xe(t.data.subarray(10, 14)), n -= Xe(t.data.subarray(16, 20)));
+ do {
+ if ((s = Xe(t.data.subarray(i + 4, i + 8))) < 1) return void this.trigger("log", {
+ level: "warn",
+ message: "Malformed ID3 frame encountered. Skipping metadata parsing."
+ });
+ if ((o = {
+ id: String.fromCharCode(t.data[i], t.data[i + 1], t.data[i + 2], t.data[i + 3]),
+ data: t.data.subarray(i + 10, i + s + 10)
+ }).key = o.id, Qe[o.id] && (Qe[o.id](o), "com.apple.streaming.transportStreamTimestamp" === o.owner)) {
+ var l = o.data,
+ h = (1 & l[3]) << 30 | l[4] << 22 | l[5] << 14 | l[6] << 6 | l[7] >>> 2;
+ h *= 4, h += 3 & l[7], o.timeStamp = h, void 0 === t.pts && void 0 === t.dts && (t.pts = o.timeStamp, t.dts = o.timeStamp), this.trigger("timestamp", o)
+ }
+ t.frames.push(o), i += 10, i += s
+ } while (i < n);
+ this.trigger("data", t)
+ }
+ }
+ }).prototype = new V;
+ var $e, Je, Ze, et = Ge,
+ tt = We;
+ ($e = function() {
+ var e = new Uint8Array(188),
+ t = 0;
+ $e.prototype.init.call(this), this.push = function(i) {
+ var n, r = 0,
+ a = 188;
+ for (t ? ((n = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), n.set(i, t), t = 0) : n = i; a < n.byteLength;) 71 !== n[r] || 71 !== n[a] ? (r++, a++) : (this.trigger("data", n.subarray(r, a)), r += 188, a += 188);
+ r < n.byteLength && (e.set(n.subarray(r), 0), t = n.byteLength - r)
+ }, this.flush = function() {
+ 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done")
+ }, this.endTimeline = function() {
+ this.flush(), this.trigger("endedtimeline")
+ }, this.reset = function() {
+ t = 0, this.trigger("reset")
+ }
+ }).prototype = new V, (Je = function() {
+ var e, t, i, n;
+ Je.prototype.init.call(this), n = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0, e = function(e, n) {
+ var r = 0;
+ n.payloadUnitStartIndicator && (r += e[r] + 1), "pat" === n.type ? t(e.subarray(r), n) : i(e.subarray(r), n)
+ }, t = function(e, t) {
+ t.section_number = e[7], t.last_section_number = e[8], n.pmtPid = (31 & e[10]) << 8 | e[11], t.pmtPid = n.pmtPid
+ }, i = function(e, t) {
+ var i, r;
+ if (1 & e[5]) {
+ for (n.programMapTable = {
+ video: null,
+ audio: null,
+ "timed-metadata": {}
+ }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, r = 12 + ((15 & e[10]) << 8 | e[11]); r < i;) {
+ var a = e[r],
+ s = (31 & e[r + 1]) << 8 | e[r + 2];
+ a === Ve.H264_STREAM_TYPE && null === n.programMapTable.video ? n.programMapTable.video = s : a === Ve.ADTS_STREAM_TYPE && null === n.programMapTable.audio ? n.programMapTable.audio = s : a === Ve.METADATA_STREAM_TYPE && (n.programMapTable["timed-metadata"][s] = a), r += 5 + ((15 & e[r + 3]) << 8 | e[r + 4])
+ }
+ t.programMapTable = n.programMapTable
+ }
+ }, this.push = function(t) {
+ var i = {},
+ n = 4;
+ if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[2], (48 & t[3]) >>> 4 > 1 && (n += t[n] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(n), i), this.trigger("data", i);
+ else if (i.pid === this.pmtPid)
+ for (i.type = "pmt", e(t.subarray(n), i), this.trigger("data", i); this.packetsWaitingForPmt.length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
+ else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, n, i]) : this.processPes_(t, n, i)
+ }, this.processPes_ = function(e, t, i) {
+ i.pid === this.programMapTable.video ? i.streamType = Ve.H264_STREAM_TYPE : i.pid === this.programMapTable.audio ? i.streamType = Ve.ADTS_STREAM_TYPE : i.streamType = this.programMapTable["timed-metadata"][i.pid], i.type = "pes", i.data = e.subarray(t), this.trigger("data", i)
+ }
+ }).prototype = new V, Je.STREAM_TYPES = {
+ h264: 27,
+ adts: 15
+ }, (Ze = function() {
+ var e, t = this,
+ i = !1,
+ n = {
+ data: [],
+ size: 0
+ },
+ r = {
+ data: [],
+ size: 0
+ },
+ a = {
+ data: [],
+ size: 0
+ },
+ s = function(e, i, n) {
+ var r, a, s = new Uint8Array(e.size),
+ o = {
+ type: i
+ },
+ u = 0,
+ l = 0;
+ if (e.data.length && !(e.size < 9)) {
+ for (o.trackId = e.data[0].pid, u = 0; u < e.data.length; u++) a = e.data[u], s.set(a.data, l), l += a.data.byteLength;
+ var h, d, c, f;
+ d = o, f = (h = s)[0] << 16 | h[1] << 8 | h[2], d.data = new Uint8Array, 1 === f && (d.packetLength = 6 + (h[4] << 8 | h[5]), d.dataAlignmentIndicator = 0 != (4 & h[6]), 192 & (c = h[7]) && (d.pts = (14 & h[9]) << 27 | (255 & h[10]) << 20 | (254 & h[11]) << 12 | (255 & h[12]) << 5 | (254 & h[13]) >>> 3, d.pts *= 4, d.pts += (6 & h[13]) >>> 1, d.dts = d.pts, 64 & c && (d.dts = (14 & h[14]) << 27 | (255 & h[15]) << 20 | (254 & h[16]) << 12 | (255 & h[17]) << 5 | (254 & h[18]) >>> 3, d.dts *= 4, d.dts += (6 & h[18]) >>> 1)), d.data = h.subarray(9 + h[8])), r = "video" === i || o.packetLength <= e.size, (n || r) && (e.size = 0, e.data.length = 0), r && t.trigger("data", o)
+ }
+ };
+ Ze.prototype.init.call(this), this.push = function(o) {
+ ({
+ pat: function() {},
+ pes: function() {
+ var e, t;
+ switch (o.streamType) {
+ case Ve.H264_STREAM_TYPE:
+ e = n, t = "video";
+ break;
+ case Ve.ADTS_STREAM_TYPE:
+ e = r, t = "audio";
+ break;
+ case Ve.METADATA_STREAM_TYPE:
+ e = a, t = "timed-metadata";
+ break;
+ default:
+ return
+ }
+ o.payloadUnitStartIndicator && s(e, t, !0), e.data.push(o), e.size += o.data.byteLength
+ },
+ pmt: function() {
+ var n = {
+ type: "metadata",
+ tracks: []
+ };
+ null !== (e = o.programMapTable).video && n.tracks.push({
+ timelineStartInfo: {
+ baseMediaDecodeTime: 0
+ },
+ id: +e.video,
+ codec: "avc",
+ type: "video"
+ }), null !== e.audio && n.tracks.push({
+ timelineStartInfo: {
+ baseMediaDecodeTime: 0
+ },
+ id: +e.audio,
+ codec: "adts",
+ type: "audio"
+ }), i = !0, t.trigger("data", n)
+ }
+ })[o.type]()
+ }, this.reset = function() {
+ n.size = 0, n.data.length = 0, r.size = 0, r.data.length = 0, this.trigger("reset")
+ }, this.flushStreams_ = function() {
+ s(n, "video"), s(r, "audio"), s(a, "timed-metadata")
+ }, this.flush = function() {
+ if (!i && e) {
+ var n = {
+ type: "metadata",
+ tracks: []
+ };
+ null !== e.video && n.tracks.push({
+ timelineStartInfo: {
+ baseMediaDecodeTime: 0
+ },
+ id: +e.video,
+ codec: "avc",
+ type: "video"
+ }), null !== e.audio && n.tracks.push({
+ timelineStartInfo: {
+ baseMediaDecodeTime: 0
+ },
+ id: +e.audio,
+ codec: "adts",
+ type: "audio"
+ }), t.trigger("data", n)
+ }
+ i = !1, this.flushStreams_(), this.trigger("done")
+ }
+ }).prototype = new V;
+ var it = {
+ PAT_PID: 0,
+ MP2T_PACKET_LENGTH: 188,
+ TransportPacketStream: $e,
+ TransportParseStream: Je,
+ ElementaryStream: Ze,
+ TimestampRolloverStream: tt,
+ CaptionStream: je.CaptionStream,
+ Cea608Stream: je.Cea608Stream,
+ Cea708Stream: je.Cea708Stream,
+ MetadataStream: et
+ };
+ for (var nt in Ve) Ve.hasOwnProperty(nt) && (it[nt] = Ve[nt]);
+ var rt, at = it,
+ st = he,
+ ot = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
+ (rt = function(e) {
+ var t, i = 0;
+ rt.prototype.init.call(this), this.skipWarn_ = function(e, t) {
+ this.trigger("log", {
+ level: "warn",
+ message: "adts skiping bytes " + e + " to " + t + " in frame " + i + " outside syncword"
+ })
+ }, this.push = function(n) {
+ var r, a, s, o, u, l = 0;
+ if (e || (i = 0), "audio" === n.type) {
+ var h;
+ for (t && t.length ? (s = t, (t = new Uint8Array(s.byteLength + n.data.byteLength)).set(s), t.set(n.data, s.byteLength)) : t = n.data; l + 7 < t.length;)
+ if (255 === t[l] && 240 == (246 & t[l + 1])) {
+ if ("number" == typeof h && (this.skipWarn_(h, l), h = null), a = 2 * (1 & ~t[l + 1]), r = (3 & t[l + 3]) << 11 | t[l + 4] << 3 | (224 & t[l + 5]) >> 5, u = (o = 1024 * (1 + (3 & t[l + 6]))) * st / ot[(60 & t[l + 2]) >>> 2], t.byteLength - l < r) break;
+ this.trigger("data", {
+ pts: n.pts + i * u,
+ dts: n.dts + i * u,
+ sampleCount: o,
+ audioobjecttype: 1 + (t[l + 2] >>> 6 & 3),
+ channelcount: (1 & t[l + 2]) << 2 | (192 & t[l + 3]) >>> 6,
+ samplerate: ot[(60 & t[l + 2]) >>> 2],
+ samplingfrequencyindex: (60 & t[l + 2]) >>> 2,
+ samplesize: 16,
+ data: t.subarray(l + 7 + a, l + r)
+ }), i++, l += r
+ } else "number" != typeof h && (h = l), l++;
+ "number" == typeof h && (this.skipWarn_(h, l), h = null), t = t.subarray(l)
+ }
+ }, this.flush = function() {
+ i = 0, this.trigger("done")
+ }, this.reset = function() {
+ t = void 0, this.trigger("reset")
+ }, this.endTimeline = function() {
+ t = void 0, this.trigger("endedtimeline")
+ }
+ }).prototype = new V;
+ var ut, lt, ht, dt = rt,
+ ct = function(e) {
+ var t = e.byteLength,
+ i = 0,
+ n = 0;
+ this.length = function() {
+ return 8 * t
+ }, this.bitsAvailable = function() {
+ return 8 * t + n
+ }, this.loadWord = function() {
+ var r = e.byteLength - t,
+ a = new Uint8Array(4),
+ s = Math.min(4, t);
+ if (0 === s) throw new Error("no bytes available");
+ a.set(e.subarray(r, r + s)), i = new DataView(a.buffer).getUint32(0), n = 8 * s, t -= s
+ }, this.skipBits = function(e) {
+ var r;
+ n > e ? (i <<= e, n -= e) : (e -= n, e -= 8 * (r = Math.floor(e / 8)), t -= r, this.loadWord(), i <<= e, n -= e)
+ }, this.readBits = function(e) {
+ var r = Math.min(n, e),
+ a = i >>> 32 - r;
+ return (n -= r) > 0 ? i <<= r : t > 0 && this.loadWord(), (r = e - r) > 0 ? a << r | this.readBits(r) : a
+ }, this.skipLeadingZeros = function() {
+ var e;
+ for (e = 0; e < n; ++e)
+ if (0 != (i & 2147483648 >>> e)) return i <<= e, n -= e, e;
+ return this.loadWord(), e + this.skipLeadingZeros()
+ }, this.skipUnsignedExpGolomb = function() {
+ this.skipBits(1 + this.skipLeadingZeros())
+ }, this.skipExpGolomb = function() {
+ this.skipBits(1 + this.skipLeadingZeros())
+ }, this.readUnsignedExpGolomb = function() {
+ var e = this.skipLeadingZeros();
+ return this.readBits(e + 1) - 1
+ }, this.readExpGolomb = function() {
+ var e = this.readUnsignedExpGolomb();
+ return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
+ }, this.readBoolean = function() {
+ return 1 === this.readBits(1)
+ }, this.readUnsignedByte = function() {
+ return this.readBits(8)
+ }, this.loadWord()
+ };
+ (lt = function() {
+ var e, t, i = 0;
+ lt.prototype.init.call(this), this.push = function(n) {
+ var r;
+ t ? ((r = new Uint8Array(t.byteLength + n.data.byteLength)).set(t), r.set(n.data, t.byteLength), t = r) : t = n.data;
+ for (var a = t.byteLength; i < a - 3; i++)
+ if (1 === t[i + 2]) {
+ e = i + 5;
+ break
+ } for (; e < a;) switch (t[e]) {
+ case 0:
+ if (0 !== t[e - 1]) {
+ e += 2;
+ break
+ }
+ if (0 !== t[e - 2]) {
+ e++;
+ break
+ }
+ i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2));
+ do {
+ e++
+ } while (1 !== t[e] && e < a);
+ i = e - 2, e += 3;
+ break;
+ case 1:
+ if (0 !== t[e - 1] || 0 !== t[e - 2]) {
+ e += 3;
+ break
+ }
+ this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3;
+ break;
+ default:
+ e += 3
+ }
+ t = t.subarray(i), e -= i, i = 0
+ }, this.reset = function() {
+ t = null, i = 0, this.trigger("reset")
+ }, this.flush = function() {
+ t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger("done")
+ }, this.endTimeline = function() {
+ this.flush(), this.trigger("endedtimeline")
+ }
+ }).prototype = new V, ht = {
+ 100: !0,
+ 110: !0,
+ 122: !0,
+ 244: !0,
+ 44: !0,
+ 83: !0,
+ 86: !0,
+ 118: !0,
+ 128: !0,
+ 138: !0,
+ 139: !0,
+ 134: !0
+ }, (ut = function() {
+ var e, t, i, n, r, a, s, o = new lt;
+ ut.prototype.init.call(this), e = this, this.push = function(e) {
+ "video" === e.type && (t = e.trackId, i = e.pts, n = e.dts, o.push(e))
+ }, o.on("data", (function(s) {
+ var o = {
+ trackId: t,
+ pts: i,
+ dts: n,
+ data: s,
+ nalUnitTypeCode: 31 & s[0]
+ };
+ switch (o.nalUnitTypeCode) {
+ case 5:
+ o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
+ break;
+ case 6:
+ o.nalUnitType = "sei_rbsp", o.escapedRBSP = r(s.subarray(1));
+ break;
+ case 7:
+ o.nalUnitType = "seq_parameter_set_rbsp", o.escapedRBSP = r(s.subarray(1)), o.config = a(o.escapedRBSP);
+ break;
+ case 8:
+ o.nalUnitType = "pic_parameter_set_rbsp";
+ break;
+ case 9:
+ o.nalUnitType = "access_unit_delimiter_rbsp"
+ }
+ e.trigger("data", o)
+ })), o.on("done", (function() {
+ e.trigger("done")
+ })), o.on("partialdone", (function() {
+ e.trigger("partialdone")
+ })), o.on("reset", (function() {
+ e.trigger("reset")
+ })), o.on("endedtimeline", (function() {
+ e.trigger("endedtimeline")
+ })), this.flush = function() {
+ o.flush()
+ }, this.partialFlush = function() {
+ o.partialFlush()
+ }, this.reset = function() {
+ o.reset()
+ }, this.endTimeline = function() {
+ o.endTimeline()
+ }, s = function(e, t) {
+ var i, n = 8,
+ r = 8;
+ for (i = 0; i < e; i++) 0 !== r && (r = (n + t.readExpGolomb() + 256) % 256), n = 0 === r ? n : r
+ }, r = function(e) {
+ for (var t, i, n = e.byteLength, r = [], a = 1; a < n - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (r.push(a + 2), a += 2) : a++;
+ if (0 === r.length) return e;
+ t = n - r.length, i = new Uint8Array(t);
+ var s = 0;
+ for (a = 0; a < t; s++, a++) s === r[0] && (s++, r.shift()), i[a] = e[s];
+ return i
+ }, a = function(e) {
+ var t, i, n, r, a, o, u, l, h, d, c, f, p = 0,
+ m = 0,
+ _ = 0,
+ g = 0,
+ v = [1, 1];
+ if (i = (t = new ct(e)).readUnsignedByte(), r = t.readUnsignedByte(), n = t.readUnsignedByte(), t.skipUnsignedExpGolomb(), ht[i] && (3 === (a = t.readUnsignedExpGolomb()) && t.skipBits(1), t.skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean()))
+ for (c = 3 !== a ? 8 : 12, f = 0; f < c; f++) t.readBoolean() && s(f < 6 ? 16 : 64, t);
+ if (t.skipUnsignedExpGolomb(), 0 === (o = t.readUnsignedExpGolomb())) t.readUnsignedExpGolomb();
+ else if (1 === o)
+ for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), u = t.readUnsignedExpGolomb(), f = 0; f < u; f++) t.skipExpGolomb();
+ if (t.skipUnsignedExpGolomb(), t.skipBits(1), l = t.readUnsignedExpGolomb(), h = t.readUnsignedExpGolomb(), 0 === (d = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t.readBoolean() && (p = t.readUnsignedExpGolomb(), m = t.readUnsignedExpGolomb(), _ = t.readUnsignedExpGolomb(), g = t.readUnsignedExpGolomb()), t.readBoolean() && t.readBoolean()) {
+ switch (t.readUnsignedByte()) {
+ case 1:
+ v = [1, 1];
+ break;
+ case 2:
+ v = [12, 11];
+ break;
+ case 3:
+ v = [10, 11];
+ break;
+ case 4:
+ v = [16, 11];
+ break;
+ case 5:
+ v = [40, 33];
+ break;
+ case 6:
+ v = [24, 11];
+ break;
+ case 7:
+ v = [20, 11];
+ break;
+ case 8:
+ v = [32, 11];
+ break;
+ case 9:
+ v = [80, 33];
+ break;
+ case 10:
+ v = [18, 11];
+ break;
+ case 11:
+ v = [15, 11];
+ break;
+ case 12:
+ v = [64, 33];
+ break;
+ case 13:
+ v = [160, 99];
+ break;
+ case 14:
+ v = [4, 3];
+ break;
+ case 15:
+ v = [3, 2];
+ break;
+ case 16:
+ v = [2, 1];
+ break;
+ case 255:
+ v = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t.readUnsignedByte()]
+ }
+ v && (v[0], v[1])
+ }
+ return {
+ profileIdc: i,
+ levelIdc: n,
+ profileCompatibility: r,
+ width: 16 * (l + 1) - 2 * p - 2 * m,
+ height: (2 - d) * (h + 1) * 16 - 2 * _ - 2 * g,
+ sarRatio: v
+ }
+ }
+ }).prototype = new V;
+ var ft, pt = {
+ H264Stream: ut,
+ NalByteStream: lt
+ },
+ mt = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350],
+ _t = function(e, t) {
+ var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
+ return i = i >= 0 ? i : 0, (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
+ },
+ gt = function(e) {
+ return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
+ },
+ vt = {
+ isLikelyAacData: function(e) {
+ var t = function e(t, i) {
+ return t.length - i < 10 || t[i] !== "I".charCodeAt(0) || t[i + 1] !== "D".charCodeAt(0) || t[i + 2] !== "3".charCodeAt(0) ? i : e(t, i += _t(t, i))
+ }(e, 0);
+ return e.length >= t + 2 && 255 == (255 & e[t]) && 240 == (240 & e[t + 1]) && 16 == (22 & e[t + 1])
+ },
+ parseId3TagSize: _t,
+ parseAdtsSize: function(e, t) {
+ var i = (224 & e[t + 5]) >> 5,
+ n = e[t + 4] << 3;
+ return 6144 & e[t + 3] | n | i
+ },
+ parseType: function(e, t) {
+ return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3".charCodeAt(0) ? "timed-metadata" : !0 & e[t] && 240 == (240 & e[t + 1]) ? "audio" : null
+ },
+ parseSampleRate: function(e) {
+ for (var t = 0; t + 5 < e.length;) {
+ if (255 === e[t] && 240 == (246 & e[t + 1])) return mt[(60 & e[t + 2]) >>> 2];
+ t++
+ }
+ return null
+ },
+ parseAacTimestamp: function(e) {
+ var t, i, n;
+ t = 10, 64 & e[5] && (t += 4, t += gt(e.subarray(10, 14)));
+ do {
+ if ((i = gt(e.subarray(t + 4, t + 8))) < 1) return null;
+ if ("PRIV" === String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3])) {
+ n = e.subarray(t + 10, t + i + 10);
+ for (var r = 0; r < n.byteLength; r++)
+ if (0 === n[r]) {
+ if ("com.apple.streaming.transportStreamTimestamp" === unescape(function(e, t, i) {
+ var n, r = "";
+ for (n = t; n < i; n++) r += "%" + ("00" + e[n].toString(16)).slice(-2);
+ return r
+ }(n, 0, r))) {
+ var a = n.subarray(r + 1),
+ s = (1 & a[3]) << 30 | a[4] << 22 | a[5] << 14 | a[6] << 6 | a[7] >>> 2;
+ return s *= 4, s += 3 & a[7]
+ }
+ break
+ }
+ }
+ t += 10, t += i
+ } while (t < e.byteLength);
+ return null
+ }
+ };
+ (ft = function() {
+ var e = new Uint8Array,
+ t = 0;
+ ft.prototype.init.call(this), this.setTimestamp = function(e) {
+ t = e
+ }, this.push = function(i) {
+ var n, r, a, s, o = 0,
+ u = 0;
+ for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e.set(i, s)) : e = i; e.length - u >= 3;)
+ if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3".charCodeAt(0))
+ if (255 != (255 & e[u]) || 240 != (240 & e[u + 1])) u++;
+ else {
+ if (e.length - u < 7) break;
+ if (u + (o = vt.parseAdtsSize(e, u)) > e.length) break;
+ a = {
+ type: "audio",
+ data: e.subarray(u, u + o),
+ pts: t,
+ dts: t
+ }, this.trigger("data", a), u += o
+ }
+ else {
+ if (e.length - u < 10) break;
+ if (u + (o = vt.parseId3TagSize(e, u)) > e.length) break;
+ r = {
+ type: "timed-metadata",
+ data: e.subarray(u, u + o)
+ }, this.trigger("data", r), u += o
+ }
+ n = e.length - u, e = n > 0 ? e.subarray(u) : new Uint8Array
+ }, this.reset = function() {
+ e = new Uint8Array, this.trigger("reset")
+ }, this.endTimeline = function() {
+ e = new Uint8Array, this.trigger("endedtimeline")
+ }
+ }).prototype = new V;
+ var yt, bt, St, Tt, Et = ft,
+ wt = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"],
+ At = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"],
+ Ct = pt.H264Stream,
+ kt = vt.isLikelyAacData,
+ Pt = he,
+ It = function(e, t) {
+ var i;
+ if (e.length !== t.length) return !1;
+ for (i = 0; i < e.length; i++)
+ if (e[i] !== t[i]) return !1;
+ return !0
+ },
+ Lt = function(e, t, i, n, r, a) {
+ return {
+ start: {
+ dts: e,
+ pts: e + (i - t)
+ },
+ end: {
+ dts: e + (n - t),
+ pts: e + (r - i)
+ },
+ prependedContentDuration: a,
+ baseMediaDecodeTime: e
+ }
+ };
+ (bt = function(e, t) {
+ var i, n = [],
+ r = 0,
+ a = 0,
+ s = 1 / 0;
+ i = (t = t || {}).firstSequenceNumber || 0, bt.prototype.init.call(this), this.push = function(t) {
+ Ee(e, t), e && wt.forEach((function(i) {
+ e[i] = t[i]
+ })), n.push(t)
+ }, this.setEarliestDts = function(e) {
+ r = e
+ }, this.setVideoBaseMediaDecodeTime = function(e) {
+ s = e
+ }, this.setAudioAppendStart = function(e) {
+ a = e
+ }, this.flush = function() {
+ var o, u, l, h, d, c, f;
+ 0 !== n.length ? (o = ge(n, e, r), e.baseMediaDecodeTime = Te(e, t.keepOriginalTimestamps), f = _e(e, o, a, s), e.samples = ve(o), l = $(ye(o)), n = [], u = J(i, [e]), h = new Uint8Array(u.byteLength + l.byteLength), i++, h.set(u), h.set(l, u.byteLength), Se(e), d = Math.ceil(1024 * Pt / e.samplerate), o.length && (c = o.length * d, this.trigger("segmentTimingInfo", Lt(fe(e.baseMediaDecodeTime, e.samplerate), o[0].dts, o[0].pts, o[0].dts + c, o[0].pts + c, f || 0)), this.trigger("timingInfo", {
+ start: o[0].pts,
+ end: o[0].pts + c
+ })), this.trigger("data", {
+ track: e,
+ boxes: h
+ }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream")
+ }, this.reset = function() {
+ Se(e), n = [], this.trigger("reset")
+ }
+ }).prototype = new V, (yt = function(e, t) {
+ var i, n, r, a = [],
+ s = [];
+ i = (t = t || {}).firstSequenceNumber || 0, yt.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function(t) {
+ Ee(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || n || (n = t.config, e.sps = [t.data], At.forEach((function(t) {
+ e[t] = n[t]
+ }), this)), "pic_parameter_set_rbsp" !== t.nalUnitType || r || (r = t.data, e.pps = [t.data]), a.push(t)
+ }, this.flush = function() {
+ for (var n, r, o, u, l, h, d, c, f = 0; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType;) a.shift();
+ if (0 === a.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream");
+ if (n = te(a), (o = ie(n))[0][0].keyFrame || ((r = this.getGopForFusion_(a[0], e)) ? (f = r.duration, o.unshift(r), o.byteLength += r.byteLength, o.nalCount += r.nalCount, o.pts = r.pts, o.dts = r.dts, o.duration += r.duration) : o = ne(o)), s.length) {
+ var p;
+ if (!(p = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o))) return this.gopCache_.unshift({
+ gop: o.pop(),
+ pps: e.pps,
+ sps: e.sps
+ }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.resetStream_(), void this.trigger("done", "VideoSegmentStream");
+ Se(e), o = p
+ }
+ Ee(e, o), e.samples = re(o), l = $(ae(o)), e.baseMediaDecodeTime = Te(e, t.keepOriginalTimestamps), this.trigger("processedGopsInfo", o.map((function(e) {
+ return {
+ pts: e.pts,
+ dts: e.dts,
+ byteLength: e.byteLength
+ }
+ }))), d = o[0], c = o[o.length - 1], this.trigger("segmentTimingInfo", Lt(e.baseMediaDecodeTime, d.dts, d.pts, c.dts + c.duration, c.pts + c.duration, f)), this.trigger("timingInfo", {
+ start: o[0].pts,
+ end: o[o.length - 1].pts + o[o.length - 1].duration
+ }), this.gopCache_.unshift({
+ gop: o.pop(),
+ pps: e.pps,
+ sps: e.sps
+ }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.trigger("baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e.timelineStartInfo), u = J(i, [e]), h = new Uint8Array(u.byteLength + l.byteLength), i++, h.set(u), h.set(l, u.byteLength), this.trigger("data", {
+ track: e,
+ boxes: h
+ }), this.resetStream_(), this.trigger("done", "VideoSegmentStream")
+ }, this.reset = function() {
+ this.resetStream_(), a = [], this.gopCache_.length = 0, s.length = 0, this.trigger("reset")
+ }, this.resetStream_ = function() {
+ Se(e), n = void 0, r = void 0
+ }, this.getGopForFusion_ = function(t) {
+ var i, n, r, a, s, o = 1 / 0;
+ for (s = 0; s < this.gopCache_.length; s++) r = (a = this.gopCache_[s]).gop, e.pps && It(e.pps[0], a.pps[0]) && e.sps && It(e.sps[0], a.sps[0]) && (r.dts < e.timelineStartInfo.dts || (i = t.dts - r.dts - r.duration) >= -1e4 && i <= 45e3 && (!n || o > i) && (n = a, o = i));
+ return n ? n.gop : null
+ }, this.alignGopsAtStart_ = function(e) {
+ var t, i, n, r, a, o, u, l;
+ for (a = e.byteLength, o = e.nalCount, u = e.duration, t = i = 0; t < s.length && i < e.length && (n = s[t], r = e[i], n.pts !== r.pts);) r.pts > n.pts ? t++ : (i++, a -= r.byteLength, o -= r.nalCount, u -= r.duration);
+ return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l.nalCount = o, l.pts = l[0].pts, l.dts = l[0].dts, l)
+ }, this.alignGopsAtEnd_ = function(e) {
+ var t, i, n, r, a, o, u;
+ for (t = s.length - 1, i = e.length - 1, a = null, o = !1; t >= 0 && i >= 0;) {
+ if (n = s[t], r = e[i], n.pts === r.pts) {
+ o = !0;
+ break
+ }
+ n.pts > r.pts ? t-- : (t === s.length - 1 && (a = i), i--)
+ }
+ if (!o && null === a) return null;
+ if (0 === (u = o ? i : a)) return e;
+ var l = e.slice(u),
+ h = l.reduce((function(e, t) {
+ return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e
+ }), {
+ byteLength: 0,
+ duration: 0,
+ nalCount: 0
+ });
+ return l.byteLength = h.byteLength, l.duration = h.duration, l.nalCount = h.nalCount, l.pts = l[0].pts, l.dts = l[0].dts, l
+ }, this.alignGopsWith = function(e) {
+ s = e
+ }
+ }).prototype = new V, (Tt = function(e, t) {
+ this.numberOfTracks = 0, this.metadataStream = t, void 0 !== (e = e || {}).remux ? this.remuxTracks = !!e.remux : this.remuxTracks = !0, "boolean" == typeof e.keepOriginalTimestamps ? this.keepOriginalTimestamps = e.keepOriginalTimestamps : this.keepOriginalTimestamps = !1, this.pendingTracks = [], this.videoTrack = null, this.pendingBoxes = [], this.pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, Tt.prototype.init.call(this), this.push = function(e) {
+ return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this.pendingTracks.push(e.track), this.pendingBytes += e.boxes.byteLength, "video" === e.track.type && (this.videoTrack = e.track, this.pendingBoxes.push(e.boxes)), void("audio" === e.track.type && (this.audioTrack = e.track, this.pendingBoxes.unshift(e.boxes))))
+ }
+ }).prototype = new V, Tt.prototype.flush = function(e) {
+ var t, i, n, r, a = 0,
+ s = {
+ captions: [],
+ captionStreams: {},
+ metadata: [],
+ info: {}
+ },
+ o = 0;
+ if (this.pendingTracks.length < this.numberOfTracks) {
+ if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return;
+ if (this.remuxTracks) return;
+ if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this.numberOfTracks && (this.trigger("done"), this.emittedTracks = 0))
+ }
+ if (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, At.forEach((function(e) {
+ s.info[e] = this.videoTrack[e]
+ }), this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, wt.forEach((function(e) {
+ s.info[e] = this.audioTrack[e]
+ }), this)), this.videoTrack || this.audioTrack) {
+ for (1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type = "combined", this.emittedTracks += this.pendingTracks.length, n = Z(this.pendingTracks), s.initSegment = new Uint8Array(n.byteLength), s.initSegment.set(n), s.data = new Uint8Array(this.pendingBytes), r = 0; r < this.pendingBoxes.length; r++) s.data.set(this.pendingBoxes[r], a), a += this.pendingBoxes[r].byteLength;
+ for (r = 0; r < this.pendingCaptions.length; r++)(t = this.pendingCaptions[r]).startTime = me(t.startPts, o, this.keepOriginalTimestamps), t.endTime = me(t.endPts, o, this.keepOriginalTimestamps), s.captionStreams[t.stream] = !0, s.captions.push(t);
+ for (r = 0; r < this.pendingMetadata.length; r++)(i = this.pendingMetadata[r]).cueTime = me(i.pts, o, this.keepOriginalTimestamps), s.metadata.push(i);
+ for (s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this.videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger("data", s), r = 0; r < s.captions.length; r++) t = s.captions[r], this.trigger("caption", t);
+ for (r = 0; r < s.metadata.length; r++) i = s.metadata[r], this.trigger("id3Frame", i)
+ }
+ this.emittedTracks >= this.numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)
+ }, Tt.prototype.setRemux = function(e) {
+ this.remuxTracks = e
+ }, (St = function(e) {
+ var t, i, n = this,
+ r = !0;
+ St.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this.transmuxPipeline_ = {}, this.setupAacPipeline = function() {
+ var r = {};
+ this.transmuxPipeline_ = r, r.type = "aac", r.metadataStream = new at.MetadataStream, r.aacStream = new Et, r.audioTimestampRolloverStream = new at.TimestampRolloverStream("audio"), r.timedMetadataTimestampRolloverStream = new at.TimestampRolloverStream("timed-metadata"), r.adtsStream = new dt, r.coalesceStream = new Tt(e, r.metadataStream), r.headOfPipeline = r.aacStream, r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream), r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream), r.metadataStream.on("timestamp", (function(e) {
+ r.aacStream.setTimestamp(e.timeStamp)
+ })), r.aacStream.on("data", (function(a) {
+ "timed-metadata" !== a.type && "audio" !== a.type || r.audioSegmentStream || (i = i || {
+ timelineStartInfo: {
+ baseMediaDecodeTime: n.baseMediaDecodeTime
+ },
+ codec: "adts",
+ type: "audio"
+ }, r.coalesceStream.numberOfTracks++, r.audioSegmentStream = new bt(i, e), r.audioSegmentStream.on("log", n.getLogTrigger_("audioSegmentStream")), r.audioSegmentStream.on("timingInfo", n.trigger.bind(n, "audioTimingInfo")), r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream), n.trigger("trackinfo", {
+ hasAudio: !!i,
+ hasVideo: !!t
+ }))
+ })), r.coalesceStream.on("data", this.trigger.bind(this, "data")), r.coalesceStream.on("done", this.trigger.bind(this, "done"))
+ }, this.setupTsPipeline = function() {
+ var r = {};
+ this.transmuxPipeline_ = r, r.type = "ts", r.metadataStream = new at.MetadataStream, r.packetStream = new at.TransportPacketStream, r.parseStream = new at.TransportParseStream, r.elementaryStream = new at.ElementaryStream, r.timestampRolloverStream = new at.TimestampRolloverStream, r.adtsStream = new dt, r.h264Stream = new Ct, r.captionStream = new at.CaptionStream(e), r.coalesceStream = new Tt(e, r.metadataStream), r.headOfPipeline = r.packetStream, r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream), r.timestampRolloverStream.pipe(r.h264Stream), r.timestampRolloverStream.pipe(r.adtsStream), r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream), r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream), r.elementaryStream.on("data", (function(a) {
+ var s;
+ if ("metadata" === a.type) {
+ for (s = a.tracks.length; s--;) t || "video" !== a.tracks[s].type ? i || "audio" !== a.tracks[s].type || ((i = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = n.baseMediaDecodeTime) : (t = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = n.baseMediaDecodeTime;
+ t && !r.videoSegmentStream && (r.coalesceStream.numberOfTracks++, r.videoSegmentStream = new yt(t, e), r.videoSegmentStream.on("log", n.getLogTrigger_("videoSegmentStream")), r.videoSegmentStream.on("timelineStartInfo", (function(t) {
+ i && !e.keepOriginalTimestamps && (i.timelineStartInfo = t, r.audioSegmentStream.setEarliestDts(t.dts - n.baseMediaDecodeTime))
+ })), r.videoSegmentStream.on("processedGopsInfo", n.trigger.bind(n, "gopInfo")), r.videoSegmentStream.on("segmentTimingInfo", n.trigger.bind(n, "videoSegmentTimingInfo")), r.videoSegmentStream.on("baseMediaDecodeTime", (function(e) {
+ i && r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)
+ })), r.videoSegmentStream.on("timingInfo", n.trigger.bind(n, "videoTimingInfo")), r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)), i && !r.audioSegmentStream && (r.coalesceStream.numberOfTracks++, r.audioSegmentStream = new bt(i, e), r.audioSegmentStream.on("log", n.getLogTrigger_("audioSegmentStream")), r.audioSegmentStream.on("timingInfo", n.trigger.bind(n, "audioTimingInfo")), r.audioSegmentStream.on("segmentTimingInfo", n.trigger.bind(n, "audioSegmentTimingInfo")), r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)), n.trigger("trackinfo", {
+ hasAudio: !!i,
+ hasVideo: !!t
+ })
+ }
+ })), r.coalesceStream.on("data", this.trigger.bind(this, "data")), r.coalesceStream.on("id3Frame", (function(e) {
+ e.dispatchType = r.metadataStream.dispatchType, n.trigger("id3Frame", e)
+ })), r.coalesceStream.on("caption", this.trigger.bind(this, "caption")), r.coalesceStream.on("done", this.trigger.bind(this, "done"))
+ }, this.setBaseMediaDecodeTime = function(n) {
+ var r = this.transmuxPipeline_;
+ e.keepOriginalTimestamps || (this.baseMediaDecodeTime = n), i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo.pts = void 0, Se(i), r.audioTimestampRolloverStream && r.audioTimestampRolloverStream.discontinuity()), t && (r.videoSegmentStream && (r.videoSegmentStream.gopCache_ = []), t.timelineStartInfo.dts = void 0, t.timelineStartInfo.pts = void 0, Se(t), r.captionStream.reset()), r.timestampRolloverStream && r.timestampRolloverStream.discontinuity()
+ }, this.setAudioAppendStart = function(e) {
+ i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)
+ }, this.setRemux = function(t) {
+ var i = this.transmuxPipeline_;
+ e.remux = t, i && i.coalesceStream && i.coalesceStream.setRemux(t)
+ }, this.alignGopsWith = function(e) {
+ t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)
+ }, this.getLogTrigger_ = function(e) {
+ var t = this;
+ return function(i) {
+ i.stream = e, t.trigger("log", i)
+ }
+ }, this.push = function(e) {
+ if (r) {
+ var t = kt(e);
+ if (t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this.transmuxPipeline_.type || this.setupTsPipeline(), this.transmuxPipeline_)
+ for (var i = Object.keys(this.transmuxPipeline_), n = 0; n < i.length; n++) {
+ var a = i[n];
+ "headOfPipeline" !== a && this.transmuxPipeline_[a].on && this.transmuxPipeline_[a].on("log", this.getLogTrigger_(a))
+ }
+ r = !1
+ }
+ this.transmuxPipeline_.headOfPipeline.push(e)
+ }, this.flush = function() {
+ r = !0, this.transmuxPipeline_.headOfPipeline.flush()
+ }, this.endTimeline = function() {
+ this.transmuxPipeline_.headOfPipeline.endTimeline()
+ }, this.reset = function() {
+ this.transmuxPipeline_.headOfPipeline && this.transmuxPipeline_.headOfPipeline.reset()
+ }, this.resetCaptions = function() {
+ this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset()
+ }
+ }).prototype = new V;
+ var xt, Rt, Dt, Ot = {
+ Transmuxer: St,
+ VideoSegmentStream: yt,
+ AudioSegmentStream: bt,
+ AUDIO_PROPERTIES: wt,
+ VIDEO_PROPERTIES: At,
+ generateSegmentTimingInfo: Lt
+ },
+ Ut = function(e) {
+ return e >>> 0
+ },
+ Mt = function(e) {
+ var t = "";
+ return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[2]), t += String.fromCharCode(e[3])
+ },
+ Ft = Ut,
+ Bt = function e(t, i) {
+ var n, r, a, s, o, u = [];
+ if (!i.length) return null;
+ for (n = 0; n < t.byteLength;) r = Ft(t[n] << 24 | t[n + 1] << 16 | t[n + 2] << 8 | t[n + 3]), a = Mt(t.subarray(n + 4, n + 8)), s = r > 1 ? n + r : t.byteLength, a === i[0] && (1 === i.length ? u.push(t.subarray(n + 8, s)) : (o = e(t.subarray(n + 8, s), i.slice(1))).length && (u = u.concat(o))), n = s;
+ return u
+ },
+ Nt = Ut,
+ jt = function(e) {
+ var t = {
+ version: e[0],
+ flags: new Uint8Array(e.subarray(1, 4)),
+ baseMediaDecodeTime: Nt(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7])
+ };
+ return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32), t.baseMediaDecodeTime += Nt(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])), t
+ },
+ Vt = function(e) {
+ return {
+ isLeading: (12 & e[0]) >>> 2,
+ dependsOn: 3 & e[0],
+ isDependedOn: (192 & e[1]) >>> 6,
+ hasRedundancy: (48 & e[1]) >>> 4,
+ paddingValue: (14 & e[1]) >>> 1,
+ isNonSyncSample: 1 & e[1],
+ degradationPriority: e[2] << 8 | e[3]
+ }
+ },
+ Ht = function(e) {
+ var t, i = {
+ version: e[0],
+ flags: new Uint8Array(e.subarray(1, 4)),
+ samples: []
+ },
+ n = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ r = 1 & i.flags[2],
+ a = 4 & i.flags[2],
+ s = 1 & i.flags[1],
+ o = 2 & i.flags[1],
+ u = 4 & i.flags[1],
+ l = 8 & i.flags[1],
+ h = n.getUint32(4),
+ d = 8;
+ for (r && (i.dataOffset = n.getInt32(d), d += 4), a && h && (t = {
+ flags: Vt(e.subarray(d, d + 4))
+ }, d += 4, s && (t.duration = n.getUint32(d), d += 4), o && (t.size = n.getUint32(d), d += 4), l && (1 === i.version ? t.compositionTimeOffset = n.getInt32(d) : t.compositionTimeOffset = n.getUint32(d), d += 4), i.samples.push(t), h--); h--;) t = {}, s && (t.duration = n.getUint32(d), d += 4), o && (t.size = n.getUint32(d), d += 4), u && (t.flags = Vt(e.subarray(d, d + 4)), d += 4), l && (1 === i.version ? t.compositionTimeOffset = n.getInt32(d) : t.compositionTimeOffset = n.getUint32(d), d += 4), i.samples.push(t);
+ return i
+ },
+ zt = function(e) {
+ var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ n = {
+ version: e[0],
+ flags: new Uint8Array(e.subarray(1, 4)),
+ trackId: i.getUint32(4)
+ },
+ r = 1 & n.flags[2],
+ a = 2 & n.flags[2],
+ s = 8 & n.flags[2],
+ o = 16 & n.flags[2],
+ u = 32 & n.flags[2],
+ l = 65536 & n.flags[0],
+ h = 131072 & n.flags[0];
+ return t = 8, r && (t += 4, n.baseDataOffset = i.getUint32(12), t += 4), a && (n.sampleDescriptionIndex = i.getUint32(t), t += 4), s && (n.defaultSampleDuration = i.getUint32(t), t += 4), o && (n.defaultSampleSize = i.getUint32(t), t += 4), u && (n.defaultSampleFlags = i.getUint32(t)), l && (n.durationIsEmpty = !0), !r && h && (n.baseDataOffsetIsMoof = !0), n
+ },
+ Gt = ke,
+ Wt = je.CaptionStream,
+ Yt = function(e, t) {
+ for (var i = e, n = 0; n < t.length; n++) {
+ var r = t[n];
+ if (i < r.size) return r;
+ i -= r.size
+ }
+ return null
+ },
+ qt = function(e, t) {
+ var i = Bt(e, ["moof", "traf"]),
+ n = Bt(e, ["mdat"]),
+ r = {},
+ a = [];
+ return n.forEach((function(e, t) {
+ var n = i[t];
+ a.push({
+ mdat: e,
+ traf: n
+ })
+ })), a.forEach((function(e) {
+ var i, n = e.mdat,
+ a = e.traf,
+ s = Bt(a, ["tfhd"]),
+ o = zt(s[0]),
+ u = o.trackId,
+ l = Bt(a, ["tfdt"]),
+ h = l.length > 0 ? jt(l[0]).baseMediaDecodeTime : 0,
+ d = Bt(a, ["trun"]);
+ t === u && d.length > 0 && (i = function(e, t, i) {
+ var n, r, a, s, o = new DataView(e.buffer, e.byteOffset, e.byteLength),
+ u = {
+ logs: [],
+ seiNals: []
+ };
+ for (r = 0; r + 4 < e.length; r += a)
+ if (a = o.getUint32(r), r += 4, !(a <= 0)) switch (31 & e[r]) {
+ case 6:
+ var l = e.subarray(r + 1, r + 1 + a),
+ h = Yt(r, t);
+ if (n = {
+ nalUnitType: "sei_rbsp",
+ size: a,
+ data: l,
+ escapedRBSP: Gt(l),
+ trackId: i
+ }, h) n.pts = h.pts, n.dts = h.dts, s = h;
+ else {
+ if (!s) {
+ u.logs.push({
+ level: "warn",
+ message: "We've encountered a nal unit without data at " + r + " for trackId " + i + ". See mux.js#223."
+ });
+ break
+ }
+ n.pts = s.pts, n.dts = s.dts
+ }
+ u.seiNals.push(n)
+ }
+ return u
+ }(n, function(e, t, i) {
+ var n = t,
+ r = i.defaultSampleDuration || 0,
+ a = i.defaultSampleSize || 0,
+ s = i.trackId,
+ o = [];
+ return e.forEach((function(e) {
+ var t = Ht(e).samples;
+ t.forEach((function(e) {
+ void 0 === e.duration && (e.duration = r), void 0 === e.size && (e.size = a), e.trackId = s, e.dts = n, void 0 === e.compositionTimeOffset && (e.compositionTimeOffset = 0), e.pts = n + e.compositionTimeOffset, n += e.duration
+ })), o = o.concat(t)
+ })), o
+ }(d, h, o), u), r[u] || (r[u] = {
+ seiNals: [],
+ logs: []
+ }), r[u].seiNals = r[u].seiNals.concat(i.seiNals), r[u].logs = r[u].logs.concat(i.logs))
+ })), r
+ },
+ Kt = function() {
+ var e, t, i, n, r, a, s = !1;
+ this.isInitialized = function() {
+ return s
+ }, this.init = function(t) {
+ e = new Wt, s = !0, a = !!t && t.isPartial, e.on("data", (function(e) {
+ e.startTime = e.startPts / n, e.endTime = e.endPts / n, r.captions.push(e), r.captionStreams[e.stream] = !0
+ })), e.on("log", (function(e) {
+ r.logs.push(e)
+ }))
+ }, this.isNewInit = function(e, t) {
+ return !(e && 0 === e.length || t && "object" == typeof t && 0 === Object.keys(t).length) && (i !== e[0] || n !== t[i])
+ }, this.parse = function(e, a, s) {
+ var o;
+ if (!this.isInitialized()) return null;
+ if (!a || !s) return null;
+ if (this.isNewInit(a, s)) i = a[0], n = s[i];
+ else if (null === i || !n) return t.push(e), null;
+ for (; t.length > 0;) {
+ var u = t.shift();
+ this.parse(u, a, s)
+ }
+ return (o = function(e, t, i) {
+ if (null === t) return null;
+ var n = qt(e, t)[t] || {};
+ return {
+ seiNals: n.seiNals,
+ logs: n.logs,
+ timescale: i
+ }
+ }(e, i, n)) && o.logs && (r.logs = r.logs.concat(o.logs)), null !== o && o.seiNals ? (this.pushNals(o.seiNals), this.flushStream(), r) : r.logs.length ? {
+ logs: r.logs,
+ captions: [],
+ captionStreams: []
+ } : null
+ }, this.pushNals = function(t) {
+ if (!this.isInitialized() || !t || 0 === t.length) return null;
+ t.forEach((function(t) {
+ e.push(t)
+ }))
+ }, this.flushStream = function() {
+ if (!this.isInitialized()) return null;
+ a ? e.partialFlush() : e.flush()
+ }, this.clearParsedCaptions = function() {
+ r.captions = [], r.captionStreams = {}, r.logs = []
+ }, this.resetCaptionStream = function() {
+ if (!this.isInitialized()) return null;
+ e.reset()
+ }, this.clearAllCaptions = function() {
+ this.clearParsedCaptions(), this.resetCaptionStream()
+ }, this.reset = function() {
+ t = [], i = null, n = null, r ? this.clearParsedCaptions() : r = {
+ captions: [],
+ captionStreams: {},
+ logs: []
+ }, this.resetCaptionStream()
+ }, this.reset()
+ },
+ Xt = Ut,
+ Qt = function(e) {
+ return ("00" + e.toString(16)).slice(-2)
+ };
+ xt = function(e, t) {
+ var i, n, r;
+ return i = Bt(t, ["moof", "traf"]), n = [].concat.apply([], i.map((function(t) {
+ return Bt(t, ["tfhd"]).map((function(i) {
+ var n, r, a;
+ return n = Xt(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]), r = e[n] || 9e4, (a = "number" != typeof(a = Bt(t, ["tfdt"]).map((function(e) {
+ var t, i;
+ return t = e[0], i = Xt(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]), 1 === t && (i *= Math.pow(2, 32), i += Xt(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])), i
+ }))[0]) || isNaN(a) ? 1 / 0 : a) / r
+ }))
+ }))), r = Math.min.apply(null, n), isFinite(r) ? r : 0
+ }, Rt = function(e) {
+ var t = Bt(e, ["moov", "trak"]),
+ i = [];
+ return t.forEach((function(e) {
+ var t, n, r = {},
+ a = Bt(e, ["tkhd"])[0];
+ a && (n = (t = new DataView(a.buffer, a.byteOffset, a.byteLength)).getUint8(0), r.id = 0 === n ? t.getUint32(12) : t.getUint32(20));
+ var s = Bt(e, ["mdia", "hdlr"])[0];
+ if (s) {
+ var o = Mt(s.subarray(8, 12));
+ r.type = "vide" === o ? "video" : "soun" === o ? "audio" : o
+ }
+ var u = Bt(e, ["mdia", "minf", "stbl", "stsd"])[0];
+ if (u) {
+ var l = u.subarray(8);
+ r.codec = Mt(l.subarray(4, 8));
+ var h, d = Bt(l, [r.codec])[0];
+ d && (/^[a-z]vc[1-9]$/i.test(r.codec) ? (h = d.subarray(78), "avcC" === Mt(h.subarray(4, 8)) && h.length > 11 ? (r.codec += ".", r.codec += Qt(h[9]), r.codec += Qt(h[10]), r.codec += Qt(h[11])) : r.codec = "avc1.4d400d") : /^mp4[a,v]$/i.test(r.codec) ? (h = d.subarray(28), "esds" === Mt(h.subarray(4, 8)) && h.length > 20 && 0 !== h[19] ? (r.codec += "." + Qt(h[19]), r.codec += "." + Qt(h[20] >>> 2 & 63).replace(/^0/, "")) : r.codec = "mp4a.40.2") : r.codec = r.codec.toLowerCase())
+ }
+ var c = Bt(e, ["mdia", "mdhd"])[0];
+ c && (r.timescale = Dt(c)), i.push(r)
+ })), i
+ };
+ var $t = xt,
+ Jt = Rt,
+ Zt = (Dt = function(e) {
+ var t = 0 === e[0] ? 12 : 20;
+ return Xt(e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3])
+ }, function(e) {
+ var t = 31 & e[1];
+ return t <<= 8, t |= e[2]
+ }),
+ ei = function(e) {
+ return !!(64 & e[1])
+ },
+ ti = function(e) {
+ var t = 0;
+ return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1), t
+ },
+ ii = function(e) {
+ switch (e) {
+ case 5:
+ return "slice_layer_without_partitioning_rbsp_idr";
+ case 6:
+ return "sei_rbsp";
+ case 7:
+ return "seq_parameter_set_rbsp";
+ case 8:
+ return "pic_parameter_set_rbsp";
+ case 9:
+ return "access_unit_delimiter_rbsp";
+ default:
+ return null
+ }
+ },
+ ni = {
+ parseType: function(e, t) {
+ var i = Zt(e);
+ return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null
+ },
+ parsePat: function(e) {
+ var t = ei(e),
+ i = 4 + ti(e);
+ return t && (i += e[i] + 1), (31 & e[i + 10]) << 8 | e[i + 11]
+ },
+ parsePmt: function(e) {
+ var t = {},
+ i = ei(e),
+ n = 4 + ti(e);
+ if (i && (n += e[n] + 1), 1 & e[n + 5]) {
+ var r;
+ r = 3 + ((15 & e[n + 1]) << 8 | e[n + 2]) - 4;
+ for (var a = 12 + ((15 & e[n + 10]) << 8 | e[n + 11]); a < r;) {
+ var s = n + a;
+ t[(31 & e[s + 1]) << 8 | e[s + 2]] = e[s], a += 5 + ((15 & e[s + 3]) << 8 | e[s + 4])
+ }
+ return t
+ }
+ },
+ parsePayloadUnitStartIndicator: ei,
+ parsePesType: function(e, t) {
+ switch (t[Zt(e)]) {
+ case Ve.H264_STREAM_TYPE:
+ return "video";
+ case Ve.ADTS_STREAM_TYPE:
+ return "audio";
+ case Ve.METADATA_STREAM_TYPE:
+ return "timed-metadata";
+ default:
+ return null
+ }
+ },
+ parsePesTime: function(e) {
+ if (!ei(e)) return null;
+ var t = 4 + ti(e);
+ if (t >= e.byteLength) return null;
+ var i, n = null;
+ return 192 & (i = e[t + 7]) && ((n = {}).pts = (14 & e[t + 9]) << 27 | (255 & e[t + 10]) << 20 | (254 & e[t + 11]) << 12 | (255 & e[t + 12]) << 5 | (254 & e[t + 13]) >>> 3, n.pts *= 4, n.pts += (6 & e[t + 13]) >>> 1, n.dts = n.pts, 64 & i && (n.dts = (14 & e[t + 14]) << 27 | (255 & e[t + 15]) << 20 | (254 & e[t + 16]) << 12 | (255 & e[t + 17]) << 5 | (254 & e[t + 18]) >>> 3, n.dts *= 4, n.dts += (6 & e[t + 18]) >>> 1)), n
+ },
+ videoPacketContainsKeyFrame: function(e) {
+ for (var t = 4 + ti(e), i = e.subarray(t), n = 0, r = 0, a = !1; r < i.byteLength - 3; r++)
+ if (1 === i[r + 2]) {
+ n = r + 5;
+ break
+ } for (; n < i.byteLength;) switch (i[n]) {
+ case 0:
+ if (0 !== i[n - 1]) {
+ n += 2;
+ break
+ }
+ if (0 !== i[n - 2]) {
+ n++;
+ break
+ }
+ r + 3 !== n - 2 && "slice_layer_without_partitioning_rbsp_idr" === ii(31 & i[r + 3]) && (a = !0);
+ do {
+ n++
+ } while (1 !== i[n] && n < i.length);
+ r = n - 2, n += 3;
+ break;
+ case 1:
+ if (0 !== i[n - 1] || 0 !== i[n - 2]) {
+ n += 3;
+ break
+ }
+ "slice_layer_without_partitioning_rbsp_idr" === ii(31 & i[r + 3]) && (a = !0), r = n - 2, n += 3;
+ break;
+ default:
+ n += 3
+ }
+ return i = i.subarray(r), n -= r, r = 0, i && i.byteLength > 3 && "slice_layer_without_partitioning_rbsp_idr" === ii(31 & i[r + 3]) && (a = !0), a
+ }
+ },
+ ri = Ye,
+ ai = {};
+ ai.ts = ni, ai.aac = vt;
+ var si = he,
+ oi = function(e, t, i) {
+ for (var n, r, a, s, o = 0, u = 188, l = !1; u <= e.byteLength;)
+ if (71 !== e[o] || 71 !== e[u] && u !== e.byteLength) o++, u++;
+ else {
+ switch (n = e.subarray(o, u), ai.ts.parseType(n, t.pid)) {
+ case "pes":
+ r = ai.ts.parsePesType(n, t.table), a = ai.ts.parsePayloadUnitStartIndicator(n), "audio" === r && a && (s = ai.ts.parsePesTime(n)) && (s.type = "audio", i.audio.push(s), l = !0)
+ }
+ if (l) break;
+ o += 188, u += 188
+ } for (o = (u = e.byteLength) - 188, l = !1; o >= 0;)
+ if (71 !== e[o] || 71 !== e[u] && u !== e.byteLength) o--, u--;
+ else {
+ switch (n = e.subarray(o, u), ai.ts.parseType(n, t.pid)) {
+ case "pes":
+ r = ai.ts.parsePesType(n, t.table), a = ai.ts.parsePayloadUnitStartIndicator(n), "audio" === r && a && (s = ai.ts.parsePesTime(n)) && (s.type = "audio", i.audio.push(s), l = !0)
+ }
+ if (l) break;
+ o -= 188, u -= 188
+ }
+ },
+ ui = function(e, t, i) {
+ for (var n, r, a, s, o, u, l, h = 0, d = 188, c = !1, f = {
+ data: [],
+ size: 0
+ }; d < e.byteLength;)
+ if (71 !== e[h] || 71 !== e[d]) h++, d++;
+ else {
+ switch (n = e.subarray(h, d), ai.ts.parseType(n, t.pid)) {
+ case "pes":
+ if (r = ai.ts.parsePesType(n, t.table), a = ai.ts.parsePayloadUnitStartIndicator(n), "video" === r && (a && !c && (s = ai.ts.parsePesTime(n)) && (s.type = "video", i.video.push(s), c = !0), !i.firstKeyFrame)) {
+ if (a && 0 !== f.size) {
+ for (o = new Uint8Array(f.size), u = 0; f.data.length;) l = f.data.shift(), o.set(l, u), u += l.byteLength;
+ if (ai.ts.videoPacketContainsKeyFrame(o)) {
+ var p = ai.ts.parsePesTime(o);
+ p && (i.firstKeyFrame = p, i.firstKeyFrame.type = "video")
+ }
+ f.size = 0
+ }
+ f.data.push(n), f.size += n.byteLength
+ }
+ }
+ if (c && i.firstKeyFrame) break;
+ h += 188, d += 188
+ } for (h = (d = e.byteLength) - 188, c = !1; h >= 0;)
+ if (71 !== e[h] || 71 !== e[d]) h--, d--;
+ else {
+ switch (n = e.subarray(h, d), ai.ts.parseType(n, t.pid)) {
+ case "pes":
+ r = ai.ts.parsePesType(n, t.table), a = ai.ts.parsePayloadUnitStartIndicator(n), "video" === r && a && (s = ai.ts.parsePesTime(n)) && (s.type = "video", i.video.push(s), c = !0)
+ }
+ if (c) break;
+ h -= 188, d -= 188
+ }
+ },
+ li = function(e) {
+ var t = {
+ pid: null,
+ table: null
+ },
+ i = {};
+ for (var n in function(e, t) {
+ for (var i, n = 0, r = 188; r < e.byteLength;)
+ if (71 !== e[n] || 71 !== e[r]) n++, r++;
+ else {
+ switch (i = e.subarray(n, r), ai.ts.parseType(i, t.pid)) {
+ case "pat":
+ t.pid = ai.ts.parsePat(i);
+ break;
+ case "pmt":
+ var a = ai.ts.parsePmt(i);
+ t.table = t.table || {}, Object.keys(a).forEach((function(e) {
+ t.table[e] = a[e]
+ }))
+ }
+ n += 188, r += 188
+ }
+ }(e, t), t.table) {
+ if (t.table.hasOwnProperty(n)) switch (t.table[n]) {
+ case Ve.H264_STREAM_TYPE:
+ i.video = [], ui(e, t, i), 0 === i.video.length && delete i.video;
+ break;
+ case Ve.ADTS_STREAM_TYPE:
+ i.audio = [], oi(e, t, i), 0 === i.audio.length && delete i.audio
+ }
+ }
+ return i
+ },
+ hi = function(e, t) {
+ var i;
+ return (i = ai.aac.isLikelyAacData(e) ? function(e) {
+ for (var t, i = !1, n = 0, r = null, a = null, s = 0, o = 0; e.length - o >= 3;) {
+ switch (ai.aac.parseType(e, o)) {
+ case "timed-metadata":
+ if (e.length - o < 10) {
+ i = !0;
+ break
+ }
+ if ((s = ai.aac.parseId3TagSize(e, o)) > e.length) {
+ i = !0;
+ break
+ }
+ null === a && (t = e.subarray(o, o + s), a = ai.aac.parseAacTimestamp(t)), o += s;
+ break;
+ case "audio":
+ if (e.length - o < 7) {
+ i = !0;
+ break
+ }
+ if ((s = ai.aac.parseAdtsSize(e, o)) > e.length) {
+ i = !0;
+ break
+ }
+ null === r && (t = e.subarray(o, o + s), r = ai.aac.parseSampleRate(t)), n++, o += s;
+ break;
+ default:
+ o++
+ }
+ if (i) return null
+ }
+ if (null === r || null === a) return null;
+ var u = si / r;
+ return {
+ audio: [{
+ type: "audio",
+ dts: a,
+ pts: a
+ }, {
+ type: "audio",
+ dts: a + 1024 * n * u,
+ pts: a + 1024 * n * u
+ }]
+ }
+ }(e) : li(e)) && (i.audio || i.video) ? (function(e, t) {
+ if (e.audio && e.audio.length) {
+ var i = t;
+ (void 0 === i || isNaN(i)) && (i = e.audio[0].dts), e.audio.forEach((function(e) {
+ e.dts = ri(e.dts, i), e.pts = ri(e.pts, i), e.dtsTime = e.dts / si, e.ptsTime = e.pts / si
+ }))
+ }
+ if (e.video && e.video.length) {
+ var n = t;
+ if ((void 0 === n || isNaN(n)) && (n = e.video[0].dts), e.video.forEach((function(e) {
+ e.dts = ri(e.dts, n), e.pts = ri(e.pts, n), e.dtsTime = e.dts / si, e.ptsTime = e.pts / si
+ })), e.firstKeyFrame) {
+ var r = e.firstKeyFrame;
+ r.dts = ri(r.dts, n), r.pts = ri(r.pts, n), r.dtsTime = r.dts / si, r.ptsTime = r.pts / si
+ }
+ }
+ }(i, t), i) : null
+ },
+ di = function() {
+ function e(e, t) {
+ this.options = t || {}, this.self = e, this.init()
+ }
+ var t = e.prototype;
+ return t.init = function() {
+ this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new Ot.Transmuxer(this.options),
+ function(e, t) {
+ t.on("data", (function(t) {
+ var i = t.initSegment;
+ t.initSegment = {
+ data: i.buffer,
+ byteOffset: i.byteOffset,
+ byteLength: i.byteLength
+ };
+ var n = t.data;
+ t.data = n.buffer, e.postMessage({
+ action: "data",
+ segment: t,
+ byteOffset: n.byteOffset,
+ byteLength: n.byteLength
+ }, [t.data])
+ })), t.on("done", (function(t) {
+ e.postMessage({
+ action: "done"
+ })
+ })), t.on("gopInfo", (function(t) {
+ e.postMessage({
+ action: "gopInfo",
+ gopInfo: t
+ })
+ })), t.on("videoSegmentTimingInfo", (function(t) {
+ var i = {
+ start: {
+ decode: ce(t.start.dts),
+ presentation: ce(t.start.pts)
+ },
+ end: {
+ decode: ce(t.end.dts),
+ presentation: ce(t.end.pts)
+ },
+ baseMediaDecodeTime: ce(t.baseMediaDecodeTime)
+ };
+ t.prependedContentDuration && (i.prependedContentDuration = ce(t.prependedContentDuration)), e.postMessage({
+ action: "videoSegmentTimingInfo",
+ videoSegmentTimingInfo: i
+ })
+ })), t.on("audioSegmentTimingInfo", (function(t) {
+ var i = {
+ start: {
+ decode: ce(t.start.dts),
+ presentation: ce(t.start.pts)
+ },
+ end: {
+ decode: ce(t.end.dts),
+ presentation: ce(t.end.pts)
+ },
+ baseMediaDecodeTime: ce(t.baseMediaDecodeTime)
+ };
+ t.prependedContentDuration && (i.prependedContentDuration = ce(t.prependedContentDuration)), e.postMessage({
+ action: "audioSegmentTimingInfo",
+ audioSegmentTimingInfo: i
+ })
+ })), t.on("id3Frame", (function(t) {
+ e.postMessage({
+ action: "id3Frame",
+ id3Frame: t
+ })
+ })), t.on("caption", (function(t) {
+ e.postMessage({
+ action: "caption",
+ caption: t
+ })
+ })), t.on("trackinfo", (function(t) {
+ e.postMessage({
+ action: "trackinfo",
+ trackInfo: t
+ })
+ })), t.on("audioTimingInfo", (function(t) {
+ e.postMessage({
+ action: "audioTimingInfo",
+ audioTimingInfo: {
+ start: ce(t.start),
+ end: ce(t.end)
+ }
+ })
+ })), t.on("videoTimingInfo", (function(t) {
+ e.postMessage({
+ action: "videoTimingInfo",
+ videoTimingInfo: {
+ start: ce(t.start),
+ end: ce(t.end)
+ }
+ })
+ })), t.on("log", (function(t) {
+ e.postMessage({
+ action: "log",
+ log: t
+ })
+ }))
+ }(this.self, this.transmuxer)
+ }, t.pushMp4Captions = function(e) {
+ this.captionParser || (this.captionParser = new Kt, this.captionParser.init());
+ var t = new Uint8Array(e.data, e.byteOffset, e.byteLength),
+ i = this.captionParser.parse(t, e.trackIds, e.timescales);
+ this.self.postMessage({
+ action: "mp4Captions",
+ captions: i && i.captions || [],
+ logs: i && i.logs || [],
+ data: t.buffer
+ }, [t.buffer])
+ }, t.probeMp4StartTime = function(e) {
+ var t = e.timescales,
+ i = e.data,
+ n = $t(t, i);
+ this.self.postMessage({
+ action: "probeMp4StartTime",
+ startTime: n,
+ data: i
+ }, [i.buffer])
+ }, t.probeMp4Tracks = function(e) {
+ var t = e.data,
+ i = Jt(t);
+ this.self.postMessage({
+ action: "probeMp4Tracks",
+ tracks: i,
+ data: t
+ }, [t.buffer])
+ }, t.probeTs = function(e) {
+ var t = e.data,
+ i = e.baseStartTime,
+ n = "number" != typeof i || isNaN(i) ? void 0 : i * he,
+ r = hi(t, n),
+ a = null;
+ r && ((a = {
+ hasVideo: r.video && 2 === r.video.length || !1,
+ hasAudio: r.audio && 2 === r.audio.length || !1
+ }).hasVideo && (a.videoStart = r.video[0].ptsTime), a.hasAudio && (a.audioStart = r.audio[0].ptsTime)), this.self.postMessage({
+ action: "probeTs",
+ result: a,
+ data: t
+ }, [t.buffer])
+ }, t.clearAllMp4Captions = function() {
+ this.captionParser && this.captionParser.clearAllCaptions()
+ }, t.clearParsedMp4Captions = function() {
+ this.captionParser && this.captionParser.clearParsedCaptions()
+ }, t.push = function(e) {
+ var t = new Uint8Array(e.data, e.byteOffset, e.byteLength);
+ this.transmuxer.push(t)
+ }, t.reset = function() {
+ this.transmuxer.reset()
+ }, t.setTimestampOffset = function(e) {
+ var t = e.timestampOffset || 0;
+ this.transmuxer.setBaseMediaDecodeTime(Math.round(de(t)))
+ }, t.setAudioAppendStart = function(e) {
+ this.transmuxer.setAudioAppendStart(Math.ceil(de(e.appendStart)))
+ }, t.setRemux = function(e) {
+ this.transmuxer.setRemux(e.remux)
+ }, t.flush = function(e) {
+ this.transmuxer.flush(), self.postMessage({
+ action: "done",
+ type: "transmuxed"
+ })
+ }, t.endTimeline = function() {
+ this.transmuxer.endTimeline(), self.postMessage({
+ action: "endedtimeline",
+ type: "transmuxed"
+ })
+ }, t.alignGopsWith = function(e) {
+ this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())
+ }, e
+ }();
+ self.onmessage = function(e) {
+ "init" === e.data.action && e.data.options ? this.messageHandlers = new di(self, e.data.options) : (this.messageHandlers || (this.messageHandlers = new di(self)), e.data && e.data.action && "init" !== e.data.action && this.messageHandlers[e.data.action] && this.messageHandlers[e.data.action](e.data))
+ }
+ })))),
+ ls = function(e) {
+ var t = e.transmuxer,
+ i = e.bytes,
+ n = e.audioAppendStart,
+ r = e.gopsToAlignWith,
+ a = e.remux,
+ s = e.onData,
+ o = e.onTrackInfo,
+ u = e.onAudioTimingInfo,
+ l = e.onVideoTimingInfo,
+ h = e.onVideoSegmentTimingInfo,
+ d = e.onAudioSegmentTimingInfo,
+ c = e.onId3,
+ f = e.onCaptions,
+ p = e.onDone,
+ m = e.onEndedTimeline,
+ _ = e.onTransmuxerLog,
+ g = e.isEndOfTimeline,
+ v = {
+ buffer: []
+ },
+ y = g;
+ if (t.onmessage = function(i) {
+ t.currentTransmux === e && ("data" === i.data.action && function(e, t, i) {
+ var n = e.data.segment,
+ r = n.type,
+ a = n.initSegment,
+ s = n.captions,
+ o = n.captionStreams,
+ u = n.metadata,
+ l = n.videoFrameDtsTime,
+ h = n.videoFramePtsTime;
+ t.buffer.push({
+ captions: s,
+ captionStreams: o,
+ metadata: u
+ });
+ var d = e.data.segment.boxes || {
+ data: e.data.segment.data
+ },
+ c = {
+ type: r,
+ data: new Uint8Array(d.data, d.data.byteOffset, d.data.byteLength),
+ initSegment: new Uint8Array(a.data, a.byteOffset, a.byteLength)
+ };
+ void 0 !== l && (c.videoFrameDtsTime = l), void 0 !== h && (c.videoFramePtsTime = h), i(c)
+ }(i, v, s), "trackinfo" === i.data.action && o(i.data.trackInfo), "gopInfo" === i.data.action && function(e, t) {
+ t.gopInfo = e.data.gopInfo
+ }(i, v), "audioTimingInfo" === i.data.action && u(i.data.audioTimingInfo), "videoTimingInfo" === i.data.action && l(i.data.videoTimingInfo), "videoSegmentTimingInfo" === i.data.action && h(i.data.videoSegmentTimingInfo), "audioSegmentTimingInfo" === i.data.action && d(i.data.audioSegmentTimingInfo), "id3Frame" === i.data.action && c([i.data.id3Frame], i.data.id3Frame.dispatchType), "caption" === i.data.action && f(i.data.caption), "endedtimeline" === i.data.action && (y = !1, m()), "log" === i.data.action && _(i.data.log), "transmuxed" === i.data.type && (y || (t.onmessage = null, function(e) {
+ var t = e.transmuxedData,
+ i = e.callback;
+ t.buffer = [], i(t)
+ }({
+ transmuxedData: v,
+ callback: p
+ }), hs(t))))
+ }, n && t.postMessage({
+ action: "setAudioAppendStart",
+ appendStart: n
+ }), Array.isArray(r) && t.postMessage({
+ action: "alignGopsWith",
+ gopsToAlignWith: r
+ }), void 0 !== a && t.postMessage({
+ action: "setRemux",
+ remux: a
+ }), i.byteLength) {
+ var b = i instanceof ArrayBuffer ? i : i.buffer,
+ S = i instanceof ArrayBuffer ? 0 : i.byteOffset;
+ t.postMessage({
+ action: "push",
+ data: b,
+ byteOffset: S,
+ byteLength: i.byteLength
+ }, [b])
+ }
+ g && t.postMessage({
+ action: "endTimeline"
+ }), t.postMessage({
+ action: "flush"
+ })
+ },
+ hs = function(e) {
+ e.currentTransmux = null, e.transmuxQueue.length && (e.currentTransmux = e.transmuxQueue.shift(), "function" == typeof e.currentTransmux ? e.currentTransmux() : ls(e.currentTransmux))
+ },
+ ds = function(e, t) {
+ e.postMessage({
+ action: t
+ }), hs(e)
+ },
+ cs = function(e, t) {
+ if (!t.currentTransmux) return t.currentTransmux = e, void ds(t, e);
+ t.transmuxQueue.push(ds.bind(null, t, e))
+ },
+ fs = function(e) {
+ if (!e.transmuxer.currentTransmux) return e.transmuxer.currentTransmux = e, void ls(e);
+ e.transmuxer.transmuxQueue.push(e)
+ },
+ ps = function(e) {
+ cs("reset", e)
+ },
+ ms = function(e) {
+ var t = new us;
+ t.currentTransmux = null, t.transmuxQueue = [];
+ var i = t.terminate;
+ return t.terminate = function() {
+ return t.currentTransmux = null, t.transmuxQueue.length = 0, i.call(t)
+ }, t.postMessage({
+ action: "init",
+ options: e
+ }), t
+ },
+ _s = function(e) {
+ var t = e.transmuxer,
+ i = e.endAction || e.action,
+ n = e.callback,
+ r = P.default({}, e, {
+ endAction: null,
+ transmuxer: null,
+ callback: null
+ });
+ if (t.addEventListener("message", (function r(a) {
+ a.data.action === i && (t.removeEventListener("message", r), a.data.data && (a.data.data = new Uint8Array(a.data.data, e.byteOffset || 0, e.byteLength || a.data.data.byteLength), e.data && (e.data = a.data.data)), n(a.data))
+ })), e.data) {
+ var a = e.data instanceof ArrayBuffer;
+ r.byteOffset = a ? 0 : e.data.byteOffset, r.byteLength = e.data.byteLength;
+ var s = [a ? e.data : e.data.buffer];
+ t.postMessage(r, s)
+ } else t.postMessage(r)
+ },
+ gs = 2,
+ vs = -101,
+ ys = -102,
+ bs = function(e) {
+ e.forEach((function(e) {
+ e.abort()
+ }))
+ },
+ Ss = function(e, t) {
+ return t.timedout ? {
+ status: t.status,
+ message: "HLS request timed-out at URL: " + t.uri,
+ code: vs,
+ xhr: t
+ } : t.aborted ? {
+ status: t.status,
+ message: "HLS request aborted at URL: " + t.uri,
+ code: ys,
+ xhr: t
+ } : e ? {
+ status: t.status,
+ message: "HLS request errored at URL: " + t.uri,
+ code: gs,
+ xhr: t
+ } : "arraybuffer" === t.responseType && 0 === t.response.byteLength ? {
+ status: t.status,
+ message: "Empty HLS response at URL: " + t.uri,
+ code: gs,
+ xhr: t
+ } : null
+ },
+ Ts = function(e, t, i) {
+ return function(n, r) {
+ var a = r.response,
+ s = Ss(n, r);
+ if (s) return i(s, e);
+ if (16 !== a.byteLength) return i({
+ status: r.status,
+ message: "Invalid HLS key at URL: " + r.uri,
+ code: gs,
+ xhr: r
+ }, e);
+ for (var o = new DataView(a), u = new Uint32Array([o.getUint32(0), o.getUint32(4), o.getUint32(8), o.getUint32(12)]), l = 0; l < t.length; l++) t[l].bytes = u;
+ return i(null, e)
+ }
+ },
+ Es = function(e, t) {
+ var i = S.detectContainerForBytes(e.map.bytes);
+ if ("mp4" !== i) {
+ var n = e.map.resolvedUri || e.map.uri;
+ return t({
+ internal: !0,
+ message: "Found unsupported " + (i || "unknown") + " container for initialization segment at URL: " + n,
+ code: gs
+ })
+ }
+ _s({
+ action: "probeMp4Tracks",
+ data: e.map.bytes,
+ transmuxer: e.transmuxer,
+ callback: function(i) {
+ var n = i.tracks,
+ r = i.data;
+ return e.map.bytes = r, n.forEach((function(t) {
+ e.map.tracks = e.map.tracks || {}, e.map.tracks[t.type] || (e.map.tracks[t.type] = t, "number" == typeof t.id && t.timescale && (e.map.timescales = e.map.timescales || {}, e.map.timescales[t.id] = t.timescale))
+ })), t(null)
+ }
+ })
+ },
+ ws = function(e) {
+ var t = e.segment,
+ i = e.finishProcessingFn,
+ n = e.responseType;
+ return function(e, r) {
+ var a = Ss(e, r);
+ if (a) return i(a, t);
+ var s = "arraybuffer" !== n && r.responseText ? function(e) {
+ for (var t = new Uint8Array(new ArrayBuffer(e.length)), i = 0; i < e.length; i++) t[i] = e.charCodeAt(i);
+ return t.buffer
+ }(r.responseText.substring(t.lastReachedChar || 0)) : r.response;
+ return t.stats = function(e) {
+ return {
+ bandwidth: e.bandwidth,
+ bytesReceived: e.bytesReceived || 0,
+ roundTripTime: e.roundTripTime || 0
+ }
+ }(r), t.key ? t.encryptedBytes = new Uint8Array(s) : t.bytes = new Uint8Array(s), i(null, t)
+ }
+ },
+ As = function(e) {
+ var t = e.segment,
+ i = e.bytes,
+ n = e.trackInfoFn,
+ r = e.timingInfoFn,
+ a = e.videoSegmentTimingInfoFn,
+ s = e.audioSegmentTimingInfoFn,
+ o = e.id3Fn,
+ u = e.captionsFn,
+ l = e.isEndOfTimeline,
+ h = e.endedTimelineFn,
+ d = e.dataFn,
+ c = e.doneFn,
+ f = e.onTransmuxerLog,
+ p = t.map && t.map.tracks || {},
+ m = Boolean(p.audio && p.video),
+ _ = r.bind(null, t, "audio", "start"),
+ g = r.bind(null, t, "audio", "end"),
+ v = r.bind(null, t, "video", "start"),
+ y = r.bind(null, t, "video", "end");
+ _s({
+ action: "probeTs",
+ transmuxer: t.transmuxer,
+ data: i,
+ baseStartTime: t.baseStartTime,
+ callback: function(e) {
+ t.bytes = i = e.data;
+ var r = e.result;
+ r && (n(t, {
+ hasAudio: r.hasAudio,
+ hasVideo: r.hasVideo,
+ isMuxed: m
+ }), n = null, r.hasAudio && !m && _(r.audioStart), r.hasVideo && v(r.videoStart), _ = null, v = null), fs({
+ bytes: i,
+ transmuxer: t.transmuxer,
+ audioAppendStart: t.audioAppendStart,
+ gopsToAlignWith: t.gopsToAlignWith,
+ remux: m,
+ onData: function(e) {
+ e.type = "combined" === e.type ? "video" : e.type, d(t, e)
+ },
+ onTrackInfo: function(e) {
+ n && (m && (e.isMuxed = !0), n(t, e))
+ },
+ onAudioTimingInfo: function(e) {
+ _ && void 0 !== e.start && (_(e.start), _ = null), g && void 0 !== e.end && g(e.end)
+ },
+ onVideoTimingInfo: function(e) {
+ v && void 0 !== e.start && (v(e.start), v = null), y && void 0 !== e.end && y(e.end)
+ },
+ onVideoSegmentTimingInfo: function(e) {
+ a(e)
+ },
+ onAudioSegmentTimingInfo: function(e) {
+ s(e)
+ },
+ onId3: function(e, i) {
+ o(t, e, i)
+ },
+ onCaptions: function(e) {
+ u(t, [e])
+ },
+ isEndOfTimeline: l,
+ onEndedTimeline: function() {
+ h()
+ },
+ onTransmuxerLog: f,
+ onDone: function(e) {
+ c && (e.type = "combined" === e.type ? "video" : e.type, c(null, t, e))
+ }
+ })
+ }
+ })
+ },
+ Cs = function(e) {
+ var t = e.segment,
+ i = e.bytes,
+ n = e.trackInfoFn,
+ r = e.timingInfoFn,
+ a = e.videoSegmentTimingInfoFn,
+ s = e.audioSegmentTimingInfoFn,
+ o = e.id3Fn,
+ u = e.captionsFn,
+ l = e.isEndOfTimeline,
+ h = e.endedTimelineFn,
+ d = e.dataFn,
+ c = e.doneFn,
+ f = e.onTransmuxerLog,
+ p = new Uint8Array(i);
+ if (S.isLikelyFmp4MediaSegment(p)) {
+ t.isFmp4 = !0;
+ var m = t.map.tracks,
+ _ = {
+ isFmp4: !0,
+ hasVideo: !!m.video,
+ hasAudio: !!m.audio
+ };
+ m.audio && m.audio.codec && "enca" !== m.audio.codec && (_.audioCodec = m.audio.codec), m.video && m.video.codec && "encv" !== m.video.codec && (_.videoCodec = m.video.codec), m.video && m.audio && (_.isMuxed = !0), n(t, _);
+ var g = function(e) {
+ d(t, {
+ data: p,
+ type: _.hasAudio && !_.isMuxed ? "audio" : "video"
+ }), e && e.length && u(t, e), c(null, t, {})
+ };
+ _s({
+ action: "probeMp4StartTime",
+ timescales: t.map.timescales,
+ data: p,
+ transmuxer: t.transmuxer,
+ callback: function(e) {
+ var n = e.data,
+ a = e.startTime;
+ i = n.buffer, t.bytes = p = n, _.hasAudio && !_.isMuxed && r(t, "audio", "start", a), _.hasVideo && r(t, "video", "start", a), m.video && n.byteLength && t.transmuxer ? _s({
+ action: "pushMp4Captions",
+ endAction: "mp4Captions",
+ transmuxer: t.transmuxer,
+ data: p,
+ timescales: t.map.timescales,
+ trackIds: [m.video.id],
+ callback: function(e) {
+ i = e.data.buffer, t.bytes = p = e.data, e.logs.forEach((function(e) {
+ f(Yr.mergeOptions(e, {
+ stream: "mp4CaptionParser"
+ }))
+ })), g(e.captions)
+ }
+ }) : g()
+ }
+ })
+ } else if (t.transmuxer) {
+ if (void 0 === t.container && (t.container = S.detectContainerForBytes(p)), "ts" !== t.container && "aac" !== t.container) return n(t, {
+ hasAudio: !1,
+ hasVideo: !1
+ }), void c(null, t, {});
+ As({
+ segment: t,
+ bytes: i,
+ trackInfoFn: n,
+ timingInfoFn: r,
+ videoSegmentTimingInfoFn: a,
+ audioSegmentTimingInfoFn: s,
+ id3Fn: o,
+ captionsFn: u,
+ isEndOfTimeline: l,
+ endedTimelineFn: h,
+ dataFn: d,
+ doneFn: c,
+ onTransmuxerLog: f
+ })
+ } else c(null, t, {})
+ },
+ ks = function(e, t) {
+ var i, n = e.id,
+ r = e.key,
+ a = e.encryptedBytes,
+ s = e.decryptionWorker;
+ s.addEventListener("message", (function e(i) {
+ if (i.data.source === n) {
+ s.removeEventListener("message", e);
+ var r = i.data.decrypted;
+ t(new Uint8Array(r.bytes, r.byteOffset, r.byteLength))
+ }
+ })), i = r.bytes.slice ? r.bytes.slice() : new Uint32Array(Array.prototype.slice.call(r.bytes)), s.postMessage(Ga({
+ source: n,
+ encrypted: a,
+ key: i,
+ iv: r.iv
+ }), [a.buffer, i.buffer])
+ },
+ Ps = function(e) {
+ var t = e.activeXhrs,
+ i = e.decryptionWorker,
+ n = e.trackInfoFn,
+ r = e.timingInfoFn,
+ a = e.videoSegmentTimingInfoFn,
+ s = e.audioSegmentTimingInfoFn,
+ o = e.id3Fn,
+ u = e.captionsFn,
+ l = e.isEndOfTimeline,
+ h = e.endedTimelineFn,
+ d = e.dataFn,
+ c = e.doneFn,
+ f = e.onTransmuxerLog,
+ p = 0,
+ m = !1;
+ return function(e, _) {
+ if (!m) {
+ if (e) return m = !0, bs(t), c(e, _);
+ if ((p += 1) === t.length) {
+ var g = function() {
+ if (_.encryptedBytes) return function(e) {
+ var t = e.decryptionWorker,
+ i = e.segment,
+ n = e.trackInfoFn,
+ r = e.timingInfoFn,
+ a = e.videoSegmentTimingInfoFn,
+ s = e.audioSegmentTimingInfoFn,
+ o = e.id3Fn,
+ u = e.captionsFn,
+ l = e.isEndOfTimeline,
+ h = e.endedTimelineFn,
+ d = e.dataFn,
+ c = e.doneFn,
+ f = e.onTransmuxerLog;
+ ks({
+ id: i.requestId,
+ key: i.key,
+ encryptedBytes: i.encryptedBytes,
+ decryptionWorker: t
+ }, (function(e) {
+ i.bytes = e, Cs({
+ segment: i,
+ bytes: i.bytes,
+ trackInfoFn: n,
+ timingInfoFn: r,
+ videoSegmentTimingInfoFn: a,
+ audioSegmentTimingInfoFn: s,
+ id3Fn: o,
+ captionsFn: u,
+ isEndOfTimeline: l,
+ endedTimelineFn: h,
+ dataFn: d,
+ doneFn: c,
+ onTransmuxerLog: f
+ })
+ }))
+ }({
+ decryptionWorker: i,
+ segment: _,
+ trackInfoFn: n,
+ timingInfoFn: r,
+ videoSegmentTimingInfoFn: a,
+ audioSegmentTimingInfoFn: s,
+ id3Fn: o,
+ captionsFn: u,
+ isEndOfTimeline: l,
+ endedTimelineFn: h,
+ dataFn: d,
+ doneFn: c,
+ onTransmuxerLog: f
+ });
+ Cs({
+ segment: _,
+ bytes: _.bytes,
+ trackInfoFn: n,
+ timingInfoFn: r,
+ videoSegmentTimingInfoFn: a,
+ audioSegmentTimingInfoFn: s,
+ id3Fn: o,
+ captionsFn: u,
+ isEndOfTimeline: l,
+ endedTimelineFn: h,
+ dataFn: d,
+ doneFn: c,
+ onTransmuxerLog: f
+ })
+ };
+ if (_.endOfAllRequests = Date.now(), _.map && _.map.encryptedBytes && !_.map.bytes) return ks({
+ decryptionWorker: i,
+ id: _.requestId + "-init",
+ encryptedBytes: _.map.encryptedBytes,
+ key: _.map.key
+ }, (function(e) {
+ _.map.bytes = e, Es(_, (function(e) {
+ if (e) return bs(t), c(e, _);
+ g()
+ }))
+ }));
+ g()
+ }
+ }
+ }
+ },
+ Is = function(e) {
+ var t = e.segment,
+ i = e.progressFn;
+ return e.trackInfoFn, e.timingInfoFn, e.videoSegmentTimingInfoFn, e.audioSegmentTimingInfoFn, e.id3Fn, e.captionsFn, e.isEndOfTimeline, e.endedTimelineFn, e.dataFn,
+ function(e) {
+ if (!e.target.aborted) return t.stats = Yr.mergeOptions(t.stats, function(e) {
+ var t = e.target,
+ i = {
+ bandwidth: 1 / 0,
+ bytesReceived: 0,
+ roundTripTime: Date.now() - t.requestTime || 0
+ };
+ return i.bytesReceived = e.loaded, i.bandwidth = Math.floor(i.bytesReceived / i.roundTripTime * 8 * 1e3), i
+ }(e)), !t.stats.firstBytesReceivedAt && t.stats.bytesReceived && (t.stats.firstBytesReceivedAt = Date.now()), i(e, t)
+ }
+ },
+ Ls = function(e) {
+ var t = e.xhr,
+ i = e.xhrOptions,
+ n = e.decryptionWorker,
+ r = e.segment,
+ a = e.abortFn,
+ s = e.progressFn,
+ o = e.trackInfoFn,
+ u = e.timingInfoFn,
+ l = e.videoSegmentTimingInfoFn,
+ h = e.audioSegmentTimingInfoFn,
+ d = e.id3Fn,
+ c = e.captionsFn,
+ f = e.isEndOfTimeline,
+ p = e.endedTimelineFn,
+ m = e.dataFn,
+ _ = e.doneFn,
+ g = e.onTransmuxerLog,
+ v = [],
+ y = Ps({
+ activeXhrs: v,
+ decryptionWorker: n,
+ trackInfoFn: o,
+ timingInfoFn: u,
+ videoSegmentTimingInfoFn: l,
+ audioSegmentTimingInfoFn: h,
+ id3Fn: d,
+ captionsFn: c,
+ isEndOfTimeline: f,
+ endedTimelineFn: p,
+ dataFn: m,
+ doneFn: _,
+ onTransmuxerLog: g
+ });
+ if (r.key && !r.key.bytes) {
+ var b = [r.key];
+ r.map && !r.map.bytes && r.map.key && r.map.key.resolvedUri === r.key.resolvedUri && b.push(r.map.key);
+ var S = t(Yr.mergeOptions(i, {
+ uri: r.key.resolvedUri,
+ responseType: "arraybuffer"
+ }), Ts(r, b, y));
+ v.push(S)
+ }
+ if (r.map && !r.map.bytes) {
+ if (r.map.key && (!r.key || r.key.resolvedUri !== r.map.key.resolvedUri)) {
+ var T = t(Yr.mergeOptions(i, {
+ uri: r.map.key.resolvedUri,
+ responseType: "arraybuffer"
+ }), Ts(r, [r.map.key], y));
+ v.push(T)
+ }
+ var E = t(Yr.mergeOptions(i, {
+ uri: r.map.resolvedUri,
+ responseType: "arraybuffer",
+ headers: ja(r.map)
+ }), function(e) {
+ var t = e.segment,
+ i = e.finishProcessingFn;
+ return function(e, n) {
+ var r = Ss(e, n);
+ if (r) return i(r, t);
+ var a = new Uint8Array(n.response);
+ if (t.map.key) return t.map.encryptedBytes = a, i(null, t);
+ t.map.bytes = a, Es(t, (function(e) {
+ if (e) return e.xhr = n, e.status = n.status, i(e, t);
+ i(null, t)
+ }))
+ }
+ }({
+ segment: r,
+ finishProcessingFn: y
+ }));
+ v.push(E)
+ }
+ var w = Yr.mergeOptions(i, {
+ uri: r.part && r.part.resolvedUri || r.resolvedUri,
+ responseType: "arraybuffer",
+ headers: ja(r)
+ }),
+ A = t(w, ws({
+ segment: r,
+ finishProcessingFn: y,
+ responseType: w.responseType
+ }));
+ A.addEventListener("progress", Is({
+ segment: r,
+ progressFn: s,
+ trackInfoFn: o,
+ timingInfoFn: u,
+ videoSegmentTimingInfoFn: l,
+ audioSegmentTimingInfoFn: h,
+ id3Fn: d,
+ captionsFn: c,
+ isEndOfTimeline: f,
+ endedTimelineFn: p,
+ dataFn: m
+ })), v.push(A);
+ var C = {};
+ return v.forEach((function(e) {
+ e.addEventListener("loadend", function(e) {
+ var t = e.loadendState,
+ i = e.abortFn;
+ return function(e) {
+ e.target.aborted && i && !t.calledAbortFn && (i(), t.calledAbortFn = !0)
+ }
+ }({
+ loadendState: C,
+ abortFn: a
+ }))
+ })),
+ function() {
+ return bs(v)
+ }
+ },
+ xs = $r("CodecUtils"),
+ Rs = function(e, t) {
+ var i = t.attributes || {};
+ return e && e.mediaGroups && e.mediaGroups.AUDIO && i.AUDIO && e.mediaGroups.AUDIO[i.AUDIO]
+ },
+ Ds = function(e) {
+ var t = {};
+ return e.forEach((function(e) {
+ var i = e.mediaType,
+ n = e.type,
+ r = e.details;
+ t[i] = t[i] || [], t[i].push(_.translateLegacyCodec("" + n + r))
+ })), Object.keys(t).forEach((function(e) {
+ if (t[e].length > 1) return xs("multiple " + e + " codecs found as attributes: " + t[e].join(", ") + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."), void(t[e] = null);
+ t[e] = t[e][0]
+ })), t
+ },
+ Os = function(e) {
+ var t = 0;
+ return e.audio && t++, e.video && t++, t
+ },
+ Us = function(e, t) {
+ var i = t.attributes || {},
+ n = Ds(function(e) {
+ var t = e.attributes || {};
+ if (t.CODECS) return _.parseCodecs(t.CODECS)
+ }(t) || []);
+ if (Rs(e, t) && !n.audio && ! function(e, t) {
+ if (!Rs(e, t)) return !0;
+ var i = t.attributes || {},
+ n = e.mediaGroups.AUDIO[i.AUDIO];
+ for (var r in n)
+ if (!n[r].uri && !n[r].playlists) return !0;
+ return !1
+ }(e, t)) {
+ var r = Ds(_.codecsFromDefault(e, i.AUDIO) || []);
+ r.audio && (n.audio = r.audio)
+ }
+ return n
+ },
+ Ms = $r("PlaylistSelector"),
+ Fs = function(e) {
+ if (e && e.playlist) {
+ var t = e.playlist;
+ return JSON.stringify({
+ id: t.id,
+ bandwidth: e.bandwidth,
+ width: e.width,
+ height: e.height,
+ codecs: t.attributes && t.attributes.CODECS || ""
+ })
+ }
+ },
+ Bs = function(e, t) {
+ if (!e) return "";
+ var i = C.default.getComputedStyle(e);
+ return i ? i[t] : ""
+ },
+ Ns = function(e, t) {
+ var i = e.slice();
+ e.sort((function(e, n) {
+ var r = t(e, n);
+ return 0 === r ? i.indexOf(e) - i.indexOf(n) : r
+ }))
+ },
+ js = function(e, t) {
+ var i, n;
+ return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH), i = i || C.default.Number.MAX_VALUE, t.attributes.BANDWIDTH && (n = t.attributes.BANDWIDTH), i - (n = n || C.default.Number.MAX_VALUE)
+ },
+ Vs = function(e, t, i, n, r, a) {
+ if (e) {
+ var s = {
+ bandwidth: t,
+ width: i,
+ height: n,
+ limitRenditionByPlayerDimensions: r
+ },
+ o = e.playlists;
+ Sa.isAudioOnly(e) && (o = a.getAudioTrackPlaylists_(), s.audioOnly = !0);
+ var u = o.map((function(e) {
+ var t = e.attributes && e.attributes.RESOLUTION && e.attributes.RESOLUTION.width,
+ i = e.attributes && e.attributes.RESOLUTION && e.attributes.RESOLUTION.height;
+ return {
+ bandwidth: e.attributes && e.attributes.BANDWIDTH || C.default.Number.MAX_VALUE,
+ width: t,
+ height: i,
+ playlist: e
+ }
+ }));
+ Ns(u, (function(e, t) {
+ return e.bandwidth - t.bandwidth
+ }));
+ var l = (u = u.filter((function(e) {
+ return !Sa.isIncompatible(e.playlist)
+ }))).filter((function(e) {
+ return Sa.isEnabled(e.playlist)
+ }));
+ l.length || (l = u.filter((function(e) {
+ return !Sa.isDisabled(e.playlist)
+ })));
+ var h = l.filter((function(e) {
+ return e.bandwidth * ns.BANDWIDTH_VARIANCE < t
+ })),
+ d = h[h.length - 1],
+ c = h.filter((function(e) {
+ return e.bandwidth === d.bandwidth
+ }))[0];
+ if (!1 === r) {
+ var f = c || l[0] || u[0];
+ if (f && f.playlist) {
+ var p = "sortedPlaylistReps";
+ return c && (p = "bandwidthBestRep"), l[0] && (p = "enabledPlaylistReps"), Ms("choosing " + Fs(f) + " using " + p + " with options", s), f.playlist
+ }
+ return Ms("could not choose a playlist with options", s), null
+ }
+ var m = h.filter((function(e) {
+ return e.width && e.height
+ }));
+ Ns(m, (function(e, t) {
+ return e.width - t.width
+ }));
+ var _ = m.filter((function(e) {
+ return e.width === i && e.height === n
+ }));
+ d = _[_.length - 1];
+ var g, v, y, b, S = _.filter((function(e) {
+ return e.bandwidth === d.bandwidth
+ }))[0];
+ if (S || (v = (g = m.filter((function(e) {
+ return e.width > i || e.height > n
+ }))).filter((function(e) {
+ return e.width === g[0].width && e.height === g[0].height
+ })), d = v[v.length - 1], y = v.filter((function(e) {
+ return e.bandwidth === d.bandwidth
+ }))[0]), a.experimentalLeastPixelDiffSelector) {
+ var T = m.map((function(e) {
+ return e.pixelDiff = Math.abs(e.width - i) + Math.abs(e.height - n), e
+ }));
+ Ns(T, (function(e, t) {
+ return e.pixelDiff === t.pixelDiff ? t.bandwidth - e.bandwidth : e.pixelDiff - t.pixelDiff
+ })), b = T[0]
+ }
+ var E = b || y || S || c || l[0] || u[0];
+ if (E && E.playlist) {
+ var w = "sortedPlaylistReps";
+ return b ? w = "leastPixelDiffRep" : y ? w = "resolutionPlusOneRep" : S ? w = "resolutionBestRep" : c ? w = "bandwidthBestRep" : l[0] && (w = "enabledPlaylistReps"), Ms("choosing " + Fs(E) + " using " + w + " with options", s), E.playlist
+ }
+ return Ms("could not choose a playlist with options", s), null
+ }
+ },
+ Hs = function() {
+ var e = this.useDevicePixelRatio && C.default.devicePixelRatio || 1;
+ return Vs(this.playlists.master, this.systemBandwidth, parseInt(Bs(this.tech_.el(), "width"), 10) * e, parseInt(Bs(this.tech_.el(), "height"), 10) * e, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_)
+ },
+ zs = function(e) {
+ var t = e.inbandTextTracks,
+ i = e.metadataArray,
+ n = e.timestampOffset,
+ r = e.videoDuration;
+ if (i) {
+ var a = C.default.WebKitDataCue || C.default.VTTCue,
+ s = t.metadataTrack_;
+ if (s && (i.forEach((function(e) {
+ var t = e.cueTime + n;
+ !("number" != typeof t || C.default.isNaN(t) || t < 0) && t < 1 / 0 && e.frames.forEach((function(e) {
+ var i = new a(t, t, e.value || e.url || e.data || "");
+ i.frame = e, i.value = e,
+ function(e) {
+ Object.defineProperties(e.frame, {
+ id: {
+ get: function() {
+ return Yr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."), e.value.key
+ }
+ },
+ value: {
+ get: function() {
+ return Yr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."), e.value.data
+ }
+ },
+ privateData: {
+ get: function() {
+ return Yr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."), e.value.data
+ }
+ }
+ })
+ }(i), s.addCue(i)
+ }))
+ })), s.cues && s.cues.length)) {
+ for (var o = s.cues, u = [], l = 0; l < o.length; l++) o[l] && u.push(o[l]);
+ var h = u.reduce((function(e, t) {
+ var i = e[t.startTime] || [];
+ return i.push(t), e[t.startTime] = i, e
+ }), {}),
+ d = Object.keys(h).sort((function(e, t) {
+ return Number(e) - Number(t)
+ }));
+ d.forEach((function(e, t) {
+ var i = h[e],
+ n = Number(d[t + 1]) || r;
+ i.forEach((function(e) {
+ e.endTime = n
+ }))
+ }))
+ }
+ }
+ },
+ Gs = function(e, t, i) {
+ var n, r;
+ if (i && i.cues)
+ for (n = i.cues.length; n--;)(r = i.cues[n]).startTime >= e && r.endTime <= t && i.removeCue(r)
+ },
+ Ws = function(e) {
+ return "number" == typeof e && isFinite(e)
+ },
+ Ys = function(e) {
+ var t = e.startOfSegment,
+ i = e.duration,
+ n = e.segment,
+ r = e.part,
+ a = e.playlist,
+ s = a.mediaSequence,
+ o = a.id,
+ u = a.segments,
+ l = void 0 === u ? [] : u,
+ h = e.mediaIndex,
+ d = e.partIndex,
+ c = e.timeline,
+ f = l.length - 1,
+ p = "mediaIndex/partIndex increment";
+ e.getMediaInfoForTime ? p = "getMediaInfoForTime (" + e.getMediaInfoForTime + ")" : e.isSyncRequest && (p = "getSyncSegmentCandidate (isSyncRequest)");
+ var m = "number" == typeof d,
+ _ = e.segment.uri ? "segment" : "pre-segment",
+ g = m ? oa({
+ preloadSegment: n
+ }) - 1 : 0;
+ return _ + " [" + (s + h) + "/" + (s + f) + "]" + (m ? " part [" + d + "/" + g + "]" : "") + " segment start/end [" + n.start + " => " + n.end + "]" + (m ? " part start/end [" + r.start + " => " + r.end + "]" : "") + " startOfSegment [" + t + "] duration [" + i + "] timeline [" + c + "] selected by [" + p + "] playlist [" + o + "]"
+ },
+ qs = function(e) {
+ return e + "TimingInfo"
+ },
+ Ks = function(e) {
+ var t = e.timelineChangeController,
+ i = e.currentTimeline,
+ n = e.segmentTimeline,
+ r = e.loaderType,
+ a = e.audioDisabled;
+ if (i === n) return !1;
+ if ("audio" === r) {
+ var s = t.lastTimelineChange({
+ type: "main"
+ });
+ return !s || s.to !== n
+ }
+ if ("main" === r && a) {
+ var o = t.pendingTimelineChange({
+ type: "audio"
+ });
+ return !o || o.to !== n
+ }
+ return !1
+ },
+ Xs = function(e) {
+ var t = e.segmentDuration,
+ i = e.maxDuration;
+ return !!t && Math.round(t) > i + 1 / 30
+ },
+ Qs = function(e, t) {
+ if ("hls" !== t) return null;
+ var i, n, r, a, s = (i = e.audioTimingInfo, n = e.videoTimingInfo, r = i && "number" == typeof i.start && "number" == typeof i.end ? i.end - i.start : 0, a = n && "number" == typeof n.start && "number" == typeof n.end ? n.end - n.start : 0, Math.max(r, a));
+ if (!s) return null;
+ var o = e.playlist.targetDuration,
+ u = Xs({
+ segmentDuration: s,
+ maxDuration: 2 * o
+ }),
+ l = Xs({
+ segmentDuration: s,
+ maxDuration: o
+ }),
+ h = "Segment with index " + e.mediaIndex + " from playlist " + e.playlist.id + " has a duration of " + s + " when the reported duration is " + e.duration + " and the target duration is " + o + ". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";
+ return u || l ? {
+ severity: u ? "warn" : "info",
+ message: h
+ } : null
+ },
+ $s = function(e) {
+ function t(t, i) {
+ var n;
+ if (n = e.call(this) || this, !t) throw new TypeError("Initialization settings are required");
+ if ("function" != typeof t.currentTime) throw new TypeError("No currentTime getter specified");
+ if (!t.mediaSource) throw new TypeError("No MediaSource specified");
+ return n.bandwidth = t.bandwidth, n.throughput = {
+ rate: 0,
+ count: 0
+ }, n.roundTrip = NaN, n.resetStats_(), n.mediaIndex = null, n.partIndex = null, n.hasPlayed_ = t.hasPlayed, n.currentTime_ = t.currentTime, n.seekable_ = t.seekable, n.seeking_ = t.seeking, n.duration_ = t.duration, n.mediaSource_ = t.mediaSource, n.vhs_ = t.vhs, n.loaderType_ = t.loaderType, n.currentMediaInfo_ = void 0, n.startingMediaInfo_ = void 0, n.segmentMetadataTrack_ = t.segmentMetadataTrack, n.goalBufferLength_ = t.goalBufferLength, n.sourceType_ = t.sourceType, n.sourceUpdater_ = t.sourceUpdater, n.inbandTextTracks_ = t.inbandTextTracks, n.state_ = "INIT", n.timelineChangeController_ = t.timelineChangeController, n.shouldSaveSegmentTimingInfo_ = !0, n.parse708captions_ = t.parse708captions, n.experimentalExactManifestTimings = t.experimentalExactManifestTimings, n.checkBufferTimeout_ = null, n.error_ = void 0, n.currentTimeline_ = -1, n.pendingSegment_ = null, n.xhrOptions_ = null, n.pendingSegments_ = [], n.audioDisabled_ = !1, n.isPendingTimestampOffset_ = !1, n.gopBuffer_ = [], n.timeMapping_ = 0, n.safeAppend_ = Yr.browser.IE_VERSION >= 11, n.appendInitSegment_ = {
+ audio: !0,
+ video: !0
+ }, n.playlistOfLastInitSegment_ = {
+ audio: null,
+ video: null
+ }, n.callQueue_ = [], n.loadQueue_ = [], n.metadataQueue_ = {
+ id3: [],
+ caption: []
+ }, n.waitingOnRemove_ = !1, n.quotaExceededErrorRetryTimeout_ = null, n.activeInitSegmentId_ = null, n.initSegments_ = {}, n.cacheEncryptionKeys_ = t.cacheEncryptionKeys, n.keyCache_ = {}, n.decrypter_ = t.decrypter, n.syncController_ = t.syncController, n.syncPoint_ = {
+ segmentIndex: 0,
+ time: 0
+ }, n.transmuxer_ = n.createTransmuxer_(), n.triggerSyncInfoUpdate_ = function() {
+ return n.trigger("syncinfoupdate")
+ }, n.syncController_.on("syncinfoupdate", n.triggerSyncInfoUpdate_), n.mediaSource_.addEventListener("sourceopen", (function() {
+ n.isEndOfStream_() || (n.ended_ = !1)
+ })), n.fetchAtBuffer_ = !1, n.logger_ = $r("SegmentLoader[" + n.loaderType_ + "]"), Object.defineProperty(I.default(n), "state", {
+ get: function() {
+ return this.state_
+ },
+ set: function(e) {
+ e !== this.state_ && (this.logger_(this.state_ + " -> " + e), this.state_ = e, this.trigger("statechange"))
+ }
+ }), n.sourceUpdater_.on("ready", (function() {
+ n.hasEnoughInfoToAppend_() && n.processCallQueue_()
+ })), "main" === n.loaderType_ && n.timelineChangeController_.on("pendingtimelinechange", (function() {
+ n.hasEnoughInfoToAppend_() && n.processCallQueue_()
+ })), "audio" === n.loaderType_ && n.timelineChangeController_.on("timelinechange", (function() {
+ n.hasEnoughInfoToLoad_() && n.processLoadQueue_(), n.hasEnoughInfoToAppend_() && n.processCallQueue_()
+ })), n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createTransmuxer_ = function() {
+ return ms({
+ remux: !1,
+ alignGopsAtEnd: this.safeAppend_,
+ keepOriginalTimestamps: !0,
+ parse708captions: this.parse708captions_
+ })
+ }, i.resetStats_ = function() {
+ this.mediaBytesTransferred = 0, this.mediaRequests = 0, this.mediaRequestsAborted = 0, this.mediaRequestsTimedout = 0, this.mediaRequestsErrored = 0, this.mediaTransferDuration = 0, this.mediaSecondsLoaded = 0, this.mediaAppends = 0
+ }, i.dispose = function() {
+ this.trigger("dispose"), this.state = "DISPOSED", this.pause(), this.abort_(), this.transmuxer_ && this.transmuxer_.terminate(), this.resetStats_(), this.checkBufferTimeout_ && C.default.clearTimeout(this.checkBufferTimeout_), this.syncController_ && this.triggerSyncInfoUpdate_ && this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_), this.off()
+ }, i.setAudio = function(e) {
+ this.audioDisabled_ = !e, e ? this.appendInitSegment_.audio = !0 : this.sourceUpdater_.removeAudio(0, this.duration_())
+ }, i.abort = function() {
+ "WAITING" === this.state ? (this.abort_(), this.state = "READY", this.paused() || this.monitorBuffer_()) : this.pendingSegment_ && (this.pendingSegment_ = null)
+ }, i.abort_ = function() {
+ this.pendingSegment_ && this.pendingSegment_.abortRequests && this.pendingSegment_.abortRequests(), this.pendingSegment_ = null, this.callQueue_ = [], this.loadQueue_ = [], this.metadataQueue_.id3 = [], this.metadataQueue_.caption = [], this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_), this.waitingOnRemove_ = !1, C.default.clearTimeout(this.quotaExceededErrorRetryTimeout_), this.quotaExceededErrorRetryTimeout_ = null
+ }, i.checkForAbort_ = function(e) {
+ return "APPENDING" !== this.state || this.pendingSegment_ ? !this.pendingSegment_ || this.pendingSegment_.requestId !== e : (this.state = "READY", !0)
+ }, i.error = function(e) {
+ return void 0 !== e && (this.logger_("error occurred:", e), this.error_ = e), this.pendingSegment_ = null, this.error_
+ }, i.endOfStream = function() {
+ this.ended_ = !0, this.transmuxer_ && ps(this.transmuxer_), this.gopBuffer_.length = 0, this.pause(), this.trigger("ended")
+ }, i.buffered_ = function() {
+ var e = this.getMediaInfo_();
+ if (!this.sourceUpdater_ || !e) return Yr.createTimeRanges();
+ if ("main" === this.loaderType_) {
+ var t = e.hasAudio,
+ i = e.hasVideo,
+ n = e.isMuxed;
+ if (i && t && !this.audioDisabled_ && !n) return this.sourceUpdater_.buffered();
+ if (i) return this.sourceUpdater_.videoBuffered()
+ }
+ return this.sourceUpdater_.audioBuffered()
+ }, i.initSegmentForMap = function(e, t) {
+ if (void 0 === t && (t = !1), !e) return null;
+ var i = Wa(e),
+ n = this.initSegments_[i];
+ return t && !n && e.bytes && (this.initSegments_[i] = n = {
+ resolvedUri: e.resolvedUri,
+ byterange: e.byterange,
+ bytes: e.bytes,
+ tracks: e.tracks,
+ timescales: e.timescales
+ }), n || e
+ }, i.segmentKey = function(e, t) {
+ if (void 0 === t && (t = !1), !e) return null;
+ var i = Ya(e),
+ n = this.keyCache_[i];
+ this.cacheEncryptionKeys_ && t && !n && e.bytes && (this.keyCache_[i] = n = {
+ resolvedUri: e.resolvedUri,
+ bytes: e.bytes
+ });
+ var r = {
+ resolvedUri: (n || e).resolvedUri
+ };
+ return n && (r.bytes = n.bytes), r
+ }, i.couldBeginLoading_ = function() {
+ return this.playlist_ && !this.paused()
+ }, i.load = function() {
+ if (this.monitorBuffer_(), this.playlist_) return "INIT" === this.state && this.couldBeginLoading_() ? this.init_() : void(!this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || (this.state = "READY"))
+ }, i.init_ = function() {
+ return this.state = "READY", this.resetEverything(), this.monitorBuffer_()
+ }, i.playlist = function(e, t) {
+ if (void 0 === t && (t = {}), e) {
+ var i = this.playlist_,
+ n = this.pendingSegment_;
+ this.playlist_ = e, this.xhrOptions_ = t, "INIT" === this.state && (e.syncInfo = {
+ mediaSequence: e.mediaSequence,
+ time: 0
+ }, "main" === this.loaderType_ && this.syncController_.setDateTimeMappingForStart(e));
+ var r = null;
+ if (i && (i.id ? r = i.id : i.uri && (r = i.uri)), this.logger_("playlist update [" + r + " => " + (e.id || e.uri) + "]"), this.trigger("syncinfoupdate"), "INIT" === this.state && this.couldBeginLoading_()) return this.init_();
+ if (!i || i.uri !== e.uri) return null !== this.mediaIndex && this.resyncLoader(), this.currentMediaInfo_ = void 0, void this.trigger("playlistupdate");
+ var a = e.mediaSequence - i.mediaSequence;
+ if (this.logger_("live window shift [" + a + "]"), null !== this.mediaIndex)
+ if (this.mediaIndex -= a, this.mediaIndex < 0) this.mediaIndex = null, this.partIndex = null;
+ else {
+ var s = this.playlist_.segments[this.mediaIndex];
+ if (this.partIndex && (!s.parts || !s.parts.length || !s.parts[this.partIndex])) {
+ var o = this.mediaIndex;
+ this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."), this.resetLoader(), this.mediaIndex = o
+ }
+ } n && (n.mediaIndex -= a, n.mediaIndex < 0 ? (n.mediaIndex = null, n.partIndex = null) : (n.mediaIndex >= 0 && (n.segment = e.segments[n.mediaIndex]), n.partIndex >= 0 && n.segment.parts && (n.part = n.segment.parts[n.partIndex]))), this.syncController_.saveExpiredSegmentInfo(i, e)
+ }
+ }, i.pause = function() {
+ this.checkBufferTimeout_ && (C.default.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = null)
+ }, i.paused = function() {
+ return null === this.checkBufferTimeout_
+ }, i.resetEverything = function(e) {
+ this.ended_ = !1, this.appendInitSegment_ = {
+ audio: !0,
+ video: !0
+ }, this.resetLoader(), this.remove(0, 1 / 0, e), this.transmuxer_ && this.transmuxer_.postMessage({
+ action: "clearAllMp4Captions"
+ })
+ }, i.resetLoader = function() {
+ this.fetchAtBuffer_ = !1, this.resyncLoader()
+ }, i.resyncLoader = function() {
+ this.transmuxer_ && ps(this.transmuxer_), this.mediaIndex = null, this.partIndex = null, this.syncPoint_ = null, this.isPendingTimestampOffset_ = !1, this.callQueue_ = [], this.loadQueue_ = [], this.metadataQueue_.id3 = [], this.metadataQueue_.caption = [], this.abort(), this.transmuxer_ && this.transmuxer_.postMessage({
+ action: "clearParsedMp4Captions"
+ })
+ }, i.remove = function(e, t, i, n) {
+ if (void 0 === i && (i = function() {}), void 0 === n && (n = !1), t === 1 / 0 && (t = this.duration_()), t <= e) this.logger_("skipping remove because end ${end} is <= start ${start}");
+ else if (this.sourceUpdater_ && this.getMediaInfo_()) {
+ var r = 1,
+ a = function() {
+ 0 === --r && i()
+ };
+ for (var s in !n && this.audioDisabled_ || (r++, this.sourceUpdater_.removeAudio(e, t, a)), (n || "main" === this.loaderType_) && (this.gopBuffer_ = function(e, t, i, n) {
+ for (var r = Math.ceil((t - n) * E.ONE_SECOND_IN_TS), a = Math.ceil((i - n) * E.ONE_SECOND_IN_TS), s = e.slice(), o = e.length; o-- && !(e[o].pts <= a););
+ if (-1 === o) return s;
+ for (var u = o + 1; u-- && !(e[u].pts <= r););
+ return u = Math.max(u, 0), s.splice(u, o - u + 1), s
+ }(this.gopBuffer_, e, t, this.timeMapping_), r++, this.sourceUpdater_.removeVideo(e, t, a)), this.inbandTextTracks_) Gs(e, t, this.inbandTextTracks_[s]);
+ Gs(e, t, this.segmentMetadataTrack_), a()
+ } else this.logger_("skipping remove because no source updater or starting media info")
+ }, i.monitorBuffer_ = function() {
+ this.checkBufferTimeout_ && C.default.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = C.default.setTimeout(this.monitorBufferTick_.bind(this), 1)
+ }, i.monitorBufferTick_ = function() {
+ "READY" === this.state && this.fillBuffer_(), this.checkBufferTimeout_ && C.default.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = C.default.setTimeout(this.monitorBufferTick_.bind(this), 500)
+ }, i.fillBuffer_ = function() {
+ if (!this.sourceUpdater_.updating()) {
+ var e = this.chooseNextRequest_();
+ e && ("number" == typeof e.timestampOffset && (this.isPendingTimestampOffset_ = !1, this.timelineChangeController_.pendingTimelineChange({
+ type: this.loaderType_,
+ from: this.currentTimeline_,
+ to: e.timeline
+ })), this.loadSegment_(e))
+ }
+ }, i.isEndOfStream_ = function(e, t, i) {
+ if (void 0 === e && (e = this.mediaIndex), void 0 === t && (t = this.playlist_), void 0 === i && (i = this.partIndex), !t || !this.mediaSource_) return !1;
+ var n = "number" == typeof e && t.segments[e],
+ r = e + 1 === t.segments.length,
+ a = !n || !n.parts || i + 1 === n.parts.length;
+ return t.endList && "open" === this.mediaSource_.readyState && r && a
+ }, i.chooseNextRequest_ = function() {
+ var e = na(this.buffered_()) || 0,
+ t = Math.max(0, e - this.currentTime_()),
+ i = !this.hasPlayed_() && t >= 1,
+ n = t >= this.goalBufferLength_(),
+ r = this.playlist_.segments;
+ if (!r.length || i || n) return null;
+ this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
+ var a = {
+ partIndex: null,
+ mediaIndex: null,
+ startOfSegment: null,
+ playlist: this.playlist_,
+ isSyncRequest: Boolean(!this.syncPoint_)
+ };
+ if (a.isSyncRequest) a.mediaIndex = function(e, t, i) {
+ t = t || [];
+ for (var n = [], r = 0, a = 0; a < t.length; a++) {
+ var s = t[a];
+ if (e === s.timeline && (n.push(a), (r += s.duration) > i)) return a
+ }
+ return 0 === n.length ? 0 : n[n.length - 1]
+ }(this.currentTimeline_, r, e);
+ else if (null !== this.mediaIndex) {
+ var s = r[this.mediaIndex],
+ o = "number" == typeof this.partIndex ? this.partIndex : -1;
+ a.startOfSegment = s.end ? s.end : e, s.parts && s.parts[o + 1] ? (a.mediaIndex = this.mediaIndex, a.partIndex = o + 1) : a.mediaIndex = this.mediaIndex + 1
+ } else {
+ var u = Sa.getMediaInfoForTime({
+ experimentalExactManifestTimings: this.experimentalExactManifestTimings,
+ playlist: this.playlist_,
+ currentTime: this.fetchAtBuffer_ ? e : this.currentTime_(),
+ startingPartIndex: this.syncPoint_.partIndex,
+ startingSegmentIndex: this.syncPoint_.segmentIndex,
+ startTime: this.syncPoint_.time
+ }),
+ l = u.segmentIndex,
+ h = u.startTime,
+ d = u.partIndex;
+ a.getMediaInfoForTime = this.fetchAtBuffer_ ? "bufferedEnd" : "currentTime", a.mediaIndex = l, a.startOfSegment = h, a.partIndex = d
+ }
+ var c = r[a.mediaIndex],
+ f = c && "number" == typeof a.partIndex && c.parts && c.parts[a.partIndex];
+ if (!c || "number" == typeof a.partIndex && !f) return null;
+ "number" != typeof a.partIndex && c.parts && (a.partIndex = 0);
+ var p = this.mediaSource_ && "ended" === this.mediaSource_.readyState;
+ return a.mediaIndex >= r.length - 1 && p && !this.seeking_() ? null : this.generateSegmentInfo_(a)
+ }, i.generateSegmentInfo_ = function(e) {
+ var t = e.playlist,
+ i = e.mediaIndex,
+ n = e.startOfSegment,
+ r = e.isSyncRequest,
+ a = e.partIndex,
+ s = e.forceTimestampOffset,
+ o = e.getMediaInfoForTime,
+ u = t.segments[i],
+ l = "number" == typeof a && u.parts[a],
+ h = {
+ requestId: "segment-loader-" + Math.random(),
+ uri: l && l.resolvedUri || u.resolvedUri,
+ mediaIndex: i,
+ partIndex: l ? a : null,
+ isSyncRequest: r,
+ startOfSegment: n,
+ playlist: t,
+ bytes: null,
+ encryptedBytes: null,
+ timestampOffset: null,
+ timeline: u.timeline,
+ duration: l && l.duration || u.duration,
+ segment: u,
+ part: l,
+ byteLength: 0,
+ transmuxer: this.transmuxer_,
+ getMediaInfoForTime: o
+ },
+ d = void 0 !== s ? s : this.isPendingTimestampOffset_;
+ h.timestampOffset = this.timestampOffsetForSegment_({
+ segmentTimeline: u.timeline,
+ currentTimeline: this.currentTimeline_,
+ startOfSegment: n,
+ buffered: this.buffered_(),
+ overrideCheck: d
+ });
+ var c = na(this.sourceUpdater_.audioBuffered());
+ return "number" == typeof c && (h.audioAppendStart = c - this.sourceUpdater_.audioTimestampOffset()), this.sourceUpdater_.videoBuffered().length && (h.gopsToAlignWith = function(e, t, i) {
+ if (null == t || !e.length) return [];
+ var n, r = Math.ceil((t - i + 3) * E.ONE_SECOND_IN_TS);
+ for (n = 0; n < e.length && !(e[n].pts > r); n++);
+ return e.slice(n)
+ }(this.gopBuffer_, this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_)), h
+ }, i.timestampOffsetForSegment_ = function(e) {
+ return i = (t = e).segmentTimeline, n = t.currentTimeline, r = t.startOfSegment, a = t.buffered, t.overrideCheck || i !== n ? i < n ? r : a.length ? a.end(a.length - 1) : r : null;
+ var t, i, n, r, a
+ }, i.earlyAbortWhenNeeded_ = function(e) {
+ if (!this.vhs_.tech_.paused() && this.xhrOptions_.timeout && this.playlist_.attributes.BANDWIDTH && !(Date.now() - (e.firstBytesReceivedAt || Date.now()) < 1e3)) {
+ var t = this.currentTime_(),
+ i = e.bandwidth,
+ n = this.pendingSegment_.duration,
+ r = Sa.estimateSegmentRequestTime(n, i, this.playlist_, e.bytesReceived),
+ a = function(e, t, i) {
+ return void 0 === i && (i = 1), ((e.length ? e.end(e.length - 1) : 0) - t) / i
+ }(this.buffered_(), t, this.vhs_.tech_.playbackRate()) - 1;
+ if (!(r <= a)) {
+ var s = function(e) {
+ var t = e.master,
+ i = e.currentTime,
+ n = e.bandwidth,
+ r = e.duration,
+ a = e.segmentDuration,
+ s = e.timeUntilRebuffer,
+ o = e.currentTimeline,
+ u = e.syncController,
+ l = t.playlists.filter((function(e) {
+ return !Sa.isIncompatible(e)
+ })),
+ h = l.filter(Sa.isEnabled);
+ h.length || (h = l.filter((function(e) {
+ return !Sa.isDisabled(e)
+ })));
+ var d = h.filter(Sa.hasAttribute.bind(null, "BANDWIDTH")).map((function(e) {
+ var t = u.getSyncPoint(e, r, o, i) ? 1 : 2;
+ return {
+ playlist: e,
+ rebufferingImpact: Sa.estimateSegmentRequestTime(a, n, e) * t - s
+ }
+ })),
+ c = d.filter((function(e) {
+ return e.rebufferingImpact <= 0
+ }));
+ return Ns(c, (function(e, t) {
+ return js(t.playlist, e.playlist)
+ })), c.length ? c[0] : (Ns(d, (function(e, t) {
+ return e.rebufferingImpact - t.rebufferingImpact
+ })), d[0] || null)
+ }({
+ master: this.vhs_.playlists.master,
+ currentTime: t,
+ bandwidth: i,
+ duration: this.duration_(),
+ segmentDuration: n,
+ timeUntilRebuffer: a,
+ currentTimeline: this.currentTimeline_,
+ syncController: this.syncController_
+ });
+ if (s) {
+ var o = r - a - s.rebufferingImpact,
+ u = .5;
+ a <= 1 / 30 && (u = 1), !s.playlist || s.playlist.uri === this.playlist_.uri || o < u || (this.bandwidth = s.playlist.attributes.BANDWIDTH * ns.BANDWIDTH_VARIANCE + 1, this.trigger("earlyabort"))
+ }
+ }
+ }
+ }, i.handleAbort_ = function(e) {
+ this.logger_("Aborting " + Ys(e)), this.mediaRequestsAborted += 1
+ }, i.handleProgress_ = function(e, t) {
+ this.earlyAbortWhenNeeded_(t.stats), this.checkForAbort_(t.requestId) || this.trigger("progress")
+ }, i.handleTrackInfo_ = function(e, t) {
+ this.earlyAbortWhenNeeded_(e.stats), this.checkForAbort_(e.requestId) || this.checkForIllegalMediaSwitch(t) || (t = t || {}, function(e, t) {
+ if (!e && !t || !e && t || e && !t) return !1;
+ if (e === t) return !0;
+ var i = Object.keys(e).sort(),
+ n = Object.keys(t).sort();
+ if (i.length !== n.length) return !1;
+ for (var r = 0; r < i.length; r++) {
+ var a = i[r];
+ if (a !== n[r]) return !1;
+ if (e[a] !== t[a]) return !1
+ }
+ return !0
+ }(this.currentMediaInfo_, t) || (this.appendInitSegment_ = {
+ audio: !0,
+ video: !0
+ }, this.startingMediaInfo_ = t, this.currentMediaInfo_ = t, this.logger_("trackinfo update", t), this.trigger("trackinfo")), this.checkForAbort_(e.requestId) || (this.pendingSegment_.trackInfo = t, this.hasEnoughInfoToAppend_() && this.processCallQueue_()))
+ }, i.handleTimingInfo_ = function(e, t, i, n) {
+ if (this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId)) {
+ var r = this.pendingSegment_,
+ a = qs(t);
+ r[a] = r[a] || {}, r[a][i] = n, this.logger_("timinginfo: " + t + " - " + i + " - " + n), this.hasEnoughInfoToAppend_() && this.processCallQueue_()
+ }
+ }, i.handleCaptions_ = function(e, t) {
+ var i = this;
+ if (this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId))
+ if (0 !== t.length)
+ if (this.pendingSegment_.hasAppendedData_) {
+ var n = null === this.sourceUpdater_.videoTimestampOffset() ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(),
+ r = {};
+ t.forEach((function(e) {
+ r[e.stream] = r[e.stream] || {
+ startTime: 1 / 0,
+ captions: [],
+ endTime: 0
+ };
+ var t = r[e.stream];
+ t.startTime = Math.min(t.startTime, e.startTime + n), t.endTime = Math.max(t.endTime, e.endTime + n), t.captions.push(e)
+ })), Object.keys(r).forEach((function(e) {
+ var t = r[e],
+ a = t.startTime,
+ s = t.endTime,
+ o = t.captions,
+ u = i.inbandTextTracks_;
+ i.logger_("adding cues from " + a + " -> " + s + " for " + e),
+ function(e, t, i) {
+ if (!e[i]) {
+ t.trigger({
+ type: "usage",
+ name: "vhs-608"
+ }), t.trigger({
+ type: "usage",
+ name: "hls-608"
+ });
+ var n = i;
+ /^cc708_/.test(i) && (n = "SERVICE" + i.split("_")[1]);
+ var r = t.textTracks().getTrackById(n);
+ if (r) e[i] = r;
+ else {
+ var a = i,
+ s = i,
+ o = !1,
+ u = (t.options_.vhs && t.options_.vhs.captionServices || {})[n];
+ u && (a = u.label, s = u.language, o = u.default), e[i] = t.addRemoteTextTrack({
+ kind: "captions",
+ id: n,
+ default: o,
+ label: a,
+ language: s
+ }, !1).track
+ }
+ }
+ }(u, i.vhs_.tech_, e), Gs(a, s, u[e]),
+ function(e) {
+ var t = e.inbandTextTracks,
+ i = e.captionArray,
+ n = e.timestampOffset;
+ if (i) {
+ var r = C.default.WebKitDataCue || C.default.VTTCue;
+ i.forEach((function(e) {
+ var i = e.stream;
+ t[i].addCue(new r(e.startTime + n, e.endTime + n, e.text))
+ }))
+ }
+ }({
+ captionArray: o,
+ inbandTextTracks: u,
+ timestampOffset: n
+ })
+ })), this.transmuxer_ && this.transmuxer_.postMessage({
+ action: "clearParsedMp4Captions"
+ })
+ } else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, e, t));
+ else this.logger_("SegmentLoader received no captions from a caption event")
+ }, i.handleId3_ = function(e, t, i) {
+ if (this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId))
+ if (this.pendingSegment_.hasAppendedData_) {
+ var n = null === this.sourceUpdater_.videoTimestampOffset() ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
+ ! function(e, t, i) {
+ e.metadataTrack_ || (e.metadataTrack_ = i.addRemoteTextTrack({
+ kind: "metadata",
+ label: "Timed Metadata"
+ }, !1).track, e.metadataTrack_.inBandMetadataTrackDispatchType = t)
+ }(this.inbandTextTracks_, i, this.vhs_.tech_), zs({
+ inbandTextTracks: this.inbandTextTracks_,
+ metadataArray: t,
+ timestampOffset: n,
+ videoDuration: this.duration_()
+ })
+ } else this.metadataQueue_.id3.push(this.handleId3_.bind(this, e, t, i))
+ }, i.processMetadataQueue_ = function() {
+ this.metadataQueue_.id3.forEach((function(e) {
+ return e()
+ })), this.metadataQueue_.caption.forEach((function(e) {
+ return e()
+ })), this.metadataQueue_.id3 = [], this.metadataQueue_.caption = []
+ }, i.processCallQueue_ = function() {
+ var e = this.callQueue_;
+ this.callQueue_ = [], e.forEach((function(e) {
+ return e()
+ }))
+ }, i.processLoadQueue_ = function() {
+ var e = this.loadQueue_;
+ this.loadQueue_ = [], e.forEach((function(e) {
+ return e()
+ }))
+ }, i.hasEnoughInfoToLoad_ = function() {
+ if ("audio" !== this.loaderType_) return !0;
+ var e = this.pendingSegment_;
+ return !!e && (!this.getCurrentMediaInfo_() || !Ks({
+ timelineChangeController: this.timelineChangeController_,
+ currentTimeline: this.currentTimeline_,
+ segmentTimeline: e.timeline,
+ loaderType: this.loaderType_,
+ audioDisabled: this.audioDisabled_
+ }))
+ }, i.getCurrentMediaInfo_ = function(e) {
+ return void 0 === e && (e = this.pendingSegment_), e && e.trackInfo || this.currentMediaInfo_
+ }, i.getMediaInfo_ = function(e) {
+ return void 0 === e && (e = this.pendingSegment_), this.getCurrentMediaInfo_(e) || this.startingMediaInfo_
+ }, i.hasEnoughInfoToAppend_ = function() {
+ if (!this.sourceUpdater_.ready()) return !1;
+ if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) return !1;
+ var e = this.pendingSegment_,
+ t = this.getCurrentMediaInfo_();
+ if (!e || !t) return !1;
+ var i = t.hasAudio,
+ n = t.hasVideo,
+ r = t.isMuxed;
+ return !(n && !e.videoTimingInfo) && (!(i && !this.audioDisabled_ && !r && !e.audioTimingInfo) && !Ks({
+ timelineChangeController: this.timelineChangeController_,
+ currentTimeline: this.currentTimeline_,
+ segmentTimeline: e.timeline,
+ loaderType: this.loaderType_,
+ audioDisabled: this.audioDisabled_
+ }))
+ }, i.handleData_ = function(e, t) {
+ if (this.earlyAbortWhenNeeded_(e.stats), !this.checkForAbort_(e.requestId))
+ if (!this.callQueue_.length && this.hasEnoughInfoToAppend_()) {
+ var i = this.pendingSegment_;
+ if (this.setTimeMapping_(i.timeline), this.updateMediaSecondsLoaded_(i.segment), "closed" !== this.mediaSource_.readyState) {
+ if (e.map && (e.map = this.initSegmentForMap(e.map, !0), i.segment.map = e.map), e.key && this.segmentKey(e.key, !0), i.isFmp4 = e.isFmp4, i.timingInfo = i.timingInfo || {}, i.isFmp4) this.trigger("fmp4"), i.timingInfo.start = i[qs(t.type)].start;
+ else {
+ var n, r = this.getCurrentMediaInfo_(),
+ a = "main" === this.loaderType_ && r && r.hasVideo;
+ a && (n = i.videoTimingInfo.start), i.timingInfo.start = this.trueSegmentStart_({
+ currentStart: i.timingInfo.start,
+ playlist: i.playlist,
+ mediaIndex: i.mediaIndex,
+ currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
+ useVideoTimingInfo: a,
+ firstVideoFrameTimeForData: n,
+ videoTimingInfo: i.videoTimingInfo,
+ audioTimingInfo: i.audioTimingInfo
+ })
+ }
+ if (this.updateAppendInitSegmentStatus(i, t.type), this.updateSourceBufferTimestampOffset_(i), i.isSyncRequest) {
+ this.updateTimingInfoEnd_(i), this.syncController_.saveSegmentTimingInfo({
+ segmentInfo: i,
+ shouldSaveTimelineMapping: "main" === this.loaderType_
+ });
+ var s = this.chooseNextRequest_();
+ if (s.mediaIndex !== i.mediaIndex || s.partIndex !== i.partIndex) return void this.logger_("sync segment was incorrect, not appending");
+ this.logger_("sync segment was correct, appending")
+ }
+ i.hasAppendedData_ = !0, this.processMetadataQueue_(), this.appendData_(i, t)
+ }
+ } else this.callQueue_.push(this.handleData_.bind(this, e, t))
+ }, i.updateAppendInitSegmentStatus = function(e, t) {
+ "main" !== this.loaderType_ || "number" != typeof e.timestampOffset || e.changedTimestampOffset || (this.appendInitSegment_ = {
+ audio: !0,
+ video: !0
+ }), this.playlistOfLastInitSegment_[t] !== e.playlist && (this.appendInitSegment_[t] = !0)
+ }, i.getInitSegmentAndUpdateState_ = function(e) {
+ var t = e.type,
+ i = e.initSegment,
+ n = e.map,
+ r = e.playlist;
+ if (n) {
+ var a = Wa(n);
+ if (this.activeInitSegmentId_ === a) return null;
+ i = this.initSegmentForMap(n, !0).bytes, this.activeInitSegmentId_ = a
+ }
+ return i && this.appendInitSegment_[t] ? (this.playlistOfLastInitSegment_[t] = r, this.appendInitSegment_[t] = !1, this.activeInitSegmentId_ = null, i) : null
+ }, i.handleQuotaExceededError_ = function(e, t) {
+ var i = this,
+ n = e.segmentInfo,
+ r = e.type,
+ a = e.bytes,
+ s = this.sourceUpdater_.audioBuffered(),
+ o = this.sourceUpdater_.videoBuffered();
+ s.length > 1 && this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + ia(s).join(", ")), o.length > 1 && this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + ia(o).join(", "));
+ var u = s.length ? s.start(0) : 0,
+ l = s.length ? s.end(s.length - 1) : 0,
+ h = o.length ? o.start(0) : 0,
+ d = o.length ? o.end(o.length - 1) : 0;
+ if (l - u <= 1 && d - h <= 1) return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: " + a.byteLength + ", audio buffer: " + ia(s).join(", ") + ", video buffer: " + ia(o).join(", ") + ", "), this.error({
+ message: "Quota exceeded error with append of a single segment of content",
+ excludeUntil: 1 / 0
+ }), void this.trigger("error");
+ this.waitingOnRemove_ = !0, this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
+ segmentInfo: n,
+ type: r,
+ bytes: a
+ }));
+ var c = this.currentTime_() - 1;
+ this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + c), this.remove(0, c, (function() {
+ i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"), i.waitingOnRemove_ = !1, i.quotaExceededErrorRetryTimeout_ = C.default.setTimeout((function() {
+ i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"), i.quotaExceededErrorRetryTimeout_ = null, i.processCallQueue_()
+ }), 1e3)
+ }), !0)
+ }, i.handleAppendError_ = function(e, t) {
+ var i = e.segmentInfo,
+ n = e.type,
+ r = e.bytes;
+ t && (22 !== t.code ? (this.logger_("Received non QUOTA_EXCEEDED_ERR on append", t), this.error(n + " append of " + r.length + "b failed for segment #" + i.mediaIndex + " in playlist " + i.playlist.id), this.trigger("appenderror")) : this.handleQuotaExceededError_({
+ segmentInfo: i,
+ type: n,
+ bytes: r
+ }))
+ }, i.appendToSourceBuffer_ = function(e) {
+ var t, i, n, r = e.segmentInfo,
+ a = e.type,
+ s = e.initSegment,
+ o = e.data,
+ u = e.bytes;
+ if (!u) {
+ var l = [o],
+ h = o.byteLength;
+ s && (l.unshift(s), h += s.byteLength), n = 0, (t = {
+ bytes: h,
+ segments: l
+ }).bytes && (i = new Uint8Array(t.bytes), t.segments.forEach((function(e) {
+ i.set(e, n), n += e.byteLength
+ }))), u = i
+ }
+ this.sourceUpdater_.appendBuffer({
+ segmentInfo: r,
+ type: a,
+ bytes: u
+ }, this.handleAppendError_.bind(this, {
+ segmentInfo: r,
+ type: a,
+ bytes: u
+ }))
+ }, i.handleSegmentTimingInfo_ = function(e, t, i) {
+ if (this.pendingSegment_ && t === this.pendingSegment_.requestId) {
+ var n = this.pendingSegment_.segment,
+ r = e + "TimingInfo";
+ n[r] || (n[r] = {}), n[r].transmuxerPrependedSeconds = i.prependedContentDuration || 0, n[r].transmuxedPresentationStart = i.start.presentation, n[r].transmuxedDecodeStart = i.start.decode, n[r].transmuxedPresentationEnd = i.end.presentation, n[r].transmuxedDecodeEnd = i.end.decode, n[r].baseMediaDecodeTime = i.baseMediaDecodeTime
+ }
+ }, i.appendData_ = function(e, t) {
+ var i = t.type,
+ n = t.data;
+ if (n && n.byteLength && ("audio" !== i || !this.audioDisabled_)) {
+ var r = this.getInitSegmentAndUpdateState_({
+ type: i,
+ initSegment: t.initSegment,
+ playlist: e.playlist,
+ map: e.isFmp4 ? e.segment.map : null
+ });
+ this.appendToSourceBuffer_({
+ segmentInfo: e,
+ type: i,
+ initSegment: r,
+ data: n
+ })
+ }
+ }, i.loadSegment_ = function(e) {
+ var t = this;
+ this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), "number" == typeof e.timestampOffset && this.transmuxer_ && this.transmuxer_.postMessage({
+ action: "clearAllMp4Captions"
+ }), this.hasEnoughInfoToLoad_() ? this.updateTransmuxerAndRequestSegment_(e) : this.loadQueue_.push((function() {
+ var i = P.default({}, e, {
+ forceTimestampOffset: !0
+ });
+ P.default(e, t.generateSegmentInfo_(i)), t.isPendingTimestampOffset_ = !1, t.updateTransmuxerAndRequestSegment_(e)
+ }))
+ }, i.updateTransmuxerAndRequestSegment_ = function(e) {
+ var t = this;
+ this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset) && (this.gopBuffer_.length = 0, e.gopsToAlignWith = [], this.timeMapping_ = 0, this.transmuxer_.postMessage({
+ action: "reset"
+ }), this.transmuxer_.postMessage({
+ action: "setTimestampOffset",
+ timestampOffset: e.timestampOffset
+ }));
+ var i = this.createSimplifiedSegmentObj_(e),
+ n = this.isEndOfStream_(e.mediaIndex, e.playlist, e.partIndex),
+ r = null !== this.mediaIndex,
+ a = e.timeline !== this.currentTimeline_ && e.timeline > 0,
+ s = n || r && a;
+ this.logger_("Requesting " + Ys(e)), i.map && !i.map.bytes && (this.logger_("going to request init segment."), this.appendInitSegment_ = {
+ video: !0,
+ audio: !0
+ }), e.abortRequests = Ls({
+ xhr: this.vhs_.xhr,
+ xhrOptions: this.xhrOptions_,
+ decryptionWorker: this.decrypter_,
+ segment: i,
+ abortFn: this.handleAbort_.bind(this, e),
+ progressFn: this.handleProgress_.bind(this),
+ trackInfoFn: this.handleTrackInfo_.bind(this),
+ timingInfoFn: this.handleTimingInfo_.bind(this),
+ videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", e.requestId),
+ audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", e.requestId),
+ captionsFn: this.handleCaptions_.bind(this),
+ isEndOfTimeline: s,
+ endedTimelineFn: function() {
+ t.logger_("received endedtimeline callback")
+ },
+ id3Fn: this.handleId3_.bind(this),
+ dataFn: this.handleData_.bind(this),
+ doneFn: this.segmentRequestFinished_.bind(this),
+ onTransmuxerLog: function(i) {
+ var n = i.message,
+ r = i.level,
+ a = i.stream;
+ t.logger_(Ys(e) + " logged from transmuxer stream " + a + " as a " + r + ": " + n)
+ }
+ })
+ }, i.trimBackBuffer_ = function(e) {
+ var t = function(e, t, i) {
+ var n = t - ns.BACK_BUFFER_LENGTH;
+ e.length && (n = Math.max(n, e.start(0)));
+ var r = t - i;
+ return Math.min(r, n)
+ }(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
+ t > 0 && this.remove(0, t)
+ }, i.createSimplifiedSegmentObj_ = function(e) {
+ var t = e.segment,
+ i = e.part,
+ n = {
+ resolvedUri: i ? i.resolvedUri : t.resolvedUri,
+ byterange: i ? i.byterange : t.byterange,
+ requestId: e.requestId,
+ transmuxer: e.transmuxer,
+ audioAppendStart: e.audioAppendStart,
+ gopsToAlignWith: e.gopsToAlignWith,
+ part: e.part
+ },
+ r = e.playlist.segments[e.mediaIndex - 1];
+ if (r && r.timeline === t.timeline && (r.videoTimingInfo ? n.baseStartTime = r.videoTimingInfo.transmuxedDecodeEnd : r.audioTimingInfo && (n.baseStartTime = r.audioTimingInfo.transmuxedDecodeEnd)), t.key) {
+ var a = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist.mediaSequence]);
+ n.key = this.segmentKey(t.key), n.key.iv = a
+ }
+ return t.map && (n.map = this.initSegmentForMap(t.map)), n
+ }, i.saveTransferStats_ = function(e) {
+ this.mediaRequests += 1, e && (this.mediaBytesTransferred += e.bytesReceived, this.mediaTransferDuration += e.roundTripTime)
+ }, i.saveBandwidthRelatedStats_ = function(e, t) {
+ this.pendingSegment_.byteLength = t.bytesReceived, e < 1 / 60 ? this.logger_("Ignoring segment's bandwidth because its duration of " + e + " is less than the min to record " + 1 / 60) : (this.bandwidth = t.bandwidth, this.roundTrip = t.roundTripTime)
+ }, i.handleTimeout_ = function() {
+ this.mediaRequestsTimedout += 1, this.bandwidth = 1, this.roundTrip = NaN, this.trigger("bandwidthupdate")
+ }, i.segmentRequestFinished_ = function(e, t, i) {
+ if (this.callQueue_.length) this.callQueue_.push(this.segmentRequestFinished_.bind(this, e, t, i));
+ else if (this.saveTransferStats_(t.stats), this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId) {
+ if (e) {
+ if (this.pendingSegment_ = null, this.state = "READY", e.code === ys) return;
+ return this.pause(), e.code === vs ? void this.handleTimeout_() : (this.mediaRequestsErrored += 1, this.error(e), void this.trigger("error"))
+ }
+ var n = this.pendingSegment_;
+ this.saveBandwidthRelatedStats_(n.duration, t.stats), n.endOfAllRequests = t.endOfAllRequests, i.gopInfo && (this.gopBuffer_ = function(e, t, i) {
+ if (!t.length) return e;
+ if (i) return t.slice();
+ for (var n = t[0].pts, r = 0; r < e.length && !(e[r].pts >= n); r++);
+ return e.slice(0, r).concat(t)
+ }(this.gopBuffer_, i.gopInfo, this.safeAppend_)), this.state = "APPENDING", this.trigger("appending"), this.waitForAppendsToComplete_(n)
+ }
+ }, i.setTimeMapping_ = function(e) {
+ var t = this.syncController_.mappingForTimeline(e);
+ null !== t && (this.timeMapping_ = t)
+ }, i.updateMediaSecondsLoaded_ = function(e) {
+ "number" == typeof e.start && "number" == typeof e.end ? this.mediaSecondsLoaded += e.end - e.start : this.mediaSecondsLoaded += e.duration
+ }, i.shouldUpdateTransmuxerTimestampOffset_ = function(e) {
+ return null !== e && ("main" === this.loaderType_ && e !== this.sourceUpdater_.videoTimestampOffset() || !this.audioDisabled_ && e !== this.sourceUpdater_.audioTimestampOffset())
+ }, i.trueSegmentStart_ = function(e) {
+ var t = e.currentStart,
+ i = e.playlist,
+ n = e.mediaIndex,
+ r = e.firstVideoFrameTimeForData,
+ a = e.currentVideoTimestampOffset,
+ s = e.useVideoTimingInfo,
+ o = e.videoTimingInfo,
+ u = e.audioTimingInfo;
+ if (void 0 !== t) return t;
+ if (!s) return u.start;
+ var l = i.segments[n - 1];
+ return 0 !== n && l && void 0 !== l.start && l.end === r + a ? o.start : r
+ }, i.waitForAppendsToComplete_ = function(e) {
+ var t = this.getCurrentMediaInfo_(e);
+ if (!t) return this.error({
+ message: "No starting media returned, likely due to an unsupported media format.",
+ blacklistDuration: 1 / 0
+ }), void this.trigger("error");
+ var i = t.hasAudio,
+ n = t.hasVideo,
+ r = t.isMuxed,
+ a = "main" === this.loaderType_ && n,
+ s = !this.audioDisabled_ && i && !r;
+ if (e.waitingOnAppends = 0, !e.hasAppendedData_) return e.timingInfo || "number" != typeof e.timestampOffset || (this.isPendingTimestampOffset_ = !0), e.timingInfo = {
+ start: 0
+ }, e.waitingOnAppends++, this.isPendingTimestampOffset_ || (this.updateSourceBufferTimestampOffset_(e), this.processMetadataQueue_()), void this.checkAppendsDone_(e);
+ a && e.waitingOnAppends++, s && e.waitingOnAppends++, a && this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, e)), s && this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, e))
+ }, i.checkAppendsDone_ = function(e) {
+ this.checkForAbort_(e.requestId) || (e.waitingOnAppends--, 0 === e.waitingOnAppends && this.handleAppendsDone_())
+ }, i.checkForIllegalMediaSwitch = function(e) {
+ var t = function(e, t, i) {
+ return "main" === e && t && i ? i.hasAudio || i.hasVideo ? t.hasVideo && !i.hasVideo ? "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest." : !t.hasVideo && i.hasVideo ? "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest." : null : "Neither audio nor video found in segment." : null
+ }(this.loaderType_, this.getCurrentMediaInfo_(), e);
+ return !!t && (this.error({
+ message: t,
+ blacklistDuration: 1 / 0
+ }), this.trigger("error"), !0)
+ }, i.updateSourceBufferTimestampOffset_ = function(e) {
+ if (null !== e.timestampOffset && "number" == typeof e.timingInfo.start && !e.changedTimestampOffset && "main" === this.loaderType_) {
+ var t = !1;
+ e.timestampOffset -= e.timingInfo.start, e.changedTimestampOffset = !0, e.timestampOffset !== this.sourceUpdater_.videoTimestampOffset() && (this.sourceUpdater_.videoTimestampOffset(e.timestampOffset), t = !0), e.timestampOffset !== this.sourceUpdater_.audioTimestampOffset() && (this.sourceUpdater_.audioTimestampOffset(e.timestampOffset), t = !0), t && this.trigger("timestampoffset")
+ }
+ }, i.updateTimingInfoEnd_ = function(e) {
+ e.timingInfo = e.timingInfo || {};
+ var t = this.getMediaInfo_(),
+ i = "main" === this.loaderType_ && t && t.hasVideo && e.videoTimingInfo ? e.videoTimingInfo : e.audioTimingInfo;
+ i && (e.timingInfo.end = "number" == typeof i.end ? i.end : i.start + e.duration)
+ }, i.handleAppendsDone_ = function() {
+ if (this.pendingSegment_ && this.trigger("appendsdone"), !this.pendingSegment_) return this.state = "READY", void(this.paused() || this.monitorBuffer_());
+ var e = this.pendingSegment_;
+ this.updateTimingInfoEnd_(e), this.shouldSaveSegmentTimingInfo_ && this.syncController_.saveSegmentTimingInfo({
+ segmentInfo: e,
+ shouldSaveTimelineMapping: "main" === this.loaderType_
+ });
+ var t = Qs(e, this.sourceType_);
+ if (t && ("warn" === t.severity ? Yr.log.warn(t.message) : this.logger_(t.message)), this.recordThroughput_(e), this.pendingSegment_ = null, this.state = "READY", !e.isSyncRequest || (this.trigger("syncinfoupdate"), e.hasAppendedData_)) {
+ this.logger_("Appended " + Ys(e)), this.addSegmentMetadataCue_(e), this.fetchAtBuffer_ = !0, this.currentTimeline_ !== e.timeline && (this.timelineChangeController_.lastTimelineChange({
+ type: this.loaderType_,
+ from: this.currentTimeline_,
+ to: e.timeline
+ }), "main" !== this.loaderType_ || this.audioDisabled_ || this.timelineChangeController_.lastTimelineChange({
+ type: "audio",
+ from: this.currentTimeline_,
+ to: e.timeline
+ })), this.currentTimeline_ = e.timeline, this.trigger("syncinfoupdate");
+ var i = e.segment;
+ if (i.end && this.currentTime_() - i.end > 3 * e.playlist.targetDuration) this.resetEverything();
+ else null !== this.mediaIndex && this.trigger("bandwidthupdate"), this.trigger("progress"), this.mediaIndex = e.mediaIndex, this.partIndex = e.partIndex, this.isEndOfStream_(e.mediaIndex, e.playlist, e.partIndex) && this.endOfStream(), this.trigger("appended"), e.hasAppendedData_ && this.mediaAppends++, this.paused() || this.monitorBuffer_()
+ } else this.logger_("Throwing away un-appended sync request " + Ys(e))
+ }, i.recordThroughput_ = function(e) {
+ if (e.duration < 1 / 60) this.logger_("Ignoring segment's throughput because its duration of " + e.duration + " is less than the min to record " + 1 / 60);
+ else {
+ var t = this.throughput.rate,
+ i = Date.now() - e.endOfAllRequests + 1,
+ n = Math.floor(e.byteLength / i * 8 * 1e3);
+ this.throughput.rate += (n - t) / ++this.throughput.count
+ }
+ }, i.addSegmentMetadataCue_ = function(e) {
+ if (this.segmentMetadataTrack_) {
+ var t = e.segment,
+ i = t.start,
+ n = t.end;
+ if (Ws(i) && Ws(n)) {
+ Gs(i, n, this.segmentMetadataTrack_);
+ var r = C.default.WebKitDataCue || C.default.VTTCue,
+ a = {
+ custom: t.custom,
+ dateTimeObject: t.dateTimeObject,
+ dateTimeString: t.dateTimeString,
+ bandwidth: e.playlist.attributes.BANDWIDTH,
+ resolution: e.playlist.attributes.RESOLUTION,
+ codecs: e.playlist.attributes.CODECS,
+ byteLength: e.byteLength,
+ uri: e.uri,
+ timeline: e.timeline,
+ playlist: e.playlist.id,
+ start: i,
+ end: n
+ },
+ s = new r(i, n, JSON.stringify(a));
+ s.value = a, this.segmentMetadataTrack_.addCue(s)
+ }
+ }
+ }, t
+ }(Yr.EventTarget);
+
+ function Js() {}
+ var Zs, eo = function(e) {
+ return "string" != typeof e ? e : e.replace(/./, (function(e) {
+ return e.toUpperCase()
+ }))
+ },
+ to = ["video", "audio"],
+ io = function(e, t) {
+ var i = t[e + "Buffer"];
+ return i && i.updating || t.queuePending[e]
+ },
+ no = function e(t, i) {
+ if (0 !== i.queue.length) {
+ var n = 0,
+ r = i.queue[n];
+ if ("mediaSource" !== r.type) {
+ if ("mediaSource" !== t && i.ready() && "closed" !== i.mediaSource.readyState && !io(t, i)) {
+ if (r.type !== t) {
+ if (null === (n = function(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ if ("mediaSource" === n.type) return null;
+ if (n.type === e) return i
+ }
+ return null
+ }(t, i.queue))) return;
+ r = i.queue[n]
+ }
+ return i.queue.splice(n, 1), i.queuePending[t] = r, r.action(t, i), r.doneFn ? void 0 : (i.queuePending[t] = null, void e(t, i))
+ }
+ } else i.updating() || "closed" === i.mediaSource.readyState || (i.queue.shift(), r.action(i), r.doneFn && r.doneFn(), e("audio", i), e("video", i))
+ }
+ },
+ ro = function(e, t) {
+ var i = t[e + "Buffer"],
+ n = eo(e);
+ i && (i.removeEventListener("updateend", t["on" + n + "UpdateEnd_"]), i.removeEventListener("error", t["on" + n + "Error_"]), t.codecs[e] = null, t[e + "Buffer"] = null)
+ },
+ ao = function(e, t) {
+ return e && t && -1 !== Array.prototype.indexOf.call(e.sourceBuffers, t)
+ },
+ so = function(e, t, i) {
+ return function(n, r) {
+ var a = r[n + "Buffer"];
+ if (ao(r.mediaSource, a)) {
+ r.logger_("Appending segment " + t.mediaIndex + "'s " + e.length + " bytes to " + n + "Buffer");
+ try {
+ a.appendBuffer(e)
+ } catch (e) {
+ r.logger_("Error with code " + e.code + " " + (22 === e.code ? "(QUOTA_EXCEEDED_ERR) " : "") + "when appending segment " + t.mediaIndex + " to " + n + "Buffer"), r.queuePending[n] = null, i(e)
+ }
+ }
+ }
+ },
+ oo = function(e, t) {
+ return function(i, n) {
+ var r = n[i + "Buffer"];
+ if (ao(n.mediaSource, r)) {
+ n.logger_("Removing " + e + " to " + t + " from " + i + "Buffer");
+ try {
+ r.remove(e, t)
+ } catch (r) {
+ n.logger_("Remove " + e + " to " + t + " from " + i + "Buffer failed")
+ }
+ }
+ }
+ },
+ uo = function(e) {
+ return function(t, i) {
+ var n = i[t + "Buffer"];
+ ao(i.mediaSource, n) && (i.logger_("Setting " + t + "timestampOffset to " + e), n.timestampOffset = e)
+ }
+ },
+ lo = function(e) {
+ return function(t, i) {
+ e()
+ }
+ },
+ ho = function(e) {
+ return function(t) {
+ if ("open" === t.mediaSource.readyState) {
+ t.logger_("Calling mediaSource endOfStream(" + (e || "") + ")");
+ try {
+ t.mediaSource.endOfStream(e)
+ } catch (e) {
+ Yr.log.warn("Failed to call media source endOfStream", e)
+ }
+ }
+ }
+ },
+ co = function(e) {
+ return function(t) {
+ t.logger_("Setting mediaSource duration to " + e);
+ try {
+ t.mediaSource.duration = e
+ } catch (e) {
+ Yr.log.warn("Failed to set media source duration", e)
+ }
+ }
+ },
+ fo = function() {
+ return function(e, t) {
+ if ("open" === t.mediaSource.readyState) {
+ var i = t[e + "Buffer"];
+ if (ao(t.mediaSource, i)) {
+ t.logger_("calling abort on " + e + "Buffer");
+ try {
+ i.abort()
+ } catch (t) {
+ Yr.log.warn("Failed to abort on " + e + "Buffer", t)
+ }
+ }
+ }
+ }
+ },
+ po = function(e, t) {
+ return function(i) {
+ var n = eo(e),
+ r = _.getMimeForCodec(t);
+ i.logger_("Adding " + e + "Buffer with codec " + t + " to mediaSource");
+ var a = i.mediaSource.addSourceBuffer(r);
+ a.addEventListener("updateend", i["on" + n + "UpdateEnd_"]), a.addEventListener("error", i["on" + n + "Error_"]), i.codecs[e] = t, i[e + "Buffer"] = a
+ }
+ },
+ mo = function(e) {
+ return function(t) {
+ var i = t[e + "Buffer"];
+ if (ro(e, t), ao(t.mediaSource, i)) {
+ t.logger_("Removing " + e + "Buffer with codec " + t.codecs[e] + " from mediaSource");
+ try {
+ t.mediaSource.removeSourceBuffer(i)
+ } catch (t) {
+ Yr.log.warn("Failed to removeSourceBuffer " + e + "Buffer", t)
+ }
+ }
+ }
+ },
+ _o = function(e) {
+ return function(t, i) {
+ var n = i[t + "Buffer"],
+ r = _.getMimeForCodec(e);
+ ao(i.mediaSource, n) && i.codecs[t] !== e && (i.logger_("changing " + t + "Buffer codec from " + i.codecs[t] + " to " + e), n.changeType(r), i.codecs[t] = e)
+ }
+ },
+ go = function(e) {
+ var t = e.type,
+ i = e.sourceUpdater,
+ n = e.action,
+ r = e.doneFn,
+ a = e.name;
+ i.queue.push({
+ type: t,
+ action: n,
+ doneFn: r,
+ name: a
+ }), no(t, i)
+ },
+ vo = function(e, t) {
+ return function(i) {
+ if (t.queuePending[e]) {
+ var n = t.queuePending[e].doneFn;
+ t.queuePending[e] = null, n && n(t[e + "Error_"])
+ }
+ no(e, t)
+ }
+ },
+ yo = function(e) {
+ function t(t) {
+ var i;
+ return (i = e.call(this) || this).mediaSource = t, i.sourceopenListener_ = function() {
+ return no("mediaSource", I.default(i))
+ }, i.mediaSource.addEventListener("sourceopen", i.sourceopenListener_), i.logger_ = $r("SourceUpdater"), i.audioTimestampOffset_ = 0, i.videoTimestampOffset_ = 0, i.queue = [], i.queuePending = {
+ audio: null,
+ video: null
+ }, i.delayedAudioAppendQueue_ = [], i.videoAppendQueued_ = !1, i.codecs = {}, i.onVideoUpdateEnd_ = vo("video", I.default(i)), i.onAudioUpdateEnd_ = vo("audio", I.default(i)), i.onVideoError_ = function(e) {
+ i.videoError_ = e
+ }, i.onAudioError_ = function(e) {
+ i.audioError_ = e
+ }, i.createdSourceBuffers_ = !1, i.initializedEme_ = !1, i.triggeredReady_ = !1, i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.initializedEme = function() {
+ this.initializedEme_ = !0, this.triggerReady()
+ }, i.hasCreatedSourceBuffers = function() {
+ return this.createdSourceBuffers_
+ }, i.hasInitializedAnyEme = function() {
+ return this.initializedEme_
+ }, i.ready = function() {
+ return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme()
+ }, i.createSourceBuffers = function(e) {
+ this.hasCreatedSourceBuffers() || (this.addOrChangeSourceBuffers(e), this.createdSourceBuffers_ = !0, this.trigger("createdsourcebuffers"), this.triggerReady())
+ }, i.triggerReady = function() {
+ this.ready() && !this.triggeredReady_ && (this.triggeredReady_ = !0, this.trigger("ready"))
+ }, i.addSourceBuffer = function(e, t) {
+ go({
+ type: "mediaSource",
+ sourceUpdater: this,
+ action: po(e, t),
+ name: "addSourceBuffer"
+ })
+ }, i.abort = function(e) {
+ go({
+ type: e,
+ sourceUpdater: this,
+ action: fo(e),
+ name: "abort"
+ })
+ }, i.removeSourceBuffer = function(e) {
+ this.canRemoveSourceBuffer() ? go({
+ type: "mediaSource",
+ sourceUpdater: this,
+ action: mo(e),
+ name: "removeSourceBuffer"
+ }) : Yr.log.error("removeSourceBuffer is not supported!")
+ }, i.canRemoveSourceBuffer = function() {
+ return !Yr.browser.IE_VERSION && !Yr.browser.IS_FIREFOX && C.default.MediaSource && C.default.MediaSource.prototype && "function" == typeof C.default.MediaSource.prototype.removeSourceBuffer
+ }, t.canChangeType = function() {
+ return C.default.SourceBuffer && C.default.SourceBuffer.prototype && "function" == typeof C.default.SourceBuffer.prototype.changeType
+ }, i.canChangeType = function() {
+ return this.constructor.canChangeType()
+ }, i.changeType = function(e, t) {
+ this.canChangeType() ? go({
+ type: e,
+ sourceUpdater: this,
+ action: _o(t),
+ name: "changeType"
+ }) : Yr.log.error("changeType is not supported!")
+ }, i.addOrChangeSourceBuffers = function(e) {
+ var t = this;
+ if (!e || "object" != typeof e || 0 === Object.keys(e).length) throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
+ Object.keys(e).forEach((function(i) {
+ var n = e[i];
+ if (!t.hasCreatedSourceBuffers()) return t.addSourceBuffer(i, n);
+ t.canChangeType() && t.changeType(i, n)
+ }))
+ }, i.appendBuffer = function(e, t) {
+ var i = this,
+ n = e.segmentInfo,
+ r = e.type,
+ a = e.bytes;
+ if (this.processedAppend_ = !0, "audio" === r && this.videoBuffer && !this.videoAppendQueued_) return this.delayedAudioAppendQueue_.push([e, t]), void this.logger_("delayed audio append of " + a.length + " until video append");
+ if (go({
+ type: r,
+ sourceUpdater: this,
+ action: so(a, n || {
+ mediaIndex: -1
+ }, t),
+ doneFn: t,
+ name: "appendBuffer"
+ }), "video" === r) {
+ if (this.videoAppendQueued_ = !0, !this.delayedAudioAppendQueue_.length) return;
+ var s = this.delayedAudioAppendQueue_.slice();
+ this.logger_("queuing delayed audio " + s.length + " appendBuffers"), this.delayedAudioAppendQueue_.length = 0, s.forEach((function(e) {
+ i.appendBuffer.apply(i, e)
+ }))
+ }
+ }, i.audioBuffered = function() {
+ return ao(this.mediaSource, this.audioBuffer) && this.audioBuffer.buffered ? this.audioBuffer.buffered : Yr.createTimeRange()
+ }, i.videoBuffered = function() {
+ return ao(this.mediaSource, this.videoBuffer) && this.videoBuffer.buffered ? this.videoBuffer.buffered : Yr.createTimeRange()
+ }, i.buffered = function() {
+ var e = ao(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null,
+ t = ao(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
+ return t && !e ? this.audioBuffered() : e && !t ? this.videoBuffered() : function(e, t) {
+ var i = null,
+ n = null,
+ r = 0,
+ a = [],
+ s = [];
+ if (!(e && e.length && t && t.length)) return Yr.createTimeRange();
+ for (var o = e.length; o--;) a.push({
+ time: e.start(o),
+ type: "start"
+ }), a.push({
+ time: e.end(o),
+ type: "end"
+ });
+ for (o = t.length; o--;) a.push({
+ time: t.start(o),
+ type: "start"
+ }), a.push({
+ time: t.end(o),
+ type: "end"
+ });
+ for (a.sort((function(e, t) {
+ return e.time - t.time
+ })), o = 0; o < a.length; o++) "start" === a[o].type ? 2 === ++r && (i = a[o].time) : "end" === a[o].type && 1 === --r && (n = a[o].time), null !== i && null !== n && (s.push([i, n]), i = null, n = null);
+ return Yr.createTimeRanges(s)
+ }(this.audioBuffered(), this.videoBuffered())
+ }, i.setDuration = function(e, t) {
+ void 0 === t && (t = Js), go({
+ type: "mediaSource",
+ sourceUpdater: this,
+ action: co(e),
+ name: "duration",
+ doneFn: t
+ })
+ }, i.endOfStream = function(e, t) {
+ void 0 === e && (e = null), void 0 === t && (t = Js), "string" != typeof e && (e = void 0), go({
+ type: "mediaSource",
+ sourceUpdater: this,
+ action: ho(e),
+ name: "endOfStream",
+ doneFn: t
+ })
+ }, i.removeAudio = function(e, t, i) {
+ void 0 === i && (i = Js), this.audioBuffered().length && 0 !== this.audioBuffered().end(0) ? go({
+ type: "audio",
+ sourceUpdater: this,
+ action: oo(e, t),
+ doneFn: i,
+ name: "remove"
+ }) : i()
+ }, i.removeVideo = function(e, t, i) {
+ void 0 === i && (i = Js), this.videoBuffered().length && 0 !== this.videoBuffered().end(0) ? go({
+ type: "video",
+ sourceUpdater: this,
+ action: oo(e, t),
+ doneFn: i,
+ name: "remove"
+ }) : i()
+ }, i.updating = function() {
+ return !(!io("audio", this) && !io("video", this))
+ }, i.audioTimestampOffset = function(e) {
+ return void 0 !== e && this.audioBuffer && this.audioTimestampOffset_ !== e && (go({
+ type: "audio",
+ sourceUpdater: this,
+ action: uo(e),
+ name: "timestampOffset"
+ }), this.audioTimestampOffset_ = e), this.audioTimestampOffset_
+ }, i.videoTimestampOffset = function(e) {
+ return void 0 !== e && this.videoBuffer && this.videoTimestampOffset !== e && (go({
+ type: "video",
+ sourceUpdater: this,
+ action: uo(e),
+ name: "timestampOffset"
+ }), this.videoTimestampOffset_ = e), this.videoTimestampOffset_
+ }, i.audioQueueCallback = function(e) {
+ this.audioBuffer && go({
+ type: "audio",
+ sourceUpdater: this,
+ action: lo(e),
+ name: "callback"
+ })
+ }, i.videoQueueCallback = function(e) {
+ this.videoBuffer && go({
+ type: "video",
+ sourceUpdater: this,
+ action: lo(e),
+ name: "callback"
+ })
+ }, i.dispose = function() {
+ var e = this;
+ this.trigger("dispose"), to.forEach((function(t) {
+ e.abort(t), e.canRemoveSourceBuffer() ? e.removeSourceBuffer(t) : e[t + "QueueCallback"]((function() {
+ return ro(t, e)
+ }))
+ })), this.videoAppendQueued_ = !1, this.delayedAudioAppendQueue_.length = 0, this.sourceopenListener_ && this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_), this.off()
+ }, t
+ }(Yr.EventTarget),
+ bo = function(e) {
+ return decodeURIComponent(escape(String.fromCharCode.apply(null, e)))
+ },
+ So = new Uint8Array("\n\n".split("").map((function(e) {
+ return e.charCodeAt(0)
+ }))),
+ To = function(e) {
+ function t(t, i) {
+ var n;
+ return void 0 === i && (i = {}), (n = e.call(this, t, i) || this).mediaSource_ = null, n.subtitlesTrack_ = null, n.loaderType_ = "subtitle", n.featuresNativeTextTracks_ = t.featuresNativeTextTracks, n.shouldSaveSegmentTimingInfo_ = !1, n
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.createTransmuxer_ = function() {
+ return null
+ }, i.buffered_ = function() {
+ if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) return Yr.createTimeRanges();
+ var e = this.subtitlesTrack_.cues,
+ t = e[0].startTime,
+ i = e[e.length - 1].startTime;
+ return Yr.createTimeRanges([
+ [t, i]
+ ])
+ }, i.initSegmentForMap = function(e, t) {
+ if (void 0 === t && (t = !1), !e) return null;
+ var i = Wa(e),
+ n = this.initSegments_[i];
+ if (t && !n && e.bytes) {
+ var r = So.byteLength + e.bytes.byteLength,
+ a = new Uint8Array(r);
+ a.set(e.bytes), a.set(So, e.bytes.byteLength), this.initSegments_[i] = n = {
+ resolvedUri: e.resolvedUri,
+ byterange: e.byterange,
+ bytes: a
+ }
+ }
+ return n || e
+ }, i.couldBeginLoading_ = function() {
+ return this.playlist_ && this.subtitlesTrack_ && !this.paused()
+ }, i.init_ = function() {
+ return this.state = "READY", this.resetEverything(), this.monitorBuffer_()
+ }, i.track = function(e) {
+ return void 0 === e || (this.subtitlesTrack_ = e, "INIT" === this.state && this.couldBeginLoading_() && this.init_()), this.subtitlesTrack_
+ }, i.remove = function(e, t) {
+ Gs(e, t, this.subtitlesTrack_)
+ }, i.fillBuffer_ = function() {
+ var e = this,
+ t = this.chooseNextRequest_();
+ if (t) {
+ if (null === this.syncController_.timestampOffsetForTimeline(t.timeline)) {
+ return this.syncController_.one("timestampoffset", (function() {
+ e.state = "READY", e.paused() || e.monitorBuffer_()
+ })), void(this.state = "WAITING_ON_TIMELINE")
+ }
+ this.loadSegment_(t)
+ }
+ }, i.timestampOffsetForSegment_ = function() {
+ return null
+ }, i.chooseNextRequest_ = function() {
+ return this.skipEmptySegments_(e.prototype.chooseNextRequest_.call(this))
+ }, i.skipEmptySegments_ = function(e) {
+ for (; e && e.segment.empty;) {
+ if (e.mediaIndex + 1 >= e.playlist.segments.length) {
+ e = null;
+ break
+ }
+ e = this.generateSegmentInfo_({
+ playlist: e.playlist,
+ mediaIndex: e.mediaIndex + 1,
+ startOfSegment: e.startOfSegment + e.duration,
+ isSyncRequest: e.isSyncRequest
+ })
+ }
+ return e
+ }, i.stopForError = function(e) {
+ this.error(e), this.state = "READY", this.pause(), this.trigger("error")
+ }, i.segmentRequestFinished_ = function(e, t, i) {
+ var n = this;
+ if (this.subtitlesTrack_) {
+ if (this.saveTransferStats_(t.stats), !this.pendingSegment_) return this.state = "READY", void(this.mediaRequestsAborted += 1);
+ if (e) return e.code === vs && this.handleTimeout_(), e.code === ys ? this.mediaRequestsAborted += 1 : this.mediaRequestsErrored += 1, void this.stopForError(e);
+ var r = this.pendingSegment_;
+ this.saveBandwidthRelatedStats_(r.duration, t.stats), this.state = "APPENDING", this.trigger("appending");
+ var a = r.segment;
+ if (a.map && (a.map.bytes = t.map.bytes), r.bytes = t.bytes, "function" != typeof C.default.WebVTT && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) {
+ var s, o = function() {
+ n.subtitlesTrack_.tech_.off("vttjsloaded", s), n.stopForError({
+ message: "Error loading vtt.js"
+ })
+ };
+ return s = function() {
+ n.subtitlesTrack_.tech_.off("vttjserror", o), n.segmentRequestFinished_(e, t, i)
+ }, this.state = "WAITING_ON_VTTJS", this.subtitlesTrack_.tech_.one("vttjsloaded", s), void this.subtitlesTrack_.tech_.one("vttjserror", o)
+ }
+ a.requested = !0;
+ try {
+ this.parseVTTCues_(r)
+ } catch (e) {
+ return void this.stopForError({
+ message: e.message
+ })
+ }
+ if (this.updateTimeMapping_(r, this.syncController_.timelines[r.timeline], this.playlist_), r.cues.length ? r.timingInfo = {
+ start: r.cues[0].startTime,
+ end: r.cues[r.cues.length - 1].endTime
+ } : r.timingInfo = {
+ start: r.startOfSegment,
+ end: r.startOfSegment + r.duration
+ }, r.isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this.state = "READY");
+ r.byteLength = r.bytes.byteLength, this.mediaSecondsLoaded += a.duration, r.cues.forEach((function(e) {
+ n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_ ? new C.default.VTTCue(e.startTime, e.endTime, e.text) : e)
+ })),
+ function(e) {
+ var t = e.cues;
+ if (t)
+ for (var i = 0; i < t.length; i++) {
+ for (var n = [], r = 0, a = 0; a < t.length; a++) t[i].startTime === t[a].startTime && t[i].endTime === t[a].endTime && t[i].text === t[a].text && ++r > 1 && n.push(t[a]);
+ n.length && n.forEach((function(t) {
+ return e.removeCue(t)
+ }))
+ }
+ }(this.subtitlesTrack_), this.handleAppendsDone_()
+ } else this.state = "READY"
+ }, i.handleData_ = function() {}, i.updateTimingInfoEnd_ = function() {}, i.parseVTTCues_ = function(e) {
+ var t, i = !1;
+ "function" == typeof C.default.TextDecoder ? t = new C.default.TextDecoder("utf8") : (t = C.default.WebVTT.StringDecoder(), i = !0);
+ var n = new C.default.WebVTT.Parser(C.default, C.default.vttjs, t);
+ if (e.cues = [], e.timestampmap = {
+ MPEGTS: 0,
+ LOCAL: 0
+ }, n.oncue = e.cues.push.bind(e.cues), n.ontimestampmap = function(t) {
+ e.timestampmap = t
+ }, n.onparsingerror = function(e) {
+ Yr.log.warn("Error encountered when parsing cues: " + e.message)
+ }, e.segment.map) {
+ var r = e.segment.map.bytes;
+ i && (r = bo(r)), n.parse(r)
+ }
+ var a = e.bytes;
+ i && (a = bo(a)), n.parse(a), n.flush()
+ }, i.updateTimeMapping_ = function(e, t, i) {
+ var n = e.segment;
+ if (t)
+ if (e.cues.length) {
+ var r = e.timestampmap,
+ a = r.MPEGTS / E.ONE_SECOND_IN_TS - r.LOCAL + t.mapping;
+ if (e.cues.forEach((function(e) {
+ e.startTime += a, e.endTime += a
+ })), !i.syncInfo) {
+ var s = e.cues[0].startTime,
+ o = e.cues[e.cues.length - 1].startTime;
+ i.syncInfo = {
+ mediaSequence: i.mediaSequence + e.mediaIndex,
+ time: Math.min(s, o - n.duration)
+ }
+ }
+ } else n.empty = !0
+ }, t
+ }($s),
+ Eo = function(e, t) {
+ for (var i = e.cues, n = 0; n < i.length; n++) {
+ var r = i[n];
+ if (t >= r.adStartTime && t <= r.adEndTime) return r
+ }
+ return null
+ },
+ wo = [{
+ name: "VOD",
+ run: function(e, t, i, n, r) {
+ if (i !== 1 / 0) {
+ return {
+ time: 0,
+ segmentIndex: 0,
+ partIndex: null
+ }
+ }
+ return null
+ }
+ }, {
+ name: "ProgramDateTime",
+ run: function(e, t, i, n, r) {
+ if (!Object.keys(e.timelineToDatetimeMappings).length) return null;
+ var a = null,
+ s = null,
+ o = aa(t);
+ r = r || 0;
+ for (var u = 0; u < o.length; u++) {
+ var l = o[t.endList || 0 === r ? u : o.length - (u + 1)],
+ h = l.segment,
+ d = e.timelineToDatetimeMappings[h.timeline];
+ if (d && h.dateTimeObject) {
+ var c = h.dateTimeObject.getTime() / 1e3 + d;
+ if (h.parts && "number" == typeof l.partIndex)
+ for (var f = 0; f < l.partIndex; f++) c += h.parts[f].duration;
+ var p = Math.abs(r - c);
+ if (null !== s && (0 === p || s < p)) break;
+ s = p, a = {
+ time: c,
+ segmentIndex: l.segmentIndex,
+ partIndex: l.partIndex
+ }
+ }
+ }
+ return a
+ }
+ }, {
+ name: "Segment",
+ run: function(e, t, i, n, r) {
+ var a = null,
+ s = null;
+ r = r || 0;
+ for (var o = aa(t), u = 0; u < o.length; u++) {
+ var l = o[t.endList || 0 === r ? u : o.length - (u + 1)],
+ h = l.segment,
+ d = l.part && l.part.start || h && h.start;
+ if (h.timeline === n && void 0 !== d) {
+ var c = Math.abs(r - d);
+ if (null !== s && s < c) break;
+ (!a || null === s || s >= c) && (s = c, a = {
+ time: d,
+ segmentIndex: l.segmentIndex,
+ partIndex: l.partIndex
+ })
+ }
+ }
+ return a
+ }
+ }, {
+ name: "Discontinuity",
+ run: function(e, t, i, n, r) {
+ var a = null;
+ if (r = r || 0, t.discontinuityStarts && t.discontinuityStarts.length)
+ for (var s = null, o = 0; o < t.discontinuityStarts.length; o++) {
+ var u = t.discontinuityStarts[o],
+ l = t.discontinuitySequence + o + 1,
+ h = e.discontinuities[l];
+ if (h) {
+ var d = Math.abs(r - h.time);
+ if (null !== s && s < d) break;
+ (!a || null === s || s >= d) && (s = d, a = {
+ time: h.time,
+ segmentIndex: u,
+ partIndex: null
+ })
+ }
+ }
+ return a
+ }
+ }, {
+ name: "Playlist",
+ run: function(e, t, i, n, r) {
+ return t.syncInfo ? {
+ time: t.syncInfo.time,
+ segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence,
+ partIndex: null
+ } : null
+ }
+ }],
+ Ao = function(e) {
+ function t(t) {
+ var i;
+ return (i = e.call(this) || this).timelines = [], i.discontinuities = [], i.timelineToDatetimeMappings = {}, i.logger_ = $r("SyncController"), i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.getSyncPoint = function(e, t, i, n) {
+ var r = this.runStrategies_(e, t, i, n);
+ return r.length ? this.selectSyncPoint_(r, {
+ key: "time",
+ value: n
+ }) : null
+ }, i.getExpiredTime = function(e, t) {
+ if (!e || !e.segments) return null;
+ var i = this.runStrategies_(e, t, e.discontinuitySequence, 0);
+ if (!i.length) return null;
+ var n = this.selectSyncPoint_(i, {
+ key: "segmentIndex",
+ value: 0
+ });
+ return n.segmentIndex > 0 && (n.time *= -1), Math.abs(n.time + da({
+ defaultDuration: e.targetDuration,
+ durationList: e.segments,
+ startIndex: n.segmentIndex,
+ endIndex: 0
+ }))
+ }, i.runStrategies_ = function(e, t, i, n) {
+ for (var r = [], a = 0; a < wo.length; a++) {
+ var s = wo[a],
+ o = s.run(this, e, t, i, n);
+ o && (o.strategy = s.name, r.push({
+ strategy: s.name,
+ syncPoint: o
+ }))
+ }
+ return r
+ }, i.selectSyncPoint_ = function(e, t) {
+ for (var i = e[0].syncPoint, n = Math.abs(e[0].syncPoint[t.key] - t.value), r = e[0].strategy, a = 1; a < e.length; a++) {
+ var s = Math.abs(e[a].syncPoint[t.key] - t.value);
+ s < n && (n = s, i = e[a].syncPoint, r = e[a].strategy)
+ }
+ return this.logger_("syncPoint for [" + t.key + ": " + t.value + "] chosen with strategy [" + r + "]: [time:" + i.time + ", segmentIndex:" + i.segmentIndex + ("number" == typeof i.partIndex ? ",partIndex:" + i.partIndex : "") + "]"), i
+ }, i.saveExpiredSegmentInfo = function(e, t) {
+ for (var i = t.mediaSequence - e.mediaSequence - 1; i >= 0; i--) {
+ var n = e.segments[i];
+ if (n && void 0 !== n.start) {
+ t.syncInfo = {
+ mediaSequence: e.mediaSequence + i,
+ time: n.start
+ }, this.logger_("playlist refresh sync: [time:" + t.syncInfo.time + ", mediaSequence: " + t.syncInfo.mediaSequence + "]"), this.trigger("syncinfoupdate");
+ break
+ }
+ }
+ }, i.setDateTimeMappingForStart = function(e) {
+ if (this.timelineToDatetimeMappings = {}, e.segments && e.segments.length && e.segments[0].dateTimeObject) {
+ var t = e.segments[0],
+ i = t.dateTimeObject.getTime() / 1e3;
+ this.timelineToDatetimeMappings[t.timeline] = -i
+ }
+ }, i.saveSegmentTimingInfo = function(e) {
+ var t = e.segmentInfo,
+ i = e.shouldSaveTimelineMapping,
+ n = this.calculateSegmentTimeMapping_(t, t.timingInfo, i),
+ r = t.segment;
+ n && (this.saveDiscontinuitySyncInfo_(t), t.playlist.syncInfo || (t.playlist.syncInfo = {
+ mediaSequence: t.playlist.mediaSequence + t.mediaIndex,
+ time: r.start
+ }));
+ var a = r.dateTimeObject;
+ r.discontinuity && i && a && (this.timelineToDatetimeMappings[r.timeline] = -a.getTime() / 1e3)
+ }, i.timestampOffsetForTimeline = function(e) {
+ return void 0 === this.timelines[e] ? null : this.timelines[e].time
+ }, i.mappingForTimeline = function(e) {
+ return void 0 === this.timelines[e] ? null : this.timelines[e].mapping
+ }, i.calculateSegmentTimeMapping_ = function(e, t, i) {
+ var n, r, a = e.segment,
+ s = e.part,
+ o = this.timelines[e.timeline];
+ if ("number" == typeof e.timestampOffset) o = {
+ time: e.startOfSegment,
+ mapping: e.startOfSegment - t.start
+ }, i && (this.timelines[e.timeline] = o, this.trigger("timestampoffset"), this.logger_("time mapping for timeline " + e.timeline + ": [time: " + o.time + "] [mapping: " + o.mapping + "]")), n = e.startOfSegment, r = t.end + o.mapping;
+ else {
+ if (!o) return !1;
+ n = t.start + o.mapping, r = t.end + o.mapping
+ }
+ return s && (s.start = n, s.end = r), (!a.start || n < a.start) && (a.start = n), a.end = r, !0
+ }, i.saveDiscontinuitySyncInfo_ = function(e) {
+ var t = e.playlist,
+ i = e.segment;
+ if (i.discontinuity) this.discontinuities[i.timeline] = {
+ time: i.start,
+ accuracy: 0
+ };
+ else if (t.discontinuityStarts && t.discontinuityStarts.length)
+ for (var n = 0; n < t.discontinuityStarts.length; n++) {
+ var r = t.discontinuityStarts[n],
+ a = t.discontinuitySequence + n + 1,
+ s = r - e.mediaIndex,
+ o = Math.abs(s);
+ if (!this.discontinuities[a] || this.discontinuities[a].accuracy > o) {
+ var u = void 0;
+ u = s < 0 ? i.start - da({
+ defaultDuration: t.targetDuration,
+ durationList: t.segments,
+ startIndex: e.mediaIndex,
+ endIndex: r
+ }) : i.end + da({
+ defaultDuration: t.targetDuration,
+ durationList: t.segments,
+ startIndex: e.mediaIndex + 1,
+ endIndex: r
+ }), this.discontinuities[a] = {
+ time: u,
+ accuracy: o
+ }
+ }
+ }
+ }, i.dispose = function() {
+ this.trigger("dispose"), this.off()
+ }, t
+ }(Yr.EventTarget),
+ Co = function(e) {
+ function t() {
+ var t;
+ return (t = e.call(this) || this).pendingTimelineChanges_ = {}, t.lastTimelineChanges_ = {}, t
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.clearPendingTimelineChange = function(e) {
+ this.pendingTimelineChanges_[e] = null, this.trigger("pendingtimelinechange")
+ }, i.pendingTimelineChange = function(e) {
+ var t = e.type,
+ i = e.from,
+ n = e.to;
+ return "number" == typeof i && "number" == typeof n && (this.pendingTimelineChanges_[t] = {
+ type: t,
+ from: i,
+ to: n
+ }, this.trigger("pendingtimelinechange")), this.pendingTimelineChanges_[t]
+ }, i.lastTimelineChange = function(e) {
+ var t = e.type,
+ i = e.from,
+ n = e.to;
+ return "number" == typeof i && "number" == typeof n && (this.lastTimelineChanges_[t] = {
+ type: t,
+ from: i,
+ to: n
+ }, delete this.pendingTimelineChanges_[t], this.trigger("timelinechange")), this.lastTimelineChanges_[t]
+ }, i.dispose = function() {
+ this.trigger("dispose"), this.pendingTimelineChanges_ = {}, this.lastTimelineChanges_ = {}, this.off()
+ }, t
+ }(Yr.EventTarget),
+ ko = as(ss(os((function() {
+ function e(e, t, i) {
+ return e(i = {
+ path: t,
+ exports: {},
+ require: function(e, t) {
+ return function() {
+ throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")
+ }(null == t && i.path)
+ }
+ }, i.exports), i.exports
+ }
+ var t = e((function(e) {
+ function t(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ e.exports = function(e, i, n) {
+ return i && t(e.prototype, i), n && t(e, n), e
+ }, e.exports.default = e.exports, e.exports.__esModule = !0
+ })),
+ i = e((function(e) {
+ function t(i, n) {
+ return e.exports = t = Object.setPrototypeOf || function(e, t) {
+ return e.__proto__ = t, e
+ }, e.exports.default = e.exports, e.exports.__esModule = !0, t(i, n)
+ }
+ e.exports = t, e.exports.default = e.exports, e.exports.__esModule = !0
+ })),
+ n = e((function(e) {
+ e.exports = function(e, t) {
+ e.prototype = Object.create(t.prototype), e.prototype.constructor = e, i(e, t)
+ }, e.exports.default = e.exports, e.exports.__esModule = !0
+ })),
+ r = function() {
+ function e() {
+ this.listeners = {}
+ }
+ var t = e.prototype;
+ return t.on = function(e, t) {
+ this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
+ }, t.off = function(e, t) {
+ if (!this.listeners[e]) return !1;
+ var i = this.listeners[e].indexOf(t);
+ return this.listeners[e] = this.listeners[e].slice(0), this.listeners[e].splice(i, 1), i > -1
+ }, t.trigger = function(e) {
+ var t = this.listeners[e];
+ if (t)
+ if (2 === arguments.length)
+ for (var i = t.length, n = 0; n < i; ++n) t[n].call(this, arguments[1]);
+ else
+ for (var r = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s].apply(this, r)
+ }, t.dispose = function() {
+ this.listeners = {}
+ }, t.pipe = function(e) {
+ this.on("data", (function(t) {
+ e.push(t)
+ }))
+ }, e
+ }();
+ /*! @name aes-decrypter @version 3.1.2 @license Apache-2.0 */
+ var a = null,
+ s = function() {
+ function e(e) {
+ var t, i, n;
+ a || (a = function() {
+ var e, t, i, n, r, a, s, o, u = [
+ [
+ [],
+ [],
+ [],
+ [],
+ []
+ ],
+ [
+ [],
+ [],
+ [],
+ [],
+ []
+ ]
+ ],
+ l = u[0],
+ h = u[1],
+ d = l[4],
+ c = h[4],
+ f = [],
+ p = [];
+ for (e = 0; e < 256; e++) p[(f[e] = e << 1 ^ 283 * (e >> 7)) ^ e] = e;
+ for (t = i = 0; !d[t]; t ^= n || 1, i = p[i] || 1)
+ for (a = (a = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4) >> 8 ^ 255 & a ^ 99, d[t] = a, c[a] = t, o = 16843009 * f[r = f[n = f[t]]] ^ 65537 * r ^ 257 * n ^ 16843008 * t, s = 257 * f[a] ^ 16843008 * a, e = 0; e < 4; e++) l[e][t] = s = s << 24 ^ s >>> 8, h[e][a] = o = o << 24 ^ o >>> 8;
+ for (e = 0; e < 5; e++) l[e] = l[e].slice(0), h[e] = h[e].slice(0);
+ return u
+ }()), this._tables = [
+ [a[0][0].slice(), a[0][1].slice(), a[0][2].slice(), a[0][3].slice(), a[0][4].slice()],
+ [a[1][0].slice(), a[1][1].slice(), a[1][2].slice(), a[1][3].slice(), a[1][4].slice()]
+ ];
+ var r = this._tables[0][4],
+ s = this._tables[1],
+ o = e.length,
+ u = 1;
+ if (4 !== o && 6 !== o && 8 !== o) throw new Error("Invalid aes key size");
+ var l = e.slice(0),
+ h = [];
+ for (this._key = [l, h], t = o; t < 4 * o + 28; t++) n = l[t - 1], (t % o == 0 || 8 === o && t % o == 4) && (n = r[n >>> 24] << 24 ^ r[n >> 16 & 255] << 16 ^ r[n >> 8 & 255] << 8 ^ r[255 & n], t % o == 0 && (n = n << 8 ^ n >>> 24 ^ u << 24, u = u << 1 ^ 283 * (u >> 7))), l[t] = l[t - o] ^ n;
+ for (i = 0; t; i++, t--) n = l[3 & i ? t : t - 4], h[i] = t <= 4 || i < 4 ? n : s[0][r[n >>> 24]] ^ s[1][r[n >> 16 & 255]] ^ s[2][r[n >> 8 & 255]] ^ s[3][r[255 & n]]
+ }
+ return e.prototype.decrypt = function(e, t, i, n, r, a) {
+ var s, o, u, l, h = this._key[1],
+ d = e ^ h[0],
+ c = n ^ h[1],
+ f = i ^ h[2],
+ p = t ^ h[3],
+ m = h.length / 4 - 2,
+ _ = 4,
+ g = this._tables[1],
+ v = g[0],
+ y = g[1],
+ b = g[2],
+ S = g[3],
+ T = g[4];
+ for (l = 0; l < m; l++) s = v[d >>> 24] ^ y[c >> 16 & 255] ^ b[f >> 8 & 255] ^ S[255 & p] ^ h[_], o = v[c >>> 24] ^ y[f >> 16 & 255] ^ b[p >> 8 & 255] ^ S[255 & d] ^ h[_ + 1], u = v[f >>> 24] ^ y[p >> 16 & 255] ^ b[d >> 8 & 255] ^ S[255 & c] ^ h[_ + 2], p = v[p >>> 24] ^ y[d >> 16 & 255] ^ b[c >> 8 & 255] ^ S[255 & f] ^ h[_ + 3], _ += 4, d = s, c = o, f = u;
+ for (l = 0; l < 4; l++) r[(3 & -l) + a] = T[d >>> 24] << 24 ^ T[c >> 16 & 255] << 16 ^ T[f >> 8 & 255] << 8 ^ T[255 & p] ^ h[_++], s = d, d = c, c = f, f = p, p = s
+ }, e
+ }(),
+ o = function(e) {
+ function t() {
+ var t;
+ return (t = e.call(this, r) || this).jobs = [], t.delay = 1, t.timeout_ = null, t
+ }
+ n(t, e);
+ var i = t.prototype;
+ return i.processJob_ = function() {
+ this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay) : this.timeout_ = null
+ }, i.push = function(e) {
+ this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay))
+ }, t
+ }(r),
+ u = function(e) {
+ return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
+ },
+ l = function() {
+ function e(t, i, n, r) {
+ var a = e.STEP,
+ s = new Int32Array(t.buffer),
+ l = new Uint8Array(t.byteLength),
+ h = 0;
+ for (this.asyncStream_ = new o, this.asyncStream_.push(this.decryptChunk_(s.subarray(h, h + a), i, n, l)), h = a; h < s.length; h += a) n = new Uint32Array([u(s[h - 4]), u(s[h - 3]), u(s[h - 2]), u(s[h - 1])]), this.asyncStream_.push(this.decryptChunk_(s.subarray(h, h + a), i, n, l));
+ this.asyncStream_.push((function() {
+ /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
+ var e;
+ r(null, (e = l).subarray(0, e.byteLength - e[e.byteLength - 1]))
+ }))
+ }
+ return e.prototype.decryptChunk_ = function(e, t, i, n) {
+ return function() {
+ var r = function(e, t, i) {
+ var n, r, a, o, l, h, d, c, f, p = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2),
+ m = new s(Array.prototype.slice.call(t)),
+ _ = new Uint8Array(e.byteLength),
+ g = new Int32Array(_.buffer);
+ for (n = i[0], r = i[1], a = i[2], o = i[3], f = 0; f < p.length; f += 4) l = u(p[f]), h = u(p[f + 1]), d = u(p[f + 2]), c = u(p[f + 3]), m.decrypt(l, h, d, c, g, f), g[f] = u(g[f] ^ n), g[f + 1] = u(g[f + 1] ^ r), g[f + 2] = u(g[f + 2] ^ a), g[f + 3] = u(g[f + 3] ^ o), n = l, r = h, a = d, o = c;
+ return _
+ }(e, t, i);
+ n.set(r, e.byteOffset)
+ }
+ }, t(e, null, [{
+ key: "STEP",
+ get: function() {
+ return 32e3
+ }
+ }]), e
+ }();
+ self.onmessage = function(e) {
+ var t = e.data,
+ i = new Uint8Array(t.encrypted.bytes, t.encrypted.byteOffset, t.encrypted.byteLength),
+ n = new Uint32Array(t.key.bytes, t.key.byteOffset, t.key.byteLength / 4),
+ r = new Uint32Array(t.iv.bytes, t.iv.byteOffset, t.iv.byteLength / 4);
+ new l(i, n, r, (function(e, i) {
+ var n, r;
+ self.postMessage((n = {
+ source: t.source,
+ decrypted: i
+ }, r = {}, Object.keys(n).forEach((function(e) {
+ var t = n[e];
+ ArrayBuffer.isView(t) ? r[e] = {
+ bytes: t.buffer,
+ byteOffset: t.byteOffset,
+ byteLength: t.byteLength
+ } : r[e] = t
+ })), r), [i.buffer])
+ }))
+ }
+ })))),
+ Po = function(e) {
+ var t = e.default ? "main" : "alternative";
+ return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >= 0 && (t = "main-desc"), t
+ },
+ Io = function(e, t) {
+ e.abort(), e.pause(), t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(), t.activePlaylistLoader = null)
+ },
+ Lo = function(e, t) {
+ t.activePlaylistLoader = e, e.load()
+ },
+ xo = {
+ AUDIO: function(e, t) {
+ return function() {
+ var i = t.segmentLoaders[e],
+ n = t.mediaTypes[e],
+ r = t.blacklistCurrentPlaylist;
+ Io(i, n);
+ var a = n.activeTrack(),
+ s = n.activeGroup(),
+ o = (s.filter((function(e) {
+ return e.default
+ }))[0] || s[0]).id,
+ u = n.tracks[o];
+ if (a !== u) {
+ for (var l in Yr.log.warn("Problem encountered loading the alternate audio track.Switching back to default."), n.tracks) n.tracks[l].enabled = n.tracks[l] === u;
+ n.onTrackChanged()
+ } else r({
+ message: "Problem encountered loading the default audio track."
+ })
+ }
+ },
+ SUBTITLES: function(e, t) {
+ return function() {
+ var i = t.segmentLoaders[e],
+ n = t.mediaTypes[e];
+ Yr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."), Io(i, n);
+ var r = n.activeTrack();
+ r && (r.mode = "disabled"), n.onTrackChanged()
+ }
+ }
+ },
+ Ro = {
+ AUDIO: function(e, t, i) {
+ if (t) {
+ var n = i.tech,
+ r = i.requestOptions,
+ a = i.segmentLoaders[e];
+ t.on("loadedmetadata", (function() {
+ var e = t.media();
+ a.playlist(e, r), (!n.paused() || e.endList && "none" !== n.preload()) && a.load()
+ })), t.on("loadedplaylist", (function() {
+ a.playlist(t.media(), r), n.paused() || a.load()
+ })), t.on("error", xo[e](e, i))
+ }
+ },
+ SUBTITLES: function(e, t, i) {
+ var n = i.tech,
+ r = i.requestOptions,
+ a = i.segmentLoaders[e],
+ s = i.mediaTypes[e];
+ t.on("loadedmetadata", (function() {
+ var e = t.media();
+ a.playlist(e, r), a.track(s.activeTrack()), (!n.paused() || e.endList && "none" !== n.preload()) && a.load()
+ })), t.on("loadedplaylist", (function() {
+ a.playlist(t.media(), r), n.paused() || a.load()
+ })), t.on("error", xo[e](e, i))
+ }
+ },
+ Do = {
+ AUDIO: function(e, t) {
+ var i = t.vhs,
+ n = t.sourceType,
+ r = t.segmentLoaders[e],
+ a = t.requestOptions,
+ s = t.master.mediaGroups,
+ o = t.mediaTypes[e],
+ u = o.groups,
+ l = o.tracks,
+ h = o.logger_,
+ d = t.masterPlaylistLoader,
+ c = ba(d.master);
+ for (var f in s[e] && 0 !== Object.keys(s[e]).length || (s[e] = {
+ main: {
+ default: {
+ default: !0
+ }
+ }
+ }, c && (s[e].main.default.playlists = d.master.playlists)), s[e])
+ for (var p in u[f] || (u[f] = []), s[e][f]) {
+ var m = s[e][f][p],
+ _ = void 0;
+ if (c ? (h("AUDIO group '" + f + "' label '" + p + "' is a master playlist"), m.isMasterPlaylist = !0, _ = null) : _ = "vhs-json" === n && m.playlists ? new Ua(m.playlists[0], i, a) : m.resolvedUri ? new Ua(m.resolvedUri, i, a) : m.playlists && "dash" === n ? new is(m.playlists[0], i, a, d) : null, m = Yr.mergeOptions({
+ id: p,
+ playlistLoader: _
+ }, m), Ro[e](e, m.playlistLoader, t), u[f].push(m), void 0 === l[p]) {
+ var g = new Yr.AudioTrack({
+ id: p,
+ kind: Po(m),
+ enabled: !1,
+ language: m.language,
+ default: m.default,
+ label: p
+ });
+ l[p] = g
+ }
+ }
+ r.on("error", xo[e](e, t))
+ },
+ SUBTITLES: function(e, t) {
+ var i = t.tech,
+ n = t.vhs,
+ r = t.sourceType,
+ a = t.segmentLoaders[e],
+ s = t.requestOptions,
+ o = t.master.mediaGroups,
+ u = t.mediaTypes[e],
+ l = u.groups,
+ h = u.tracks,
+ d = t.masterPlaylistLoader;
+ for (var c in o[e])
+ for (var f in l[c] || (l[c] = []), o[e][c])
+ if (!o[e][c][f].forced) {
+ var p = o[e][c][f],
+ m = void 0;
+ if ("hls" === r) m = new Ua(p.resolvedUri, n, s);
+ else if ("dash" === r) {
+ if (!p.playlists.filter((function(e) {
+ return e.excludeUntil !== 1 / 0
+ })).length) return;
+ m = new is(p.playlists[0], n, s, d)
+ } else "vhs-json" === r && (m = new Ua(p.playlists ? p.playlists[0] : p.resolvedUri, n, s));
+ if (p = Yr.mergeOptions({
+ id: f,
+ playlistLoader: m
+ }, p), Ro[e](e, p.playlistLoader, t), l[c].push(p), void 0 === h[f]) {
+ var _ = i.addRemoteTextTrack({
+ id: f,
+ kind: "subtitles",
+ default: p.default && p.autoselect,
+ language: p.language,
+ label: f
+ }, !1).track;
+ h[f] = _
+ }
+ } a.on("error", xo[e](e, t))
+ },
+ "CLOSED-CAPTIONS": function(e, t) {
+ var i = t.tech,
+ n = t.master.mediaGroups,
+ r = t.mediaTypes[e],
+ a = r.groups,
+ s = r.tracks;
+ for (var o in n[e])
+ for (var u in a[o] || (a[o] = []), n[e][o]) {
+ var l = n[e][o][u];
+ if (/^(?:CC|SERVICE)/.test(l.instreamId)) {
+ var h = i.options_.vhs && i.options_.vhs.captionServices || {},
+ d = {
+ label: u,
+ language: l.language,
+ instreamId: l.instreamId,
+ default: l.default && l.autoselect
+ };
+ if (h[d.instreamId] && (d = Yr.mergeOptions(d, h[d.instreamId])), void 0 === d.default && delete d.default, a[o].push(Yr.mergeOptions({
+ id: u
+ }, l)), void 0 === s[u]) {
+ var c = i.addRemoteTextTrack({
+ id: d.instreamId,
+ kind: "captions",
+ default: d.default,
+ language: d.language,
+ label: d.label
+ }, !1).track;
+ s[u] = c
+ }
+ }
+ }
+ }
+ },
+ Oo = function e(t, i) {
+ for (var n = 0; n < t.length; n++) {
+ if (va(i, t[n])) return !0;
+ if (t[n].playlists && e(t[n].playlists, i)) return !0
+ }
+ return !1
+ },
+ Uo = {
+ AUDIO: function(e, t) {
+ return function() {
+ var i = t.mediaTypes[e].tracks;
+ for (var n in i)
+ if (i[n].enabled) return i[n];
+ return null
+ }
+ },
+ SUBTITLES: function(e, t) {
+ return function() {
+ var i = t.mediaTypes[e].tracks;
+ for (var n in i)
+ if ("showing" === i[n].mode || "hidden" === i[n].mode) return i[n];
+ return null
+ }
+ }
+ },
+ Mo = function(e) {
+ ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((function(t) {
+ Do[t](t, e)
+ }));
+ var t = e.mediaTypes,
+ i = e.masterPlaylistLoader,
+ n = e.tech,
+ r = e.vhs,
+ a = e.segmentLoaders,
+ s = a.AUDIO,
+ o = a.main;
+ ["AUDIO", "SUBTITLES"].forEach((function(i) {
+ t[i].activeGroup = function(e, t) {
+ return function(i) {
+ var n = t.masterPlaylistLoader,
+ r = t.mediaTypes[e].groups,
+ a = n.media();
+ if (!a) return null;
+ var s = null;
+ a.attributes[e] && (s = r[a.attributes[e]]);
+ var o = Object.keys(r);
+ if (!s)
+ if ("AUDIO" === e && o.length > 1 && ba(t.master))
+ for (var u = 0; u < o.length; u++) {
+ var l = r[o[u]];
+ if (Oo(l, a)) {
+ s = l;
+ break
+ }
+ } else r.main ? s = r.main : 1 === o.length && (s = r[o[0]]);
+ return void 0 === i ? s : null !== i && s && s.filter((function(e) {
+ return e.id === i.id
+ }))[0] || null
+ }
+ }(i, e), t[i].activeTrack = Uo[i](i, e), t[i].onGroupChanged = function(e, t) {
+ return function() {
+ var i = t.segmentLoaders,
+ n = i[e],
+ r = i.main,
+ a = t.mediaTypes[e],
+ s = a.activeTrack(),
+ o = a.getActiveGroup(),
+ u = a.activePlaylistLoader,
+ l = a.lastGroup_;
+ o && l && o.id === l.id || (a.lastGroup_ = o, a.lastTrack_ = s, Io(n, a), o && !o.isMasterPlaylist && (o.playlistLoader ? (n.resyncLoader(), Lo(o.playlistLoader, a)) : u && r.resetEverything()))
+ }
+ }(i, e), t[i].onGroupChanging = function(e, t) {
+ return function() {
+ var i = t.segmentLoaders[e];
+ t.mediaTypes[e].lastGroup_ = null, i.abort(), i.pause()
+ }
+ }(i, e), t[i].onTrackChanged = function(e, t) {
+ return function() {
+ var i = t.masterPlaylistLoader,
+ n = t.segmentLoaders,
+ r = n[e],
+ a = n.main,
+ s = t.mediaTypes[e],
+ o = s.activeTrack(),
+ u = s.getActiveGroup(),
+ l = s.activePlaylistLoader,
+ h = s.lastTrack_;
+ if ((!h || !o || h.id !== o.id) && (s.lastGroup_ = u, s.lastTrack_ = o, Io(r, s), u)) {
+ if (u.isMasterPlaylist) {
+ if (!o || !h || o.id === h.id) return;
+ var d = t.vhs.masterPlaylistController_,
+ c = d.selectPlaylist();
+ if (d.media() === c) return;
+ return s.logger_("track change. Switching master audio from " + h.id + " to " + o.id), i.pause(), a.resetEverything(), void d.fastQualityChange_(c)
+ }
+ if ("AUDIO" === e) {
+ if (!u.playlistLoader) return a.setAudio(!0), void a.resetEverything();
+ r.setAudio(!0), a.setAudio(!1)
+ }
+ l !== u.playlistLoader ? (r.track && r.track(o), r.resetEverything(), Lo(u.playlistLoader, s)) : Lo(u.playlistLoader, s)
+ }
+ }
+ }(i, e), t[i].getActiveGroup = function(e, t) {
+ var i = t.mediaTypes;
+ return function() {
+ var t = i[e].activeTrack();
+ return t ? i[e].activeGroup(t) : null
+ }
+ }(i, e)
+ }));
+ var u = t.AUDIO.activeGroup();
+ if (u) {
+ var l = (u.filter((function(e) {
+ return e.default
+ }))[0] || u[0]).id;
+ t.AUDIO.tracks[l].enabled = !0, t.AUDIO.onGroupChanged(), t.AUDIO.onTrackChanged(), t.AUDIO.getActiveGroup().playlistLoader ? (o.setAudio(!1), s.setAudio(!0)) : o.setAudio(!0)
+ }
+ i.on("mediachange", (function() {
+ ["AUDIO", "SUBTITLES"].forEach((function(e) {
+ return t[e].onGroupChanged()
+ }))
+ })), i.on("mediachanging", (function() {
+ ["AUDIO", "SUBTITLES"].forEach((function(e) {
+ return t[e].onGroupChanging()
+ }))
+ }));
+ var h = function() {
+ t.AUDIO.onTrackChanged(), n.trigger({
+ type: "usage",
+ name: "vhs-audio-change"
+ }), n.trigger({
+ type: "usage",
+ name: "hls-audio-change"
+ })
+ };
+ for (var d in n.audioTracks().addEventListener("change", h), n.remoteTextTracks().addEventListener("change", t.SUBTITLES.onTrackChanged), r.on("dispose", (function() {
+ n.audioTracks().removeEventListener("change", h), n.remoteTextTracks().removeEventListener("change", t.SUBTITLES.onTrackChanged)
+ })), n.clearTracks("audio"), t.AUDIO.tracks) n.audioTracks().addTrack(t.AUDIO.tracks[d])
+ },
+ Fo = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"],
+ Bo = function(e) {
+ return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e]
+ },
+ No = function(e) {
+ function t(t) {
+ var i;
+ i = e.call(this) || this;
+ var n = t.src,
+ r = t.handleManifestRedirects,
+ a = t.withCredentials,
+ s = t.tech,
+ o = t.bandwidth,
+ u = t.externVhs,
+ l = t.useCueTags,
+ h = t.blacklistDuration,
+ d = t.enableLowInitialPlaylist,
+ c = t.sourceType,
+ f = t.cacheEncryptionKeys,
+ p = t.experimentalBufferBasedABR,
+ m = t.experimentalLeastPixelDiffSelector;
+ if (!n) throw new Error("A non-empty playlist URL or JSON manifest string is required");
+ var _, g = t.maxPlaylistRetries;
+ null == g && (g = 1 / 0), Zs = u, i.experimentalBufferBasedABR = Boolean(p), i.experimentalLeastPixelDiffSelector = Boolean(m), i.withCredentials = a, i.tech_ = s, i.vhs_ = s.vhs, i.sourceType_ = c, i.useCueTags_ = l, i.blacklistDuration = h, i.maxPlaylistRetries = g, i.enableLowInitialPlaylist = d, i.useCueTags_ && (i.cueTagsTrack_ = i.tech_.addTextTrack("metadata", "ad-cues"), i.cueTagsTrack_.inBandMetadataTrackDispatchType = ""), i.requestOptions_ = {
+ withCredentials: a,
+ handleManifestRedirects: r,
+ maxPlaylistRetries: g,
+ timeout: null
+ }, i.on("error", i.pauseLoading), i.mediaTypes_ = (_ = {}, ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((function(e) {
+ _[e] = {
+ groups: {},
+ tracks: {},
+ activePlaylistLoader: null,
+ activeGroup: Js,
+ activeTrack: Js,
+ getActiveGroup: Js,
+ onGroupChanged: Js,
+ onTrackChanged: Js,
+ lastTrack_: null,
+ logger_: $r("MediaGroups[" + e + "]")
+ }
+ })), _), i.mediaSource = new C.default.MediaSource, i.handleDurationChange_ = i.handleDurationChange_.bind(I.default(i)), i.handleSourceOpen_ = i.handleSourceOpen_.bind(I.default(i)), i.handleSourceEnded_ = i.handleSourceEnded_.bind(I.default(i)), i.mediaSource.addEventListener("durationchange", i.handleDurationChange_), i.mediaSource.addEventListener("sourceopen", i.handleSourceOpen_), i.mediaSource.addEventListener("sourceended", i.handleSourceEnded_), i.seekable_ = Yr.createTimeRanges(), i.hasPlayed_ = !1, i.syncController_ = new Ao(t), i.segmentMetadataTrack_ = s.addRemoteTextTrack({
+ kind: "metadata",
+ label: "segment-metadata"
+ }, !1).track, i.decrypter_ = new ko, i.sourceUpdater_ = new yo(i.mediaSource), i.inbandTextTracks_ = {}, i.timelineChangeController_ = new Co;
+ var v = {
+ vhs: i.vhs_,
+ parse708captions: t.parse708captions,
+ mediaSource: i.mediaSource,
+ currentTime: i.tech_.currentTime.bind(i.tech_),
+ seekable: function() {
+ return i.seekable()
+ },
+ seeking: function() {
+ return i.tech_.seeking()
+ },
+ duration: function() {
+ return i.duration()
+ },
+ hasPlayed: function() {
+ return i.hasPlayed_
+ },
+ goalBufferLength: function() {
+ return i.goalBufferLength()
+ },
+ bandwidth: o,
+ syncController: i.syncController_,
+ decrypter: i.decrypter_,
+ sourceType: i.sourceType_,
+ inbandTextTracks: i.inbandTextTracks_,
+ cacheEncryptionKeys: f,
+ sourceUpdater: i.sourceUpdater_,
+ timelineChangeController: i.timelineChangeController_,
+ experimentalExactManifestTimings: t.experimentalExactManifestTimings
+ };
+ i.masterPlaylistLoader_ = "dash" === i.sourceType_ ? new is(n, i.vhs_, i.requestOptions_) : new Ua(n, i.vhs_, i.requestOptions_), i.setupMasterPlaylistLoaderListeners_(), i.mainSegmentLoader_ = new $s(Yr.mergeOptions(v, {
+ segmentMetadataTrack: i.segmentMetadataTrack_,
+ loaderType: "main"
+ }), t), i.audioSegmentLoader_ = new $s(Yr.mergeOptions(v, {
+ loaderType: "audio"
+ }), t), i.subtitleSegmentLoader_ = new To(Yr.mergeOptions(v, {
+ loaderType: "vtt",
+ featuresNativeTextTracks: i.tech_.featuresNativeTextTracks
+ }), t), i.setupSegmentLoaderListeners_(), i.experimentalBufferBasedABR && (i.masterPlaylistLoader_.one("loadedplaylist", (function() {
+ return i.startABRTimer_()
+ })), i.tech_.on("pause", (function() {
+ return i.stopABRTimer_()
+ })), i.tech_.on("play", (function() {
+ return i.startABRTimer_()
+ }))), Fo.forEach((function(e) {
+ i[e + "_"] = Bo.bind(I.default(i), e)
+ })), i.logger_ = $r("MPC"), i.triggeredFmp4Usage = !1, "none" === i.tech_.preload() ? (i.loadOnPlay_ = function() {
+ i.loadOnPlay_ = null, i.masterPlaylistLoader_.load()
+ }, i.tech_.one("play", i.loadOnPlay_)) : i.masterPlaylistLoader_.load(), i.timeToLoadedData__ = -1, i.mainAppendsToLoadedData__ = -1, i.audioAppendsToLoadedData__ = -1;
+ var y = "none" === i.tech_.preload() ? "play" : "loadstart";
+ return i.tech_.one(y, (function() {
+ var e = Date.now();
+ i.tech_.one("loadeddata", (function() {
+ i.timeToLoadedData__ = Date.now() - e, i.mainAppendsToLoadedData__ = i.mainSegmentLoader_.mediaAppends, i.audioAppendsToLoadedData__ = i.audioSegmentLoader_.mediaAppends
+ }))
+ })), i
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.mainAppendsToLoadedData_ = function() {
+ return this.mainAppendsToLoadedData__
+ }, i.audioAppendsToLoadedData_ = function() {
+ return this.audioAppendsToLoadedData__
+ }, i.appendsToLoadedData_ = function() {
+ var e = this.mainAppendsToLoadedData_(),
+ t = this.audioAppendsToLoadedData_();
+ return -1 === e || -1 === t ? -1 : e + t
+ }, i.timeToLoadedData_ = function() {
+ return this.timeToLoadedData__
+ }, i.checkABR_ = function() {
+ var e = this.selectPlaylist();
+ e && this.shouldSwitchToMedia_(e) && this.switchMedia_(e, "abr")
+ }, i.switchMedia_ = function(e, t, i) {
+ var n = this.media(),
+ r = n && (n.id || n.uri),
+ a = e.id || e.uri;
+ r && r !== a && (this.logger_("switch media " + r + " -> " + a + " from " + t), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-rendition-change-" + t
+ })), this.masterPlaylistLoader_.media(e, i)
+ }, i.startABRTimer_ = function() {
+ var e = this;
+ this.stopABRTimer_(), this.abrTimer_ = C.default.setInterval((function() {
+ return e.checkABR_()
+ }), 250)
+ }, i.stopABRTimer_ = function() {
+ this.tech_.scrubbing && this.tech_.scrubbing() || (C.default.clearInterval(this.abrTimer_), this.abrTimer_ = null)
+ }, i.getAudioTrackPlaylists_ = function() {
+ var e = this.master(),
+ t = e && e.playlists || [];
+ if (!e || !e.mediaGroups || !e.mediaGroups.AUDIO) return t;
+ var i, n = e.mediaGroups.AUDIO,
+ r = Object.keys(n);
+ if (Object.keys(this.mediaTypes_.AUDIO.groups).length) i = this.mediaTypes_.AUDIO.activeTrack();
+ else {
+ var a = n.main || r.length && n[r[0]];
+ for (var s in a)
+ if (a[s].default) {
+ i = {
+ label: s
+ };
+ break
+ }
+ }
+ if (!i) return t;
+ var o = [];
+ for (var u in n)
+ if (n[u][i.label]) {
+ var l = n[u][i.label];
+ if (l.playlists && l.playlists.length) o.push.apply(o, l.playlists);
+ else if (l.uri) o.push(l);
+ else if (e.playlists.length)
+ for (var h = 0; h < e.playlists.length; h++) {
+ var d = e.playlists[h];
+ d.attributes && d.attributes.AUDIO && d.attributes.AUDIO === u && o.push(d)
+ }
+ } return o.length ? o : t
+ }, i.setupMasterPlaylistLoaderListeners_ = function() {
+ var e = this;
+ this.masterPlaylistLoader_.on("loadedmetadata", (function() {
+ var t = e.masterPlaylistLoader_.media(),
+ i = 1.5 * t.targetDuration * 1e3;
+ ga(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0 : e.requestOptions_.timeout = i, t.endList && "none" !== e.tech_.preload() && (e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_.load()), Mo({
+ sourceType: e.sourceType_,
+ segmentLoaders: {
+ AUDIO: e.audioSegmentLoader_,
+ SUBTITLES: e.subtitleSegmentLoader_,
+ main: e.mainSegmentLoader_
+ },
+ tech: e.tech_,
+ requestOptions: e.requestOptions_,
+ masterPlaylistLoader: e.masterPlaylistLoader_,
+ vhs: e.vhs_,
+ master: e.master(),
+ mediaTypes: e.mediaTypes_,
+ blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e)
+ }), e.triggerPresenceUsage_(e.master(), t), e.setupFirstPlay(), !e.mediaTypes_.AUDIO.activePlaylistLoader || e.mediaTypes_.AUDIO.activePlaylistLoader.media() ? e.trigger("selectedinitialmedia") : e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", (function() {
+ e.trigger("selectedinitialmedia")
+ }))
+ })), this.masterPlaylistLoader_.on("loadedplaylist", (function() {
+ e.loadOnPlay_ && e.tech_.off("play", e.loadOnPlay_);
+ var t = e.masterPlaylistLoader_.media();
+ if (!t) {
+ var i;
+ if (e.excludeUnsupportedVariants_(), e.enableLowInitialPlaylist && (i = e.selectInitialPlaylist()), i || (i = e.selectPlaylist()), !i || !e.shouldSwitchToMedia_(i)) return;
+ if (e.initialMedia_ = i, e.switchMedia_(e.initialMedia_, "initial"), !("vhs-json" === e.sourceType_ && e.initialMedia_.segments)) return;
+ t = e.initialMedia_
+ }
+ e.handleUpdatedMediaPlaylist(t)
+ })), this.masterPlaylistLoader_.on("error", (function() {
+ e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)
+ })), this.masterPlaylistLoader_.on("mediachanging", (function() {
+ e.mainSegmentLoader_.abort(), e.mainSegmentLoader_.pause()
+ })), this.masterPlaylistLoader_.on("mediachange", (function() {
+ var t = e.masterPlaylistLoader_.media(),
+ i = 1.5 * t.targetDuration * 1e3;
+ ga(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0 : e.requestOptions_.timeout = i, e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_.load(), e.tech_.trigger({
+ type: "mediachange",
+ bubbles: !0
+ })
+ })), this.masterPlaylistLoader_.on("playlistunchanged", (function() {
+ var t = e.masterPlaylistLoader_.media();
+ "playlist-unchanged" !== t.lastExcludeReason_ && (e.stuckAtPlaylistEnd_(t) && (e.blacklistCurrentPlaylist({
+ message: "Playlist no longer updating.",
+ reason: "playlist-unchanged"
+ }), e.tech_.trigger("playliststuck")))
+ })), this.masterPlaylistLoader_.on("renditiondisabled", (function() {
+ e.tech_.trigger({
+ type: "usage",
+ name: "vhs-rendition-disabled"
+ }), e.tech_.trigger({
+ type: "usage",
+ name: "hls-rendition-disabled"
+ })
+ })), this.masterPlaylistLoader_.on("renditionenabled", (function() {
+ e.tech_.trigger({
+ type: "usage",
+ name: "vhs-rendition-enabled"
+ }), e.tech_.trigger({
+ type: "usage",
+ name: "hls-rendition-enabled"
+ })
+ }))
+ }, i.handleUpdatedMediaPlaylist = function(e) {
+ this.useCueTags_ && this.updateAdCues_(e), this.mainSegmentLoader_.playlist(e, this.requestOptions_), this.updateDuration(!e.endList), this.tech_.paused() || (this.mainSegmentLoader_.load(), this.audioSegmentLoader_ && this.audioSegmentLoader_.load())
+ }, i.triggerPresenceUsage_ = function(e, t) {
+ var i = e.mediaGroups || {},
+ n = !0,
+ r = Object.keys(i.AUDIO);
+ for (var a in i.AUDIO)
+ for (var s in i.AUDIO[a]) {
+ i.AUDIO[a][s].uri || (n = !1)
+ }
+ n && (this.tech_.trigger({
+ type: "usage",
+ name: "vhs-demuxed"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-demuxed"
+ })), Object.keys(i.SUBTITLES).length && (this.tech_.trigger({
+ type: "usage",
+ name: "vhs-webvtt"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-webvtt"
+ })), Zs.Playlist.isAes(t) && (this.tech_.trigger({
+ type: "usage",
+ name: "vhs-aes"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-aes"
+ })), r.length && Object.keys(i.AUDIO[r[0]]).length > 1 && (this.tech_.trigger({
+ type: "usage",
+ name: "vhs-alternate-audio"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-alternate-audio"
+ })), this.useCueTags_ && (this.tech_.trigger({
+ type: "usage",
+ name: "vhs-playlist-cue-tags"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-playlist-cue-tags"
+ }))
+ }, i.shouldSwitchToMedia_ = function(e) {
+ var t = this.masterPlaylistLoader_.media(),
+ i = this.tech_.buffered();
+ return function(e) {
+ var t = e.currentPlaylist,
+ i = e.nextPlaylist,
+ n = e.forwardBuffer,
+ r = e.bufferLowWaterLine,
+ a = e.bufferHighWaterLine,
+ s = e.duration,
+ o = e.experimentalBufferBasedABR,
+ u = e.log;
+ if (!i) return Yr.log.warn("We received no playlist to switch to. Please check your stream."), !1;
+ var l = "allowing switch " + (t && t.id || "null") + " -> " + i.id;
+ if (!t) return u(l + " as current playlist is not set"), !0;
+ if (i.id === t.id) return !1;
+ if (!t.endList) return u(l + " as current playlist is live"), !0;
+ var h = o ? ns.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : ns.MAX_BUFFER_LOW_WATER_LINE;
+ if (s < h) return u(l + " as duration < max low water line (" + s + " < " + h + ")"), !0;
+ var d = i.attributes.BANDWIDTH,
+ c = t.attributes.BANDWIDTH;
+ if (d < c && (!o || n < a)) {
+ var f = l + " as next bandwidth < current bandwidth (" + d + " < " + c + ")";
+ return o && (f += " and forwardBuffer < bufferHighWaterLine (" + n + " < " + a + ")"), u(f), !0
+ }
+ if ((!o || d > c) && n >= r) {
+ var p = l + " as forwardBuffer >= bufferLowWaterLine (" + n + " >= " + r + ")";
+ return o && (p += " and next bandwidth > current bandwidth (" + d + " > " + c + ")"), u(p), !0
+ }
+ return u("not " + l + " as no switching criteria met"), !1
+ }({
+ currentPlaylist: t,
+ nextPlaylist: e,
+ forwardBuffer: i.length ? i.end(i.length - 1) - this.tech_.currentTime() : 0,
+ bufferLowWaterLine: this.bufferLowWaterLine(),
+ bufferHighWaterLine: this.bufferHighWaterLine(),
+ duration: this.duration(),
+ experimentalBufferBasedABR: this.experimentalBufferBasedABR,
+ log: this.logger_
+ })
+ }, i.setupSegmentLoaderListeners_ = function() {
+ var e = this;
+ this.experimentalBufferBasedABR || (this.mainSegmentLoader_.on("bandwidthupdate", (function() {
+ var t = e.selectPlaylist();
+ e.shouldSwitchToMedia_(t) && e.switchMedia_(t, "bandwidthupdate"), e.tech_.trigger("bandwidthupdate")
+ })), this.mainSegmentLoader_.on("progress", (function() {
+ e.trigger("progress")
+ }))), this.mainSegmentLoader_.on("error", (function() {
+ e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())
+ })), this.mainSegmentLoader_.on("appenderror", (function() {
+ e.error = e.mainSegmentLoader_.error_, e.trigger("error")
+ })), this.mainSegmentLoader_.on("syncinfoupdate", (function() {
+ e.onSyncInfoUpdate_()
+ })), this.mainSegmentLoader_.on("timestampoffset", (function() {
+ e.tech_.trigger({
+ type: "usage",
+ name: "vhs-timestamp-offset"
+ }), e.tech_.trigger({
+ type: "usage",
+ name: "hls-timestamp-offset"
+ })
+ })), this.audioSegmentLoader_.on("syncinfoupdate", (function() {
+ e.onSyncInfoUpdate_()
+ })), this.audioSegmentLoader_.on("appenderror", (function() {
+ e.error = e.audioSegmentLoader_.error_, e.trigger("error")
+ })), this.mainSegmentLoader_.on("ended", (function() {
+ e.logger_("main segment loader ended"), e.onEndOfStream()
+ })), this.mainSegmentLoader_.on("earlyabort", (function(t) {
+ e.experimentalBufferBasedABR || (e.delegateLoaders_("all", ["abort"]), e.blacklistCurrentPlaylist({
+ message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
+ }, 120))
+ }));
+ var t = function() {
+ if (!e.sourceUpdater_.hasCreatedSourceBuffers()) return e.tryToCreateSourceBuffers_();
+ var t = e.getCodecsOrExclude_();
+ t && e.sourceUpdater_.addOrChangeSourceBuffers(t)
+ };
+ this.mainSegmentLoader_.on("trackinfo", t), this.audioSegmentLoader_.on("trackinfo", t), this.mainSegmentLoader_.on("fmp4", (function() {
+ e.triggeredFmp4Usage || (e.tech_.trigger({
+ type: "usage",
+ name: "vhs-fmp4"
+ }), e.tech_.trigger({
+ type: "usage",
+ name: "hls-fmp4"
+ }), e.triggeredFmp4Usage = !0)
+ })), this.audioSegmentLoader_.on("fmp4", (function() {
+ e.triggeredFmp4Usage || (e.tech_.trigger({
+ type: "usage",
+ name: "vhs-fmp4"
+ }), e.tech_.trigger({
+ type: "usage",
+ name: "hls-fmp4"
+ }), e.triggeredFmp4Usage = !0)
+ })), this.audioSegmentLoader_.on("ended", (function() {
+ e.logger_("audioSegmentLoader ended"), e.onEndOfStream()
+ }))
+ }, i.mediaSecondsLoaded_ = function() {
+ return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded)
+ }, i.load = function() {
+ this.mainSegmentLoader_.load(), this.mediaTypes_.AUDIO.activePlaylistLoader && this.audioSegmentLoader_.load(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this.subtitleSegmentLoader_.load()
+ }, i.smoothQualityChange_ = function(e) {
+ void 0 === e && (e = this.selectPlaylist()), this.fastQualityChange_(e)
+ }, i.fastQualityChange_ = function(e) {
+ var t = this;
+ void 0 === e && (e = this.selectPlaylist()), e !== this.masterPlaylistLoader_.media() ? (this.switchMedia_(e, "fast-quality"), this.mainSegmentLoader_.resetEverything((function() {
+ Yr.browser.IE_VERSION || Yr.browser.IS_EDGE ? t.tech_.setCurrentTime(t.tech_.currentTime() + .04) : t.tech_.setCurrentTime(t.tech_.currentTime())
+ }))) : this.logger_("skipping fastQualityChange because new media is same as old")
+ }, i.play = function() {
+ if (!this.setupFirstPlay()) {
+ this.tech_.ended() && this.tech_.setCurrentTime(0), this.hasPlayed_ && this.load();
+ var e = this.tech_.seekable();
+ return this.tech_.duration() === 1 / 0 && this.tech_.currentTime() < e.start(0) ? this.tech_.setCurrentTime(e.end(e.length - 1)) : void 0
+ }
+ }, i.setupFirstPlay = function() {
+ var e = this,
+ t = this.masterPlaylistLoader_.media();
+ if (!t || this.tech_.paused() || this.hasPlayed_) return !1;
+ if (!t.endList) {
+ var i = this.seekable();
+ if (!i.length) return !1;
+ if (Yr.browser.IE_VERSION && 0 === this.tech_.readyState()) return this.tech_.one("loadedmetadata", (function() {
+ e.trigger("firstplay"), e.tech_.setCurrentTime(i.end(0)), e.hasPlayed_ = !0
+ })), !1;
+ this.trigger("firstplay"), this.tech_.setCurrentTime(i.end(0))
+ }
+ return this.hasPlayed_ = !0, this.load(), !0
+ }, i.handleSourceOpen_ = function() {
+ if (this.tryToCreateSourceBuffers_(), this.tech_.autoplay()) {
+ var e = this.tech_.play();
+ void 0 !== e && "function" == typeof e.then && e.then(null, (function(e) {}))
+ }
+ this.trigger("sourceopen")
+ }, i.handleSourceEnded_ = function() {
+ if (this.inbandTextTracks_.metadataTrack_) {
+ var e = this.inbandTextTracks_.metadataTrack_.cues;
+ if (e && e.length) {
+ var t = this.duration();
+ e[e.length - 1].endTime = isNaN(t) || Math.abs(t) === 1 / 0 ? Number.MAX_VALUE : t
+ }
+ }
+ }, i.handleDurationChange_ = function() {
+ this.tech_.trigger("durationchange")
+ }, i.onEndOfStream = function() {
+ var e = this.mainSegmentLoader_.ended_;
+ if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
+ var t = this.mainSegmentLoader_.getCurrentMediaInfo_();
+ e = !t || t.hasVideo ? e && this.audioSegmentLoader_.ended_ : this.audioSegmentLoader_.ended_
+ }
+ e && (this.stopABRTimer_(), this.sourceUpdater_.endOfStream())
+ }, i.stuckAtPlaylistEnd_ = function(e) {
+ if (!this.seekable().length) return !1;
+ var t = this.syncController_.getExpiredTime(e, this.duration());
+ if (null === t) return !1;
+ var i = Zs.Playlist.playlistEnd(e, t),
+ n = this.tech_.currentTime(),
+ r = this.tech_.buffered();
+ if (!r.length) return i - n <= .1;
+ var a = r.end(r.length - 1);
+ return a - n <= .1 && i - a <= .1
+ }, i.blacklistCurrentPlaylist = function(e, t) {
+ void 0 === e && (e = {});
+ var i = e.playlist || this.masterPlaylistLoader_.media();
+ if (t = t || e.blacklistDuration || this.blacklistDuration, !i) return this.error = e, void("open" !== this.mediaSource.readyState ? this.trigger("error") : this.sourceUpdater_.endOfStream("network"));
+ i.playlistErrors_++;
+ var n, r = this.masterPlaylistLoader_.master.playlists,
+ a = r.filter(ma),
+ s = 1 === a.length && a[0] === i;
+ if (1 === r.length && t !== 1 / 0) return Yr.log.warn("Problem encountered with playlist " + i.id + ". Trying again since it is the only playlist."), this.tech_.trigger("retryplaylist"), this.masterPlaylistLoader_.load(s);
+ if (s) {
+ var o = !1;
+ r.forEach((function(e) {
+ if (e !== i) {
+ var t = e.excludeUntil;
+ void 0 !== t && t !== 1 / 0 && (o = !0, delete e.excludeUntil)
+ }
+ })), o && (Yr.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."), this.tech_.trigger("retryplaylist"))
+ }
+ n = i.playlistErrors_ > this.maxPlaylistRetries ? 1 / 0 : Date.now() + 1e3 * t, i.excludeUntil = n, e.reason && (i.lastExcludeReason_ = e.reason), this.tech_.trigger("blacklistplaylist"), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-rendition-blacklisted"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-rendition-blacklisted"
+ });
+ var u = this.selectPlaylist();
+ if (!u) return this.error = "Playback cannot continue. No available working or supported playlists.", void this.trigger("error");
+ var l = e.internal ? this.logger_ : Yr.log.warn,
+ h = e.message ? " " + e.message : "";
+ l((e.internal ? "Internal problem" : "Problem") + " encountered with playlist " + i.id + "." + h + " Switching to playlist " + u.id + "."), u.attributes.AUDIO !== i.attributes.AUDIO && this.delegateLoaders_("audio", ["abort", "pause"]), u.attributes.SUBTITLES !== i.attributes.SUBTITLES && this.delegateLoaders_("subtitle", ["abort", "pause"]), this.delegateLoaders_("main", ["abort", "pause"]);
+ var d = u.targetDuration / 2 * 1e3 || 5e3,
+ c = "number" == typeof u.lastRequest && Date.now() - u.lastRequest <= d;
+ return this.switchMedia_(u, "exclude", s || c)
+ }, i.pauseLoading = function() {
+ this.delegateLoaders_("all", ["abort", "pause"]), this.stopABRTimer_()
+ }, i.delegateLoaders_ = function(e, t) {
+ var i = this,
+ n = [],
+ r = "all" === e;
+ (r || "main" === e) && n.push(this.masterPlaylistLoader_);
+ var a = [];
+ (r || "audio" === e) && a.push("AUDIO"), (r || "subtitle" === e) && (a.push("CLOSED-CAPTIONS"), a.push("SUBTITLES")), a.forEach((function(e) {
+ var t = i.mediaTypes_[e] && i.mediaTypes_[e].activePlaylistLoader;
+ t && n.push(t)
+ })), ["main", "audio", "subtitle"].forEach((function(t) {
+ var r = i[t + "SegmentLoader_"];
+ !r || e !== t && "all" !== e || n.push(r)
+ })), n.forEach((function(e) {
+ return t.forEach((function(t) {
+ "function" == typeof e[t] && e[t]()
+ }))
+ }))
+ }, i.setCurrentTime = function(e) {
+ var t = Zr(this.tech_.buffered(), e);
+ return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this.masterPlaylistLoader_.media().segments ? t && t.length ? e : (this.mainSegmentLoader_.resetEverything(), this.mainSegmentLoader_.abort(), this.mediaTypes_.AUDIO.activePlaylistLoader && (this.audioSegmentLoader_.resetEverything(), this.audioSegmentLoader_.abort()), this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_.resetEverything(), this.subtitleSegmentLoader_.abort()), void this.load()) : 0
+ }, i.duration = function() {
+ if (!this.masterPlaylistLoader_) return 0;
+ var e = this.masterPlaylistLoader_.media();
+ return e ? e.endList ? this.mediaSource ? this.mediaSource.duration : Zs.Playlist.duration(e) : 1 / 0 : 0
+ }, i.seekable = function() {
+ return this.seekable_
+ }, i.onSyncInfoUpdate_ = function() {
+ var e;
+ if (this.masterPlaylistLoader_) {
+ var t = this.masterPlaylistLoader_.media();
+ if (t) {
+ var i = this.syncController_.getExpiredTime(t, this.duration());
+ if (null !== i) {
+ var n = this.masterPlaylistLoader_.master,
+ r = Zs.Playlist.seekable(t, i, Zs.Playlist.liveEdgeDelay(n, t));
+ if (0 !== r.length) {
+ if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
+ if (t = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (i = this.syncController_.getExpiredTime(t, this.duration()))) return;
+ if (0 === (e = Zs.Playlist.seekable(t, i, Zs.Playlist.liveEdgeDelay(n, t))).length) return
+ }
+ var a, s;
+ this.seekable_ && this.seekable_.length && (a = this.seekable_.end(0), s = this.seekable_.start(0)), e ? e.start(0) > r.end(0) || r.start(0) > e.end(0) ? this.seekable_ = r : this.seekable_ = Yr.createTimeRanges([
+ [e.start(0) > r.start(0) ? e.start(0) : r.start(0), e.end(0) < r.end(0) ? e.end(0) : r.end(0)]
+ ]) : this.seekable_ = r, this.seekable_ && this.seekable_.length && this.seekable_.end(0) === a && this.seekable_.start(0) === s || (this.logger_("seekable updated [" + ta(this.seekable_) + "]"), this.tech_.trigger("seekablechanged"))
+ }
+ }
+ }
+ }
+ }, i.updateDuration = function(e) {
+ if (this.updateDuration_ && (this.mediaSource.removeEventListener("sourceopen", this.updateDuration_), this.updateDuration_ = null), "open" !== this.mediaSource.readyState) return this.updateDuration_ = this.updateDuration.bind(this, e), void this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
+ if (e) {
+ var t = this.seekable();
+ if (!t.length) return;
+ (isNaN(this.mediaSource.duration) || this.mediaSource.duration < t.end(t.length - 1)) && this.sourceUpdater_.setDuration(t.end(t.length - 1))
+ } else {
+ var i = this.tech_.buffered(),
+ n = Zs.Playlist.duration(this.masterPlaylistLoader_.media());
+ i.length > 0 && (n = Math.max(n, i.end(i.length - 1))), this.mediaSource.duration !== n && this.sourceUpdater_.setDuration(n)
+ }
+ }, i.dispose = function() {
+ var e = this;
+ this.trigger("dispose"), this.decrypter_.terminate(), this.masterPlaylistLoader_.dispose(), this.mainSegmentLoader_.dispose(), this.loadOnPlay_ && this.tech_.off("play", this.loadOnPlay_), ["AUDIO", "SUBTITLES"].forEach((function(t) {
+ var i = e.mediaTypes_[t].groups;
+ for (var n in i) i[n].forEach((function(e) {
+ e.playlistLoader && e.playlistLoader.dispose()
+ }))
+ })), this.audioSegmentLoader_.dispose(), this.subtitleSegmentLoader_.dispose(), this.sourceUpdater_.dispose(), this.timelineChangeController_.dispose(), this.stopABRTimer_(), this.updateDuration_ && this.mediaSource.removeEventListener("sourceopen", this.updateDuration_), this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_), this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_), this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_), this.off()
+ }, i.master = function() {
+ return this.masterPlaylistLoader_.master
+ }, i.media = function() {
+ return this.masterPlaylistLoader_.media() || this.initialMedia_
+ }, i.areMediaTypesKnown_ = function() {
+ var e = !!this.mediaTypes_.AUDIO.activePlaylistLoader,
+ t = !!this.mainSegmentLoader_.getCurrentMediaInfo_(),
+ i = !e || !!this.audioSegmentLoader_.getCurrentMediaInfo_();
+ return !(!t || !i)
+ }, i.getCodecsOrExclude_ = function() {
+ var e = this,
+ t = {
+ main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
+ audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
+ };
+ t.video = t.main;
+ var i = Us(this.master(), this.media()),
+ n = {},
+ r = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
+ if (t.main.hasVideo && (n.video = i.video || t.main.videoCodec || _.DEFAULT_VIDEO_CODEC), t.main.isMuxed && (n.video += "," + (i.audio || t.main.audioCodec || _.DEFAULT_AUDIO_CODEC)), (t.main.hasAudio && !t.main.isMuxed || t.audio.hasAudio || r) && (n.audio = i.audio || t.main.audioCodec || t.audio.audioCodec || _.DEFAULT_AUDIO_CODEC, t.audio.isFmp4 = t.main.hasAudio && !t.main.isMuxed ? t.main.isFmp4 : t.audio.isFmp4), n.audio || n.video) {
+ var a, s = {};
+ if (["video", "audio"].forEach((function(e) {
+ if (n.hasOwnProperty(e) && (r = t[e].isFmp4, o = n[e], !(r ? _.browserSupportsCodec(o) : _.muxerSupportsCodec(o)))) {
+ var i = t[e].isFmp4 ? "browser" : "muxer";
+ s[i] = s[i] || [], s[i].push(n[e]), "audio" === e && (a = i)
+ }
+ var r, o
+ })), r && a && this.media().attributes.AUDIO) {
+ var o = this.media().attributes.AUDIO;
+ this.master().playlists.forEach((function(t) {
+ (t.attributes && t.attributes.AUDIO) === o && t !== e.media() && (t.excludeUntil = 1 / 0)
+ })), this.logger_("excluding audio group " + o + " as " + a + ' does not support codec(s): "' + n.audio + '"')
+ }
+ if (!Object.keys(s).length) {
+ if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
+ var u = [];
+ if (["video", "audio"].forEach((function(t) {
+ var i = (_.parseCodecs(e.sourceUpdater_.codecs[t] || "")[0] || {}).type,
+ r = (_.parseCodecs(n[t] || "")[0] || {}).type;
+ i && r && i.toLowerCase() !== r.toLowerCase() && u.push('"' + e.sourceUpdater_.codecs[t] + '" -> "' + n[t] + '"')
+ })), u.length) return void this.blacklistCurrentPlaylist({
+ playlist: this.media(),
+ message: "Codec switching not supported: " + u.join(", ") + ".",
+ blacklistDuration: 1 / 0,
+ internal: !0
+ })
+ }
+ return n
+ }
+ var l = Object.keys(s).reduce((function(e, t) {
+ return e && (e += ", "), e += t + ' does not support codec(s): "' + s[t].join(",") + '"'
+ }), "") + ".";
+ this.blacklistCurrentPlaylist({
+ playlist: this.media(),
+ internal: !0,
+ message: l,
+ blacklistDuration: 1 / 0
+ })
+ } else this.blacklistCurrentPlaylist({
+ playlist: this.media(),
+ message: "Could not determine codecs for playlist.",
+ blacklistDuration: 1 / 0
+ })
+ }, i.tryToCreateSourceBuffers_ = function() {
+ if ("open" === this.mediaSource.readyState && !this.sourceUpdater_.hasCreatedSourceBuffers() && this.areMediaTypesKnown_()) {
+ var e = this.getCodecsOrExclude_();
+ if (e) {
+ this.sourceUpdater_.createSourceBuffers(e);
+ var t = [e.video, e.audio].filter(Boolean).join(",");
+ this.excludeIncompatibleVariants_(t)
+ }
+ }
+ }, i.excludeUnsupportedVariants_ = function() {
+ var e = this,
+ t = this.master().playlists,
+ i = [];
+ Object.keys(t).forEach((function(n) {
+ var r = t[n];
+ if (-1 === i.indexOf(r.id)) {
+ i.push(r.id);
+ var a = Us(e.master, r),
+ s = [];
+ !a.audio || _.muxerSupportsCodec(a.audio) || _.browserSupportsCodec(a.audio) || s.push("audio codec " + a.audio), !a.video || _.muxerSupportsCodec(a.video) || _.browserSupportsCodec(a.video) || s.push("video codec " + a.video), a.text && "stpp.ttml.im1t" === a.text && s.push("text codec " + a.text), s.length && (r.excludeUntil = 1 / 0, e.logger_("excluding " + r.id + " for unsupported: " + s.join(", ")))
+ }
+ }))
+ }, i.excludeIncompatibleVariants_ = function(e) {
+ var t = this,
+ i = [],
+ n = this.master().playlists,
+ r = Ds(_.parseCodecs(e)),
+ a = Os(r),
+ s = r.video && _.parseCodecs(r.video)[0] || null,
+ o = r.audio && _.parseCodecs(r.audio)[0] || null;
+ Object.keys(n).forEach((function(e) {
+ var r = n[e];
+ if (-1 === i.indexOf(r.id) && r.excludeUntil !== 1 / 0) {
+ i.push(r.id);
+ var u = [],
+ l = Us(t.masterPlaylistLoader_.master, r),
+ h = Os(l);
+ if (l.audio || l.video) {
+ if (h !== a && u.push('codec count "' + h + '" !== "' + a + '"'), !t.sourceUpdater_.canChangeType()) {
+ var d = l.video && _.parseCodecs(l.video)[0] || null,
+ c = l.audio && _.parseCodecs(l.audio)[0] || null;
+ d && s && d.type.toLowerCase() !== s.type.toLowerCase() && u.push('video codec "' + d.type + '" !== "' + s.type + '"'), c && o && c.type.toLowerCase() !== o.type.toLowerCase() && u.push('audio codec "' + c.type + '" !== "' + o.type + '"')
+ }
+ u.length && (r.excludeUntil = 1 / 0, t.logger_("blacklisting " + r.id + ": " + u.join(" && ")))
+ }
+ }
+ }))
+ }, i.updateAdCues_ = function(e) {
+ var t = 0,
+ i = this.seekable();
+ i.length && (t = i.start(0)),
+ function(e, t, i) {
+ if (void 0 === i && (i = 0), e.segments)
+ for (var n, r = i, a = 0; a < e.segments.length; a++) {
+ var s = e.segments[a];
+ if (n || (n = Eo(t, r + s.duration / 2)), n) {
+ if ("cueIn" in s) {
+ n.endTime = r, n.adEndTime = r, r += s.duration, n = null;
+ continue
+ }
+ if (r < n.endTime) {
+ r += s.duration;
+ continue
+ }
+ n.endTime += s.duration
+ } else if ("cueOut" in s && ((n = new C.default.VTTCue(r, r + s.duration, s.cueOut)).adStartTime = r, n.adEndTime = r + parseFloat(s.cueOut), t.addCue(n)), "cueOutCont" in s) {
+ var o = s.cueOutCont.split("/").map(parseFloat),
+ u = o[0],
+ l = o[1];
+ (n = new C.default.VTTCue(r, r + s.duration, "")).adStartTime = r - u, n.adEndTime = n.adStartTime + l, t.addCue(n)
+ }
+ r += s.duration
+ }
+ }(e, this.cueTagsTrack_, t)
+ }, i.goalBufferLength = function() {
+ var e = this.tech_.currentTime(),
+ t = ns.GOAL_BUFFER_LENGTH,
+ i = ns.GOAL_BUFFER_LENGTH_RATE,
+ n = Math.max(t, ns.MAX_GOAL_BUFFER_LENGTH);
+ return Math.min(t + e * i, n)
+ }, i.bufferLowWaterLine = function() {
+ var e = this.tech_.currentTime(),
+ t = ns.BUFFER_LOW_WATER_LINE,
+ i = ns.BUFFER_LOW_WATER_LINE_RATE,
+ n = Math.max(t, ns.MAX_BUFFER_LOW_WATER_LINE),
+ r = Math.max(t, ns.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
+ return Math.min(t + e * i, this.experimentalBufferBasedABR ? r : n)
+ }, i.bufferHighWaterLine = function() {
+ return ns.BUFFER_HIGH_WATER_LINE
+ }, t
+ }(Yr.EventTarget),
+ jo = function(e, t, i) {
+ var n, r, a, s = e.masterPlaylistController_,
+ o = s[(e.options_.smoothQualityChange ? "smooth" : "fast") + "QualityChange_"].bind(s);
+ if (t.attributes) {
+ var u = t.attributes.RESOLUTION;
+ this.width = u && u.width, this.height = u && u.height, this.bandwidth = t.attributes.BANDWIDTH
+ }
+ this.codecs = Us(s.master(), t), this.playlist = t, this.id = i, this.enabled = (n = e.playlists, r = t.id, a = o, function(e) {
+ var t = n.master.playlists[r],
+ i = pa(t),
+ s = ma(t);
+ return void 0 === e ? s : (e ? delete t.disabled : t.disabled = !0, e === s || i || (a(), e ? n.trigger("renditionenabled") : n.trigger("renditiondisabled")), e)
+ })
+ },
+ Vo = ["seeking", "seeked", "pause", "playing", "error"],
+ Ho = function() {
+ function e(e) {
+ var t = this;
+ this.masterPlaylistController_ = e.masterPlaylistController, this.tech_ = e.tech, this.seekable = e.seekable, this.allowSeeksWithinUnsafeLiveWindow = e.allowSeeksWithinUnsafeLiveWindow, this.liveRangeSafeTimeDelta = e.liveRangeSafeTimeDelta, this.media = e.media, this.consecutiveUpdates = 0, this.lastRecordedTime = null, this.timer_ = null, this.checkCurrentTimeTimeout_ = null, this.logger_ = $r("PlaybackWatcher"), this.logger_("initialize");
+ var i = function() {
+ return t.monitorCurrentTime_()
+ },
+ n = function() {
+ return t.monitorCurrentTime_()
+ },
+ r = function() {
+ return t.techWaiting_()
+ },
+ a = function() {
+ return t.cancelTimer_()
+ },
+ s = function() {
+ return t.fixesBadSeeks_()
+ },
+ o = this.masterPlaylistController_,
+ u = ["main", "subtitle", "audio"],
+ l = {};
+ u.forEach((function(e) {
+ l[e] = {
+ reset: function() {
+ return t.resetSegmentDownloads_(e)
+ },
+ updateend: function() {
+ return t.checkSegmentDownloads_(e)
+ }
+ }, o[e + "SegmentLoader_"].on("appendsdone", l[e].updateend), o[e + "SegmentLoader_"].on("playlistupdate", l[e].reset), t.tech_.on(["seeked", "seeking"], l[e].reset)
+ })), this.tech_.on("seekablechanged", s), this.tech_.on("waiting", r), this.tech_.on(Vo, a), this.tech_.on("canplay", n), this.tech_.one("play", i), this.dispose = function() {
+ t.logger_("dispose"), t.tech_.off("seekablechanged", s), t.tech_.off("waiting", r), t.tech_.off(Vo, a), t.tech_.off("canplay", n), t.tech_.off("play", i), u.forEach((function(e) {
+ o[e + "SegmentLoader_"].off("appendsdone", l[e].updateend), o[e + "SegmentLoader_"].off("playlistupdate", l[e].reset), t.tech_.off(["seeked", "seeking"], l[e].reset)
+ })), t.checkCurrentTimeTimeout_ && C.default.clearTimeout(t.checkCurrentTimeTimeout_), t.cancelTimer_()
+ }
+ }
+ var t = e.prototype;
+ return t.monitorCurrentTime_ = function() {
+ this.checkCurrentTime_(), this.checkCurrentTimeTimeout_ && C.default.clearTimeout(this.checkCurrentTimeTimeout_), this.checkCurrentTimeTimeout_ = C.default.setTimeout(this.monitorCurrentTime_.bind(this), 250)
+ }, t.resetSegmentDownloads_ = function(e) {
+ var t = this.masterPlaylistController_[e + "SegmentLoader_"];
+ this[e + "StalledDownloads_"] > 0 && this.logger_("resetting possible stalled download count for " + e + " loader"), this[e + "StalledDownloads_"] = 0, this[e + "Buffered_"] = t.buffered_()
+ }, t.checkSegmentDownloads_ = function(e) {
+ var t = this.masterPlaylistController_,
+ i = t[e + "SegmentLoader_"],
+ n = i.buffered_(),
+ r = function(e, t) {
+ if (e === t) return !1;
+ if (!e && t || !t && e) return !0;
+ if (e.length !== t.length) return !0;
+ for (var i = 0; i < e.length; i++)
+ if (e.start(i) !== t.start(i) || e.end(i) !== t.end(i)) return !0;
+ return !1
+ }(this[e + "Buffered_"], n);
+ this[e + "Buffered_"] = n, r ? this.resetSegmentDownloads_(e) : (this[e + "StalledDownloads_"]++, this.logger_("found #" + this[e + "StalledDownloads_"] + " " + e + " appends that did not increase buffer (possible stalled download)", {
+ playlistId: i.playlist_ && i.playlist_.id,
+ buffered: ia(n)
+ }), this[e + "StalledDownloads_"] < 10 || (this.logger_(e + " loader stalled download exclusion"), this.resetSegmentDownloads_(e), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-" + e + "-download-exclusion"
+ }), "subtitle" !== e && t.blacklistCurrentPlaylist({
+ message: "Excessive " + e + " segment downloading detected."
+ }, 1 / 0)))
+ }, t.checkCurrentTime_ = function() {
+ if (this.tech_.seeking() && this.fixesBadSeeks_()) return this.consecutiveUpdates = 0, void(this.lastRecordedTime = this.tech_.currentTime());
+ if (!this.tech_.paused() && !this.tech_.seeking()) {
+ var e = this.tech_.currentTime(),
+ t = this.tech_.buffered();
+ if (this.lastRecordedTime === e && (!t.length || e + .1 >= t.end(t.length - 1))) return this.techWaiting_();
+ this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this.consecutiveUpdates++, this.waiting_()) : e === this.lastRecordedTime ? this.consecutiveUpdates++ : (this.consecutiveUpdates = 0, this.lastRecordedTime = e)
+ }
+ }, t.cancelTimer_ = function() {
+ this.consecutiveUpdates = 0, this.timer_ && (this.logger_("cancelTimer_"), clearTimeout(this.timer_)), this.timer_ = null
+ }, t.fixesBadSeeks_ = function() {
+ if (!this.tech_.seeking()) return !1;
+ var e, t = this.seekable(),
+ i = this.tech_.currentTime();
+ this.afterSeekableWindow_(t, i, this.media(), this.allowSeeksWithinUnsafeLiveWindow) && (e = t.end(t.length - 1));
+ if (this.beforeSeekableWindow_(t, i)) {
+ var n = t.start(0);
+ e = n + (n === t.end(0) ? 0 : .1)
+ }
+ if (void 0 !== e) return this.logger_("Trying to seek outside of seekable at time " + i + " with seekable range " + ta(t) + ". Seeking to " + e + "."), this.tech_.setCurrentTime(e), !0;
+ var r = this.tech_.buffered();
+ return !! function(e) {
+ var t = e.buffered,
+ i = e.targetDuration,
+ n = e.currentTime;
+ return !!t.length && (!(t.end(0) - t.start(0) < 2 * i) && (!(n > t.start(0)) && t.start(0) - n < i))
+ }({
+ buffered: r,
+ targetDuration: this.media().targetDuration,
+ currentTime: i
+ }) && (e = r.start(0) + .1, this.logger_("Buffered region starts (" + r.start(0) + ") just beyond seek point (" + i + "). Seeking to " + e + "."), this.tech_.setCurrentTime(e), !0)
+ }, t.waiting_ = function() {
+ if (!this.techWaiting_()) {
+ var e = this.tech_.currentTime(),
+ t = this.tech_.buffered(),
+ i = Zr(t, e);
+ return i.length && e + 3 <= i.end(0) ? (this.cancelTimer_(), this.tech_.setCurrentTime(e), this.logger_("Stopped at " + e + " while inside a buffered region [" + i.start(0) + " -> " + i.end(0) + "]. Attempting to resume playback by seeking to the current time."), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-unknown-waiting"
+ }), void this.tech_.trigger({
+ type: "usage",
+ name: "hls-unknown-waiting"
+ })) : void 0
+ }
+ }, t.techWaiting_ = function() {
+ var e = this.seekable(),
+ t = this.tech_.currentTime();
+ if (this.tech_.seeking() && this.fixesBadSeeks_()) return !0;
+ if (this.tech_.seeking() || null !== this.timer_) return !0;
+ if (this.beforeSeekableWindow_(e, t)) {
+ var i = e.end(e.length - 1);
+ return this.logger_("Fell out of live window at time " + t + ". Seeking to live point (seekable end) " + i), this.cancelTimer_(), this.tech_.setCurrentTime(i), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-live-resync"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-live-resync"
+ }), !0
+ }
+ var n = this.tech_.vhs.masterPlaylistController_.sourceUpdater_,
+ r = this.tech_.buffered();
+ if (this.videoUnderflow_({
+ audioBuffered: n.audioBuffered(),
+ videoBuffered: n.videoBuffered(),
+ currentTime: t
+ })) return this.cancelTimer_(), this.tech_.setCurrentTime(t), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-video-underflow"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-video-underflow"
+ }), !0;
+ var a = ea(r, t);
+ if (a.length > 0) {
+ var s = a.start(0) - t;
+ return this.logger_("Stopped at " + t + ", setting timer for " + s + ", seeking to " + a.start(0)), this.cancelTimer_(), this.timer_ = setTimeout(this.skipTheGap_.bind(this), 1e3 * s, t), !0
+ }
+ return !1
+ }, t.afterSeekableWindow_ = function(e, t, i, n) {
+ if (void 0 === n && (n = !1), !e.length) return !1;
+ var r = e.end(e.length - 1) + .1;
+ return !i.endList && n && (r = e.end(e.length - 1) + 3 * i.targetDuration), t > r
+ }, t.beforeSeekableWindow_ = function(e, t) {
+ return !!(e.length && e.start(0) > 0 && t < e.start(0) - this.liveRangeSafeTimeDelta)
+ }, t.videoUnderflow_ = function(e) {
+ var t = e.videoBuffered,
+ i = e.audioBuffered,
+ n = e.currentTime;
+ if (t) {
+ var r;
+ if (t.length && i.length) {
+ var a = Zr(t, n - 3),
+ s = Zr(t, n),
+ o = Zr(i, n);
+ o.length && !s.length && a.length && (r = {
+ start: a.end(0),
+ end: o.end(0)
+ })
+ } else {
+ ea(t, n).length || (r = this.gapFromVideoUnderflow_(t, n))
+ }
+ return !!r && (this.logger_("Encountered a gap in video from " + r.start + " to " + r.end + ". Seeking to current time " + n), !0)
+ }
+ }, t.skipTheGap_ = function(e) {
+ var t = this.tech_.buffered(),
+ i = this.tech_.currentTime(),
+ n = ea(t, i);
+ this.cancelTimer_(), 0 !== n.length && i === e && (this.logger_("skipTheGap_:", "currentTime:", i, "scheduled currentTime:", e, "nextRange start:", n.start(0)), this.tech_.setCurrentTime(n.start(0) + 1 / 30), this.tech_.trigger({
+ type: "usage",
+ name: "vhs-gap-skip"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-gap-skip"
+ }))
+ }, t.gapFromVideoUnderflow_ = function(e, t) {
+ for (var i = function(e) {
+ if (e.length < 2) return Yr.createTimeRanges();
+ for (var t = [], i = 1; i < e.length; i++) {
+ var n = e.end(i - 1),
+ r = e.start(i);
+ t.push([n, r])
+ }
+ return Yr.createTimeRanges(t)
+ }(e), n = 0; n < i.length; n++) {
+ var r = i.start(n),
+ a = i.end(n);
+ if (t - r < 4 && t - r > 2) return {
+ start: r,
+ end: a
+ }
+ }
+ return null
+ }, e
+ }(),
+ zo = {
+ errorInterval: 30,
+ getSource: function(e) {
+ return e(this.tech({
+ IWillNotUseThisInPlugins: !0
+ }).currentSource_ || this.currentSource())
+ }
+ },
+ Go = function(e) {
+ ! function e(t, i) {
+ var n = 0,
+ r = 0,
+ a = Yr.mergeOptions(zo, i);
+ t.ready((function() {
+ t.trigger({
+ type: "usage",
+ name: "vhs-error-reload-initialized"
+ }), t.trigger({
+ type: "usage",
+ name: "hls-error-reload-initialized"
+ })
+ }));
+ var s = function() {
+ r && t.currentTime(r)
+ },
+ o = function(e) {
+ null != e && (r = t.duration() !== 1 / 0 && t.currentTime() || 0, t.one("loadedmetadata", s), t.src(e), t.trigger({
+ type: "usage",
+ name: "vhs-error-reload"
+ }), t.trigger({
+ type: "usage",
+ name: "hls-error-reload"
+ }), t.play())
+ },
+ u = function() {
+ return Date.now() - n < 1e3 * a.errorInterval ? (t.trigger({
+ type: "usage",
+ name: "vhs-error-reload-canceled"
+ }), void t.trigger({
+ type: "usage",
+ name: "hls-error-reload-canceled"
+ })) : a.getSource && "function" == typeof a.getSource ? (n = Date.now(), a.getSource.call(t, o)) : void Yr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")
+ },
+ l = function e() {
+ t.off("loadedmetadata", s), t.off("error", u), t.off("dispose", e)
+ };
+ t.on("error", u), t.on("dispose", l), t.reloadSourceOnError = function(i) {
+ l(), e(t, i)
+ }
+ }(this, e)
+ },
+ Wo = {
+ PlaylistLoader: Ua,
+ Playlist: Sa,
+ utils: Ka,
+ STANDARD_PLAYLIST_SELECTOR: Hs,
+ INITIAL_PLAYLIST_SELECTOR: function() {
+ var e = this,
+ t = this.playlists.master.playlists.filter(Sa.isEnabled);
+ return Ns(t, (function(e, t) {
+ return js(e, t)
+ })), t.filter((function(t) {
+ return !!Us(e.playlists.master, t).video
+ }))[0] || null
+ },
+ lastBandwidthSelector: Hs,
+ movingAverageBandwidthSelector: function(e) {
+ var t = -1,
+ i = -1;
+ if (e < 0 || e > 1) throw new Error("Moving average bandwidth decay must be between 0 and 1.");
+ return function() {
+ var n = this.useDevicePixelRatio && C.default.devicePixelRatio || 1;
+ return t < 0 && (t = this.systemBandwidth, i = this.systemBandwidth), this.systemBandwidth > 0 && this.systemBandwidth !== i && (t = e * this.systemBandwidth + (1 - e) * t, i = this.systemBandwidth), Vs(this.playlists.master, t, parseInt(Bs(this.tech_.el(), "width"), 10) * n, parseInt(Bs(this.tech_.el(), "height"), 10) * n, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_)
+ }
+ },
+ comparePlaylistBandwidth: js,
+ comparePlaylistResolution: function(e, t) {
+ var i, n;
+ return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION.width), i = i || C.default.Number.MAX_VALUE, t.attributes.RESOLUTION && t.attributes.RESOLUTION.width && (n = t.attributes.RESOLUTION.width), i === (n = n || C.default.Number.MAX_VALUE) && e.attributes.BANDWIDTH && t.attributes.BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes.BANDWIDTH : i - n
+ },
+ xhr: Na()
+ };
+ Object.keys(ns).forEach((function(e) {
+ Object.defineProperty(Wo, e, {
+ get: function() {
+ return Yr.log.warn("using Vhs." + e + " is UNSAFE be sure you know what you are doing"), ns[e]
+ },
+ set: function(t) {
+ Yr.log.warn("using Vhs." + e + " is UNSAFE be sure you know what you are doing"), "number" != typeof t || t < 0 ? Yr.log.warn("value of Vhs." + e + " must be greater than or equal to 0") : ns[e] = t
+ }
+ })
+ }));
+ var Yo = function(e, t) {
+ for (var i = t.media(), n = -1, r = 0; r < e.length; r++)
+ if (e[r].id === i.id) {
+ n = r;
+ break
+ } e.selectedIndex_ = n, e.trigger({
+ selectedIndex: n,
+ type: "change"
+ })
+ };
+ Wo.canPlaySource = function() {
+ return Yr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
+ };
+ var qo = function(e) {
+ var t = e.player,
+ i = e.sourceKeySystems,
+ n = e.audioMedia,
+ r = e.mainPlaylists;
+ if (!t.eme.initializeMediaKeys) return Promise.resolve();
+ var a = function(e, t) {
+ return e.reduce((function(e, i) {
+ if (!i.contentProtection) return e;
+ var n = t.reduce((function(e, t) {
+ var n = i.contentProtection[t];
+ return n && n.pssh && (e[t] = {
+ pssh: n.pssh
+ }), e
+ }), {});
+ return Object.keys(n).length && e.push(n), e
+ }), [])
+ }(n ? r.concat([n]) : r, Object.keys(i)),
+ s = [],
+ o = [];
+ return a.forEach((function(e) {
+ o.push(new Promise((function(e, i) {
+ t.tech_.one("keysessioncreated", e)
+ }))), s.push(new Promise((function(i, n) {
+ t.eme.initializeMediaKeys({
+ keySystems: e
+ }, (function(e) {
+ e ? n(e) : i()
+ }))
+ })))
+ })), Promise.race([Promise.all(s), Promise.race(o)])
+ },
+ Ko = function(e) {
+ var t = e.player,
+ i = function(e, t, i) {
+ if (!e) return e;
+ var n = {};
+ t && t.attributes && t.attributes.CODECS && (n = Ds(_.parseCodecs(t.attributes.CODECS))), i && i.attributes && i.attributes.CODECS && (n.audio = i.attributes.CODECS);
+ var r = _.getMimeForCodec(n.video),
+ a = _.getMimeForCodec(n.audio),
+ s = {};
+ for (var o in e) s[o] = {}, a && (s[o].audioContentType = a), r && (s[o].videoContentType = r), t.contentProtection && t.contentProtection[o] && t.contentProtection[o].pssh && (s[o].pssh = t.contentProtection[o].pssh), "string" == typeof e[o] && (s[o].url = e[o]);
+ return Yr.mergeOptions(e, s)
+ }(e.sourceKeySystems, e.media, e.audioMedia);
+ return !!i && (t.currentSource().keySystems = i, !(i && !t.eme) || (Yr.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"), !1))
+ },
+ Xo = function() {
+ if (!C.default.localStorage) return null;
+ var e = C.default.localStorage.getItem("videojs-vhs");
+ if (!e) return null;
+ try {
+ return JSON.parse(e)
+ } catch (e) {
+ return null
+ }
+ };
+ Wo.supportsNativeHls = function() {
+ if (!k.default || !k.default.createElement) return !1;
+ var e = k.default.createElement("video");
+ if (!Yr.getTech("Html5").isSupported()) return !1;
+ return ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl"].some((function(t) {
+ return /maybe|probably/i.test(e.canPlayType(t))
+ }))
+ }(), Wo.supportsNativeDash = !!(k.default && k.default.createElement && Yr.getTech("Html5").isSupported()) && /maybe|probably/i.test(k.default.createElement("video").canPlayType("application/dash+xml")), Wo.supportsTypeNatively = function(e) {
+ return "hls" === e ? Wo.supportsNativeHls : "dash" === e && Wo.supportsNativeDash
+ }, Wo.isSupported = function() {
+ return Yr.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
+ };
+ var Qo = function(e) {
+ function t(t, i, n) {
+ var r;
+ if (r = e.call(this, i, Yr.mergeOptions(n.hls, n.vhs)) || this, n.hls && Object.keys(n.hls).length && Yr.log.warn("Using hls options is deprecated. Use vhs instead."), "number" == typeof n.initialBandwidth && (r.options_.bandwidth = n.initialBandwidth), r.logger_ = $r("VhsHandler"), i.options_ && i.options_.playerId) {
+ var a = Yr(i.options_.playerId);
+ a.hasOwnProperty("hls") || Object.defineProperty(a, "hls", {
+ get: function() {
+ return Yr.log.warn("player.hls is deprecated. Use player.tech().vhs instead."), i.trigger({
+ type: "usage",
+ name: "hls-player-access"
+ }), I.default(r)
+ },
+ configurable: !0
+ }), a.hasOwnProperty("vhs") || Object.defineProperty(a, "vhs", {
+ get: function() {
+ return Yr.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."), i.trigger({
+ type: "usage",
+ name: "vhs-player-access"
+ }), I.default(r)
+ },
+ configurable: !0
+ }), a.hasOwnProperty("dash") || Object.defineProperty(a, "dash", {
+ get: function() {
+ return Yr.log.warn("player.dash is deprecated. Use player.tech().vhs instead."), I.default(r)
+ },
+ configurable: !0
+ }), r.player_ = a
+ }
+ if (r.tech_ = i, r.source_ = t, r.stats = {}, r.ignoreNextSeekingEvent_ = !1, r.setOptions_(), r.options_.overrideNative && i.overrideNativeAudioTracks && i.overrideNativeVideoTracks) i.overrideNativeAudioTracks(!0), i.overrideNativeVideoTracks(!0);
+ else if (r.options_.overrideNative && (i.featuresNativeVideoTracks || i.featuresNativeAudioTracks)) throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
+ return r.on(k.default, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], (function(e) {
+ var t = k.default.fullscreenElement || k.default.webkitFullscreenElement || k.default.mozFullScreenElement || k.default.msFullscreenElement;
+ t && t.contains(r.tech_.el()) ? r.masterPlaylistController_.fastQualityChange_() : r.masterPlaylistController_.checkABR_()
+ })), r.on(r.tech_, "seeking", (function() {
+ this.ignoreNextSeekingEvent_ ? this.ignoreNextSeekingEvent_ = !1 : this.setCurrentTime(this.tech_.currentTime())
+ })), r.on(r.tech_, "error", (function() {
+ this.tech_.error() && this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading()
+ })), r.on(r.tech_, "play", r.play), r
+ }
+ L.default(t, e);
+ var i = t.prototype;
+ return i.setOptions_ = function() {
+ var e = this;
+ if (this.options_.withCredentials = this.options_.withCredentials || !1, this.options_.handleManifestRedirects = !1 !== this.options_.handleManifestRedirects, this.options_.limitRenditionByPlayerDimensions = !1 !== this.options_.limitRenditionByPlayerDimensions, this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || !1, this.options_.smoothQualityChange = this.options_.smoothQualityChange || !1, this.options_.useBandwidthFromLocalStorage = void 0 !== this.source_.useBandwidthFromLocalStorage ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || !1, this.options_.customTagParsers = this.options_.customTagParsers || [], this.options_.customTagMappers = this.options_.customTagMappers || [], this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || !1, "number" != typeof this.options_.blacklistDuration && (this.options_.blacklistDuration = 300), "number" != typeof this.options_.bandwidth && this.options_.useBandwidthFromLocalStorage) {
+ var t = Xo();
+ t && t.bandwidth && (this.options_.bandwidth = t.bandwidth, this.tech_.trigger({
+ type: "usage",
+ name: "vhs-bandwidth-from-local-storage"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-bandwidth-from-local-storage"
+ })), t && t.throughput && (this.options_.throughput = t.throughput, this.tech_.trigger({
+ type: "usage",
+ name: "vhs-throughput-from-local-storage"
+ }), this.tech_.trigger({
+ type: "usage",
+ name: "hls-throughput-from-local-storage"
+ }))
+ }
+ "number" != typeof this.options_.bandwidth && (this.options_.bandwidth = ns.INITIAL_BANDWIDTH), this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === ns.INITIAL_BANDWIDTH, ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "smoothQualityChange", "customTagParsers", "customTagMappers", "handleManifestRedirects", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "experimentalBufferBasedABR", "liveRangeSafeTimeDelta", "experimentalLLHLS", "experimentalExactManifestTimings", "experimentalLeastPixelDiffSelector"].forEach((function(t) {
+ void 0 !== e.source_[t] && (e.options_[t] = e.source_[t])
+ })), this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions, this.useDevicePixelRatio = this.options_.useDevicePixelRatio
+ }, i.src = function(e, t) {
+ var i = this;
+ if (e) {
+ var n;
+ this.setOptions_(), this.options_.src = 0 === (n = this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") ? JSON.parse(n.substring(n.indexOf(",") + 1)) : n, this.options_.tech = this.tech_, this.options_.externVhs = Wo, this.options_.sourceType = g.simpleTypeFromSourceType(t), this.options_.seekTo = function(e) {
+ i.tech_.setCurrentTime(e)
+ }, this.options_.smoothQualityChange && Yr.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"), this.masterPlaylistController_ = new No(this.options_);
+ var r = Yr.mergeOptions({
+ liveRangeSafeTimeDelta: .1
+ }, this.options_, {
+ seekable: function() {
+ return i.seekable()
+ },
+ media: function() {
+ return i.masterPlaylistController_.media()
+ },
+ masterPlaylistController: this.masterPlaylistController_
+ });
+ this.playbackWatcher_ = new Ho(r), this.masterPlaylistController_.on("error", (function() {
+ var e = Yr.players[i.tech_.options_.playerId],
+ t = i.masterPlaylistController_.error;
+ "object" != typeof t || t.code ? "string" == typeof t && (t = {
+ message: t,
+ code: 3
+ }) : t.code = 3, e.error(t)
+ }));
+ var a = this.options_.experimentalBufferBasedABR ? Wo.movingAverageBandwidthSelector(.55) : Wo.STANDARD_PLAYLIST_SELECTOR;
+ this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : a.bind(this), this.masterPlaylistController_.selectInitialPlaylist = Wo.INITIAL_PLAYLIST_SELECTOR.bind(this), this.playlists = this.masterPlaylistController_.masterPlaylistLoader_, this.mediaSource = this.masterPlaylistController_.mediaSource, Object.defineProperties(this, {
+ selectPlaylist: {
+ get: function() {
+ return this.masterPlaylistController_.selectPlaylist
+ },
+ set: function(e) {
+ this.masterPlaylistController_.selectPlaylist = e.bind(this)
+ }
+ },
+ throughput: {
+ get: function() {
+ return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate
+ },
+ set: function(e) {
+ this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = e, this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1
+ }
+ },
+ bandwidth: {
+ get: function() {
+ return this.masterPlaylistController_.mainSegmentLoader_.bandwidth
+ },
+ set: function(e) {
+ this.masterPlaylistController_.mainSegmentLoader_.bandwidth = e, this.masterPlaylistController_.mainSegmentLoader_.throughput = {
+ rate: 0,
+ count: 0
+ }
+ }
+ },
+ systemBandwidth: {
+ get: function() {
+ var e, t = 1 / (this.bandwidth || 1);
+ return e = this.throughput > 0 ? 1 / this.throughput : 0, Math.floor(1 / (t + e))
+ },
+ set: function() {
+ Yr.log.error('The "systemBandwidth" property is read-only')
+ }
+ }
+ }), this.options_.bandwidth && (this.bandwidth = this.options_.bandwidth), this.options_.throughput && (this.throughput = this.options_.throughput), Object.defineProperties(this.stats, {
+ bandwidth: {
+ get: function() {
+ return i.bandwidth || 0
+ },
+ enumerable: !0
+ },
+ mediaRequests: {
+ get: function() {
+ return i.masterPlaylistController_.mediaRequests_() || 0
+ },
+ enumerable: !0
+ },
+ mediaRequestsAborted: {
+ get: function() {
+ return i.masterPlaylistController_.mediaRequestsAborted_() || 0
+ },
+ enumerable: !0
+ },
+ mediaRequestsTimedout: {
+ get: function() {
+ return i.masterPlaylistController_.mediaRequestsTimedout_() || 0
+ },
+ enumerable: !0
+ },
+ mediaRequestsErrored: {
+ get: function() {
+ return i.masterPlaylistController_.mediaRequestsErrored_() || 0
+ },
+ enumerable: !0
+ },
+ mediaTransferDuration: {
+ get: function() {
+ return i.masterPlaylistController_.mediaTransferDuration_() || 0
+ },
+ enumerable: !0
+ },
+ mediaBytesTransferred: {
+ get: function() {
+ return i.masterPlaylistController_.mediaBytesTransferred_() || 0
+ },
+ enumerable: !0
+ },
+ mediaSecondsLoaded: {
+ get: function() {
+ return i.masterPlaylistController_.mediaSecondsLoaded_() || 0
+ },
+ enumerable: !0
+ },
+ mediaAppends: {
+ get: function() {
+ return i.masterPlaylistController_.mediaAppends_() || 0
+ },
+ enumerable: !0
+ },
+ mainAppendsToLoadedData: {
+ get: function() {
+ return i.masterPlaylistController_.mainAppendsToLoadedData_() || 0
+ },
+ enumerable: !0
+ },
+ audioAppendsToLoadedData: {
+ get: function() {
+ return i.masterPlaylistController_.audioAppendsToLoadedData_() || 0
+ },
+ enumerable: !0
+ },
+ appendsToLoadedData: {
+ get: function() {
+ return i.masterPlaylistController_.appendsToLoadedData_() || 0
+ },
+ enumerable: !0
+ },
+ timeToLoadedData: {
+ get: function() {
+ return i.masterPlaylistController_.timeToLoadedData_() || 0
+ },
+ enumerable: !0
+ },
+ buffered: {
+ get: function() {
+ return ia(i.tech_.buffered())
+ },
+ enumerable: !0
+ },
+ currentTime: {
+ get: function() {
+ return i.tech_.currentTime()
+ },
+ enumerable: !0
+ },
+ currentSource: {
+ get: function() {
+ return i.tech_.currentSource_
+ },
+ enumerable: !0
+ },
+ currentTech: {
+ get: function() {
+ return i.tech_.name_
+ },
+ enumerable: !0
+ },
+ duration: {
+ get: function() {
+ return i.tech_.duration()
+ },
+ enumerable: !0
+ },
+ master: {
+ get: function() {
+ return i.playlists.master
+ },
+ enumerable: !0
+ },
+ playerDimensions: {
+ get: function() {
+ return i.tech_.currentDimensions()
+ },
+ enumerable: !0
+ },
+ seekable: {
+ get: function() {
+ return ia(i.tech_.seekable())
+ },
+ enumerable: !0
+ },
+ timestamp: {
+ get: function() {
+ return Date.now()
+ },
+ enumerable: !0
+ },
+ videoPlaybackQuality: {
+ get: function() {
+ return i.tech_.getVideoPlaybackQuality()
+ },
+ enumerable: !0
+ }
+ }), this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)), this.tech_.on("bandwidthupdate", (function() {
+ i.options_.useBandwidthFromLocalStorage && function(e) {
+ if (!C.default.localStorage) return !1;
+ var t = Xo();
+ t = t ? Yr.mergeOptions(t, e) : e;
+ try {
+ C.default.localStorage.setItem("videojs-vhs", JSON.stringify(t))
+ } catch (e) {
+ return !1
+ }
+ }({
+ bandwidth: i.bandwidth,
+ throughput: Math.round(i.throughput)
+ })
+ })), this.masterPlaylistController_.on("selectedinitialmedia", (function() {
+ var e;
+ (e = i).representations = function() {
+ var t = e.masterPlaylistController_.master(),
+ i = ba(t) ? e.masterPlaylistController_.getAudioTrackPlaylists_() : t.playlists;
+ return i ? i.filter((function(e) {
+ return !pa(e)
+ })).map((function(t, i) {
+ return new jo(e, t, t.id)
+ })) : []
+ }
+ })), this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers", (function() {
+ i.setupEme_()
+ })), this.on(this.masterPlaylistController_, "progress", (function() {
+ this.tech_.trigger("progress")
+ })), this.on(this.masterPlaylistController_, "firstplay", (function() {
+ this.ignoreNextSeekingEvent_ = !0
+ })), this.setupQualityLevels_(), this.tech_.el() && (this.mediaSourceUrl_ = C.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource), this.tech_.src(this.mediaSourceUrl_))
+ }
+ }, i.setupEme_ = function() {
+ var e = this,
+ t = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,
+ i = Ko({
+ player: this.player_,
+ sourceKeySystems: this.source_.keySystems,
+ media: this.playlists.media(),
+ audioMedia: t && t.media()
+ });
+ this.player_.tech_.on("keystatuschange", (function(t) {
+ "output-restricted" === t.status && e.masterPlaylistController_.blacklistCurrentPlaylist({
+ playlist: e.masterPlaylistController_.media(),
+ message: "DRM keystatus changed to " + t.status + ". Playlist will fail to play. Check for HDCP content.",
+ blacklistDuration: 1 / 0
+ })
+ })), 11 !== Yr.browser.IE_VERSION && i ? (this.logger_("waiting for EME key session creation"), qo({
+ player: this.player_,
+ sourceKeySystems: this.source_.keySystems,
+ audioMedia: t && t.media(),
+ mainPlaylists: this.playlists.master.playlists
+ }).then((function() {
+ e.logger_("created EME key session"), e.masterPlaylistController_.sourceUpdater_.initializedEme()
+ })).catch((function(t) {
+ e.logger_("error while creating EME key session", t), e.player_.error({
+ message: "Failed to initialize media keys for EME",
+ code: 3
+ })
+ }))) : this.masterPlaylistController_.sourceUpdater_.initializedEme()
+ }, i.setupQualityLevels_ = function() {
+ var e = this,
+ t = Yr.players[this.tech_.options_.playerId];
+ t && t.qualityLevels && !this.qualityLevels_ && (this.qualityLevels_ = t.qualityLevels(), this.masterPlaylistController_.on("selectedinitialmedia", (function() {
+ var t, i;
+ t = e.qualityLevels_, (i = e).representations().forEach((function(e) {
+ t.addQualityLevel(e)
+ })), Yo(t, i.playlists)
+ })), this.playlists.on("mediachange", (function() {
+ Yo(e.qualityLevels_, e.playlists)
+ })))
+ }, t.version = function() {
+ return {
+ "@videojs/http-streaming": "2.10.2",
+ "mux.js": "5.13.0",
+ "mpd-parser": "0.19.0",
+ "m3u8-parser": "4.7.0",
+ "aes-decrypter": "3.1.2"
+ }
+ }, i.version = function() {
+ return this.constructor.version()
+ }, i.canChangeType = function() {
+ return yo.canChangeType()
+ }, i.play = function() {
+ this.masterPlaylistController_.play()
+ }, i.setCurrentTime = function(e) {
+ this.masterPlaylistController_.setCurrentTime(e)
+ }, i.duration = function() {
+ return this.masterPlaylistController_.duration()
+ }, i.seekable = function() {
+ return this.masterPlaylistController_.seekable()
+ }, i.dispose = function() {
+ this.playbackWatcher_ && this.playbackWatcher_.dispose(), this.masterPlaylistController_ && this.masterPlaylistController_.dispose(), this.qualityLevels_ && this.qualityLevels_.dispose(), this.player_ && (delete this.player_.vhs, delete this.player_.dash, delete this.player_.hls), this.tech_ && this.tech_.vhs && delete this.tech_.vhs, this.tech_ && delete this.tech_.hls, this.mediaSourceUrl_ && C.default.URL.revokeObjectURL && (C.default.URL.revokeObjectURL(this.mediaSourceUrl_), this.mediaSourceUrl_ = null), e.prototype.dispose.call(this)
+ }, i.convertToProgramTime = function(e, t) {
+ return Xa({
+ playlist: this.masterPlaylistController_.media(),
+ time: e,
+ callback: t
+ })
+ }, i.seekToProgramTime = function(e, t, i, n) {
+ return void 0 === i && (i = !0), void 0 === n && (n = 2), Qa({
+ programTime: e,
+ playlist: this.masterPlaylistController_.media(),
+ retryCount: n,
+ pauseAfterSeek: i,
+ seekTo: this.options_.seekTo,
+ tech: this.options_.tech,
+ callback: t
+ })
+ }, t
+ }(Yr.getComponent("Component")),
+ $o = {
+ name: "videojs-http-streaming",
+ VERSION: "2.10.2",
+ canHandleSource: function(e, t) {
+ void 0 === t && (t = {});
+ var i = Yr.mergeOptions(Yr.options, t);
+ return $o.canPlayType(e.type, i)
+ },
+ handleSource: function(e, t, i) {
+ void 0 === i && (i = {});
+ var n = Yr.mergeOptions(Yr.options, i);
+ return t.vhs = new Qo(e, t, n), Yr.hasOwnProperty("hls") || Object.defineProperty(t, "hls", {
+ get: function() {
+ return Yr.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."), t.vhs
+ },
+ configurable: !0
+ }), t.vhs.xhr = Na(), t.vhs.src(e.src, e.type), t.vhs
+ },
+ canPlayType: function(e, t) {
+ void 0 === t && (t = {});
+ var i = Yr.mergeOptions(Yr.options, t).vhs.overrideNative,
+ n = void 0 === i ? !Yr.browser.IS_ANY_SAFARI : i,
+ r = g.simpleTypeFromSourceType(e);
+ return r && (!Wo.supportsTypeNatively(r) || n) ? "maybe" : ""
+ }
+ };
+ _.browserSupportsCodec("avc1.4d400d,mp4a.40.2") && Yr.getTech("Html5").registerSourceHandler($o, 0), Yr.VhsHandler = Qo, Object.defineProperty(Yr, "HlsHandler", {
+ get: function() {
+ return Yr.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."), Qo
+ },
+ configurable: !0
+ }), Yr.VhsSourceHandler = $o, Object.defineProperty(Yr, "HlsSourceHandler", {
+ get: function() {
+ return Yr.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."), $o
+ },
+ configurable: !0
+ }), Yr.Vhs = Wo, Object.defineProperty(Yr, "Hls", {
+ get: function() {
+ return Yr.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."), Wo
+ },
+ configurable: !0
+ }), Yr.use || (Yr.registerComponent("Hls", Wo), Yr.registerComponent("Vhs", Wo)), Yr.options.vhs = Yr.options.vhs || {}, Yr.options.hls = Yr.options.hls || {}, Yr.registerPlugin ? Yr.registerPlugin("reloadSourceOnError", Go) : Yr.plugin("reloadSourceOnError", Go), t.exports = Yr
+ }, {
+ "@babel/runtime/helpers/assertThisInitialized": 1,
+ "@babel/runtime/helpers/construct": 2,
+ "@babel/runtime/helpers/extends": 3,
+ "@babel/runtime/helpers/inherits": 4,
+ "@babel/runtime/helpers/inheritsLoose": 5,
+ "@videojs/vhs-utils/cjs/byte-helpers": 9,
+ "@videojs/vhs-utils/cjs/codecs.js": 11,
+ "@videojs/vhs-utils/cjs/containers": 12,
+ "@videojs/vhs-utils/cjs/id3-helpers": 15,
+ "@videojs/vhs-utils/cjs/media-types.js": 16,
+ "@videojs/vhs-utils/cjs/resolve-url.js": 20,
+ "@videojs/xhr": 23,
+ "global/document": 33,
+ "global/window": 34,
+ keycode: 37,
+ "m3u8-parser": 38,
+ "mpd-parser": 40,
+ "mux.js/lib/tools/parse-sidx": 42,
+ "mux.js/lib/utils/clock": 43,
+ "safe-json-parse/tuple": 45,
+ "videojs-vtt.js": 48
+ }],
+ 48: [function(e, t, i) {
+ var n = e("global/window"),
+ r = t.exports = {
+ WebVTT: e("./vtt.js"),
+ VTTCue: e("./vttcue.js"),
+ VTTRegion: e("./vttregion.js")
+ };
+ n.vttjs = r, n.WebVTT = r.WebVTT;
+ var a = r.VTTCue,
+ s = r.VTTRegion,
+ o = n.VTTCue,
+ u = n.VTTRegion;
+ r.shim = function() {
+ n.VTTCue = a, n.VTTRegion = s
+ }, r.restore = function() {
+ n.VTTCue = o, n.VTTRegion = u
+ }, n.VTTCue || r.shim()
+ }, {
+ "./vtt.js": 49,
+ "./vttcue.js": 50,
+ "./vttregion.js": 51,
+ "global/window": 34
+ }],
+ 49: [function(e, t, i) {
+ var n = e("global/document"),
+ r = Object.create || function() {
+ function e() {}
+ return function(t) {
+ if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter.");
+ return e.prototype = t, new e
+ }
+ }();
+
+ function a(e, t) {
+ this.name = "ParsingError", this.code = e.code, this.message = t || e.message
+ }
+
+ function s(e) {
+ function t(e, t, i, n) {
+ return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + (0 | n) / 1e3
+ }
+ var i = e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
+ return i ? i[3] ? t(i[1], i[2], i[3].replace(":", ""), i[4]) : i[1] > 59 ? t(i[1], i[2], 0, i[4]) : t(0, i[1], i[2], i[4]) : null
+ }
+
+ function o() {
+ this.values = r(null)
+ }
+
+ function u(e, t, i, n) {
+ var r = n ? e.split(n) : [e];
+ for (var a in r)
+ if ("string" == typeof r[a]) {
+ var s = r[a].split(i);
+ if (2 === s.length) t(s[0], s[1])
+ }
+ }
+
+ function l(e, t, i) {
+ var n = e;
+
+ function r() {
+ var t = s(e);
+ if (null === t) throw new a(a.Errors.BadTimeStamp, "Malformed timestamp: " + n);
+ return e = e.replace(/^[^\sa-zA-Z-]+/, ""), t
+ }
+
+ function l() {
+ e = e.replace(/^\s+/, "")
+ }
+ if (l(), t.startTime = r(), l(), "--\x3e" !== e.substr(0, 3)) throw new a(a.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '--\x3e'): " + n);
+ e = e.substr(3), l(), t.endTime = r(), l(),
+ function(e, t) {
+ var n = new o;
+ u(e, (function(e, t) {
+ switch (e) {
+ case "region":
+ for (var r = i.length - 1; r >= 0; r--)
+ if (i[r].id === t) {
+ n.set(e, i[r].region);
+ break
+ } break;
+ case "vertical":
+ n.alt(e, t, ["rl", "lr"]);
+ break;
+ case "line":
+ var a = t.split(","),
+ s = a[0];
+ n.integer(e, s), n.percent(e, s) && n.set("snapToLines", !1), n.alt(e, s, ["auto"]), 2 === a.length && n.alt("lineAlign", a[1], ["start", "center", "end"]);
+ break;
+ case "position":
+ a = t.split(","), n.percent(e, a[0]), 2 === a.length && n.alt("positionAlign", a[1], ["start", "center", "end"]);
+ break;
+ case "size":
+ n.percent(e, t);
+ break;
+ case "align":
+ n.alt(e, t, ["start", "center", "end", "left", "right"])
+ }
+ }), /:/, /\s/), t.region = n.get("region", null), t.vertical = n.get("vertical", "");
+ try {
+ t.line = n.get("line", "auto")
+ } catch (e) {}
+ t.lineAlign = n.get("lineAlign", "start"), t.snapToLines = n.get("snapToLines", !0), t.size = n.get("size", 100);
+ try {
+ t.align = n.get("align", "center")
+ } catch (e) {
+ t.align = n.get("align", "middle")
+ }
+ try {
+ t.position = n.get("position", "auto")
+ } catch (e) {
+ t.position = n.get("position", {
+ start: 0,
+ left: 0,
+ center: 50,
+ middle: 50,
+ end: 100,
+ right: 100
+ }, t.align)
+ }
+ t.positionAlign = n.get("positionAlign", {
+ start: "start",
+ left: "start",
+ center: "center",
+ middle: "center",
+ end: "end",
+ right: "end"
+ }, t.align)
+ }(e, t)
+ }
+ a.prototype = r(Error.prototype), a.prototype.constructor = a, a.Errors = {
+ BadSignature: {
+ code: 0,
+ message: "Malformed WebVTT signature."
+ },
+ BadTimeStamp: {
+ code: 1,
+ message: "Malformed time stamp."
+ }
+ }, o.prototype = {
+ set: function(e, t) {
+ this.get(e) || "" === t || (this.values[e] = t)
+ },
+ get: function(e, t, i) {
+ return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t
+ },
+ has: function(e) {
+ return e in this.values
+ },
+ alt: function(e, t, i) {
+ for (var n = 0; n < i.length; ++n)
+ if (t === i[n]) {
+ this.set(e, t);
+ break
+ }
+ },
+ integer: function(e, t) {
+ /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10))
+ },
+ percent: function(e, t) {
+ return !!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t)) >= 0 && t <= 100) && (this.set(e, t), !0)
+ }
+ };
+ var h = n.createElement && n.createElement("textarea"),
+ d = {
+ c: "span",
+ i: "i",
+ b: "b",
+ u: "u",
+ ruby: "ruby",
+ rt: "rt",
+ v: "span",
+ lang: "span"
+ },
+ c = {
+ white: "rgba(255,255,255,1)",
+ lime: "rgba(0,255,0,1)",
+ cyan: "rgba(0,255,255,1)",
+ red: "rgba(255,0,0,1)",
+ yellow: "rgba(255,255,0,1)",
+ magenta: "rgba(255,0,255,1)",
+ blue: "rgba(0,0,255,1)",
+ black: "rgba(0,0,0,1)"
+ },
+ f = {
+ v: "title",
+ lang: "lang"
+ },
+ p = {
+ rt: "ruby"
+ };
+
+ function m(e, t) {
+ function i() {
+ if (!t) return null;
+ var e, i = t.match(/^([^<]*)(<[^>]*>?)?/);
+ return e = i[1] ? i[1] : i[2], t = t.substr(e.length), e
+ }
+
+ function n(e, t) {
+ return !p[t.localName] || p[t.localName] === e.localName
+ }
+
+ function r(t, i) {
+ var n = d[t];
+ if (!n) return null;
+ var r = e.document.createElement(n),
+ a = f[t];
+ return a && i && (r[a] = i.trim()), r
+ }
+ for (var a, o, u = e.document.createElement("div"), l = u, m = []; null !== (a = i());)
+ if ("<" !== a[0]) l.appendChild(e.document.createTextNode((o = a, h.innerHTML = o, o = h.textContent, h.textContent = "", o)));
+ else {
+ if ("/" === a[1]) {
+ m.length && m[m.length - 1] === a.substr(2).replace(">", "") && (m.pop(), l = l.parentNode);
+ continue
+ }
+ var _, g = s(a.substr(1, a.length - 2));
+ if (g) {
+ _ = e.document.createProcessingInstruction("timestamp", g), l.appendChild(_);
+ continue
+ }
+ var v = a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
+ if (!v) continue;
+ if (!(_ = r(v[1], v[3]))) continue;
+ if (!n(l, _)) continue;
+ if (v[2]) {
+ var y = v[2].split(".");
+ y.forEach((function(e) {
+ var t = /^bg_/.test(e),
+ i = t ? e.slice(3) : e;
+ if (c.hasOwnProperty(i)) {
+ var n = t ? "background-color" : "color",
+ r = c[i];
+ _.style[n] = r
+ }
+ })), _.className = y.join(" ")
+ }
+ m.push(v[1]), l.appendChild(_), l = _
+ } return u
+ }
+ var _ = [
+ [1470, 1470],
+ [1472, 1472],
+ [1475, 1475],
+ [1478, 1478],
+ [1488, 1514],
+ [1520, 1524],
+ [1544, 1544],
+ [1547, 1547],
+ [1549, 1549],
+ [1563, 1563],
+ [1566, 1610],
+ [1645, 1647],
+ [1649, 1749],
+ [1765, 1766],
+ [1774, 1775],
+ [1786, 1805],
+ [1807, 1808],
+ [1810, 1839],
+ [1869, 1957],
+ [1969, 1969],
+ [1984, 2026],
+ [2036, 2037],
+ [2042, 2042],
+ [2048, 2069],
+ [2074, 2074],
+ [2084, 2084],
+ [2088, 2088],
+ [2096, 2110],
+ [2112, 2136],
+ [2142, 2142],
+ [2208, 2208],
+ [2210, 2220],
+ [8207, 8207],
+ [64285, 64285],
+ [64287, 64296],
+ [64298, 64310],
+ [64312, 64316],
+ [64318, 64318],
+ [64320, 64321],
+ [64323, 64324],
+ [64326, 64449],
+ [64467, 64829],
+ [64848, 64911],
+ [64914, 64967],
+ [65008, 65020],
+ [65136, 65140],
+ [65142, 65276],
+ [67584, 67589],
+ [67592, 67592],
+ [67594, 67637],
+ [67639, 67640],
+ [67644, 67644],
+ [67647, 67669],
+ [67671, 67679],
+ [67840, 67867],
+ [67872, 67897],
+ [67903, 67903],
+ [67968, 68023],
+ [68030, 68031],
+ [68096, 68096],
+ [68112, 68115],
+ [68117, 68119],
+ [68121, 68147],
+ [68160, 68167],
+ [68176, 68184],
+ [68192, 68223],
+ [68352, 68405],
+ [68416, 68437],
+ [68440, 68466],
+ [68472, 68479],
+ [68608, 68680],
+ [126464, 126467],
+ [126469, 126495],
+ [126497, 126498],
+ [126500, 126500],
+ [126503, 126503],
+ [126505, 126514],
+ [126516, 126519],
+ [126521, 126521],
+ [126523, 126523],
+ [126530, 126530],
+ [126535, 126535],
+ [126537, 126537],
+ [126539, 126539],
+ [126541, 126543],
+ [126545, 126546],
+ [126548, 126548],
+ [126551, 126551],
+ [126553, 126553],
+ [126555, 126555],
+ [126557, 126557],
+ [126559, 126559],
+ [126561, 126562],
+ [126564, 126564],
+ [126567, 126570],
+ [126572, 126578],
+ [126580, 126583],
+ [126585, 126588],
+ [126590, 126590],
+ [126592, 126601],
+ [126603, 126619],
+ [126625, 126627],
+ [126629, 126633],
+ [126635, 126651],
+ [1114109, 1114109]
+ ];
+
+ function g(e) {
+ for (var t = 0; t < _.length; t++) {
+ var i = _[t];
+ if (e >= i[0] && e <= i[1]) return !0
+ }
+ return !1
+ }
+
+ function v(e) {
+ var t = [],
+ i = "";
+ if (!e || !e.childNodes) return "ltr";
+
+ function n(e, t) {
+ for (var i = t.childNodes.length - 1; i >= 0; i--) e.push(t.childNodes[i])
+ }
+
+ function r(e) {
+ if (!e || !e.length) return null;
+ var t = e.pop(),
+ i = t.textContent || t.innerText;
+ if (i) {
+ var a = i.match(/^.*(\n|\r)/);
+ return a ? (e.length = 0, a[0]) : i
+ }
+ return "ruby" === t.tagName ? r(e) : t.childNodes ? (n(e, t), r(e)) : void 0
+ }
+ for (n(t, e); i = r(t);)
+ for (var a = 0; a < i.length; a++)
+ if (g(i.charCodeAt(a))) return "rtl";
+ return "ltr"
+ }
+
+ function y() {}
+
+ function b(e, t, i) {
+ y.call(this), this.cue = t, this.cueDiv = m(e, t.text);
+ var n = {
+ color: "rgba(255, 255, 255, 1)",
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
+ position: "relative",
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0,
+ display: "inline",
+ writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
+ unicodeBidi: "plaintext"
+ };
+ this.applyStyles(n, this.cueDiv), this.div = e.document.createElement("div"), n = {
+ direction: v(this.cueDiv),
+ writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
+ unicodeBidi: "plaintext",
+ textAlign: "middle" === t.align ? "center" : t.align,
+ font: i.font,
+ whiteSpace: "pre-line",
+ position: "absolute"
+ }, this.applyStyles(n), this.div.appendChild(this.cueDiv);
+ var r = 0;
+ switch (t.positionAlign) {
+ case "start":
+ r = t.position;
+ break;
+ case "center":
+ r = t.position - t.size / 2;
+ break;
+ case "end":
+ r = t.position - t.size
+ }
+ "" === t.vertical ? this.applyStyles({
+ left: this.formatStyle(r, "%"),
+ width: this.formatStyle(t.size, "%")
+ }) : this.applyStyles({
+ top: this.formatStyle(r, "%"),
+ height: this.formatStyle(t.size, "%")
+ }), this.move = function(e) {
+ this.applyStyles({
+ top: this.formatStyle(e.top, "px"),
+ bottom: this.formatStyle(e.bottom, "px"),
+ left: this.formatStyle(e.left, "px"),
+ right: this.formatStyle(e.right, "px"),
+ height: this.formatStyle(e.height, "px"),
+ width: this.formatStyle(e.width, "px")
+ })
+ }
+ }
+
+ function S(e) {
+ var t, i, n, r;
+ if (e.div) {
+ i = e.div.offsetHeight, n = e.div.offsetWidth, r = e.div.offsetTop;
+ var a = (a = e.div.childNodes) && (a = a[0]) && a.getClientRects && a.getClientRects();
+ e = e.div.getBoundingClientRect(), t = a ? Math.max(a[0] && a[0].height || 0, e.height / a.length) : 0
+ }
+ this.left = e.left, this.right = e.right, this.top = e.top || r, this.height = e.height || i, this.bottom = e.bottom || r + (e.height || i), this.width = e.width || n, this.lineHeight = void 0 !== t ? t : e.lineHeight
+ }
+
+ function T(e, t, i, n) {
+ var r = new S(t),
+ a = t.cue,
+ s = function(e) {
+ if ("number" == typeof e.line && (e.snapToLines || e.line >= 0 && e.line <= 100)) return e.line;
+ if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement) return -1;
+ for (var t = e.track, i = t.textTrackList, n = 0, r = 0; r < i.length && i[r] !== t; r++) "showing" === i[r].mode && n++;
+ return -1 * ++n
+ }(a),
+ o = [];
+ if (a.snapToLines) {
+ var u;
+ switch (a.vertical) {
+ case "":
+ o = ["+y", "-y"], u = "height";
+ break;
+ case "rl":
+ o = ["+x", "-x"], u = "width";
+ break;
+ case "lr":
+ o = ["-x", "+x"], u = "width"
+ }
+ var l = r.lineHeight,
+ h = l * Math.round(s),
+ d = i[u] + l,
+ c = o[0];
+ Math.abs(h) > d && (h = h < 0 ? -1 : 1, h *= Math.ceil(d / l) * l), s < 0 && (h += "" === a.vertical ? i.height : i.width, o = o.reverse()), r.move(c, h)
+ } else {
+ var f = r.lineHeight / i.height * 100;
+ switch (a.lineAlign) {
+ case "center":
+ s -= f / 2;
+ break;
+ case "end":
+ s -= f
+ }
+ switch (a.vertical) {
+ case "":
+ t.applyStyles({
+ top: t.formatStyle(s, "%")
+ });
+ break;
+ case "rl":
+ t.applyStyles({
+ left: t.formatStyle(s, "%")
+ });
+ break;
+ case "lr":
+ t.applyStyles({
+ right: t.formatStyle(s, "%")
+ })
+ }
+ o = ["+y", "-x", "+x", "-y"], r = new S(t)
+ }
+ var p = function(e, t) {
+ for (var r, a = new S(e), s = 1, o = 0; o < t.length; o++) {
+ for (; e.overlapsOppositeAxis(i, t[o]) || e.within(i) && e.overlapsAny(n);) e.move(t[o]);
+ if (e.within(i)) return e;
+ var u = e.intersectPercentage(i);
+ s > u && (r = new S(e), s = u), e = new S(a)
+ }
+ return r || a
+ }(r, o);
+ t.move(p.toCSSCompatValues(i))
+ }
+
+ function E() {}
+ y.prototype.applyStyles = function(e, t) {
+ for (var i in t = t || this.div, e) e.hasOwnProperty(i) && (t.style[i] = e[i])
+ }, y.prototype.formatStyle = function(e, t) {
+ return 0 === e ? 0 : e + t
+ }, b.prototype = r(y.prototype), b.prototype.constructor = b, S.prototype.move = function(e, t) {
+ switch (t = void 0 !== t ? t : this.lineHeight, e) {
+ case "+x":
+ this.left += t, this.right += t;
+ break;
+ case "-x":
+ this.left -= t, this.right -= t;
+ break;
+ case "+y":
+ this.top += t, this.bottom += t;
+ break;
+ case "-y":
+ this.top -= t, this.bottom -= t
+ }
+ }, S.prototype.overlaps = function(e) {
+ return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top
+ }, S.prototype.overlapsAny = function(e) {
+ for (var t = 0; t < e.length; t++)
+ if (this.overlaps(e[t])) return !0;
+ return !1
+ }, S.prototype.within = function(e) {
+ return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right
+ }, S.prototype.overlapsOppositeAxis = function(e, t) {
+ switch (t) {
+ case "+x":
+ return this.left < e.left;
+ case "-x":
+ return this.right > e.right;
+ case "+y":
+ return this.top < e.top;
+ case "-y":
+ return this.bottom > e.bottom
+ }
+ }, S.prototype.intersectPercentage = function(e) {
+ return Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left)) * Math.max(0, Math.min(this.bottom, e.bottom) - Math.max(this.top, e.top)) / (this.height * this.width)
+ }, S.prototype.toCSSCompatValues = function(e) {
+ return {
+ top: this.top - e.top,
+ bottom: e.bottom - this.bottom,
+ left: this.left - e.left,
+ right: e.right - this.right,
+ height: this.height,
+ width: this.width
+ }
+ }, S.getSimpleBoxPosition = function(e) {
+ var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0,
+ i = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0,
+ n = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0;
+ return {
+ left: (e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e).left,
+ right: e.right,
+ top: e.top || n,
+ height: e.height || t,
+ bottom: e.bottom || n + (e.height || t),
+ width: e.width || i
+ }
+ }, E.StringDecoder = function() {
+ return {
+ decode: function(e) {
+ if (!e) return "";
+ if ("string" != typeof e) throw new Error("Error - expected string data.");
+ return decodeURIComponent(encodeURIComponent(e))
+ }
+ }
+ }, E.convertCueToDOMTree = function(e, t) {
+ return e && t ? m(e, t) : null
+ };
+ E.processCues = function(e, t, i) {
+ if (!e || !t || !i) return null;
+ for (; i.firstChild;) i.removeChild(i.firstChild);
+ var n = e.document.createElement("div");
+ if (n.style.position = "absolute", n.style.left = "0", n.style.right = "0", n.style.top = "0", n.style.bottom = "0", n.style.margin = "1.5%", i.appendChild(n), function(e) {
+ for (var t = 0; t < e.length; t++)
+ if (e[t].hasBeenReset || !e[t].displayState) return !0;
+ return !1
+ }(t)) {
+ var r = [],
+ a = S.getSimpleBoxPosition(n),
+ s = {
+ font: Math.round(.05 * a.height * 100) / 100 + "px sans-serif"
+ };
+ ! function() {
+ for (var i, o, u = 0; u < t.length; u++) o = t[u], i = new b(e, o, s), n.appendChild(i.div), T(0, i, a, r), o.displayState = i.div, r.push(S.getSimpleBoxPosition(i))
+ }()
+ } else
+ for (var o = 0; o < t.length; o++) n.appendChild(t[o].displayState)
+ }, E.Parser = function(e, t, i) {
+ i || (i = t, t = {}), t || (t = {}), this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "", this.decoder = i || new TextDecoder("utf8"), this.regionList = []
+ }, E.Parser.prototype = {
+ reportOrThrowError: function(e) {
+ if (!(e instanceof a)) throw e;
+ this.onparsingerror && this.onparsingerror(e)
+ },
+ parse: function(e) {
+ var t = this;
+
+ function i() {
+ for (var e = t.buffer, i = 0; i < e.length && "\r" !== e[i] && "\n" !== e[i];) ++i;
+ var n = e.substr(0, i);
+ return "\r" === e[i] && ++i, "\n" === e[i] && ++i, t.buffer = e.substr(i), n
+ }
+
+ function n(e) {
+ e.match(/X-TIMESTAMP-MAP/) ? u(e, (function(e, i) {
+ switch (e) {
+ case "X-TIMESTAMP-MAP":
+ ! function(e) {
+ var i = new o;
+ u(e, (function(e, t) {
+ switch (e) {
+ case "MPEGT":
+ i.integer(e + "S", t);
+ break;
+ case "LOCA":
+ i.set(e + "L", s(t))
+ }
+ }), /[^\d]:/, /,/), t.ontimestampmap && t.ontimestampmap({
+ MPEGTS: i.get("MPEGTS"),
+ LOCAL: i.get("LOCAL")
+ })
+ }(i)
+ }
+ }), /=/) : u(e, (function(e, i) {
+ switch (e) {
+ case "Region":
+ ! function(e) {
+ var i = new o;
+ if (u(e, (function(e, t) {
+ switch (e) {
+ case "id":
+ i.set(e, t);
+ break;
+ case "width":
+ i.percent(e, t);
+ break;
+ case "lines":
+ i.integer(e, t);
+ break;
+ case "regionanchor":
+ case "viewportanchor":
+ var n = t.split(",");
+ if (2 !== n.length) break;
+ var r = new o;
+ if (r.percent("x", n[0]), r.percent("y", n[1]), !r.has("x") || !r.has("y")) break;
+ i.set(e + "X", r.get("x")), i.set(e + "Y", r.get("y"));
+ break;
+ case "scroll":
+ i.alt(e, t, ["up"])
+ }
+ }), /=/, /\s/), i.has("id")) {
+ var n = new(t.vttjs.VTTRegion || t.window.VTTRegion);
+ n.width = i.get("width", 100), n.lines = i.get("lines", 3), n.regionAnchorX = i.get("regionanchorX", 0), n.regionAnchorY = i.get("regionanchorY", 100), n.viewportAnchorX = i.get("viewportanchorX", 0), n.viewportAnchorY = i.get("viewportanchorY", 100), n.scroll = i.get("scroll", ""), t.onregion && t.onregion(n), t.regionList.push({
+ id: i.get("id"),
+ region: n
+ })
+ }
+ }(i)
+ }
+ }), /:/)
+ }
+ e && (t.buffer += t.decoder.decode(e, {
+ stream: !0
+ }));
+ try {
+ var r;
+ if ("INITIAL" === t.state) {
+ if (!/\r\n|\n/.test(t.buffer)) return this;
+ var h = (r = i()).match(/^WEBVTT([ \t].*)?$/);
+ if (!h || !h[0]) throw new a(a.Errors.BadSignature);
+ t.state = "HEADER"
+ }
+ for (var d = !1; t.buffer;) {
+ if (!/\r\n|\n/.test(t.buffer)) return this;
+ switch (d ? d = !1 : r = i(), t.state) {
+ case "HEADER":
+ /:/.test(r) ? n(r) : r || (t.state = "ID");
+ continue;
+ case "NOTE":
+ r || (t.state = "ID");
+ continue;
+ case "ID":
+ if (/^NOTE($|[ \t])/.test(r)) {
+ t.state = "NOTE";
+ break
+ }
+ if (!r) continue;
+ t.cue = new(t.vttjs.VTTCue || t.window.VTTCue)(0, 0, "");
+ try {
+ t.cue.align = "center"
+ } catch (e) {
+ t.cue.align = "middle"
+ }
+ if (t.state = "CUE", -1 === r.indexOf("--\x3e")) {
+ t.cue.id = r;
+ continue
+ }
+ case "CUE":
+ try {
+ l(r, t.cue, t.regionList)
+ } catch (e) {
+ t.reportOrThrowError(e), t.cue = null, t.state = "BADCUE";
+ continue
+ }
+ t.state = "CUETEXT";
+ continue;
+ case "CUETEXT":
+ var c = -1 !== r.indexOf("--\x3e");
+ if (!r || c && (d = !0)) {
+ t.oncue && t.oncue(t.cue), t.cue = null, t.state = "ID";
+ continue
+ }
+ t.cue.text && (t.cue.text += "\n"), t.cue.text += r.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
+ continue;
+ case "BADCUE":
+ r || (t.state = "ID");
+ continue
+ }
+ }
+ } catch (e) {
+ t.reportOrThrowError(e), "CUETEXT" === t.state && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t.state = "INITIAL" === t.state ? "BADWEBVTT" : "BADCUE"
+ }
+ return this
+ },
+ flush: function() {
+ try {
+ if (this.buffer += this.decoder.decode(), (this.cue || "HEADER" === this.state) && (this.buffer += "\n\n", this.parse()), "INITIAL" === this.state) throw new a(a.Errors.BadSignature)
+ } catch (e) {
+ this.reportOrThrowError(e)
+ }
+ return this.onflush && this.onflush(), this
+ }
+ }, t.exports = E
+ }, {
+ "global/document": 33
+ }],
+ 50: [function(e, t, i) {
+ var n = {
+ "": 1,
+ lr: 1,
+ rl: 1
+ },
+ r = {
+ start: 1,
+ center: 1,
+ end: 1,
+ left: 1,
+ right: 1,
+ auto: 1,
+ "line-left": 1,
+ "line-right": 1
+ };
+
+ function a(e) {
+ return "string" == typeof e && (!!r[e.toLowerCase()] && e.toLowerCase())
+ }
+
+ function s(e, t, i) {
+ this.hasBeenReset = !1;
+ var r = "",
+ s = !1,
+ o = e,
+ u = t,
+ l = i,
+ h = null,
+ d = "",
+ c = !0,
+ f = "auto",
+ p = "start",
+ m = "auto",
+ _ = "auto",
+ g = 100,
+ v = "center";
+ Object.defineProperties(this, {
+ id: {
+ enumerable: !0,
+ get: function() {
+ return r
+ },
+ set: function(e) {
+ r = "" + e
+ }
+ },
+ pauseOnExit: {
+ enumerable: !0,
+ get: function() {
+ return s
+ },
+ set: function(e) {
+ s = !!e
+ }
+ },
+ startTime: {
+ enumerable: !0,
+ get: function() {
+ return o
+ },
+ set: function(e) {
+ if ("number" != typeof e) throw new TypeError("Start time must be set to a number.");
+ o = e, this.hasBeenReset = !0
+ }
+ },
+ endTime: {
+ enumerable: !0,
+ get: function() {
+ return u
+ },
+ set: function(e) {
+ if ("number" != typeof e) throw new TypeError("End time must be set to a number.");
+ u = e, this.hasBeenReset = !0
+ }
+ },
+ text: {
+ enumerable: !0,
+ get: function() {
+ return l
+ },
+ set: function(e) {
+ l = "" + e, this.hasBeenReset = !0
+ }
+ },
+ region: {
+ enumerable: !0,
+ get: function() {
+ return h
+ },
+ set: function(e) {
+ h = e, this.hasBeenReset = !0
+ }
+ },
+ vertical: {
+ enumerable: !0,
+ get: function() {
+ return d
+ },
+ set: function(e) {
+ var t = function(e) {
+ return "string" == typeof e && (!!n[e.toLowerCase()] && e.toLowerCase())
+ }(e);
+ if (!1 === t) throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
+ d = t, this.hasBeenReset = !0
+ }
+ },
+ snapToLines: {
+ enumerable: !0,
+ get: function() {
+ return c
+ },
+ set: function(e) {
+ c = !!e, this.hasBeenReset = !0
+ }
+ },
+ line: {
+ enumerable: !0,
+ get: function() {
+ return f
+ },
+ set: function(e) {
+ if ("number" != typeof e && "auto" !== e) throw new SyntaxError("Line: an invalid number or illegal string was specified.");
+ f = e, this.hasBeenReset = !0
+ }
+ },
+ lineAlign: {
+ enumerable: !0,
+ get: function() {
+ return p
+ },
+ set: function(e) {
+ var t = a(e);
+ t && (p = t, this.hasBeenReset = !0)
+ }
+ },
+ position: {
+ enumerable: !0,
+ get: function() {
+ return m
+ },
+ set: function(e) {
+ if (e < 0 || e > 100) throw new Error("Position must be between 0 and 100.");
+ m = e, this.hasBeenReset = !0
+ }
+ },
+ positionAlign: {
+ enumerable: !0,
+ get: function() {
+ return _
+ },
+ set: function(e) {
+ var t = a(e);
+ t && (_ = t, this.hasBeenReset = !0)
+ }
+ },
+ size: {
+ enumerable: !0,
+ get: function() {
+ return g
+ },
+ set: function(e) {
+ if (e < 0 || e > 100) throw new Error("Size must be between 0 and 100.");
+ g = e, this.hasBeenReset = !0
+ }
+ },
+ align: {
+ enumerable: !0,
+ get: function() {
+ return v
+ },
+ set: function(e) {
+ var t = a(e);
+ if (!t) throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
+ v = t, this.hasBeenReset = !0
+ }
+ }
+ }), this.displayState = void 0
+ }
+ s.prototype.getCueAsHTML = function() {
+ return WebVTT.convertCueToDOMTree(window, this.text)
+ }, t.exports = s
+ }, {}],
+ 51: [function(e, t, i) {
+ var n = {
+ "": !0,
+ up: !0
+ };
+
+ function r(e) {
+ return "number" == typeof e && e >= 0 && e <= 100
+ }
+ t.exports = function() {
+ var e = 100,
+ t = 3,
+ i = 0,
+ a = 100,
+ s = 0,
+ o = 100,
+ u = "";
+ Object.defineProperties(this, {
+ width: {
+ enumerable: !0,
+ get: function() {
+ return e
+ },
+ set: function(t) {
+ if (!r(t)) throw new Error("Width must be between 0 and 100.");
+ e = t
+ }
+ },
+ lines: {
+ enumerable: !0,
+ get: function() {
+ return t
+ },
+ set: function(e) {
+ if ("number" != typeof e) throw new TypeError("Lines must be set to a number.");
+ t = e
+ }
+ },
+ regionAnchorY: {
+ enumerable: !0,
+ get: function() {
+ return a
+ },
+ set: function(e) {
+ if (!r(e)) throw new Error("RegionAnchorX must be between 0 and 100.");
+ a = e
+ }
+ },
+ regionAnchorX: {
+ enumerable: !0,
+ get: function() {
+ return i
+ },
+ set: function(e) {
+ if (!r(e)) throw new Error("RegionAnchorY must be between 0 and 100.");
+ i = e
+ }
+ },
+ viewportAnchorY: {
+ enumerable: !0,
+ get: function() {
+ return o
+ },
+ set: function(e) {
+ if (!r(e)) throw new Error("ViewportAnchorY must be between 0 and 100.");
+ o = e
+ }
+ },
+ viewportAnchorX: {
+ enumerable: !0,
+ get: function() {
+ return s
+ },
+ set: function(e) {
+ if (!r(e)) throw new Error("ViewportAnchorX must be between 0 and 100.");
+ s = e
+ }
+ },
+ scroll: {
+ enumerable: !0,
+ get: function() {
+ return u
+ },
+ set: function(e) {
+ var t = function(e) {
+ return "string" == typeof e && (!!n[e.toLowerCase()] && e.toLowerCase())
+ }(e);
+ !1 === t || (u = t)
+ }
+ }
+ })
+ }
+ }, {}],
+ 52: [function(e, t, i) {
+ "use strict";
+ t.exports = {
+ H265WEBJS_COMPILE_MULTI_THREAD_SHAREDBUFFER: 0,
+ DEFAULT_PLAYERE_LOAD_TIMEOUT: 20,
+ DEFAILT_WEBGL_PLAY_ID: "glplayer",
+ PLAYER_IN_TYPE_MP4: "mp4",
+ PLAYER_IN_TYPE_FLV: "flv",
+ PLAYER_IN_TYPE_HTTPFLV: "httpflv",
+ PLAYER_IN_TYPE_RAW_265: "raw265",
+ PLAYER_IN_TYPE_TS: "ts",
+ PLAYER_IN_TYPE_MPEGTS: "mpegts",
+ PLAYER_IN_TYPE_M3U8: "hls",
+ PLAYER_IN_TYPE_M3U8_VOD: "m3u8",
+ PLAYER_IN_TYPE_M3U8_LIVE: "hls",
+ APPEND_TYPE_STREAM: 0,
+ APPEND_TYPE_FRAME: 1,
+ APPEND_TYPE_SEQUENCE: 2,
+ DEFAULT_WIDTH: 600,
+ DEFAULT_HEIGHT: 600,
+ DEFAULT_FPS: 30,
+ DEFAULT_FRAME_DUR: 40,
+ DEFAULT_FIXED: !1,
+ DEFAULT_SAMPLERATE: 44100,
+ DEFAULT_CHANNELS: 2,
+ DEFAULT_CONSU_SAMPLE_LEN: 20,
+ PLAYER_MODE_VOD: "vod",
+ PLAYER_MODE_NOTIME_LIVE: "live",
+ AUDIO_MODE_ONCE: "ONCE",
+ AUDIO_MODE_SWAP: "SWAP",
+ DEFAULT_STRING_LIVE: "LIVE",
+ CODEC_H265: 0,
+ CODEC_H264: 1,
+ PLAYER_CORE_TYPE_DEFAULT: 0,
+ PLAYER_CORE_TYPE_CNATIVE: 1,
+ PLAYER_CNATIVE_VOD_RETRY_MAX: 7,
+ URI_PROTOCOL_WEBSOCKET: "ws",
+ URI_PROTOCOL_WEBSOCKET_DESC: "websocket",
+ URI_PROTOCOL_HTTP: "http",
+ URI_PROTOCOL_HTTP_DESC: "http",
+ FETCH_FIRST_MAX_TIMES: 5,
+ FETCH_HTTP_FLV_TIMEOUT_MS: 7e3,
+ V_CODEC_NAME_HEVC: 265,
+ V_CODEC_NAME_AVC: 264,
+ V_CODEC_NAME_UNKN: 500,
+ A_CODEC_NAME_AAC: 112,
+ A_CODEC_NAME_MP3: 113,
+ A_CODEC_NAME_UNKN: 500,
+ CACHE_NO_LOADCACHE: 1001,
+ CACHE_WITH_PLAY_SIGN: 1002,
+ CACHE_WITH_NOPLAY_SIGN: 1003,
+ V_CODEC_AVC_DEFAULT_FPS: 25
+ }
+ }, {}],
+ 53: [function(e, t, i) {
+ "use strict";
+ var n = window.AudioContext || window.webkitAudioContext,
+ r = e("../consts"),
+ a = e("./av-common");
+ t.exports = function() {
+ var e = {
+ options: {
+ sampleRate: r.DEFAULT_SAMPLERATE,
+ appendType: r.APPEND_TYPE_FRAME,
+ playMode: r.AUDIO_MODE_SWAP
+ },
+ sourceChannel: -1,
+ audioCtx: new n({
+ latencyHint: "interactive",
+ sampleRate: r.DEFAULT_SAMPLERATE
+ }),
+ gainNode: null,
+ sourceList: [],
+ startStatus: !1,
+ sampleQueue: [],
+ nextBuffer: null,
+ playTimestamp: 0,
+ playStartTime: 0,
+ durationMs: -1,
+ isLIVE: !1,
+ voice: 1,
+ onLoadCache: null,
+ resetStartParam: function() {
+ e.playTimestamp = 0, e.playStartTime = 0
+ },
+ setOnLoadCache: function(t) {
+ e.onLoadCache = t
+ },
+ setDurationMs: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ e.durationMs = t
+ },
+ setVoice: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ e.voice = t, e.gainNode.gain.value = t
+ },
+ getAlignVPTS: function() {
+ return e.playTimestamp + (a.GetMsTime() - e.playStartTime) / 1e3
+ },
+ swapSource: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ if (0 == e.startStatus) return null;
+ if (t < 0 || t >= e.sourceList.length) return null;
+ if (i < 0 || i >= e.sourceList.length) return null;
+ try {
+ e.sourceChannel === t && null !== e.sourceList[t] && (e.sourceList[t].disconnect(e.gainNode), e.sourceList[t] = null)
+ } catch (e) {
+ console.error("[DEFINE ERROR] audioPcmModule disconnect source Index:" + t + " error happened!", e)
+ }
+ e.sourceChannel = i;
+ var n = e.decodeSample(i, t); - 2 == n && e.isLIVE && (e.getAlignVPTS() >= e.durationMs / 1e3 - .04 ? e.pause() : null !== e.onLoadCache && e.onLoadCache())
+ },
+ addSample: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
+ return !(null == t || !t || null == t) && (0 == e.sampleQueue.length && (e.seekPos = t.pts), e.sampleQueue.push(t), e.sampleQueue.length, !0)
+ },
+ runNextBuffer: function() {
+ window.setInterval((function() {
+ if (!(null != e.nextBuffer || e.sampleQueue.length < r.DEFAULT_CONSU_SAMPLE_LEN)) {
+ e.nextBuffer = {
+ data: null,
+ pts: -1
+ };
+ for (var t = null, i = 0; i < r.DEFAULT_CONSU_SAMPLE_LEN; i++) {
+ t = e.sampleQueue.shift();
+ var n = null;
+ if (n = e.options.appendType == r.APPEND_TYPE_STREAM ? t : t.data, e.nextBuffer.pts < 0 && (e.nextBuffer.pts = t.pts), null == e.nextBuffer.data) e.nextBuffer.data = new Float32Array(n), n.length, e.nextBuffer.data.length;
+ else {
+ var a = new Float32Array(n.length + e.nextBuffer.data.length);
+ a.set(e.nextBuffer.data, 0), a.set(n, e.nextBuffer.data.length), e.nextBuffer.data = a, n.length, e.nextBuffer.data.length
+ }
+ if (e.sampleQueue.length <= 0) break;
+ t = null
+ }
+ e.nextBuffer.data.length
+ }
+ }), 10)
+ },
+ decodeSample: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ if (t < 0 || t >= e.sourceList.length) return -1;
+ if (null != e.sourceList[t] && null != e.sourceList[t] && e.sourceList[t] || (e.sourceList[t] = e.audioCtx.createBufferSource(), e.sourceList[t].onended = function() {
+ e.swapSource(t, i)
+ }), 0 == e.sampleQueue.length) return e.isLIVE ? (e.sourceList[t].connect(e.gainNode), e.sourceList[t].start(), e.sourceList[t].onended = function() {
+ e.swapSource(t, i)
+ }, e.sourceList[t].stop(), 0) : -2;
+ if (e.sourceList[t].buffer) return e.swapSource(t, i), 0;
+ if (null == e.nextBuffer || e.nextBuffer.data.length < 1) return e.sourceList[t].connect(e.gainNode), e.sourceList[t].start(), e.sourceList[t].startState = !0, e.sourceList[t].stop(), 1;
+ var n = e.nextBuffer.data;
+ e.playTimestamp = e.nextBuffer.pts, e.playStartTime = a.GetMsTime(), e.nextBuffer.data, e.playTimestamp;
+ try {
+ var r = e.audioCtx.createBuffer(1, n.length, e.options.sampleRate);
+ r.copyToChannel(n, 0), null !== e.sourceList[t] && (e.sourceList[t].buffer = r, e.sourceList[t].connect(e.gainNode), e.sourceList[t].start(), e.sourceList[t].startState = !0)
+ } catch (t) {
+ return e.nextBuffer = null, -3
+ }
+ return e.nextBuffer = null, 0
+ },
+ decodeWholeSamples: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ if (e.sourceChannel = t, t < 0 || t >= e.sourceList.length) return -1;
+ if (null != e.sourceList[t] && null != e.sourceList[t] && e.sourceList[t] || (e.sourceList[t] = e.audioCtx.createBufferSource(), e.sourceList[t].onended = function() {}), 0 == e.sampleQueue.length) return -2;
+ for (var i = null, n = null, a = 0; a < e.sampleQueue.length; a++) {
+ n = e.sampleQueue.shift();
+ var s = null;
+ if (s = e.options.appendType == r.APPEND_TYPE_STREAM ? n : n.data, null == i) i = new Uint8Array(s);
+ else {
+ var o = new Uint8Array(s.length + i.length);
+ o.set(i, 0), o.set(s, i.length), i = o
+ }
+ if (e.sampleQueue.length <= 0) break;
+ n = null
+ }
+ var u = i;
+ if (null == u || u.length < 1) return e.sourceList[t].connect(e.gainNode), e.sourceList[t].start(), e.sourceList[t].stop(), 1;
+ var l = u.buffer;
+ try {
+ var h = e.audioCtx.createBuffer(1, l.byteLength, e.options.sampleRate);
+ h.copyToChannel(l, 0), e.sourceList[t].buffer = h, e.sourceList[t].connect(e.gainNode), e.sourceList[t].start(), e.sourceList[t].startState = !0
+ } catch (e) {
+ return -3
+ }
+ return 0
+ },
+ play: function() {
+ if (0 == e.startStatus) {
+ e.startStatus = !0; - 2 == (e.options.playMode == r.AUDIO_MODE_ONCE ? e.decodeWholeSamples(0) : e.swapSource(0, 1)) && e.pause()
+ }
+ },
+ pause: function() {
+ e.startStatus = !1;
+ for (var t = 0; t < e.sourceList.length; t++)
+ if (void 0 !== e.sourceList[t] && null !== e.sourceList[t]) {
+ e.sourceList[t], e.gainNode;
+ try {
+ void 0 !== e.sourceList[t].buffer && null !== e.sourceList[t].buffer && (e.sourceList[t].stop(), e.sourceList[t].disconnect(e.gainNode)), e.sourceList[t] = null
+ } catch (e) {
+ console.error("audio pause error ", e)
+ }
+ }
+ },
+ stop: function() {
+ e.pause(), e.cleanQueue(), e.nextBuffer = null, e.sourceChannel = -1
+ },
+ cleanQueue: function() {
+ e.sampleQueue.length = 0;
+ for (var t = 0; t < e.sourceList.length; t++) try {
+ void 0 !== e.sourceList[t].buffer && null !== e.sourceList[t].buffer && (e.sourceList[t].stop(), e.sourceList[t].disconnect(e.gainNode)), e.sourceList[t] = null
+ } catch (e) {}
+ }
+ };
+ return e.sourceList.push(e.audioCtx.createBufferSource()), e.sourceList.push(e.audioCtx.createBufferSource()), e.sourceList[0].onended = function() {
+ e.swapSource(0, 1)
+ }, e.sourceList[1].onended = function() {
+ e.swapSource(1, 0)
+ }, e.gainNode = e.audioCtx.createGain(), e.gainNode.gain.value = e.voice, e.gainNode.connect(e.audioCtx.destination), e.options, e.runNextBuffer(), e
+ }
+ }, {
+ "../consts": 52,
+ "./av-common": 56
+ }],
+ 54: [function(e, t, i) {
+ "use strict";
+ var n = window.AudioContext || window.webkitAudioContext,
+ r = e("../consts"),
+ a = e("./av-common");
+ t.exports = function(e) {
+ var t = {
+ options: {
+ sampleRate: e.sampleRate || r.DEFAULT_SAMPLERATE,
+ appendType: e.appendType || r.APPEND_TYPE_STREAM,
+ playMode: e.playMode || r.AUDIO_MODE_SWAP
+ },
+ sourceChannel: -1,
+ audioCtx: new n({
+ latencyHint: "interactive",
+ sampleRate: e.sampleRate
+ }),
+ gainNode: null,
+ sourceList: [],
+ startStatus: !1,
+ sampleQueue: [],
+ nextBuffer: null,
+ playTimestamp: 0,
+ playStartTime: 0,
+ durationMs: -1,
+ isLIVE: !1,
+ voice: 1,
+ onLoadCache: null,
+ resetStartParam: function() {
+ t.playTimestamp = 0, t.playStartTime = 0
+ },
+ setOnLoadCache: function(e) {
+ t.onLoadCache = e
+ },
+ setDurationMs: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ t.durationMs = e
+ },
+ setVoice: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ t.voice = e, t.gainNode.gain.value = e
+ },
+ getAlignVPTS: function() {
+ return t.playTimestamp + (a.GetMsTime() - t.playStartTime) / 1e3
+ },
+ swapSource: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ if (0 == t.startStatus) return null;
+ if (e < 0 || e >= t.sourceList.length) return null;
+ if (i < 0 || i >= t.sourceList.length) return null;
+ try {
+ t.sourceChannel === e && null !== t.sourceList[e] && (t.sourceList[e].disconnect(t.gainNode), t.sourceList[e] = null)
+ } catch (t) {
+ console.error("[DEFINE ERROR] audioModule disconnect source Index:" + e + " error happened!", t)
+ }
+ t.sourceChannel = i;
+ var n = t.decodeSample(i, e); - 2 == n && t.isLIVE && (t.getAlignVPTS() >= t.durationMs / 1e3 - .04 ? t.pause() : null !== t.onLoadCache && t.onLoadCache())
+ },
+ addSample: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
+ return !(null == e || !e || null == e) && (0 == t.sampleQueue.length && (t.seekPos = e.pts), t.sampleQueue.push(e), !0)
+ },
+ runNextBuffer: function() {
+ window.setInterval((function() {
+ if (!(null != t.nextBuffer || t.sampleQueue.length < r.DEFAULT_CONSU_SAMPLE_LEN)) {
+ t.nextBuffer = {
+ data: null,
+ pts: -1
+ };
+ for (var e = null, i = 0; i < r.DEFAULT_CONSU_SAMPLE_LEN; i++) {
+ e = t.sampleQueue.shift();
+ var n = null;
+ if (n = t.options.appendType == r.APPEND_TYPE_STREAM ? e : e.data, t.nextBuffer.pts < 0 && (t.nextBuffer.pts = e.pts), null == t.nextBuffer.data) t.nextBuffer.data = new Uint8Array(n);
+ else {
+ var a = new Uint8Array(n.length + t.nextBuffer.data.length);
+ a.set(t.nextBuffer.data, 0), a.set(n, t.nextBuffer.data.length), t.nextBuffer.data = a
+ }
+ if (t.sampleQueue.length <= 0) break;
+ e = null
+ }
+ }
+ }), 10)
+ },
+ decodeSample: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ if (e < 0 || e >= t.sourceList.length) return -1;
+ if (null != t.sourceList[e] && null != t.sourceList[e] && t.sourceList[e] || (t.sourceList[e] = t.audioCtx.createBufferSource(), t.sourceList[e].onended = function() {
+ t.swapSource(e, i)
+ }), 0 == t.sampleQueue.length) return t.isLIVE ? (t.sourceList[e].connect(t.gainNode), t.sourceList[e].start(), t.sourceList[e].onended = function() {
+ t.swapSource(e, i)
+ }, t.sourceList[e].stop(), 0) : -2;
+ if (t.sourceList[e].buffer) return t.swapSource(e, i), 0;
+ if (null == t.nextBuffer || t.nextBuffer.data.length < 1) return t.sourceList[e].connect(t.gainNode), t.sourceList[e].start(), t.sourceList[e].startState = !0, t.sourceList[e].stop(), 1;
+ var n = t.nextBuffer.data.buffer;
+ t.playTimestamp = t.nextBuffer.pts, t.playStartTime = a.GetMsTime();
+ try {
+ t.audioCtx.decodeAudioData(n, (function(i) {
+ null !== t.sourceList[e] && (t.sourceList[e].buffer = i, t.sourceList[e].connect(t.gainNode), t.sourceList[e].start(), t.sourceList[e].startState = !0)
+ }), (function(e) {}))
+ } catch (e) {
+ return t.nextBuffer = null, -3
+ }
+ return t.nextBuffer = null, 0
+ },
+ decodeWholeSamples: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ if (t.sourceChannel = e, e < 0 || e >= t.sourceList.length) return -1;
+ if (null != t.sourceList[e] && null != t.sourceList[e] && t.sourceList[e] || (t.sourceList[e] = t.audioCtx.createBufferSource(), t.sourceList[e].onended = function() {}), 0 == t.sampleQueue.length) return -2;
+ for (var i = null, n = null, a = 0; a < t.sampleQueue.length; a++) {
+ n = t.sampleQueue.shift();
+ var s = null;
+ if (s = t.options.appendType == r.APPEND_TYPE_STREAM ? n : n.data, null == i) i = new Uint8Array(s);
+ else {
+ var o = new Uint8Array(s.length + i.length);
+ o.set(i, 0), o.set(s, i.length), i = o
+ }
+ if (t.sampleQueue.length <= 0) break;
+ n = null
+ }
+ var u = i;
+ if (null == u || u.length < 1) return t.sourceList[e].connect(t.gainNode), t.sourceList[e].start(), t.sourceList[e].stop(), 1;
+ var l = u.buffer;
+ try {
+ t.audioCtx.decodeAudioData(l, (function(i) {
+ t.sourceList[e].state, t.sourceList[e].buffer = i, t.sourceList[e].connect(t.gainNode), t.sourceList[e].start(), t.sourceList[e].startState = !0, t.sourceList[e].state
+ }), (function(e) {
+ e.err
+ }))
+ } catch (e) {
+ return -3
+ }
+ return 0
+ },
+ play: function() {
+ if (0 == t.startStatus) {
+ t.startStatus = !0; - 2 == (t.options.playMode == r.AUDIO_MODE_ONCE ? t.decodeWholeSamples(0) : t.swapSource(0, 1)) && t.pause()
+ }
+ },
+ pause: function() {
+ t.startStatus = !1;
+ for (var e = 0; e < t.sourceList.length; e++)
+ if (void 0 !== t.sourceList[e] && null !== t.sourceList[e]) {
+ t.sourceList[e], t.gainNode;
+ try {
+ void 0 !== t.sourceList[e].buffer && null !== t.sourceList[e].buffer && (t.sourceList[e].stop(), t.sourceList[e].disconnect(t.gainNode)), t.sourceList[e] = null
+ } catch (e) {
+ console.error("audio pause error ", e)
+ }
+ }
+ },
+ stop: function() {
+ t.pause(), t.cleanQueue(), t.nextBuffer = null, t.sourceChannel = -1
+ },
+ cleanQueue: function() {
+ t.sampleQueue.length = 0;
+ for (var e = 0; e < t.sourceList.length; e++) try {
+ void 0 !== t.sourceList[e].buffer && null !== t.sourceList[e].buffer && (t.sourceList[e].stop(), t.sourceList[e].disconnect(t.gainNode)), t.sourceList[e] = null
+ } catch (e) {}
+ }
+ };
+ return t.sourceList.push(t.audioCtx.createBufferSource()), t.sourceList.push(t.audioCtx.createBufferSource()), t.sourceList[0].onended = function() {
+ t.swapSource(0, 1)
+ }, t.sourceList[1].onended = function() {
+ t.swapSource(1, 0)
+ }, t.gainNode = t.audioCtx.createGain(), t.gainNode.gain.value = t.voice, t.gainNode.connect(t.audioCtx.destination), t.options, t.runNextBuffer(), t
+ }
+ }, {
+ "../consts": 52,
+ "./av-common": 56
+ }],
+ 55: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = window.AudioContext || window.webkitAudioContext,
+ a = (e("../consts"), e("./av-common")),
+ s = function() {
+ function e() {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this._sample_rate = 44100, this._seg_dur = .1, this._channels = 1, this._swapStartPlay = !0, this.playStartTime = -1, this.playTimestamp = 0, this._now_seg_dur = -1, this._push_start_idx = 0, this._playInterval = null, this._pcm_array_buf = null, this._pcm_array_frame = [], this._once_pop_len = parseInt(this._sample_rate * this._seg_dur), this._active_node = null, this._ctx = new r, this._gain = this._ctx.createGain(), this._gain.gain.value = 1, this._gain.connect(this._ctx.destination)
+ }
+ var t, i, s;
+ return t = e, (i = [{
+ key: "setVoice",
+ value: function(e) {
+ this._gain.gain.value = e
+ }
+ }, {
+ key: "pushBufferFrame",
+ value: function(e, t) {}
+ }, {
+ key: "pushBuffer",
+ value: function(e) {
+ var t = e.buffer,
+ i = null,
+ n = t.byteLength % 4;
+ if (0 !== n) {
+ var r = new Uint8Array(t.byteLength + n);
+ r.set(new Uint8Array(t), 0), i = new Float32Array(r.buffer)
+ } else i = new Float32Array(t);
+ var a = null;
+ if (this._channels >= 2) {
+ var s = i.length / 2;
+ a = new Float32Array(s);
+ for (var o = 0, u = 0; u < i.length; u += 2) a[o] = i[u], o++
+ } else a = new Float32Array(i);
+ if (null === this._pcm_array_buf) this._pcm_array_buf = new Float32Array(a);
+ else {
+ var l = new Float32Array(this._pcm_array_buf.length + a.length);
+ l.set(this._pcm_array_buf, 0), l.set(a, this._pcm_array_buf.length), this._pcm_array_buf = l
+ }
+ this._pcm_array_buf.length
+ }
+ }, {
+ key: "readingLoopWithF32",
+ value: function() {
+ if (!(null !== this._pcm_array_buf && this._pcm_array_buf.length > this._push_start_idx)) return -1;
+ this.playStartTime < 0 && (this.playStartTime = a.GetMsTime(), this.playTimestamp = a.GetMsTime()), this._swapStartPlay = !1;
+ var e = this._push_start_idx + this._once_pop_len;
+ e > this._pcm_array_buf.length && (e = this._pcm_array_buf.length);
+ var t = this._pcm_array_buf.slice(this._push_start_idx, e);
+ this._push_start_idx += t.length, this._now_seg_dur = 1 * t.length / this._sample_rate * 1e3, t.length, this._sample_rate, this._now_seg_dur;
+ var i = this._ctx.createBuffer(1, t.length, this._sample_rate);
+ return t.length, new Date, i.copyToChannel(t, 0), this._active_node = this._ctx.createBufferSource(), this._active_node.buffer = i, this._active_node.connect(this._gain), this.playStartTime = a.GetMsTime(), this._active_node.start(0), this.playTimestamp += this._now_seg_dur, 0
+ }
+ }, {
+ key: "getAlignVPTS",
+ value: function() {
+ return this.playTimestamp
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ null !== this._playInterval && (window.clearInterval(this._playInterval), this._playInterval = null)
+ }
+ }, {
+ key: "play",
+ value: function() {
+ var e = this;
+ this._playInterval = window.setInterval((function() {
+ e.readingLoopWithF32()
+ }), 10)
+ }
+ }]) && n(t.prototype, i), s && n(t, s), e
+ }();
+ i.AudioPcmPlayer = s
+ }, {
+ "../consts": 52,
+ "./av-common": 56
+ }],
+ 56: [function(e, t, i) {
+ "use strict";
+ var n = e("../consts"),
+ r = [{
+ format: "mp4",
+ value: "mp4",
+ core: n.PLAYER_CORE_TYPE_CNATIVE
+ }, {
+ format: "mov",
+ value: "mp4",
+ core: n.PLAYER_CORE_TYPE_CNATIVE
+ }, {
+ format: "mkv",
+ value: "mp4",
+ core: n.PLAYER_CORE_TYPE_CNATIVE
+ }, {
+ format: "flv",
+ value: "flv",
+ core: n.PLAYER_CORE_TYPE_CNATIVE
+ }, {
+ format: "m3u8",
+ value: "hls",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "m3u",
+ value: "hls",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "ts",
+ value: "ts",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "ps",
+ value: "ts",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "mpegts",
+ value: "ts",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "hevc",
+ value: "raw265",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "h265",
+ value: "raw265",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }, {
+ format: "265",
+ value: "raw265",
+ core: n.PLAYER_CORE_TYPE_DEFAULT
+ }],
+ a = [{
+ format: n.URI_PROTOCOL_HTTP,
+ value: n.URI_PROTOCOL_HTTP_DESC
+ }, {
+ format: n.URI_PROTOCOL_WEBSOCKET,
+ value: n.URI_PROTOCOL_WEBSOCKET_DESC
+ }];
+ t.exports = {
+ frameDataAlignCrop: function(e, t, i, n, r, a, s, o) {
+ if (0 == e - n) return [a, s, o];
+ for (var u = n * r, l = u / 4, h = new Uint8Array(u), d = new Uint8Array(l), c = new Uint8Array(l), f = n, p = n / 2, m = 0; m < r; m++) h.set(a.subarray(m * e, f), m * r);
+ for (var _ = 0; _ < r / 2; _++) d.set(s.subarray(_ * t, p), _ * r / 2);
+ for (var g = 0; g < r / 2; g++) c.set(o.subarray(g * i, p), g * r / 2);
+ return [h, d, c]
+ },
+ GetUriFormat: function(e) {
+ if (null != e)
+ for (var t = 0; t < r.length; t++) {
+ var i = r[t],
+ n = "." + i.format;
+ if (e.search(n) >= 0) return i.value
+ }
+ return r[0].value
+ },
+ GetFormatPlayCore: function(e) {
+ if (null != e)
+ for (var t = 0; t < r.length; t++) {
+ var i = r[t];
+ if (i.value === e) return i.core
+ }
+ return r[0].core
+ },
+ GetUriProtocol: function(e) {
+ if (null != e)
+ for (var t = 0; t < a.length; t++) {
+ var i = a[t],
+ n = i.format + "[s]{0,}://";
+ if (e.search(n) >= 0) return i.value
+ }
+ return a[0].value
+ },
+ GetMsTime: function() {
+ return (new Date).getTime()
+ },
+ GetScriptPath: function(e) {
+ var t = e.toString(),
+ i = t.match(/^\s*function\s*\(\s*\)\s*\{(([\s\S](?!\}$))*[\s\S])/),
+ n = [i[1]];
+ return window.URL.createObjectURL(new Blob(n, {
+ type: "text/javascript"
+ }))
+ },
+ BrowserJudge: function() {
+ var e = window.document,
+ t = window.navigator.userAgent.toLowerCase(),
+ i = e.documentMode,
+ n = window.chrome || !1,
+ r = {
+ agent: t,
+ isIE: /msie/.test(t),
+ isGecko: t.indexOf("gecko") > 0 && t.indexOf("like gecko") < 0,
+ isWebkit: t.indexOf("webkit") > 0,
+ isStrict: "CSS1Compat" === e.compatMode,
+ supportSubTitle: function() {
+ return "track" in e.createElement("track")
+ },
+ supportScope: function() {
+ return "scoped" in e.createElement("style")
+ },
+ ieVersion: function() {
+ try {
+ return t.match(/msie ([\d.]+)/)[1] || 0
+ } catch (e) {
+ return i
+ }
+ },
+ operaVersion: function() {
+ try {
+ if (window.opera) return t.match(/opera.([\d.]+)/)[1];
+ if (t.indexOf("opr") > 0) return t.match(/opr\/([\d.]+)/)[1]
+ } catch (e) {
+ return 0
+ }
+ },
+ versionFilter: function() {
+ if (1 === arguments.length && "string" == typeof arguments[0]) {
+ var e = arguments[0],
+ t = e.indexOf(".");
+ if (t > 0) {
+ var i = e.indexOf(".", t + 1);
+ if (-1 !== i) return e.substr(0, i)
+ }
+ return e
+ }
+ return 1 === arguments.length ? arguments[0] : 0
+ }
+ };
+ try {
+ r.type = r.isIE ? "IE" : window.opera || t.indexOf("opr") > 0 ? "Opera" : t.indexOf("chrome") > 0 ? "Chrome" : t.indexOf("safari") > 0 || window.openDatabase ? "Safari" : t.indexOf("firefox") > 0 ? "Firefox" : "unknow", r.version = "IE" === r.type ? r.ieVersion() : "Firefox" === r.type ? t.match(/firefox\/([\d.]+)/)[1] : "Chrome" === r.type ? t.match(/chrome\/([\d.]+)/)[1] : "Opera" === r.type ? r.operaVersion() : "Safari" === r.type ? t.match(/version\/([\d.]+)/)[1] : "0", r.shell = function() {
+ if (t.indexOf("maxthon") > 0) return r.version = t.match(/maxthon\/([\d.]+)/)[1] || r.version, "傲游浏览器";
+ if (t.indexOf("qqbrowser") > 0) return r.version = t.match(/qqbrowser\/([\d.]+)/)[1] || r.version, "QQ浏览器";
+ if (t.indexOf("se 2.x") > 0) return "搜狗浏览器";
+ if (n && "Opera" !== r.type) {
+ var e = window.external,
+ i = window.clientInformation.languages;
+ if (e && "LiebaoGetVersion" in e) return "猎豹浏览器";
+ if (t.indexOf("bidubrowser") > 0) return r.version = t.match(/bidubrowser\/([\d.]+)/)[1] || t.match(/chrome\/([\d.]+)/)[1], "百度浏览器";
+ if (r.supportSubTitle() && void 0 === i) {
+ var a = Object.keys(n.webstore).length;
+ window;
+ return a > 1 ? "360极速浏览器" : "360安全浏览器"
+ }
+ return "Chrome"
+ }
+ return r.type
+ }, r.name = r.shell(), r.version = r.versionFilter(r.version)
+ } catch (e) {}
+ return [r.type, r.version]
+ },
+ ParseGetMediaURL: function(e) {
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "http";
+ if ("http" !== t && "ws" !== t && "wss" !== t && (e.indexOf("ws") >= 0 || e.indexOf("wss") >= 0) && (t = "ws"), "ws" === t || "wss" === t) return e;
+ var i = e;
+ if (e.indexOf(t) >= 0) i = e;
+ else if ("/" === e[0]) i = "/" === e[1] ? t + ":" + e : window.location.origin + e;
+ else if (":" === e[0]) i = t + e;
+ else {
+ var n = window.location.href.split("/");
+ i = window.location.href.replace(n[n.length - 1], e)
+ }
+ return i
+ },
+ IsSupport265Mse: function() {
+ return MediaSource.isTypeSupported('video/mp4;codecs=hvc1.1.1.L63.B0"')
+ }
+ }
+ }, {
+ "../consts": 52
+ }],
+ 57: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ e("../demuxer/bufferFrame"), e("../demuxer/buffer"), e("./cache"), e("./cacheYuv");
+ var r = e("../render-engine/webgl-420p"),
+ a = e("./av-common"),
+ s = (e("./audio-native-core"), e("./audio-core"), e("./audio-core-pcm")),
+ o = e("../consts"),
+ u = (e("../version"), function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e);
+ var i = this;
+ this.config = {
+ width: t.width || o.DEFAULT_WIDTH,
+ height: t.height || o.DEFAULT_HEIGHT,
+ fps: t.fps || o.DEFAULT_FPS,
+ sampleRate: t.sampleRate || o.DEFAULT_SAMPLERATE,
+ playerId: t.playerId || o.DEFAILT_WEBGL_PLAY_ID,
+ token: t.token || null,
+ probeSize: t.probeSize || 4096,
+ ignoreAudio: t.ignoreAudio || 0,
+ autoPlay: t.autoPlay || !1
+ }, this.config.probeSize, this.config.ignoreAudio, this.mediaInfo = {
+ noFPS: !1,
+ fps: o.DEFAULT_FPS,
+ width: this.config.width,
+ height: this.config.height,
+ sampleRate: this.config.sampleRate,
+ size: {
+ width: -1,
+ height: -1
+ },
+ audioNone: !1
+ }, this.duration = -1, this.vCodecID = o.V_CODEC_NAME_HEVC, this.corePtr = null, this.AVGetInterval = null, this.readyShowDone = !1, this.readyKeyFrame = !1, this.cache_status = !1, this.download_length = 0, this.AVGLObj = null, this.canvasBox = document.querySelector("#" + this.config.playerId), this.canvasBox.style.overflow = "hidden", this.CanvasObj = null, this.CanvasObj = document.createElement("canvas"), this.CanvasObj.style.width = this.canvasBox.clientWidth + "px", this.CanvasObj.style.height = this.canvasBox.clientHeight + "px", this.CanvasObj.style.top = "0px", this.CanvasObj.style.left = "0px", this.canvasBox.appendChild(this.CanvasObj), this.audioWAudio = null, this.audioVoice = 1, this.muted = this.config.autoPlay, !0 === this.config.autoPlay && this.config.ignoreAudio < 1 && (window.onclick = document.body.onclick = function(e) {
+ i.muted = !1, i._reinitAudioModule(i.mediaInfo.sampleRate), !0 === i.isPlayingState() && (i.pause(), i.play()), window.onclick = document.body.onclick = null
+ }), this.frameTime = 1e3 / this.config.fps, this.NaluBuf = [], this.YuvBuf = [], this.getPackageTimeMS = 0, this.workerFetch = null, this.playInterval = null, this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null, this.totalLen = 0, this.pushPkg = 0, this.showScreen = !1, this.onProbeFinish = null, this.onLoadCache = null, this.onLoadCacheFinshed = null, this.onRender = null, this.onReadyShowDone = null, this.onError = null, this.onPlayState = null, this.corePtr = Module.cwrap("AVSniffHttpG711Init", "number", ["string", "string"])(this.config.token, "0.0.0"), this.corePtr
+ }
+ var t, i, u;
+ return t = e, (i = [{
+ key: "_workerFetch_onmessage",
+ value: function(e, t) {
+ var i = e.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "startok":
+ t.getPackageTimeMS = a.GetMsTime(), void 0 !== t.AVGetInterval && null !== t.AVGetInterval || (t.AVGetInterval = window.setInterval((function() {
+ Module.cwrap("getG711BufferLengthApi", "number", ["number"])(t.corePtr) <= t.config.probeSize && t.getPackageTimeMS > 0 && a.GetMsTime() - t.getPackageTimeMS >= o.FETCH_HTTP_FLV_TIMEOUT_MS && (t.getPackageTimeMS = a.GetMsTime(), t.workerFetch.postMessage({
+ cmd: "retry",
+ data: null,
+ msg: "retry"
+ }))
+ }), 5));
+ break;
+ case "fetch-chunk":
+ var n = i.data;
+ t.download_length += n.length, setTimeout((function() {
+ var e = Module._malloc(n.length);
+ Module.HEAP8.set(n, e), Module.cwrap("pushSniffG711FlvData", "number", ["number", "number", "number", "number"])(t.corePtr, e, n.length, t.config.probeSize), Module._free(e), e = null
+ }), 0), t.totalLen += n.length, n.length > 0 && (t.getPackageTimeMS = a.GetMsTime()), t.pushPkg++;
+ break;
+ case "close":
+ t.AVGetInterval && clearInterval(t.AVGetInterval), t.AVGetInterval = null;
+ case "fetch-fin":
+ break;
+ case "fetch-error":
+ t.onError && t.onError(i.data)
+ }
+ }
+ }, {
+ key: "_checkDisplaySize",
+ value: function(e, t, i) {
+ var n = t - e,
+ r = this.config.width + Math.ceil(n / 2),
+ a = t / this.config.width > i / this.config.height,
+ s = (r / t).toFixed(2),
+ o = (this.config.height / i).toFixed(2),
+ u = a ? s : o,
+ l = this.config.fixed,
+ h = l ? r : parseInt(t * u),
+ d = l ? this.config.height : parseInt(i * u);
+ if (this.CanvasObj.offsetWidth != h || this.CanvasObj.offsetHeight != d) {
+ var c = parseInt((this.canvasBox.offsetHeight - d) / 2),
+ f = parseInt((this.canvasBox.offsetWidth - h) / 2);
+ c = c < 0 ? 0 : c, f = f < 0 ? 0 : f, this.CanvasObj.style.marginTop = c + "px", this.CanvasObj.style.marginLeft = f + "px", this.CanvasObj.style.width = h + "px", this.CanvasObj.style.height = d + "px"
+ }
+ return this.isCheckDisplay = !0, [h, d]
+ }
+ }, {
+ key: "_ptsFixed2",
+ value: function(e) {
+ return Math.ceil(100 * e) / 100
+ }
+ }, {
+ key: "_reinitAudioModule",
+ value: function() {
+ void 0 !== this.audioWAudio && null !== this.audioWAudio && (this.audioWAudio.stop(), this.audioWAudio = null), this.audioWAudio = s()
+ }
+ }, {
+ key: "_callbackProbe",
+ value: function(e, t, i, n, r, a, s, u, l) {
+ for (var h = Module.HEAPU8.subarray(l, l + 10), d = 0; d < h.length; d++) String.fromCharCode(h[d]);
+ var c = n;
+ n > 100 && (c = o.DEFAULT_FPS, this.mediaInfo.noFPS = !0), this.vCodecID = u, this.config.fps = c, this.mediaInfo.fps = c, this.mediaInfo.size.width = t, this.mediaInfo.size.height = i, this.frameTime = Math.floor(1e3 / (this.mediaInfo.fps + 2)), this.CanvasObj.width == t && this.CanvasObj.height == i || (this.CanvasObj.width = t, this.CanvasObj.height = i, this.isCheckDisplay) || this._checkDisplaySize(t, t, i), r >= 0 && !1 === this.mediaInfo.noFPS ? (this.config.sampleRate = a, this.mediaInfo.sampleRate = a, !1 === this.muted && this._reinitAudioModule(this.mediaInfo.sampleRate)) : this.mediaInfo.audioNone = !0, this.onProbeFinish && this.onProbeFinish()
+ }
+ }, {
+ key: "_callbackYUV",
+ value: function(e, t, i, n, r, a, s, o, u, l) {
+ var h = this,
+ d = Module.HEAPU8.subarray(e, e + n * o),
+ c = new Uint8Array(d),
+ f = Module.HEAPU8.subarray(t, t + r * o / 2),
+ p = new Uint8Array(f),
+ m = Module.HEAPU8.subarray(i, i + a * o / 2),
+ _ = {
+ bufY: c,
+ bufU: p,
+ bufV: new Uint8Array(m),
+ line_y: n,
+ h: o,
+ pts: u
+ };
+ this.YuvBuf.push(_), this.checkCacheState(), Module._free(d), d = null, Module._free(f), f = null, Module._free(m), m = null, !1 === this.readyShowDone && !0 === this.playYUV() && (this.readyShowDone = !0, this.onReadyShowDone && this.onReadyShowDone(), this.audioWAudio || !0 !== this.config.autoPlay || (this.play(), setTimeout((function() {
+ h.isPlayingState()
+ }), 3e3)))
+ }
+ }, {
+ key: "_callbackNALU",
+ value: function(e, t, i, n, r, a, s) {
+ if (!1 === this.readyKeyFrame) {
+ if (i <= 0) return;
+ this.readyKeyFrame = !0
+ }
+ var o = Module.HEAPU8.subarray(e, e + t),
+ u = new Uint8Array(o);
+ this.NaluBuf.push({
+ bufData: u,
+ len: t,
+ isKey: i,
+ w: n,
+ h: r,
+ pts: 1e3 * a,
+ dts: 1e3 * s
+ }), Module._free(o), o = null
+ }
+ }, {
+ key: "_callbackPCM",
+ value: function(e, t, i, n) {
+ var r = Module.HEAPU8.subarray(e, e + t),
+ a = new Uint8Array(r).buffer,
+ s = this._ptsFixed2(i),
+ o = null,
+ u = a.byteLength % 4;
+ if (0 !== u) {
+ var l = new Uint8Array(a.byteLength + u);
+ l.set(new Uint8Array(a), 0), o = new Float32Array(l.buffer)
+ } else o = new Float32Array(a);
+ var h = {
+ pts: s,
+ data: o
+ };
+ this.audioWAudio.addSample(h), this.checkCacheState()
+ }
+ }, {
+ key: "_decode",
+ value: function() {
+ var e = this;
+ setTimeout((function() {
+ null !== e.workerFetch && (Module.cwrap("decodeG711Frame", "number", ["number"])(e.corePtr), e._decode())
+ }), 1)
+ }
+ }, {
+ key: "setScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ this.showScreen = e
+ }
+ }, {
+ key: "checkCacheState",
+ value: function() {
+ var e = this.YuvBuf.length >= 25 && (!0 === this.mediaInfo.audioNone || this.audioWAudio && this.audioWAudio.sampleQueue.length >= 50);
+ return !1 === this.cache_status && e && (this.playInterval && this.audioWAudio && this.audioWAudio.play(), this.onLoadCacheFinshed && this.onLoadCacheFinshed(), this.cache_status = !0), e
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.audioVoice = e, this.audioWAudio && this.audioWAudio.setVoice(e)
+ }
+ }, {
+ key: "_removeBindFuncPtr",
+ value: function() {
+ null !== this._ptr_probeCallback && Module.removeFunction(this._ptr_probeCallback), null !== this._ptr_frameCallback && Module.removeFunction(this._ptr_frameCallback), null !== this._ptr_naluCallback && Module.removeFunction(this._ptr_naluCallback), null !== this._ptr_sampleCallback && Module.removeFunction(this._ptr_sampleCallback), null !== this._ptr_aacCallback && Module.removeFunction(this._ptr_aacCallback), this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null
+ }
+ }, {
+ key: "release",
+ value: function() {
+ return this.pause(), this.NaluBuf.length = 0, this.YuvBuf.length = 0, void 0 !== this.workerFetch && null !== this.workerFetch && this.workerFetch.postMessage({
+ cmd: "stop",
+ data: "stop",
+ msg: "stop"
+ }), this.workerFetch = null, this.AVGetInterval && clearInterval(this.AVGetInterval), this.AVGetInterval = null, this._removeBindFuncPtr(), void 0 !== this.corePtr && null !== this.corePtr && Module.cwrap("releaseG711", "number", ["number"])(this.corePtr), this.playInterval && clearInterval(this.playInterval), this.playInterval = null, this.audioWAudio && this.audioWAudio.stop(), this.audioWAudio = null, void 0 !== this.AVGLObj && null !== this.AVGLObj && (r.releaseContext(this.AVGLObj), this.AVGLObj = null), this.CanvasObj && this.CanvasObj.remove(), this.CanvasObj = null, window.onclick = document.body.onclick = null, delete window.g_players[this.corePtr], 0
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return null !== this.playInterval && void 0 !== this.playInterval
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.audioWAudio && this.audioWAudio.pause(), this.playInterval && clearInterval(this.playInterval), this.playInterval = null, this.onPlayState && this.onPlayState(this.isPlayingState())
+ }
+ }, {
+ key: "playYUV",
+ value: function() {
+ if (this.YuvBuf.length > 0) {
+ var e = this.YuvBuf.shift();
+ return e.pts, this.onRender && this.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), r.renderFrame(this.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h), !0
+ }
+ return !1
+ }
+ }, {
+ key: "play",
+ value: function() {
+ var e = this;
+ if (!1 === this.checkCacheState()) return this.onLoadCache && this.onLoadCache(), setTimeout((function() {
+ e.play()
+ }), 100), !1;
+ var t = 1 * e.frameTime;
+ if (void 0 === this.playInterval || null === this.playInterval) {
+ var i = 0,
+ n = 0,
+ s = 0;
+ !1 === this.mediaInfo.audioNone && this.audioWAudio && !1 === this.mediaInfo.noFPS ? (this.playInterval = setInterval((function() {
+ if (n = a.GetMsTime(), e.cache_status) {
+ if (n - i >= e.frameTime - s) {
+ var o = e.YuvBuf.shift();
+ if (null != o && null !== o) {
+ o.pts;
+ var u = 0;
+ null !== e.audioWAudio && void 0 !== e.audioWAudio ? (u = 1e3 * (o.pts - e.audioWAudio.getAlignVPTS()), s = u < 0 && -1 * u <= t || u > 0 && u <= t || 0 === u || u > 0 && u > t ? a.GetMsTime() - n + 1 : e.frameTime) : s = a.GetMsTime() - n + 1, e.showScreen && e.onRender && e.onRender(o.line_y, o.h, o.bufY, o.bufU, o.bufV), o.pts, r.renderFrame(e.AVGLObj, o.bufY, o.bufU, o.bufV, o.line_y, o.h)
+ }
+ e.YuvBuf.length <= 0 && (e.cache_status = !1, e.onLoadCache && e.onLoadCache(), e.audioWAudio && e.audioWAudio.pause()), i = n
+ }
+ } else s = e.frameTime
+ }), 1), this.audioWAudio && this.audioWAudio.play()) : this.playInterval = setInterval((function() {
+ var t = e.YuvBuf.shift();
+ null != t && null !== t && (t.pts, e.showScreen && e.onRender && e.onRender(t.line_y, t.h, t.bufY, t.bufU, t.bufV), r.renderFrame(e.AVGLObj, t.bufY, t.bufU, t.bufV, t.line_y, t.h)), e.YuvBuf.length <= 0 && (e.cache_status = !1)
+ }), e.frameTime)
+ }
+ this.onPlayState && this.onPlayState(this.isPlayingState())
+ }
+ }, {
+ key: "start",
+ value: function(e) {
+ var t = this;
+ this.workerFetch = new Worker(a.GetScriptPath((function() {
+ var e = null,
+ t = new AbortController,
+ i = t.signal,
+ n = (self, function(e) {
+ var t = !1;
+ t || (t = !0, fetch(e, {
+ signal: i
+ }).then((function(e) {
+ return function e(t) {
+ return t.read().then((function(i) {
+ if (!i.done) {
+ var n = i.value;
+ return self.postMessage({
+ cmd: "fetch-chunk",
+ data: n,
+ msg: "fetch-chunk"
+ }), e(t)
+ }
+ self.postMessage({
+ cmd: "fetch-fin",
+ data: null,
+ msg: "fetch-fin"
+ })
+ }))
+ }(e.body.getReader())
+ })).catch((function(e) {
+ if (!e.toString().includes("user aborted")) {
+ var t = " httplive request error:" + e + " start to retry";
+ console.error(t), self.postMessage({
+ cmd: "fetch-error",
+ data: t,
+ msg: "fetch-error"
+ })
+ }
+ })))
+ });
+ self.onmessage = function(r) {
+ var a = r.data;
+ switch (void 0 === a.cmd || null === a.cmd ? "" : a.cmd) {
+ case "start":
+ e = a.data, n(e), self.postMessage({
+ cmd: "startok",
+ data: "WORKER STARTED",
+ msg: "startok"
+ });
+ break;
+ case "stop":
+ t.abort(), self.close(), self.postMessage({
+ cmd: "close",
+ data: "close",
+ msg: "close"
+ });
+ break;
+ case "retry":
+ t.abort(), t = null, i = null, t = new AbortController, i = t.signal, setTimeout((function() {
+ n(e)
+ }), 3e3)
+ }
+ }
+ }))), this.workerFetch.onmessage = function(e) {
+ t._workerFetch_onmessage(e, t)
+ }, this.workerFetch, this._ptr_probeCallback = Module.addFunction(this._callbackProbe.bind(this)), this._ptr_yuvCallback = Module.addFunction(this._callbackYUV.bind(this)), this._ptr_sampleCallback = Module.addFunction(this._callbackPCM.bind(this)), Module.cwrap("initializeSniffG711Module", "number", ["number", "number", "number", "number", "number", "number"])(this.corePtr, this._ptr_probeCallback, this._ptr_yuvCallback, this._ptr_sampleCallback, 0, 1), this.AVGLObj = r.setupCanvas(this.CanvasObj, {
+ preserveDrawingBuffer: !1
+ }), this.workerFetch.postMessage({
+ cmd: "start",
+ data: e,
+ msg: "start"
+ }), 0 === o.H265WEBJS_COMPILE_MULTI_THREAD_SHAREDBUFFER && this._decode()
+ }
+ }]) && n(t.prototype, i), u && n(t, u), e
+ }());
+ i.CHttpG711Core = u
+ }, {
+ "../consts": 52,
+ "../demuxer/buffer": 66,
+ "../demuxer/bufferFrame": 67,
+ "../render-engine/webgl-420p": 81,
+ "../version": 84,
+ "./audio-core": 54,
+ "./audio-core-pcm": 53,
+ "./audio-native-core": 55,
+ "./av-common": 56,
+ "./cache": 61,
+ "./cacheYuv": 62
+ }],
+ 58: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ e("../demuxer/bufferFrame"), e("../demuxer/buffer"), e("./cache"), e("./cacheYuv");
+ var r = e("../render-engine/webgl-420p"),
+ a = e("./av-common"),
+ s = (e("./audio-native-core"), e("./audio-core")),
+ o = e("../consts"),
+ u = (e("../version"), function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e);
+ var i = this;
+ this.config = {
+ width: t.width || o.DEFAULT_WIDTH,
+ height: t.height || o.DEFAULT_HEIGHT,
+ fps: t.fps || o.DEFAULT_FPS,
+ sampleRate: t.sampleRate || o.DEFAULT_SAMPLERATE,
+ playerId: t.playerId || o.DEFAILT_WEBGL_PLAY_ID,
+ token: t.token || null,
+ probeSize: t.probeSize || 4096,
+ ignoreAudio: t.ignoreAudio || 0,
+ autoPlay: t.autoPlay || !1
+ }, this.config, this.config.probeSize, this.config.ignoreAudio, this.mediaInfo = {
+ noFPS: !1,
+ fps: o.DEFAULT_FPS,
+ width: this.config.width,
+ height: this.config.height,
+ sampleRate: this.config.sampleRate,
+ size: {
+ width: -1,
+ height: -1
+ },
+ audioNone: !1
+ }, this.duration = -1, this.vCodecID = o.V_CODEC_NAME_HEVC, this.corePtr = null, this.AVGetInterval = null, this.AVDecodeInterval = null, this.decVFrameInterval = null, this.readyShowDone = !1, this.readyKeyFrame = !1, this.cache_status = !1, this.download_length = 0, this.AVGLObj = null, this.canvasBox = document.querySelector("#" + this.config.playerId), this.canvasBox.style.overflow = "hidden", this.CanvasObj = null, this.CanvasObj = document.createElement("canvas"), this.CanvasObj.style.width = this.canvasBox.clientWidth + "px", this.CanvasObj.style.height = this.canvasBox.clientHeight + "px", this.CanvasObj.style.top = "0px", this.CanvasObj.style.left = "0px", this.canvasBox.appendChild(this.CanvasObj), this.audioWAudio = null, this.audioVoice = 1, this.isCacheV = o.CACHE_NO_LOADCACHE, this.muted = this.config.autoPlay, !0 === this.config.autoPlay && this.config.ignoreAudio < 1 && (window.onclick = document.body.onclick = function(e) {
+ i.muted = !1, i._reinitAudioModule(i.mediaInfo.sampleRate), !0 === i.isPlayingState() && (i.pause(), i.play()), window.onclick = document.body.onclick = null
+ }), this.frameTimeSec = 1 / this.config.fps, this.frameTime = 1e3 * this.frameTimeSec, this.NaluBuf = [], this.YuvBuf = [], this.getPackageTimeMS = 0, this.workerFetch = null, this.playInterval = null, this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null, this.totalLen = 0, this.pushPkg = 0, this.showScreen = !1, this.onProbeFinish = null, this.onLoadCache = null, this.onLoadCacheFinshed = null, this.onRender = null, this.onReadyShowDone = null, this.onError = null, this.onPlayState = null, this.corePtr = Module.cwrap("AVSniffHttpFlvInit", "number", ["string", "string"])(this.config.token, "0.0.0"), this.corePtr
+ }
+ var t, i, u;
+ return t = e, (i = [{
+ key: "_workerFetch_onmessage",
+ value: function(e, t) {
+ var i = e.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "startok":
+ t.getPackageTimeMS = a.GetMsTime(), void 0 !== t.AVGetInterval && null !== t.AVGetInterval || (t.AVGetInterval = window.setInterval((function() {
+ Module.cwrap("getBufferLengthApi", "number", ["number"])(t.corePtr) > t.config.probeSize ? (Module.cwrap("getSniffHttpFlvPkg", "number", ["number"])(t.corePtr), t.pushPkg -= 1) : t.getPackageTimeMS > 0 && a.GetMsTime() - t.getPackageTimeMS >= o.FETCH_HTTP_FLV_TIMEOUT_MS && (t.getPackageTimeMS = a.GetMsTime(), t.workerFetch.postMessage({
+ cmd: "retry",
+ data: null,
+ msg: "retry"
+ }))
+ }), 5));
+ break;
+ case "fetch-chunk":
+ var n = i.data;
+ t.download_length += n.length, setTimeout((function() {
+ var e = Module._malloc(n.length);
+ Module.HEAP8.set(n, e), Module.cwrap("pushSniffHttpFlvData", "number", ["number", "number", "number", "number"])(t.corePtr, e, n.length, t.config.probeSize), Module._free(e), e = null
+ }), 0), t.totalLen += n.length, n.length > 0 && (t.getPackageTimeMS = a.GetMsTime()), t.pushPkg++;
+ break;
+ case "close":
+ t.AVGetInterval && clearInterval(t.AVGetInterval), t.AVGetInterval = null;
+ break;
+ case "fetch-fin":
+ break;
+ case "fetch-error":
+ t.onError && t.onError(i.data)
+ }
+ }
+ }, {
+ key: "_checkDisplaySize",
+ value: function(e, t, i) {
+ var n = t - e,
+ r = this.config.width + Math.ceil(n / 2),
+ a = t / this.config.width > i / this.config.height,
+ s = (r / t).toFixed(2),
+ o = (this.config.height / i).toFixed(2),
+ u = a ? s : o,
+ l = this.config.fixed,
+ h = l ? r : parseInt(t * u),
+ d = l ? this.config.height : parseInt(i * u);
+ if (this.CanvasObj.offsetWidth != h || this.CanvasObj.offsetHeight != d) {
+ var c = parseInt((this.canvasBox.offsetHeight - d) / 2),
+ f = parseInt((this.canvasBox.offsetWidth - h) / 2);
+ c = c < 0 ? 0 : c, f = f < 0 ? 0 : f, this.CanvasObj.style.marginTop = c + "px", this.CanvasObj.style.marginLeft = f + "px", this.CanvasObj.style.width = h + "px", this.CanvasObj.style.height = d + "px"
+ }
+ return this.isCheckDisplay = !0, [h, d]
+ }
+ }, {
+ key: "_ptsFixed2",
+ value: function(e) {
+ return Math.ceil(100 * e) / 100
+ }
+ }, {
+ key: "_reinitAudioModule",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 44100;
+ this.config.ignoreAudio > 0 || (void 0 !== this.audioWAudio && null !== this.audioWAudio && (this.audioWAudio.stop(), this.audioWAudio = null), this.audioWAudio = s({
+ sampleRate: e,
+ appendType: o.APPEND_TYPE_FRAME
+ }), this.audioWAudio.isLIVE = !0)
+ }
+ }, {
+ key: "_callbackProbe",
+ value: function(e, t, i, n, r, a, s, u, l) {
+ var h = arguments.length > 9 && void 0 !== arguments[9] ? arguments[9] : 0;
+ if (1 !== h) {
+ for (var d = Module.HEAPU8.subarray(l, l + 10), c = 0; c < d.length; c++) String.fromCharCode(d[c]);
+ var f = n;
+ n > 100 && (f = o.DEFAULT_FPS, this.mediaInfo.noFPS = !0), this.vCodecID = u, this.config.fps = f, this.mediaInfo.fps = f, this.mediaInfo.size.width = t, this.mediaInfo.size.height = i, this.frameTime = Math.floor(1e3 / (this.mediaInfo.fps + 5)), this.chaseFrame = 0, this.CanvasObj.width == t && this.CanvasObj.height == i || (this.CanvasObj.width = t, this.CanvasObj.height = i, this.isCheckDisplay) || this._checkDisplaySize(t, t, i), r >= 0 && !1 === this.mediaInfo.noFPS ? (this.config.sampleRate = a, this.mediaInfo.sampleRate = a, this.config.ignoreAudio < 1 && !1 === this.muted && this._reinitAudioModule(this.mediaInfo.sampleRate)) : this.mediaInfo.audioNone = !0, this.onProbeFinish && this.onProbeFinish()
+ } else this.onProbeFinish && this.onProbeFinish(h)
+ }
+ }, {
+ key: "_callbackYUV",
+ value: function(e, t, i, n, r, a, s, o, u, l) {
+ var h = this,
+ d = Module.HEAPU8.subarray(e, e + n * o),
+ c = new Uint8Array(d),
+ f = Module.HEAPU8.subarray(t, t + r * o / 2),
+ p = new Uint8Array(f),
+ m = Module.HEAPU8.subarray(i, i + a * o / 2),
+ _ = {
+ bufY: c,
+ bufU: p,
+ bufV: new Uint8Array(m),
+ line_y: n,
+ h: o,
+ pts: u
+ };
+ this.YuvBuf.push(_), this.YuvBuf.length, this.checkCacheState(), Module._free(d), d = null, Module._free(f), f = null, Module._free(m), m = null, !1 === this.readyShowDone && !0 === this.playYUV() && (this.readyShowDone = !0, this.onReadyShowDone && this.onReadyShowDone(), this.audioWAudio || !0 !== this.config.autoPlay || (this.play(), setTimeout((function() {
+ h.isPlayingState()
+ }), 3e3)))
+ }
+ }, {
+ key: "_callbackNALU",
+ value: function(e, t, i, n, r, a, s) {
+ if (!1 === this.readyKeyFrame) {
+ if (i <= 0) return;
+ this.readyKeyFrame = !0
+ }
+ var o = Module.HEAPU8.subarray(e, e + t),
+ u = new Uint8Array(o);
+ this.NaluBuf.push({
+ bufData: u,
+ len: t,
+ isKey: i,
+ w: n,
+ h: r,
+ pts: 1e3 * a,
+ dts: 1e3 * s
+ }), Module._free(o), o = null
+ }
+ }, {
+ key: "_callbackPCM",
+ value: function(e) {
+ this.config.ignoreAudio
+ }
+ }, {
+ key: "_callbackAAC",
+ value: function(e, t, i, n) {
+ if (!(this.config.ignoreAudio > 0)) {
+ var r = this._ptsFixed2(n);
+ if (this.audioWAudio && !1 === this.muted) {
+ var a = Module.HEAPU8.subarray(e, e + t),
+ s = {
+ pts: r,
+ data: new Uint8Array(a)
+ };
+ this.audioWAudio.addSample(s), this.checkCacheState()
+ }
+ }
+ }
+ }, {
+ key: "_decode",
+ value: function() {
+ var e = this;
+ setTimeout((function() {
+ if (null !== e.workerFetch) {
+ var t = e.NaluBuf.shift();
+ if (null != t) {
+ var i = Module._malloc(t.bufData.length);
+ Module.HEAP8.set(t.bufData, i), Module.cwrap("decodeHttpFlvVideoFrame", "number", ["number", "number", "number", "number", "number"])(e.corePtr, i, t.bufData.length, t.pts, t.dts, 0), Module._free(i), i = null
+ }
+ e._decode()
+ }
+ }), 1)
+ }
+ }, {
+ key: "setScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ this.showScreen = e
+ }
+ }, {
+ key: "checkCacheState",
+ value: function() {
+ this.YuvBuf.length, this.config.ignoreAudio > 0 || !0 === this.mediaInfo.audioNone || this.audioWAudio && this.audioWAudio.sampleQueue.length;
+ var e = this.YuvBuf.length >= 25 && (!0 === this.muted || this.config.ignoreAudio > 0 || !0 === this.mediaInfo.audioNone || this.audioWAudio && this.audioWAudio.sampleQueue.length >= 50);
+ return !1 === this.cache_status && e && (this.playInterval && this.audioWAudio && this.audioWAudio.play(), this.onLoadCacheFinshed && this.onLoadCacheFinshed(), this.cache_status = !0), e
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.config.ignoreAudio < 1 && (this.audioVoice = e, this.audioWAudio && this.audioWAudio.setVoice(e))
+ }
+ }, {
+ key: "_removeBindFuncPtr",
+ value: function() {
+ null !== this._ptr_probeCallback && Module.removeFunction(this._ptr_probeCallback), null !== this._ptr_frameCallback && Module.removeFunction(this._ptr_frameCallback), null !== this._ptr_naluCallback && Module.removeFunction(this._ptr_naluCallback), null !== this._ptr_sampleCallback && Module.removeFunction(this._ptr_sampleCallback), null !== this._ptr_aacCallback && Module.removeFunction(this._ptr_aacCallback), this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null
+ }
+ }, {
+ key: "release",
+ value: function() {
+ return this.pause(), this.NaluBuf.length = 0, this.YuvBuf.length = 0, void 0 !== this.workerFetch && null !== this.workerFetch && this.workerFetch.postMessage({
+ cmd: "stop",
+ data: "stop",
+ msg: "stop"
+ }), this.workerFetch = null, this.AVGetInterval && clearInterval(this.AVGetInterval), this.AVGetInterval = null, this._removeBindFuncPtr(), void 0 !== this.corePtr && null !== this.corePtr && Module.cwrap("releaseHttpFLV", "number", ["number"])(this.corePtr), this.playInterval && clearInterval(this.playInterval), this.playInterval = null, this.audioWAudio && this.audioWAudio.stop(), this.audioWAudio = null, void 0 !== this.AVGLObj && null !== this.AVGLObj && (r.releaseContext(this.AVGLObj), this.AVGLObj = null), this.CanvasObj && this.CanvasObj.remove(), this.CanvasObj = null, window.onclick = document.body.onclick = null, delete window.g_players[this.corePtr], 0
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return null !== this.playInterval && void 0 !== this.playInterval
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.config.ignoreAudio, this.audioWAudio, this.config.ignoreAudio < 1 && this.audioWAudio && this.audioWAudio.pause(), this.playInterval && clearInterval(this.playInterval), this.playInterval = null, this.chaseFrame = 0, this.onPlayState && this.onPlayState(this.isPlayingState())
+ }
+ }, {
+ key: "playYUV",
+ value: function() {
+ if (this.YuvBuf.length > 0) {
+ var e = this.YuvBuf.shift();
+ return this.onRender && this.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), r.renderFrame(this.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h), !0
+ }
+ return !1
+ }
+ }, {
+ key: "play",
+ value: function() {
+ var e = this,
+ t = this;
+ if (this.chaseFrame = 0, !1 === this.checkCacheState()) return this.onLoadCache && this.onLoadCache(), setTimeout((function() {
+ e.play()
+ }), 100), !1;
+ var i = 1 * t.frameTime;
+ if (void 0 === this.playInterval || null === this.playInterval) {
+ var n = 0,
+ s = 0,
+ o = 0;
+ if (this.config.ignoreAudio < 1 && !1 === this.mediaInfo.audioNone && null != this.audioWAudio && !1 === this.mediaInfo.noFPS) this.config.ignoreAudio, this.mediaInfo.audioNone, this.audioWAudio, this.mediaInfo.noFPS, this.playInterval = setInterval((function() {
+ if (s = a.GetMsTime(), t.cache_status) {
+ if (s - n >= t.frameTime - o) {
+ var e = t.YuvBuf.shift();
+ if (e.pts, t.YuvBuf.length, null != e && null !== e) {
+ var u = 0;
+ null !== t.audioWAudio && void 0 !== t.audioWAudio ? (u = 1e3 * (e.pts - t.audioWAudio.getAlignVPTS()), o = u < 0 && -1 * u <= i || u > 0 && u <= i || 0 === u || u > 0 && u > i ? a.GetMsTime() - s + 1 : t.frameTime) : o = a.GetMsTime() - s + 1, t.showScreen && t.onRender && t.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), e.pts, r.renderFrame(t.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h)
+ }(t.YuvBuf.length <= 0 || t.audioWAudio && t.audioWAudio.sampleQueue.length <= 0) && (t.cache_status = !1, t.onLoadCache && t.onLoadCache(), t.audioWAudio && t.audioWAudio.pause()), n = s
+ }
+ } else o = t.frameTime
+ }), 1), this.audioWAudio && this.audioWAudio.play();
+ else {
+ var u = -1;
+ this.playInterval = setInterval((function() {
+ if (s = a.GetMsTime(), t.cache_status) {
+ t.YuvBuf.length, t.frameTime, t.frameTime, t.chaseFrame;
+ var e = -1;
+ if (u > 0 && (e = s - n, t.frameTime, t.chaseFrame <= 0 && o > 0 && (t.chaseFrame = Math.floor(o / t.frameTime), t.chaseFrame)), u <= 0 || e >= t.frameTime || t.chaseFrame > 0) {
+ u = 1;
+ var i = t.YuvBuf.shift();
+ i.pts, t.YuvBuf.length, null != i && null !== i && (t.showScreen && t.onRender && t.onRender(i.line_y, i.h, i.bufY, i.bufU, i.bufV), i.pts, r.renderFrame(t.AVGLObj, i.bufY, i.bufU, i.bufV, i.line_y, i.h), o = a.GetMsTime() - s + 1), t.YuvBuf.length <= 0 && (t.cache_status = !1, t.onLoadCache && t.onLoadCache()), n = s, t.chaseFrame > 0 && (t.chaseFrame--, 0 === t.chaseFrame && (o = t.frameTime))
+ }
+ } else o = t.frameTime, u = -1, t.chaseFrame = 0, n = 0, s = 0, o = 0
+ }), 1)
+ }
+ }
+ this.onPlayState && this.onPlayState(this.isPlayingState())
+ }
+ }, {
+ key: "start",
+ value: function(e) {
+ var t = this;
+ this.workerFetch = new Worker(a.GetScriptPath((function() {
+ var e = null,
+ t = new AbortController,
+ i = t.signal,
+ n = (self, function(e) {
+ var t = !1;
+ t || (t = !0, fetch(e, {
+ signal: i
+ }).then((function(e) {
+ return function e(t) {
+ return t.read().then((function(i) {
+ if (!i.done) {
+ var n = i.value;
+ return self.postMessage({
+ cmd: "fetch-chunk",
+ data: n,
+ msg: "fetch-chunk"
+ }), e(t)
+ }
+ self.postMessage({
+ cmd: "fetch-fin",
+ data: null,
+ msg: "fetch-fin"
+ })
+ }))
+ }(e.body.getReader())
+ })).catch((function(e) {
+ if (!e.toString().includes("user aborted")) {
+ var t = " httplive request error:" + e + " start to retry";
+ console.error(t), self.postMessage({
+ cmd: "fetch-error",
+ data: t,
+ msg: "fetch-error"
+ })
+ }
+ })))
+ });
+ self.onmessage = function(r) {
+ var a = r.data;
+ switch (void 0 === a.cmd || null === a.cmd ? "" : a.cmd) {
+ case "start":
+ e = a.data, n(e), self.postMessage({
+ cmd: "startok",
+ data: "WORKER STARTED",
+ msg: "startok"
+ });
+ break;
+ case "stop":
+ t.abort(), self.close(), self.postMessage({
+ cmd: "close",
+ data: "close",
+ msg: "close"
+ });
+ break;
+ case "retry":
+ t.abort(), t = null, i = null, t = new AbortController, i = t.signal, setTimeout((function() {
+ n(e)
+ }), 3e3)
+ }
+ }
+ }))), this.workerFetch.onmessage = function(e) {
+ t._workerFetch_onmessage(e, t)
+ }, this.workerFetch, this._ptr_probeCallback = Module.addFunction(this._callbackProbe.bind(this)), this._ptr_yuvCallback = Module.addFunction(this._callbackYUV.bind(this)), this._ptr_naluCallback = Module.addFunction(this._callbackNALU.bind(this)), this._ptr_sampleCallback = Module.addFunction(this._callbackPCM.bind(this)), this._ptr_aacCallback = Module.addFunction(this._callbackAAC.bind(this)), Module.cwrap("initializeSniffHttpFlvModule", "number", ["number", "number", "number", "number", "number", "number", "number"])(this.corePtr, this._ptr_probeCallback, this._ptr_yuvCallback, this._ptr_naluCallback, this._ptr_sampleCallback, this._ptr_aacCallback, this.config.ignoreAudio), this.AVGLObj = r.setupCanvas(this.CanvasObj, {
+ preserveDrawingBuffer: !1
+ }), this.workerFetch.postMessage({
+ cmd: "start",
+ data: e,
+ msg: "start"
+ }), this._decode()
+ }
+ }]) && n(t.prototype, i), u && n(t, u), e
+ }());
+ i.CHttpLiveCore = u
+ }, {
+ "../consts": 52,
+ "../demuxer/buffer": 66,
+ "../demuxer/bufferFrame": 67,
+ "../render-engine/webgl-420p": 81,
+ "../version": 84,
+ "./audio-core": 54,
+ "./audio-native-core": 55,
+ "./av-common": 56,
+ "./cache": 61,
+ "./cacheYuv": 62
+ }],
+ 59: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+
+ function r(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }
+ var a = e("../demuxer/bufferFrame"),
+ s = e("../demuxer/buffer"),
+ o = (e("./cache"), e("./cacheYuv"), e("../render-engine/webgl-420p")),
+ u = e("./av-common"),
+ l = (e("./audio-native-core"), e("./audio-core")),
+ h = e("../consts"),
+ d = e("../version"),
+ c = function e(t, i, n, a, s, o, u, l, h) {
+ r(this, e), this.pts = h, this.data_y = t, this.data_u = i, this.data_v = n, this.line1 = a, this.line2 = s, this.line3 = o, this.width = u, this.height = l, this.byteAlignIncr = this.line1 - this.width
+ },
+ f = function() {
+ function e(t) {
+ r(this, e);
+ this.config = {
+ width: t.width || h.DEFAULT_WIDTH,
+ height: t.height || h.DEFAULT_HEIGHT,
+ fps: t.fps || h.DEFAULT_FPS,
+ sampleRate: t.sampleRate || h.DEFAULT_SAMPLERATE,
+ playerId: t.playerId || h.DEFAILT_WEBGL_PLAY_ID,
+ token: t.token || null,
+ readyShow: t.readyShow || !1,
+ checkProbe: t.checkProbe,
+ ignoreAudio: t.ignoreAudio,
+ playMode: t.playMode || h.PLAYER_MODE_VOD,
+ autoPlay: t.autoPlay || !1,
+ defaultFps: t.defaultFps || -1,
+ cacheLength: t.cacheLength || 50
+ }, this.config.cacheLength = Math.max(this.config.cacheLength, 5), this.probeSize = 4524611, this.audioWAudio = null, this.audioVoice = 1, this.frameCallTag = 0, this.seekTarget = 0, this.avSeekVState = !1, this.isNewSeek = !1, this.openFrameCall = !0, this.bufRecvStat = !1, this.bufObject = s(), this.bufLastVDTS = 0, this.bufLastADTS = 0, this.yuvMaxTime = 0, this.loopMs = 10, this.isCacheV = h.CACHE_NO_LOADCACHE, this.playVPipe = [], this._videoQueue = [], this._VIDEO_CACHE_LEN = this.config.cacheLength, this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null, this.duration = -1, this.channels = -1, this.width = -1, this.height = -1, this.isPlaying = !1, this.isCheckDisplay = !1, this.frameTime = 1e3 / this.config.fps, this.vCodecID = h.V_CODEC_NAME_UNKN, this.audioIdx = -1, this.audioNone = !1, this.frameDur = 0, this.canvasBox = null, this.canvas = null, this.yuv = null, this.retryAuSampleNo = 0, this.cacheStatus = !1, this.showScreen = !1, this.playPTS = 0, this.vCachePTS = 0, this.aCachePTS = 0, this.reFull = !1, this.bufOK = !1, this.avRecvInterval = null, this.avFeedVideoInterval = null, this.avFeedAudioInterval = null, this.decVFrameInterval = null, this.playFrameInterval = null, this.onProbeFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onSeekFinish = null, this.onLoadCache = null, this.onLoadCacheFinshed = null, this.onRender = null, this.onCacheProcess = null, this.onReadyShowDone = null, this.onRelease = null, this.playModeEnum = this.config.playMode === h.PLAYER_MODE_NOTIME_LIVE ? 1 : 0, this.corePtr = Module.cwrap("AVSniffStreamInit", "number", ["string", "string"])(this.config.token, d.PLAYER_VERSION), this.corePtr, this._ptr_probeCallback = Module.addFunction(this._probeFinCallback.bind(this)), this._ptr_frameCallback = Module.addFunction(this._frameCallback.bind(this)), this._ptr_naluCallback = Module.addFunction(this._naluCallback.bind(this)), this._ptr_sampleCallback = Module.addFunction(this._samplesCallback.bind(this)), this._ptr_aacCallback = Module.addFunction(this._aacFrameCallback.bind(this)), this.config.ignoreAudio, this.config.playMode, this.playModeEnum;
+ Module.cwrap("initializeSniffStreamModuleWithAOpt", "number", ["number", "number", "number", "number", "number", "number", "number", "number", "number"])(this.corePtr, this._ptr_probeCallback, this._ptr_frameCallback, this._ptr_naluCallback, this._ptr_sampleCallback, this._ptr_aacCallback, this.config.ignoreAudio, this.playModeEnum, this.config.defaultFps)
+ }
+ var t, i, f;
+ return t = e, (i = [{
+ key: "_createWorker1",
+ value: function() {
+ var e = this;
+ this.worker1 = new Worker("./dist/dc-worker-dist.js"), this.worker1ready = !1, this.worker1decing = !1, this.worker1.onmessage = function(t) {
+ var i = t.data,
+ n = i.cmd,
+ r = i.params;
+ switch (n) {
+ case "onRuntimeInitialized":
+ e.worker1.postMessage({
+ cmd: "AVSniffStreamInit",
+ params: [e.config.token, d.PLAYER_VERSION]
+ });
+ break;
+ case "onInitDecOK":
+ e.worker1ready = !0;
+ break;
+ case "decodeVideoFrame_Start":
+ e.worker1decing = !0;
+ break;
+ case "decodeVideoFrame_End":
+ e.worker1decing = !1;
+ break;
+ case "_frameCallback":
+ e._handleFrameYUVCallback(r.buf_y, r.buf_u, r.buf_v, r.line1, r.line2, r.line3, r.width, r.height, r.pts, r.tag);
+ break;
+ case "stop_End":
+ e.worker1.onmessage = null, e.worker1 = null
+ }
+ }
+ }
+ }, {
+ key: "_removeBindFuncPtr",
+ value: function() {
+ null !== this._ptr_probeCallback && Module.removeFunction(this._ptr_probeCallback), null !== this._ptr_frameCallback && Module.removeFunction(this._ptr_frameCallback), null !== this._ptr_naluCallback && Module.removeFunction(this._ptr_naluCallback), null !== this._ptr_sampleCallback && Module.removeFunction(this._ptr_sampleCallback), null !== this._ptr_aacCallback && Module.removeFunction(this._ptr_aacCallback), this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null
+ }
+ }, {
+ key: "release",
+ value: function() {
+ null !== this.playFrameInterval && (window.clearInterval(this.playFrameInterval), this.playFrameInterval = null), null !== this.avFeedVideoInterval && (window.clearInterval(this.avFeedVideoInterval), this.avFeedVideoInterval = null), null !== this.avFeedAudioInterval && (window.clearInterval(this.avFeedAudioInterval), this.avFeedAudioInterval = null), null !== this.avRecvInterval && (window.clearInterval(this.avRecvInterval), this.avRecvInterval = null), this._clearDecInterval(), this._removeBindFuncPtr();
+ var e = -1;
+ return void 0 !== this.corePtr && null !== this.corePtr && (e = Module.cwrap("releaseSniffStream", "number", ["number"])(this.corePtr), this.corePtr = null), this.audioWAudio && this.audioWAudio.stop(), this.audioWAudio = null, this.bufRecvStat = !1, this.bufObject.cleanPipeline(), this.playVPipe.length = 0, this.loopMs = 10, void 0 !== this.yuv && null !== this.yuv && (o.releaseContext(this.yuv), this.yuv = null), void 0 !== this.canvas && null !== this.canvas && (this.canvas.remove(), this.canvas = null), this.config.readyShow = !0, window.onclick = document.body.onclick = null, delete window.g_players[this.corePtr], this.onRelease && this.onRelease(), e
+ }
+ }, {
+ key: "setScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ this.showScreen = e
+ }
+ }, {
+ key: "getCachePTS",
+ value: function() {
+ return 1 !== this.config.ignoreAudio && this.audioWAudio ? Math.max(this.vCachePTS, this.aCachePTS) : this.vCachePTS
+ }
+ }, {
+ key: "getMaxPTS",
+ value: function() {
+ return Math.max(this.vCachePTS, this.aCachePTS)
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return this.isPlaying
+ }
+ }, {
+ key: "_clearDecInterval",
+ value: function() {
+ this.decVFrameInterval && window.clearInterval(this.decVFrameInterval), this.decVFrameInterval = null
+ }
+ }, {
+ key: "_checkPlayFinished",
+ value: function() {
+ return !(this.config.playMode !== h.PLAYER_MODE_VOD || !(!0 === this.bufRecvStat && (this.playPTS >= this.bufLastVDTS || this.audioWAudio && this.playPTS >= this.bufLastADTS) || this.duration - this.playPTS < this.frameDur) || (this.pause(), this._clearDecInterval(), this.onPlayingTime && this.onPlayingTime(this.duration), this.onLoadCacheFinshed && this.onLoadCacheFinshed(), this.onPlayingFinish && this.onPlayingFinish(), 0))
+ }
+ }, {
+ key: "play",
+ value: function() {
+ var e = this,
+ t = this;
+ if (this.isCacheV === h.CACHE_WITH_NOPLAY_SIGN && (this.isCacheV = h.CACHE_WITH_PLAY_SIGN), this.isPlaying = !0, !this.playFrameInterval || null === this.playFrameInterval || null == this.playFrameInterval) {
+ var i = 0,
+ n = 0,
+ r = 0,
+ a = 1 * this.frameTime;
+ this.config.playMode === h.PLAYER_MODE_NOTIME_LIVE ? this.playFrameInterval = window.setInterval((function() {
+ if (n = u.GetMsTime(), t._videoQueue.length > 0 && n - i >= t.frameTime - r) {
+ var e = t._videoQueue.shift();
+ e.pts, o.renderFrame(t.yuv, e.data_y, e.data_u, e.data_v, e.line1, e.height), (r = u.GetMsTime() - n) >= t.frameTime && (r = t.frameTime), i = n
+ }
+ }), 2) : this.playFrameInterval = window.setInterval((function() {
+ if (n = u.GetMsTime(), e._videoQueue.length > 0 && n - i >= e.frameTime - r) {
+ var t = e._videoQueue.shift(),
+ s = 0;
+ if (e.isNewSeek || null === e.audioWAudio || void 0 === e.audioWAudio || (s = 1e3 * (t.pts - e.audioWAudio.getAlignVPTS()), e.playPTS = Math.max(e.audioWAudio.getAlignVPTS(), e.playPTS)), i = n, e.playPTS = Math.max(t.pts, e.playPTS), e.isNewSeek && e.seekTarget - e.frameDur > t.pts) return void(r = e.frameTime);
+ if (e.isNewSeek && (e.audioWAudio && e.audioWAudio.setVoice(e.audioVoice), e.audioWAudio && e.audioWAudio.play(), r = 0, e.isNewSeek = !1, e.seekTarget = 0), e.showScreen && e.onRender && e.onRender(t.line1, t.height, t.data_y, t.data_u, t.data_v), o.renderFrame(e.yuv, t.data_y, t.data_u, t.data_v, t.line1, t.height), e.onPlayingTime && e.onPlayingTime(t.pts), !e.isNewSeek && e.audioWAudio && (s < 0 && -1 * s <= a || s >= 0)) {
+ if (e.config.playMode === h.PLAYER_MODE_VOD)
+ if (t.pts >= e.duration) e.onLoadCacheFinshed && e.onLoadCacheFinshed(), e.onPlayingFinish && e.onPlayingFinish(), e._clearDecInterval(), e.pause();
+ else if (e._checkPlayFinished()) return;
+ r = u.GetMsTime() - n
+ } else !e.isNewSeek && e.audioWAudio && (r = e.frameTime)
+ }
+ e._checkPlayFinished()
+ }), 1)
+ }
+ this.isNewSeek || this.audioWAudio && this.audioWAudio.play()
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.isPlaying = !1, this._pause(), this.isCacheV === h.CACHE_WITH_PLAY_SIGN && (this.isCacheV = h.CACHE_WITH_NOPLAY_SIGN)
+ }
+ }, {
+ key: "_pause",
+ value: function() {
+ this.playFrameInterval && window.clearInterval(this.playFrameInterval), this.playFrameInterval = null, this.audioWAudio && this.audioWAudio.pause()
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ var t = this,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
+ this.openFrameCall = !1, this.pause(), this._clearDecInterval(), null !== this.avFeedVideoInterval && (window.clearInterval(this.avFeedVideoInterval), this.avFeedVideoInterval = null), null !== this.avFeedAudioInterval && (window.clearInterval(this.avFeedAudioInterval), this.avFeedAudioInterval = null), this.yuvMaxTime = 0, this.playVPipe.length = 0, this._videoQueue.length = 0, this.audioWAudio && this.audioWAudio.stop(), e && e(), this.isNewSeek = !0, this.avSeekVState = !0, this.seekTarget = i.seekTime, null !== this.audioWAudio && void 0 !== this.audioWAudio && (this.audioWAudio.setVoice(0), this.audioWAudio.resetStartParam(), this.audioWAudio.stop()), this._avFeedData(i.seekTime), setTimeout((function() {
+ t.yuvMaxTime = 0, t._videoQueue.length = 0, t.openFrameCall = !0, t.frameCallTag += 1, t._decVFrameIntervalFunc()
+ }), 1e3)
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.audioVoice = e, this.audioWAudio && this.audioWAudio.setVoice(e)
+ }
+ }, {
+ key: "cacheIsFull",
+ value: function() {
+ return this._videoQueue.length >= this._VIDEO_CACHE_LEN
+ }
+ }, {
+ key: "_checkDisplaySize",
+ value: function(e, t, i) {
+ var n = t - e,
+ r = this.config.width + Math.ceil(n / 2),
+ a = t / this.config.width > i / this.config.height,
+ s = (r / t).toFixed(2),
+ o = (this.config.height / i).toFixed(2),
+ u = a ? s : o,
+ l = this.config.fixed,
+ h = l ? r : parseInt(t * u),
+ d = l ? this.config.height : parseInt(i * u);
+ if (this.canvas.offsetWidth != h || this.canvas.offsetHeight != d) {
+ var c = parseInt((this.canvasBox.offsetHeight - d) / 2),
+ f = parseInt((this.canvasBox.offsetWidth - h) / 2);
+ c = c < 0 ? 0 : c, f = f < 0 ? 0 : f, this.canvas.style.marginTop = c + "px", this.canvas.style.marginLeft = f + "px", this.canvas.style.width = h + "px", this.canvas.style.height = d + "px"
+ }
+ return this.isCheckDisplay = !0, [h, d]
+ }
+ }, {
+ key: "_createYUVCanvas",
+ value: function() {
+ this.canvasBox = document.querySelector("#" + this.config.playerId), this.canvasBox.style.overflow = "hidden", this.canvas = document.createElement("canvas"), this.canvas.style.width = this.canvasBox.clientWidth + "px", this.canvas.style.height = this.canvasBox.clientHeight + "px", this.canvas.style.top = "0px", this.canvas.style.left = "0px", this.canvasBox.appendChild(this.canvas), this.yuv = o.setupCanvas(this.canvas, {
+ preserveDrawingBuffer: !1
+ })
+ }
+ }, {
+ key: "_avRecvPackets",
+ value: function() {
+ var e = this;
+ this.bufObject.cleanPipeline(), null !== this.avRecvInterval && (window.clearInterval(this.avRecvInterval), this.avRecvInterval = null), !0 === this.config.checkProbe ? this.avRecvInterval = window.setInterval((function() {
+ Module.cwrap("getSniffStreamPkg", "number", ["number"])(e.corePtr), e._avCheckRecvFinish()
+ }), 5) : this.avRecvInterval = window.setInterval((function() {
+ Module.cwrap("getSniffStreamPkgNoCheckProbe", "number", ["number"])(e.corePtr), e._avCheckRecvFinish()
+ }), 5), this._avFeedData(0, !1)
+ }
+ }, {
+ key: "_avCheckRecvFinish",
+ value: function() {
+ this.config.playMode === h.PLAYER_MODE_VOD && this.duration - this.getMaxPTS() < this.frameDur && this._avSetRecvFinished()
+ }
+ }, {
+ key: "_avSetRecvFinished",
+ value: function() {
+ this.bufRecvStat = !0, null !== this.avRecvInterval && (window.clearInterval(this.avRecvInterval), this.avRecvInterval = null), this.bufOK = !0
+ }
+ }, {
+ key: "_afterAvFeedSeekToStartWithFinishedBuffer",
+ value: function(e) {
+ var t = this,
+ i = window.setInterval((function() {
+ t._videoQueue.length >= t._VIDEO_CACHE_LEN && (t.onSeekFinish && t.onSeekFinish(), t.onPlayingTime && t.onPlayingTime(e), t.play(), window.clearInterval(i), i = null)
+ }), 10);
+ return !0
+ }
+ }, {
+ key: "_afterAvFeedSeekToStartWithUnFinBuffer",
+ value: function(e) {
+ var t = this,
+ i = this,
+ n = window.setInterval((function() {
+ t._videoQueue.length, i._videoQueue.length >= i._VIDEO_CACHE_LEN && (i.onSeekFinish && i.onSeekFinish(), i.onPlayingTime && i.onPlayingTime(e), !1 === i.reFull ? i.play() : i.reFull = !1, window.clearInterval(n), n = null)
+ }), 10);
+ return !0
+ }
+ }, {
+ key: "_avFeedData",
+ value: function(e) {
+ var t = this;
+ if (this.playVPipe.length = 0, this.audioWAudio && this.audioWAudio.cleanQueue(), e <= 0 && !1 === this.bufOK) {
+ var i = 0;
+ if (t.avFeedVideoInterval = window.setInterval((function() {
+ var n = t.bufObject.videoBuffer.length;
+ if (n - 1 > i || t.duration > 0 && t.duration - t.getMaxPTS() < t.frameDur && n - 1 == i) {
+ var r = t.bufObject.videoBuffer[i].length;
+ if (r > 0) {
+ for (var s = 0; s < r; s++) t.playVPipe.push(a.ConstructWithDts(t.bufObject.videoBuffer[i][s].pts, t.bufObject.videoBuffer[i][s].dts, t.bufObject.videoBuffer[i][s].isKey, t.bufObject.videoBuffer[i][s].data, !0));
+ i += 1
+ }
+ t.config.playMode === h.PLAYER_MODE_VOD && t.duration - t.getMaxPTS() < t.frameDur && t.playVPipe.length > 0 && t.playVPipe[t.playVPipe.length - 1].pts >= t.bufLastVDTS && (window.clearInterval(t.avFeedVideoInterval), t.avFeedVideoInterval = null, t.playVPipe[t.playVPipe.length - 1].pts, t.bufLastVDTS, t.bufObject.videoBuffer, t.playVPipe)
+ } else t.config.playMode === h.PLAYER_MODE_VOD && t.playVPipe.length > 0 && t.playVPipe[t.playVPipe.length - 1].pts >= t.duration && (window.clearInterval(t.avFeedVideoInterval), t.avFeedVideoInterval = null, t.playVPipe[t.playVPipe.length - 1].pts, t.duration, t.bufObject.videoBuffer, t.playVPipe);
+ t.avSeekVState && (t.getMaxPTS(), t.duration, t.config.playMode === h.PLAYER_MODE_VOD && (t._afterAvFeedSeekToStartWithFinishedBuffer(e), t.avSeekVState = !1))
+ }), 5), void 0 !== t.audioWAudio && null !== t.audioWAudio && t.config.ignoreAudio < 1) {
+ var n = 0;
+ t.avFeedAudioInterval = window.setInterval((function() {
+ var e = t.bufObject.audioBuffer.length;
+ if (e - 1 > n || t.duration - t.getMaxPTS() < t.frameDur && e - 1 == n) {
+ for (var i = t.bufObject.audioBuffer[n].length, r = 0; r < i; r++) t.audioWAudio.addSample(new a.BufferFrame(t.bufObject.audioBuffer[n][r].pts, t.bufObject.audioBuffer[n][r].isKey, t.bufObject.audioBuffer[n][r].data, !1));
+ n += 1, t.config.playMode === h.PLAYER_MODE_VOD && t.duration - t.getMaxPTS() < t.frameDur && t.audioWAudio.sampleQueue.length > 0 && t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts >= t.bufLastADTS && (window.clearInterval(t.avFeedAudioInterval), t.avFeedAudioInterval = null, t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts, t.bufObject.audioBuffer)
+ } else t.config.playMode === h.PLAYER_MODE_VOD && t.audioWAudio.sampleQueue.length > 0 && t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts >= t.duration && (window.clearInterval(t.avFeedAudioInterval), t.avFeedAudioInterval = null, t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts, t.bufObject.audioBuffer)
+ }), 5)
+ }
+ } else {
+ var r = this.bufObject.seekIDR(e),
+ s = parseInt(r, 10);
+ this.playPTS = 0;
+ var o = s;
+ if (this.avFeedVideoInterval = window.setInterval((function() {
+ var i = t.bufObject.videoBuffer.length;
+ if (i - 1 > o || t.duration - t.getMaxPTS() < t.frameDur && i - 1 == o) {
+ var n = t.bufObject.videoBuffer[o].length;
+ if (n > 0) {
+ for (var r = 0; r < n; r++) t.playVPipe.push(a.ConstructWithDts(t.bufObject.videoBuffer[o][r].pts, t.bufObject.videoBuffer[o][r].dts, t.bufObject.videoBuffer[o][r].isKey, t.bufObject.videoBuffer[o][r].data, !0));
+ o += 1
+ }
+ t.config.playMode === h.PLAYER_MODE_VOD && t.duration - t.getMaxPTS() < t.frameDur && t.playVPipe.length > 0 && t.playVPipe[t.playVPipe.length - 1].pts >= t.bufLastVDTS && (window.clearInterval(t.avFeedVideoInterval), t.avFeedVideoInterval = null)
+ } else t.config.playMode === h.PLAYER_MODE_VOD && t.playVPipe.length > 0 && t.playVPipe[t.playVPipe.length - 1].pts >= t.duration && (window.clearInterval(t.avFeedVideoInterval), t.avFeedVideoInterval = null);
+ t.avSeekVState && (t.getMaxPTS(), t.duration, t.config.playMode === h.PLAYER_MODE_VOD && (t._afterAvFeedSeekToStartWithUnFinBuffer(e), t.avSeekVState = !1))
+ }), 5), this.audioWAudio && this.config.ignoreAudio < 1) {
+ var u = parseInt(e, 10);
+ this.avFeedAudioInterval = window.setInterval((function() {
+ var e = t.bufObject.audioBuffer.length;
+ if (e - 1 > u || t.duration - t.getMaxPTS() < t.frameDur && e - 1 == u) {
+ for (var i = t.bufObject.audioBuffer[u].length, n = 0; n < i; n++) t.bufObject.audioBuffer[u][n].pts < t.seekTarget || t.audioWAudio.addSample(new a.BufferFrame(t.bufObject.audioBuffer[u][n].pts, t.bufObject.audioBuffer[u][n].isKey, t.bufObject.audioBuffer[u][n].data, !1));
+ u += 1, t.config.playMode === h.PLAYER_MODE_VOD && t.duration - t.getMaxPTS() < t.frameDur && t.audioWAudio.sampleQueue.length > 0 && t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts >= t.bufLastADTS && (window.clearInterval(t.avFeedAudioInterval), t.avFeedAudioInterval = null)
+ } else t.config.playMode === h.PLAYER_MODE_VOD && t.audioWAudio.sampleQueue.length > 0 && t.audioWAudio.sampleQueue[t.audioWAudio.sampleQueue.length - 1].pts >= t.duration && (window.clearInterval(t.avFeedAudioInterval), t.avFeedAudioInterval = null)
+ }), 5)
+ }
+ }
+ }
+ }, {
+ key: "_probeFinCallback",
+ value: function(e, t, i, n, r, a, s, o, u) {
+ var d = this;
+ this._createYUVCanvas(), h.V_CODEC_NAME_HEVC, this.config.fps = 1 * n, this.frameTime = 1e3 / this.config.fps, this.width = t, this.height = i, this.frameDur = 1 / this.config.fps, this.duration = e - this.frameDur, this.vCodecID = o, this.config.sampleRate = a, this.channels = s, this.audioIdx = r, this.duration < 0 && (this.config.playMode = h.PLAYER_MODE_NOTIME_LIVE, this.frameTime, this.frameDur);
+ for (var c = Module.HEAPU8.subarray(u, u + 10), f = 0; f < c.length; f++) String.fromCharCode(c[f]);
+ r >= 0 && this.config.ignoreAudio < 1 ? this.audioNone = !1 : this.audioNone = !0, h.V_CODEC_NAME_HEVC === this.vCodecID && (!1 === this.audioNone && (void 0 !== this.audioWAudio && null !== this.audioWAudio && (this.audioWAudio.stop(), this.audioWAudio = null), this.audioWAudio = l({
+ sampleRate: a,
+ appendType: h.APPEND_TYPE_FRAME
+ }), this.audioWAudio.setDurationMs(1e3 * e), this.onLoadCache && this.audioWAudio.setOnLoadCache((function() {
+ if (d.retryAuSampleNo, d.retryAuSampleNo <= 5) {
+ d.pause(), d.onLoadCache && d.onLoadCache();
+ var e = window.setInterval((function() {
+ return d.retryAuSampleNo, d.audioWAudio.sampleQueue.length, d.audioWAudio.sampleQueue.length > 2 ? (d.onLoadCacheFinshed && d.onLoadCacheFinshed(), d.play(), d.retryAuSampleNo = 0, window.clearInterval(e), void(e = null)) : (d.retryAuSampleNo += 1, d.retryAuSampleNo > 5 ? (d.play(), d.onLoadCacheFinshed && d.onLoadCacheFinshed(), window.clearInterval(e), void(e = null)) : void 0)
+ }), 1e3)
+ }
+ }))), this._avRecvPackets(), this._decVFrameIntervalFunc()), this.onProbeFinish && this.onProbeFinish()
+ }
+ }, {
+ key: "_ptsFixed2",
+ value: function(e) {
+ return Math.ceil(100 * e) / 100
+ }
+ }, {
+ key: "_naluCallback",
+ value: function(e, t, i, n, r, a, s, o) {
+ var u = this._ptsFixed2(a);
+ o > 0 && (u = a);
+ var l = Module.HEAPU8.subarray(e, e + t),
+ h = new Uint8Array(l);
+ this.bufObject.appendFrameWithDts(u, s, h, !0, i), this.bufLastVDTS = Math.max(s, this.bufLastVDTS), this.vCachePTS = Math.max(u, this.vCachePTS), this.onCacheProcess && this.onCacheProcess(this.getCachePTS())
+ }
+ }, {
+ key: "_samplesCallback",
+ value: function(e, t, i, n) {}
+ }, {
+ key: "_aacFrameCallback",
+ value: function(e, t, i, n) {
+ var r = this._ptsFixed2(n);
+ if (this.audioWAudio) {
+ var a = Module.HEAPU8.subarray(e, e + t),
+ s = new Uint8Array(a);
+ this.bufObject.appendFrame(r, s, !1, !0), this.bufLastADTS = Math.max(r, this.bufLastADTS), this.aCachePTS = Math.max(r, this.aCachePTS), this.onCacheProcess && this.onCacheProcess(this.getCachePTS())
+ }
+ }
+ }, {
+ key: "_setLoadCache",
+ value: function() {
+ if (null === this.avFeedVideoInterval && null === this.avFeedAudioInterval && this.playVPipe.length <= 0) return 1;
+ if (this.isCacheV === h.CACHE_NO_LOADCACHE) {
+ var e = this.isPlaying;
+ this.pause(), this.onLoadCache && this.onLoadCache(), this.isCacheV = e ? h.CACHE_WITH_PLAY_SIGN : h.CACHE_WITH_NOPLAY_SIGN
+ }
+ return 0
+ }
+ }, {
+ key: "_setLoadCacheFinished",
+ value: function() {
+ this.isCacheV !== h.CACHE_NO_LOADCACHE && (this.isCacheV, this.onLoadCacheFinshed && this.onLoadCacheFinshed(), this.isCacheV === h.CACHE_WITH_PLAY_SIGN && this.play(), this.isCacheV = h.CACHE_NO_LOADCACHE)
+ }
+ }, {
+ key: "_createDecVframeInterval",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 10,
+ t = this;
+ null !== this.decVFrameInterval && (window.clearInterval(this.decVFrameInterval), this.decVFrameInterval = null);
+ var i = 0;
+ this.loopMs = e, this.decVFrameInterval = window.setInterval((function() {
+ if (t._videoQueue.length < 1 ? t._setLoadCache() : t._videoQueue.length >= t._VIDEO_CACHE_LEN && t._setLoadCacheFinished(), t._videoQueue.length < t._VIDEO_CACHE_LEN && i <= t._VIDEO_CACHE_LEN) {
+ if (t.playVPipe.length > 0) {
+ 100 === t.loopMs && t._createDecVframeInterval(10);
+ var e = t.playVPipe.shift(),
+ n = e.data,
+ r = Module._malloc(n.length);
+ Module.HEAP8.set(n, r);
+ var a = parseInt(1e3 * e.pts, 10),
+ s = parseInt(1e3 * e.dts, 10);
+ t.yuvMaxTime = Math.max(e.pts, t.yuvMaxTime);
+ var o = Module.cwrap("decodeVideoFrame", "number", ["number", "number", "number", "number", "number"])(t.corePtr, r, n.length, a, s, t.frameCallTag);
+ o > 0 && (i = o), Module._free(r), r = null
+ }
+ } else i = Module.cwrap("naluLListLength", "number", ["number"])(t.corePtr)
+ }), e)
+ }
+ }, {
+ key: "_decVFrameIntervalFunc",
+ value: function() {
+ null == this.decVFrameInterval && this._createDecVframeInterval(10)
+ }
+ }, {
+ key: "_frameCallback",
+ value: function(e, t, i, n, r, a, s, o, u, l) {
+ if (this._videoQueue.length, !1 === this.openFrameCall) return -1;
+ if (l !== this.frameCallTag) return -2;
+ if (u > this.yuvMaxTime + this.frameDur) return -3;
+ if (this.isNewSeek && this.seekTarget - u > 3 * this.frameDur) return -4;
+ var h = this._videoQueue.length;
+ if (this.canvas.width == n && this.canvas.height == o || (this.canvas.width = n, this.canvas.height = o, this.isCheckDisplay) || this._checkDisplaySize(s, n, o), this.playPTS > u) return -5;
+ var d = Module.HEAPU8.subarray(e, e + n * o),
+ f = Module.HEAPU8.subarray(t, t + r * o / 2),
+ p = Module.HEAPU8.subarray(i, i + a * o / 2),
+ m = new Uint8Array(d),
+ _ = new Uint8Array(f),
+ g = new Uint8Array(p),
+ v = new c(m, _, g, n, r, a, s, o, u);
+ if (h <= 0 || u > this._videoQueue[h - 1].pts) this._videoQueue.push(v);
+ else if (u < this._videoQueue[0].pts) this._videoQueue.splice(0, 0, v);
+ else if (u < this._videoQueue[h - 1].pts)
+ for (var y = 0; y < h; y++)
+ if (u > this._videoQueue[y].pts && y + 1 < h && u < this._videoQueue[y + 1].pts) {
+ this._videoQueue.splice(y + 1, 0, v);
+ break
+ } return this._videoQueue, this.vCachePTS = Math.max(u, this.vCachePTS), this.onCacheProcess && this.onCacheProcess(this.getCachePTS()), this.config.readyShow && !0 === this.playYUV() && (this.config.readyShow = !1, this.onReadyShowDone && this.onReadyShowDone()), 0
+ }
+ }, {
+ key: "_handleFrameYUVCallback",
+ value: function(e, t, i, n, r, a, s, o, u, l) {
+ var h = new Uint8Array(e),
+ d = new Uint8Array(t),
+ f = new Uint8Array(i);
+ if (!(!1 === this.openFrameCall || l !== this.frameCallTag || u > this.yuvMaxTime + this.frameDur || this.isNewSeek && this.seekTarget - u > 3 * this.frameDur)) {
+ var p = this._videoQueue.length;
+ if (this.canvas.width == n && this.canvas.height == o || (this.canvas.width = n, this.canvas.height = o, this.isCheckDisplay) || this._checkDisplaySize(s, n, o), !(this.playPTS > u)) {
+ var m = new c(h, d, f, n, r, a, s, o, u);
+ if (p <= 0 || u > this._videoQueue[p - 1].pts) this._videoQueue.push(m);
+ else if (u < this._videoQueue[0].pts) this._videoQueue.splice(0, 0, m);
+ else if (u < this._videoQueue[p - 1].pts)
+ for (var _ = 0; _ < p; _++)
+ if (u > this._videoQueue[_].pts && _ + 1 < p && u < this._videoQueue[_ + 1].pts) {
+ this._videoQueue.splice(_ + 1, 0, m);
+ break
+ } this._videoQueue, this.vCachePTS = Math.max(u, this.vCachePTS), this.onCacheProcess && this.onCacheProcess(this.getCachePTS()), this.config.readyShow && !0 === this.playYUV() && (this.config.readyShow = !1, this.onReadyShowDone && this.onReadyShowDone())
+ }
+ }
+ }
+ }, {
+ key: "playYUV",
+ value: function() {
+ if (this._videoQueue.length > 0) {
+ var e = this._videoQueue.shift();
+ return e.pts, this.onRender && this.onRender(e.line1, e.height, e.data_y, e.data_u, e.data_v), o.renderFrame(this.yuv, e.data_y, e.data_u, e.data_v, e.line1, e.height), !0
+ }
+ return !1
+ }
+ }, {
+ key: "setProbeSize",
+ value: function(e) {
+ this.probeSize = e
+ }
+ }, {
+ key: "pushBuffer",
+ value: function(e) {
+ if (void 0 === this.corePtr || null === this.corePtr) return -1;
+ var t = Module._malloc(e.length);
+ Module.HEAP8.set(e, t);
+ var i = Module.cwrap("pushSniffStreamData", "number", ["number", "number", "number", "number"])(this.corePtr, t, e.length, this.probeSize);
+ return i
+ }
+ }]) && n(t.prototype, i), f && n(t, f), e
+ }();
+ i.CNativeCore = f
+ }, {
+ "../consts": 52,
+ "../demuxer/buffer": 66,
+ "../demuxer/bufferFrame": 67,
+ "../render-engine/webgl-420p": 81,
+ "../version": 84,
+ "./audio-core": 54,
+ "./audio-native-core": 55,
+ "./av-common": 56,
+ "./cache": 61,
+ "./cacheYuv": 62
+ }],
+ 60: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ e("../demuxer/bufferFrame"), e("../demuxer/buffer"), e("./cache"), e("./cacheYuv");
+ var r = e("../render-engine/webgl-420p"),
+ a = e("./av-common"),
+ s = (e("./audio-native-core"), e("./audio-core")),
+ o = e("../consts"),
+ u = (e("../version"), function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.config = {
+ width: t.width || o.DEFAULT_WIDTH,
+ height: t.height || o.DEFAULT_HEIGHT,
+ fps: t.fps || o.DEFAULT_FPS,
+ sampleRate: t.sampleRate || o.DEFAULT_SAMPLERATE,
+ playerId: t.playerId || o.DEFAILT_WEBGL_PLAY_ID,
+ token: t.token || null,
+ probeSize: t.probeSize || 4096,
+ ignoreAudio: t.ignoreAudio || 0,
+ autoPlay: t.autoPlay || !1
+ }, this.config.probeSize, this.config.ignoreAudio, this.mediaInfo = {
+ noFPS: !1,
+ fps: o.DEFAULT_FPS,
+ width: this.config.width,
+ height: this.config.height,
+ sampleRate: this.config.sampleRate,
+ size: {
+ width: -1,
+ height: -1
+ },
+ audioNone: !1
+ }, this.duration = -1, this.vCodecID = o.V_CODEC_NAME_HEVC, this.corePtr = null, this.AVGetInterval = null, this.readyShowDone = !1, this.readyKeyFrame = !1, this.cache_status = !1, this.download_length = 0, this.AVGLObj = null, this.canvasBox = document.querySelector("#" + this.config.playerId), this.canvasBox.style.overflow = "hidden", this.CanvasObj = null, this.CanvasObj = document.createElement("canvas"), this.CanvasObj.style.width = this.canvasBox.clientWidth + "px", this.CanvasObj.style.height = this.canvasBox.clientHeight + "px", this.CanvasObj.style.top = "0px", this.CanvasObj.style.left = "0px", this.canvasBox.appendChild(this.CanvasObj), this.audioWAudio = null, this.audioVoice = 1, this.frameTime = 1e3 / this.config.fps, this.NaluBuf = [], this.YuvBuf = [], this.getPackageTimeMS = 0, this.workerFetch = null, this.playInterval = null, this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null;
+ this.totalLen = 0, this.pushPkg = 0, this.showScreen = !1, this.onProbeFinish = null, this.onLoadCache = null, this.onLoadCacheFinshed = null, this.onRender = null, this.onReadyShowDone = null, this.onError = null;
+ this.corePtr = Module.cwrap("AVSniffHttpFlvInit", "number", ["string", "string"])("base64:QXV0aG9yOmNoYW5neWFubG9uZ3xudW1iZXJ3b2xmLEdpdGh1YjpodHRwczovL2dpdGh1Yi5jb20vbnVtYmVyd29sZixFbWFpbDpwb3JzY2hlZ3QyM0Bmb3htYWlsLmNvbSxRUTo1MzEzNjU4NzIsSG9tZVBhZ2U6aHR0cDovL3h2aWRlby52aWRlbyxEaXNjb3JkOm51bWJlcndvbGYjODY5NCx3ZWNoYXI6bnVtYmVyd29sZjExLEJlaWppbmcsV29ya0luOkJhaWR1", "0.0.0"), this.corePtr
+ }
+ var t, i, u;
+ return t = e, (i = [{
+ key: "_workerFetch_onmessage",
+ value: function(e, t) {
+ var i = e.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "fetch-chunk":
+ var n = i.data;
+ t.download_length += n.length, setTimeout((function() {
+ var e = Module._malloc(n.length);
+ Module.HEAP8.set(n, e), Module.cwrap("pushSniffHttpFlvData", "number", ["number", "number", "number", "number"])(t.corePtr, e, n.length, t.config.probeSize), Module._free(e), e = null
+ }), 0), t.totalLen += n.length, n.length > 0 && (t.getPackageTimeMS = a.GetMsTime()), t.pushPkg++, void 0 !== t.AVGetInterval && null !== t.AVGetInterval || (t.AVGetInterval = window.setInterval((function() {
+ Module.cwrap("getBufferLengthApi", "number", ["number"])(t.corePtr) > t.config.probeSize && (Module.cwrap("getSniffHttpFlvPkg", "number", ["number"])(t.corePtr), t.pushPkg -= 1)
+ }), 5));
+ break;
+ case "close":
+ t.AVGetInterval && clearInterval(t.AVGetInterval), t.AVGetInterval = null;
+ case "fetch-fin":
+ break;
+ case "fetch-error":
+ t.onError && t.onError(i.data)
+ }
+ }
+ }, {
+ key: "_checkDisplaySize",
+ value: function(e, t, i) {
+ var n = t - e,
+ r = this.config.width + Math.ceil(n / 2),
+ a = t / this.config.width > i / this.config.height,
+ s = (r / t).toFixed(2),
+ o = (this.config.height / i).toFixed(2),
+ u = a ? s : o,
+ l = this.config.fixed,
+ h = l ? r : parseInt(t * u),
+ d = l ? this.config.height : parseInt(i * u);
+ if (this.CanvasObj.offsetWidth != h || this.CanvasObj.offsetHeight != d) {
+ var c = parseInt((this.canvasBox.offsetHeight - d) / 2),
+ f = parseInt((this.canvasBox.offsetWidth - h) / 2);
+ c = c < 0 ? 0 : c, f = f < 0 ? 0 : f, this.CanvasObj.style.marginTop = c + "px", this.CanvasObj.style.marginLeft = f + "px", this.CanvasObj.style.width = h + "px", this.CanvasObj.style.height = d + "px"
+ }
+ return this.isCheckDisplay = !0, [h, d]
+ }
+ }, {
+ key: "_ptsFixed2",
+ value: function(e) {
+ return Math.ceil(100 * e) / 100
+ }
+ }, {
+ key: "_callbackProbe",
+ value: function(e, t, i, n, r, a, u, l, h) {
+ for (var d = Module.HEAPU8.subarray(h, h + 10), c = 0; c < d.length; c++) String.fromCharCode(d[c]);
+ var f = n;
+ n > 100 && (f = o.DEFAULT_FPS, this.mediaInfo.noFPS = !0), this.vCodecID = l, this.config.fps = f, this.mediaInfo.fps = f, this.mediaInfo.size.width = t, this.mediaInfo.size.height = i, this.frameTime = Math.floor(1e3 / (this.mediaInfo.fps + 2)), this.CanvasObj.width == t && this.CanvasObj.height == i || (this.CanvasObj.width = t, this.CanvasObj.height = i, this.isCheckDisplay) || this._checkDisplaySize(t, t, i), r >= 0 && !1 === this.mediaInfo.noFPS && this.config.ignoreAudio < 1 ? (void 0 !== this.audioWAudio && null !== this.audioWAudio && (this.audioWAudio.stop(), this.audioWAudio = null), this.config.sampleRate = a, this.mediaInfo.sampleRate = a, this.audioWAudio = s({
+ sampleRate: this.mediaInfo.sampleRate,
+ appendType: o.APPEND_TYPE_FRAME
+ }), this.audioWAudio.isLIVE = !0) : this.mediaInfo.audioNone = !0, this.onProbeFinish && this.onProbeFinish()
+ }
+ }, {
+ key: "_callbackYUV",
+ value: function(e, t, i, n, r, a, s, o, u) {
+ var l = Module.HEAPU8.subarray(e, e + n * o),
+ h = new Uint8Array(l),
+ d = Module.HEAPU8.subarray(t, t + r * o / 2),
+ c = new Uint8Array(d),
+ f = Module.HEAPU8.subarray(i, i + a * o / 2),
+ p = {
+ bufY: h,
+ bufU: c,
+ bufV: new Uint8Array(f),
+ line_y: n,
+ h: o,
+ pts: u
+ };
+ this.YuvBuf.push(p), this.checkCacheState(), Module._free(l), l = null, Module._free(d), d = null, Module._free(f), f = null, !1 === this.readyShowDone && !0 === this.playYUV() && (this.readyShowDone = !0, this.onReadyShowDone && this.onReadyShowDone(), this.audioWAudio || this.play())
+ }
+ }, {
+ key: "_callbackNALU",
+ value: function(e, t, i, n, r, a, s) {
+ if (!1 === this.readyKeyFrame) {
+ if (i <= 0) return;
+ this.readyKeyFrame = !0
+ }
+ var o = Module.HEAPU8.subarray(e, e + t),
+ u = new Uint8Array(o);
+ this.NaluBuf.push({
+ bufData: u,
+ len: t,
+ isKey: i,
+ w: n,
+ h: r,
+ pts: 1e3 * a,
+ dts: 1e3 * s
+ }), Module._free(o), o = null
+ }
+ }, {
+ key: "_callbackPCM",
+ value: function(e) {}
+ }, {
+ key: "_callbackAAC",
+ value: function(e, t, i, n) {
+ var r = this._ptsFixed2(n);
+ if (this.audioWAudio) {
+ var a = Module.HEAPU8.subarray(e, e + t),
+ s = {
+ pts: r,
+ data: new Uint8Array(a)
+ };
+ this.audioWAudio.addSample(s), this.checkCacheState()
+ }
+ }
+ }, {
+ key: "_decode",
+ value: function() {
+ var e = this;
+ setTimeout((function() {
+ if (null !== e.workerFetch) {
+ var t = e.NaluBuf.shift();
+ if (null != t) {
+ var i = Module._malloc(t.bufData.length);
+ Module.HEAP8.set(t.bufData, i), Module.cwrap("decodeHttpFlvVideoFrame", "number", ["number", "number", "number", "number", "number"])(e.corePtr, i, t.bufData.length, t.pts, t.dts, 0), Module._free(i), i = null
+ }
+ e._decode()
+ }
+ }), 1)
+ }
+ }, {
+ key: "setScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ this.showScreen = e
+ }
+ }, {
+ key: "checkCacheState",
+ value: function() {
+ var e = this.YuvBuf.length >= 25 && (!0 === this.mediaInfo.audioNone || this.audioWAudio && this.audioWAudio.sampleQueue.length >= 50);
+ return !1 === this.cache_status && e && (this.playInterval && this.audioWAudio && this.audioWAudio.play(), this.onLoadCacheFinshed && this.onLoadCacheFinshed(), this.cache_status = !0), e
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.audioVoice = e, this.audioWAudio && this.audioWAudio.setVoice(e)
+ }
+ }, {
+ key: "_removeBindFuncPtr",
+ value: function() {
+ null !== this._ptr_probeCallback && Module.removeFunction(this._ptr_probeCallback), null !== this._ptr_frameCallback && Module.removeFunction(this._ptr_frameCallback), null !== this._ptr_naluCallback && Module.removeFunction(this._ptr_naluCallback), null !== this._ptr_sampleCallback && Module.removeFunction(this._ptr_sampleCallback), null !== this._ptr_aacCallback && Module.removeFunction(this._ptr_aacCallback), this._ptr_probeCallback = null, this._ptr_frameCallback = null, this._ptr_naluCallback = null, this._ptr_sampleCallback = null, this._ptr_aacCallback = null
+ }
+ }, {
+ key: "release",
+ value: function() {
+ return this.pause(), this.NaluBuf.length = 0, this.YuvBuf.length = 0, void 0 !== this.workerFetch && null !== this.workerFetch && this.workerFetch.postMessage({
+ cmd: "stop",
+ data: "stop",
+ msg: "stop"
+ }), this.workerFetch = null, this.AVGetInterval && clearInterval(this.AVGetInterval), this.AVGetInterval = null, this._removeBindFuncPtr(), void 0 !== this.corePtr && null !== this.corePtr && Module.cwrap("releaseHttpFLV", "number", ["number"])(this.corePtr), this.playInterval && clearInterval(this.playInterval), this.playInterval = null, this.audioWAudio && this.audioWAudio.stop(), this.audioWAudio = null, void 0 !== this.AVGLObj && null !== this.AVGLObj && (r.releaseContext(this.AVGLObj), this.AVGLObj = null), this.CanvasObj && this.CanvasObj.remove(), this.CanvasObj = null, window.onclick = document.body.onclick = null, 0
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return null !== this.playInterval && void 0 !== this.playInterval
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.audioWAudio && this.audioWAudio.pause(), this.playInterval && clearInterval(this.playInterval), this.playInterval = null
+ }
+ }, {
+ key: "playYUV",
+ value: function() {
+ if (this.YuvBuf.length > 0) {
+ var e = this.YuvBuf.shift();
+ return this.onRender && this.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), r.renderFrame(this.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h), !0
+ }
+ return !1
+ }
+ }, {
+ key: "play",
+ value: function() {
+ var e = this,
+ t = this;
+ if (!1 === this.checkCacheState()) return this.onLoadCache && this.onLoadCache(), setTimeout((function() {
+ e.play()
+ }), 100), !1;
+ if (void 0 === this.playInterval || null === this.playInterval) {
+ var i = 0,
+ n = 0,
+ s = 0;
+ !1 === this.mediaInfo.audioNone && this.audioWAudio && !1 === this.mediaInfo.noFPS ? (this.playInterval = setInterval((function() {
+ if (n = a.GetMsTime(), t.cache_status) {
+ if (n - i >= t.frameTime - s) {
+ var e = t.YuvBuf.shift();
+ if (null != e && null !== e) {
+ var o = 0;
+ null !== t.audioWAudio && void 0 !== t.audioWAudio && (o = 1e3 * (e.pts - t.audioWAudio.getAlignVPTS())), s = t.audioWAudio ? o < 0 && -1 * o <= t.frameTime || o >= 0 ? a.GetMsTime() - n + 1 : t.frameTime : a.GetMsTime() - n + 1, t.showScreen && t.onRender && t.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), e.pts, r.renderFrame(t.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h)
+ }(t.YuvBuf.length <= 0 || t.audioWAudio && t.audioWAudio.sampleQueue.length <= 0) && (t.cache_status = !1, t.onLoadCache && t.onLoadCache(), t.audioWAudio && t.audioWAudio.pause()), i = n
+ }
+ } else s = t.frameTime
+ }), 1), this.audioWAudio && this.audioWAudio.play()) : this.playInterval = setInterval((function() {
+ var e = t.YuvBuf.shift();
+ null != e && null !== e && (t.showScreen && t.onRender && t.onRender(e.line_y, e.h, e.bufY, e.bufU, e.bufV), r.renderFrame(t.AVGLObj, e.bufY, e.bufU, e.bufV, e.line_y, e.h)), t.YuvBuf.length <= 0 && (t.cache_status = !1)
+ }), t.frameTime)
+ }
+ }
+ }, {
+ key: "start",
+ value: function(e) {
+ var t = this;
+ this.workerFetch = new Worker(a.GetScriptPath((function() {
+ var e = null;
+ self, self.onmessage = function(t) {
+ var i = t.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "start":
+ var n = i.data;
+ (e = new WebSocket(n)).binaryType = "arraybuffer", e.onopen = function(t) {
+ e.send("Hello WebSockets!")
+ }, e.onmessage = function(e) {
+ if (e.data instanceof ArrayBuffer) {
+ var t = e.data;
+ t.byteLength > 0 && postMessage({
+ cmd: "fetch-chunk",
+ data: new Uint8Array(t),
+ msg: "fetch-chunk"
+ })
+ }
+ }, e.onclose = function(e) {};
+ break;
+ case "stop":
+ e && e.close(), self.close(), self.postMessage({
+ cmd: "close",
+ data: "close",
+ msg: "close"
+ })
+ }
+ }
+ }))), this.workerFetch.onmessage = function(e) {
+ t._workerFetch_onmessage(e, t)
+ }, this.workerFetch, this._ptr_probeCallback = Module.addFunction(this._callbackProbe.bind(this)), this._ptr_yuvCallback = Module.addFunction(this._callbackYUV.bind(this)), this._ptr_naluCallback = Module.addFunction(this._callbackNALU.bind(this)), this._ptr_sampleCallback = Module.addFunction(this._callbackPCM.bind(this)), this._ptr_aacCallback = Module.addFunction(this._callbackAAC.bind(this)), Module.cwrap("initializeSniffHttpFlvModule", "number", ["number", "number", "number", "number", "number", "number"])(this.corePtr, this._ptr_probeCallback, this._ptr_yuvCallback, this._ptr_naluCallback, this._ptr_sampleCallback, this._ptr_aacCallback), this.AVGLObj = r.setupCanvas(this.CanvasObj, {
+ preserveDrawingBuffer: !1
+ }), this.workerFetch.postMessage({
+ cmd: "start",
+ data: e,
+ msg: "start"
+ }), this._decode()
+ }
+ }]) && n(t.prototype, i), u && n(t, u), e
+ }());
+ i.CWsLiveCore = u
+ }, {
+ "../consts": 52,
+ "../demuxer/buffer": 66,
+ "../demuxer/bufferFrame": 67,
+ "../render-engine/webgl-420p": 81,
+ "../version": 84,
+ "./audio-core": 54,
+ "./audio-native-core": 55,
+ "./av-common": 56,
+ "./cache": 61,
+ "./cacheYuv": 62
+ }],
+ 61: [function(e, t, i) {
+ (function(i) {
+ "use strict";
+ e("./cacheYuv");
+ i.CACHE_APPEND_STATUS_CODE = {
+ FAILED: -1,
+ OVERFLOW: -2,
+ OK: 0,
+ NOT_FULL: 1,
+ FULL: 2,
+ NULL: 3
+ }, t.exports = function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 60,
+ t = {
+ limit: e,
+ yuvCache: [],
+ appendCacheByCacheYuv: function(e) {
+ e.pts;
+ return t.yuvCache.length >= t.limit ? CACHE_APPEND_STATUS_CODE.OVERFLOW : (t.yuvCache.push(e), t.yuvCache.length >= t.limit ? CACHE_APPEND_STATUS_CODE.FULL : CACHE_APPEND_STATUS_CODE.NOT_FULL)
+ },
+ getState: function() {
+ return t.yuvCache.length <= 0 ? CACHE_APPEND_STATUS_CODE.NULL : t.yuvCache.length >= t.limit ? CACHE_APPEND_STATUS_CODE.FULL : CACHE_APPEND_STATUS_CODE.NOT_FULL
+ },
+ cleanPipeline: function() {
+ t.yuvCache.length = 0
+ },
+ vYuv: function() {
+ return t.yuvCache.length <= 0 ? null : t.yuvCache.shift()
+ }
+ };
+ return t
+ }
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {
+ "./cacheYuv": 62
+ }],
+ 62: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = function() {
+ function e(t, i, n, r, a, s) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.pts = t, this.width = i, this.height = n, this.imageBufferY = r, this.imageBufferB = a, this.imageBufferR = s
+ }
+ var t, i, r;
+ return t = e, (i = [{
+ key: "setYuv",
+ value: function(e, t, i, n, r, a) {
+ this.pts = e, this.width = t, this.height = i, this.imageBufferY = n, this.imageBufferB = r, this.imageBufferR = a
+ }
+ }]) && n(t.prototype, i), r && n(t, r), e
+ }();
+ i.CacheYuvStruct = r
+ }, {}],
+ 63: [function(e, t, i) {
+ "use strict";
+ t.exports = {
+ HEVC_NAL_TRAIL_N: 0,
+ HEVC_NAL_TRAIL_R: 1,
+ HEVC_NAL_TSA_N: 2,
+ HEVC_NAL_TSA_R: 3,
+ HEVC_NAL_STSA_N: 4,
+ HEVC_NAL_STSA_R: 5,
+ HEVC_NAL_RADL_N: 6,
+ HEVC_NAL_RADL_R: 7,
+ HEVC_NAL_RASL_N: 8,
+ HEVC_NAL_RASL_R: 9,
+ HEVC_NAL_VCL_N10: 10,
+ HEVC_NAL_VCL_R11: 11,
+ HEVC_NAL_VCL_N12: 12,
+ HEVC_NAL_VCL_R13: 13,
+ HEVC_NAL_VCL_N14: 14,
+ HEVC_NAL_VCL_R15: 15,
+ HEVC_NAL_BLA_W_LP: 16,
+ HEVC_NAL_BLA_W_RADL: 17,
+ HEVC_NAL_BLA_N_LP: 18,
+ HEVC_NAL_IDR_W_RADL: 19,
+ HEVC_NAL_IDR_N_LP: 20,
+ HEVC_NAL_CRA_NUT: 21,
+ HEVC_NAL_IRAP_VCL22: 22,
+ HEVC_NAL_IRAP_VCL23: 23,
+ HEVC_NAL_RSV_VCL24: 24,
+ HEVC_NAL_RSV_VCL25: 25,
+ HEVC_NAL_RSV_VCL26: 26,
+ HEVC_NAL_RSV_VCL27: 27,
+ HEVC_NAL_RSV_VCL28: 28,
+ HEVC_NAL_RSV_VCL29: 29,
+ HEVC_NAL_RSV_VCL30: 30,
+ HEVC_NAL_RSV_VCL31: 31,
+ HEVC_NAL_VPS: 32,
+ HEVC_NAL_SPS: 33,
+ HEVC_NAL_PPS: 34,
+ HEVC_NAL_AUD: 35,
+ HEVC_NAL_EOS_NUT: 36,
+ HEVC_NAL_EOB_NUT: 37,
+ HEVC_NAL_FD_NUT: 38,
+ HEVC_NAL_SEI_PREFIX: 39,
+ HEVC_NAL_SEI_SUFFIX: 40,
+ HEVC_NAL_RSV_NVCL41: 41,
+ HEVC_NAL_RSV_NVCL42: 42,
+ HEVC_NAL_RSV_NVCL43: 43,
+ HEVC_NAL_RSV_NVCL44: 44,
+ HEVC_NAL_RSV_NVCL45: 45,
+ HEVC_NAL_RSV_NVCL46: 46,
+ HEVC_NAL_RSV_NVCL47: 47,
+ HEVC_NAL_UNSPEC48: 48,
+ HEVC_NAL_UNSPEC49: 49,
+ HEVC_NAL_UNSPEC50: 50,
+ HEVC_NAL_UNSPEC51: 51,
+ HEVC_NAL_UNSPEC52: 52,
+ HEVC_NAL_UNSPEC53: 53,
+ HEVC_NAL_UNSPEC54: 54,
+ HEVC_NAL_UNSPEC55: 55,
+ HEVC_NAL_UNSPEC56: 56,
+ HEVC_NAL_UNSPEC57: 57,
+ HEVC_NAL_UNSPEC58: 58,
+ HEVC_NAL_UNSPEC59: 59,
+ HEVC_NAL_UNSPEC60: 60,
+ HEVC_NAL_UNSPEC61: 61,
+ HEVC_NAL_UNSPEC62: 62,
+ HEVC_NAL_UNSPEC63: 63,
+ SOURCE_CODE_VPS: 64,
+ SOURCE_CODE_SPS: 66,
+ SOURCE_CODE_PPS: 68,
+ SOURCE_CODE_SEI: 78,
+ SOURCE_CODE_IDR: 38,
+ SOURCE_CODE_P: 2,
+ SOURCE_CODE_SEI_END: 128,
+ DEFINE_STARTCODE: new Uint8Array([0, 0, 0, 1]),
+ DEFINE_KEY_FRAME: 21,
+ DEFINE_P_FRAME: 9,
+ DEFINE_OTHERS_FRAME: 153
+ }
+ }, {}],
+ 64: [function(e, t, i) {
+ "use strict";
+ var n = e("./hevc-header"),
+ r = [n.HEVC_NAL_VPS, n.HEVC_NAL_SPS, n.HEVC_NAL_PPS, n.HEVC_NAL_SEI_PREFIX];
+ t.exports = {
+ IS_HEV_PS_INFO_CHAR: function(e) {
+ var t = (126 & e) >> 1;
+ return r.indexOf(t)
+ },
+ GET_NALU_TYPE: function(e) {
+ var t = (126 & e) >> 1;
+ if (t >= 1 && t <= 9) return n.DEFINE_P_FRAME;
+ if (t >= 16 && t <= 21) return n.DEFINE_KEY_FRAME;
+ var i = r.indexOf(t);
+ return i >= 0 ? r[i] : n.DEFINE_OTHERS_FRAME
+ },
+ PACK_NALU: function(e) {
+ var t = e.nalu,
+ i = e.vlc.vlc;
+ null == t.vps && (t.vps = new Uint8Array);
+ var n = new Uint8Array(t.vps.length + t.sps.length + t.pps.length + t.sei.length + i.length);
+ return n.set(t.vps, 0), n.set(t.sps, t.vps.length), n.set(t.pps, t.vps.length + t.sps.length), n.set(t.sei, t.vps.length + t.sps.length + t.pps.length), n.set(i, t.vps.length + t.sps.length + t.pps.length + t.sei.length), n
+ }
+ }
+ }, {
+ "./hevc-header": 63
+ }],
+ 65: [function(e, t, i) {
+ "use strict";
+
+ function n(e) {
+ return function(e) {
+ if (Array.isArray(e)) {
+ for (var t = 0, i = new Array(e.length); t < e.length; t++) i[t] = e[t];
+ return i
+ }
+ }(e) || function(e) {
+ if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) return Array.from(e)
+ }(e) || function() {
+ throw new TypeError("Invalid attempt to spread non-iterable instance")
+ }()
+ }
+ var r = e("./av-common"),
+ a = e("./audio-core"),
+ s = e("./cache"),
+ o = e("./cacheYuv"),
+ u = e("../render-engine/webgl-420p"),
+ l = e("../consts"),
+ h = e("../version");
+ t.exports = function(e) {
+ var t = {
+ config: {
+ width: e.width || l.DEFAULT_WIDTH,
+ height: e.height || l.DEFAULT_HEIGHT,
+ fps: e.fps || l.DEFAULT_FPS,
+ fixed: e.fixed || l.DEFAULT_FIXED,
+ sampleRate: e.sampleRate || l.DEFAULT_SAMPLERATE,
+ appendHevcType: e.appendHevcType || l.APPEND_TYPE_STREAM,
+ frameDurMs: e.frameDur || l.DEFAULT_FRAME_DUR,
+ playerId: e.playerId || l.DEFAILT_WEBGL_PLAY_ID,
+ audioNone: e.audioNone || !1,
+ token: e.token || null,
+ videoCodec: e.videoCodec || l.CODEC_H265
+ },
+ vcodecerPtr: null,
+ videoCallback: null,
+ frameList: [],
+ cacheInterval: null,
+ cacheYuvBuf: s(30),
+ nowPacket: null,
+ stream: new Uint8Array,
+ vCodecID: l.V_CODEC_NAME_HEVC,
+ audio: null,
+ liveStartMs: -1,
+ durationMs: -1,
+ videoPTS: 0,
+ loop: null,
+ debugYUVSwitch: !1,
+ debugID: null,
+ cacheLoop: null,
+ playParams: {
+ seekPos: -1,
+ mode: l.PLAYER_MODE_VOD,
+ accurateSeek: !0,
+ seekEvent: !1,
+ realPlay: !0
+ },
+ calcuteStartTime: -1,
+ fix_poc_err_skip: 0,
+ frameTime: 0,
+ frameTimeSec: 0,
+ preCostTime: 0,
+ realVolume: 1,
+ isPlaying: !1,
+ isCaching: l.CACHE_NO_LOADCACHE,
+ isNewSeek: !1,
+ flushDecoder: 0,
+ isCheckDisplay: !1,
+ isPlayLoadingFinish: 0,
+ vCachePTS: 0,
+ aCachePTS: 0,
+ showScreen: !1,
+ noCacheFrame: 0,
+ onPlayingTime: null,
+ onPlayingFinish: null,
+ onSeekFinish: null,
+ onLoadCache: null,
+ onLoadCacheFinshed: null,
+ onRender: null,
+ setScreen: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ null != t && (t.showScreen = e)
+ },
+ setSize: function(e, i) {
+ t.config.width = e || l.DEFAULT_WIDTH, t.config.height = i || l.DEFAULT_HEIGHT
+ },
+ setFrameRate: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 25;
+ t.config.fps = e, t.config.frameDurMs = 1e3 / e
+ },
+ setDurationMs: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ t.durationMs = e, 0 == t.config.audioNone && t.audio.setDurationMs(e)
+ },
+ setPlayingCall: function(e) {
+ t.onPlayingTime = e
+ },
+ setVoice: function(e) {
+ t.realVolume = e, 0 == t.config.audioNone && t.audio.setVoice(t.realVolume)
+ },
+ isPlayingState: function() {
+ return t.isPlaying || t.isCaching === l.CACHE_WITH_PLAY_SIGN
+ },
+ appendAACFrame: function(e) {
+ t.audio.addSample(e), t.aCachePTS = Math.max(e.pts, t.aCachePTS)
+ },
+ appendHevcFrame: function(e) {
+ var i;
+ t.config.appendHevcType == l.APPEND_TYPE_STREAM ? t.stream = new Uint8Array((i = n(t.stream)).concat.apply(i, n(e))) : t.config.appendHevcType == l.APPEND_TYPE_FRAME && (t.frameList.push(e), t.vCachePTS = Math.max(e.pts, t.vCachePTS))
+ },
+ getCachePTS: function() {
+ return Math.max(t.vCachePTS, t.aCachePTS)
+ },
+ endAudio: function() {
+ 0 == t.config.audioNone && t.audio.stop()
+ },
+ cleanSample: function() {
+ 0 == t.config.audioNone && t.audio.cleanQueue()
+ },
+ cleanVideoQueue: function() {
+ t.config.appendHevcType == l.APPEND_TYPE_STREAM ? t.stream = new Uint8Array : t.config.appendHevcType == l.APPEND_TYPE_FRAME && (t.frameList = [], t.frameList.length = 0)
+ },
+ cleanCacheYUV: function() {
+ t.cacheYuvBuf.cleanPipeline()
+ },
+ pause: function() {
+ t.loop && window.clearInterval(t.loop), t.loop = null, 0 == t.config.audioNone && t.audio.pause(), t.isPlaying = !1, t.isCaching === l.CACHE_WITH_PLAY_SIGN && (t.isCaching = l.CACHE_WITH_NOPLAY_SIGN)
+ },
+ checkFinished: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : l.PLAYER_MODE_VOD;
+ return e == l.PLAYER_MODE_VOD && t.cacheYuvBuf.yuvCache.length <= 0 && (t.videoPTS.toFixed(1) >= (t.durationMs - t.config.frameDurMs) / 1e3 || t.noCacheFrame >= 10) && (null != t.onPlayingFinish && (l.PLAYER_MODE_VOD, t.frameList.length, t.cacheYuvBuf.yuvCache.length, t.videoPTS.toFixed(1), t.durationMs, t.config.frameDurMs, t.noCacheFrame, t.onPlayingFinish()), !0)
+ },
+ clearAllCache: function() {
+ t.nowPacket = null, t.vCachePTS = 0, t.aCachePTS = 0, t.cleanSample(), t.cleanVideoQueue(), t.cleanCacheYUV()
+ },
+ seek: function(e) {
+ var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
+ n = t.isPlaying;
+ t.pause(), t.stopCacheThread(), t.clearAllCache(), e && e(), t.isNewSeek = !0, t.flushDecoder = 1, t.videoPTS = parseInt(i.seekTime);
+ var r = {
+ seekPos: i.seekTime || -1,
+ mode: i.mode || l.PLAYER_MODE_VOD,
+ accurateSeek: i.accurateSeek || !0,
+ seekEvent: i.seekEvent || !0,
+ realPlay: n
+ };
+ t.cacheThread(), t.play(r)
+ },
+ getNalu1Packet: function() {
+ var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
+ i = null,
+ n = -1;
+ if (t.config.appendHevcType == l.APPEND_TYPE_STREAM) i = t.nextNalu();
+ else {
+ if (t.config.appendHevcType != l.APPEND_TYPE_FRAME) return null;
+ var r = t.frameList.shift();
+ if (!r) return null;
+ i = r.data, n = r.pts, e && (t.videoPTS = n)
+ }
+ return {
+ nalBuf: i,
+ pts: n
+ }
+ },
+ decodeNalu1Frame: function(e, i) {
+ var n = Module._malloc(e.length);
+ Module.HEAP8.set(e, n);
+ var r = parseInt(1e3 * i);
+ Module.cwrap("decodeCodecContext", "number", ["number", "number", "number", "number", "number"])(t.vcodecerPtr, n, e.length, r, t.flushDecoder);
+ return t.flushDecoder = 0, Module._free(n), n = null, !1
+ },
+ cacheThread: function() {
+ t.cacheLoop = window.setInterval((function() {
+ if (t.cacheYuvBuf.getState() != CACHE_APPEND_STATUS_CODE.FULL) {
+ var e = t.getNalu1Packet(!1);
+ if (null != e) {
+ var i = e.nalBuf,
+ n = e.pts;
+ t.decodeNalu1Frame(i, n, !0)
+ }
+ }
+ }), 10)
+ },
+ stopCacheThread: function() {
+ null !== t.cacheLoop && (window.clearInterval(t.cacheLoop), t.cacheLoop = null)
+ },
+ loadCache: function() {
+ if (!(t.frameList.length <= 3)) {
+ var e = t.isPlaying;
+ if (t.cacheYuvBuf.yuvCache.length <= 3) {
+ t.pause(), null != t.onLoadCache && t.onLoadCache(), t.isCaching = e ? l.CACHE_WITH_PLAY_SIGN : l.CACHE_WITH_NOPLAY_SIGN;
+ var i = t.frameList.length > 30 ? 30 : t.frameList.length;
+ null === t.cacheInterval && (t.cacheInterval = window.setInterval((function() {
+ t.cacheYuvBuf.yuvCache.length >= i && (null != t.onLoadCacheFinshed && t.onLoadCacheFinshed(), window.clearInterval(t.cacheInterval), t.cacheInterval = null, t.isCaching === l.CACHE_WITH_PLAY_SIGN && t.play(t.playParams), t.isCaching = l.CACHE_NO_LOADCACHE)
+ }), 40))
+ }
+ }
+ },
+ playFunc: function() {
+ var e = !1;
+ if (t.playParams.seekEvent || r.GetMsTime() - t.calcuteStartTime >= t.frameTime - t.preCostTime) {
+ e = !0;
+ var i = !0;
+ if (t.calcuteStartTime = r.GetMsTime(), t.config.audioNone) t.playFrameYUV(i, t.playParams.accurateSeek);
+ else {
+ t.fix_poc_err_skip > 0 && (t.fix_poc_err_skip--, i = !1);
+ var n = t.videoPTS - t.audio.getAlignVPTS();
+ if (n > 0) return void(t.playParams.seekEvent && !t.config.audioNone && t.audio.setVoice(0));
+ if (i) {
+ if (!(i = -1 * n <= 1 * t.frameTimeSec)) {
+ for (var a = parseInt(n / t.frameTimeSec), s = 0; s < a; s++) t.playFrameYUV(!1, t.playParams.accurateSeek);
+ t.playFrameYUV(!0, t.playParams.accurateSeek)
+ }
+ t.playFrameYUV(i, t.playParams.accurateSeek)
+ }
+ }
+ }
+ return t.playParams.seekEvent && (t.playParams.seekEvent = !1, t.onSeekFinish(), t.isPlaying || (t.playFrameYUV(!0, t.playParams.accurateSeek), t.pause()), t.config.audioNone || t.audio.setVoice(t.realVolume)), t.onPlayingTime && t.onPlayingTime(t.videoPTS), t.checkFinished(t.playParams.mode), e
+ },
+ play: function(e) {
+ if (t.playParams = e, t.calcuteStartTime = r.GetMsTime(), t.noCacheFrame = 0, t.isPlaying = t.playParams.realPlay, !0 === t.config.audioNone && t.playParams.mode == l.PLAYER_MODE_NOTIME_LIVE) {
+ t.liveStartMs = r.GetMsTime(), t.frameTime = Math.floor(1e3 / t.config.fps), t.frameTimeSec = t.frameTime / 1e3;
+ var i = 0;
+ t.loop = window.setInterval((function() {
+ var e = r.GetMsTime() - t.liveStartMs,
+ n = e / t.frameTime;
+ n >= i && (t.playFrameYUV(!0, t.playParams.accurateSeek), i += 1)
+ }), 1)
+ } else t.videoPTS >= t.playParams.seekPos && !t.isNewSeek || 0 === t.playParams.seekPos || 0 === t.playParams.seekPos ? (t.frameTime = 1e3 / t.config.fps, t.frameTimeSec = t.frameTime / 1e3, 0 == t.config.audioNone && t.audio.play(), t.realVolume = t.config.audioNone ? 0 : t.audio.voice, t.playParams.seekEvent && (t.fix_poc_err_skip = 10), t.loop = window.setInterval((function() {
+ var e = r.GetMsTime();
+ t.playFunc(), t.preCostTime = r.GetMsTime() - e
+ }), 1)) : (t.loop = window.setInterval((function() {
+ t.playFrameYUV(!1, t.playParams.accurateSeek), t.checkFinished(t.playParams.mode) ? (window.clearInterval(t.loop), t.loop = null) : t.videoPTS >= t.playParams.seekPos && (window.clearInterval(t.loop), t.loop = null, t.play(t.playParams))
+ }), 1), t.isNewSeek = !1)
+ },
+ stop: function() {
+ t.release(), Module.cwrap("initializeDecoder", "number", ["number"])(t.vcodecerPtr), t.stream = new Uint8Array
+ },
+ release: function() {
+ return void 0 !== t.yuv && null !== t.yuv && (u.releaseContext(t.yuv), t.yuv = null), t.endAudio(), t.cacheLoop && window.clearInterval(t.cacheLoop), t.cacheLoop = null, t.loop && window.clearInterval(t.loop), t.loop = null, t.pause(), null !== t.videoCallback && Module.removeFunction(t.videoCallback), t.videoCallback = null, Module.cwrap("release", "number", ["number"])(t.vcodecerPtr), t.stream = null, t.frameList.length = 0, t.durationMs = -1, t.videoPTS = 0, t.isPlaying = !1, t.canvas.remove(), t.canvas = null, window.onclick = document.body.onclick = null, !0
+ },
+ nextNalu: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ if (t.stream.length <= 4) return !1;
+ for (var i = -1, n = 0; n < t.stream.length; n++) {
+ if (n + 5 >= t.stream.length) {
+ if (-1 == i) return !1;
+ var r = t.stream.subarray(i);
+ return t.stream = new Uint8Array, r
+ }
+ var a = "0 0 1" == t.stream.slice(0, 3).join(" "),
+ s = "0 0 0 1" == t.stream.slice(0, 4).join(" ");
+ if (a || s) {
+ if (-1 == i) i = n;
+ else {
+ if (e <= 1) {
+ var o = t.stream.subarray(i, n);
+ return t.stream = t.stream.subarray(n), o
+ }
+ e -= 1
+ }
+ n += 3
+ }
+ }
+ return !1
+ },
+ decodeSendPacket: function(e) {
+ var i = Module._malloc(e.length);
+ Module.HEAP8.set(e, i);
+ var n = Module.cwrap("decodeSendPacket", "number", ["number", "number", "number"])(t.vcodecerPtr, i, e.length);
+ return Module._free(i), n
+ },
+ decodeRecvFrame: function() {
+ return Module.cwrap("decodeRecv", "number", ["number"])(t.vcodecerPtr)
+ },
+ playYUV: function() {
+ return t.playFrameYUV(!0, !0)
+ },
+ playFrameYUV: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
+ i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+ n = t.cacheYuvBuf.vYuv();
+ if (null == n) return t.noCacheFrame += 1, e && !t.playParams.seekEvent && t.loadCache(), !1;
+ t.noCacheFrame = 0;
+ var r = n.pts;
+ return t.videoPTS = r, (!e && i || e) && e && (t.onRender(n.width, n.height, n.imageBufferY, n.imageBufferB, n.imageBufferR), t.drawImage(n.width, n.height, n.imageBufferY, n.imageBufferB, n.imageBufferR)), e && !t.playParams.seekEvent && t.isPlaying && t.loadCache(), !0
+ },
+ drawImage: function(e, i, n, r, a) {
+ if (t.canvas.width === e && t.canvas.height == i || (t.canvas.width = e, t.canvas.height = i), t.showScreen && null != t.onRender && t.onRender(e, i, n, r, a), !t.isCheckDisplay) t.checkDisplaySize(e, i);
+ var s = e * i,
+ o = e / 2 * (i / 2),
+ l = new Uint8Array(s + 2 * o);
+ l.set(n, 0), l.set(r, s), l.set(a, s + o), u.renderFrame(t.yuv, n, r, a, e, i)
+ },
+ debugYUV: function(e) {
+ t.debugYUVSwitch = !0, t.debugID = e
+ },
+ checkDisplaySize: function(e, i) {
+ var n = e / t.config.width > i / t.config.height,
+ r = (t.config.width / e).toFixed(2),
+ a = (t.config.height / i).toFixed(2),
+ s = n ? r : a,
+ o = t.config.fixed,
+ u = o ? t.config.width : parseInt(e * s),
+ l = o ? t.config.height : parseInt(i * s);
+ if (t.canvas.offsetWidth != u || t.canvas.offsetHeight != l) {
+ var h = parseInt((t.canvasBox.offsetHeight - l) / 2),
+ d = parseInt((t.canvasBox.offsetWidth - u) / 2);
+ t.canvas.style.marginTop = h + "px", t.canvas.style.marginLeft = d + "px", t.canvas.style.width = u + "px", t.canvas.style.height = l + "px"
+ }
+ return t.isCheckDisplay = !0, [u, l]
+ },
+ makeWasm: function() {
+ if (null != t.config.token) {
+ t.vcodecerPtr = Module.cwrap("registerPlayer", "number", ["string", "string"])(t.config.token, h.PLAYER_VERSION), t.videoCallback = Module.addFunction((function(e, i, n, r, a, s, u, l, h) {
+ var d = Module.HEAPU8.subarray(e, e + r * l),
+ c = Module.HEAPU8.subarray(i, i + a * l / 2),
+ f = Module.HEAPU8.subarray(n, n + s * l / 2),
+ p = new Uint8Array(d),
+ m = new Uint8Array(c),
+ _ = new Uint8Array(f),
+ g = 1 * h / 1e3,
+ v = new o.CacheYuvStruct(g, r, l, p, m, _);
+ Module._free(d), d = null, Module._free(c), c = null, Module._free(f), f = null, t.cacheYuvBuf.appendCacheByCacheYuv(v)
+ })), Module.cwrap("setCodecType", "number", ["number", "number", "number"])(t.vcodecerPtr, t.config.videoCodec, t.videoCallback);
+ Module.cwrap("initializeDecoder", "number", ["number"])(t.vcodecerPtr)
+ }
+ },
+ makeIt: function() {
+ var e = document.querySelector("div#" + t.config.playerId),
+ i = document.createElement("canvas");
+ i.style.width = e.clientWidth + "px", i.style.height = e.clientHeight + "px", i.style.top = "0px", i.style.left = "0px", e.appendChild(i), t.canvasBox = e, t.canvas = i, t.yuv = u.setupCanvas(i, {
+ preserveDrawingBuffer: !1
+ }), 0 == t.config.audioNone && (t.audio = a({
+ sampleRate: t.config.sampleRate,
+ appendType: t.config.appendHevcType
+ })), t.isPlayLoadingFinish = 1
+ }
+ };
+ return t.makeWasm(), t.makeIt(), t.cacheThread(), t
+ }
+ }, {
+ "../consts": 52,
+ "../render-engine/webgl-420p": 81,
+ "../version": 84,
+ "./audio-core": 54,
+ "./av-common": 56,
+ "./cache": 61,
+ "./cacheYuv": 62
+ }],
+ 66: [function(e, t, i) {
+ "use strict";
+ var n = e("./bufferFrame");
+ t.exports = function() {
+ var e = {
+ videoBuffer: [],
+ audioBuffer: [],
+ idrIdxBuffer: [],
+ appendFrame: function(t, i) {
+ var r = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
+ a = arguments.length > 3 && void 0 !== arguments[3] && arguments[3],
+ s = new n.BufferFrame(t, a, i, r),
+ o = parseInt(t);
+ return r ? (e.videoBuffer.length - 1 >= o ? e.videoBuffer[o].push(s) : e.videoBuffer.push([s]), a && !e.idrIdxBuffer.includes(t) && e.idrIdxBuffer.push(t)) : e.audioBuffer.length - 1 >= o && null != e.audioBuffer[o] && null != e.audioBuffer[o] ? e.audioBuffer[o] && e.audioBuffer[o].push(s) : e.audioBuffer.push([s]), !0
+ },
+ appendFrameWithDts: function(t, i, r) {
+ var a = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
+ s = arguments.length > 4 && void 0 !== arguments[4] && arguments[4],
+ o = n.ConstructWithDts(t, i, s, r, a),
+ u = parseInt(i);
+ return a ? (e.videoBuffer.length - 1 >= u ? e.videoBuffer[u].push(o) : e.videoBuffer.push([o]), s && !e.idrIdxBuffer.includes(i) && e.idrIdxBuffer.push(i)) : e.audioBuffer.length - 1 >= u && null != e.audioBuffer[u] && null != e.audioBuffer[u] ? e.audioBuffer[u] && e.audioBuffer[u].push(o) : e.audioBuffer.push([o]), e.videoBuffer, e.idrIdxBuffer, !0
+ },
+ appendFrameByBufferFrame: function(t) {
+ var i = t.pts,
+ n = parseInt(i);
+ return t.video ? (e.videoBuffer.length - 1 >= n ? e.videoBuffer[n].push(t) : e.videoBuffer.push([t]), isKey && !e.idrIdxBuffer.includes(i) && e.idrIdxBuffer.push(i)) : e.audioBuffer.length - 1 >= n ? e.audioBuffer[n].push(t) : e.audioBuffer.push([t]), !0
+ },
+ cleanPipeline: function() {
+ e.videoBuffer.length = 0, e.audioBuffer.length = 0
+ },
+ vFrame: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ if (!(t < 0 || t > e.videoBuffer.length - 1)) return e.videoBuffer[t]
+ },
+ aFrame: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ if (!(t < 0 || t > e.audioBuffer.length - 1)) return e.audioBuffer[t]
+ },
+ seekIDR: function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1;
+ if (e.idrIdxBuffer, e.videoBuffer, t < 0) return null;
+ if (e.idrIdxBuffer.includes(t)) return t;
+ for (var i = 0; i < e.idrIdxBuffer.length; i++)
+ if (i === e.idrIdxBuffer.length - 1 || e.idrIdxBuffer[i] < t && e.idrIdxBuffer[i + 1] > t || 0 === i && e.idrIdxBuffer[i] >= t) {
+ for (var n = 1; n >= 0; n--) {
+ var r = i - n;
+ if (r >= 0) return e.idrIdxBuffer[r], e.idrIdxBuffer[r]
+ }
+ return e.idrIdxBuffer[i], j, e.idrIdxBuffer[i]
+ }
+ }
+ };
+ return e
+ }
+ }, {
+ "./bufferFrame": 67
+ }],
+ 67: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = function() {
+ function e(t, i, n, r) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.pts = t, this.dts = t, this.isKey = i, this.data = n, this.video = r
+ }
+ var t, i, r;
+ return t = e, (i = [{
+ key: "setFrame",
+ value: function(e, t, i, n) {
+ this.pts = e, this.isKey = t, this.data = i, this.video = n
+ }
+ }]) && n(t.prototype, i), r && n(t, r), e
+ }();
+ i.BufferFrame = r, i.ConstructWithDts = function(e, t, i, n, a) {
+ var s = new r(e, i, n, a);
+ return s.dts = t, s
+ }
+ }, {}],
+ 68: [function(e, t, i) {
+ (function(e) {
+ "use strict";
+
+ 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)
+ }
+ var r, a;
+ r = self, a = function() {
+ return function() {
+ var t = {
+ "./node_modules/es6-promise/dist/es6-promise.js":
+ /*!******************************************************!*\
+ !*** ./node_modules/es6-promise/dist/es6-promise.js ***!
+ \******************************************************/
+ function(t, i, r) {
+ /*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
+ * @version v4.2.8+1e68dce6
+ */
+ t.exports = function() {
+ function t(e) {
+ return "function" == typeof e
+ }
+ var i = Array.isArray ? Array.isArray : function(e) {
+ return "[object Array]" === Object.prototype.toString.call(e)
+ },
+ a = 0,
+ s = void 0,
+ o = void 0,
+ u = function(e, t) {
+ m[a] = e, m[a + 1] = t, 2 === (a += 2) && (o ? o(_) : S())
+ },
+ l = "undefined" != typeof window ? window : void 0,
+ h = l || {},
+ d = h.MutationObserver || h.WebKitMutationObserver,
+ c = "undefined" == typeof self && void 0 !== e && "[object process]" === {}.toString.call(e),
+ f = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel;
+
+ function p() {
+ var e = setTimeout;
+ return function() {
+ return e(_, 1)
+ }
+ }
+ var m = new Array(1e3);
+
+ function _() {
+ for (var e = 0; e < a; e += 2)(0, m[e])(m[e + 1]), m[e] = void 0, m[e + 1] = void 0;
+ a = 0
+ }
+ var g, v, y, b, S = void 0;
+
+ function T(e, t) {
+ var i = this,
+ n = new this.constructor(A);
+ void 0 === n[w] && U(n);
+ var r = i._state;
+ if (r) {
+ var a = arguments[r - 1];
+ u((function() {
+ return D(r, n, a, i._result)
+ }))
+ } else x(i, n, e, t);
+ return n
+ }
+
+ function E(e) {
+ if (e && "object" === n(e) && e.constructor === this) return e;
+ var t = new this(A);
+ return k(t, e), t
+ }
+ c ? S = function() {
+ return e.nextTick(_)
+ } : d ? (v = 0, y = new d(_), b = document.createTextNode(""), y.observe(b, {
+ characterData: !0
+ }), S = function() {
+ b.data = v = ++v % 2
+ }) : f ? ((g = new MessageChannel).port1.onmessage = _, S = function() {
+ return g.port2.postMessage(0)
+ }) : S = void 0 === l ? function() {
+ try {
+ var e = Function("return this")().require("vertx");
+ return void 0 !== (s = e.runOnLoop || e.runOnContext) ? function() {
+ s(_)
+ } : p()
+ } catch (e) {
+ return p()
+ }
+ }() : p();
+ var w = Math.random().toString(36).substring(2);
+
+ function A() {}
+
+ function C(e, i, n) {
+ i.constructor === e.constructor && n === T && i.constructor.resolve === E ? function(e, t) {
+ 1 === t._state ? I(e, t._result) : 2 === t._state ? L(e, t._result) : x(t, void 0, (function(t) {
+ return k(e, t)
+ }), (function(t) {
+ return L(e, t)
+ }))
+ }(e, i) : void 0 === n ? I(e, i) : t(n) ? function(e, t, i) {
+ u((function(e) {
+ var n = !1,
+ r = function(e, t, i, n) {
+ try {
+ e.call(t, i, n)
+ } catch (e) {
+ return e
+ }
+ }(i, t, (function(i) {
+ n || (n = !0, t !== i ? k(e, i) : I(e, i))
+ }), (function(t) {
+ n || (n = !0, L(e, t))
+ }), e._label);
+ !n && r && (n = !0, L(e, r))
+ }), e)
+ }(e, i, n) : I(e, i)
+ }
+
+ function k(e, t) {
+ if (e === t) L(e, new TypeError("You cannot resolve a promise with itself"));
+ else if (a = n(r = t), null === r || "object" !== a && "function" !== a) I(e, t);
+ else {
+ var i = void 0;
+ try {
+ i = t.then
+ } catch (t) {
+ return void L(e, t)
+ }
+ C(e, t, i)
+ }
+ var r, a
+ }
+
+ function P(e) {
+ e._onerror && e._onerror(e._result), R(e)
+ }
+
+ function I(e, t) {
+ void 0 === e._state && (e._result = t, e._state = 1, 0 !== e._subscribers.length && u(R, e))
+ }
+
+ function L(e, t) {
+ void 0 === e._state && (e._state = 2, e._result = t, u(P, e))
+ }
+
+ function x(e, t, i, n) {
+ var r = e._subscribers,
+ a = r.length;
+ e._onerror = null, r[a] = t, r[a + 1] = i, r[a + 2] = n, 0 === a && e._state && u(R, e)
+ }
+
+ function R(e) {
+ var t = e._subscribers,
+ i = e._state;
+ if (0 !== t.length) {
+ for (var n = void 0, r = void 0, a = e._result, s = 0; s < t.length; s += 3) n = t[s], r = t[s + i], n ? D(i, n, r, a) : r(a);
+ e._subscribers.length = 0
+ }
+ }
+
+ function D(e, i, n, r) {
+ var a = t(n),
+ s = void 0,
+ o = void 0,
+ u = !0;
+ if (a) {
+ try {
+ s = n(r)
+ } catch (e) {
+ u = !1, o = e
+ }
+ if (i === s) return void L(i, new TypeError("A promises callback cannot return that same promise."))
+ } else s = r;
+ void 0 !== i._state || (a && u ? k(i, s) : !1 === u ? L(i, o) : 1 === e ? I(i, s) : 2 === e && L(i, s))
+ }
+ var O = 0;
+
+ function U(e) {
+ e[w] = O++, e._state = void 0, e._result = void 0, e._subscribers = []
+ }
+ var M = function() {
+ function e(e, t) {
+ this._instanceConstructor = e, this.promise = new e(A), this.promise[w] || U(this.promise), i(t) ? (this.length = t.length, this._remaining = t.length, this._result = new Array(this.length), 0 === this.length ? I(this.promise, this._result) : (this.length = this.length || 0, this._enumerate(t), 0 === this._remaining && I(this.promise, this._result))) : L(this.promise, new Error("Array Methods must be provided an Array"))
+ }
+ return e.prototype._enumerate = function(e) {
+ for (var t = 0; void 0 === this._state && t < e.length; t++) this._eachEntry(e[t], t)
+ }, e.prototype._eachEntry = function(e, t) {
+ var i = this._instanceConstructor,
+ n = i.resolve;
+ if (n === E) {
+ var r = void 0,
+ a = void 0,
+ s = !1;
+ try {
+ r = e.then
+ } catch (e) {
+ s = !0, a = e
+ }
+ if (r === T && void 0 !== e._state) this._settledAt(e._state, t, e._result);
+ else if ("function" != typeof r) this._remaining--, this._result[t] = e;
+ else if (i === F) {
+ var o = new i(A);
+ s ? L(o, a) : C(o, e, r), this._willSettleAt(o, t)
+ } else this._willSettleAt(new i((function(t) {
+ return t(e)
+ })), t)
+ } else this._willSettleAt(n(e), t)
+ }, e.prototype._settledAt = function(e, t, i) {
+ var n = this.promise;
+ void 0 === n._state && (this._remaining--, 2 === e ? L(n, i) : this._result[t] = i), 0 === this._remaining && I(n, this._result)
+ }, e.prototype._willSettleAt = function(e, t) {
+ var i = this;
+ x(e, void 0, (function(e) {
+ return i._settledAt(1, t, e)
+ }), (function(e) {
+ return i._settledAt(2, t, e)
+ }))
+ }, e
+ }(),
+ F = function() {
+ function e(t) {
+ this[w] = O++, this._result = this._state = void 0, this._subscribers = [], A !== t && ("function" != typeof t && function() {
+ throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")
+ }(), this instanceof e ? function(e, t) {
+ try {
+ t((function(t) {
+ k(e, t)
+ }), (function(t) {
+ L(e, t)
+ }))
+ } catch (t) {
+ L(e, t)
+ }
+ }(this, t) : function() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")
+ }())
+ }
+ return e.prototype.catch = function(e) {
+ return this.then(null, e)
+ }, e.prototype.finally = function(e) {
+ var i = this.constructor;
+ return t(e) ? this.then((function(t) {
+ return i.resolve(e()).then((function() {
+ return t
+ }))
+ }), (function(t) {
+ return i.resolve(e()).then((function() {
+ throw t
+ }))
+ })) : this.then(e, e)
+ }, e
+ }();
+ return F.prototype.then = T, F.all = function(e) {
+ return new M(this, e).promise
+ }, F.race = function(e) {
+ var t = this;
+ return i(e) ? new t((function(i, n) {
+ for (var r = e.length, a = 0; a < r; a++) t.resolve(e[a]).then(i, n)
+ })) : new t((function(e, t) {
+ return t(new TypeError("You must pass an array to race."))
+ }))
+ }, F.resolve = E, F.reject = function(e) {
+ var t = new this(A);
+ return L(t, e), t
+ }, F._setScheduler = function(e) {
+ o = e
+ }, F._setAsap = function(e) {
+ u = e
+ }, F._asap = u, F.polyfill = function() {
+ var e = void 0;
+ if (void 0 !== r.g) e = r.g;
+ else if ("undefined" != typeof self) e = self;
+ else try {
+ e = Function("return this")()
+ } catch (e) {
+ throw new Error("polyfill failed because global object is unavailable in this environment")
+ }
+ var t = e.Promise;
+ if (t) {
+ var i = null;
+ try {
+ i = Object.prototype.toString.call(t.resolve())
+ } catch (e) {}
+ if ("[object Promise]" === i && !t.cast) return
+ }
+ e.Promise = F
+ }, F.Promise = F, F
+ }()
+ },
+ "./node_modules/events/events.js":
+ /*!***************************************!*\
+ !*** ./node_modules/events/events.js ***!
+ \***************************************/
+ function(e) {
+ var t, i = "object" === ("undefined" == typeof Reflect ? "undefined" : n(Reflect)) ? Reflect : null,
+ r = i && "function" == typeof i.apply ? i.apply : function(e, t, i) {
+ return Function.prototype.apply.call(e, t, i)
+ };
+ t = i && "function" == typeof i.ownKeys ? i.ownKeys : Object.getOwnPropertySymbols ? function(e) {
+ return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))
+ } : function(e) {
+ return Object.getOwnPropertyNames(e)
+ };
+ var a = Number.isNaN || function(e) {
+ return e != e
+ };
+
+ function s() {
+ s.init.call(this)
+ }
+ e.exports = s, e.exports.once = function(e, t) {
+ return new Promise((function(i, n) {
+ function r(i) {
+ e.removeListener(t, a), n(i)
+ }
+
+ function a() {
+ "function" == typeof e.removeListener && e.removeListener("error", r), i([].slice.call(arguments))
+ }
+ _(e, t, a, {
+ once: !0
+ }), "error" !== t && function(e, t, i) {
+ "function" == typeof e.on && _(e, "error", t, i)
+ }(e, r, {
+ once: !0
+ })
+ }))
+ }, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
+ var o = 10;
+
+ function u(e) {
+ if ("function" != typeof e) throw new TypeError('The "listener" argument must be of type Function. Received type ' + n(e))
+ }
+
+ function l(e) {
+ return void 0 === e._maxListeners ? s.defaultMaxListeners : e._maxListeners
+ }
+
+ function h(e, t, i, n) {
+ var r, a, s;
+ if (u(i), void 0 === (a = e._events) ? (a = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== a.newListener && (e.emit("newListener", t, i.listener ? i.listener : i), a = e._events), s = a[t]), void 0 === s) s = a[t] = i, ++e._eventsCount;
+ else if ("function" == typeof s ? s = a[t] = n ? [i, s] : [s, i] : n ? s.unshift(i) : s.push(i), (r = l(e)) > 0 && s.length > r && !s.warned) {
+ s.warned = !0;
+ var o = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
+ o.name = "MaxListenersExceededWarning", o.emitter = e, o.type = t, o.count = s.length, console && console.warn
+ }
+ return e
+ }
+
+ function d() {
+ if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments)
+ }
+
+ function c(e, t, i) {
+ var n = {
+ fired: !1,
+ wrapFn: void 0,
+ target: e,
+ type: t,
+ listener: i
+ },
+ r = d.bind(n);
+ return r.listener = i, n.wrapFn = r, r
+ }
+
+ function f(e, t, i) {
+ var n = e._events;
+ if (void 0 === n) return [];
+ var r = n[t];
+ return void 0 === r ? [] : "function" == typeof r ? i ? [r.listener || r] : [r] : i ? function(e) {
+ for (var t = new Array(e.length), i = 0; i < t.length; ++i) t[i] = e[i].listener || e[i];
+ return t
+ }(r) : m(r, r.length)
+ }
+
+ function p(e) {
+ var t = this._events;
+ if (void 0 !== t) {
+ var i = t[e];
+ if ("function" == typeof i) return 1;
+ if (void 0 !== i) return i.length
+ }
+ return 0
+ }
+
+ function m(e, t) {
+ for (var i = new Array(t), n = 0; n < t; ++n) i[n] = e[n];
+ return i
+ }
+
+ function _(e, t, i, r) {
+ if ("function" == typeof e.on) r.once ? e.once(t, i) : e.on(t, i);
+ else {
+ if ("function" != typeof e.addEventListener) throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + n(e));
+ e.addEventListener(t, (function n(a) {
+ r.once && e.removeEventListener(t, n), i(a)
+ }))
+ }
+ }
+ Object.defineProperty(s, "defaultMaxListeners", {
+ enumerable: !0,
+ get: function() {
+ return o
+ },
+ set: function(e) {
+ if ("number" != typeof e || e < 0 || a(e)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + ".");
+ o = e
+ }
+ }), s.init = function() {
+ void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0
+ }, s.prototype.setMaxListeners = function(e) {
+ if ("number" != typeof e || e < 0 || a(e)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
+ return this._maxListeners = e, this
+ }, s.prototype.getMaxListeners = function() {
+ return l(this)
+ }, s.prototype.emit = function(e) {
+ for (var t = [], i = 1; i < arguments.length; i++) t.push(arguments[i]);
+ var n = "error" === e,
+ a = this._events;
+ if (void 0 !== a) n = n && void 0 === a.error;
+ else if (!n) return !1;
+ if (n) {
+ var s;
+ if (t.length > 0 && (s = t[0]), s instanceof Error) throw s;
+ var o = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
+ throw o.context = s, o
+ }
+ var u = a[e];
+ if (void 0 === u) return !1;
+ if ("function" == typeof u) r(u, this, t);
+ else {
+ var l = u.length,
+ h = m(u, l);
+ for (i = 0; i < l; ++i) r(h[i], this, t)
+ }
+ return !0
+ }, s.prototype.addListener = function(e, t) {
+ return h(this, e, t, !1)
+ }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
+ return h(this, e, t, !0)
+ }, s.prototype.once = function(e, t) {
+ return u(t), this.on(e, c(this, e, t)), this
+ }, s.prototype.prependOnceListener = function(e, t) {
+ return u(t), this.prependListener(e, c(this, e, t)), this
+ }, s.prototype.removeListener = function(e, t) {
+ var i, n, r, a, s;
+ if (u(t), void 0 === (n = this._events)) return this;
+ if (void 0 === (i = n[e])) return this;
+ if (i === t || i.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete n[e], n.removeListener && this.emit("removeListener", e, i.listener || t));
+ else if ("function" != typeof i) {
+ for (r = -1, a = i.length - 1; a >= 0; a--)
+ if (i[a] === t || i[a].listener === t) {
+ s = i[a].listener, r = a;
+ break
+ } if (r < 0) return this;
+ 0 === r ? i.shift() : function(e, t) {
+ for (; t + 1 < e.length; t++) e[t] = e[t + 1];
+ e.pop()
+ }(i, r), 1 === i.length && (n[e] = i[0]), void 0 !== n.removeListener && this.emit("removeListener", e, s || t)
+ }
+ return this
+ }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
+ var t, i, n;
+ if (void 0 === (i = this._events)) return this;
+ if (void 0 === i.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== i[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete i[e]), this;
+ if (0 === arguments.length) {
+ var r, a = Object.keys(i);
+ for (n = 0; n < a.length; ++n) "removeListener" !== (r = a[n]) && this.removeAllListeners(r);
+ return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this
+ }
+ if ("function" == typeof(t = i[e])) this.removeListener(e, t);
+ else if (void 0 !== t)
+ for (n = t.length - 1; n >= 0; n--) this.removeListener(e, t[n]);
+ return this
+ }, s.prototype.listeners = function(e) {
+ return f(this, e, !0)
+ }, s.prototype.rawListeners = function(e) {
+ return f(this, e, !1)
+ }, s.listenerCount = function(e, t) {
+ return "function" == typeof e.listenerCount ? e.listenerCount(t) : p.call(e, t)
+ }, s.prototype.listenerCount = p, s.prototype.eventNames = function() {
+ return this._eventsCount > 0 ? t(this._events) : []
+ }
+ },
+ "./node_modules/webworkify-webpack/index.js":
+ /*!**************************************************!*\
+ !*** ./node_modules/webworkify-webpack/index.js ***!
+ \**************************************************/
+ function(e, t, i) {
+ function n(e) {
+ var t = {};
+
+ function i(n) {
+ if (t[n]) return t[n].exports;
+ var r = t[n] = {
+ i: n,
+ l: !1,
+ exports: {}
+ };
+ return e[n].call(r.exports, r, r.exports, i), r.l = !0, r.exports
+ }
+ i.m = e, i.c = t, i.i = function(e) {
+ return e
+ }, i.d = function(e, t, n) {
+ i.o(e, t) || Object.defineProperty(e, t, {
+ configurable: !1,
+ enumerable: !0,
+ get: n
+ })
+ }, i.r = function(e) {
+ Object.defineProperty(e, "__esModule", {
+ value: !0
+ })
+ }, i.n = function(e) {
+ var t = e && e.__esModule ? function() {
+ return e.default
+ } : function() {
+ return e
+ };
+ return i.d(t, "a", t), t
+ }, i.o = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }, i.p = "/", i.oe = function(e) {
+ throw console.error(e), e
+ };
+ var n = i(i.s = ENTRY_MODULE);
+ return n.default || n
+ }
+
+ function r(e) {
+ return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
+ }
+
+ function a(e, t, n) {
+ var a = {};
+ a[n] = [];
+ var s = t.toString(),
+ o = s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
+ if (!o) return a;
+ for (var u, l = o[1], h = new RegExp("(\\\\n|\\W)" + r(l) + "\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)", "g"); u = h.exec(s);) "dll-reference" !== u[3] && a[n].push(u[3]);
+ for (h = new RegExp("\\(" + r(l) + '\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)', "g"); u = h.exec(s);) e[u[2]] || (a[n].push(u[1]), e[u[2]] = i(u[1]).m), a[u[2]] = a[u[2]] || [], a[u[2]].push(u[4]);
+ for (var d, c = Object.keys(a), f = 0; f < c.length; f++)
+ for (var p = 0; p < a[c[f]].length; p++) d = a[c[f]][p], isNaN(1 * d) || (a[c[f]][p] = 1 * a[c[f]][p]);
+ return a
+ }
+
+ function s(e) {
+ return Object.keys(e).reduce((function(t, i) {
+ return t || e[i].length > 0
+ }), !1)
+ }
+ e.exports = function(e, t) {
+ t = t || {};
+ var r = {
+ main: i.m
+ },
+ o = t.all ? {
+ main: Object.keys(r.main)
+ } : function(e, t) {
+ for (var i = {
+ main: [t]
+ }, n = {
+ main: []
+ }, r = {
+ main: {}
+ }; s(i);)
+ for (var o = Object.keys(i), u = 0; u < o.length; u++) {
+ var l = o[u],
+ h = i[l].pop();
+ if (r[l] = r[l] || {}, !r[l][h] && e[l][h]) {
+ r[l][h] = !0, n[l] = n[l] || [], n[l].push(h);
+ for (var d = a(e, e[l][h], l), c = Object.keys(d), f = 0; f < c.length; f++) i[c[f]] = i[c[f]] || [], i[c[f]] = i[c[f]].concat(d[c[f]])
+ }
+ }
+ return n
+ }(r, e),
+ u = "";
+ Object.keys(o).filter((function(e) {
+ return "main" !== e
+ })).forEach((function(e) {
+ for (var t = 0; o[e][t];) t++;
+ o[e].push(t), r[e][t] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", u = u + "var " + e + " = (" + n.toString().replace("ENTRY_MODULE", JSON.stringify(t)) + ")({" + o[e].map((function(t) {
+ return JSON.stringify(t) + ": " + r[e][t].toString()
+ })).join(",") + "});\n"
+ })), u = u + "new ((" + n.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + o.main.map((function(e) {
+ return JSON.stringify(e) + ": " + r.main[e].toString()
+ })).join(",") + "}))(self);";
+ var l = new window.Blob([u], {
+ type: "text/javascript"
+ });
+ if (t.bare) return l;
+ var h = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l),
+ d = new window.Worker(h);
+ return d.objectURL = h, d
+ }
+ },
+ "./src/config.js":
+ /*!***********************!*\
+ !*** ./src/config.js ***!
+ \***********************/
+ function(e, t, i) {
+ i.r(t), i.d(t, {
+ defaultConfig: function() {
+ return n
+ },
+ createDefaultConfig: function() {
+ return r
+ }
+ });
+ var n = {
+ enableWorker: !1,
+ enableStashBuffer: !0,
+ stashInitialSize: void 0,
+ isLive: !1,
+ lazyLoad: !0,
+ lazyLoadMaxDuration: 180,
+ lazyLoadRecoverDuration: 30,
+ deferLoadAfterSourceOpen: !0,
+ autoCleanupMaxBackwardDuration: 180,
+ autoCleanupMinBackwardDuration: 120,
+ statisticsInfoReportInterval: 600,
+ fixAudioTimestampGap: !0,
+ accurateSeek: !1,
+ seekType: "range",
+ seekParamStart: "bstart",
+ seekParamEnd: "bend",
+ rangeLoadZeroStart: !1,
+ customSeekHandler: void 0,
+ reuseRedirectedURL: !1,
+ headers: void 0,
+ customLoader: void 0
+ };
+
+ function r() {
+ return Object.assign({}, n)
+ }
+ },
+ "./src/core/features.js":
+ /*!******************************!*\
+ !*** ./src/core/features.js ***!
+ \******************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ../io/io-controller.js */
+ "./src/io/io-controller.js"),
+ r = i(
+ /*! ../config.js */
+ "./src/config.js"),
+ a = function() {
+ function e() {}
+ return e.supportMSEH264Playback = function() {
+ return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')
+ }, e.supportNetworkStreamIO = function() {
+ var e = new n.default({}, (0, r.createDefaultConfig)()),
+ t = e.loaderType;
+ return e.destroy(), "fetch-stream-loader" == t || "xhr-moz-chunked-loader" == t
+ }, e.getNetworkLoaderTypeName = function() {
+ var e = new n.default({}, (0, r.createDefaultConfig)()),
+ t = e.loaderType;
+ return e.destroy(), t
+ }, e.supportNativeMediaPlayback = function(t) {
+ null == e.videoElement && (e.videoElement = window.document.createElement("video"));
+ var i = e.videoElement.canPlayType(t);
+ return "probably" === i || "maybe" == i
+ }, e.getFeatureList = function() {
+ var t = {
+ mseFlvPlayback: !1,
+ mseLiveFlvPlayback: !1,
+ networkStreamIO: !1,
+ networkLoaderName: "",
+ nativeMP4H264Playback: !1,
+ nativeMP4H265Playback: !1,
+ nativeWebmVP8Playback: !1,
+ nativeWebmVP9Playback: !1
+ };
+ return t.mseFlvPlayback = e.supportMSEH264Playback(), t.networkStreamIO = e.supportNetworkStreamIO(), t.networkLoaderName = e.getNetworkLoaderTypeName(), t.mseLiveFlvPlayback = t.mseFlvPlayback && t.networkStreamIO, t.nativeMP4H264Playback = e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'), t.nativeMP4H265Playback = e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'), t.nativeWebmVP8Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'), t.nativeWebmVP9Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp9"'), t
+ }, e
+ }();
+ t.default = a
+ },
+ "./src/core/media-info.js":
+ /*!********************************!*\
+ !*** ./src/core/media-info.js ***!
+ \********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e() {
+ this.mimeType = null, this.duration = null, this.hasAudio = null, this.hasVideo = null, this.audioCodec = null, this.videoCodec = null, this.audioDataRate = null, this.videoDataRate = null, this.audioSampleRate = null, this.audioChannelCount = null, this.width = null, this.height = null, this.fps = null, this.profile = null, this.level = null, this.refFrames = null, this.chromaFormat = null, this.sarNum = null, this.sarDen = null, this.metadata = null, this.segments = null, this.segmentCount = null, this.hasKeyframesIndex = null, this.keyframesIndex = null
+ }
+ return e.prototype.isComplete = function() {
+ var e = !1 === this.hasAudio || !0 === this.hasAudio && null != this.audioCodec && null != this.audioSampleRate && null != this.audioChannelCount,
+ t = !1 === this.hasVideo || !0 === this.hasVideo && null != this.videoCodec && null != this.width && null != this.height && null != this.fps && null != this.profile && null != this.level && null != this.refFrames && null != this.chromaFormat && null != this.sarNum && null != this.sarDen;
+ return null != this.mimeType && null != this.duration && null != this.metadata && null != this.hasKeyframesIndex && e && t
+ }, e.prototype.isSeekable = function() {
+ return !0 === this.hasKeyframesIndex
+ }, e.prototype.getNearestKeyframe = function(e) {
+ if (null == this.keyframesIndex) return null;
+ var t = this.keyframesIndex,
+ i = this._search(t.times, e);
+ return {
+ index: i,
+ milliseconds: t.times[i],
+ fileposition: t.filepositions[i]
+ }
+ }, e.prototype._search = function(e, t) {
+ var i = 0,
+ n = e.length - 1,
+ r = 0,
+ a = 0,
+ s = n;
+ for (t < e[0] && (i = 0, a = s + 1); a <= s;) {
+ if ((r = a + Math.floor((s - a) / 2)) === n || t >= e[r] && t < e[r + 1]) {
+ i = r;
+ break
+ }
+ e[r] < t ? a = r + 1 : s = r - 1
+ }
+ return i
+ }, e
+ }();
+ t.default = n
+ },
+ "./src/core/media-segment-info.js":
+ /*!****************************************!*\
+ !*** ./src/core/media-segment-info.js ***!
+ \****************************************/
+ function(e, t, i) {
+ i.r(t), i.d(t, {
+ SampleInfo: function() {
+ return n
+ },
+ MediaSegmentInfo: function() {
+ return r
+ },
+ IDRSampleList: function() {
+ return a
+ },
+ MediaSegmentInfoList: function() {
+ return s
+ }
+ });
+ var n = function(e, t, i, n, r) {
+ this.dts = e, this.pts = t, this.duration = i, this.originalDts = n, this.isSyncPoint = r, this.fileposition = null
+ },
+ r = function() {
+ function e() {
+ this.beginDts = 0, this.endDts = 0, this.beginPts = 0, this.endPts = 0, this.originalBeginDts = 0, this.originalEndDts = 0, this.syncPoints = [], this.firstSample = null, this.lastSample = null
+ }
+ return e.prototype.appendSyncPoint = function(e) {
+ e.isSyncPoint = !0, this.syncPoints.push(e)
+ }, e
+ }(),
+ a = function() {
+ function e() {
+ this._list = []
+ }
+ return e.prototype.clear = function() {
+ this._list = []
+ }, e.prototype.appendArray = function(e) {
+ var t = this._list;
+ 0 !== e.length && (t.length > 0 && e[0].originalDts < t[t.length - 1].originalDts && this.clear(), Array.prototype.push.apply(t, e))
+ }, e.prototype.getLastSyncPointBeforeDts = function(e) {
+ if (0 == this._list.length) return null;
+ var t = this._list,
+ i = 0,
+ n = t.length - 1,
+ r = 0,
+ a = 0,
+ s = n;
+ for (e < t[0].dts && (i = 0, a = s + 1); a <= s;) {
+ if ((r = a + Math.floor((s - a) / 2)) === n || e >= t[r].dts && e < t[r + 1].dts) {
+ i = r;
+ break
+ }
+ t[r].dts < e ? a = r + 1 : s = r - 1
+ }
+ return this._list[i]
+ }, e
+ }(),
+ s = function() {
+ function e(e) {
+ this._type = e, this._list = [], this._lastAppendLocation = -1
+ }
+ return Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "length", {
+ get: function() {
+ return this._list.length
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.isEmpty = function() {
+ return 0 === this._list.length
+ }, e.prototype.clear = function() {
+ this._list = [], this._lastAppendLocation = -1
+ }, e.prototype._searchNearestSegmentBefore = function(e) {
+ var t = this._list;
+ if (0 === t.length) return -2;
+ var i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i,
+ s = 0;
+ if (e < t[0].originalBeginDts) return s = -1;
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e > t[n].lastSample.originalDts && e < t[n + 1].originalBeginDts) {
+ s = n;
+ break
+ }
+ t[n].originalBeginDts < e ? r = n + 1 : a = n - 1
+ }
+ return s
+ }, e.prototype._searchNearestSegmentAfter = function(e) {
+ return this._searchNearestSegmentBefore(e) + 1
+ }, e.prototype.append = function(e) {
+ var t = this._list,
+ i = e,
+ n = this._lastAppendLocation,
+ r = 0; - 1 !== n && n < t.length && i.originalBeginDts >= t[n].lastSample.originalDts && (n === t.length - 1 || n < t.length - 1 && i.originalBeginDts < t[n + 1].originalBeginDts) ? r = n + 1 : t.length > 0 && (r = this._searchNearestSegmentBefore(i.originalBeginDts) + 1), this._lastAppendLocation = r, this._list.splice(r, 0, i)
+ }, e.prototype.getLastSegmentBefore = function(e) {
+ var t = this._searchNearestSegmentBefore(e);
+ return t >= 0 ? this._list[t] : null
+ }, e.prototype.getLastSampleBefore = function(e) {
+ var t = this.getLastSegmentBefore(e);
+ return null != t ? t.lastSample : null
+ }, e.prototype.getLastSyncPointBefore = function(e) {
+ for (var t = this._searchNearestSegmentBefore(e), i = this._list[t].syncPoints; 0 === i.length && t > 0;) t--, i = this._list[t].syncPoints;
+ return i.length > 0 ? i[i.length - 1] : null
+ }, e
+ }()
+ },
+ "./src/core/mse-controller.js":
+ /*!************************************!*\
+ !*** ./src/core/mse-controller.js ***!
+ \************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ r = i.n(n),
+ a = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ s = i(
+ /*! ../utils/browser.js */
+ "./src/utils/browser.js"),
+ o = i(
+ /*! ./mse-events.js */
+ "./src/core/mse-events.js"),
+ u = i(
+ /*! ./media-segment-info.js */
+ "./src/core/media-segment-info.js"),
+ l = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ h = function() {
+ function e(e) {
+ this.TAG = "MSEController", this._config = e, this._emitter = new(r()), this._config.isLive && null == this._config.autoCleanupSourceBuffer && (this._config.autoCleanupSourceBuffer = !0), this.e = {
+ onSourceOpen: this._onSourceOpen.bind(this),
+ onSourceEnded: this._onSourceEnded.bind(this),
+ onSourceClose: this._onSourceClose.bind(this),
+ onSourceBufferError: this._onSourceBufferError.bind(this),
+ onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
+ }, this._mediaSource = null, this._mediaSourceObjectURL = null, this._mediaElement = null, this._isBufferFull = !1, this._hasPendingEos = !1, this._requireSetMediaDuration = !1, this._pendingMediaDuration = 0, this._pendingSourceBufferInit = [], this._mimeTypes = {
+ video: null,
+ audio: null
+ }, this._sourceBuffers = {
+ video: null,
+ audio: null
+ }, this._lastInitSegments = {
+ video: null,
+ audio: null
+ }, this._pendingSegments = {
+ video: [],
+ audio: []
+ }, this._pendingRemoveRanges = {
+ video: [],
+ audio: []
+ }, this._idrList = new u.IDRSampleList
+ }
+ return e.prototype.destroy = function() {
+ (this._mediaElement || this._mediaSource) && this.detachMediaElement(), this.e = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ if (this._mediaSource) throw new l.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");
+ var t = this._mediaSource = new window.MediaSource;
+ t.addEventListener("sourceopen", this.e.onSourceOpen), t.addEventListener("sourceended", this.e.onSourceEnded), t.addEventListener("sourceclose", this.e.onSourceClose), this._mediaElement = e, this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource), e.src = this._mediaSourceObjectURL
+ }, e.prototype.detachMediaElement = function() {
+ if (this._mediaSource) {
+ var e = this._mediaSource;
+ for (var t in this._sourceBuffers) {
+ var i = this._pendingSegments[t];
+ i.splice(0, i.length), this._pendingSegments[t] = null, this._pendingRemoveRanges[t] = null, this._lastInitSegments[t] = null;
+ var n = this._sourceBuffers[t];
+ if (n) {
+ if ("closed" !== e.readyState) {
+ try {
+ e.removeSourceBuffer(n)
+ } catch (e) {
+ a.default.e(this.TAG, e.message)
+ }
+ n.removeEventListener("error", this.e.onSourceBufferError), n.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd)
+ }
+ this._mimeTypes[t] = null, this._sourceBuffers[t] = null
+ }
+ }
+ if ("open" === e.readyState) try {
+ e.endOfStream()
+ } catch (e) {
+ a.default.e(this.TAG, e.message)
+ }
+ e.removeEventListener("sourceopen", this.e.onSourceOpen), e.removeEventListener("sourceended", this.e.onSourceEnded), e.removeEventListener("sourceclose", this.e.onSourceClose), this._pendingSourceBufferInit = [], this._isBufferFull = !1, this._idrList.clear(), this._mediaSource = null
+ }
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this._mediaElement = null), this._mediaSourceObjectURL && (window.URL.revokeObjectURL(this._mediaSourceObjectURL), this._mediaSourceObjectURL = null)
+ }, e.prototype.appendInitSegment = function(e, t) {
+ if (!this._mediaSource || "open" !== this._mediaSource.readyState) return this._pendingSourceBufferInit.push(e), void this._pendingSegments[e.type].push(e);
+ var i = e,
+ n = "" + i.container;
+ i.codec && i.codec.length > 0 && (n += ";codecs=" + i.codec);
+ var r = !1;
+ if (a.default.v(this.TAG, "Received Initialization Segment, mimeType: " + n), this._lastInitSegments[i.type] = i, n !== this._mimeTypes[i.type]) {
+ if (this._mimeTypes[i.type]) a.default.v(this.TAG, "Notice: " + i.type + " mimeType changed, origin: " + this._mimeTypes[i.type] + ", target: " + n);
+ else {
+ r = !0;
+ try {
+ var u = this._sourceBuffers[i.type] = this._mediaSource.addSourceBuffer(n);
+ u.addEventListener("error", this.e.onSourceBufferError), u.addEventListener("updateend", this.e.onSourceBufferUpdateEnd)
+ } catch (e) {
+ return a.default.e(this.TAG, e.message), void this._emitter.emit(o.default.ERROR, {
+ code: e.code,
+ msg: e.message
+ })
+ }
+ }
+ this._mimeTypes[i.type] = n
+ }
+ t || this._pendingSegments[i.type].push(i), r || this._sourceBuffers[i.type] && !this._sourceBuffers[i.type].updating && this._doAppendSegments(), s.default.safari && "audio/mpeg" === i.container && i.mediaDuration > 0 && (this._requireSetMediaDuration = !0, this._pendingMediaDuration = i.mediaDuration / 1e3, this._updateMediaSourceDuration())
+ }, e.prototype.appendMediaSegment = function(e) {
+ var t = e;
+ this._pendingSegments[t.type].push(t), this._config.autoCleanupSourceBuffer && this._needCleanupSourceBuffer() && this._doCleanupSourceBuffer();
+ var i = this._sourceBuffers[t.type];
+ !i || i.updating || this._hasPendingRemoveRanges() || this._doAppendSegments()
+ }, e.prototype.seek = function(e) {
+ for (var t in this._sourceBuffers)
+ if (this._sourceBuffers[t]) {
+ var i = this._sourceBuffers[t];
+ if ("open" === this._mediaSource.readyState) try {
+ i.abort()
+ } catch (e) {
+ a.default.e(this.TAG, e.message)
+ }
+ this._idrList.clear();
+ var n = this._pendingSegments[t];
+ if (n.splice(0, n.length), "closed" !== this._mediaSource.readyState) {
+ for (var r = 0; r < i.buffered.length; r++) {
+ var o = i.buffered.start(r),
+ u = i.buffered.end(r);
+ this._pendingRemoveRanges[t].push({
+ start: o,
+ end: u
+ })
+ }
+ if (i.updating || this._doRemoveRanges(), s.default.safari) {
+ var l = this._lastInitSegments[t];
+ l && (this._pendingSegments[t].push(l), i.updating || this._doAppendSegments())
+ }
+ }
+ }
+ }, e.prototype.endOfStream = function() {
+ var e = this._mediaSource,
+ t = this._sourceBuffers;
+ e && "open" === e.readyState ? t.video && t.video.updating || t.audio && t.audio.updating ? this._hasPendingEos = !0 : (this._hasPendingEos = !1, e.endOfStream()) : e && "closed" === e.readyState && this._hasPendingSegments() && (this._hasPendingEos = !0)
+ }, e.prototype.getNearestKeyframe = function(e) {
+ return this._idrList.getLastSyncPointBeforeDts(e)
+ }, e.prototype._needCleanupSourceBuffer = function() {
+ if (!this._config.autoCleanupSourceBuffer) return !1;
+ var e = this._mediaElement.currentTime;
+ for (var t in this._sourceBuffers) {
+ var i = this._sourceBuffers[t];
+ if (i) {
+ var n = i.buffered;
+ if (n.length >= 1 && e - n.start(0) >= this._config.autoCleanupMaxBackwardDuration) return !0
+ }
+ }
+ return !1
+ }, e.prototype._doCleanupSourceBuffer = function() {
+ var e = this._mediaElement.currentTime;
+ for (var t in this._sourceBuffers) {
+ var i = this._sourceBuffers[t];
+ if (i) {
+ for (var n = i.buffered, r = !1, a = 0; a < n.length; a++) {
+ var s = n.start(a),
+ o = n.end(a);
+ if (s <= e && e < o + 3) {
+ if (e - s >= this._config.autoCleanupMaxBackwardDuration) {
+ r = !0;
+ var u = e - this._config.autoCleanupMinBackwardDuration;
+ this._pendingRemoveRanges[t].push({
+ start: s,
+ end: u
+ })
+ }
+ } else o < e && (r = !0, this._pendingRemoveRanges[t].push({
+ start: s,
+ end: o
+ }))
+ }
+ r && !i.updating && this._doRemoveRanges()
+ }
+ }
+ }, e.prototype._updateMediaSourceDuration = function() {
+ var e = this._sourceBuffers;
+ if (0 !== this._mediaElement.readyState && "open" === this._mediaSource.readyState && !(e.video && e.video.updating || e.audio && e.audio.updating)) {
+ var t = this._mediaSource.duration,
+ i = this._pendingMediaDuration;
+ i > 0 && (isNaN(t) || i > t) && (a.default.v(this.TAG, "Update MediaSource duration from " + t + " to " + i), this._mediaSource.duration = i), this._requireSetMediaDuration = !1, this._pendingMediaDuration = 0
+ }
+ }, e.prototype._doRemoveRanges = function() {
+ for (var e in this._pendingRemoveRanges)
+ if (this._sourceBuffers[e] && !this._sourceBuffers[e].updating)
+ for (var t = this._sourceBuffers[e], i = this._pendingRemoveRanges[e]; i.length && !t.updating;) {
+ var n = i.shift();
+ t.remove(n.start, n.end)
+ }
+ }, e.prototype._doAppendSegments = function() {
+ var e = this._pendingSegments;
+ for (var t in e)
+ if (this._sourceBuffers[t] && !this._sourceBuffers[t].updating && e[t].length > 0) {
+ var i = e[t].shift();
+ if (i.timestampOffset) {
+ var n = this._sourceBuffers[t].timestampOffset,
+ r = i.timestampOffset / 1e3;
+ Math.abs(n - r) > .1 && (a.default.v(this.TAG, "Update MPEG audio timestampOffset from " + n + " to " + r), this._sourceBuffers[t].timestampOffset = r), delete i.timestampOffset
+ }
+ if (!i.data || 0 === i.data.byteLength) continue;
+ try {
+ this._sourceBuffers[t].appendBuffer(i.data), this._isBufferFull = !1, "video" === t && i.hasOwnProperty("info") && this._idrList.appendArray(i.info.syncPoints)
+ } catch (e) {
+ this._pendingSegments[t].unshift(i), 22 === e.code ? (this._isBufferFull || this._emitter.emit(o.default.BUFFER_FULL), this._isBufferFull = !0) : (a.default.e(this.TAG, t, e.message), this._emitter.emit(o.default.ERROR, {
+ code: e.code,
+ msg: e.message
+ }))
+ }
+ }
+ }, e.prototype._onSourceOpen = function() {
+ if (a.default.v(this.TAG, "MediaSource onSourceOpen"), this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen), this._pendingSourceBufferInit.length > 0)
+ for (var e = this._pendingSourceBufferInit; e.length;) {
+ var t = e.shift();
+ this.appendInitSegment(t, !0)
+ }
+ this._hasPendingSegments() && this._doAppendSegments(), this._emitter.emit(o.default.SOURCE_OPEN)
+ }, e.prototype._onSourceEnded = function() {
+ a.default.v(this.TAG, "MediaSource onSourceEnded")
+ }, e.prototype._onSourceClose = function() {
+ a.default.v(this.TAG, "MediaSource onSourceClose"), this._mediaSource && null != this.e && (this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen), this._mediaSource.removeEventListener("sourceended", this.e.onSourceEnded), this._mediaSource.removeEventListener("sourceclose", this.e.onSourceClose))
+ }, e.prototype._hasPendingSegments = function() {
+ var e = this._pendingSegments;
+ return (e.video && e.video.length) > 0 || e.audio && e.audio.length > 0
+ }, e.prototype._hasPendingRemoveRanges = function() {
+ var e = this._pendingRemoveRanges;
+ return (e.video && e.video.length) > 0 || e.audio && e.audio.length > 0
+ }, e.prototype._onSourceBufferUpdateEnd = function() {
+ this._requireSetMediaDuration ? this._updateMediaSourceDuration() : this._hasPendingRemoveRanges() ? this._doRemoveRanges() : this._hasPendingSegments() ? this._doAppendSegments() : this._hasPendingEos && this.endOfStream(), this._emitter.emit(o.default.UPDATE_END)
+ }, e.prototype._onSourceBufferError = function(e) {
+ a.default.e(this.TAG, "SourceBuffer Error: " + e)
+ }, e
+ }();
+ t.default = h
+ },
+ "./src/core/mse-events.js":
+ /*!********************************!*\
+ !*** ./src/core/mse-events.js ***!
+ \********************************/
+ function(e, t, i) {
+ i.r(t), t.default = {
+ ERROR: "error",
+ SOURCE_OPEN: "source_open",
+ UPDATE_END: "update_end",
+ BUFFER_FULL: "buffer_full"
+ }
+ },
+ "./src/core/transmuxer.js":
+ /*!********************************!*\
+ !*** ./src/core/transmuxer.js ***!
+ \********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ r = i.n(n),
+ a = i(
+ /*! webworkify-webpack */
+ "./node_modules/webworkify-webpack/index.js"),
+ s = i.n(a),
+ o = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ u = i(
+ /*! ../utils/logging-control.js */
+ "./src/utils/logging-control.js"),
+ l = i(
+ /*! ./transmuxing-controller.js */
+ "./src/core/transmuxing-controller.js"),
+ h = i(
+ /*! ./transmuxing-events.js */
+ "./src/core/transmuxing-events.js"),
+ d = i(
+ /*! ./media-info.js */
+ "./src/core/media-info.js"),
+ c = function() {
+ function e(e, t) {
+ if (this.TAG = "Transmuxer", this._emitter = new(r()), t.enableWorker && "undefined" != typeof Worker) try {
+ this._worker = s()(
+ /*! ./transmuxing-worker */
+ "./src/core/transmuxing-worker.js"), this._workerDestroying = !1, this._worker.addEventListener("message", this._onWorkerMessage.bind(this)), this._worker.postMessage({
+ cmd: "init",
+ param: [e, t]
+ }), this.e = {
+ onLoggingConfigChanged: this._onLoggingConfigChanged.bind(this)
+ }, u.default.registerListener(this.e.onLoggingConfigChanged), this._worker.postMessage({
+ cmd: "logging_config",
+ param: u.default.getConfig()
+ })
+ } catch (i) {
+ o.default.e(this.TAG, "Error while initialize transmuxing worker, fallback to inline transmuxing"), this._worker = null, this._controller = new l.default(e, t)
+ } else this._controller = new l.default(e, t);
+ if (this._controller) {
+ var i = this._controller;
+ i.on(h.default.IO_ERROR, this._onIOError.bind(this)), i.on(h.default.DEMUX_ERROR, this._onDemuxError.bind(this)), i.on(h.default.INIT_SEGMENT, this._onInitSegment.bind(this)), i.on(h.default.MEDIA_SEGMENT, this._onMediaSegment.bind(this)), i.on(h.default.LOADING_COMPLETE, this._onLoadingComplete.bind(this)), i.on(h.default.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this)), i.on(h.default.MEDIA_INFO, this._onMediaInfo.bind(this)), i.on(h.default.METADATA_ARRIVED, this._onMetaDataArrived.bind(this)), i.on(h.default.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this)), i.on(h.default.STATISTICS_INFO, this._onStatisticsInfo.bind(this)), i.on(h.default.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this))
+ }
+ }
+ return e.prototype.destroy = function() {
+ this._worker ? this._workerDestroying || (this._workerDestroying = !0, this._worker.postMessage({
+ cmd: "destroy"
+ }), u.default.removeListener(this.e.onLoggingConfigChanged), this.e = null) : (this._controller.destroy(), this._controller = null), this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.hasWorker = function() {
+ return null != this._worker
+ }, e.prototype.open = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "start"
+ }) : this._controller.start()
+ }, e.prototype.close = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "stop"
+ }) : this._controller.stop()
+ }, e.prototype.seek = function(e) {
+ this._worker ? this._worker.postMessage({
+ cmd: "seek",
+ param: e
+ }) : this._controller.seek(e)
+ }, e.prototype.pause = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "pause"
+ }) : this._controller.pause()
+ }, e.prototype.resume = function() {
+ this._worker ? this._worker.postMessage({
+ cmd: "resume"
+ }) : this._controller.resume()
+ }, e.prototype._onInitSegment = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(h.default.INIT_SEGMENT, e, t)
+ }))
+ }, e.prototype._onMediaSegment = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(h.default.MEDIA_SEGMENT, e, t)
+ }))
+ }, e.prototype._onLoadingComplete = function() {
+ var e = this;
+ Promise.resolve().then((function() {
+ e._emitter.emit(h.default.LOADING_COMPLETE)
+ }))
+ }, e.prototype._onRecoveredEarlyEof = function() {
+ var e = this;
+ Promise.resolve().then((function() {
+ e._emitter.emit(h.default.RECOVERED_EARLY_EOF)
+ }))
+ }, e.prototype._onMediaInfo = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(h.default.MEDIA_INFO, e)
+ }))
+ }, e.prototype._onMetaDataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(h.default.METADATA_ARRIVED, e)
+ }))
+ }, e.prototype._onScriptDataArrived = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(h.default.SCRIPTDATA_ARRIVED, e)
+ }))
+ }, e.prototype._onStatisticsInfo = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(h.default.STATISTICS_INFO, e)
+ }))
+ }, e.prototype._onIOError = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(h.default.IO_ERROR, e, t)
+ }))
+ }, e.prototype._onDemuxError = function(e, t) {
+ var i = this;
+ Promise.resolve().then((function() {
+ i._emitter.emit(h.default.DEMUX_ERROR, e, t)
+ }))
+ }, e.prototype._onRecommendSeekpoint = function(e) {
+ var t = this;
+ Promise.resolve().then((function() {
+ t._emitter.emit(h.default.RECOMMEND_SEEKPOINT, e)
+ }))
+ }, e.prototype._onLoggingConfigChanged = function(e) {
+ this._worker && this._worker.postMessage({
+ cmd: "logging_config",
+ param: e
+ })
+ }, e.prototype._onWorkerMessage = function(e) {
+ var t = e.data,
+ i = t.data;
+ if ("destroyed" === t.msg || this._workerDestroying) return this._workerDestroying = !1, this._worker.terminate(), void(this._worker = null);
+ switch (t.msg) {
+ case h.default.INIT_SEGMENT:
+ case h.default.MEDIA_SEGMENT:
+ this._emitter.emit(t.msg, i.type, i.data);
+ break;
+ case h.default.LOADING_COMPLETE:
+ case h.default.RECOVERED_EARLY_EOF:
+ this._emitter.emit(t.msg);
+ break;
+ case h.default.MEDIA_INFO:
+ Object.setPrototypeOf(i, d.default.prototype), this._emitter.emit(t.msg, i);
+ break;
+ case h.default.METADATA_ARRIVED:
+ case h.default.SCRIPTDATA_ARRIVED:
+ case h.default.STATISTICS_INFO:
+ this._emitter.emit(t.msg, i);
+ break;
+ case h.default.IO_ERROR:
+ case h.default.DEMUX_ERROR:
+ this._emitter.emit(t.msg, i.type, i.info);
+ break;
+ case h.default.RECOMMEND_SEEKPOINT:
+ this._emitter.emit(t.msg, i);
+ break;
+ case "logcat_callback":
+ o.default.emitter.emit("log", i.type, i.logcat)
+ }
+ }, e
+ }();
+ t.default = c
+ },
+ "./src/core/transmuxing-controller.js":
+ /*!********************************************!*\
+ !*** ./src/core/transmuxing-controller.js ***!
+ \********************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ r = i.n(n),
+ a = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ s = i(
+ /*! ../utils/browser.js */
+ "./src/utils/browser.js"),
+ o = i(
+ /*! ./media-info.js */
+ "./src/core/media-info.js"),
+ u = i(
+ /*! ../demux/flv-demuxer.js */
+ "./src/demux/flv-demuxer.js"),
+ l = i(
+ /*! ../remux/mp4-remuxer.js */
+ "./src/remux/mp4-remuxer.js"),
+ h = i(
+ /*! ../demux/demux-errors.js */
+ "./src/demux/demux-errors.js"),
+ d = i(
+ /*! ../io/io-controller.js */
+ "./src/io/io-controller.js"),
+ c = i(
+ /*! ./transmuxing-events.js */
+ "./src/core/transmuxing-events.js"),
+ f = function() {
+ function e(e, t) {
+ this.TAG = "TransmuxingController", this._emitter = new(r()), this._config = t, e.segments || (e.segments = [{
+ duration: e.duration,
+ filesize: e.filesize,
+ url: e.url
+ }]), "boolean" != typeof e.cors && (e.cors = !0), "boolean" != typeof e.withCredentials && (e.withCredentials = !1), this._mediaDataSource = e, this._currentSegmentIndex = 0;
+ var i = 0;
+ this._mediaDataSource.segments.forEach((function(n) {
+ n.timestampBase = i, i += n.duration, n.cors = e.cors, n.withCredentials = e.withCredentials, t.referrerPolicy && (n.referrerPolicy = t.referrerPolicy)
+ })), isNaN(i) || this._mediaDataSource.duration === i || (this._mediaDataSource.duration = i), this._mediaInfo = null, this._demuxer = null, this._remuxer = null, this._ioctl = null, this._pendingSeekTime = null, this._pendingResolveSeekPoint = null, this._statisticsReporter = null
+ }
+ return e.prototype.destroy = function() {
+ this._mediaInfo = null, this._mediaDataSource = null, this._statisticsReporter && this._disableStatisticsReporter(), this._ioctl && (this._ioctl.destroy(), this._ioctl = null), this._demuxer && (this._demuxer.destroy(), this._demuxer = null), this._remuxer && (this._remuxer.destroy(), this._remuxer = null), this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.start = function() {
+ this._loadSegment(0), this._enableStatisticsReporter()
+ }, e.prototype._loadSegment = function(e, t) {
+ this._currentSegmentIndex = e;
+ var i = this._mediaDataSource.segments[e],
+ n = this._ioctl = new d.default(i, this._config, e);
+ n.onError = this._onIOException.bind(this), n.onSeeked = this._onIOSeeked.bind(this), n.onComplete = this._onIOComplete.bind(this), n.onRedirect = this._onIORedirect.bind(this), n.onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this), t ? this._demuxer.bindDataSource(this._ioctl) : n.onDataArrival = this._onInitChunkArrival.bind(this), n.open(t)
+ }, e.prototype.stop = function() {
+ this._internalAbort(), this._disableStatisticsReporter()
+ }, e.prototype._internalAbort = function() {
+ this._ioctl && (this._ioctl.destroy(), this._ioctl = null)
+ }, e.prototype.pause = function() {
+ this._ioctl && this._ioctl.isWorking() && (this._ioctl.pause(), this._disableStatisticsReporter())
+ }, e.prototype.resume = function() {
+ this._ioctl && this._ioctl.isPaused() && (this._ioctl.resume(), this._enableStatisticsReporter())
+ }, e.prototype.seek = function(e) {
+ if (null != this._mediaInfo && this._mediaInfo.isSeekable()) {
+ var t = this._searchSegmentIndexContains(e);
+ if (t === this._currentSegmentIndex) {
+ var i = this._mediaInfo.segments[t];
+ if (null == i) this._pendingSeekTime = e;
+ else {
+ var n = i.getNearestKeyframe(e);
+ this._remuxer.seek(n.milliseconds), this._ioctl.seek(n.fileposition), this._pendingResolveSeekPoint = n.milliseconds
+ }
+ } else {
+ var r = this._mediaInfo.segments[t];
+ null == r ? (this._pendingSeekTime = e, this._internalAbort(), this._remuxer.seek(), this._remuxer.insertDiscontinuity(), this._loadSegment(t)) : (n = r.getNearestKeyframe(e), this._internalAbort(), this._remuxer.seek(e), this._remuxer.insertDiscontinuity(), this._demuxer.resetMediaInfo(), this._demuxer.timestampBase = this._mediaDataSource.segments[t].timestampBase, this._loadSegment(t, n.fileposition), this._pendingResolveSeekPoint = n.milliseconds, this._reportSegmentMediaInfo(t))
+ }
+ this._enableStatisticsReporter()
+ }
+ }, e.prototype._searchSegmentIndexContains = function(e) {
+ for (var t = this._mediaDataSource.segments, i = t.length - 1, n = 0; n < t.length; n++)
+ if (e < t[n].timestampBase) {
+ i = n - 1;
+ break
+ } return i
+ }, e.prototype._onInitChunkArrival = function(e, t) {
+ var i = this,
+ n = null,
+ r = 0;
+ if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, r = this._demuxer.parseChunks(e, t);
+ else if ((n = u.default.probe(e)).match) {
+ this._demuxer = new u.default(n, this._config), this._remuxer || (this._remuxer = new l.default(this._config));
+ var s = this._mediaDataSource;
+ null == s.duration || isNaN(s.duration) || (this._demuxer.overridedDuration = s.duration), "boolean" == typeof s.hasAudio && (this._demuxer.overridedHasAudio = s.hasAudio), "boolean" == typeof s.hasVideo && (this._demuxer.overridedHasVideo = s.hasVideo), this._demuxer.timestampBase = s.segments[this._currentSegmentIndex].timestampBase, this._demuxer.onError = this._onDemuxException.bind(this), this._demuxer.onMediaInfo = this._onMediaInfo.bind(this), this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this), this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this), r = this._demuxer.parseChunks(e, t)
+ } else n = null, a.default.e(this.TAG, "Non-FLV, Unsupported media type!"), Promise.resolve().then((function() {
+ i._internalAbort()
+ })), this._emitter.emit(c.default.DEMUX_ERROR, h.default.FORMAT_UNSUPPORTED, "Non-FLV, Unsupported media type"), r = 0;
+ return r
+ }, e.prototype._onMediaInfo = function(e) {
+ var t = this;
+ null == this._mediaInfo && (this._mediaInfo = Object.assign({}, e), this._mediaInfo.keyframesIndex = null, this._mediaInfo.segments = [], this._mediaInfo.segmentCount = this._mediaDataSource.segments.length, Object.setPrototypeOf(this._mediaInfo, o.default.prototype));
+ var i = Object.assign({}, e);
+ Object.setPrototypeOf(i, o.default.prototype), this._mediaInfo.segments[this._currentSegmentIndex] = i, this._reportSegmentMediaInfo(this._currentSegmentIndex), null != this._pendingSeekTime && Promise.resolve().then((function() {
+ var e = t._pendingSeekTime;
+ t._pendingSeekTime = null, t.seek(e)
+ }))
+ }, e.prototype._onMetaDataArrived = function(e) {
+ this._emitter.emit(c.default.METADATA_ARRIVED, e)
+ }, e.prototype._onScriptDataArrived = function(e) {
+ this._emitter.emit(c.default.SCRIPTDATA_ARRIVED, e)
+ }, e.prototype._onIOSeeked = function() {
+ this._remuxer.insertDiscontinuity()
+ }, e.prototype._onIOComplete = function(e) {
+ var t = e + 1;
+ t < this._mediaDataSource.segments.length ? (this._internalAbort(), this._remuxer.flushStashedSamples(), this._loadSegment(t)) : (this._remuxer.flushStashedSamples(), this._emitter.emit(c.default.LOADING_COMPLETE), this._disableStatisticsReporter())
+ }, e.prototype._onIORedirect = function(e) {
+ var t = this._ioctl.extraData;
+ this._mediaDataSource.segments[t].redirectedURL = e
+ }, e.prototype._onIORecoveredEarlyEof = function() {
+ this._emitter.emit(c.default.RECOVERED_EARLY_EOF)
+ }, e.prototype._onIOException = function(e, t) {
+ a.default.e(this.TAG, "IOException: type = " + e + ", code = " + t.code + ", msg = " + t.msg), this._emitter.emit(c.default.IO_ERROR, e, t), this._disableStatisticsReporter()
+ }, e.prototype._onDemuxException = function(e, t) {
+ a.default.e(this.TAG, "DemuxException: type = " + e + ", info = " + t), this._emitter.emit(c.default.DEMUX_ERROR, e, t)
+ }, e.prototype._onRemuxerInitSegmentArrival = function(e, t) {
+ this._emitter.emit(c.default.INIT_SEGMENT, e, t)
+ }, e.prototype._onRemuxerMediaSegmentArrival = function(e, t) {
+ if (null == this._pendingSeekTime && (this._emitter.emit(c.default.MEDIA_SEGMENT, e, t), null != this._pendingResolveSeekPoint && "video" === e)) {
+ var i = t.info.syncPoints,
+ n = this._pendingResolveSeekPoint;
+ this._pendingResolveSeekPoint = null, s.default.safari && i.length > 0 && i[0].originalDts === n && (n = i[0].pts), this._emitter.emit(c.default.RECOMMEND_SEEKPOINT, n)
+ }
+ }, e.prototype._enableStatisticsReporter = function() {
+ null == this._statisticsReporter && (this._statisticsReporter = self.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval))
+ }, e.prototype._disableStatisticsReporter = function() {
+ this._statisticsReporter && (self.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype._reportSegmentMediaInfo = function(e) {
+ var t = this._mediaInfo.segments[e],
+ i = Object.assign({}, t);
+ i.duration = this._mediaInfo.duration, i.segmentCount = this._mediaInfo.segmentCount, delete i.segments, delete i.keyframesIndex, this._emitter.emit(c.default.MEDIA_INFO, i)
+ }, e.prototype._reportStatisticsInfo = function() {
+ var e = {};
+ e.url = this._ioctl.currentURL, e.hasRedirect = this._ioctl.hasRedirect, e.hasRedirect && (e.redirectedURL = this._ioctl.currentRedirectedURL), e.speed = this._ioctl.currentSpeed, e.loaderType = this._ioctl.loaderType, e.currentSegmentIndex = this._currentSegmentIndex, e.totalSegmentCount = this._mediaDataSource.segments.length, this._emitter.emit(c.default.STATISTICS_INFO, e)
+ }, e
+ }();
+ t.default = f
+ },
+ "./src/core/transmuxing-events.js":
+ /*!****************************************!*\
+ !*** ./src/core/transmuxing-events.js ***!
+ \****************************************/
+ function(e, t, i) {
+ i.r(t), t.default = {
+ IO_ERROR: "io_error",
+ DEMUX_ERROR: "demux_error",
+ INIT_SEGMENT: "init_segment",
+ MEDIA_SEGMENT: "media_segment",
+ LOADING_COMPLETE: "loading_complete",
+ RECOVERED_EARLY_EOF: "recovered_early_eof",
+ MEDIA_INFO: "media_info",
+ METADATA_ARRIVED: "metadata_arrived",
+ SCRIPTDATA_ARRIVED: "scriptdata_arrived",
+ STATISTICS_INFO: "statistics_info",
+ RECOMMEND_SEEKPOINT: "recommend_seekpoint"
+ }
+ },
+ "./src/core/transmuxing-worker.js":
+ /*!****************************************!*\
+ !*** ./src/core/transmuxing-worker.js ***!
+ \****************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ../utils/logging-control.js */
+ "./src/utils/logging-control.js"),
+ r = i(
+ /*! ../utils/polyfill.js */
+ "./src/utils/polyfill.js"),
+ a = i(
+ /*! ./transmuxing-controller.js */
+ "./src/core/transmuxing-controller.js"),
+ s = i(
+ /*! ./transmuxing-events.js */
+ "./src/core/transmuxing-events.js");
+ t.default = function(e) {
+ var t = null,
+ i = function(t, i) {
+ e.postMessage({
+ msg: "logcat_callback",
+ data: {
+ type: t,
+ logcat: i
+ }
+ })
+ }.bind(this);
+
+ function o(t, i) {
+ var n = {
+ msg: s.default.INIT_SEGMENT,
+ data: {
+ type: t,
+ data: i
+ }
+ };
+ e.postMessage(n, [i.data])
+ }
+
+ function u(t, i) {
+ var n = {
+ msg: s.default.MEDIA_SEGMENT,
+ data: {
+ type: t,
+ data: i
+ }
+ };
+ e.postMessage(n, [i.data])
+ }
+
+ function l() {
+ var t = {
+ msg: s.default.LOADING_COMPLETE
+ };
+ e.postMessage(t)
+ }
+
+ function h() {
+ var t = {
+ msg: s.default.RECOVERED_EARLY_EOF
+ };
+ e.postMessage(t)
+ }
+
+ function d(t) {
+ var i = {
+ msg: s.default.MEDIA_INFO,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function c(t) {
+ var i = {
+ msg: s.default.METADATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function f(t) {
+ var i = {
+ msg: s.default.SCRIPTDATA_ARRIVED,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function p(t) {
+ var i = {
+ msg: s.default.STATISTICS_INFO,
+ data: t
+ };
+ e.postMessage(i)
+ }
+
+ function m(t, i) {
+ e.postMessage({
+ msg: s.default.IO_ERROR,
+ data: {
+ type: t,
+ info: i
+ }
+ })
+ }
+
+ function _(t, i) {
+ e.postMessage({
+ msg: s.default.DEMUX_ERROR,
+ data: {
+ type: t,
+ info: i
+ }
+ })
+ }
+
+ function g(t) {
+ e.postMessage({
+ msg: s.default.RECOMMEND_SEEKPOINT,
+ data: t
+ })
+ }
+ r.default.install(), e.addEventListener("message", (function(r) {
+ switch (r.data.cmd) {
+ case "init":
+ (t = new a.default(r.data.param[0], r.data.param[1])).on(s.default.IO_ERROR, m.bind(this)), t.on(s.default.DEMUX_ERROR, _.bind(this)), t.on(s.default.INIT_SEGMENT, o.bind(this)), t.on(s.default.MEDIA_SEGMENT, u.bind(this)), t.on(s.default.LOADING_COMPLETE, l.bind(this)), t.on(s.default.RECOVERED_EARLY_EOF, h.bind(this)), t.on(s.default.MEDIA_INFO, d.bind(this)), t.on(s.default.METADATA_ARRIVED, c.bind(this)), t.on(s.default.SCRIPTDATA_ARRIVED, f.bind(this)), t.on(s.default.STATISTICS_INFO, p.bind(this)), t.on(s.default.RECOMMEND_SEEKPOINT, g.bind(this));
+ break;
+ case "destroy":
+ t && (t.destroy(), t = null), e.postMessage({
+ msg: "destroyed"
+ });
+ break;
+ case "start":
+ t.start();
+ break;
+ case "stop":
+ t.stop();
+ break;
+ case "seek":
+ t.seek(r.data.param);
+ break;
+ case "pause":
+ t.pause();
+ break;
+ case "resume":
+ t.resume();
+ break;
+ case "logging_config":
+ var v = r.data.param;
+ n.default.applyConfig(v), !0 === v.enableCallback ? n.default.addLogListener(i) : n.default.removeLogListener(i)
+ }
+ }))
+ }
+ },
+ "./src/demux/amf-parser.js":
+ /*!*********************************!*\
+ !*** ./src/demux/amf-parser.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n, r = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ a = i(
+ /*! ../utils/utf8-conv.js */
+ "./src/utils/utf8-conv.js"),
+ s = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ o = (n = new ArrayBuffer(2), new DataView(n).setInt16(0, 256, !0), 256 === new Int16Array(n)[0]),
+ u = function() {
+ function e() {}
+ return e.parseScriptData = function(t, i, n) {
+ var a = {};
+ try {
+ var s = e.parseValue(t, i, n),
+ o = e.parseValue(t, i + s.size, n - s.size);
+ a[s.data] = o.data
+ } catch (e) {
+ r.default.e("AMF", e.toString())
+ }
+ return a
+ }, e.parseObject = function(t, i, n) {
+ if (n < 3) throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");
+ var r = e.parseString(t, i, n),
+ a = e.parseValue(t, i + r.size, n - r.size),
+ o = a.objectEnd;
+ return {
+ data: {
+ name: r.data,
+ value: a.data
+ },
+ size: r.size + a.size,
+ objectEnd: o
+ }
+ }, e.parseVariable = function(t, i, n) {
+ return e.parseObject(t, i, n)
+ }, e.parseString = function(e, t, i) {
+ if (i < 2) throw new s.IllegalStateException("Data not enough when parse String");
+ var n = new DataView(e, t, i).getUint16(0, !o);
+ return {
+ data: n > 0 ? (0, a.default)(new Uint8Array(e, t + 2, n)) : "",
+ size: 2 + n
+ }
+ }, e.parseLongString = function(e, t, i) {
+ if (i < 4) throw new s.IllegalStateException("Data not enough when parse LongString");
+ var n = new DataView(e, t, i).getUint32(0, !o);
+ return {
+ data: n > 0 ? (0, a.default)(new Uint8Array(e, t + 4, n)) : "",
+ size: 4 + n
+ }
+ }, e.parseDate = function(e, t, i) {
+ if (i < 10) throw new s.IllegalStateException("Data size invalid when parse Date");
+ var n = new DataView(e, t, i),
+ r = n.getFloat64(0, !o),
+ a = n.getInt16(8, !o);
+ return {
+ data: new Date(r += 60 * a * 1e3),
+ size: 10
+ }
+ }, e.parseValue = function(t, i, n) {
+ if (n < 1) throw new s.IllegalStateException("Data not enough when parse Value");
+ var a, u = new DataView(t, i, n),
+ l = 1,
+ h = u.getUint8(0),
+ d = !1;
+ try {
+ switch (h) {
+ case 0:
+ a = u.getFloat64(1, !o), l += 8;
+ break;
+ case 1:
+ a = !!u.getUint8(1), l += 1;
+ break;
+ case 2:
+ var c = e.parseString(t, i + 1, n - 1);
+ a = c.data, l += c.size;
+ break;
+ case 3:
+ a = {};
+ var f = 0;
+ for (9 == (16777215 & u.getUint32(n - 4, !o)) && (f = 3); l < n - 4;) {
+ var p = e.parseObject(t, i + l, n - l - f);
+ if (p.objectEnd) break;
+ a[p.data.name] = p.data.value, l += p.size
+ }
+ l <= n - 3 && 9 == (16777215 & u.getUint32(l - 1, !o)) && (l += 3);
+ break;
+ case 8:
+ for (a = {}, l += 4, f = 0, 9 == (16777215 & u.getUint32(n - 4, !o)) && (f = 3); l < n - 8;) {
+ var m = e.parseVariable(t, i + l, n - l - f);
+ if (m.objectEnd) break;
+ a[m.data.name] = m.data.value, l += m.size
+ }
+ l <= n - 3 && 9 == (16777215 & u.getUint32(l - 1, !o)) && (l += 3);
+ break;
+ case 9:
+ a = void 0, l = 1, d = !0;
+ break;
+ case 10:
+ a = [];
+ var _ = u.getUint32(1, !o);
+ l += 4;
+ for (var g = 0; g < _; g++) {
+ var v = e.parseValue(t, i + l, n - l);
+ a.push(v.data), l += v.size
+ }
+ break;
+ case 11:
+ var y = e.parseDate(t, i + 1, n - 1);
+ a = y.data, l += y.size;
+ break;
+ case 12:
+ var b = e.parseString(t, i + 1, n - 1);
+ a = b.data, l += b.size;
+ break;
+ default:
+ l = n, r.default.w("AMF", "Unsupported AMF value type " + h)
+ }
+ } catch (e) {
+ r.default.e("AMF", e.toString())
+ }
+ return {
+ data: a,
+ size: l,
+ objectEnd: d
+ }
+ }, e
+ }();
+ t.default = u
+ },
+ "./src/demux/demux-errors.js":
+ /*!***********************************!*\
+ !*** ./src/demux/demux-errors.js ***!
+ \***********************************/
+ function(e, t, i) {
+ i.r(t), t.default = {
+ OK: "OK",
+ FORMAT_ERROR: "FormatError",
+ FORMAT_UNSUPPORTED: "FormatUnsupported",
+ CODEC_UNSUPPORTED: "CodecUnsupported"
+ }
+ },
+ "./src/demux/exp-golomb.js":
+ /*!*********************************!*\
+ !*** ./src/demux/exp-golomb.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ r = function() {
+ function e(e) {
+ this.TAG = "ExpGolomb", this._buffer = e, this._buffer_index = 0, this._total_bytes = e.byteLength, this._total_bits = 8 * e.byteLength, this._current_word = 0, this._current_word_bits_left = 0
+ }
+ return e.prototype.destroy = function() {
+ this._buffer = null
+ }, e.prototype._fillCurrentWord = function() {
+ var e = this._total_bytes - this._buffer_index;
+ if (e <= 0) throw new n.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");
+ var t = Math.min(4, e),
+ i = new Uint8Array(4);
+ i.set(this._buffer.subarray(this._buffer_index, this._buffer_index + t)), this._current_word = new DataView(i.buffer).getUint32(0, !1), this._buffer_index += t, this._current_word_bits_left = 8 * t
+ }, e.prototype.readBits = function(e) {
+ if (e > 32) throw new n.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");
+ if (e <= this._current_word_bits_left) {
+ var t = this._current_word >>> 32 - e;
+ return this._current_word <<= e, this._current_word_bits_left -= e, t
+ }
+ var i = this._current_word_bits_left ? this._current_word : 0;
+ i >>>= 32 - this._current_word_bits_left;
+ var r = e - this._current_word_bits_left;
+ this._fillCurrentWord();
+ var a = Math.min(r, this._current_word_bits_left),
+ s = this._current_word >>> 32 - a;
+ return this._current_word <<= a, this._current_word_bits_left -= a, i = i << a | s
+ }, e.prototype.readBool = function() {
+ return 1 === this.readBits(1)
+ }, e.prototype.readByte = function() {
+ return this.readBits(8)
+ }, e.prototype._skipLeadingZero = function() {
+ var e;
+ for (e = 0; e < this._current_word_bits_left; e++)
+ if (0 != (this._current_word & 2147483648 >>> e)) return this._current_word <<= e, this._current_word_bits_left -= e, e;
+ return this._fillCurrentWord(), e + this._skipLeadingZero()
+ }, e.prototype.readUEG = function() {
+ var e = this._skipLeadingZero();
+ return this.readBits(e + 1) - 1
+ }, e.prototype.readSEG = function() {
+ var e = this.readUEG();
+ return 1 & e ? e + 1 >>> 1 : -1 * (e >>> 1)
+ }, e
+ }();
+ t.default = r
+ },
+ "./src/demux/flv-demuxer.js":
+ /*!**********************************!*\
+ !*** ./src/demux/flv-demuxer.js ***!
+ \**********************************/
+ function(e, t, i) {
+ i.r(t);
+ var r = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ a = i(
+ /*! ./amf-parser.js */
+ "./src/demux/amf-parser.js"),
+ s = i(
+ /*! ./sps-parser.js */
+ "./src/demux/sps-parser.js"),
+ o = i(
+ /*! ./hevc-sps-parser.js */
+ "./src/demux/hevc-sps-parser.js"),
+ u = i(
+ /*! ./demux-errors.js */
+ "./src/demux/demux-errors.js"),
+ l = i(
+ /*! ../core/media-info.js */
+ "./src/core/media-info.js"),
+ h = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ d = function() {
+ function e(e, t) {
+ var i;
+ this.TAG = "FLVDemuxer", this._config = t, this._onError = null, this._onMediaInfo = null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this._onDataAvailable = null, this._dataOffset = e.dataOffset, this._firstParse = !0, this._dispatch = !1, this._hasAudio = e.hasAudioTrack, this._hasVideo = e.hasVideoTrack, this._hasAudioFlagOverrided = !1, this._hasVideoFlagOverrided = !1, this._audioInitialMetadataDispatched = !1, this._videoInitialMetadataDispatched = !1, this._mediaInfo = new l.default, this._mediaInfo.hasAudio = this._hasAudio, this._mediaInfo.hasVideo = this._hasVideo, this._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._naluLengthSize = 4, this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1, this._referenceFrameRate = {
+ fixed: !0,
+ fps: 23.976,
+ fps_num: 23976,
+ fps_den: 1e3
+ }, this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3], this._mpegSamplingRates = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0], this._mpegAudioV20SampleRateTable = [22050, 24e3, 16e3, 0], this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0], this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1], this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1], this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1], this._videoTrack = {
+ type: "video",
+ id: 1,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, this._audioTrack = {
+ type: "audio",
+ id: 2,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ }, this._littleEndian = (i = new ArrayBuffer(2), new DataView(i).setInt16(0, 256, !0), 256 === new Int16Array(i)[0])
+ }
+ return e.prototype.destroy = function() {
+ this._mediaInfo = null, this._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._videoTrack = null, this._audioTrack = null, this._onError = null, this._onMediaInfo = null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this._onDataAvailable = null
+ }, e.probe = function(e) {
+ var t = new Uint8Array(e),
+ i = {
+ match: !1
+ };
+ if (70 !== t[0] || 76 !== t[1] || 86 !== t[2] || 1 !== t[3]) return i;
+ var n, r, a = (4 & t[4]) >>> 2 != 0,
+ s = 0 != (1 & t[4]),
+ o = (n = t)[r = 5] << 24 | n[r + 1] << 16 | n[r + 2] << 8 | n[r + 3];
+ return o < 9 ? i : {
+ match: !0,
+ consumed: o,
+ dataOffset: o,
+ hasAudioTrack: a,
+ hasVideoTrack: s
+ }
+ }, e.prototype.bindDataSource = function(e) {
+ return e.onDataArrival = this.parseChunks.bind(this), this
+ }, Object.defineProperty(e.prototype, "onTrackMetadata", {
+ get: function() {
+ return this._onTrackMetadata
+ },
+ set: function(e) {
+ this._onTrackMetadata = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMediaInfo", {
+ get: function() {
+ return this._onMediaInfo
+ },
+ set: function(e) {
+ this._onMediaInfo = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMetaDataArrived", {
+ get: function() {
+ return this._onMetaDataArrived
+ },
+ set: function(e) {
+ this._onMetaDataArrived = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onScriptDataArrived", {
+ get: function() {
+ return this._onScriptDataArrived
+ },
+ set: function(e) {
+ this._onScriptDataArrived = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataAvailable", {
+ get: function() {
+ return this._onDataAvailable
+ },
+ set: function(e) {
+ this._onDataAvailable = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "timestampBase", {
+ get: function() {
+ return this._timestampBase
+ },
+ set: function(e) {
+ this._timestampBase = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedDuration", {
+ get: function() {
+ return this._duration
+ },
+ set: function(e) {
+ this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedHasAudio", {
+ set: function(e) {
+ this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "overridedHasVideo", {
+ set: function(e) {
+ this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.resetMediaInfo = function() {
+ this._mediaInfo = new l.default
+ }, e.prototype._isInitialMetadataDispatched = function() {
+ return this._hasAudio && this._hasVideo ? this._audioInitialMetadataDispatched && this._videoInitialMetadataDispatched : this._hasAudio && !this._hasVideo ? this._audioInitialMetadataDispatched : !(this._hasAudio || !this._hasVideo) && this._videoInitialMetadataDispatched
+ }, e.prototype.parseChunks = function(t, i) {
+ if (!(this._onError && this._onMediaInfo && this._onTrackMetadata && this._onDataAvailable)) throw new h.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
+ var n = 0,
+ a = this._littleEndian;
+ if (0 === i) {
+ if (!(t.byteLength > 13)) return 0;
+ n = e.probe(t).dataOffset
+ }
+ for (this._firstParse && (this._firstParse = !1, i + n !== this._dataOffset && r.default.w(this.TAG, "First time parsing but chunk byteStart invalid!"), 0 !== (s = new DataView(t, n)).getUint32(0, !a) && r.default.w(this.TAG, "PrevTagSize0 !== 0 !!!"), n += 4); n < t.byteLength;) {
+ this._dispatch = !0;
+ var s = new DataView(t, n);
+ if (n + 11 + 4 > t.byteLength) break;
+ var o = s.getUint8(0),
+ u = 16777215 & s.getUint32(0, !a);
+ if (n + 11 + u + 4 > t.byteLength) break;
+ if (8 === o || 9 === o || 18 === o) {
+ var l = s.getUint8(4),
+ d = s.getUint8(5),
+ c = s.getUint8(6) | d << 8 | l << 16 | s.getUint8(7) << 24;
+ 0 != (16777215 & s.getUint32(7, !a)) && r.default.w(this.TAG, "Meet tag which has StreamID != 0!");
+ var f = n + 11;
+ switch (o) {
+ case 8:
+ this._parseAudioData(t, f, u, c);
+ break;
+ case 9:
+ this._parseVideoData(t, f, u, c, i + n);
+ break;
+ case 18:
+ this._parseScriptData(t, f, u)
+ }
+ var p = s.getUint32(11 + u, !a);
+ p !== 11 + u && r.default.w(this.TAG, "Invalid PrevTagSize " + p), n += 11 + u + 4
+ } else r.default.w(this.TAG, "Unsupported tag type " + o + ", skipped"), n += 11 + u + 4
+ }
+ return this._isInitialMetadataDispatched() && this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack), n
+ }, e.prototype._parseScriptData = function(e, t, i) {
+ var s = a.default.parseScriptData(e, t, i);
+ if (s.hasOwnProperty("onMetaData")) {
+ if (null == s.onMetaData || "object" !== n(s.onMetaData)) return void r.default.w(this.TAG, "Invalid onMetaData structure!");
+ this._metadata && r.default.w(this.TAG, "Found another onMetaData tag!"), this._metadata = s;
+ var o = this._metadata.onMetaData;
+ if (this._onMetaDataArrived && this._onMetaDataArrived(Object.assign({}, o)), "boolean" == typeof o.hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = o.hasAudio, this._mediaInfo.hasAudio = this._hasAudio), "boolean" == typeof o.hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = o.hasVideo, this._mediaInfo.hasVideo = this._hasVideo), "number" == typeof o.audiodatarate && (this._mediaInfo.audioDataRate = o.audiodatarate), "number" == typeof o.videodatarate && (this._mediaInfo.videoDataRate = o.videodatarate), "number" == typeof o.width && (this._mediaInfo.width = o.width), "number" == typeof o.height && (this._mediaInfo.height = o.height), "number" == typeof o.duration) {
+ if (!this._durationOverrided) {
+ var u = Math.floor(o.duration * this._timescale);
+ this._duration = u, this._mediaInfo.duration = u
+ }
+ } else this._mediaInfo.duration = 0;
+ if ("number" == typeof o.framerate) {
+ var l = Math.floor(1e3 * o.framerate);
+ if (l > 0) {
+ var h = l / 1e3;
+ this._referenceFrameRate.fixed = !0, this._referenceFrameRate.fps = h, this._referenceFrameRate.fps_num = l, this._referenceFrameRate.fps_den = 1e3, this._mediaInfo.fps = h
+ }
+ }
+ if ("object" === n(o.keyframes)) {
+ this._mediaInfo.hasKeyframesIndex = !0;
+ var d = o.keyframes;
+ this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(d), o.keyframes = null
+ } else this._mediaInfo.hasKeyframesIndex = !1;
+ this._dispatch = !1, this._mediaInfo.metadata = o, r.default.v(this.TAG, "Parsed onMetaData"), this._mediaInfo.isComplete() && this._onMediaInfo(this._mediaInfo)
+ }
+ Object.keys(s).length > 0 && this._onScriptDataArrived && this._onScriptDataArrived(Object.assign({}, s))
+ }, e.prototype._parseKeyframesIndex = function(e) {
+ for (var t = [], i = [], n = 1; n < e.times.length; n++) {
+ var r = this._timestampBase + Math.floor(1e3 * e.times[n]);
+ t.push(r), i.push(e.filepositions[n])
+ }
+ return {
+ times: t,
+ filepositions: i
+ }
+ }, e.prototype._parseAudioData = function(e, t, i, n) {
+ if (i <= 1) r.default.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!");
+ else if (!0 !== this._hasAudioFlagOverrided || !1 !== this._hasAudio) {
+ this._littleEndian;
+ var a = new DataView(e, t, i).getUint8(0),
+ s = a >>> 4;
+ if (2 === s || 10 === s) {
+ var o = 0,
+ l = (12 & a) >>> 2;
+ if (l >= 0 && l <= 4) {
+ o = this._flvSoundRateTable[l];
+ var h = 1 & a,
+ d = this._audioMetadata,
+ c = this._audioTrack;
+ if (d || (!1 === this._hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = !0, this._mediaInfo.hasAudio = !0), (d = this._audioMetadata = {}).type = "audio", d.id = c.id, d.timescale = this._timescale, d.duration = this._duration, d.audioSampleRate = o, d.channelCount = 0 === h ? 1 : 2), 10 === s) {
+ var f = this._parseAACAudioData(e, t + 1, i - 1);
+ if (null == f) return;
+ if (0 === f.packetType) {
+ d.config && r.default.w(this.TAG, "Found another AudioSpecificConfig!");
+ var p = f.data;
+ d.audioSampleRate = p.samplingRate, d.channelCount = p.channelCount, d.codec = p.codec, d.originalCodec = p.originalCodec, d.config = p.config, d.refSampleDuration = 1024 / d.audioSampleRate * d.timescale, r.default.v(this.TAG, "Parsed AudioSpecificConfig"), this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._audioInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("audio", d), (g = this._mediaInfo).audioCodec = d.originalCodec, g.audioSampleRate = d.audioSampleRate, g.audioChannelCount = d.channelCount, g.hasVideo ? null != g.videoCodec && (g.mimeType = 'video/x-flv; codecs="' + g.videoCodec + "," + g.audioCodec + '"') : g.mimeType = 'video/x-flv; codecs="' + g.audioCodec + '"', g.isComplete() && this._onMediaInfo(g)
+ } else if (1 === f.packetType) {
+ var m = this._timestampBase + n,
+ _ = {
+ unit: f.data,
+ length: f.data.byteLength,
+ dts: m,
+ pts: m
+ };
+ c.samples.push(_), c.length += f.data.length
+ } else r.default.e(this.TAG, "Flv: Unsupported AAC data type " + f.packetType)
+ } else if (2 === s) {
+ if (!d.codec) {
+ var g;
+ if (null == (p = this._parseMP3AudioData(e, t + 1, i - 1, !0))) return;
+ d.audioSampleRate = p.samplingRate, d.channelCount = p.channelCount, d.codec = p.codec, d.originalCodec = p.originalCodec, d.refSampleDuration = 1152 / d.audioSampleRate * d.timescale, r.default.v(this.TAG, "Parsed MPEG Audio Frame Header"), this._audioInitialMetadataDispatched = !0, this._onTrackMetadata("audio", d), (g = this._mediaInfo).audioCodec = d.codec, g.audioSampleRate = d.audioSampleRate, g.audioChannelCount = d.channelCount, g.audioDataRate = p.bitRate, g.hasVideo ? null != g.videoCodec && (g.mimeType = 'video/x-flv; codecs="' + g.videoCodec + "," + g.audioCodec + '"') : g.mimeType = 'video/x-flv; codecs="' + g.audioCodec + '"', g.isComplete() && this._onMediaInfo(g)
+ }
+ var v = this._parseMP3AudioData(e, t + 1, i - 1, !1);
+ if (null == v) return;
+ m = this._timestampBase + n;
+ var y = {
+ unit: v,
+ length: v.byteLength,
+ dts: m,
+ pts: m
+ };
+ c.samples.push(y), c.length += v.length
+ }
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + l)
+ } else this._onError(u.default.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + s)
+ }
+ }, e.prototype._parseAACAudioData = function(e, t, i) {
+ if (!(i <= 1)) {
+ var n = {},
+ a = new Uint8Array(e, t, i);
+ return n.packetType = a[0], 0 === a[0] ? n.data = this._parseAACAudioSpecificConfig(e, t + 1, i - 1) : n.data = a.subarray(1), n
+ }
+ r.default.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!")
+ }, e.prototype._parseAACAudioSpecificConfig = function(e, t, i) {
+ var n, r, a = new Uint8Array(e, t, i),
+ s = null,
+ o = 0,
+ l = null;
+ if (o = n = a[0] >>> 3, (r = (7 & a[0]) << 1 | a[1] >>> 7) < 0 || r >= this._mpegSamplingRates.length) this._onError(u.default.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
+ else {
+ var h = this._mpegSamplingRates[r],
+ d = (120 & a[1]) >>> 3;
+ if (!(d < 0 || d >= 8)) {
+ 5 === o && (l = (7 & a[1]) << 1 | a[2] >>> 7, a[2]);
+ var c = self.navigator.userAgent.toLowerCase();
+ return -1 !== c.indexOf("firefox") ? r >= 6 ? (o = 5, s = new Array(4), l = r - 3) : (o = 2, s = new Array(2), l = r) : -1 !== c.indexOf("android") ? (o = 2, s = new Array(2), l = r) : (o = 5, l = r, s = new Array(4), r >= 6 ? l = r - 3 : 1 === d && (o = 2, s = new Array(2), l = r)), s[0] = o << 3, s[0] |= (15 & r) >>> 1, s[1] = (15 & r) << 7, s[1] |= (15 & d) << 3, 5 === o && (s[1] |= (15 & l) >>> 1, s[2] = (1 & l) << 7, s[2] |= 8, s[3] = 0), {
+ config: s,
+ samplingRate: h,
+ channelCount: d,
+ codec: "mp4a.40." + o,
+ originalCodec: "mp4a.40." + n
+ }
+ }
+ this._onError(u.default.FORMAT_ERROR, "Flv: AAC invalid channel configuration")
+ }
+ }, e.prototype._parseMP3AudioData = function(e, t, i, n) {
+ if (!(i < 4)) {
+ this._littleEndian;
+ var a = new Uint8Array(e, t, i),
+ s = null;
+ if (n) {
+ if (255 !== a[0]) return;
+ var o = a[1] >>> 3 & 3,
+ u = (6 & a[1]) >> 1,
+ l = (240 & a[2]) >>> 4,
+ h = (12 & a[2]) >>> 2,
+ d = 3 != (a[3] >>> 6 & 3) ? 2 : 1,
+ c = 0,
+ f = 0;
+ switch (o) {
+ case 0:
+ c = this._mpegAudioV25SampleRateTable[h];
+ break;
+ case 2:
+ c = this._mpegAudioV20SampleRateTable[h];
+ break;
+ case 3:
+ c = this._mpegAudioV10SampleRateTable[h]
+ }
+ switch (u) {
+ case 1:
+ l < this._mpegAudioL3BitRateTable.length && (f = this._mpegAudioL3BitRateTable[l]);
+ break;
+ case 2:
+ l < this._mpegAudioL2BitRateTable.length && (f = this._mpegAudioL2BitRateTable[l]);
+ break;
+ case 3:
+ l < this._mpegAudioL1BitRateTable.length && (f = this._mpegAudioL1BitRateTable[l])
+ }
+ s = {
+ bitRate: f,
+ samplingRate: c,
+ channelCount: d,
+ codec: "mp3",
+ originalCodec: "mp3"
+ }
+ } else s = a;
+ return s
+ }
+ r.default.w(this.TAG, "Flv: Invalid MP3 packet, header missing!")
+ }, e.prototype._parseVideoData = function(e, t, i, n, a) {
+ if (i <= 1) r.default.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
+ else if (!0 !== this._hasVideoFlagOverrided || !1 !== this._hasVideo) {
+ var s = new Uint8Array(e, t, i)[0],
+ o = (240 & s) >>> 4,
+ l = 15 & s;
+ 7 === l || 12 === l ? 7 === l ? this._parseAVCVideoPacket(e, t + 1, i - 1, n, a, o) : 12 === l && this._parseHVCVideoPacket(e, t + 1, i - 1, n, a, o) : this._onError(u.default.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + l)
+ }
+ }, e.prototype._parseAVCVideoPacket = function(e, t, i, n, a, s) {
+ if (i < 4) r.default.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
+ else {
+ var o = this._littleEndian,
+ l = new DataView(e, t, i),
+ h = l.getUint8(0),
+ d = (16777215 & l.getUint32(0, !o)) << 8 >> 8;
+ if (0 === h) this._parseAVCDecoderConfigurationRecord(e, t + 4, i - 4);
+ else if (1 === h) this._parseAVCVideoData(e, t + 4, i - 4, n, a, s, d);
+ else if (2 !== h) return void this._onError(u.default.FORMAT_ERROR, "Flv: Invalid video packet type " + h)
+ }
+ }, e.prototype._parseAVCDecoderConfigurationRecord = function(e, t, i) {
+ if (i < 7) r.default.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
+ else {
+ var n = this._videoMetadata,
+ a = this._videoTrack,
+ o = this._littleEndian,
+ l = new DataView(e, t, i);
+ n ? void 0 !== n.avcc && r.default.w(this.TAG, "Found another AVCDecoderConfigurationRecord!") : (!1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this._mediaInfo.hasVideo = !0), (n = this._videoMetadata = {}).type = "video", n.id = a.id, n.timescale = this._timescale, n.duration = this._duration);
+ var h = l.getUint8(0),
+ d = l.getUint8(1);
+ if (l.getUint8(2), l.getUint8(3), 1 === h && 0 !== d)
+ if (this._naluLengthSize = 1 + (3 & l.getUint8(4)), 3 === this._naluLengthSize || 4 === this._naluLengthSize) {
+ var c = 31 & l.getUint8(5);
+ if (0 !== c) {
+ c > 1 && r.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + c);
+ for (var f = 6, p = 0; p < c; p++) {
+ var m = l.getUint16(f, !o);
+ if (f += 2, 0 !== m) {
+ var _ = new Uint8Array(e, t + f, m);
+ f += m;
+ var g = s.default.parseSPS(_);
+ if (0 === p) {
+ n.codecWidth = g.codec_size.width, n.codecHeight = g.codec_size.height, n.presentWidth = g.present_size.width, n.presentHeight = g.present_size.height, n.profile = g.profile_string, n.level = g.level_string, n.bitDepth = g.bit_depth, n.chromaFormat = g.chroma_format, n.sarRatio = g.sar_ratio, n.frameRate = g.frame_rate, !1 !== g.frame_rate.fixed && 0 !== g.frame_rate.fps_num && 0 !== g.frame_rate.fps_den || (n.frameRate = this._referenceFrameRate);
+ var v = n.frameRate.fps_den,
+ y = n.frameRate.fps_num;
+ n.refSampleDuration = n.timescale * (v / y);
+ for (var b = _.subarray(1, 4), S = "avc1.", T = 0; T < 3; T++) {
+ var E = b[T].toString(16);
+ E.length < 2 && (E = "0" + E), S += E
+ }
+ n.codec = S;
+ var w = this._mediaInfo;
+ w.width = n.codecWidth, w.height = n.codecHeight, w.fps = n.frameRate.fps, w.profile = n.profile, w.level = n.level, w.refFrames = g.ref_frames, w.chromaFormat = g.chroma_format_string, w.sarNum = n.sarRatio.width, w.sarDen = n.sarRatio.height, w.videoCodec = S, w.hasAudio ? null != w.audioCodec && (w.mimeType = 'video/x-flv; codecs="' + w.videoCodec + "," + w.audioCodec + '"') : w.mimeType = 'video/x-flv; codecs="' + w.videoCodec + '"', w.isComplete() && this._onMediaInfo(w)
+ }
+ }
+ }
+ var A = l.getUint8(f);
+ if (0 !== A) {
+ for (A > 1 && r.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + A), f++, p = 0; p < A; p++) m = l.getUint16(f, !o), f += 2, 0 !== m && (f += m);
+ n.avcc = new Uint8Array(i), n.avcc.set(new Uint8Array(e, t, i), 0), r.default.v(this.TAG, "Parsed AVCDecoderConfigurationRecord"), this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._videoInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("video", n)
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS")
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS")
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
+ else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord")
+ }
+ }, e.prototype._parseAVCVideoData = function(e, t, i, n, a, s, o) {
+ for (var u = this._littleEndian, l = new DataView(e, t, i), h = [], d = 0, c = 0, f = this._naluLengthSize, p = this._timestampBase + n, m = 1 === s; c < i;) {
+ if (c + 4 >= i) {
+ r.default.w(this.TAG, "Malformed Nalu near timestamp " + p + ", offset = " + c + ", dataSize = " + i);
+ break
+ }
+ var _ = l.getUint32(c, !u);
+ if (3 === f && (_ >>>= 8), _ > i - f) return void r.default.w(this.TAG, "Malformed Nalus near timestamp " + p + ", NaluSize > DataSize!");
+ var g = 31 & l.getUint8(c + f);
+ 5 === g && (m = !0);
+ var v = new Uint8Array(e, t + c, f + _),
+ y = {
+ type: g,
+ data: v
+ };
+ h.push(y), d += v.byteLength, c += f + _
+ }
+ if (h.length) {
+ var b = this._videoTrack,
+ S = {
+ units: h,
+ length: d,
+ isKeyframe: m,
+ dts: p,
+ cts: o,
+ pts: p + o
+ };
+ m && (S.fileposition = a), b.samples.push(S), b.length += d
+ }
+ }, e.prototype._parseHVCVideoPacket = function(e, t, i, n, a, s) {
+ if (i < 4) r.default.w(this.TAG, "Flv: Invalid HVC packet, missing HVCPacketType or/and CompositionTime");
+ else {
+ var o = this._littleEndian,
+ l = new DataView(e, t, i),
+ h = l.getUint8(0),
+ d = (16777215 & l.getUint32(0, !o)) << 8 >> 8;
+ if (0 === h) this._parseHVCDecoderConfigurationRecord(e, t + 4, i - 4);
+ else if (1 === h) this._parseHVCVideoData(e, t + 4, i - 4, n, a, s, d);
+ else if (2 !== h) return void this._onError(u.default.FORMAT_ERROR, "Flv: Invalid video packet type " + h)
+ }
+ }, e.prototype._parseHVCDecoderConfigurationRecord = function(e, t, i) {
+ if (i < 23) r.default.w(this.TAG, "Flv: Invalid HVCDecoderConfigurationRecord, lack of data!");
+ else {
+ var n = this._videoMetadata,
+ a = this._videoTrack,
+ s = this._littleEndian,
+ l = new DataView(e, t, i);
+ if (n ? void 0 !== n.avcc && r.default.w(this.TAG, "Found another HVCDecoderConfigurationRecord!") : (!1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this._mediaInfo.hasVideo = !0), (n = this._videoMetadata = {}).type = "video", n.id = a.id, n.timescale = this._timescale, n.duration = this._duration), 1 === l.getUint8(0))
+ if (this._naluLengthSize = 1 + (3 & l.getUint8(21)), 3 === this._naluLengthSize || 4 === this._naluLengthSize) {
+ for (var h, d, c, f = l.getUint8(22), p = 23, m = [], _ = 0; _ < f; _++) {
+ var g = 63 & l.getUint8(p++),
+ v = l.getUint16(p, !s);
+ if (p += 2, 0 !== v) {
+ switch (g) {
+ case 32:
+ h += v;
+ break;
+ case 33:
+ d += v;
+ break;
+ case 34:
+ c += v
+ }
+ for (var y = 0; y < v; y++) {
+ var b = l.getUint16(p, !s);
+ if (p += 2, 0 !== b) {
+ if (33 === g) {
+ var S = new Uint8Array(e, t + p, b);
+ m.push(S)
+ }
+ p += b
+ }
+ }
+ }
+ }
+ if (0 !== h)
+ if (h > 1 && r.default.w(this.TAG, "Flv: Strange HVCDecoderConfigurationRecord: VPS Count = " + h), 0 !== d)
+ if (d > 1 && r.default.w(this.TAG, "Flv: Strange HVCDecoderConfigurationRecord: SPS Count = " + d), 0 !== c) {
+ c > 1 && r.default.w(this.TAG, "Flv: Strange HVCDecoderConfigurationRecord: PPS Count = " + d);
+ var T = m[0],
+ E = o.default.parseSPS(T);
+ n.codecWidth = E.codec_size.width, n.codecHeight = E.codec_size.height, n.presentWidth = E.present_size.width, n.presentHeight = E.present_size.height, n.profile = E.profile_string, n.level = E.level_string, n.profile_idc = E.profile_idc, n.level_idc = E.level_idc, n.bitDepth = E.bit_depth, n.chromaFormat = E.chroma_format, n.sarRatio = E.sar_ratio, n.frameRate = E.frame_rate, !1 !== E.frame_rate.fixed && 0 !== E.frame_rate.fps_num && 0 !== E.frame_rate.fps_den || (n.frameRate = this._referenceFrameRate);
+ var w = n.frameRate.fps_den,
+ A = n.frameRate.fps_num;
+ n.refSampleDuration = n.timescale * (w / A);
+ var C = "hvc1." + n.profile_idc + ".1.L" + n.level_idc + ".B0";
+ n.codec = C;
+ var k = this._mediaInfo;
+ k.width = n.codecWidth, k.height = n.codecHeight, k.fps = n.frameRate.fps, k.profile = n.profile, k.level = n.level, k.refFrames = E.ref_frames, k.chromaFormat = E.chroma_format_string, k.sarNum = n.sarRatio.width, k.sarDen = n.sarRatio.height, k.videoCodec = C, k.hasAudio ? null != k.audioCodec && (k.mimeType = 'video/x-flv; codecs="' + k.videoCodec + "," + k.audioCodec + '"') : k.mimeType = 'video/x-flv; codecs="' + k.videoCodec + '"', k.isComplete() && this._onMediaInfo(k), n.avcc = new Uint8Array(i), n.avcc.set(new Uint8Array(e, t, i), 0), r.default.v(this.TAG, "Parsed HVCDecoderConfigurationRecord"), this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._videoInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("video", n)
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid HVCDecoderConfigurationRecord: No PPS");
+ else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid HVCDecoderConfigurationRecord: No SPS");
+ else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid HVCDecoderConfigurationRecord: No VPS")
+ } else this._onError(u.default.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
+ else this._onError(u.default.FORMAT_ERROR, "Flv: Invalid HVCDecoderConfigurationRecord")
+ }
+ }, e.prototype._parseHVCVideoData = function(e, t, i, n, a, s, o) {
+ for (var u = this._littleEndian, l = new DataView(e, t, i), h = [], d = 0, c = 0, f = this._naluLengthSize, p = this._timestampBase + n, m = 1 === s; c < i;) {
+ if (c + 4 >= i) {
+ r.default.w(this.TAG, "Malformed Nalu near timestamp " + p + ", offset = " + c + ", dataSize = " + i);
+ break
+ }
+ var _ = l.getUint32(c, !u);
+ if (3 === f && (_ >>>= 8), _ > i - f) return void r.default.w(this.TAG, "Malformed Nalus near timestamp " + p + ", NaluSize > DataSize!");
+ var g = l.getUint8(c + f) >> 1 & 63;
+ g >= 16 && g <= 23 && (m = !0);
+ var v = new Uint8Array(e, t + c, f + _),
+ y = {
+ type: g,
+ data: v
+ };
+ h.push(y), d += v.byteLength, c += f + _
+ }
+ if (h.length) {
+ var b = this._videoTrack,
+ S = {
+ units: h,
+ length: d,
+ isKeyframe: m,
+ dts: p,
+ cts: o,
+ pts: p + o
+ };
+ m && (S.fileposition = a), b.samples.push(S), b.length += d
+ }
+ }, e
+ }();
+ t.default = d
+ },
+ "./src/demux/hevc-sps-parser.js":
+ /*!**************************************!*\
+ !*** ./src/demux/hevc-sps-parser.js ***!
+ \**************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ./exp-golomb.js */
+ "./src/demux/exp-golomb.js"),
+ r = i(
+ /*! ./sps-parser.js */
+ "./src/demux/sps-parser.js"),
+ a = function() {
+ function e() {}
+ return e.parseSPS = function(t) {
+ var i = r.default._ebsp2rbsp(t),
+ a = new n.default(i),
+ s = {};
+ a.readBits(16), a.readBits(4);
+ var o = a.readBits(3);
+ a.readBits(1), e._hvcc_parse_ptl(a, s, o), a.readUEG();
+ var u = 0,
+ l = a.readUEG();
+ 3 == l && (u = a.readBits(1)), s.sar_width = s.sar_height = 1, s.conf_win_left_offset = s.conf_win_right_offset = s.conf_win_top_offset = s.conf_win_bottom_offset = 0, s.def_disp_win_left_offset = s.def_disp_win_right_offset = s.def_disp_win_top_offset = s.def_disp_win_bottom_offset = 0;
+ var h = a.readUEG(),
+ d = a.readUEG();
+ a.readBits(1) && (s.conf_win_left_offset = a.readUEG(), s.conf_win_right_offset = a.readUEG(), s.conf_win_top_offset = a.readUEG(), s.conf_win_bottom_offset = a.readUEG(), 1 === s.default_display_window_flag && (s.conf_win_left_offset, s.def_disp_win_left_offset, s.conf_win_right_offset, s.def_disp_win_right_offset, s.conf_win_top_offset, s.def_disp_win_top_offset, s.conf_win_bottom_offset, s.def_disp_win_bottom_offset));
+ var c = a.readUEG() + 8;
+ a.readUEG();
+ for (var f = a.readUEG(), p = a.readBits(1) ? 0 : o; p <= o; p++) e._skip_sub_layer_ordering_info(a);
+ a.readUEG(), a.readUEG(), a.readUEG(), a.readUEG(), a.readUEG(), a.readUEG(), a.readBits(1) && a.readBits(1) && e._skip_scaling_list_data(a), a.readBits(1), a.readBits(1), a.readBits(1) && (a.readBits(4), a.readBits(4), a.readUEG(), a.readUEG(), a.readBits(1));
+ var m = [],
+ _ = a.readUEG();
+ for (p = 0; p < _; p++) {
+ var g = e._parse_rps(a, p, _, m);
+ if (g < 0) return g
+ }
+ if (a.readBits(1)) {
+ var v = a.readUEG();
+ for (p = 0; p < v; p++) {
+ var y = Math.min(f + 4, 16);
+ if (y > 32) {
+ for (var b = y / 32, S = y % 32, T = 0; T < b; T++) a.readBits(32);
+ a.readBits(S)
+ } else a.readBits(y);
+ a.readBits(1)
+ }
+ }
+ a.readBits(1), a.readBits(1), a.readBits(1) && e._hvcc_parse_vui(a, s, o);
+ var E = e.getProfileString(s.profile_idc),
+ w = e.getLevelString(s.level_idc),
+ A = 1;
+ 1 === s.sar_width && 1 === s.sar_height || (A = s.sar_width / s.sar_height);
+ var C = h,
+ k = d,
+ P = 1 === l && 0 === u ? 2 : 1;
+ C -= (1 !== l && 2 != l || 0 !== u ? 1 : 2) * (s.conf_win_left_offset + s.conf_win_right_offset), k -= P * (s.conf_win_top_offset + s.conf_win_bottom_offset);
+ var I = Math.ceil(C * A);
+ return a.destroy(), a = null, {
+ profile_string: E,
+ level_string: w,
+ profile_idc: s.profile_idc,
+ level_idc: s.level_idc,
+ bit_depth: c,
+ ref_frames: 1,
+ chroma_format: l,
+ chroma_format_string: e.getChromaFormatString(l),
+ frame_rate: {
+ fixed: s.fps_fixed,
+ fps: s.fps,
+ fps_den: s.fps_den,
+ fps_num: s.fps_num
+ },
+ sar_ratio: {
+ width: s.sar_width,
+ height: s.sar_height
+ },
+ codec_size: {
+ width: C,
+ height: k
+ },
+ present_size: {
+ width: I,
+ height: k
+ }
+ }
+ }, e._hvcc_parse_ptl = function(e, t, i) {
+ e.readBits(2);
+ var n = e.readBits(1),
+ r = e.readBits(5);
+ e.readBits(32), e.readBits(32), e.readBits(16);
+ var a = e.readByte();
+ void 0 === t.tier_flag || void 0 === t.level_idc || t.tier_flag < n ? t.level_idc = a : t.level_idc = Math.max(t.level_idc, a), t.profile_idc = Math.max(void 0 === t.profile_idc ? 0 : t.profile_idc, r);
+ for (var s = [], o = [], u = 0; u < i; u++) s.push(e.readBits(1)), o.push(e.readBits(1));
+ if (i > 0)
+ for (u = i; u < 8; u++) e.readBits(2);
+ for (u = 0; u < i; u++) s[u] && (e.readBits(32), e.readBits(32), e.readBits(24)), o[u] && e.readByte()
+ }, e._parse_rps = function(e, t, i, n) {
+ if (t && e.readBits(1)) {
+ if (t >= i) return -1;
+ e.readBits(1), e.readUEG(), n[t] = 0;
+ for (var r = 0; r <= n[t - 1]; r++) {
+ var a = 0,
+ s = e.readBits(1);
+ s || (a = e.readBits(1)), (s || a) && n[t]++
+ }
+ } else {
+ var o = e.readUEG(),
+ u = e.readUEG();
+ for (n[t] = o + u, r = 0; r < o; r++) e.readUEG(), e.readBits(1);
+ for (r = 0; r < u; r++) e.readUEG(), e.readBits(1)
+ }
+ return 0
+ }, e._hvcc_parse_vui = function(t, i, n) {
+ t.readBits(1) && 255 == t.readByte() && (i.sar_width = t.readBits(16), i.sar_height = t.readBits(16)), t.readBits(1) && t.readBits(1), t.readBits(1) && (t.readBits(4), t.readBits(1) && t.readBits(24)), t.readBits(1) && (t.readUEG(), t.readUEG()), t.readBits(3), i.default_display_window_flag = t.readBits(1), i.default_display_window_flag && (i.def_disp_win_left_offset = t.readUEG(), i.def_disp_win_right_offset = t.readUEG(), i.def_disp_win_top_offset = t.readUEG(), i.def_disp_win_bottom_offset = t.readUEG()), t.readBits(1) && (e._skip_timing_info(t, i), t.readBits(1) && e._skip_hrd_parameters(t, i, 1, n)), t.readBits(1) && (t.readBits(3), t.readUEG(), t.readUEG(), t.readUEG(), t.readUEG(), t.readUEG())
+ }, e._skip_sub_layer_ordering_info = function(e, t) {
+ e.readUEG(), e.readUEG(), e.readUEG()
+ }, e._skip_scaling_list_data = function(e) {
+ for (var t = 0; t < 4; t++)
+ for (var i = 0; i < (3 == t ? 2 : 6); i++)
+ if (e.readBits(1)) {
+ var n = Math.min(64, 1 << 4 + (t << 1));
+ t > 1 && e.readSEG();
+ for (var r = 0; r < n; r++) e.readSEG()
+ } else e.readUEG()
+ }, e._skip_sub_layer_hrd_parameters = function(e, t, i) {
+ for (var n = 0; n <= t; n++) e.readUEG(), e.readUEG(), i && (e.readUEG(), e.readUEG()), e.readBits(1)
+ }, e._skip_timing_info = function(e, t) {
+ t.fps_den = e.readBits(32), t.fps_num = e.readBits(32), t.fps_den > 0 && (t.fps = t.fps_num / t.fps_den);
+ var i = 0;
+ e.readBits(1) && (i = e.readUEG()) >= 0 && (t.fps /= i + 1)
+ }, e._skip_hrd_parameters = function(t, i, n) {
+ var r = 0,
+ a = 0;
+ if (i && (r = t.readBits(1), a = t.readBits(1), r || a)) {
+ var s = t.readBits(1);
+ s && t.readBits(19), t.readByte(), s && t.readBits(4), t.readBits(15)
+ }
+ for (var o = 0; o <= n; o++) {
+ var u = 0,
+ l = 0,
+ h = 0,
+ d = t.readBits(1);
+ hvcc.fps_fixed = d, d || (h = t.readBits(1)), h ? t.readUEG() : l = t.readBits(1), l || (u = t.readUEG(t)), r && e._skip_sub_layer_hrd_parameters(t, u, 0), a && e._skip_sub_layer_hrd_parameters(t, u, 0)
+ }
+ }, e.getProfileString = function(e) {
+ switch (e) {
+ case 1:
+ return "Main";
+ case 2:
+ return "Main10";
+ case 3:
+ return "MainSP";
+ case 4:
+ return "Rext";
+ case 9:
+ return "SCC";
+ default:
+ return "Unknown"
+ }
+ }, e.getLevelString = function(e) {
+ return (e / 30).toFixed(1)
+ }, e.getChromaFormatString = function(e) {
+ switch (e) {
+ case 0:
+ return "4:0:0";
+ case 1:
+ return "4:2:0";
+ case 2:
+ return "4:2:2";
+ case 3:
+ return "4:4:4";
+ default:
+ return "Unknown"
+ }
+ }, e
+ }();
+ t.default = a
+ },
+ "./src/demux/sps-parser.js":
+ /*!*********************************!*\
+ !*** ./src/demux/sps-parser.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ./exp-golomb.js */
+ "./src/demux/exp-golomb.js"),
+ r = function() {
+ function e() {}
+ return e._ebsp2rbsp = function(e) {
+ for (var t = e, i = t.byteLength, n = new Uint8Array(i), r = 0, a = 0; a < i; a++) a >= 2 && 3 === t[a] && 0 === t[a - 1] && 0 === t[a - 2] || (n[r] = t[a], r++);
+ return new Uint8Array(n.buffer, 0, r)
+ }, e.parseSPS = function(t) {
+ var i = e._ebsp2rbsp(t),
+ r = new n.default(i);
+ r.readByte();
+ var a = r.readByte();
+ r.readByte();
+ var s = r.readByte();
+ r.readUEG();
+ var o = e.getProfileString(a),
+ u = e.getLevelString(s),
+ l = 1,
+ h = 420,
+ d = 8;
+ if ((100 === a || 110 === a || 122 === a || 244 === a || 44 === a || 83 === a || 86 === a || 118 === a || 128 === a || 138 === a || 144 === a) && (3 === (l = r.readUEG()) && r.readBits(1), l <= 3 && (h = [0, 420, 422, 444][l]), d = r.readUEG() + 8, r.readUEG(), r.readBits(1), r.readBool()))
+ for (var c = 3 !== l ? 8 : 12, f = 0; f < c; f++) r.readBool() && (f < 6 ? e._skipScalingList(r, 16) : e._skipScalingList(r, 64));
+ r.readUEG();
+ var p = r.readUEG();
+ if (0 === p) r.readUEG();
+ else if (1 === p) {
+ r.readBits(1), r.readSEG(), r.readSEG();
+ var m = r.readUEG();
+ for (f = 0; f < m; f++) r.readSEG()
+ }
+ var _ = r.readUEG();
+ r.readBits(1);
+ var g = r.readUEG(),
+ v = r.readUEG(),
+ y = r.readBits(1);
+ 0 === y && r.readBits(1), r.readBits(1);
+ var b = 0,
+ S = 0,
+ T = 0,
+ E = 0;
+ r.readBool() && (b = r.readUEG(), S = r.readUEG(), T = r.readUEG(), E = r.readUEG());
+ var w = 1,
+ A = 1,
+ C = 0,
+ k = !0,
+ P = 0,
+ I = 0;
+ if (r.readBool()) {
+ if (r.readBool()) {
+ var L = r.readByte();
+ L > 0 && L < 16 ? (w = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2][L - 1], A = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1][L - 1]) : 255 === L && (w = r.readByte() << 8 | r.readByte(), A = r.readByte() << 8 | r.readByte())
+ }
+ if (r.readBool() && r.readBool(), r.readBool() && (r.readBits(4), r.readBool() && r.readBits(24)), r.readBool() && (r.readUEG(), r.readUEG()), r.readBool()) {
+ var x = r.readBits(32),
+ R = r.readBits(32);
+ k = r.readBool(), C = (P = R) / (I = 2 * x)
+ }
+ }
+ var D = 1;
+ 1 === w && 1 === A || (D = w / A);
+ var O = 0,
+ U = 0;
+ 0 === l ? (O = 1, U = 2 - y) : (O = 3 === l ? 1 : 2, U = (1 === l ? 2 : 1) * (2 - y));
+ var M = 16 * (g + 1),
+ F = 16 * (v + 1) * (2 - y);
+ M -= (b + S) * O, F -= (T + E) * U;
+ var B = Math.ceil(M * D);
+ return r.destroy(), r = null, {
+ profile_string: o,
+ level_string: u,
+ bit_depth: d,
+ ref_frames: _,
+ chroma_format: h,
+ chroma_format_string: e.getChromaFormatString(h),
+ frame_rate: {
+ fixed: k,
+ fps: C,
+ fps_den: I,
+ fps_num: P
+ },
+ sar_ratio: {
+ width: w,
+ height: A
+ },
+ codec_size: {
+ width: M,
+ height: F
+ },
+ present_size: {
+ width: B,
+ height: F
+ }
+ }
+ }, e._skipScalingList = function(e, t) {
+ for (var i = 8, n = 8, r = 0; r < t; r++) 0 !== n && (n = (i + e.readSEG() + 256) % 256), i = 0 === n ? i : n
+ }, e.getProfileString = function(e) {
+ switch (e) {
+ case 66:
+ return "Baseline";
+ case 77:
+ return "Main";
+ case 88:
+ return "Extended";
+ case 100:
+ return "High";
+ case 110:
+ return "High10";
+ case 122:
+ return "High422";
+ case 244:
+ return "High444";
+ default:
+ return "Unknown"
+ }
+ }, e.getLevelString = function(e) {
+ return (e / 10).toFixed(1)
+ }, e.getChromaFormatString = function(e) {
+ switch (e) {
+ case 420:
+ return "4:2:0";
+ case 422:
+ return "4:2:2";
+ case 444:
+ return "4:4:4";
+ default:
+ return "Unknown"
+ }
+ }, e
+ }();
+ t.default = r
+ },
+ "./src/flv.js":
+ /*!********************!*\
+ !*** ./src/flv.js ***!
+ \********************/
+ function(e, t, i) {
+ i.r(t);
+ var r = i(
+ /*! ./utils/polyfill.js */
+ "./src/utils/polyfill.js"),
+ a = i(
+ /*! ./core/features.js */
+ "./src/core/features.js"),
+ s = i(
+ /*! ./io/loader.js */
+ "./src/io/loader.js"),
+ o = i(
+ /*! ./player/flv-player.js */
+ "./src/player/flv-player.js"),
+ u = i(
+ /*! ./player/native-player.js */
+ "./src/player/native-player.js"),
+ l = i(
+ /*! ./player/player-events.js */
+ "./src/player/player-events.js"),
+ h = i(
+ /*! ./player/player-errors.js */
+ "./src/player/player-errors.js"),
+ d = i(
+ /*! ./utils/logging-control.js */
+ "./src/utils/logging-control.js"),
+ c = i(
+ /*! ./utils/exception.js */
+ "./src/utils/exception.js");
+ r.default.install();
+ var f = {
+ createPlayer: function(e, t) {
+ var i = e;
+ if (null == i || "object" !== n(i)) throw new c.InvalidArgumentException("MediaDataSource must be an javascript object!");
+ if (!i.hasOwnProperty("type")) throw new c.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");
+ switch (i.type) {
+ case "flv":
+ return new o.default(i, t);
+ default:
+ return new u.default(i, t)
+ }
+ },
+ isSupported: function() {
+ return a.default.supportMSEH264Playback()
+ },
+ getFeatureList: function() {
+ return a.default.getFeatureList()
+ }
+ };
+ f.BaseLoader = s.BaseLoader, f.LoaderStatus = s.LoaderStatus, f.LoaderErrors = s.LoaderErrors, f.Events = l.default, f.ErrorTypes = h.ErrorTypes, f.ErrorDetails = h.ErrorDetails, f.FlvPlayer = o.default, f.NativePlayer = u.default, f.LoggingControl = d.default, Object.defineProperty(f, "version", {
+ enumerable: !0,
+ get: function() {
+ return "1.7.0"
+ }
+ }), t.default = f
+ },
+ "./src/index.js":
+ /*!**********************!*\
+ !*** ./src/index.js ***!
+ \**********************/
+ function(e, t, i) {
+ e.exports = i(
+ /*! ./flv.js */
+ "./src/flv.js").default
+ },
+ "./src/io/fetch-stream-loader.js":
+ /*!***************************************!*\
+ !*** ./src/io/fetch-stream-loader.js ***!
+ \***************************************/
+ function(e, t, i) {
+ i.r(t);
+ var r, a = i(
+ /*! ../utils/browser.js */
+ "./src/utils/browser.js"),
+ s = i(
+ /*! ./loader.js */
+ "./src/io/loader.js"),
+ o = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ u = (r = function(e, t) {
+ return (r = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
+
+ function i() {
+ this.constructor = e
+ }
+ r(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ l = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "fetch-stream-loader") || this;
+ return n.TAG = "FetchStreamLoader", n._seekHandler = t, n._config = i, n._needStash = !0, n._requestAbort = !1, n._contentLength = null, n._receivedLength = 0, n
+ }
+ return u(t, e), t.isSupported = function() {
+ try {
+ var e = a.default.msedge && a.default.version.minor >= 15048,
+ t = !a.default.msedge || e;
+ return self.fetch && self.ReadableStream && t
+ } catch (e) {
+ return !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e, t) {
+ var i = this;
+ this._dataSource = e, this._range = t;
+ var r = e.url;
+ this._config.reuseRedirectedURL && null != e.redirectedURL && (r = e.redirectedURL);
+ var a = this._seekHandler.getConfig(r, t),
+ u = new self.Headers;
+ if ("object" === n(a.headers)) {
+ var l = a.headers;
+ for (var h in l) l.hasOwnProperty(h) && u.append(h, l[h])
+ }
+ var d = {
+ method: "GET",
+ headers: u,
+ mode: "cors",
+ cache: "default",
+ referrerPolicy: "no-referrer-when-downgrade"
+ };
+ if ("object" === n(this._config.headers))
+ for (var h in this._config.headers) u.append(h, this._config.headers[h]);
+ !1 === e.cors && (d.mode = "same-origin"), e.withCredentials && (d.credentials = "include"), e.referrerPolicy && (d.referrerPolicy = e.referrerPolicy), self.AbortController && (this._abortController = new self.AbortController, d.signal = this._abortController.signal), this._status = s.LoaderStatus.kConnecting, self.fetch(a.url, d).then((function(e) {
+ if (i._requestAbort) return i._status = s.LoaderStatus.kIdle, void e.body.cancel();
+ if (e.ok && e.status >= 200 && e.status <= 299) {
+ if (e.url !== a.url && i._onURLRedirect) {
+ var t = i._seekHandler.removeURLParameters(e.url);
+ i._onURLRedirect(t)
+ }
+ var n = e.headers.get("Content-Length");
+ return null != n && (i._contentLength = parseInt(n), 0 !== i._contentLength && i._onContentLengthKnown && i._onContentLengthKnown(i._contentLength)), i._pump.call(i, e.body.getReader())
+ }
+ if (i._status = s.LoaderStatus.kError, !i._onError) throw new o.RuntimeException("FetchStreamLoader: Http code invalid, " + e.status + " " + e.statusText);
+ i._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID, {
+ code: e.status,
+ msg: e.statusText
+ })
+ })).catch((function(e) {
+ if (!i._abortController || !i._abortController.signal.aborted) {
+ if (i._status = s.LoaderStatus.kError, !i._onError) throw e;
+ i._onError(s.LoaderErrors.EXCEPTION, {
+ code: -1,
+ msg: e.message
+ })
+ }
+ }))
+ }, t.prototype.abort = function() {
+ if (this._requestAbort = !0, (this._status !== s.LoaderStatus.kBuffering || !a.default.chrome) && this._abortController) try {
+ this._abortController.abort()
+ } catch (e) {}
+ }, t.prototype._pump = function(e) {
+ var t = this;
+ return e.read().then((function(i) {
+ if (i.done)
+ if (null !== t._contentLength && t._receivedLength < t._contentLength) {
+ t._status = s.LoaderStatus.kError;
+ var n = s.LoaderErrors.EARLY_EOF,
+ r = {
+ code: -1,
+ msg: "Fetch stream meet Early-EOF"
+ };
+ if (!t._onError) throw new o.RuntimeException(r.msg);
+ t._onError(n, r)
+ } else t._status = s.LoaderStatus.kComplete, t._onComplete && t._onComplete(t._range.from, t._range.from + t._receivedLength - 1);
+ else {
+ if (t._abortController && t._abortController.signal.aborted) return void(t._status = s.LoaderStatus.kComplete);
+ if (!0 === t._requestAbort) return t._status = s.LoaderStatus.kComplete, e.cancel();
+ t._status = s.LoaderStatus.kBuffering;
+ var a = i.value.buffer,
+ u = t._range.from + t._receivedLength;
+ t._receivedLength += a.byteLength, t._onDataArrival && t._onDataArrival(a, u, t._receivedLength), t._pump(e)
+ }
+ })).catch((function(e) {
+ if (t._abortController && t._abortController.signal.aborted) t._status = s.LoaderStatus.kComplete;
+ else if (11 !== e.code || !a.default.msedge) {
+ t._status = s.LoaderStatus.kError;
+ var i = 0,
+ n = null;
+ if (19 !== e.code && "network error" !== e.message || !(null === t._contentLength || null !== t._contentLength && t._receivedLength < t._contentLength) ? (i = s.LoaderErrors.EXCEPTION, n = {
+ code: e.code,
+ msg: e.message
+ }) : (i = s.LoaderErrors.EARLY_EOF, n = {
+ code: e.code,
+ msg: "Fetch stream meet Early-EOF"
+ }), !t._onError) throw new o.RuntimeException(n.msg);
+ t._onError(i, n)
+ }
+ }))
+ }, t
+ }(s.BaseLoader);
+ t.default = l
+ },
+ "./src/io/io-controller.js":
+ /*!*********************************!*\
+ !*** ./src/io/io-controller.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ r = i(
+ /*! ./speed-sampler.js */
+ "./src/io/speed-sampler.js"),
+ a = i(
+ /*! ./loader.js */
+ "./src/io/loader.js"),
+ s = i(
+ /*! ./fetch-stream-loader.js */
+ "./src/io/fetch-stream-loader.js"),
+ o = i(
+ /*! ./xhr-moz-chunked-loader.js */
+ "./src/io/xhr-moz-chunked-loader.js"),
+ u = i(
+ /*! ./xhr-range-loader.js */
+ "./src/io/xhr-range-loader.js"),
+ l = i(
+ /*! ./websocket-loader.js */
+ "./src/io/websocket-loader.js"),
+ h = i(
+ /*! ./range-seek-handler.js */
+ "./src/io/range-seek-handler.js"),
+ d = i(
+ /*! ./param-seek-handler.js */
+ "./src/io/param-seek-handler.js"),
+ c = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ f = function() {
+ function e(e, t, i) {
+ this.TAG = "IOController", this._config = t, this._extraData = i, this._stashInitialSize = 393216, null != t.stashInitialSize && t.stashInitialSize > 0 && (this._stashInitialSize = t.stashInitialSize), this._stashUsed = 0, this._stashSize = this._stashInitialSize, this._bufferSize = 3145728, this._stashBuffer = new ArrayBuffer(this._bufferSize), this._stashByteStart = 0, this._enableStash = !0, !1 === t.enableStashBuffer && (this._enableStash = !1), this._loader = null, this._loaderClass = null, this._seekHandler = null, this._dataSource = e, this._isWebSocketURL = /wss?:\/\/(.+?)/.test(e.url), this._refTotalLength = e.filesize ? e.filesize : null, this._totalLength = this._refTotalLength, this._fullRequestFlag = !1, this._currentRange = null, this._redirectedURL = null, this._speedNormalized = 0, this._speedSampler = new r.default, this._speedNormalizeList = [64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096], this._isEarlyEofReconnecting = !1, this._paused = !1, this._resumeFrom = 0, this._onDataArrival = null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this._onRecoveredEarlyEof = null, this._selectSeekHandler(), this._selectLoader(), this._createLoader()
+ }
+ return e.prototype.destroy = function() {
+ this._loader.isWorking() && this._loader.abort(), this._loader.destroy(), this._loader = null, this._loaderClass = null, this._dataSource = null, this._stashBuffer = null, this._stashUsed = this._stashSize = this._bufferSize = this._stashByteStart = 0, this._currentRange = null, this._speedSampler = null, this._isEarlyEofReconnecting = !1, this._onDataArrival = null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this._onRecoveredEarlyEof = null, this._extraData = null
+ }, e.prototype.isWorking = function() {
+ return this._loader && this._loader.isWorking() && !this._paused
+ }, e.prototype.isPaused = function() {
+ return this._paused
+ }, Object.defineProperty(e.prototype, "status", {
+ get: function() {
+ return this._loader.status
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "extraData", {
+ get: function() {
+ return this._extraData
+ },
+ set: function(e) {
+ this._extraData = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataArrival", {
+ get: function() {
+ return this._onDataArrival
+ },
+ set: function(e) {
+ this._onDataArrival = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onSeeked", {
+ get: function() {
+ return this._onSeeked
+ },
+ set: function(e) {
+ this._onSeeked = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onComplete", {
+ get: function() {
+ return this._onComplete
+ },
+ set: function(e) {
+ this._onComplete = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onRedirect", {
+ get: function() {
+ return this._onRedirect
+ },
+ set: function(e) {
+ this._onRedirect = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onRecoveredEarlyEof", {
+ get: function() {
+ return this._onRecoveredEarlyEof
+ },
+ set: function(e) {
+ this._onRecoveredEarlyEof = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentURL", {
+ get: function() {
+ return this._dataSource.url
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "hasRedirect", {
+ get: function() {
+ return null != this._redirectedURL || null != this._dataSource.redirectedURL
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentRedirectedURL", {
+ get: function() {
+ return this._redirectedURL || this._dataSource.redirectedURL
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentSpeed", {
+ get: function() {
+ return this._loaderClass === u.default ? this._loader.currentSpeed : this._speedSampler.lastSecondKBps
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "loaderType", {
+ get: function() {
+ return this._loader.type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._selectSeekHandler = function() {
+ var e = this._config;
+ if ("range" === e.seekType) this._seekHandler = new h.default(this._config.rangeLoadZeroStart);
+ else if ("param" === e.seekType) {
+ var t = e.seekParamStart || "bstart",
+ i = e.seekParamEnd || "bend";
+ this._seekHandler = new d.default(t, i)
+ } else {
+ if ("custom" !== e.seekType) throw new c.InvalidArgumentException("Invalid seekType in config: " + e.seekType);
+ if ("function" != typeof e.customSeekHandler) throw new c.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");
+ this._seekHandler = new e.customSeekHandler
+ }
+ }, e.prototype._selectLoader = function() {
+ if (null != this._config.customLoader) this._loaderClass = this._config.customLoader;
+ else if (this._isWebSocketURL) this._loaderClass = l.default;
+ else if (s.default.isSupported()) this._loaderClass = s.default;
+ else if (o.default.isSupported()) this._loaderClass = o.default;
+ else {
+ if (!u.default.isSupported()) throw new c.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");
+ this._loaderClass = u.default
+ }
+ }, e.prototype._createLoader = function() {
+ this._loader = new this._loaderClass(this._seekHandler, this._config), !1 === this._loader.needStashBuffer && (this._enableStash = !1), this._loader.onContentLengthKnown = this._onContentLengthKnown.bind(this), this._loader.onURLRedirect = this._onURLRedirect.bind(this), this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this), this._loader.onComplete = this._onLoaderComplete.bind(this), this._loader.onError = this._onLoaderError.bind(this)
+ }, e.prototype.open = function(e) {
+ this._currentRange = {
+ from: 0,
+ to: -1
+ }, e && (this._currentRange.from = e), this._speedSampler.reset(), e || (this._fullRequestFlag = !0), this._loader.open(this._dataSource, Object.assign({}, this._currentRange))
+ }, e.prototype.abort = function() {
+ this._loader.abort(), this._paused && (this._paused = !1, this._resumeFrom = 0)
+ }, e.prototype.pause = function() {
+ this.isWorking() && (this._loader.abort(), 0 !== this._stashUsed ? (this._resumeFrom = this._stashByteStart, this._currentRange.to = this._stashByteStart - 1) : this._resumeFrom = this._currentRange.to + 1, this._stashUsed = 0, this._stashByteStart = 0, this._paused = !0)
+ }, e.prototype.resume = function() {
+ if (this._paused) {
+ this._paused = !1;
+ var e = this._resumeFrom;
+ this._resumeFrom = 0, this._internalSeek(e, !0)
+ }
+ }, e.prototype.seek = function(e) {
+ this._paused = !1, this._stashUsed = 0, this._stashByteStart = 0, this._internalSeek(e, !0)
+ }, e.prototype._internalSeek = function(e, t) {
+ this._loader.isWorking() && this._loader.abort(), this._flushStashBuffer(t), this._loader.destroy(), this._loader = null;
+ var i = {
+ from: e,
+ to: -1
+ };
+ this._currentRange = {
+ from: i.from,
+ to: -1
+ }, this._speedSampler.reset(), this._stashSize = this._stashInitialSize, this._createLoader(), this._loader.open(this._dataSource, i), this._onSeeked && this._onSeeked()
+ }, e.prototype.updateUrl = function(e) {
+ if (!e || "string" != typeof e || 0 === e.length) throw new c.InvalidArgumentException("Url must be a non-empty string!");
+ this._dataSource.url = e
+ }, e.prototype._expandBuffer = function(e) {
+ for (var t = this._stashSize; t + 1048576 < e;) t *= 2;
+ if ((t += 1048576) !== this._bufferSize) {
+ var i = new ArrayBuffer(t);
+ if (this._stashUsed > 0) {
+ var n = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
+ new Uint8Array(i, 0, t).set(n, 0)
+ }
+ this._stashBuffer = i, this._bufferSize = t
+ }
+ }, e.prototype._normalizeSpeed = function(e) {
+ var t = this._speedNormalizeList,
+ i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i;
+ if (e < t[0]) return t[0];
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e >= t[n] && e < t[n + 1]) return t[n];
+ t[n] < e ? r = n + 1 : a = n - 1
+ }
+ }, e.prototype._adjustStashSize = function(e) {
+ var t = 0;
+ (t = this._config.isLive || e < 512 ? e : e >= 512 && e <= 1024 ? Math.floor(1.5 * e) : 2 * e) > 8192 && (t = 8192);
+ var i = 1024 * t + 1048576;
+ this._bufferSize < i && this._expandBuffer(i), this._stashSize = 1024 * t
+ }, e.prototype._dispatchChunks = function(e, t) {
+ return this._currentRange.to = t + e.byteLength - 1, this._onDataArrival(e, t)
+ }, e.prototype._onURLRedirect = function(e) {
+ this._redirectedURL = e, this._onRedirect && this._onRedirect(e)
+ }, e.prototype._onContentLengthKnown = function(e) {
+ e && this._fullRequestFlag && (this._totalLength = e, this._fullRequestFlag = !1)
+ }, e.prototype._onLoaderChunkArrival = function(e, t, i) {
+ if (!this._onDataArrival) throw new c.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");
+ if (!this._paused) {
+ this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, this._onRecoveredEarlyEof && this._onRecoveredEarlyEof()), this._speedSampler.addBytes(e.byteLength);
+ var n = this._speedSampler.lastSecondKBps;
+ if (0 !== n) {
+ var r = this._normalizeSpeed(n);
+ this._speedNormalized !== r && (this._speedNormalized = r, this._adjustStashSize(r))
+ }
+ if (this._enableStash)
+ if (0 === this._stashUsed && 0 === this._stashByteStart && (this._stashByteStart = t), this._stashUsed + e.byteLength <= this._stashSize)(o = new Uint8Array(this._stashBuffer, 0, this._stashSize)).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength;
+ else if (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize), this._stashUsed > 0) {
+ var a = this._stashBuffer.slice(0, this._stashUsed);
+ (u = this._dispatchChunks(a, this._stashByteStart)) < a.byteLength ? u > 0 && (l = new Uint8Array(a, u), o.set(l, 0), this._stashUsed = l.byteLength, this._stashByteStart += u) : (this._stashUsed = 0, this._stashByteStart += u), this._stashUsed + e.byteLength > this._bufferSize && (this._expandBuffer(this._stashUsed + e.byteLength), o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), o.set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength
+ } else(u = this._dispatchChunks(e, t)) < e.byteLength && ((s = e.byteLength - u) > this._bufferSize && (this._expandBuffer(s), o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), o.set(new Uint8Array(e, u), 0), this._stashUsed += s, this._stashByteStart = t + u);
+ else if (0 === this._stashUsed) {
+ var s;
+ (u = this._dispatchChunks(e, t)) < e.byteLength && ((s = e.byteLength - u) > this._bufferSize && this._expandBuffer(s), (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)).set(new Uint8Array(e, u), 0), this._stashUsed += s, this._stashByteStart = t + u)
+ } else {
+ var o, u;
+ if (this._stashUsed + e.byteLength > this._bufferSize && this._expandBuffer(this._stashUsed + e.byteLength), (o = new Uint8Array(this._stashBuffer, 0, this._bufferSize)).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength, (u = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart)) < this._stashUsed && u > 0) {
+ var l = new Uint8Array(this._stashBuffer, u);
+ o.set(l, 0)
+ }
+ this._stashUsed -= u, this._stashByteStart += u
+ }
+ }
+ }, e.prototype._flushStashBuffer = function(e) {
+ if (this._stashUsed > 0) {
+ var t = this._stashBuffer.slice(0, this._stashUsed),
+ i = this._dispatchChunks(t, this._stashByteStart),
+ r = t.byteLength - i;
+ if (i < t.byteLength) {
+ if (!e) {
+ if (i > 0) {
+ var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize),
+ s = new Uint8Array(t, i);
+ a.set(s, 0), this._stashUsed = s.byteLength, this._stashByteStart += i
+ }
+ return 0
+ }
+ n.default.w(this.TAG, r + " bytes unconsumed data remain when flush buffer, dropped")
+ }
+ return this._stashUsed = 0, this._stashByteStart = 0, r
+ }
+ return 0
+ }, e.prototype._onLoaderComplete = function(e, t) {
+ this._flushStashBuffer(!0), this._onComplete && this._onComplete(this._extraData)
+ }, e.prototype._onLoaderError = function(e, t) {
+ switch (n.default.e(this.TAG, "Loader error, code = " + t.code + ", msg = " + t.msg), this._flushStashBuffer(!1), this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, e = a.LoaderErrors.UNRECOVERABLE_EARLY_EOF), e) {
+ case a.LoaderErrors.EARLY_EOF:
+ if (!this._config.isLive && this._totalLength) {
+ var i = this._currentRange.to + 1;
+ return void(i < this._totalLength && (n.default.w(this.TAG, "Connection lost, trying reconnect..."), this._isEarlyEofReconnecting = !0, this._internalSeek(i, !1)))
+ }
+ e = a.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
+ break;
+ case a.LoaderErrors.UNRECOVERABLE_EARLY_EOF:
+ case a.LoaderErrors.CONNECTING_TIMEOUT:
+ case a.LoaderErrors.HTTP_STATUS_CODE_INVALID:
+ case a.LoaderErrors.EXCEPTION:
+ }
+ if (!this._onError) throw new c.RuntimeException("IOException: " + t.msg);
+ this._onError(e, t)
+ }, e
+ }();
+ t.default = f
+ },
+ "./src/io/loader.js":
+ /*!**************************!*\
+ !*** ./src/io/loader.js ***!
+ \**************************/
+ function(e, t, i) {
+ i.r(t), i.d(t, {
+ LoaderStatus: function() {
+ return r
+ },
+ LoaderErrors: function() {
+ return a
+ },
+ BaseLoader: function() {
+ return s
+ }
+ });
+ var n = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ r = {
+ kIdle: 0,
+ kConnecting: 1,
+ kBuffering: 2,
+ kError: 3,
+ kComplete: 4
+ },
+ a = {
+ OK: "OK",
+ EXCEPTION: "Exception",
+ HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
+ CONNECTING_TIMEOUT: "ConnectingTimeout",
+ EARLY_EOF: "EarlyEof",
+ UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
+ },
+ s = function() {
+ function e(e) {
+ this._type = e || "undefined", this._status = r.kIdle, this._needStash = !1, this._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this._onError = null, this._onComplete = null
+ }
+ return e.prototype.destroy = function() {
+ this._status = r.kIdle, this._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this._onError = null, this._onComplete = null
+ }, e.prototype.isWorking = function() {
+ return this._status === r.kConnecting || this._status === r.kBuffering
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "status", {
+ get: function() {
+ return this._status
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "needStashBuffer", {
+ get: function() {
+ return this._needStash
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onContentLengthKnown", {
+ get: function() {
+ return this._onContentLengthKnown
+ },
+ set: function(e) {
+ this._onContentLengthKnown = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onURLRedirect", {
+ get: function() {
+ return this._onURLRedirect
+ },
+ set: function(e) {
+ this._onURLRedirect = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onDataArrival", {
+ get: function() {
+ return this._onDataArrival
+ },
+ set: function(e) {
+ this._onDataArrival = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onError", {
+ get: function() {
+ return this._onError
+ },
+ set: function(e) {
+ this._onError = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onComplete", {
+ get: function() {
+ return this._onComplete
+ },
+ set: function(e) {
+ this._onComplete = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.open = function(e, t) {
+ throw new n.NotImplementedException("Unimplemented abstract function!")
+ }, e.prototype.abort = function() {
+ throw new n.NotImplementedException("Unimplemented abstract function!")
+ }, e
+ }()
+ },
+ "./src/io/param-seek-handler.js":
+ /*!**************************************!*\
+ !*** ./src/io/param-seek-handler.js ***!
+ \**************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e(e, t) {
+ this._startName = e, this._endName = t
+ }
+ return e.prototype.getConfig = function(e, t) {
+ var i = e;
+ if (0 !== t.from || -1 !== t.to) {
+ var n = !0; - 1 === i.indexOf("?") && (i += "?", n = !1), n && (i += "&"), i += this._startName + "=" + t.from.toString(), -1 !== t.to && (i += "&" + this._endName + "=" + t.to.toString())
+ }
+ return {
+ url: i,
+ headers: {}
+ }
+ }, e.prototype.removeURLParameters = function(e) {
+ var t = e.split("?")[0],
+ i = void 0,
+ n = e.indexOf("?"); - 1 !== n && (i = e.substring(n + 1));
+ var r = "";
+ if (null != i && i.length > 0)
+ for (var a = i.split("&"), s = 0; s < a.length; s++) {
+ var o = a[s].split("="),
+ u = s > 0;
+ o[0] !== this._startName && o[0] !== this._endName && (u && (r += "&"), r += a[s])
+ }
+ return 0 === r.length ? t : t + "?" + r
+ }, e
+ }();
+ t.default = n
+ },
+ "./src/io/range-seek-handler.js":
+ /*!**************************************!*\
+ !*** ./src/io/range-seek-handler.js ***!
+ \**************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e(e) {
+ this._zeroStart = e || !1
+ }
+ return e.prototype.getConfig = function(e, t) {
+ var i = {};
+ if (0 !== t.from || -1 !== t.to) {
+ var n = void 0;
+ n = -1 !== t.to ? "bytes=" + t.from.toString() + "-" + t.to.toString() : "bytes=" + t.from.toString() + "-", i.Range = n
+ } else this._zeroStart && (i.Range = "bytes=0-");
+ return {
+ url: e,
+ headers: i
+ }
+ }, e.prototype.removeURLParameters = function(e) {
+ return e
+ }, e
+ }();
+ t.default = n
+ },
+ "./src/io/speed-sampler.js":
+ /*!*********************************!*\
+ !*** ./src/io/speed-sampler.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e() {
+ this._firstCheckpoint = 0, this._lastCheckpoint = 0, this._intervalBytes = 0, this._totalBytes = 0, this._lastSecondBytes = 0, self.performance && self.performance.now ? this._now = self.performance.now.bind(self.performance) : this._now = Date.now
+ }
+ return e.prototype.reset = function() {
+ this._firstCheckpoint = this._lastCheckpoint = 0, this._totalBytes = this._intervalBytes = 0, this._lastSecondBytes = 0
+ }, e.prototype.addBytes = function(e) {
+ 0 === this._firstCheckpoint ? (this._firstCheckpoint = this._now(), this._lastCheckpoint = this._firstCheckpoint, this._intervalBytes += e, this._totalBytes += e) : this._now() - this._lastCheckpoint < 1e3 ? (this._intervalBytes += e, this._totalBytes += e) : (this._lastSecondBytes = this._intervalBytes, this._intervalBytes = e, this._totalBytes += e, this._lastCheckpoint = this._now())
+ }, Object.defineProperty(e.prototype, "currentKBps", {
+ get: function() {
+ this.addBytes(0);
+ var e = (this._now() - this._lastCheckpoint) / 1e3;
+ return 0 == e && (e = 1), this._intervalBytes / e / 1024
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "lastSecondKBps", {
+ get: function() {
+ return this.addBytes(0), 0 !== this._lastSecondBytes ? this._lastSecondBytes / 1024 : this._now() - this._lastCheckpoint >= 500 ? this.currentKBps : 0
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "averageKBps", {
+ get: function() {
+ var e = (this._now() - this._firstCheckpoint) / 1e3;
+ return this._totalBytes / e / 1024
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e
+ }();
+ t.default = n
+ },
+ "./src/io/websocket-loader.js":
+ /*!************************************!*\
+ !*** ./src/io/websocket-loader.js ***!
+ \************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n, r = i(
+ /*! ./loader.js */
+ "./src/io/loader.js"),
+ a = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ s = (n = function(e, t) {
+ return (n = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
+
+ function i() {
+ this.constructor = e
+ }
+ n(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ o = function(e) {
+ function t() {
+ var t = e.call(this, "websocket-loader") || this;
+ return t.TAG = "WebSocketLoader", t._needStash = !0, t._ws = null, t._requestAbort = !1, t._receivedLength = 0, t
+ }
+ return s(t, e), t.isSupported = function() {
+ try {
+ return void 0 !== self.WebSocket
+ } catch (e) {
+ return !1
+ }
+ }, t.prototype.destroy = function() {
+ this._ws && this.abort(), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e) {
+ try {
+ var t = this._ws = new self.WebSocket(e.url);
+ t.binaryType = "arraybuffer", t.onopen = this._onWebSocketOpen.bind(this), t.onclose = this._onWebSocketClose.bind(this), t.onmessage = this._onWebSocketMessage.bind(this), t.onerror = this._onWebSocketError.bind(this), this._status = r.LoaderStatus.kConnecting
+ } catch (e) {
+ this._status = r.LoaderStatus.kError;
+ var i = {
+ code: e.code,
+ msg: e.message
+ };
+ if (!this._onError) throw new a.RuntimeException(i.msg);
+ this._onError(r.LoaderErrors.EXCEPTION, i)
+ }
+ }, t.prototype.abort = function() {
+ var e = this._ws;
+ !e || 0 !== e.readyState && 1 !== e.readyState || (this._requestAbort = !0, e.close()), this._ws = null, this._status = r.LoaderStatus.kComplete
+ }, t.prototype._onWebSocketOpen = function(e) {
+ this._status = r.LoaderStatus.kBuffering
+ }, t.prototype._onWebSocketClose = function(e) {
+ !0 !== this._requestAbort ? (this._status = r.LoaderStatus.kComplete, this._onComplete && this._onComplete(0, this._receivedLength - 1)) : this._requestAbort = !1
+ }, t.prototype._onWebSocketMessage = function(e) {
+ var t = this;
+ if (e.data instanceof ArrayBuffer) this._dispatchArrayBuffer(e.data);
+ else if (e.data instanceof Blob) {
+ var i = new FileReader;
+ i.onload = function() {
+ t._dispatchArrayBuffer(i.result)
+ }, i.readAsArrayBuffer(e.data)
+ } else {
+ this._status = r.LoaderStatus.kError;
+ var n = {
+ code: -1,
+ msg: "Unsupported WebSocket message type: " + e.data.constructor.name
+ };
+ if (!this._onError) throw new a.RuntimeException(n.msg);
+ this._onError(r.LoaderErrors.EXCEPTION, n)
+ }
+ }, t.prototype._dispatchArrayBuffer = function(e) {
+ var t = e,
+ i = this._receivedLength;
+ this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this._receivedLength)
+ }, t.prototype._onWebSocketError = function(e) {
+ this._status = r.LoaderStatus.kError;
+ var t = {
+ code: e.code,
+ msg: e.message
+ };
+ if (!this._onError) throw new a.RuntimeException(t.msg);
+ this._onError(r.LoaderErrors.EXCEPTION, t)
+ }, t
+ }(r.BaseLoader);
+ t.default = o
+ },
+ "./src/io/xhr-moz-chunked-loader.js":
+ /*!******************************************!*\
+ !*** ./src/io/xhr-moz-chunked-loader.js ***!
+ \******************************************/
+ function(e, t, i) {
+ i.r(t);
+ var r, a = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ s = i(
+ /*! ./loader.js */
+ "./src/io/loader.js"),
+ o = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ u = (r = function(e, t) {
+ return (r = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
+
+ function i() {
+ this.constructor = e
+ }
+ r(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ l = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "xhr-moz-chunked-loader") || this;
+ return n.TAG = "MozChunkedLoader", n._seekHandler = t, n._config = i, n._needStash = !0, n._xhr = null, n._requestAbort = !1, n._contentLength = null, n._receivedLength = 0, n
+ }
+ return u(t, e), t.isSupported = function() {
+ try {
+ var e = new XMLHttpRequest;
+ return e.open("GET", "https://example.com", !0), e.responseType = "moz-chunked-arraybuffer", "moz-chunked-arraybuffer" === e.responseType
+ } catch (e) {
+ return a.default.w("MozChunkedLoader", e.message), !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onloadend = null, this._xhr.onerror = null, this._xhr = null), e.prototype.destroy.call(this)
+ }, t.prototype.open = function(e, t) {
+ this._dataSource = e, this._range = t;
+ var i = e.url;
+ this._config.reuseRedirectedURL && null != e.redirectedURL && (i = e.redirectedURL);
+ var r = this._seekHandler.getConfig(i, t);
+ this._requestURL = r.url;
+ var a = this._xhr = new XMLHttpRequest;
+ if (a.open("GET", r.url, !0), a.responseType = "moz-chunked-arraybuffer", a.onreadystatechange = this._onReadyStateChange.bind(this), a.onprogress = this._onProgress.bind(this), a.onloadend = this._onLoadEnd.bind(this), a.onerror = this._onXhrError.bind(this), e.withCredentials && (a.withCredentials = !0), "object" === n(r.headers)) {
+ var o = r.headers;
+ for (var u in o) o.hasOwnProperty(u) && a.setRequestHeader(u, o[u])
+ }
+ if ("object" === n(this._config.headers))
+ for (var u in o = this._config.headers) o.hasOwnProperty(u) && a.setRequestHeader(u, o[u]);
+ this._status = s.LoaderStatus.kConnecting, a.send()
+ }, t.prototype.abort = function() {
+ this._requestAbort = !0, this._xhr && this._xhr.abort(), this._status = s.LoaderStatus.kComplete
+ }, t.prototype._onReadyStateChange = function(e) {
+ var t = e.target;
+ if (2 === t.readyState) {
+ if (null != t.responseURL && t.responseURL !== this._requestURL && this._onURLRedirect) {
+ var i = this._seekHandler.removeURLParameters(t.responseURL);
+ this._onURLRedirect(i)
+ }
+ if (0 !== t.status && (t.status < 200 || t.status > 299)) {
+ if (this._status = s.LoaderStatus.kError, !this._onError) throw new o.RuntimeException("MozChunkedLoader: Http code invalid, " + t.status + " " + t.statusText);
+ this._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID, {
+ code: t.status,
+ msg: t.statusText
+ })
+ } else this._status = s.LoaderStatus.kBuffering
+ }
+ }, t.prototype._onProgress = function(e) {
+ if (this._status !== s.LoaderStatus.kError) {
+ null === this._contentLength && null !== e.total && 0 !== e.total && (this._contentLength = e.total, this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength));
+ var t = e.target.response,
+ i = this._range.from + this._receivedLength;
+ this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this._receivedLength)
+ }
+ }, t.prototype._onLoadEnd = function(e) {
+ !0 !== this._requestAbort ? this._status !== s.LoaderStatus.kError && (this._status = s.LoaderStatus.kComplete, this._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1)) : this._requestAbort = !1
+ }, t.prototype._onXhrError = function(e) {
+ this._status = s.LoaderStatus.kError;
+ var t = 0,
+ i = null;
+ if (this._contentLength && e.loaded < this._contentLength ? (t = s.LoaderErrors.EARLY_EOF, i = {
+ code: -1,
+ msg: "Moz-Chunked stream meet Early-Eof"
+ }) : (t = s.LoaderErrors.EXCEPTION, i = {
+ code: -1,
+ msg: e.constructor.name + " " + e.type
+ }), !this._onError) throw new o.RuntimeException(i.msg);
+ this._onError(t, i)
+ }, t
+ }(s.BaseLoader);
+ t.default = l
+ },
+ "./src/io/xhr-range-loader.js":
+ /*!************************************!*\
+ !*** ./src/io/xhr-range-loader.js ***!
+ \************************************/
+ function(e, t, i) {
+ i.r(t);
+ var r, a = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ s = i(
+ /*! ./speed-sampler.js */
+ "./src/io/speed-sampler.js"),
+ o = i(
+ /*! ./loader.js */
+ "./src/io/loader.js"),
+ u = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ l = (r = function(e, t) {
+ return (r = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
+
+ function i() {
+ this.constructor = e
+ }
+ r(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ h = function(e) {
+ function t(t, i) {
+ var n = e.call(this, "xhr-range-loader") || this;
+ return n.TAG = "RangeLoader", n._seekHandler = t, n._config = i, n._needStash = !1, n._chunkSizeKBList = [128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 5120, 6144, 7168, 8192], n._currentChunkSizeKB = 384, n._currentSpeedNormalized = 0, n._zeroSpeedChunkCount = 0, n._xhr = null, n._speedSampler = new s.default, n._requestAbort = !1, n._waitForTotalLength = !1, n._totalLengthReceived = !1, n._currentRequestURL = null, n._currentRedirectedURL = null, n._currentRequestRange = null, n._totalLength = null, n._contentLength = null, n._receivedLength = 0, n._lastTimeLoaded = 0, n
+ }
+ return l(t, e), t.isSupported = function() {
+ try {
+ var e = new XMLHttpRequest;
+ return e.open("GET", "https://example.com", !0), e.responseType = "arraybuffer", "arraybuffer" === e.responseType
+ } catch (e) {
+ return a.default.w("RangeLoader", e.message), !1
+ }
+ }, t.prototype.destroy = function() {
+ this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr = null), e.prototype.destroy.call(this)
+ }, Object.defineProperty(t.prototype, "currentSpeed", {
+ get: function() {
+ return this._speedSampler.lastSecondKBps
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t.prototype.open = function(e, t) {
+ this._dataSource = e, this._range = t, this._status = o.LoaderStatus.kConnecting;
+ var i = !1;
+ null != this._dataSource.filesize && 0 !== this._dataSource.filesize && (i = !0, this._totalLength = this._dataSource.filesize), this._totalLengthReceived || i ? this._openSubRange() : (this._waitForTotalLength = !0, this._internalOpen(this._dataSource, {
+ from: 0,
+ to: -1
+ }))
+ }, t.prototype._openSubRange = function() {
+ var e = 1024 * this._currentChunkSizeKB,
+ t = this._range.from + this._receivedLength,
+ i = t + e;
+ null != this._contentLength && i - this._range.from >= this._contentLength && (i = this._range.from + this._contentLength - 1), this._currentRequestRange = {
+ from: t,
+ to: i
+ }, this._internalOpen(this._dataSource, this._currentRequestRange)
+ }, t.prototype._internalOpen = function(e, t) {
+ this._lastTimeLoaded = 0;
+ var i = e.url;
+ this._config.reuseRedirectedURL && (null != this._currentRedirectedURL ? i = this._currentRedirectedURL : null != e.redirectedURL && (i = e.redirectedURL));
+ var r = this._seekHandler.getConfig(i, t);
+ this._currentRequestURL = r.url;
+ var a = this._xhr = new XMLHttpRequest;
+ if (a.open("GET", r.url, !0), a.responseType = "arraybuffer", a.onreadystatechange = this._onReadyStateChange.bind(this), a.onprogress = this._onProgress.bind(this), a.onload = this._onLoad.bind(this), a.onerror = this._onXhrError.bind(this), e.withCredentials && (a.withCredentials = !0), "object" === n(r.headers)) {
+ var s = r.headers;
+ for (var o in s) s.hasOwnProperty(o) && a.setRequestHeader(o, s[o])
+ }
+ if ("object" === n(this._config.headers))
+ for (var o in s = this._config.headers) s.hasOwnProperty(o) && a.setRequestHeader(o, s[o]);
+ a.send()
+ }, t.prototype.abort = function() {
+ this._requestAbort = !0, this._internalAbort(), this._status = o.LoaderStatus.kComplete
+ }, t.prototype._internalAbort = function() {
+ this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr.abort(), this._xhr = null)
+ }, t.prototype._onReadyStateChange = function(e) {
+ var t = e.target;
+ if (2 === t.readyState) {
+ if (null != t.responseURL) {
+ var i = this._seekHandler.removeURLParameters(t.responseURL);
+ t.responseURL !== this._currentRequestURL && i !== this._currentRedirectedURL && (this._currentRedirectedURL = i, this._onURLRedirect && this._onURLRedirect(i))
+ }
+ if (t.status >= 200 && t.status <= 299) {
+ if (this._waitForTotalLength) return;
+ this._status = o.LoaderStatus.kBuffering
+ } else {
+ if (this._status = o.LoaderStatus.kError, !this._onError) throw new u.RuntimeException("RangeLoader: Http code invalid, " + t.status + " " + t.statusText);
+ this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID, {
+ code: t.status,
+ msg: t.statusText
+ })
+ }
+ }
+ }, t.prototype._onProgress = function(e) {
+ if (this._status !== o.LoaderStatus.kError) {
+ if (null === this._contentLength) {
+ var t = !1;
+ if (this._waitForTotalLength) {
+ this._waitForTotalLength = !1, this._totalLengthReceived = !0, t = !0;
+ var i = e.total;
+ this._internalAbort(), null != i & 0 !== i && (this._totalLength = i)
+ }
+ if (-1 === this._range.to ? this._contentLength = this._totalLength - this._range.from : this._contentLength = this._range.to - this._range.from + 1, t) return void this._openSubRange();
+ this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength)
+ }
+ var n = e.loaded - this._lastTimeLoaded;
+ this._lastTimeLoaded = e.loaded, this._speedSampler.addBytes(n)
+ }
+ }, t.prototype._normalizeSpeed = function(e) {
+ var t = this._chunkSizeKBList,
+ i = t.length - 1,
+ n = 0,
+ r = 0,
+ a = i;
+ if (e < t[0]) return t[0];
+ for (; r <= a;) {
+ if ((n = r + Math.floor((a - r) / 2)) === i || e >= t[n] && e < t[n + 1]) return t[n];
+ t[n] < e ? r = n + 1 : a = n - 1
+ }
+ }, t.prototype._onLoad = function(e) {
+ if (this._status !== o.LoaderStatus.kError)
+ if (this._waitForTotalLength) this._waitForTotalLength = !1;
+ else {
+ this._lastTimeLoaded = 0;
+ var t = this._speedSampler.lastSecondKBps;
+ if (0 === t && (this._zeroSpeedChunkCount++, this._zeroSpeedChunkCount >= 3 && (t = this._speedSampler.currentKBps)), 0 !== t) {
+ var i = this._normalizeSpeed(t);
+ this._currentSpeedNormalized !== i && (this._currentSpeedNormalized = i, this._currentChunkSizeKB = i)
+ }
+ var n = e.target.response,
+ r = this._range.from + this._receivedLength;
+ this._receivedLength += n.byteLength;
+ var a = !1;
+ null != this._contentLength && this._receivedLength < this._contentLength ? this._openSubRange() : a = !0, this._onDataArrival && this._onDataArrival(n, r, this._receivedLength), a && (this._status = o.LoaderStatus.kComplete, this._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1))
+ }
+ }, t.prototype._onXhrError = function(e) {
+ this._status = o.LoaderStatus.kError;
+ var t = 0,
+ i = null;
+ if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength ? (t = o.LoaderErrors.EARLY_EOF, i = {
+ code: -1,
+ msg: "RangeLoader meet Early-Eof"
+ }) : (t = o.LoaderErrors.EXCEPTION, i = {
+ code: -1,
+ msg: e.constructor.name + " " + e.type
+ }), !this._onError) throw new u.RuntimeException(i.msg);
+ this._onError(t, i)
+ }, t
+ }(o.BaseLoader);
+ t.default = h
+ },
+ "./src/player/flv-player.js":
+ /*!**********************************!*\
+ !*** ./src/player/flv-player.js ***!
+ \**********************************/
+ function(e, t, i) {
+ i.r(t);
+ var r = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ a = i.n(r),
+ s = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ o = i(
+ /*! ../utils/browser.js */
+ "./src/utils/browser.js"),
+ u = i(
+ /*! ./player-events.js */
+ "./src/player/player-events.js"),
+ l = i(
+ /*! ../core/transmuxer.js */
+ "./src/core/transmuxer.js"),
+ h = i(
+ /*! ../core/transmuxing-events.js */
+ "./src/core/transmuxing-events.js"),
+ d = i(
+ /*! ../core/mse-controller.js */
+ "./src/core/mse-controller.js"),
+ c = i(
+ /*! ../core/mse-events.js */
+ "./src/core/mse-events.js"),
+ f = i(
+ /*! ./player-errors.js */
+ "./src/player/player-errors.js"),
+ p = i(
+ /*! ../config.js */
+ "./src/config.js"),
+ m = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ _ = function() {
+ function e(e, t) {
+ if (this.TAG = "FlvPlayer", this._type = "FlvPlayer", this._emitter = new(a()), this._config = (0, p.createDefaultConfig)(), "object" === n(t) && Object.assign(this._config, t), "flv" !== e.type.toLowerCase()) throw new m.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");
+ !0 === e.isLive && (this._config.isLive = !0), this.e = {
+ onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
+ onvSeeking: this._onvSeeking.bind(this),
+ onvCanPlay: this._onvCanPlay.bind(this),
+ onvStalled: this._onvStalled.bind(this),
+ onvProgress: this._onvProgress.bind(this)
+ }, self.performance && self.performance.now ? this._now = self.performance.now.bind(self.performance) : this._now = Date.now, this._pendingSeekTime = null, this._requestSetTime = !1, this._seekpointRecord = null, this._progressChecker = null, this._mediaDataSource = e, this._mediaElement = null, this._msectl = null, this._transmuxer = null, this._mseSourceOpened = !1, this._hasPendingLoad = !1, this._receivedCanPlay = !1, this._mediaInfo = null, this._statisticsInfo = null;
+ var i = o.default.chrome && (o.default.version.major < 50 || 50 === o.default.version.major && o.default.version.build < 2661);
+ this._alwaysSeekKeyframe = !!(i || o.default.msedge || o.default.msie), this._alwaysSeekKeyframe && (this._config.accurateSeek = !1)
+ }
+ return e.prototype.destroy = function() {
+ null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker = null), this._transmuxer && this.unload(), this._mediaElement && this.detachMediaElement(), this.e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ var i = this;
+ e === u.default.MEDIA_INFO ? null != this._mediaInfo && Promise.resolve().then((function() {
+ i._emitter.emit(u.default.MEDIA_INFO, i.mediaInfo)
+ })) : e === u.default.STATISTICS_INFO && null != this._statisticsInfo && Promise.resolve().then((function() {
+ i._emitter.emit(u.default.STATISTICS_INFO, i.statisticsInfo)
+ })), this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ var t = this;
+ if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), e.addEventListener("seeking", this.e.onvSeeking), e.addEventListener("canplay", this.e.onvCanPlay), e.addEventListener("stalled", this.e.onvStalled), e.addEventListener("progress", this.e.onvProgress), this._msectl = new d.default(this._config), this._msectl.on(c.default.UPDATE_END, this._onmseUpdateEnd.bind(this)), this._msectl.on(c.default.BUFFER_FULL, this._onmseBufferFull.bind(this)), this._msectl.on(c.default.SOURCE_OPEN, (function() {
+ t._mseSourceOpened = !0, t._hasPendingLoad && (t._hasPendingLoad = !1, t.load())
+ })), this._msectl.on(c.default.ERROR, (function(e) {
+ t._emitter.emit(u.default.ERROR, f.ErrorTypes.MEDIA_ERROR, f.ErrorDetails.MEDIA_MSE_ERROR, e)
+ })), this._msectl.attachMediaElement(e), null != this._pendingSeekTime) try {
+ e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
+ } catch (e) {}
+ }, e.prototype.detachMediaElement = function() {
+ this._mediaElement && (this._msectl.detachMediaElement(), this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement.removeEventListener("seeking", this.e.onvSeeking), this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay), this._mediaElement.removeEventListener("stalled", this.e.onvStalled), this._mediaElement.removeEventListener("progress", this.e.onvProgress), this._mediaElement = null), this._msectl && (this._msectl.destroy(), this._msectl = null)
+ }, e.prototype.load = function() {
+ var e = this;
+ if (!this._mediaElement) throw new m.IllegalStateException("HTMLMediaElement must be attached before load()!");
+ if (this._transmuxer) throw new m.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");
+ this._hasPendingLoad || (this._config.deferLoadAfterSourceOpen && !1 === this._mseSourceOpened ? this._hasPendingLoad = !0 : (this._mediaElement.readyState > 0 && (this._requestSetTime = !0, this._mediaElement.currentTime = 0), this._transmuxer = new l.default(this._mediaDataSource, this._config), this._transmuxer.on(h.default.INIT_SEGMENT, (function(t, i) {
+ e._msectl.appendInitSegment(i)
+ })), this._transmuxer.on(h.default.MEDIA_SEGMENT, (function(t, i) {
+ if (e._msectl.appendMediaSegment(i), e._config.lazyLoad && !e._config.isLive) {
+ var n = e._mediaElement.currentTime;
+ i.info.endDts >= 1e3 * (n + e._config.lazyLoadMaxDuration) && null == e._progressChecker && (s.default.v(e.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), e._suspendTransmuxer())
+ }
+ })), this._transmuxer.on(h.default.LOADING_COMPLETE, (function() {
+ e._msectl.endOfStream(), e._emitter.emit(u.default.LOADING_COMPLETE)
+ })), this._transmuxer.on(h.default.RECOVERED_EARLY_EOF, (function() {
+ e._emitter.emit(u.default.RECOVERED_EARLY_EOF)
+ })), this._transmuxer.on(h.default.IO_ERROR, (function(t, i) {
+ e._emitter.emit(u.default.ERROR, f.ErrorTypes.NETWORK_ERROR, t, i)
+ })), this._transmuxer.on(h.default.DEMUX_ERROR, (function(t, i) {
+ e._emitter.emit(u.default.ERROR, f.ErrorTypes.MEDIA_ERROR, t, {
+ code: -1,
+ msg: i
+ })
+ })), this._transmuxer.on(h.default.MEDIA_INFO, (function(t) {
+ e._mediaInfo = t, e._emitter.emit(u.default.MEDIA_INFO, Object.assign({}, t))
+ })), this._transmuxer.on(h.default.METADATA_ARRIVED, (function(t) {
+ e._emitter.emit(u.default.METADATA_ARRIVED, t)
+ })), this._transmuxer.on(h.default.SCRIPTDATA_ARRIVED, (function(t) {
+ e._emitter.emit(u.default.SCRIPTDATA_ARRIVED, t)
+ })), this._transmuxer.on(h.default.STATISTICS_INFO, (function(t) {
+ e._statisticsInfo = e._fillStatisticsInfo(t), e._emitter.emit(u.default.STATISTICS_INFO, Object.assign({}, e._statisticsInfo))
+ })), this._transmuxer.on(h.default.RECOMMEND_SEEKPOINT, (function(t) {
+ e._mediaElement && !e._config.accurateSeek && (e._requestSetTime = !0, e._mediaElement.currentTime = t / 1e3)
+ })), this._transmuxer.open()))
+ }, e.prototype.unload = function() {
+ this._mediaElement && this._mediaElement.pause(), this._msectl && this._msectl.seek(0), this._transmuxer && (this._transmuxer.close(), this._transmuxer.destroy(), this._transmuxer = null)
+ }, e.prototype.play = function() {
+ return this._mediaElement.play()
+ }, e.prototype.pause = function() {
+ this._mediaElement.pause()
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "buffered", {
+ get: function() {
+ return this._mediaElement.buffered
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "duration", {
+ get: function() {
+ return this._mediaElement.duration
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "volume", {
+ get: function() {
+ return this._mediaElement.volume
+ },
+ set: function(e) {
+ this._mediaElement.volume = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "muted", {
+ get: function() {
+ return this._mediaElement.muted
+ },
+ set: function(e) {
+ this._mediaElement.muted = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentTime", {
+ get: function() {
+ return this._mediaElement ? this._mediaElement.currentTime : 0
+ },
+ set: function(e) {
+ this._mediaElement ? this._internalSeek(e) : this._pendingSeekTime = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "mediaInfo", {
+ get: function() {
+ return Object.assign({}, this._mediaInfo)
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "statisticsInfo", {
+ get: function() {
+ return null == this._statisticsInfo && (this._statisticsInfo = {}), this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo), Object.assign({}, this._statisticsInfo)
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._fillStatisticsInfo = function(e) {
+ if (e.playerType = this._type, !(this._mediaElement instanceof HTMLVideoElement)) return e;
+ var t = !0,
+ i = 0,
+ n = 0;
+ if (this._mediaElement.getVideoPlaybackQuality) {
+ var r = this._mediaElement.getVideoPlaybackQuality();
+ i = r.totalVideoFrames, n = r.droppedVideoFrames
+ } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement.webkitDecodedFrameCount, n = this._mediaElement.webkitDroppedFrameCount) : t = !1;
+ return t && (e.decodedFrames = i, e.droppedFrames = n), e
+ }, e.prototype._onmseUpdateEnd = function() {
+ if (this._config.lazyLoad && !this._config.isLive) {
+ for (var e = this._mediaElement.buffered, t = this._mediaElement.currentTime, i = 0, n = 0; n < e.length; n++) {
+ var r = e.start(n),
+ a = e.end(n);
+ if (r <= t && t < a) {
+ i = a;
+ break
+ }
+ }
+ i >= t + this._config.lazyLoadMaxDuration && null == this._progressChecker && (s.default.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), this._suspendTransmuxer())
+ }
+ }, e.prototype._onmseBufferFull = function() {
+ s.default.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task"), null == this._progressChecker && this._suspendTransmuxer()
+ }, e.prototype._suspendTransmuxer = function() {
+ this._transmuxer && (this._transmuxer.pause(), null == this._progressChecker && (this._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3)))
+ }, e.prototype._checkProgressAndResume = function() {
+ for (var e = this._mediaElement.currentTime, t = this._mediaElement.buffered, i = !1, n = 0; n < t.length; n++) {
+ var r = t.start(n),
+ a = t.end(n);
+ if (e >= r && e < a) {
+ e >= a - this._config.lazyLoadRecoverDuration && (i = !0);
+ break
+ }
+ }
+ i && (window.clearInterval(this._progressChecker), this._progressChecker = null, i && (s.default.v(this.TAG, "Continue loading from paused position"), this._transmuxer.resume()))
+ }, e.prototype._isTimepointBuffered = function(e) {
+ for (var t = this._mediaElement.buffered, i = 0; i < t.length; i++) {
+ var n = t.start(i),
+ r = t.end(i);
+ if (e >= n && e < r) return !0
+ }
+ return !1
+ }, e.prototype._internalSeek = function(e) {
+ var t = this._isTimepointBuffered(e),
+ i = !1,
+ n = 0;
+ if (e < 1 && this._mediaElement.buffered.length > 0) {
+ var r = this._mediaElement.buffered.start(0);
+ (r < 1 && e < r || o.default.safari) && (i = !0, n = o.default.safari ? .1 : r)
+ }
+ if (i) this._requestSetTime = !0, this._mediaElement.currentTime = n;
+ else if (t) {
+ if (this._alwaysSeekKeyframe) {
+ var a = this._msectl.getNearestKeyframe(Math.floor(1e3 * e));
+ this._requestSetTime = !0, this._mediaElement.currentTime = null != a ? a.dts / 1e3 : e
+ } else this._requestSetTime = !0, this._mediaElement.currentTime = e;
+ null != this._progressChecker && this._checkProgressAndResume()
+ } else null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e)
+ }, e.prototype._checkAndApplyUnbufferedSeekpoint = function() {
+ if (this._seekpointRecord)
+ if (this._seekpointRecord.recordTime <= this._now() - 100) {
+ var e = this._mediaElement.currentTime;
+ this._seekpointRecord = null, this._isTimepointBuffered(e) || (null != this._progressChecker && (window.clearTimeout(this._progressChecker), this._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e))
+ } else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
+ }, e.prototype._checkAndResumeStuckPlayback = function(e) {
+ var t = this._mediaElement;
+ if (e || !this._receivedCanPlay || t.readyState < 2) {
+ var i = t.buffered;
+ i.length > 0 && t.currentTime < i.start(0) && (s.default.w(this.TAG, "Playback seems stuck at " + t.currentTime + ", seek to " + i.start(0)), this._requestSetTime = !0, this._mediaElement.currentTime = i.start(0), this._mediaElement.removeEventListener("progress", this.e.onvProgress))
+ } else this._mediaElement.removeEventListener("progress", this.e.onvProgress)
+ }, e.prototype._onvLoadedMetadata = function(e) {
+ null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this._pendingSeekTime = null)
+ }, e.prototype._onvSeeking = function(e) {
+ var t = this._mediaElement.currentTime,
+ i = this._mediaElement.buffered;
+ if (this._requestSetTime) this._requestSetTime = !1;
+ else {
+ if (t < 1 && i.length > 0) {
+ var n = i.start(0);
+ if (n < 1 && t < n || o.default.safari) return this._requestSetTime = !0, void(this._mediaElement.currentTime = o.default.safari ? .1 : n)
+ }
+ if (this._isTimepointBuffered(t)) {
+ if (this._alwaysSeekKeyframe) {
+ var r = this._msectl.getNearestKeyframe(Math.floor(1e3 * t));
+ null != r && (this._requestSetTime = !0, this._mediaElement.currentTime = r.dts / 1e3)
+ }
+ null != this._progressChecker && this._checkProgressAndResume()
+ } else this._seekpointRecord = {
+ seekPoint: t,
+ recordTime: this._now()
+ }, window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
+ }
+ }, e.prototype._onvCanPlay = function(e) {
+ this._receivedCanPlay = !0, this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay)
+ }, e.prototype._onvStalled = function(e) {
+ this._checkAndResumeStuckPlayback(!0)
+ }, e.prototype._onvProgress = function(e) {
+ this._checkAndResumeStuckPlayback()
+ }, e
+ }();
+ t.default = _
+ },
+ "./src/player/native-player.js":
+ /*!*************************************!*\
+ !*** ./src/player/native-player.js ***!
+ \*************************************/
+ function(e, t, i) {
+ i.r(t);
+ var r = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ a = i.n(r),
+ s = i(
+ /*! ./player-events.js */
+ "./src/player/player-events.js"),
+ o = i(
+ /*! ../config.js */
+ "./src/config.js"),
+ u = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ l = function() {
+ function e(e, t) {
+ if (this.TAG = "NativePlayer", this._type = "NativePlayer", this._emitter = new(a()), this._config = (0, o.createDefaultConfig)(), "object" === n(t) && Object.assign(this._config, t), "flv" === e.type.toLowerCase()) throw new u.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");
+ if (e.hasOwnProperty("segments")) throw new u.InvalidArgumentException("NativePlayer(" + e.type + ") doesn't support multipart playback!");
+ this.e = {
+ onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
+ }, this._pendingSeekTime = null, this._statisticsReporter = null, this._mediaDataSource = e, this._mediaElement = null
+ }
+ return e.prototype.destroy = function() {
+ this._mediaElement && (this.unload(), this.detachMediaElement()), this.e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null
+ }, e.prototype.on = function(e, t) {
+ var i = this;
+ e === s.default.MEDIA_INFO ? null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise.resolve().then((function() {
+ i._emitter.emit(s.default.MEDIA_INFO, i.mediaInfo)
+ })) : e === s.default.STATISTICS_INFO && null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise.resolve().then((function() {
+ i._emitter.emit(s.default.STATISTICS_INFO, i.statisticsInfo)
+ })), this._emitter.addListener(e, t)
+ }, e.prototype.off = function(e, t) {
+ this._emitter.removeListener(e, t)
+ }, e.prototype.attachMediaElement = function(e) {
+ if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), null != this._pendingSeekTime) try {
+ e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
+ } catch (e) {}
+ }, e.prototype.detachMediaElement = function() {
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement = null), null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype.load = function() {
+ if (!this._mediaElement) throw new u.IllegalStateException("HTMLMediaElement must be attached before load()!");
+ this._mediaElement.src = this._mediaDataSource.url, this._mediaElement.readyState > 0 && (this._mediaElement.currentTime = 0), this._mediaElement.preload = "auto", this._mediaElement.load(), this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval)
+ }, e.prototype.unload = function() {
+ this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src")), null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this._statisticsReporter = null)
+ }, e.prototype.play = function() {
+ return this._mediaElement.play()
+ }, e.prototype.pause = function() {
+ this._mediaElement.pause()
+ }, Object.defineProperty(e.prototype, "type", {
+ get: function() {
+ return this._type
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "buffered", {
+ get: function() {
+ return this._mediaElement.buffered
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "duration", {
+ get: function() {
+ return this._mediaElement.duration
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "volume", {
+ get: function() {
+ return this._mediaElement.volume
+ },
+ set: function(e) {
+ this._mediaElement.volume = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "muted", {
+ get: function() {
+ return this._mediaElement.muted
+ },
+ set: function(e) {
+ this._mediaElement.muted = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "currentTime", {
+ get: function() {
+ return this._mediaElement ? this._mediaElement.currentTime : 0
+ },
+ set: function(e) {
+ this._mediaElement ? this._mediaElement.currentTime = e : this._pendingSeekTime = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "mediaInfo", {
+ get: function() {
+ var e = {
+ mimeType: (this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/") + this._mediaDataSource.type
+ };
+ return this._mediaElement && (e.duration = Math.floor(1e3 * this._mediaElement.duration), this._mediaElement instanceof HTMLVideoElement && (e.width = this._mediaElement.videoWidth, e.height = this._mediaElement.videoHeight)), e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "statisticsInfo", {
+ get: function() {
+ var e = {
+ playerType: this._type,
+ url: this._mediaDataSource.url
+ };
+ if (!(this._mediaElement instanceof HTMLVideoElement)) return e;
+ var t = !0,
+ i = 0,
+ n = 0;
+ if (this._mediaElement.getVideoPlaybackQuality) {
+ var r = this._mediaElement.getVideoPlaybackQuality();
+ i = r.totalVideoFrames, n = r.droppedVideoFrames
+ } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement.webkitDecodedFrameCount, n = this._mediaElement.webkitDroppedFrameCount) : t = !1;
+ return t && (e.decodedFrames = i, e.droppedFrames = n), e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype._onvLoadedMetadata = function(e) {
+ null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this._pendingSeekTime = null), this._emitter.emit(s.default.MEDIA_INFO, this.mediaInfo)
+ }, e.prototype._reportStatisticsInfo = function() {
+ this._emitter.emit(s.default.STATISTICS_INFO, this.statisticsInfo)
+ }, e
+ }();
+ t.default = l
+ },
+ "./src/player/player-errors.js":
+ /*!*************************************!*\
+ !*** ./src/player/player-errors.js ***!
+ \*************************************/
+ function(e, t, i) {
+ i.r(t), i.d(t, {
+ ErrorTypes: function() {
+ return a
+ },
+ ErrorDetails: function() {
+ return s
+ }
+ });
+ var n = i(
+ /*! ../io/loader.js */
+ "./src/io/loader.js"),
+ r = i(
+ /*! ../demux/demux-errors.js */
+ "./src/demux/demux-errors.js"),
+ a = {
+ NETWORK_ERROR: "NetworkError",
+ MEDIA_ERROR: "MediaError",
+ OTHER_ERROR: "OtherError"
+ },
+ s = {
+ NETWORK_EXCEPTION: n.LoaderErrors.EXCEPTION,
+ NETWORK_STATUS_CODE_INVALID: n.LoaderErrors.HTTP_STATUS_CODE_INVALID,
+ NETWORK_TIMEOUT: n.LoaderErrors.CONNECTING_TIMEOUT,
+ NETWORK_UNRECOVERABLE_EARLY_EOF: n.LoaderErrors.UNRECOVERABLE_EARLY_EOF,
+ MEDIA_MSE_ERROR: "MediaMSEError",
+ MEDIA_FORMAT_ERROR: r.default.FORMAT_ERROR,
+ MEDIA_FORMAT_UNSUPPORTED: r.default.FORMAT_UNSUPPORTED,
+ MEDIA_CODEC_UNSUPPORTED: r.default.CODEC_UNSUPPORTED
+ }
+ },
+ "./src/player/player-events.js":
+ /*!*************************************!*\
+ !*** ./src/player/player-events.js ***!
+ \*************************************/
+ function(e, t, i) {
+ i.r(t), t.default = {
+ ERROR: "error",
+ LOADING_COMPLETE: "loading_complete",
+ RECOVERED_EARLY_EOF: "recovered_early_eof",
+ MEDIA_INFO: "media_info",
+ METADATA_ARRIVED: "metadata_arrived",
+ SCRIPTDATA_ARRIVED: "scriptdata_arrived",
+ STATISTICS_INFO: "statistics_info"
+ }
+ },
+ "./src/remux/aac-silent.js":
+ /*!*********************************!*\
+ !*** ./src/remux/aac-silent.js ***!
+ \*********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e() {}
+ return e.getSilentFrame = function(e, t) {
+ if ("mp4a.40.2" === e) {
+ if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]);
+ if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
+ if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
+ if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
+ if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
+ if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224])
+ } else {
+ if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
+ if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
+ if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94])
+ }
+ return null
+ }, e
+ }();
+ t.default = n
+ },
+ "./src/remux/mp4-generator.js":
+ /*!************************************!*\
+ !*** ./src/remux/mp4-generator.js ***!
+ \************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e() {}
+ return e.init = function() {
+ for (var t in e.types = {
+ hvc1: [],
+ hvcC: [],
+ avc1: [],
+ avcC: [],
+ btrt: [],
+ dinf: [],
+ dref: [],
+ esds: [],
+ ftyp: [],
+ hdlr: [],
+ mdat: [],
+ mdhd: [],
+ mdia: [],
+ mfhd: [],
+ minf: [],
+ moof: [],
+ moov: [],
+ mp4a: [],
+ mvex: [],
+ mvhd: [],
+ sdtp: [],
+ stbl: [],
+ stco: [],
+ stsc: [],
+ stsd: [],
+ stsz: [],
+ stts: [],
+ tfdt: [],
+ tfhd: [],
+ traf: [],
+ trak: [],
+ trun: [],
+ trex: [],
+ tkhd: [],
+ vmhd: [],
+ smhd: [],
+ pasp: [],
+ ".mp3": []
+ }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t.charCodeAt(2), t.charCodeAt(3)]);
+ var i = e.constants = {};
+ i.FTYP = new Uint8Array([105, 115, 111, 109, 0, 0, 0, 1, 105, 115, 111, 109, 97, 118, 99, 49]), i.STSD_PREFIX = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), i.STTS = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.STSC = i.STCO = i.STTS, i.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), i.HDLR_VIDEO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0]), i.HDLR_AUDIO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0]), i.DREF = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), i.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
+ }, e.box = function(e) {
+ for (var t = 8, i = null, n = Array.prototype.slice.call(arguments, 1), r = n.length, a = 0; a < r; a++) t += n[a].byteLength;
+ (i = new Uint8Array(t))[0] = t >>> 24 & 255, i[1] = t >>> 16 & 255, i[2] = t >>> 8 & 255, i[3] = 255 & t, i.set(e, 4);
+ var s = 8;
+ for (a = 0; a < r; a++) i.set(n[a], s), s += n[a].byteLength;
+ return i
+ }, e.generateInitSegment = function(t) {
+ var i = e.box(e.types.ftyp, e.constants.FTYP),
+ n = e.moov(t),
+ r = new Uint8Array(i.byteLength + n.byteLength);
+ return r.set(i, 0), r.set(n, i.byteLength), r
+ }, e.moov = function(t) {
+ var i = e.mvhd(t.timescale, t.duration),
+ n = e.trak(t),
+ r = e.mvex(t);
+ return e.box(e.types.moov, i, n, r)
+ }, e.mvhd = function(t, i) {
+ return e.box(e.types.mvhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255]))
+ }, e.trak = function(t) {
+ return e.box(e.types.trak, e.tkhd(t), e.mdia(t))
+ }, e.tkhd = function(t) {
+ var i = t.id,
+ n = t.duration,
+ r = t.presentWidth,
+ a = t.presentHeight;
+ return e.box(e.types.tkhd, new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 0, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, r >>> 8 & 255, 255 & r, 0, 0, a >>> 8 & 255, 255 & a, 0, 0]))
+ }, e.mdia = function(t) {
+ return e.box(e.types.mdia, e.mdhd(t), e.hdlr(t), e.minf(t))
+ }, e.mdhd = function(t) {
+ var i = t.timescale,
+ n = t.duration;
+ return e.box(e.types.mdhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, 85, 196, 0, 0]))
+ }, e.hdlr = function(t) {
+ var i = null;
+ return i = "audio" === t.type ? e.constants.HDLR_AUDIO : e.constants.HDLR_VIDEO, e.box(e.types.hdlr, i)
+ }, e.minf = function(t) {
+ var i = null;
+ return i = "audio" === t.type ? e.box(e.types.smhd, e.constants.SMHD) : e.box(e.types.vmhd, e.constants.VMHD), e.box(e.types.minf, i, e.dinf(), e.stbl(t))
+ }, e.dinf = function() {
+ return e.box(e.types.dinf, e.box(e.types.dref, e.constants.DREF))
+ }, e.stbl = function(t) {
+ return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.constants.STTS), e.box(e.types.stsc, e.constants.STSC), e.box(e.types.stsz, e.constants.STSZ), e.box(e.types.stco, e.constants.STCO))
+ }, e.stsd = function(t) {
+ return "audio" === t.type ? "mp3" === t.codec ? e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp3(t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp4a(t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.avc1(t))
+ }, e.mp3 = function(t) {
+ var i = t.channelCount,
+ n = t.audioSampleRate,
+ r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, 0, 0]);
+ return e.box(e.types[".mp3"], r)
+ }, e.mp4a = function(t) {
+ var i = t.channelCount,
+ n = t.audioSampleRate,
+ r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, 0, 0]);
+ return e.box(e.types.mp4a, r, e.esds(t))
+ }, e.esds = function(t) {
+ var i = t.config || [],
+ n = i.length,
+ r = new Uint8Array([0, 0, 0, 0, 3, 23 + n, 0, 1, 0, 4, 15 + n, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5].concat([n]).concat(i).concat([6, 1, 2]));
+ return e.box(e.types.esds, r)
+ }, e.avc1 = function(t) {
+ var i = t.avcc,
+ n = t.codecWidth,
+ r = t.codecHeight,
+ a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, n >>> 8 & 255, 255 & n, r >>> 8 & 255, 255 & r, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 10, 120, 113, 113, 47, 102, 108, 118, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 255, 255]);
+ return t.codec.indexOf("avc1") >= 0 ? e.box(e.types.avc1, a, e.box(e.types.avcC, i)) : e.box(e.types.hvc1, a, e.box(e.types.hvcC, i))
+ }, e.mvex = function(t) {
+ return e.box(e.types.mvex, e.trex(t))
+ }, e.trex = function(t) {
+ var i = t.id,
+ n = new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]);
+ return e.box(e.types.trex, n)
+ }, e.moof = function(t, i) {
+ return e.box(e.types.moof, e.mfhd(t.sequenceNumber), e.traf(t, i))
+ }, e.mfhd = function(t) {
+ var i = new Uint8Array([0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t]);
+ return e.box(e.types.mfhd, i)
+ }, e.traf = function(t, i) {
+ var n = t.id,
+ r = e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n])),
+ a = e.box(e.types.tfdt, new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i])),
+ s = e.sdtp(t),
+ o = e.trun(t, s.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
+ return e.box(e.types.traf, r, a, o, s)
+ }, e.sdtp = function(t) {
+ for (var i = t.samples || [], n = i.length, r = new Uint8Array(4 + n), a = 0; a < n; a++) {
+ var s = i[a].flags;
+ r[a + 4] = s.isLeading << 6 | s.dependsOn << 4 | s.isDependedOn << 2 | s.hasRedundancy
+ }
+ return e.box(e.types.sdtp, r)
+ }, e.trun = function(t, i) {
+ var n = t.samples || [],
+ r = n.length,
+ a = 12 + 16 * r,
+ s = new Uint8Array(a);
+ i += 8 + a, s.set([0, 0, 15, 1, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i], 0);
+ for (var o = 0; o < r; o++) {
+ var u = n[o].duration,
+ l = n[o].size,
+ h = n[o].flags,
+ d = n[o].cts;
+ s.set([u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u, l >>> 24 & 255, l >>> 16 & 255, l >>> 8 & 255, 255 & l, h.isLeading << 2 | h.dependsOn, h.isDependedOn << 6 | h.hasRedundancy << 4 | h.isNonSync, 0, 0, d >>> 24 & 255, d >>> 16 & 255, d >>> 8 & 255, 255 & d], 12 + 16 * o)
+ }
+ return e.box(e.types.trun, s)
+ }, e.mdat = function(t) {
+ return e.box(e.types.mdat, t)
+ }, e
+ }();
+ n.init(), t.default = n
+ },
+ "./src/remux/mp4-remuxer.js":
+ /*!**********************************!*\
+ !*** ./src/remux/mp4-remuxer.js ***!
+ \**********************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! ../utils/logger.js */
+ "./src/utils/logger.js"),
+ r = i(
+ /*! ./mp4-generator.js */
+ "./src/remux/mp4-generator.js"),
+ a = i(
+ /*! ./aac-silent.js */
+ "./src/remux/aac-silent.js"),
+ s = i(
+ /*! ../utils/browser.js */
+ "./src/utils/browser.js"),
+ o = i(
+ /*! ../core/media-segment-info.js */
+ "./src/core/media-segment-info.js"),
+ u = i(
+ /*! ../utils/exception.js */
+ "./src/utils/exception.js"),
+ l = function() {
+ function e(e) {
+ this.TAG = "MP4Remuxer", this._config = e, this._isLive = !0 === e.isLive, this._dtsBase = -1, this._dtsBaseInited = !1, this._audioDtsBase = 1 / 0, this._videoDtsBase = 1 / 0, this._audioNextDts = void 0, this._videoNextDts = void 0, this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._audioMeta = null, this._videoMeta = null, this._audioSegmentInfoList = new o.MediaSegmentInfoList("audio"), this._videoSegmentInfoList = new o.MediaSegmentInfoList("video"), this._onInitSegment = null, this._onMediaSegment = null, this._forceFirstIDR = !(!s.default.chrome || !(s.default.version.major < 50 || 50 === s.default.version.major && s.default.version.build < 2661)), this._fillSilentAfterSeek = s.default.msedge || s.default.msie, this._mp3UseMpegAudio = !s.default.firefox, this._fillAudioTimestampGap = this._config.fixAudioTimestampGap
+ }
+ return e.prototype.destroy = function() {
+ this._dtsBase = -1, this._dtsBaseInited = !1, this._audioMeta = null, this._videoMeta = null, this._audioSegmentInfoList.clear(), this._audioSegmentInfoList = null, this._videoSegmentInfoList.clear(), this._videoSegmentInfoList = null, this._onInitSegment = null, this._onMediaSegment = null
+ }, e.prototype.bindDataSource = function(e) {
+ return e.onDataAvailable = this.remux.bind(this), e.onTrackMetadata = this._onTrackMetadataReceived.bind(this), this
+ }, Object.defineProperty(e.prototype, "onInitSegment", {
+ get: function() {
+ return this._onInitSegment
+ },
+ set: function(e) {
+ this._onInitSegment = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "onMediaSegment", {
+ get: function() {
+ return this._onMediaSegment
+ },
+ set: function(e) {
+ this._onMediaSegment = e
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.insertDiscontinuity = function() {
+ this._audioNextDts = this._videoNextDts = void 0
+ }, e.prototype.seek = function(e) {
+ this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._videoSegmentInfoList.clear(), this._audioSegmentInfoList.clear()
+ }, e.prototype.remux = function(e, t) {
+ if (!this._onMediaSegment) throw new u.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");
+ this._dtsBaseInited || this._calculateDtsBase(e, t), this._remuxVideo(t), this._remuxAudio(e)
+ }, e.prototype._onTrackMetadataReceived = function(e, t) {
+ var i = null,
+ n = "mp4",
+ a = t.codec;
+ if ("audio" === e) this._audioMeta = t, "mp3" === t.codec && this._mp3UseMpegAudio ? (n = "mpeg", a = "", i = new Uint8Array) : i = r.default.generateInitSegment(t);
+ else {
+ if ("video" !== e) return;
+ this._videoMeta = t, i = r.default.generateInitSegment(t)
+ }
+ if (!this._onInitSegment) throw new u.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");
+ this._onInitSegment(e, {
+ type: e,
+ data: i.buffer,
+ codec: a,
+ container: e + "/" + n,
+ mediaDuration: t.duration
+ })
+ }, e.prototype._calculateDtsBase = function(e, t) {
+ this._dtsBaseInited || (e.samples && e.samples.length && (this._audioDtsBase = e.samples[0].dts), t.samples && t.samples.length && (this._videoDtsBase = t.samples[0].dts), this._dtsBase = Math.min(this._audioDtsBase, this._videoDtsBase), this._dtsBaseInited = !0)
+ }, e.prototype.flushStashedSamples = function() {
+ var e = this._videoStashedLastSample,
+ t = this._audioStashedLastSample,
+ i = {
+ type: "video",
+ id: 1,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ };
+ null != e && (i.samples.push(e), i.length = e.length);
+ var n = {
+ type: "audio",
+ id: 2,
+ sequenceNumber: 0,
+ samples: [],
+ length: 0
+ };
+ null != t && (n.samples.push(t), n.length = t.length), this._videoStashedLastSample = null, this._audioStashedLastSample = null, this._remuxVideo(i, !0), this._remuxAudio(n, !0)
+ }, e.prototype._remuxAudio = function(e, t) {
+ if (null != this._audioMeta) {
+ var i, u = e,
+ l = u.samples,
+ h = void 0,
+ d = -1,
+ c = this._audioMeta.refSampleDuration,
+ f = "mp3" === this._audioMeta.codec && this._mp3UseMpegAudio,
+ p = this._dtsBaseInited && void 0 === this._audioNextDts,
+ m = !1;
+ if (l && 0 !== l.length && (1 !== l.length || t)) {
+ var _ = 0,
+ g = null,
+ v = 0;
+ f ? (_ = 0, v = u.length) : (_ = 8, v = 8 + u.length);
+ var y = null;
+ if (l.length > 1 && (v -= (y = l.pop()).length), null != this._audioStashedLastSample) {
+ var b = this._audioStashedLastSample;
+ this._audioStashedLastSample = null, l.unshift(b), v += b.length
+ }
+ null != y && (this._audioStashedLastSample = y);
+ var S = l[0].dts - this._dtsBase;
+ if (this._audioNextDts) h = S - this._audioNextDts;
+ else if (this._audioSegmentInfoList.isEmpty()) h = 0, this._fillSilentAfterSeek && !this._videoSegmentInfoList.isEmpty() && "mp3" !== this._audioMeta.originalCodec && (m = !0);
+ else {
+ var T = this._audioSegmentInfoList.getLastSampleBefore(S);
+ if (null != T) {
+ var E = S - (T.originalDts + T.duration);
+ E <= 3 && (E = 0), h = S - (T.dts + T.duration + E)
+ } else h = 0
+ }
+ if (m) {
+ var w = S - h,
+ A = this._videoSegmentInfoList.getLastSegmentBefore(S);
+ if (null != A && A.beginDts < w) {
+ if (M = a.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount)) {
+ var C = A.beginDts,
+ k = w - A.beginDts;
+ n.default.v(this.TAG, "InsertPrefixSilentAudio: dts: " + C + ", duration: " + k), l.unshift({
+ unit: M,
+ dts: C,
+ pts: C
+ }), v += M.byteLength
+ }
+ } else m = !1
+ }
+ for (var P = [], I = 0; I < l.length; I++) {
+ var L = (b = l[I]).unit,
+ x = b.dts - this._dtsBase,
+ R = (C = x, !1),
+ D = null,
+ O = 0;
+ if (!(x < -.001)) {
+ if ("mp3" !== this._audioMeta.codec) {
+ var U = x;
+ if (this._audioNextDts && (U = this._audioNextDts), (h = x - U) <= -3 * c) {
+ n.default.w(this.TAG, "Dropping 1 audio frame (originalDts: " + x + " ms ,curRefDts: " + U + " ms) due to dtsCorrection: " + h + " ms overlap.");
+ continue
+ }
+ if (h >= 3 * c && this._fillAudioTimestampGap && !s.default.safari) {
+ R = !0;
+ var M, F = Math.floor(h / c);
+ n.default.w(this.TAG, "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: " + x + " ms, curRefDts: " + U + " ms, dtsCorrection: " + Math.round(h) + " ms, generate: " + F + " frames"), C = Math.floor(U), O = Math.floor(U + c) - C, null == (M = a.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount)) && (n.default.w(this.TAG, "Unable to generate silent frame for " + this._audioMeta.originalCodec + " with " + this._audioMeta.channelCount + " channels, repeat last frame"), M = L), D = [];
+ for (var B = 0; B < F; B++) {
+ U += c;
+ var N = Math.floor(U),
+ j = Math.floor(U + c) - N,
+ V = {
+ dts: N,
+ pts: N,
+ cts: 0,
+ unit: M,
+ size: M.byteLength,
+ duration: j,
+ originalDts: x,
+ flags: {
+ isLeading: 0,
+ dependsOn: 1,
+ isDependedOn: 0,
+ hasRedundancy: 0
+ }
+ };
+ D.push(V), v += V.size
+ }
+ this._audioNextDts = U + c
+ } else C = Math.floor(U), O = Math.floor(U + c) - C, this._audioNextDts = U + c
+ } else C = x - h, O = I !== l.length - 1 ? l[I + 1].dts - this._dtsBase - h - C : null != y ? y.dts - this._dtsBase - h - C : P.length >= 1 ? P[P.length - 1].duration : Math.floor(c), this._audioNextDts = C + O; - 1 === d && (d = C), P.push({
+ dts: C,
+ pts: C,
+ cts: 0,
+ unit: b.unit,
+ size: b.unit.byteLength,
+ duration: O,
+ originalDts: x,
+ flags: {
+ isLeading: 0,
+ dependsOn: 1,
+ isDependedOn: 0,
+ hasRedundancy: 0
+ }
+ }), R && P.push.apply(P, D)
+ }
+ }
+ if (0 === P.length) return u.samples = [], void(u.length = 0);
+ for (f ? g = new Uint8Array(v) : ((g = new Uint8Array(v))[0] = v >>> 24 & 255, g[1] = v >>> 16 & 255, g[2] = v >>> 8 & 255, g[3] = 255 & v, g.set(r.default.types.mdat, 4)), I = 0; I < P.length; I++) L = P[I].unit, g.set(L, _), _ += L.byteLength;
+ var H = P[P.length - 1];
+ i = H.dts + H.duration;
+ var z = new o.MediaSegmentInfo;
+ z.beginDts = d, z.endDts = i, z.beginPts = d, z.endPts = i, z.originalBeginDts = P[0].originalDts, z.originalEndDts = H.originalDts + H.duration, z.firstSample = new o.SampleInfo(P[0].dts, P[0].pts, P[0].duration, P[0].originalDts, !1), z.lastSample = new o.SampleInfo(H.dts, H.pts, H.duration, H.originalDts, !1), this._isLive || this._audioSegmentInfoList.append(z), u.samples = P, u.sequenceNumber++;
+ var G = null;
+ G = f ? new Uint8Array : r.default.moof(u, d), u.samples = [], u.length = 0;
+ var W = {
+ type: "audio",
+ data: this._mergeBoxes(G, g).buffer,
+ sampleCount: P.length,
+ info: z
+ };
+ f && p && (W.timestampOffset = d), this._onMediaSegment("audio", W)
+ }
+ }
+ }, e.prototype._remuxVideo = function(e, t) {
+ if (null != this._videoMeta) {
+ var i, n, a = e,
+ s = a.samples,
+ u = void 0,
+ l = -1,
+ h = -1;
+ if (s && 0 !== s.length && (1 !== s.length || t)) {
+ var d = 8,
+ c = null,
+ f = 8 + e.length,
+ p = null;
+ if (s.length > 1 && (f -= (p = s.pop()).length), null != this._videoStashedLastSample) {
+ var m = this._videoStashedLastSample;
+ this._videoStashedLastSample = null, s.unshift(m), f += m.length
+ }
+ null != p && (this._videoStashedLastSample = p);
+ var _ = s[0].dts - this._dtsBase;
+ if (this._videoNextDts) u = _ - this._videoNextDts;
+ else if (this._videoSegmentInfoList.isEmpty()) u = 0;
+ else {
+ var g = this._videoSegmentInfoList.getLastSampleBefore(_);
+ if (null != g) {
+ var v = _ - (g.originalDts + g.duration);
+ v <= 3 && (v = 0), u = _ - (g.dts + g.duration + v)
+ } else u = 0
+ }
+ for (var y = new o.MediaSegmentInfo, b = [], S = 0; S < s.length; S++) {
+ var T = (m = s[S]).dts - this._dtsBase,
+ E = m.isKeyframe,
+ w = T - u,
+ A = m.cts,
+ C = w + A; - 1 === l && (l = w, h = C);
+ var k = 0;
+ if (k = S !== s.length - 1 ? s[S + 1].dts - this._dtsBase - u - w : null != p ? p.dts - this._dtsBase - u - w : b.length >= 1 ? b[b.length - 1].duration : Math.floor(this._videoMeta.refSampleDuration), E) {
+ var P = new o.SampleInfo(w, C, k, m.dts, !0);
+ P.fileposition = m.fileposition, y.appendSyncPoint(P)
+ }
+ b.push({
+ dts: w,
+ pts: C,
+ cts: A,
+ units: m.units,
+ size: m.length,
+ isKeyframe: E,
+ duration: k,
+ originalDts: T,
+ flags: {
+ isLeading: 0,
+ dependsOn: E ? 2 : 1,
+ isDependedOn: E ? 1 : 0,
+ hasRedundancy: 0,
+ isNonSync: E ? 0 : 1
+ }
+ })
+ }
+ for ((c = new Uint8Array(f))[0] = f >>> 24 & 255, c[1] = f >>> 16 & 255, c[2] = f >>> 8 & 255, c[3] = 255 & f, c.set(r.default.types.mdat, 4), S = 0; S < b.length; S++)
+ for (var I = b[S].units; I.length;) {
+ var L = I.shift().data;
+ c.set(L, d), d += L.byteLength
+ }
+ var x = b[b.length - 1];
+ if (i = x.dts + x.duration, n = x.pts + x.duration, this._videoNextDts = i, y.beginDts = l, y.endDts = i, y.beginPts = h, y.endPts = n, y.originalBeginDts = b[0].originalDts, y.originalEndDts = x.originalDts + x.duration, y.firstSample = new o.SampleInfo(b[0].dts, b[0].pts, b[0].duration, b[0].originalDts, b[0].isKeyframe), y.lastSample = new o.SampleInfo(x.dts, x.pts, x.duration, x.originalDts, x.isKeyframe), this._isLive || this._videoSegmentInfoList.append(y), a.samples = b, a.sequenceNumber++, this._forceFirstIDR) {
+ var R = b[0].flags;
+ R.dependsOn = 2, R.isNonSync = 0
+ }
+ var D = r.default.moof(a, l);
+ a.samples = [], a.length = 0, this._onMediaSegment("video", {
+ type: "video",
+ data: this._mergeBoxes(D, c).buffer,
+ sampleCount: b.length,
+ info: y
+ })
+ }
+ }
+ }, e.prototype._mergeBoxes = function(e, t) {
+ var i = new Uint8Array(e.byteLength + t.byteLength);
+ return i.set(e, 0), i.set(t, e.byteLength), i
+ }, e
+ }();
+ t.default = l
+ },
+ "./src/utils/browser.js":
+ /*!******************************!*\
+ !*** ./src/utils/browser.js ***!
+ \******************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = {};
+ ! function() {
+ var e = self.navigator.userAgent.toLowerCase(),
+ t = /(edge)\/([\w.]+)/.exec(e) || /(opr)[\/]([\w.]+)/.exec(e) || /(chrome)[ \/]([\w.]+)/.exec(e) || /(iemobile)[\/]([\w.]+)/.exec(e) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/.exec(e) || e.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 && /(firefox)[ \/]([\w.]+)/.exec(e) || [],
+ i = /(ipad)/.exec(e) || /(ipod)/.exec(e) || /(windows phone)/.exec(e) || /(iphone)/.exec(e) || /(kindle)/.exec(e) || /(android)/.exec(e) || /(windows)/.exec(e) || /(mac)/.exec(e) || /(linux)/.exec(e) || /(cros)/.exec(e) || [],
+ r = {
+ browser: t[5] || t[3] || t[1] || "",
+ version: t[2] || t[4] || "0",
+ majorVersion: t[4] || t[2] || "0",
+ platform: i[0] || ""
+ },
+ a = {};
+ if (r.browser) {
+ a[r.browser] = !0;
+ var s = r.majorVersion.split(".");
+ a.version = {
+ major: parseInt(r.majorVersion, 10),
+ string: r.version
+ }, s.length > 1 && (a.version.minor = parseInt(s[1], 10)), s.length > 2 && (a.version.build = parseInt(s[2], 10))
+ }
+ for (var o in r.platform && (a[r.platform] = !0), (a.chrome || a.opr || a.safari) && (a.webkit = !0), (a.rv || a.iemobile) && (a.rv && delete a.rv, r.browser = "msie", a.msie = !0), a.edge && (delete a.edge, r.browser = "msedge", a.msedge = !0), a.opr && (r.browser = "opera", a.opera = !0), a.safari && a.android && (r.browser = "android", a.android = !0), a.name = r.browser, a.platform = r.platform, n) n.hasOwnProperty(o) && delete n[o];
+ Object.assign(n, a)
+ }(), t.default = n
+ },
+ "./src/utils/exception.js":
+ /*!********************************!*\
+ !*** ./src/utils/exception.js ***!
+ \********************************/
+ function(e, t, i) {
+ i.r(t), i.d(t, {
+ RuntimeException: function() {
+ return a
+ },
+ IllegalStateException: function() {
+ return s
+ },
+ InvalidArgumentException: function() {
+ return o
+ },
+ NotImplementedException: function() {
+ return u
+ }
+ });
+ var n, r = (n = function(e, t) {
+ return (n = Object.setPrototypeOf || {
+ __proto__: []
+ }
+ instanceof Array && function(e, t) {
+ e.__proto__ = t
+ } || function(e, t) {
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
+ })(e, t)
+ }, function(e, t) {
+ if ("function" != typeof t && null !== t) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
+
+ function i() {
+ this.constructor = e
+ }
+ n(e, t), e.prototype = null === t ? Object.create(t) : (i.prototype = t.prototype, new i)
+ }),
+ a = function() {
+ function e(e) {
+ this._message = e
+ }
+ return Object.defineProperty(e.prototype, "name", {
+ get: function() {
+ return "RuntimeException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e.prototype, "message", {
+ get: function() {
+ return this._message
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.prototype.toString = function() {
+ return this.name + ": " + this.message
+ }, e
+ }(),
+ s = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "IllegalStateException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a),
+ o = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "InvalidArgumentException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a),
+ u = function(e) {
+ function t(t) {
+ return e.call(this, t) || this
+ }
+ return r(t, e), Object.defineProperty(t.prototype, "name", {
+ get: function() {
+ return "NotImplementedException"
+ },
+ enumerable: !1,
+ configurable: !0
+ }), t
+ }(a)
+ },
+ "./src/utils/logger.js":
+ /*!*****************************!*\
+ !*** ./src/utils/logger.js ***!
+ \*****************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ r = i.n(n),
+ a = function() {
+ function e() {}
+ return e.e = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "error", n), e.ENABLE_ERROR && (console.error ? console.error(n) : console.warn)
+ }, e.i = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "info", n), e.ENABLE_INFO && console.info && console.info(n)
+ }, e.w = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "warn", n), e.ENABLE_WARN && console.warn
+ }, e.d = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "debug", n), e.ENABLE_DEBUG && console.debug && console.debug(n)
+ }, e.v = function(t, i) {
+ t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
+ var n = "[" + t + "] > " + i;
+ e.ENABLE_CALLBACK && e.emitter.emit("log", "verbose", n), e.ENABLE_VERBOSE
+ }, e
+ }();
+ a.GLOBAL_TAG = "flv.js", a.FORCE_GLOBAL_TAG = !1, a.ENABLE_ERROR = !0, a.ENABLE_INFO = !0, a.ENABLE_WARN = !0, a.ENABLE_DEBUG = !0, a.ENABLE_VERBOSE = !0, a.ENABLE_CALLBACK = !1, a.emitter = new(r()), t.default = a
+ },
+ "./src/utils/logging-control.js":
+ /*!**************************************!*\
+ !*** ./src/utils/logging-control.js ***!
+ \**************************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = i(
+ /*! events */
+ "./node_modules/events/events.js"),
+ r = i.n(n),
+ a = i(
+ /*! ./logger.js */
+ "./src/utils/logger.js"),
+ s = function() {
+ function e() {}
+ return Object.defineProperty(e, "forceGlobalTag", {
+ get: function() {
+ return a.default.FORCE_GLOBAL_TAG
+ },
+ set: function(t) {
+ a.default.FORCE_GLOBAL_TAG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "globalTag", {
+ get: function() {
+ return a.default.GLOBAL_TAG
+ },
+ set: function(t) {
+ a.default.GLOBAL_TAG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableAll", {
+ get: function() {
+ return a.default.ENABLE_VERBOSE && a.default.ENABLE_DEBUG && a.default.ENABLE_INFO && a.default.ENABLE_WARN && a.default.ENABLE_ERROR
+ },
+ set: function(t) {
+ a.default.ENABLE_VERBOSE = t, a.default.ENABLE_DEBUG = t, a.default.ENABLE_INFO = t, a.default.ENABLE_WARN = t, a.default.ENABLE_ERROR = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableDebug", {
+ get: function() {
+ return a.default.ENABLE_DEBUG
+ },
+ set: function(t) {
+ a.default.ENABLE_DEBUG = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableVerbose", {
+ get: function() {
+ return a.default.ENABLE_VERBOSE
+ },
+ set: function(t) {
+ a.default.ENABLE_VERBOSE = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableInfo", {
+ get: function() {
+ return a.default.ENABLE_INFO
+ },
+ set: function(t) {
+ a.default.ENABLE_INFO = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableWarn", {
+ get: function() {
+ return a.default.ENABLE_WARN
+ },
+ set: function(t) {
+ a.default.ENABLE_WARN = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), Object.defineProperty(e, "enableError", {
+ get: function() {
+ return a.default.ENABLE_ERROR
+ },
+ set: function(t) {
+ a.default.ENABLE_ERROR = t, e._notifyChange()
+ },
+ enumerable: !1,
+ configurable: !0
+ }), e.getConfig = function() {
+ return {
+ globalTag: a.default.GLOBAL_TAG,
+ forceGlobalTag: a.default.FORCE_GLOBAL_TAG,
+ enableVerbose: a.default.ENABLE_VERBOSE,
+ enableDebug: a.default.ENABLE_DEBUG,
+ enableInfo: a.default.ENABLE_INFO,
+ enableWarn: a.default.ENABLE_WARN,
+ enableError: a.default.ENABLE_ERROR,
+ enableCallback: a.default.ENABLE_CALLBACK
+ }
+ }, e.applyConfig = function(e) {
+ a.default.GLOBAL_TAG = e.globalTag, a.default.FORCE_GLOBAL_TAG = e.forceGlobalTag, a.default.ENABLE_VERBOSE = e.enableVerbose, a.default.ENABLE_DEBUG = e.enableDebug, a.default.ENABLE_INFO = e.enableInfo, a.default.ENABLE_WARN = e.enableWarn, a.default.ENABLE_ERROR = e.enableError, a.default.ENABLE_CALLBACK = e.enableCallback
+ }, e._notifyChange = function() {
+ var t = e.emitter;
+ if (t.listenerCount("change") > 0) {
+ var i = e.getConfig();
+ t.emit("change", i)
+ }
+ }, e.registerListener = function(t) {
+ e.emitter.addListener("change", t)
+ }, e.removeListener = function(t) {
+ e.emitter.removeListener("change", t)
+ }, e.addLogListener = function(t) {
+ a.default.emitter.addListener("log", t), a.default.emitter.listenerCount("log") > 0 && (a.default.ENABLE_CALLBACK = !0, e._notifyChange())
+ }, e.removeLogListener = function(t) {
+ a.default.emitter.removeListener("log", t), 0 === a.default.emitter.listenerCount("log") && (a.default.ENABLE_CALLBACK = !1, e._notifyChange())
+ }, e
+ }();
+ s.emitter = new(r()), t.default = s
+ },
+ "./src/utils/polyfill.js":
+ /*!*******************************!*\
+ !*** ./src/utils/polyfill.js ***!
+ \*******************************/
+ function(e, t, i) {
+ i.r(t);
+ var n = function() {
+ function e() {}
+ return e.install = function() {
+ Object.setPrototypeOf = Object.setPrototypeOf || function(e, t) {
+ return e.__proto__ = t, e
+ }, Object.assign = Object.assign || function(e) {
+ if (null == e) throw new TypeError("Cannot convert undefined or null to object");
+ for (var t = Object(e), i = 1; i < arguments.length; i++) {
+ var n = arguments[i];
+ if (null != n)
+ for (var r in n) n.hasOwnProperty(r) && (t[r] = n[r])
+ }
+ return t
+ }, "function" != typeof self.Promise && i(
+ /*! es6-promise */
+ "./node_modules/es6-promise/dist/es6-promise.js").polyfill()
+ }, e
+ }();
+ n.install(), t.default = n
+ },
+ "./src/utils/utf8-conv.js":
+ /*!********************************!*\
+ !*** ./src/utils/utf8-conv.js ***!
+ \********************************/
+ function(e, t, i) {
+ function n(e, t, i) {
+ var n = e;
+ if (t + i < n.length) {
+ for (; i--;)
+ if (128 != (192 & n[++t])) return !1;
+ return !0
+ }
+ return !1
+ }
+ i.r(t), t.default = function(e) {
+ for (var t = [], i = e, r = 0, a = e.length; r < a;)
+ if (i[r] < 128) t.push(String.fromCharCode(i[r])), ++r;
+ else {
+ if (i[r] < 192);
+ else if (i[r] < 224) {
+ if (n(i, r, 1) && (s = (31 & i[r]) << 6 | 63 & i[r + 1]) >= 128) {
+ t.push(String.fromCharCode(65535 & s)), r += 2;
+ continue
+ }
+ } else if (i[r] < 240) {
+ if (n(i, r, 2) && (s = (15 & i[r]) << 12 | (63 & i[r + 1]) << 6 | 63 & i[r + 2]) >= 2048 && 55296 != (63488 & s)) {
+ t.push(String.fromCharCode(65535 & s)), r += 3;
+ continue
+ }
+ } else if (i[r] < 248) {
+ var s;
+ if (n(i, r, 3) && (s = (7 & i[r]) << 18 | (63 & i[r + 1]) << 12 | (63 & i[r + 2]) << 6 | 63 & i[r + 3]) > 65536 && s < 1114112) {
+ s -= 65536, t.push(String.fromCharCode(s >>> 10 | 55296)), t.push(String.fromCharCode(1023 & s | 56320)), r += 4;
+ continue
+ }
+ }
+ t.push(String.fromCharCode(65533)), ++r
+ } return t.join("")
+ }
+ }
+ },
+ i = {};
+
+ function r(e) {
+ var n = i[e];
+ if (void 0 !== n) return n.exports;
+ var a = i[e] = {
+ exports: {}
+ };
+ return t[e].call(a.exports, a, a.exports, r), a.exports
+ }
+ return r.m = t, r.n = function(e) {
+ var t = e && e.__esModule ? function() {
+ return e.default
+ } : function() {
+ return e
+ };
+ return r.d(t, {
+ a: t
+ }), t
+ }, r.d = function(e, t) {
+ for (var i in t) r.o(t, i) && !r.o(e, i) && Object.defineProperty(e, i, {
+ enumerable: !0,
+ get: t[i]
+ })
+ }, r.g = function() {
+ if ("object" === ("undefined" == typeof globalThis ? "undefined" : n(globalThis))) return globalThis;
+ try {
+ return this || new Function("return this")()
+ } catch (e) {
+ if ("object" === ("undefined" == typeof window ? "undefined" : n(window))) return window
+ }
+ }(), r.o = function(e, t) {
+ return Object.prototype.hasOwnProperty.call(e, t)
+ }, r.r = function(e) {
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
+ value: "Module"
+ }), Object.defineProperty(e, "__esModule", {
+ value: !0
+ })
+ }, r("./src/index.js")
+ }()
+ }, "object" === (void 0 === i ? "undefined" : n(i)) && "object" === (void 0 === t ? "undefined" : n(t)) ? t.exports = a() : "function" == typeof define && define.amd ? define([], a) : "object" === (void 0 === i ? "undefined" : n(i)) ? i.flvjshevc = a() : r.flvjshevc = a()
+ }).call(this, e("_process"))
+ }, {
+ _process: 44
+ }],
+ 69: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("./m3u8base"),
+ a = e("./mpegts/mpeg.js"),
+ s = e("./bufferFrame"),
+ o = e("./buffer"),
+ u = e("../decoder/hevc-imp"),
+ l = e("../consts"),
+ h = function() {
+ function e() {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.hls = new r.M3u8Base, this.mpegTsObj = new a.MPEG_JS({}), this.mpegTsWasmState = !1, this.mpegTsWasmRetryLoadTimes = 0, this.tsList = [], this.vStartTime = 0, this.aStartTime = 0, this.lockWait = {
+ state: !1,
+ lockMember: {
+ dur: 0
+ }
+ }, this.timerFeed = null, this.timerTsWasm = null, this.seekPos = -1, this.vPreFramePTS = 0, this.aPreFramePTS = 0, this.audioNone = !1, this.isHevcParam = !1, this.vCodec = !1, this.aCodec = !1, this.aChannel = 0, this.durationMs = -1, this.bufObject = o(), this.fps = -1, this.sampleRate = -1, this.size = {
+ width: -1,
+ height: -1
+ }, this.mediaInfo = null, this.extensionInfo = null, this.onReadyOBJ = null, this.onFinished = null, this.onDemuxed = null, this.onSamples = null, this.onCacheProcess = null
+ }
+ var t, i, h;
+ return t = e, (i = [{
+ key: "getCachePTS",
+ value: function() {
+ return Math.max(this.vPreFramePTS, this.aPreFramePTS)
+ }
+ }, {
+ key: "demux",
+ value: function(e) {
+ var t = this,
+ i = this;
+ this.vPreFramePTS = 0, this.aPreFramePTS = 0, this.hls.onTransportStream = function(e, t) {
+ i.lockWait.state, i.tsList.length, i.tsList.push({
+ streamURI: e,
+ streamDur: t
+ })
+ }, this.hls.onFinished = function(e) {
+ e.type == l.PLAYER_IN_TYPE_M3U8_VOD ? i.durationMs = 1e3 * e.duration : i.durationMs = -1, null != i.onFinished && i.onFinished(i.onReadyOBJ, e)
+ }, this.mpegTsObj.onDemuxedFailed = function(e, t) {
+ console.error("onDemuxedFailed: ", e, t), i.lockWait.state = !1
+ }, this.mpegTsObj.onDemuxed = function() {
+ null == i.mediaInfo && (i.mediaInfo = i.mpegTsObj.readMediaInfo(), i.mediaInfo, i.isHevcParam = i.mpegTsObj.isHEVC(), i.vCodec = i.mpegTsObj.vCodec, i.aCodec = i.mediaInfo.aCodec, i.aChannel = i.mediaInfo.sampleChannel, i.fps = i.mediaInfo.vFps, i.sampleRate = i.mediaInfo.sampleRate, (null === i.aCodec || "" === i.aCodec || i.aChannel <= 0) && (i.audioNone = !0)), null == i.extensionInfo && (i.extensionInfo = i.mpegTsObj.readExtensionInfo(), i.extensionInfo.vWidth > 0 && i.extensionInfo.vHeight > 0 && (i.size.width = i.extensionInfo.vWidth, i.size.height = i.extensionInfo.vHeight)), i.mediaInfo.duration, null != i.onDemuxed && i.onDemuxed(i.onReadyOBJ);
+ for (var e = !1; void 0 !== i.mpegTsObj && null !== i.mpegTsObj;) {
+ var n = i.mpegTsObj.readPacket();
+ if (n.size <= 0) break;
+ var r = n.dtime > 0 ? n.dtime : n.ptime;
+ if (!(r < 0)) {
+ if (0 == n.type) {
+ r <= i.vPreFramePTS && (e = !0);
+ var a = u.PACK_NALU(n.layer),
+ o = 1 == n.keyframe,
+ l = 1 == e ? r + i.vStartTime : r,
+ h = new s.BufferFrame(l, o, a, !0);
+ i.bufObject.appendFrame(h.pts, h.data, !0, h.isKey), i.vPreFramePTS = l, null != i.onSamples && i.onSamples(i.onReadyOBJ, h)
+ } else if (r <= i.aPreFramePTS && (e = !0), "aac" == i.mediaInfo.aCodec)
+ for (var d = n.data, c = 0; c < d.length; c++) {
+ var f = d[c],
+ p = 1 == e ? f.ptime + i.vStartTime : r,
+ m = new s.BufferFrame(p, !0, f.data, !1);
+ i.bufObject.appendFrameByBufferFrame(m), i.aPreFramePTS = p, null != i.onSamples && i.onSamples(i.onReadyOBJ, m)
+ } else {
+ var _ = 1 == e ? r + i.vStartTime : r,
+ g = new s.BufferFrame(_, !0, n.data, !1);
+ i.bufObject.appendFrameByBufferFrame(g), i.aPreFramePTS = _, null != i.onSamples && i.onSamples(i.onReadyOBJ, g)
+ }
+ t.onCacheProcess && t.onCacheProcess(t.getCachePTS())
+ }
+ }
+ i.vStartTime += parseFloat(i.lockWait.lockMember.dur), i.aStartTime += parseFloat(i.lockWait.lockMember.dur), i.vStartTime, i.lockWait.state = !1
+ }, this.mpegTsObj.onReady = function() {
+ i._onTsReady(e)
+ }, i.mpegTsObj.initDemuxer(), this.timerTsWasm = window.setInterval((function() {
+ i.mpegTsWasmState ? (window.clearInterval(i.timerTsWasm), i.timerTsWasm = null) : i.mpegTsWasmRetryLoadTimes >= 3 ? (i._onTsReady(e), window.clearInterval(i.timerTsWasm), i.timerTsWasm = null) : (i.mpegTsWasmRetryLoadTimes += 1, i.mpegTsObj.initDemuxer())
+ }), 3e3)
+ }
+ }, {
+ key: "_onTsReady",
+ value: function(e) {
+ var t = this;
+ t.hls.fetchM3u8(e), t.mpegTsWasmState = !0, t.timerFeed = window.setInterval((function() {
+ if (t.tsList.length > 0 && 0 == t.lockWait.state) try {
+ var e = t.tsList.shift();
+ if (null != e) {
+ var i = e.streamURI,
+ n = e.streamDur;
+ t.lockWait.state = !0, t.lockWait.lockMember.dur = n, t.mpegTsObj.isLive = t.hls.isLive(), t.mpegTsObj.demuxURL(i)
+ } else console.error("_onTsReady need wait ")
+ } catch (e) {
+ console.error("onTsReady ERROR:", e), t.lockWait.state = !1
+ }
+ }), 50)
+ }
+ }, {
+ key: "release",
+ value: function() {
+ this.hls && this.hls.release(), this.hls = null, this.timerFeed && window.clearInterval(this.timerFeed), this.timerFeed = null, this.timerTsWasm && window.clearInterval(this.timerTsWasm), this.timerTsWasm = null
+ }
+ }, {
+ key: "bindReady",
+ value: function(e) {
+ this.onReadyOBJ = e
+ }
+ }, {
+ key: "popBuffer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
+ t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ return t < 0 ? null : 1 === e ? t + 1 > this.bufObject.videoBuffer.length ? null : this.bufObject.vFrame(t) : 2 === e ? t + 1 > this.bufObject.audioBuffer.length ? null : this.bufObject.aFrame(t) : void 0
+ }
+ }, {
+ key: "getVLen",
+ value: function() {
+ return this.bufObject.videoBuffer.length
+ }
+ }, {
+ key: "getALen",
+ value: function() {
+ return this.bufObject.audioBuffer.length
+ }
+ }, {
+ key: "getLastIdx",
+ value: function() {
+ return this.bufObject.videoBuffer.length - 1
+ }
+ }, {
+ key: "getALastIdx",
+ value: function() {
+ return this.bufObject.audioBuffer.length - 1
+ }
+ }, {
+ key: "getACodec",
+ value: function() {
+ return this.aCodec
+ }
+ }, {
+ key: "getVCodec",
+ value: function() {
+ return this.vCodec
+ }
+ }, {
+ key: "getDurationMs",
+ value: function() {
+ return this.durationMs
+ }
+ }, {
+ key: "getFPS",
+ value: function() {
+ return this.fps
+ }
+ }, {
+ key: "getSampleRate",
+ value: function() {
+ return this.sampleRate
+ }
+ }, {
+ key: "getSampleChannel",
+ value: function() {
+ return this.aChannel
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return this.size
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ if (e >= 0) {
+ var t = this.bufObject.seekIDR(e);
+ this.seekPos = t
+ }
+ }
+ }]) && n(t.prototype, i), h && n(t, h), e
+ }();
+ i.M3u8 = h
+ }, {
+ "../consts": 52,
+ "../decoder/hevc-imp": 64,
+ "./buffer": 66,
+ "./bufferFrame": 67,
+ "./m3u8base": 70,
+ "./mpegts/mpeg.js": 74
+ }],
+ 70: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("../consts"),
+ a = [/#EXT-X-PROGRAM-DATE-TIME.+\n/g],
+ s = {
+ lineDelimiter: /\r?\n/,
+ extensionHeader: "#EXTM3U",
+ tagPrefix: "#EXT",
+ segmentPrefix: "#EXTINF",
+ segmentParse: /^#EXTINF: *([0-9.]+)(, *(.+?)?)?$/,
+ tagParse: /^#EXT-X-([A-Z-]+)(:(.+))?$/,
+ version: "VERSION",
+ allowCache: "ALLOW-CACHE",
+ combined: "COMBINED",
+ endList: "ENDLIST",
+ targetDuration: "TARGETDURATION",
+ mediaSequence: "MEDIA-SEQUENCE",
+ discontinuity: "DISCONTINUITY",
+ streamInf: "STREAM-INF",
+ isComment: function(e) {
+ return e && "#" === e[0] && !e.startsWith(s.tagPrefix)
+ },
+ isBlank: function(e) {
+ return "" === e
+ },
+ canStrip: function(e) {
+ return s.isBlank(e) || s.isComment(e)
+ },
+ defaultMinDur: 99999,
+ hlsSliceLimit: 100
+ },
+ o = function() {
+ function e() {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.initState = !0, this.controller = new AbortController, this._slices = [], this._type = r.PLAYER_IN_TYPE_M3U8_LIVE, this._preURI = "", this.duration = -1, this.onTransportStream = null, this.onFinished = null
+ }
+ var t, i, o;
+ return t = e, (i = [{
+ key: "isLive",
+ value: function() {
+ return this._type === r.PLAYER_IN_TYPE_M3U8_LIVE ? 1 : 0
+ }
+ }, {
+ key: "release",
+ value: function() {
+ this.initState = !1
+ }
+ }, {
+ key: "fetchM3u8",
+ value: function(e) {
+ var t = this,
+ i = this;
+ this.initState && fetch(e,{credentials: "same-origin"}).then((function(e) {
+ return e.text()
+ })).then((function(t) {
+ return 1 == i._uriParse(e) ? i._m3u8Parse(t) : null
+ })).then((function(n) {
+ null != n && !1 !== n && !0 !== n && t._type == r.PLAYER_IN_TYPE_M3U8_LIVE && setTimeout((function() {
+ i.fetchM3u8(e)
+ }), 500 * n)
+ })).catch((function(t) {
+ console.error("fetchM3u8 ERROR fetch ERROR ==> ", t), setTimeout((function() {
+ i.fetchM3u8(e)
+ }), 500)
+ }))
+ }
+ }, {
+ key: "_uriParse",
+ value: function(e) {
+ this._preURI = "";
+ var t = e.split("://"),
+ i = null,
+ n = null;
+ if (t.length < 1) return !1;
+ t.length > 1 ? (i = t[0], n = t[1].split("/"), this._preURI = i + "://") : n = t[0].split("/");
+ for (var r = 0; r < n.length - 1; r++) this._preURI += n[r] + "/";
+ return !0
+ }
+ }, {
+ key: "_m3u8Parse",
+ value: function(e) {
+ for (var t = e, i = 0; i < a.length; i++) t = e.replace(a[i], "");
+ for (var n = t.split(s.lineDelimiter), o = s.defaultMinDur, u = "", l = 0; l < n.length; l++) {
+ var h = n[l];
+ if (!(h.length < 1)) {
+ if (null != u && "" !== u) switch (u) {
+ case s.version:
+ case s.mediaSequence:
+ case s.allowCache:
+ case s.discontinuity:
+ case s.targetDuration:
+ case s.combined:
+ break;
+ case s.streamInf:
+ return this.fetchM3u8(h), null
+ }
+ var d = this._readTag(h);
+ if (null != d) switch (u = d.key, d.key) {
+ case s.version:
+ case s.mediaSequence:
+ case s.allowCache:
+ case s.discontinuity:
+ case s.targetDuration:
+ case s.combined:
+ case s.streamInf:
+ break;
+ case s.endList:
+ if (this._type = r.PLAYER_IN_TYPE_M3U8_VOD, null != this.onFinished) {
+ var c = {
+ type: this._type,
+ duration: this.duration
+ };
+ this.onFinished(c)
+ }
+ return !0;
+ default:
+ d.key
+ }
+ var f = s.segmentParse.exec(h);
+ if (null != f) {
+ var p = f[1];
+ this.duration += parseFloat(f[1]), o > p && (o = p);
+ var m = n[l += 1],
+ _ = null;
+ if (m.indexOf("http") >= 0) _ = m;
+ else {
+ if ("/" === m[0]) {
+ var g = this._preURI.split("//"),
+ v = g[g.length - 1].split("/");
+ this._preURI = g[0] + "//" + v[0]
+ }
+ _ = this._preURI + m
+ }
+ this._slices.indexOf(_) < 0 && (this._slices.push(_), this._slices[this._slices.length - 1], null != this.onTransportStream && this.onTransportStream(_, p))
+ }
+ }
+ }
+ if (this._slices.length > s.hlsSliceLimit && this._type == r.PLAYER_IN_TYPE_M3U8_LIVE && (this._slices = this._slices.slice(-1 * s.hlsSliceLimit)), null != this.onFinished) {
+ var y = {
+ type: this._type,
+ duration: -1
+ };
+ this.onFinished(y)
+ }
+ return o
+ }
+ }, {
+ key: "_readTag",
+ value: function(e) {
+ var t = s.tagParse.exec(e);
+ return null !== t ? {
+ key: t[1],
+ value: t[3]
+ } : null
+ }
+ }]) && n(t.prototype, i), o && n(t, o), e
+ }();
+ i.M3u8Base = o
+ }, {
+ "../consts": 52
+ }],
+ 71: [function(e, t, i) {
+ "use strict";
+ var n = e("mp4box"),
+ r = e("../decoder/hevc-header"),
+ a = e("../decoder/hevc-imp"),
+ s = e("./buffer"),
+ o = e("../consts"),
+ u = {
+ 96e3: 0,
+ 88200: 1,
+ 64e3: 2,
+ 48e3: 3,
+ 44100: 4,
+ 32e3: 5,
+ 24e3: 6,
+ 22050: 7,
+ 16e3: 8,
+ 12e3: 9,
+ 11025: 10,
+ 8e3: 11,
+ 7350: 12,
+ Reserved: 13,
+ "frequency is written explictly": 15
+ },
+ l = function(e) {
+ for (var t = [], i = 0; i < e.length; i++) t.push(e[i].toString(16));
+ return t
+ };
+
+ function h() {}
+ h.prototype.setStartCode = function(e) {
+ var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+ i = null;
+ return t ? ((i = e)[0] = r.DEFINE_STARTCODE[0], i[1] = r.DEFINE_STARTCODE[1], i[2] = r.DEFINE_STARTCODE[2], i[3] = r.DEFINE_STARTCODE[3]) : ((i = new Uint8Array(r.DEFINE_STARTCODE.length + e.length)).set(r.DEFINE_STARTCODE, 0), i.set(e, r.DEFINE_STARTCODE.length)), i
+ }, h.prototype.setAACAdts = function(e) {
+ var t = null,
+ i = this.aacProfile,
+ n = u[this.sampleRate],
+ r = new Uint8Array(7),
+ a = r.length + e.length;
+ return r[0] = 255, r[1] = 241, r[2] = (i - 1 << 6) + (n << 2) + 0, r[3] = 128 + (a >> 11), r[4] = (2047 & a) >> 3, r[5] = 31 + ((7 & a) << 5), r[6] = 252, (t = new Uint8Array(a)).set(r, 0), t.set(e, r.length), t
+ }, h.prototype.demux = function() {
+ var e = this;
+ e.seekPos = -1, e.mp4boxfile = n.createFile(), e.movieInfo = null, e.videoCodec = null, e.durationMs = -1, e.fps = -1, e.sampleRate = -1, e.aacProfile = 2, e.size = {
+ width: -1,
+ height: -1
+ }, e.bufObject = s(), e.audioNone = !1, e.naluHeader = {
+ vps: null,
+ sps: null,
+ pps: null,
+ sei: null
+ }, e.mp4boxfile.onError = function(e) {}, this.mp4boxfile.onReady = function(t) {
+ for (var i in e.movieInfo = t, t.tracks) "VideoHandler" !== t.tracks[i].name && "video" !== t.tracks[i].type || (t.tracks[i].codec, t.tracks[i].codec.indexOf("hev") >= 0 || t.tracks[i].codec.indexOf("hvc") >= 0 ? e.videoCodec = o.CODEC_H265 : t.tracks[i].codec.indexOf("avc") >= 0 && (e.videoCodec = o.CODEC_H264));
+ var n = -1;
+ if (n = t.videoTracks[0].samples_duration / t.videoTracks[0].timescale, e.durationMs = 1e3 * n, e.fps = t.videoTracks[0].nb_samples / n, e.seekDiffTime = 1 / e.fps, e.size.width = t.videoTracks[0].track_width, e.size.height = t.videoTracks[0].track_height, t.audioTracks.length > 0) {
+ e.sampleRate = t.audioTracks[0].audio.sample_rate;
+ var r = t.audioTracks[0].codec.split(".");
+ e.aacProfile = r[r.length - 1]
+ } else e.audioNone = !0;
+ null != e.onMp4BoxReady && e.onMp4BoxReady(e.videoCodec), e.videoCodec === o.CODEC_H265 ? (e.initializeAllSourceBuffers(), e.mp4boxfile.start()) : (e.videoCodec, o.CODEC_H264)
+ }, e.mp4boxfile.onSamples = function(t, i, n) {
+ var s = window.setInterval((function() {
+ for (var i = 0; i < n.length; i++) {
+ var u = n[i],
+ h = u.data,
+ d = null;
+ if (!(null == h || h.length < 4) && h) {
+ var c = u.dts / u.timescale;
+ if (1 === t) {
+ var f = null,
+ p = u.is_sync;
+ if (e.videoCodec === o.CODEC_H265) {
+ f = u.description.hvcC;
+ var m = a.GET_NALU_TYPE(h[4]);
+ p || (p = m == r.DEFINE_KEY_FRAME || u.is_sync)
+ } else e.videoCodec === o.CODEC_H264 && (f = u.description.avcC);
+ if (p) {
+ if (e.videoCodec == o.CODEC_H265) {
+ var _ = f.nalu_arrays;
+ e.naluHeader.vps = e.setStartCode(_[0][0].data, !1), e.naluHeader.sps = e.setStartCode(_[1][0].data, !1), e.naluHeader.pps = e.setStartCode(_[2][0].data, !1), _.length > 3 ? e.naluHeader.sei = e.setStartCode(_[3][0].data, !1) : e.naluHeader.sei = new Uint8Array, e.naluHeader
+ } else e.videoCodec == o.CODEC_H264 && (e.naluHeader.vps = new Uint8Array, e.naluHeader.sps = e.setStartCode(f.SPS[0].nalu, !1), e.naluHeader.pps = e.setStartCode(f.PPS[0].nalu, !1), e.naluHeader.sei = new Uint8Array);
+ h[4].toString(16), e.naluHeader.vps[4].toString(16), l(e.naluHeader.vps), l(h);
+ var g = e.setStartCode(h.subarray(0, e.naluHeader.vps.length), !0);
+ if (l(g), h[4] === e.naluHeader.vps[4]) {
+ var v = e.naluHeader.vps.length + 4,
+ y = e.naluHeader.vps.length + e.naluHeader.sps.length + 4,
+ b = e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length + 4;
+ if (e.naluHeader.sei.length <= 0 && e.naluHeader.sps.length > 0 && h[v] === e.naluHeader.sps[4] && e.naluHeader.pps.length > 0 && h[y] === e.naluHeader.pps[4] && 78 === h[b]) {
+ h[e.naluHeader.vps.length + 4], e.naluHeader.sps[4], h[e.naluHeader.vps.length + e.naluHeader.sps.length + 4], e.naluHeader.pps[4], h[e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length + 4];
+ for (var S = 0, T = 0; T < h.length; T++)
+ if (h[T] === r.SOURCE_CODE_SEI_END && a.GET_NALU_TYPE(h[T + 5]) === r.DEFINE_KEY_FRAME) {
+ S = T;
+ break
+ } h[3] = 1, h[v - 1] = 1, h[y - 1] = 1, h[b - 1] = 1, h[2] = 0, h[v - 2] = 0, h[y - 2] = 0, h[b - 2] = 0, h[1] = 0, h[v - 3] = 0, h[y - 3] = 0, h[b - 3] = 0, h[S + 1] = 0, h[S + 2] = 0, h[S + 3] = 0, h[S + 4] = 1, e.naluHeader.vps = null, e.naluHeader.sps = null, e.naluHeader.pps = null, e.naluHeader.vps = new Uint8Array, e.naluHeader.sps = new Uint8Array, e.naluHeader.pps = new Uint8Array
+ } else h[4].toString(16), e.naluHeader.vps[4].toString(16), l(e.naluHeader.vps), l(h), h = h.subarray(e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length + e.naluHeader.sei.length)
+ } else if (e.naluHeader.sei.length > 4 && h[4] === e.naluHeader.sei[4]) {
+ var E = h.subarray(0, 10),
+ w = new Uint8Array(e.naluHeader.vps.length + E.length);
+ w.set(E, 0), w.set(e.naluHeader.vps, E.length), w[3] = 1, e.naluHeader.vps = null, e.naluHeader.vps = new Uint8Array(w), w = null, E = null, (h = h.subarray(10))[4], e.naluHeader.vps[4], e.naluHeader.vps
+ } else if (0 === e.naluHeader.sei.length && 78 === h[4]) {
+ h = e.setStartCode(h, !0);
+ for (var A = 0, C = 0; C < h.length; C++)
+ if (h[C] === r.SOURCE_CODE_SEI_END && a.GET_NALU_TYPE(h[C + 5]) === r.DEFINE_KEY_FRAME) {
+ A = C;
+ break
+ } e.naluHeader.sei = h.subarray(0, A + 1), h = new Uint8Array(h.subarray(A + 1)), e.naluHeader.sei
+ }
+ l(e.naluHeader.vps), l(e.naluHeader.sps), l(e.naluHeader.pps), l(e.naluHeader.sei), l(h), (d = new Uint8Array(e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length + e.naluHeader.sei.length + h.length)).set(e.naluHeader.vps, 0), d.set(e.naluHeader.sps, e.naluHeader.vps.length), d.set(e.naluHeader.pps, e.naluHeader.vps.length + e.naluHeader.sps.length), d.set(e.naluHeader.sei, e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length), d.set(e.setStartCode(h, !0), e.naluHeader.vps.length + e.naluHeader.sps.length + e.naluHeader.pps.length + e.naluHeader.sei.length)
+ } else d = e.setStartCode(h, !0);
+ e.bufObject.appendFrame(c, d, !0, p)
+ } else 2 == t && (d = e.setAACAdts(h), e.bufObject.appendFrame(c, d, !1, !0))
+ }
+ }
+ window.clearInterval(s), s = null
+ }), 0)
+ }
+ }, h.prototype.appendBufferData = function(e) {
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
+ return e.fileStart = t, this.mp4boxfile.appendBuffer(e)
+ }, h.prototype.finishBuffer = function() {
+ this.mp4boxfile.flush()
+ }, h.prototype.play = function() {}, h.prototype.getVideoCoder = function() {
+ return this.videoCodec
+ }, h.prototype.getDurationMs = function() {
+ return this.durationMs
+ }, h.prototype.getFPS = function() {
+ return this.fps
+ }, h.prototype.getSampleRate = function() {
+ return this.sampleRate
+ }, h.prototype.getSize = function() {
+ return this.size
+ }, h.prototype.seek = function(e) {
+ if (e >= 0) {
+ var t = this.bufObject.seekIDR(e);
+ this.seekPos = t
+ }
+ }, h.prototype.popBuffer = function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
+ t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ return t < 0 ? null : 1 == e ? this.bufObject.vFrame(t) : 2 == e ? this.bufObject.aFrame(t) : void 0
+ }, h.prototype.addBuffer = function(e) {
+ var t = e.id;
+ this.mp4boxfile.setExtractionOptions(t)
+ }, h.prototype.initializeAllSourceBuffers = function() {
+ if (this.movieInfo) {
+ for (var e = this.movieInfo, t = 0; t < e.tracks.length; t++) {
+ var i = e.tracks[t];
+ this.addBuffer(i)
+ }
+ this.initializeSourceBuffers()
+ }
+ }, h.prototype.onInitAppended = function(e) {
+ var t = e.target;
+ "open" === t.ms.readyState && (t.sampleNum = 0, t.removeEventListener("updateend", this.onInitAppended), t.ms.pendingInits--, 0 === t.ms.pendingInits && this.mp4boxfile.start())
+ }, h.prototype.initializeSourceBuffers = function() {
+ for (var e = this.mp4boxfile.initializeSegmentation(), t = 0; t < e.length; t++) {
+ var i = e[t].user;
+ 0 === t && (i.ms.pendingInits = 0), i.addEventListener("updateend", this.onInitAppended), i.appendBuffer(e[t].buffer), i.segmentIndex = 0, i.ms.pendingInits++
+ }
+ }, t.exports = h
+ }, {
+ "../consts": 52,
+ "../decoder/hevc-header": 63,
+ "../decoder/hevc-imp": 64,
+ "./buffer": 66,
+ mp4box: 39
+ }],
+ 72: [function(e, t, i) {
+ "use strict";
+ t.exports = {
+ DEFAULT_SAMPLERATE: 44100,
+ DEFAULT_CHANNEL: 1,
+ H264AUD: [0, 0, 0, 1, 9, 224],
+ H265AUD: [0, 0, 0, 1, 70, 1, 80],
+ DEF_AAC: "aac",
+ DEF_MP3: "mp3",
+ DEF_H265: "h265",
+ DEF_HEVC: "hevc",
+ DEF_H264: "h264",
+ DEF_AVC: "avc",
+ CODEC_OFFSET_TABLE: ["hevc", "h265", "avc", "h264", "aac", "mp3"]
+ }
+ }, {}],
+ 73: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.sampleRate = t.sampleRate, this.frameDurMs = Math.floor(1024e3 / this.sampleRate), this.frameDurSec = this.frameDurMs / 1e3
+ }
+ var t, i, r;
+ return t = e, (i = [{
+ key: "updateConfig",
+ value: function(e) {
+ this.sampleRate = e.sampleRate, this.frameDurMs = 1024e3 / this.sampleRate, this.frameDurSec = this.frameDurMs / 1e3
+ }
+ }, {
+ key: "_getPktLen",
+ value: function(e, t, i) {
+ return ((3 & e) << 11) + (t << 3) + ((224 & i) >> 5)
+ }
+ }, {
+ key: "sliceAACFrames",
+ value: function(e, t) {
+ for (var i = [], n = e, r = 0; r < t.length - 1;)
+ if (255 == t[r] && t[r + 1] >> 4 == 15) {
+ var a = this._getPktLen(t[r + 3], t[r + 4], t[r + 5]);
+ if (a <= 0) continue;
+ var s = t.subarray(r, r + a),
+ o = new Uint8Array(a);
+ o.set(s, 0), i.push({
+ ptime: n,
+ data: o
+ }), n += this.frameDurSec, r += a
+ } else r += 1;
+ return i
+ }
+ }]) && n(t.prototype, i), r && n(t, r), e
+ }();
+ i.AACDecoder = r
+ }, {}],
+ 74: [function(e, t, i) {
+ (function(t) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("./decoder/aac"),
+ a = e("./consts"),
+ s = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.configFormat = {}, this.isLive = 0, this.mediaAttr = {
+ sampleRate: 0,
+ sampleChannel: 0,
+ vFps: 0,
+ vGop: 0,
+ vDuration: 0,
+ aDuration: 0,
+ duration: 0,
+ aCodec: "",
+ vCodec: "",
+ audioNone: !1
+ }, this.extensionInfo = {
+ vWidth: 0,
+ vHeight: 0
+ }, this.controller = new AbortController, this.offsetDemux = null, this.wasmState = 0, this.naluLayer = null, this.vlcLayer = null, this.onReady = null, this.onDemuxed = null, this.onDemuxedFailed = null, this.aacDec = null
+ }
+ var i, s, o;
+ return i = e, (s = [{
+ key: "initDemuxer",
+ value: function() {
+ var e = this;
+ return window.WebAssembly ? (Module.run(), 1 === t.STATIC_MEM_wasmDecoderState ? (e.wasmState = 1, e.onReady()) : (Module.onRuntimeInitialized = function() {
+ null != e.onReady && 0 == e.wasmState && (e.wasmState = 1, e.onReady())
+ }, Module.postRun = function() {
+ null != e.onReady && 0 == e.wasmState && (e.wasmState = 1, e.onReady())
+ })) : /iPhone|iPad/.test(window.navigator.userAgent), !0
+ }
+ }, {
+ key: "demuxURL",
+ value: function(e) {
+ this._demuxerTsInit(e)
+ }
+ }, {
+ key: "demuxUint8Buf",
+ value: function(e) {
+ this._demuxCore(e)
+ }
+ }, {
+ key: "_demuxerTsInit",
+ value: function(e) {
+ var t = this,
+ i = this.controller.signal;
+ fetch(e, {
+ signal: i
+ }).then((function(e) {
+ return e.arrayBuffer()
+ })).then((function(i) {
+ i.fileStart = 0;
+ var n = new Uint8Array(i);
+ null != n ? t._demuxCore(n) : console.error("demuxerTsInit ERROR fetch res is null ==> ", e), n = null
+ })).catch((function(i) {
+ console.error("demuxerTsInit ERROR fetch ERROR ==> ", i), t._releaseOffset(), t.onDemuxedFailed && t.onDemuxedFailed(i, e)
+ }))
+ }
+ }, {
+ key: "_releaseOffset",
+ value: function() {
+ void 0 !== this.offsetDemux && null !== this.offsetDemux && (Module._free(this.offsetDemux), this.offsetDemux = null)
+ }
+ }, {
+ key: "_demuxCore",
+ value: function(e) {
+ if (this._releaseOffset(), this._refreshDemuxer(), !(e.length <= 0)) {
+ this.offsetDemux = Module._malloc(e.length), Module.HEAP8.set(e, this.offsetDemux);
+ var t = Module.cwrap("demuxBox", "number", ["number", "number", "number"])(this.offsetDemux, e.length, this.isLive);
+ Module._free(this.offsetDemux), this.offsetDemux = null, t >= 0 && (this._setMediaInfo(), this._setExtensionInfo(), null != this.onDemuxed && this.onDemuxed())
+ }
+ }
+ }, {
+ key: "_setMediaInfo",
+ value: function() {
+ var e = Module.cwrap("getMediaInfo", "number", [])(),
+ t = Module.HEAPU32[e / 4],
+ i = Module.HEAPU32[e / 4 + 1],
+ n = Module.HEAPF64[e / 8 + 1],
+ s = Module.HEAPF64[e / 8 + 1 + 1],
+ o = Module.HEAPF64[e / 8 + 1 + 1 + 1],
+ u = Module.HEAPF64[e / 8 + 1 + 1 + 1 + 1],
+ l = Module.HEAPU32[e / 4 + 2 + 2 + 2 + 2 + 2];
+ this.mediaAttr.vFps = n, this.mediaAttr.vGop = l, this.mediaAttr.vDuration = s, this.mediaAttr.aDuration = o, this.mediaAttr.duration = u;
+ var h = Module.cwrap("getAudioCodecID", "number", [])();
+ h >= 0 ? (this.mediaAttr.aCodec = a.CODEC_OFFSET_TABLE[h], this.mediaAttr.sampleRate = t > 0 ? t : a.DEFAULT_SAMPLERATE, this.mediaAttr.sampleChannel = i >= 0 ? i : a.DEFAULT_CHANNEL) : (this.mediaAttr.sampleRate = 0, this.mediaAttr.sampleChannel = 0, this.mediaAttr.audioNone = !0);
+ var d = Module.cwrap("getVideoCodecID", "number", [])();
+ d >= 0 && (this.mediaAttr.vCodec = a.CODEC_OFFSET_TABLE[d]), null == this.aacDec ? this.aacDec = new r.AACDecoder(this.mediaAttr) : this.aacDec.updateConfig(this.mediaAttr)
+ }
+ }, {
+ key: "_setExtensionInfo",
+ value: function() {
+ var e = Module.cwrap("getExtensionInfo", "number", [])(),
+ t = Module.HEAPU32[e / 4],
+ i = Module.HEAPU32[e / 4 + 1];
+ this.extensionInfo.vWidth = t, this.extensionInfo.vHeight = i
+ }
+ }, {
+ key: "readMediaInfo",
+ value: function() {
+ return this.mediaAttr
+ }
+ }, {
+ key: "readExtensionInfo",
+ value: function() {
+ return this.extensionInfo
+ }
+ }, {
+ key: "readAudioNone",
+ value: function() {
+ return this.mediaAttr.audioNone
+ }
+ }, {
+ key: "_readLayer",
+ value: function() {
+ null === this.naluLayer ? this.naluLayer = {
+ vps: null,
+ sps: null,
+ pps: null,
+ sei: null
+ } : (this.naluLayer.vps = null, this.naluLayer.sps = null, this.naluLayer.pps = null, this.naluLayer.sei = null), null === this.vlcLayer ? this.vlcLayer = {
+ vlc: null
+ } : this.vlcLayer.vlc = null;
+ var e = Module.cwrap("getSPSLen", "number", [])(),
+ t = Module.cwrap("getSPS", "number", [])();
+ if (!(e < 0)) {
+ var i = Module.HEAPU8.subarray(t, t + e);
+ this.naluLayer.sps = new Uint8Array(e), this.naluLayer.sps.set(i, 0);
+ var n = Module.cwrap("getPPSLen", "number", [])(),
+ r = Module.cwrap("getPPS", "number", [])(),
+ s = Module.HEAPU8.subarray(r, r + n);
+ this.naluLayer.pps = new Uint8Array(n), this.naluLayer.pps.set(s, 0);
+ var o = Module.cwrap("getSEILen", "number", [])(),
+ u = Module.cwrap("getSEI", "number", [])(),
+ l = Module.HEAPU8.subarray(u, u + o);
+ this.naluLayer.sei = new Uint8Array(o), this.naluLayer.sei.set(l, 0);
+ var h = Module.cwrap("getVLCLen", "number", [])(),
+ d = Module.cwrap("getVLC", "number", [])(),
+ c = Module.HEAPU8.subarray(d, d + h);
+ if (this.vlcLayer.vlc = new Uint8Array(h), this.vlcLayer.vlc.set(c, 0), this.mediaAttr.vCodec == a.DEF_HEVC || this.mediaAttr.vCodec == a.DEF_H265) {
+ var f = Module.cwrap("getVPSLen", "number", [])(),
+ p = Module.cwrap("getVPS", "number", [])(),
+ m = Module.HEAPU8.subarray(p, p + f);
+ this.naluLayer.vps = new Uint8Array(f), this.naluLayer.vps.set(m, 0), Module._free(m), m = null
+ } else this.mediaAttr.vCodec == a.DEF_AVC || (this.mediaAttr.vCodec, a.DEF_H264);
+ return Module._free(i), i = null, Module._free(s), s = null, Module._free(l), l = null, Module._free(c), c = null, {
+ nalu: this.naluLayer,
+ vlc: this.vlcLayer
+ }
+ }
+ }
+ }, {
+ key: "isHEVC",
+ value: function() {
+ return this.mediaAttr.vCodec == a.DEF_HEVC || this.mediaAttr.vCodec == a.DEF_H265
+ }
+ }, {
+ key: "readPacket",
+ value: function() {
+ var e = Module.cwrap("getPacket", "number", [])(),
+ t = Module.HEAPU32[e / 4],
+ i = Module.HEAPU32[e / 4 + 1],
+ n = Module.HEAPF64[e / 8 + 1],
+ r = Module.HEAPF64[e / 8 + 1 + 1],
+ s = Module.HEAPU32[e / 4 + 1 + 1 + 2 + 2],
+ o = Module.HEAPU32[e / 4 + 1 + 1 + 2 + 2 + 1],
+ u = Module.HEAPU8.subarray(o, o + i),
+ l = this._readLayer(),
+ h = {
+ type: t,
+ size: i,
+ ptime: n,
+ dtime: r,
+ keyframe: s,
+ src: u,
+ data: 1 == t && this.mediaAttr.aCodec == a.DEF_AAC ? this.aacDec.sliceAACFrames(n, u) : u,
+ layer: l
+ };
+ return Module._free(u), u = null, h
+ }
+ }, {
+ key: "_refreshDemuxer",
+ value: function() {
+ this.releaseTsDemuxer(), this._initDemuxer()
+ }
+ }, {
+ key: "_initDemuxer",
+ value: function() {
+ Module.cwrap("initTsMissile", "number", [])(), Module.cwrap("initializeDemuxer", "number", [])()
+ }
+ }, {
+ key: "releaseTsDemuxer",
+ value: function() {
+ Module.cwrap("exitTsMissile", "number", [])()
+ }
+ }]) && n(i.prototype, s), o && n(i, o), e
+ }();
+ i.MPEG_JS = s
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {
+ "./consts": 72,
+ "./decoder/aac": 73
+ }],
+ 75: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("./mpegts/mpeg.js"),
+ a = e("./buffer"),
+ s = e("../decoder/hevc-imp"),
+ o = function() {
+ function e() {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.seekPos = -1, this.durationMs = -1, this.fps = -1, this.sampleRate = -1, this.aCodec = "", this.vCodec = "", this.size = {
+ width: -1,
+ height: -1
+ }, this.bufObject = a(), this.mpegTsObj = null, this.bufObject = a(), this.mediaInfo = {}, this.extensionInfo = {}, this.onReady = null, this.onDemuxed = null, this.onReadyOBJ = null
+ }
+ var t, i, o;
+ return t = e, (i = [{
+ key: "initMPEG",
+ value: function() {
+ var e = this;
+ this.mpegTsObj = new r.MPEG_JS({}), this.mpegTsObj.onDemuxed = function() {
+ e.mediaInfo = e.mpegTsObj.readMediaInfo(), e.mediaInfo, e.extensionInfo = e.mpegTsObj.readExtensionInfo(), e.extensionInfo, e.vCodec = e.mediaInfo.vCodec, e.aCodec = e.mediaInfo.aCodec, e.durationMs = 1e3 * e.mediaInfo.duration, e.fps = e.mediaInfo.vFps, e.sampleRate = e.mediaInfo.sampleRate, e.extensionInfo.vWidth > 0 && e.extensionInfo.vHeight > 0 && (e.size.width = e.extensionInfo.vWidth, e.size.height = e.extensionInfo.vHeight);
+ for (var t = null; !((t = e.mpegTsObj.readPacket()).size <= 0);) {
+ var i = t.dtime;
+ if (0 == t.type) {
+ var n = s.PACK_NALU(t.layer),
+ r = 1 == t.keyframe;
+ e.bufObject.appendFrame(i, n, !0, r)
+ } else if ("aac" == e.mediaInfo.aCodec)
+ for (var a = t.data, o = 0; o < a.length; o++) {
+ var u = a[o];
+ e.bufObject.appendFrame(u.ptime, u.data, !1, !0)
+ } else e.bufObject.appendFrame(i, t.data, !1, !0)
+ }
+ e.bufObject.videoBuffer, e.bufObject.audioBuffer, null != e.onDemuxed && e.onDemuxed(e.onReadyOBJ)
+ }, this.mpegTsObj.onReady = function() {
+ null != e.onReady && e.onReady(e.onReadyOBJ)
+ }, this.mpegTsObj.initDemuxer()
+ }
+ }, {
+ key: "bindReady",
+ value: function(e) {
+ this.onReadyOBJ = e
+ }
+ }, {
+ key: "releaseTsDemuxer",
+ value: function() {
+ this.mpegTsObj && this.mpegTsObj.releaseTsDemuxer(), this.mpegTsObj = null
+ }
+ }, {
+ key: "demux",
+ value: function(e) {
+ this.mpegTsObj.demuxUint8Buf(e)
+ }
+ }, {
+ key: "popBuffer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1,
+ t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : -1;
+ return t < 0 ? null : 1 == e ? this.bufObject.vFrame(t) : 2 == e ? this.bufObject.aFrame(t) : void 0
+ }
+ }, {
+ key: "isHEVC",
+ value: function() {
+ return this.mpegTsObj.isHEVC()
+ }
+ }, {
+ key: "getACodec",
+ value: function() {
+ return this.aCodec
+ }
+ }, {
+ key: "getVCodec",
+ value: function() {
+ return this.vCodec
+ }
+ }, {
+ key: "getAudioNone",
+ value: function() {
+ return this.mpegTsObj.mediaAttr.audioNone
+ }
+ }, {
+ key: "getDurationMs",
+ value: function() {
+ return this.durationMs
+ }
+ }, {
+ key: "getFPS",
+ value: function() {
+ return this.fps
+ }
+ }, {
+ key: "getSampleRate",
+ value: function() {
+ return this.sampleRate
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return this.size
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ if (e >= 0) {
+ var t = this.bufObject.seekIDR(e);
+ this.seekPos = t
+ }
+ }
+ }]) && n(t.prototype, i), o && n(t, o), e
+ }();
+ i.MpegTs = o
+ }, {
+ "../decoder/hevc-imp": 64,
+ "./buffer": 66,
+ "./mpegts/mpeg.js": 74
+ }],
+ 76: [function(e, t, i) {
+ (function(t) {
+ "use strict";
+
+ 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 r(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var a = e("./decoder/player-core"),
+ s = e("./native/mp4-player"),
+ o = e("./decoder/c-native-core"),
+ u = e("./decoder/c-httplive-core"),
+ l = e("./decoder/c-http-g711-core"),
+ h = e("./decoder/c-wslive-core"),
+ d = e("./native/nv-videojs-core"),
+ c = e("./native/nv-flvjs-core"),
+ f = e("./native/nv-mpegts-core"),
+ p = e("./decoder/av-common"),
+ m = (e("./demuxer/mpegts/mpeg.js"), e("./demuxer/mp4")),
+ _ = e("./demuxer/ts"),
+ g = e("./demuxer/m3u8"),
+ v = e("./consts"),
+ y = (e("./utils/static-mem"), e("./utils/ui/ui")),
+ b = (e("./decoder/cache"), e("./render-engine/webgl-420p")),
+ S = {
+ moovStartFlag: !0,
+ readyShow: !0,
+ rawFps: 24,
+ autoCrop: !1,
+ core: v.PLAYER_CORE_TYPE_DEFAULT,
+ coreProbePart: 0,
+ checkProbe: !0,
+ ignoreAudio: 0,
+ probeSize: 4096,
+ autoPlay: !1,
+ cacheLength: 50,
+ loadTimeout: 30,
+ hevc: !0
+ },
+ T = function(e, t) {
+ return t - 1e3 / e
+ };
+ void 0 !== t.Module && null !== t.Module || (t.Module = {}), Module.onRuntimeInitialized = function() {
+ t.STATIC_MEM_wasmDecoderState = 1, t.STATIC_MEM_wasmDecoderState
+ }, window.g_players = {}, window.onmessage = function(e) {}, window.addEventListener("wasmLoaded", (function() {
+ t.STATIC_MEM_wasmDecoderState = 1
+ })), t.onWASMLoaded = function() {
+ t.STATIC_MEM_wasmDecoderState = 1
+ };
+ var E = function() {
+ function e(i, n) {
+ if (function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), t.STATICE_MEM_playerCount += 1, this.playerIndex = t.STATICE_MEM_playerCount, this.mp4Obj = null, this.mpegTsObj = null, this.hlsObj = null, this.hlsConf = {
+ hlsType: v.PLAYER_IN_TYPE_M3U8_VOD
+ }, this.snapshotCanvasContext = null, this.snapshotYuvLastFrame = {
+ width: 0,
+ height: 0,
+ luma: null,
+ chromaB: null,
+ chromaR: null
+ }, this.videoURL = i, this.configFormat = {
+ playerId: n.player || v.DEFAILT_WEBGL_PLAY_ID,
+ playerW: n.width || v.DEFAULT_WIDTH,
+ playerH: n.height || v.DEFAULT_HEIGHT,
+ type: n.type || p.GetUriFormat(this.videoURL),
+ accurateSeek: n.accurateSeek || !0,
+ playIcon: n.playIcon || "assets/icon-play@300.png",
+ loadIcon: n.loadIcon || "assets/icon-loading.gif",
+ token: n.token || null,
+ extInfo: S
+ }, this.mediaExtFormat = this.configFormat.type, this.mediaExtProtocol = null, void 0 !== this.videoURL && null !== this.videoURL && (this.mediaExtProtocol = p.GetUriProtocol(this.videoURL)), this.mediaExtProtocol, this.mediaExtFormat, null != this.configFormat.token) {
+ for (var r in this.configFormat.extInfo.core = p.GetFormatPlayCore(this.configFormat.type), n.extInfo) r in this.configFormat.extInfo && (this.configFormat.extInfo[r] = n.extInfo[r]);
+ this.playMode = v.PLAYER_MODE_VOD, this.seekTarget = 0, this.playParam = null, this.timerFeed = null, this.player = null, this.volume = 1, this.rawModePts = 0, this.loadTimeoutInterval = null, this.loadTimeoutSecNow = this.configFormat.extInfo.loadTimeout, this.autoScreenClose = !0, this.feedMP4Data = null, this.workerFetch = null, this.workerParse = null, this.onPlayTime = null, this.onLoadFinish = null, this.onSeekStart = null, this.onSeekFinish = null, this.onRender = null, this.onLoadCache = null, this.onLoadCacheFinshed = null, this.onPlayFinish = null, this.onCacheProcess = null, this.onReadyShowDone = null, this.onOpenFullScreen = null, this.onCloseFullScreen = null, this.onError = null, this.onProbeError = null, this.onMakeItReady = null, this.onPlayState = null, this.filterConfigParams(), this.configFormat;
+ var a = this;
+ document.addEventListener("fullscreenchange", (function(e) {
+ a._isFullScreen() ? a.onOpenFullScreen && a.onOpenFullScreen() : (!0 === a.autoScreenClose && a.closeFullScreen(!0), a.onCloseFullScreen && a.onCloseFullScreen())
+ })), this.screenW = window.screen.width, this.screenH = window.screen.height
+ }
+ }
+ var i, E, w;
+ return i = e, (E = [{
+ key: "filterConfigParams",
+ value: function() {
+ void 0 !== this.configFormat.extInfo.checkProbe && null !== this.configFormat.extInfo.checkProbe || (this.configFormat.extInfo.checkProbe = !0), this.configFormat.type === v.PLAYER_IN_TYPE_FLV ? (this.configFormat.extInfo.core = v.PLAYER_CORE_TYPE_CNATIVE, this.configFormat.type = v.PLAYER_IN_TYPE_MP4) : this.configFormat.type === v.PLAYER_IN_TYPE_HTTPFLV && (this.configFormat.extInfo.core = v.PLAYER_CORE_TYPE_CNATIVE, this.configFormat.type = v.PLAYER_IN_TYPE_MP4, this.playMode = v.PLAYER_MODE_NOTIME_LIVE)
+ }
+ }, {
+ key: "do",
+ value: function() {
+ var e = this,
+ i = !1;
+ if (this.configFormat.extInfo.ignoreAudio > 0 && (i = !0), this.configFormat.type === v.PLAYER_IN_TYPE_RAW_265 && (i = !0, this.playMode = v.PLAYER_MODE_NOTIME_LIVE), this.playParam = {
+ durationMs: 0,
+ fps: 0,
+ sampleRate: 0,
+ size: {
+ width: 0,
+ height: 0
+ },
+ audioNone: i,
+ videoCodec: v.CODEC_H265
+ }, y.UI.createPlayerRender(this.configFormat.playerId, this.configFormat.playerW, this.configFormat.playerH), !1 === this._isSupportWASM()) return this._makeMP4Player(!1), 0;
+ if (!1 === this.configFormat.extInfo.hevc) return Module.cwrap("AVPlayerInit", "number", ["string", "string"])(this.configFormat.token, "0.0.0"), this._makeMP4Player(!0), 0;
+ var n = window.setInterval((function() {
+ t.STATICE_MEM_playerIndexPtr === e.playerIndex && (t.STATICE_MEM_playerIndexPtr, e.playerIndex, window.WebAssembly ? (t.STATIC_MEM_wasmDecoderState, 1 == t.STATIC_MEM_wasmDecoderState && (e._makeMP4Player(), t.STATICE_MEM_playerIndexPtr += 1, window.clearInterval(n), n = null)) : (/iPhone|iPad/.test(window.navigator.userAgent), t.STATICE_MEM_playerIndexPtr += 1, window.clearInterval(n), n = null))
+ }), 500)
+ }
+ }, {
+ key: "release",
+ value: function() {
+ return void 0 !== this.player && null !== this.player && (this.player, this.playParam.videoCodec === v.CODEC_H265 && this.player ? (this.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && void 0 !== this.hlsObj && null !== this.hlsObj && this.hlsObj.release(), this.player.release()) : this.player.release(), void 0 !== this.snapshotCanvasContext && null !== this.snapshotCanvasContext && (b.releaseContext(this.snapshotCanvasContext), this.snapshotCanvasContext = null, void 0 !== this.snapshotYuvLastFrame && null !== this.snapshotYuvLastFrame && (this.snapshotYuvLastFrame.luma = null, this.snapshotYuvLastFrame.chromaB = null, this.snapshotYuvLastFrame.chromaR = null, this.snapshotYuvLastFrame.width = 0, this.snapshotYuvLastFrame.height = 0)), void 0 !== this.workerFetch && null !== this.workerFetch && (this.workerFetch.postMessage({
+ cmd: "stop",
+ params: "",
+ type: this.mediaExtProtocol
+ }), this.workerFetch.onmessage = null), void 0 !== this.workerParse && null !== this.workerParse && (this.workerParse.postMessage({
+ cmd: "stop",
+ params: ""
+ }), this.workerParse.onmessage = null), this.workerFetch = null, this.workerParse = null, this.configFormat.extInfo.readyShow = !0, window.onclick = document.body.onclick = null, window.g_players = {}, !0)
+ }
+ }, {
+ key: "debugYUV",
+ value: function(e) {
+ this.player.debugYUV(e)
+ }
+ }, {
+ key: "setPlaybackRate",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ return !(this.playParam.videoCodec === v.CODEC_H265 || e <= 0 || void 0 === this.player || null === this.player) && this.player.setPlaybackRate(e)
+ }
+ }, {
+ key: "getPlaybackRate",
+ value: function() {
+ return void 0 !== this.player && null !== this.player && (this.playParam.videoCodec === v.CODEC_H265 ? 1 : this.player.getPlaybackRate())
+ }
+ }, {
+ key: "setRenderScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ return void 0 !== this.player && null !== this.player && (this.player.setScreen(e), !0)
+ }
+ }, {
+ key: "play",
+ value: function() {
+ if (void 0 === this.player || null === this.player) return !1;
+ if (this.playParam.videoCodec === v.CODEC_H265) {
+ var e = {
+ seekPos: this._getSeekTarget(),
+ mode: this.playMode,
+ accurateSeek: this.configFormat.accurateSeek,
+ seekEvent: !1,
+ realPlay: !0
+ };
+ this.player.play(e)
+ } else this.player.play();
+ return !0
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ return void 0 !== this.player && null !== this.player && (this.player.pause(), !0)
+ }
+ }, {
+ key: "isPlaying",
+ value: function() {
+ return void 0 !== this.player && null !== this.player && this.player.isPlayingState()
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ return !(e < 0 || void 0 === this.player || null === this.player || (this.volume = e, this.player && this.player.setVoice(e), 0))
+ }
+ }, {
+ key: "getVolume",
+ value: function() {
+ return this.volume
+ }
+ }, {
+ key: "mediaInfo",
+ value: function() {
+ var e = {
+ meta: this.playParam,
+ videoType: this.playMode
+ };
+ return e.meta.isHEVC = 0 === this.playParam.videoCodec, e
+ }
+ }, {
+ key: "snapshot",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
+ return null === e || void 0 !== this.playParam && null !== this.playParam && (0 === this.playParam.videoCodec ? (this.player.setScreen(!0), e.width = this.snapshotYuvLastFrame.width, e.height = this.snapshotYuvLastFrame.height, this.snapshotYuvLastFrame, void 0 !== this.snapshotCanvasContext && null !== this.snapshotCanvasContext || (this.snapshotCanvasContext = b.setupCanvas(e, {
+ preserveDrawingBuffer: !1
+ })), b.renderFrame(this.snapshotCanvasContext, this.snapshotYuvLastFrame.luma, this.snapshotYuvLastFrame.chromaB, this.snapshotYuvLastFrame.chromaR, this.snapshotYuvLastFrame.width, this.snapshotYuvLastFrame.height)) : (e.width = this.playParam.size.width, e.height = this.playParam.size.height, e.getContext("2d").drawImage(this.player.videoTag, 0, 0, e.width, e.height))), null
+ }
+ }, {
+ key: "_seekHLS",
+ value: function(e, t, i) {
+ if (void 0 === this.player || null === this.player) return !1;
+ setTimeout((function() {
+ t.player.getCachePTS(), t.player.getCachePTS() > e ? i() : t._seekHLS(e, t, i)
+ }), 100)
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ if (void 0 === this.player || null === this.player) return !1;
+ var t = this;
+ this.seekTarget = e, this.onSeekStart && this.onSeekStart(e), this.timerFeed && (window.clearInterval(this.timerFeed), this.timerFeed = null);
+ var i = this._getSeekTarget();
+ return this.playParam.videoCodec === v.CODEC_H264 ? (this.player.seek(e), this.onSeekFinish && this.onSeekFinish()) : this.configFormat.extInfo.core === v.PLAYER_CORE_TYPE_CNATIVE ? (this.pause(), this._seekHLS(e, this, (function() {
+ t.player.seek((function() {}), {
+ seekTime: i,
+ mode: t.playMode,
+ accurateSeek: t.configFormat.accurateSeek
+ })
+ }))) : this._seekHLS(e, this, (function() {
+ t.player.seek((function() {
+ t.configFormat.type == v.PLAYER_IN_TYPE_MP4 ? t.mp4Obj.seek(e) : t.configFormat.type == v.PLAYER_IN_TYPE_TS || t.configFormat.type == v.PLAYER_IN_TYPE_MPEGTS ? t.mpegTsObj.seek(e) : t.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && (t.hlsObj.onSamples = null, t.hlsObj.seek(e));
+ var i, n = (i = 0, i = t.configFormat.accurateSeek ? e : t._getBoxBufSeekIDR(), parseInt(i)),
+ r = parseInt(t._getBoxBufSeekIDR()) || 0;
+ t._avFeedMP4Data(r, n)
+ }), {
+ seekTime: i,
+ mode: t.playMode,
+ accurateSeek: t.configFormat.accurateSeek
+ })
+ })), !0
+ }
+ }, {
+ key: "fullScreen",
+ value: function() {
+ if (this.autoScreenClose = !0, this.player.vCodecID, this.player, this.player.vCodecID === v.V_CODEC_NAME_HEVC) {
+ var e = document.querySelector("#" + this.configFormat.playerId),
+ t = e.getElementsByTagName("canvas")[0];
+ e.style.width = this.screenW + "px", e.style.height = this.screenH + "px";
+ var i = this._checkScreenDisplaySize(this.screenW, this.screenH, this.playParam.size.width, this.playParam.size.height);
+ t.style.marginTop = i[0] + "px", t.style.marginLeft = i[1] + "px", t.style.width = i[2] + "px", t.style.height = i[3] + "px", this._requestFullScreen(e)
+ } else this._requestFullScreen(this.player.videoTag)
+ }
+ }, {
+ key: "closeFullScreen",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
+ if (!1 === e && (this.autoScreenClose = !1, this._exitFull()), this.player.vCodecID === v.V_CODEC_NAME_HEVC) {
+ var t = document.querySelector("#" + this.configFormat.playerId),
+ i = t.getElementsByTagName("canvas")[0];
+ t.style.width = this.configFormat.playerW + "px", t.style.height = this.configFormat.playerH + "px";
+ var n = this._checkScreenDisplaySize(this.configFormat.playerW, this.configFormat.playerH, this.playParam.size.width, this.playParam.size.height);
+ i.style.marginTop = n[0] + "px", i.style.marginLeft = n[1] + "px", i.style.width = n[2] + "px", i.style.height = n[3] + "px"
+ }
+ }
+ }, {
+ key: "playNextFrame",
+ value: function() {
+ return this.pause(), void 0 !== this.playParam && null !== this.playParam && (0 === this.playParam.videoCodec ? this.player.playYUV() : this.player.nativeNextFrame(), !0)
+ }
+ }, {
+ key: "resize",
+ value: function(e, t) {
+ if (void 0 !== this.player && null !== this.player) {
+ if (!(e && t && this.playParam.size.width && this.playParam.size.height)) return !1;
+ var i = this.playParam.size.width,
+ n = this.playParam.size.height,
+ r = 0 === this.playParam.videoCodec,
+ a = document.querySelector("#" + this.configFormat.playerId);
+ if (a.style.width = e + "px", a.style.height = t + "px", !0 === r) {
+ var s = a.getElementsByTagName("canvas")[0],
+ o = function(e, t) {
+ var r = i / e > n / t,
+ a = (e / i).toFixed(2),
+ s = (t / n).toFixed(2),
+ o = r ? a : s,
+ u = parseInt(i * o, 10),
+ l = parseInt(n * o, 10);
+ return [parseInt((t - l) / 2, 10), parseInt((e - u) / 2, 10), u, l]
+ }(e, t);
+ s.style.marginTop = o[0] + "px", s.style.marginLeft = o[1] + "px", s.style.width = o[2] + "px", s.style.height = o[3] + "px"
+ } else {
+ var u = a.getElementsByTagName("video")[0];
+ u.style.width = e + "px", u.style.height = t + "px"
+ }
+ return !0
+ }
+ return !1
+ }
+ }, {
+ key: "_checkScreenDisplaySize",
+ value: function(e, t, i, n) {
+ var r = i / e > n / t,
+ a = (e / i).toFixed(2),
+ s = (t / n).toFixed(2),
+ o = r ? a : s,
+ u = this.fixed ? e : parseInt(i * o),
+ l = this.fixed ? t : parseInt(n * o);
+ return [parseInt((t - l) / 2), parseInt((e - u) / 2), u, l]
+ }
+ }, {
+ key: "_isFullScreen",
+ value: function() {
+ var e = document.fullscreenElement || document.mozFullscreenElement || document.webkitFullscreenElement;
+ return document.fullscreenEnabled || document.mozFullscreenEnabled || document.webkitFullscreenEnabled, null != e
+ }
+ }, {
+ key: "_requestFullScreen",
+ value: function(e) {
+ e.requestFullscreen ? e.requestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.msRequestFullscreen ? e.msRequestFullscreen() : e.webkitRequestFullscreen && e.webkitRequestFullScreen()
+ }
+ }, {
+ key: "_exitFull",
+ value: function() {
+ document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen()
+ }
+ }, {
+ key: "_durationText",
+ value: function(e) {
+ if (e < 0) return "Play";
+ var t = Math.round(e);
+ return Math.floor(t / 3600) + ":" + Math.floor(t % 3600 / 60) + ":" + Math.floor(t % 60)
+ }
+ }, {
+ key: "_getSeekTarget",
+ value: function() {
+ return this.configFormat.accurateSeek ? this.seekTarget : this._getBoxBufSeekIDR()
+ }
+ }, {
+ key: "_getBoxBufSeekIDR",
+ value: function() {
+ return this.configFormat.type == v.PLAYER_IN_TYPE_MP4 ? this.mp4Obj.seekPos : this.configFormat.type == v.PLAYER_IN_TYPE_TS || this.configFormat.type == v.PLAYER_IN_TYPE_MPEGTS ? this.mpegTsObj.seekPos : this.configFormat.type == v.PLAYER_IN_TYPE_M3U8 ? this.hlsObj.seekPos : void 0
+ }
+ }, {
+ key: "_playControl",
+ value: function() {
+ this.isPlaying() ? this.pause() : this.play()
+ }
+ }, {
+ key: "_avFeedMP4Data",
+ value: function() {
+ var e = this,
+ t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
+ i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
+ n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
+ if (void 0 === this.player || null === this.player) return !1;
+ var r = parseInt(this.playParam.durationMs / 1e3);
+ this.player.clearAllCache(), this.timerFeed = window.setInterval((function() {
+ var a = null,
+ s = null,
+ o = !0,
+ u = !0;
+ if (e.configFormat.type == v.PLAYER_IN_TYPE_MP4 ? (a = e.mp4Obj.popBuffer(1, t), s = e.mp4Obj.audioNone ? null : e.mp4Obj.popBuffer(2, i)) : e.configFormat.type == v.PLAYER_IN_TYPE_TS || e.configFormat.type == v.PLAYER_IN_TYPE_MPEGTS ? (a = e.mpegTsObj.popBuffer(1, t), s = e.mpegTsObj.getAudioNone() ? null : e.mpegTsObj.popBuffer(2, i)) : e.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && (a = e.hlsObj.popBuffer(1, t), s = e.hlsObj.audioNone ? null : e.hlsObj.popBuffer(2, i), t < r - 1 && t >= e.hlsObj.getLastIdx() && (o = !1), i < r - 1 && i >= e.hlsObj.getALastIdx() && (u = !1)), !0 === o && null != a)
+ for (var l = 0; l < a.length; l++) e.player.appendHevcFrame(a[l]);
+ if (!0 === u && null != s)
+ for (var h = 0; h < s.length; h++) e.player.appendAACFrame(s[h]);
+ if (e.playMode !== v.PLAYER_MODE_NOTIME_LIVE && e.configFormat.type !== v.PLAYER_IN_TYPE_M3U8 && e.onCacheProcess && e.onCacheProcess(e.player.getCachePTS()), !0 === o && null != a && (a.length, e.configFormat.extInfo.readyShow && (e.configFormat.type === v.PLAYER_IN_TYPE_M3U8 ? e.configFormat.extInfo.readyShow = !1 : e.configFormat.extInfo.core === v.PLAYER_CORE_TYPE_CNATIVE || (e.player.cacheYuvBuf.getState(), CACHE_APPEND_STATUS_CODE.NULL, !0 === e.player.playYUV(!0, !0) && (e.configFormat.extInfo.readyShow = !1, e.onReadyShowDone && e.onReadyShowDone()))), t++), !0 === u && null != s && i++, t > r) return window.clearInterval(e.timerFeed), e.timerFeed = null, e.player.vCachePTS, e.player.aCachePTS, void(null != n && n())
+ }), 5)
+ }
+ }, {
+ key: "_isSupportWASM",
+ value: function() {
+ window.document;
+ var e = window.navigator,
+ t = e.userAgent.toLowerCase(),
+ i = "ipad" == t.match(/ipad/i),
+ r = "iphone os" == t.match(/iphone os/i),
+ a = "iPad" == t.match(/iPad/i),
+ s = "iPhone os" == t.match(/iPhone os/i),
+ o = "midp" == t.match(/midp/i),
+ u = "rv:1.2.3.4" == t.match(/rv:1.2.3.4/i),
+ l = "ucweb" == t.match(/ucweb/i),
+ h = "android" == t.match(/android/i),
+ d = "Android" == t.match(/Android/i),
+ c = "windows ce" == t.match(/windows ce/i),
+ f = "windows mobile" == t.match(/windows mobile/i);
+ if (i || r || a || s || o || u || l || h || d || c || f) return !1;
+ var m = function() {
+ try {
+ if ("object" === ("undefined" == typeof WebAssembly ? "undefined" : n(WebAssembly)) && "function" == typeof WebAssembly.instantiate) {
+ var e = new WebAssembly.Module(Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0));
+ if (e instanceof WebAssembly.Module) return new WebAssembly.Instance(e) instanceof WebAssembly.Instance
+ }
+ } catch (e) {}
+ return !1
+ }();
+ if (!1 === m) return !1;
+ if (!0 === m) {
+ var _ = p.BrowserJudge(),
+ g = _[0],
+ v = _[1];
+ if ("Chrome" === g && v < 85) return !1;
+ if (g.indexOf("360") >= 0) return !1;
+ if (/Safari/.test(e.userAgent) && !/Chrome/.test(e.userAgent) && v > 13) return !1
+ }
+ return !0
+ }
+ }, {
+ key: "_makeMP4Player",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
+ t = this;
+ if (this._isSupportWASM(), !1 === this._isSupportWASM() || !0 === e) {
+ if (this.configFormat.type == v.PLAYER_IN_TYPE_MP4) t.mediaExtFormat === v.PLAYER_IN_TYPE_FLV ? this._flvJsPlayer(this.playParam.durationMs, t.playParam.audioNone) : this._makeNativePlayer();
+ else if (this.configFormat.type == v.PLAYER_IN_TYPE_TS || this.configFormat.type == v.PLAYER_IN_TYPE_MPEGTS) this._mpegTsNv3rdPlayer(-1, !1);
+ else if (this.configFormat.type == v.PLAYER_IN_TYPE_M3U8) this._videoJsPlayer();
+ else if (this.configFormat.type === v.PLAYER_IN_TYPE_RAW_265) return -1;
+ return 1
+ }
+ return this.mediaExtProtocol === v.URI_PROTOCOL_WEBSOCKET_DESC ? (this.configFormat.type, this.configFormat.type === v.PLAYER_IN_TYPE_RAW_265 ? this._raw265Entry() : this._cWsFLVDecoderEntry(), 0) : (null != this.configFormat.extInfo.core && null !== this.configFormat.extInfo.core && this.configFormat.extInfo.core === v.PLAYER_CORE_TYPE_CNATIVE ? this._cDemuxDecoderEntry() : this.configFormat.type == v.PLAYER_IN_TYPE_MP4 ? this.configFormat.extInfo.moovStartFlag ? this._mp4EntryVodStream() : this._mp4Entry() : this.configFormat.type == v.PLAYER_IN_TYPE_TS || this.configFormat.type == v.PLAYER_IN_TYPE_MPEGTS ? this._mpegTsEntry() : this.configFormat.type == v.PLAYER_IN_TYPE_M3U8 ? this._m3u8Entry() : this.configFormat.type === v.PLAYER_IN_TYPE_RAW_265 && this._raw265Entry(), 0)
+ }
+ }, {
+ key: "_makeMP4PlayerViewEvent",
+ value: function(e, t, i, n) {
+ var r = this,
+ s = arguments.length > 4 && void 0 !== arguments[4] && arguments[4],
+ o = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null,
+ u = this;
+ if (this.playParam.durationMs = e, this.playParam.fps = t, this.playParam.sampleRate = i, this.playParam.size = n, this.playParam.audioNone = s, this.playParam.videoCodec = o || v.CODEC_H265, this.playParam, (this.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && this.hlsConf.hlsType == v.PLAYER_IN_TYPE_M3U8_LIVE || this.configFormat.type == v.PLAYER_IN_TYPE_RAW_265) && (this.playMode = v.PLAYER_MODE_NOTIME_LIVE), u.configFormat.extInfo.autoCrop) {
+ var l = document.querySelector("#" + this.configFormat.playerId),
+ h = n.width / n.height,
+ d = this.configFormat.playerW / this.configFormat.playerH;
+ h > d ? l.style.height = this.configFormat.playerW / h + "px" : h < d && (l.style.width = this.configFormat.playerH * h + "px")
+ }
+ this.player = a({
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ sampleRate: i,
+ fps: t,
+ appendHevcType: v.APPEND_TYPE_FRAME,
+ fixed: !1,
+ playerId: this.configFormat.playerId,
+ audioNone: s,
+ token: this.configFormat.token,
+ videoCodec: o
+ }), this.player.onPlayingTime = function(t) {
+ u._durationText(t), u._durationText(e / 1e3), null != u.onPlayTime && u.onPlayTime(t)
+ }, this.player.onPlayingFinish = function() {
+ r.pause(), r.seek(0), null != r.onPlayFinish && r.onPlayFinish()
+ }, this.player.onSeekFinish = function() {
+ null != u.onSeekFinish && u.onSeekFinish()
+ }, this.player.onRender = function(e, t, i, n, r) {
+ u.snapshotYuvLastFrame.luma = null, u.snapshotYuvLastFrame.chromaB = null, u.snapshotYuvLastFrame.chromaR = null, u.snapshotYuvLastFrame.width = e, u.snapshotYuvLastFrame.height = t, u.snapshotYuvLastFrame.luma = new Uint8Array(i), u.snapshotYuvLastFrame.chromaB = new Uint8Array(n), u.snapshotYuvLastFrame.chromaR = new Uint8Array(r), null != u.onRender && u.onRender(e, t, i, n, r)
+ }, this.player.onLoadCache = function() {
+ null != r.onLoadCache && r.onLoadCache()
+ }, this.player.onLoadCacheFinshed = function() {
+ null != r.onLoadCacheFinshed && r.onLoadCacheFinshed()
+ }, u.player.setDurationMs(e), u.player.setFrameRate(t), null != u.onLoadFinish && (u.onLoadFinish(), u.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && u.onReadyShowDone && u.onReadyShowDone())
+ }
+ }, {
+ key: "_makeNativePlayer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
+ t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,
+ i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0,
+ n = arguments.length > 3 ? arguments[3] : void 0,
+ r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0,
+ a = arguments.length > 5 ? arguments[5] : void 0,
+ o = this;
+ this.playParam.durationMs = e, this.playParam.fps = t, this.playParam.sampleRate = i, this.playParam.size = n, this.playParam.audioNone = r, this.playParam.videoCodec = a || v.CODEC_H264, this.configFormat.type == v.PLAYER_IN_TYPE_M3U8 && this.hlsConf.hlsType == v.PLAYER_IN_TYPE_M3U8_LIVE && (this.playMode = v.PLAYER_MODE_NOTIME_LIVE), this.player = new s.Mp4Player({
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ sampleRate: i,
+ fps: t,
+ appendHevcType: v.APPEND_TYPE_FRAME,
+ fixed: !1,
+ playerId: this.configFormat.playerId,
+ audioNone: r,
+ token: this.configFormat.token,
+ videoCodec: a,
+ autoPlay: this.configFormat.extInfo.autoPlay
+ });
+ var u = 0,
+ l = window.setInterval((function() {
+ u++, void 0 !== o.player && null !== o.player || (window.clearInterval(l), l = null), u > v.DEFAULT_PLAYERE_LOAD_TIMEOUT && (o.player.release(), o.player = null, o._cDemuxDecoderEntry(0, !0), window.clearInterval(l), l = null)
+ }), 1e3);
+ this.player.makeIt(this.videoURL), this.player.onPlayingTime = function(t) {
+ o._durationText(t), o._durationText(e / 1e3), null != o.onPlayTime && o.onPlayTime(t)
+ }, this.player.onPlayingFinish = function() {
+ null != o.onPlayFinish && o.onPlayFinish()
+ }, this.player.onLoadFinish = function() {
+ window.clearInterval(l), l = null, o.playParam.durationMs = 1e3 * o.player.duration, o.playParam.size = o.player.getSize(), o.onLoadFinish && o.onLoadFinish(), o.onReadyShowDone && o.onReadyShowDone()
+ }, this.player.onPlayState = function(e) {
+ o.onPlayState && o.onPlayState(e)
+ }, this.player.onCacheProcess = function(e) {
+ o.onCacheProcess && o.onCacheProcess(e)
+ }
+ }
+ }, {
+ key: "_initMp4BoxObject",
+ value: function() {
+ var e = this;
+ this.timerFeed = null, this.mp4Obj = new m, this.mp4Obj.onMp4BoxReady = function(t) {
+ var i = e.mp4Obj.getFPS(),
+ n = T(i, e.mp4Obj.getDurationMs()),
+ r = e.mp4Obj.getSampleRate(),
+ a = e.mp4Obj.getSize(),
+ s = e.mp4Obj.getVideoCoder();
+ t === v.CODEC_H265 ? (e._makeMP4PlayerViewEvent(n, i, r, a, e.mp4Obj.audioNone, s), parseInt(n / 1e3), e._avFeedMP4Data(0, 0)) : e._makeNativePlayer(n, i, r, a, e.mp4Obj.audioNone, s)
+ }
+ }
+ }, {
+ key: "_mp4Entry",
+ value: function() {
+ var e = this,
+ t = this;
+ fetch(this.videoURL).then((function(e) {
+ return e.arrayBuffer()
+ })).then((function(i) {
+ t._initMp4BoxObject(), e.mp4Obj.demux(), e.mp4Obj.appendBufferData(i, 0), e.mp4Obj.finishBuffer(), e.mp4Obj.seek(-1)
+ }))
+ }
+ }, {
+ key: "_mp4EntryVodStream",
+ value: function() {
+ var e = this,
+ t = this;
+ this.timerFeed = null, this.mp4Obj = new m, this._initMp4BoxObject(), this.mp4Obj.demux();
+ var i = 0,
+ n = !1,
+ r = window.setInterval((function() {
+ n || (n = !0, fetch(e.videoURL).then((function(e) {
+ return function e(n) {
+ return n.read().then((function(a) {
+ if (a.done) return t.mp4Obj.finishBuffer(), t.mp4Obj.seek(-1), void window.clearInterval(r);
+ var s = a.value;
+ return t.mp4Obj.appendBufferData(s.buffer, i), i += s.byteLength, e(n)
+ }))
+ }(e.body.getReader())
+ })).catch((function(e) {})))
+ }), 1)
+ }
+ }, {
+ key: "_cDemuxDecoderEntry",
+ value: function() {
+ var e = this,
+ t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
+ i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
+ this.configFormat.type;
+ var n = this,
+ r = !1,
+ a = new AbortController,
+ s = a.signal,
+ u = {
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ playerId: this.configFormat.playerId,
+ token: this.configFormat.token,
+ readyShow: this.configFormat.extInfo.readyShow,
+ checkProbe: this.configFormat.extInfo.checkProbe,
+ ignoreAudio: this.configFormat.extInfo.ignoreAudio,
+ playMode: this.playMode,
+ autoPlay: this.configFormat.extInfo.autoPlay,
+ defaultFps: this.configFormat.extInfo.rawFps,
+ cacheLength: this.configFormat.extInfo.cacheLength
+ };
+ this.player = new o.CNativeCore(u), window.g_players[this.player.corePtr] = this.player, this.player.onReadyShowDone = function() {
+ n.configFormat.extInfo.readyShow = !1, n.onReadyShowDone && n.onReadyShowDone()
+ }, this.player.onRelease = function() {
+ a.abort()
+ }, this.player.onProbeFinish = function() {
+ r = !0, n.player.config, n.player.audioNone, n.playParam.fps = n.player.config.fps, n.playParam.durationMs = T(n.playParam.fps, 1e3 * n.player.duration), n.player.duration < 0 && (n.playMode = v.PLAYER_MODE_NOTIME_LIVE, n.playParam.durationMs = -1), n.playParam.sampleRate = n.player.config.sampleRate, n.playParam.size = {
+ width: n.player.width,
+ height: n.player.height
+ }, n.playParam.audioNone = n.player.audioNone, n.player.vCodecID === v.V_CODEC_NAME_HEVC ? (n.playParam.videoCodec = v.CODEC_H265, n.playParam.audioIdx < 0 && (n.playParam.audioNone = !0), !0 !== p.IsSupport265Mse() || !1 !== i || n.mediaExtFormat !== v.PLAYER_IN_TYPE_MP4 && n.mediaExtFormat !== v.PLAYER_IN_TYPE_FLV ? n.onLoadFinish && n.onLoadFinish() : (a.abort(), n.player.release(), n.mediaExtFormat, v.PLAYER_IN_TYPE_MP4, n.player = null, n.mediaExtFormat === v.PLAYER_IN_TYPE_MP4 ? n._makeNativePlayer(n.playParam.durationMs, n.playParam.fps, n.playParam.sampleRate, n.playParam.size, !1, n.playParam.videoCodec) : n.mediaExtFormat === v.PLAYER_IN_TYPE_FLV && n._flvJsPlayer(n.playParam.durationMs, n.playParam.audioNone))) : (n.playParam.videoCodec = v.CODEC_H264, a.abort(), n.player.release(), n.player = null, n.mediaExtFormat === v.PLAYER_IN_TYPE_MP4 ? n._makeNativePlayer(n.playParam.durationMs, n.playParam.fps, n.playParam.sampleRate, n.playParam.size, !1, n.playParam.videoCodec) : n.mediaExtFormat === v.PLAYER_IN_TYPE_FLV ? n._flvJsPlayer(n.playParam.durationMs, n.playParam.audioNone) : n.onLoadFinish && n.onLoadFinish())
+ }, this.player.onPlayingTime = function(e) {
+ n._durationText(e), n._durationText(n.player.duration), null != n.onPlayTime && n.onPlayTime(e)
+ }, this.player.onPlayingFinish = function() {
+ n.pause(), null != n.onPlayTime && n.onPlayTime(0), n.onPlayFinish && n.onPlayFinish(), n.player.reFull = !0, n.seek(0)
+ }, this.player.onCacheProcess = function(t) {
+ e.onCacheProcess && e.onCacheProcess(t)
+ }, this.player.onLoadCache = function() {
+ null != e.onLoadCache && e.onLoadCache()
+ }, this.player.onLoadCacheFinshed = function() {
+ null != e.onLoadCacheFinshed && e.onLoadCacheFinshed()
+ }, this.player.onRender = function(e, t, i, r, a) {
+ n.snapshotYuvLastFrame.luma = null, n.snapshotYuvLastFrame.chromaB = null, n.snapshotYuvLastFrame.chromaR = null, n.snapshotYuvLastFrame.width = e, n.snapshotYuvLastFrame.height = t, n.snapshotYuvLastFrame.luma = new Uint8Array(i), n.snapshotYuvLastFrame.chromaB = new Uint8Array(r), n.snapshotYuvLastFrame.chromaR = new Uint8Array(a), null != n.onRender && n.onRender(e, t, i, r, a)
+ }, this.player.onSeekFinish = function() {
+ null != e.onSeekFinish && e.onSeekFinish()
+ };
+ var l = !1,
+ h = 0,
+ d = function e(i) {
+ setTimeout((function() {
+ if (!1 === l) {
+ if (a.abort(), a = null, s = null, i >= v.FETCH_FIRST_MAX_TIMES) return;
+ a = new AbortController, s = a.signal, e(i + 1)
+ }
+ }), v.FETCH_HTTP_FLV_TIMEOUT_MS), fetch(n.videoURL, {
+ signal: s
+ }).then((function(e) {
+ if (e.headers.get("Content-Length"), !e.ok) return console.error("error cdemuxdecoder prepare request media failed with http code:", e.status), !1;
+ if (l = !0, e.headers.has("Content-Length")) h = e.headers.get("Content-Length"), n.configFormat.extInfo.coreProbePart <= 0 ? n.player && n.player.setProbeSize(n.configFormat.extInfo.probeSize) : n.player && n.player.setProbeSize(h * n.configFormat.extInfo.coreProbePart);
+ else {
+ if (n.mediaExtFormat === v.PLAYER_IN_TYPE_FLV) return a.abort(), n.player.release(), n.player = null, n._cLiveFLVDecoderEntry(u), !0;
+ n.player && n.player.setProbeSize(40960)
+ }
+ return e.headers.get("Content-Length"), n.configFormat.type, n.mediaExtFormat,
+ function e(i) {
+ return i.read().then((function(a) {
+ if (a.done) return !0 === r || (n.player.release(), n.player = null, t < v.PLAYER_CNATIVE_VOD_RETRY_MAX ? (t += 1, n._cDemuxDecoderEntry(t), !0) : (n._mp4EntryVodStream(), !1));
+ a.value.buffer;
+ var s = new Uint8Array(a.value.buffer);
+ return n.player && n.player.pushBuffer(s) < 0 ? (n.player.release(), n.player = null, t < v.PLAYER_CNATIVE_VOD_RETRY_MAX ? (t += 1, n._cDemuxDecoderEntry(t), !0) : (n._mp4EntryVodStream(), !1)) : e(i)
+ }))
+ }(e.body.getReader())
+ })).catch((function(e) {
+ e.toString().includes("user aborted") || console.error("cdemuxdecoder error", e)
+ }))
+ };
+ d(0)
+ }
+ }, {
+ key: "_cLiveG711DecoderEntry",
+ value: function(e) {
+ var t = this,
+ i = this;
+ e.probeSize = this.configFormat.extInfo.probeSize, this.player = new l.CHttpG711Core(e), window.g_players[this.player.corePtr] = this.player, this.player.onProbeFinish = function() {
+ i.playParam.fps = i.player.mediaInfo.fps, i.playParam.durationMs = -1, i.playMode = v.PLAYER_MODE_NOTIME_LIVE, i.playParam.sampleRate = i.player.mediaInfo.sampleRate, i.playParam.size = {
+ width: i.player.mediaInfo.width,
+ height: i.player.mediaInfo.height
+ }, i.playParam.audioNone = i.player.mediaInfo.audioNone, i.player.mediaInfo, i.player.vCodecID === v.V_CODEC_NAME_HEVC ? (i.playParam.audioIdx < 0 && (i.playParam.audioNone = !0), i.playParam.videoCodec = v.CODEC_H265, i.onLoadFinish && i.onLoadFinish()) : (i.playParam.videoCodec = v.CODEC_H264, i.player.release(), i.player = null, i._flvJsPlayer(i.playParam.durationMs, i.playParam.audioNone))
+ }, this.player.onError = function(e) {
+ i.onError && i.onError(e)
+ }, this.player.onReadyShowDone = function() {
+ i.configFormat.extInfo.readyShow = !1, i.onReadyShowDone && i.onReadyShowDone()
+ }, this.player.onLoadCache = function() {
+ null != t.onLoadCache && t.onLoadCache()
+ }, this.player.onLoadCacheFinshed = function() {
+ null != t.onLoadCacheFinshed && t.onLoadCacheFinshed()
+ }, this.player.onRender = function(e, t, n, r, a) {
+ i.snapshotYuvLastFrame.luma = null, i.snapshotYuvLastFrame.chromaB = null, i.snapshotYuvLastFrame.chromaR = null, i.snapshotYuvLastFrame.width = e, i.snapshotYuvLastFrame.height = t, i.snapshotYuvLastFrame.luma = new Uint8Array(n), i.snapshotYuvLastFrame.chromaB = new Uint8Array(r), i.snapshotYuvLastFrame.chromaR = new Uint8Array(a), null != i.onRender && i.onRender(e, t, n, r, a)
+ }, this.player.onPlayState = function(e) {
+ i.onPlayState && i.onPlayState(e)
+ }, this.player.start(this.videoURL)
+ }
+ }, {
+ key: "_cLiveFLVDecoderEntry",
+ value: function(e) {
+ var t = this,
+ i = this;
+ e.probeSize = this.configFormat.extInfo.probeSize, this.player = new u.CHttpLiveCore(e), window.g_players[this.player.corePtr] = this.player, this.player.onProbeFinish = function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
+ if (1 === t) return i.player.release(), i.player = null, void i._cLiveG711DecoderEntry(e);
+ if (i.playParam.fps = i.player.mediaInfo.fps, i.playParam.durationMs = -1, i.playMode = v.PLAYER_MODE_NOTIME_LIVE, i.playParam.sampleRate = i.player.mediaInfo.sampleRate, i.playParam.size = {
+ width: i.player.mediaInfo.width,
+ height: i.player.mediaInfo.height
+ }, i.playParam.audioNone = i.player.mediaInfo.audioNone, i.player.mediaInfo, i.player.vCodecID === v.V_CODEC_NAME_HEVC) i.playParam.videoCodec = v.CODEC_H265, i.playParam.audioIdx < 0 && (i.playParam.audioNone = !0), !0 === p.IsSupport265Mse() && i.mediaExtFormat === v.PLAYER_IN_TYPE_FLV ? (i.player.release(), i.player = null, i.mediaExtFormat === v.PLAYER_IN_TYPE_FLV && i._flvJsPlayer(i.playParam.durationMs, i.playParam.audioNone)) : i.onLoadFinish && i.onLoadFinish();
+ else if (i.playParam.videoCodec = v.CODEC_H264, i.player.release(), i.player = null, i.mediaExtFormat === v.PLAYER_IN_TYPE_FLV) i._flvJsPlayer(i.playParam.durationMs, i.playParam.audioNone);
+ else {
+ if (i.mediaExtFormat !== v.PLAYER_IN_TYPE_TS && i.mediaExtFormat !== v.PLAYER_IN_TYPE_MPEGTS) return -1;
+ i._mpegTsNv3rdPlayer(i.playParam.durationMs, i.playParam.audioNone)
+ }
+ }, this.player.onError = function(e) {
+ i.onError && i.onError(e)
+ }, this.player.onReadyShowDone = function() {
+ i.configFormat.extInfo.readyShow = !1, i.onReadyShowDone && i.onReadyShowDone()
+ }, this.player.onLoadCache = function() {
+ null != t.onLoadCache && t.onLoadCache()
+ }, this.player.onLoadCacheFinshed = function() {
+ null != t.onLoadCacheFinshed && t.onLoadCacheFinshed()
+ }, this.player.onRender = function(e, t, n, r, a) {
+ i.snapshotYuvLastFrame.luma = null, i.snapshotYuvLastFrame.chromaB = null, i.snapshotYuvLastFrame.chromaR = null, i.snapshotYuvLastFrame.width = e, i.snapshotYuvLastFrame.height = t, i.snapshotYuvLastFrame.luma = new Uint8Array(n), i.snapshotYuvLastFrame.chromaB = new Uint8Array(r), i.snapshotYuvLastFrame.chromaR = new Uint8Array(a), null != i.onRender && i.onRender(e, t, n, r, a)
+ }, this.player.onPlayState = function(e) {
+ i.onPlayState && i.onPlayState(e)
+ }, this.player.start(this.videoURL)
+ }
+ }, {
+ key: "_cWsFLVDecoderEntry",
+ value: function() {
+ var e = this,
+ t = this,
+ i = {
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ playerId: this.configFormat.playerId,
+ token: this.configFormat.token,
+ readyShow: this.configFormat.extInfo.readyShow,
+ checkProbe: this.configFormat.extInfo.checkProbe,
+ ignoreAudio: this.configFormat.extInfo.ignoreAudio,
+ playMode: this.playMode,
+ autoPlay: this.configFormat.extInfo.autoPlay
+ };
+ i.probeSize = this.configFormat.extInfo.probeSize, this.player = new h.CWsLiveCore(i), i.probeSize, window.g_players[this.player.corePtr] = this.player, this.player.onProbeFinish = function() {
+ t.playParam.fps = t.player.mediaInfo.fps, t.playParam.durationMs = -1, t.playMode = v.PLAYER_MODE_NOTIME_LIVE, t.playParam.sampleRate = t.player.mediaInfo.sampleRate, t.playParam.size = {
+ width: t.player.mediaInfo.width,
+ height: t.player.mediaInfo.height
+ }, t.playParam.audioNone = t.player.mediaInfo.audioNone, t.player.mediaInfo, t.player.vCodecID === v.V_CODEC_NAME_HEVC ? (t.playParam.audioIdx < 0 && (t.playParam.audioNone = !0), t.playParam.videoCodec = v.CODEC_H265, !0 === p.IsSupport265Mse() && t.mediaExtFormat === v.PLAYER_IN_TYPE_FLV ? (t.player.release(), t.player = null, t._flvJsPlayer(t.playParam.durationMs, t.playParam.audioNone)) : t.onLoadFinish && t.onLoadFinish()) : (t.playParam.videoCodec = v.CODEC_H264, t.player.release(), t.player = null, t._flvJsPlayer(t.playParam.durationMs, t.playParam.audioNone))
+ }, this.player.onError = function(e) {
+ t.onError && t.onError(e)
+ }, this.player.onReadyShowDone = function() {
+ t.configFormat.extInfo.readyShow = !1, t.onReadyShowDone && t.onReadyShowDone()
+ }, this.player.onLoadCache = function() {
+ null != e.onLoadCache && e.onLoadCache()
+ }, this.player.onLoadCacheFinshed = function() {
+ null != e.onLoadCacheFinshed && e.onLoadCacheFinshed()
+ }, this.player.onRender = function(e, i, n, r, a) {
+ t.snapshotYuvLastFrame.luma = null, t.snapshotYuvLastFrame.chromaB = null, t.snapshotYuvLastFrame.chromaR = null, t.snapshotYuvLastFrame.width = e, t.snapshotYuvLastFrame.height = i, t.snapshotYuvLastFrame.luma = new Uint8Array(n), t.snapshotYuvLastFrame.chromaB = new Uint8Array(r), t.snapshotYuvLastFrame.chromaR = new Uint8Array(a), null != t.onRender && t.onRender(e, i, n, r, a)
+ }, this.player.start(this.videoURL)
+ }
+ }, {
+ key: "_mpegTsEntry",
+ value: function() {
+ var e = this,
+ t = (Module.cwrap("AVPlayerInit", "number", ["string", "string"])(this.configFormat.token, "0.0.0"), new AbortController),
+ i = t.signal;
+ this.timerFeed = null, this.mpegTsObj = new _.MpegTs, this.mpegTsObj.bindReady(e), this.mpegTsObj.onDemuxed = this._mpegTsEntryReady.bind(this), this.mpegTsObj.onReady = function() {
+ var n = null;
+ fetch(e.videoURL, {
+ signal: i
+ }).then((function(r) {
+ if (r.headers.has("Content-Length")) return function t(i) {
+ return i.read().then((function(r) {
+ if (!r.done) {
+ var a = r.value;
+ if (null === n) n = a;
+ else {
+ var s = a,
+ o = n.length + s.length,
+ u = new Uint8Array(o);
+ u.set(n), u.set(s, n.length), n = new Uint8Array(u), s = null, u = null
+ }
+ return t(i)
+ }
+ e.mpegTsObj.demux(n)
+ }))
+ }(r.body.getReader());
+ t.abort(), i = null, t = null;
+ var a = {
+ width: e.configFormat.playerW,
+ height: e.configFormat.playerH,
+ playerId: e.configFormat.playerId,
+ token: e.configFormat.token,
+ readyShow: e.configFormat.extInfo.readyShow,
+ checkProbe: e.configFormat.extInfo.checkProbe,
+ ignoreAudio: e.configFormat.extInfo.ignoreAudio,
+ playMode: e.playMode,
+ autoPlay: e.configFormat.extInfo.autoPlay
+ };
+ e._cLiveFLVDecoderEntry(a)
+ })).catch((function(e) {
+ if (!e.toString().includes("user aborted")) {
+ var t = " mpegts request error:" + e;
+ console.error(t)
+ }
+ }))
+ }, this.mpegTsObj.initMPEG()
+ }
+ }, {
+ key: "_mpegTsEntryReady",
+ value: function(e) {
+ var t = e,
+ i = (t.mpegTsObj.getVCodec(), t.mpegTsObj.getACodec()),
+ n = t.mpegTsObj.getDurationMs(),
+ r = t.mpegTsObj.getFPS(),
+ a = t.mpegTsObj.getSampleRate(),
+ s = t.mpegTsObj.getSize(),
+ o = this.mpegTsObj.isHEVC();
+ if (!o) return this.mpegTsObj.releaseTsDemuxer(), this.mpegTsObj = null, this.playParam.durationMs = n, this.playParam.fps = r, this.playParam.sampleRate = a, this.playParam.size = s, this.playParam.audioNone = "" == i, this.playParam.videoCodec = o ? 0 : 1, this.playParam, void this._mpegTsNv3rdPlayer(this.playParam.durationMs, this.playParam.audioNone);
+ t._makeMP4PlayerViewEvent(n, r, a, s, "" == i), parseInt(n / 1e3), t._avFeedMP4Data(0, 0)
+ }
+ }, {
+ key: "_m3u8Entry",
+ value: function() {
+ var e = this,
+ t = this;
+ if (!1 === this._isSupportWASM()) return this._videoJsPlayer();
+ Module.cwrap("AVPlayerInit", "number", ["string", "string"])(this.configFormat.token, "0.0.0");
+ var i = !1,
+ n = 0;
+ this.hlsObj = new g.M3u8, this.hlsObj.bindReady(t), this.hlsObj.onFinished = function(e, r) {
+ 0 == i && (n = t.hlsObj.getDurationMs(), t.hlsConf.hlsType = r.type, i = !0)
+ }, this.hlsObj.onCacheProcess = function(t) {
+ e.playMode !== v.PLAYER_MODE_NOTIME_LIVE && e.onCacheProcess && e.onCacheProcess(t)
+ }, this.hlsObj.onDemuxed = function(e) {
+ if (null == t.player) {
+ var i = t.hlsObj.isHevcParam,
+ r = (t.hlsObj.getVCodec(), t.hlsObj.getACodec()),
+ a = t.hlsObj.getFPS(),
+ s = t.hlsObj.getSampleRate(),
+ o = t.hlsObj.getSize(),
+ u = !1;
+ if (u = t.hlsObj.getSampleChannel() <= 0 || "" === r, !i) return t.hlsObj.release(), t.hlsObj.mpegTsObj && t.hlsObj.mpegTsObj.releaseTsDemuxer(), t.hlsObj = null, t.playParam.durationMs = n, t.playParam.fps = a, t.playParam.sampleRate = s, t.playParam.size = o, t.playParam.audioNone = "" == r, t.playParam.videoCodec = i ? 0 : 1, t.playParam, void t._videoJsPlayer(n);
+ t._makeMP4PlayerViewEvent(n, a, s, o, u)
+ }
+ }, this.hlsObj.onSamples = this._hlsOnSamples.bind(this), this.hlsObj.demux(this.videoURL)
+ }
+ }, {
+ key: "_hlsOnSamples",
+ value: function(e, t) {
+ 1 == t.video ? this.player.appendHevcFrame(t) : !1 === this.hlsObj.audioNone && this.player.appendAACFrame(t)
+ }
+ }, {
+ key: "_videoJsPlayer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ t = this,
+ i = {
+ probeDurationMS: e,
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ playerId: this.configFormat.playerId,
+ ignoreAudio: this.configFormat.extInfo.ignoreAudio,
+ autoPlay: this.configFormat.extInfo.autoPlay,
+ playMode: this.playMode
+ };
+ this.player = new d.NvVideojsCore(i), this.player.onMakeItReady = function() {
+ t.onMakeItReady && t.onMakeItReady()
+ }, this.player.onLoadFinish = function() {
+ t.playParam.size = t.player.getSize(), t.playParam.videoCodec = 1, t.player.duration === 1 / 0 || t.player.duration < 0 ? (t.playParam.durationMs = -1, t.playMode = v.PLAYER_MODE_NOTIME_LIVE) : (t.playParam.durationMs = 1e3 * t.player.duration, t.playMode = v.PLAYER_MODE_VOD), t.playParam, t.player.duration, t.player.getSize(), t.onLoadFinish && t.onLoadFinish()
+ }, this.player.onReadyShowDone = function() {
+ t.onReadyShowDone && t.onReadyShowDone()
+ }, this.player.onPlayingFinish = function() {
+ t.pause(), t.seek(0), null != t.onPlayFinish && t.onPlayFinish()
+ }, this.player.onPlayingTime = function(e) {
+ t._durationText(e), t._durationText(t.player.duration), null != t.onPlayTime && t.onPlayTime(e)
+ }, this.player.onSeekFinish = function() {
+ t.onSeekFinish && t.onSeekFinish()
+ }, this.player.onPlayState = function(e) {
+ t.onPlayState && t.onPlayState(e)
+ }, this.player.onCacheProcess = function(e) {
+ t.onCacheProcess && t.onCacheProcess(e)
+ }, this.player.makeIt(this.videoURL)
+ }
+ }, {
+ key: "_flvJsPlayer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+ i = this,
+ n = {
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ playerId: this.configFormat.playerId,
+ ignoreAudio: this.configFormat.extInfo.ignoreAudio,
+ duration: e,
+ autoPlay: this.configFormat.extInfo.autoPlay,
+ audioNone: t
+ };
+ this.player = new c.NvFlvjsCore(n), this.player.onLoadFinish = function() {
+ i.playParam.size = i.player.getSize(), !i.player.duration || NaN === i.player.duration || i.player.duration === 1 / 0 || i.player.duration < 0 ? (i.playParam.durationMs = -1, i.playMode = v.PLAYER_MODE_NOTIME_LIVE) : (i.playParam.durationMs = 1e3 * i.player.duration, i.playMode = v.PLAYER_MODE_VOD), i.onLoadFinish && i.onLoadFinish()
+ }, this.player.onReadyShowDone = function() {
+ i.onReadyShowDone && i.onReadyShowDone()
+ }, this.player.onPlayingTime = function(e) {
+ i._durationText(e), i._durationText(i.player.duration), null != i.onPlayTime && i.onPlayTime(e)
+ }, this.player.onPlayingFinish = function() {
+ i.pause(), i.seek(0), null != i.onPlayFinish && i.onPlayFinish()
+ }, this.player.onPlayState = function(e) {
+ i.onPlayState && i.onPlayState(e)
+ }, this.player.onCacheProcess = function(e) {
+ i.onCacheProcess && i.onCacheProcess(e)
+ }, this.player.makeIt(this.videoURL)
+ }
+ }, {
+ key: "_mpegTsNv3rdPlayer",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : -1,
+ t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
+ i = this,
+ n = {
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH,
+ playerId: this.configFormat.playerId,
+ ignoreAudio: this.configFormat.extInfo.ignoreAudio,
+ duration: e,
+ autoPlay: this.configFormat.extInfo.autoPlay,
+ audioNone: t
+ };
+ this.player = new f.NvMpegTsCore(n), this.player.onLoadFinish = function() {
+ i.playParam.size = i.player.getSize(), !i.player.duration || NaN === i.player.duration || i.player.duration === 1 / 0 || i.player.duration < 0 ? (i.playParam.durationMs = -1, i.playMode = v.PLAYER_MODE_NOTIME_LIVE) : (i.playParam.durationMs = 1e3 * i.player.duration, i.playMode = v.PLAYER_MODE_VOD), i.onLoadFinish && i.onLoadFinish()
+ }, this.player.onReadyShowDone = function() {
+ i.onReadyShowDone && i.onReadyShowDone()
+ }, this.player.onPlayingTime = function(e) {
+ i._durationText(e), i._durationText(i.player.duration), null != i.onPlayTime && i.onPlayTime(e)
+ }, this.player.onPlayingFinish = function() {
+ i.pause(), i.seek(0), null != i.onPlayFinish && i.onPlayFinish()
+ }, this.player.onPlayState = function(e) {
+ i.onPlayState && i.onPlayState(e)
+ }, this.player.onCacheProcess = function(e) {
+ i.onCacheProcess && i.onCacheProcess(e)
+ }, this.player.makeIt(this.videoURL)
+ }
+ }, {
+ key: "_raw265Entry",
+ value: function() {
+ var e = this;
+ this.videoURL;
+ var t = function t() {
+ setTimeout((function() {
+ e.workerParse.postMessage({
+ cmd: "get-nalu",
+ data: null,
+ msg: "get-nalu"
+ }), e.workerParse.parseEmpty, e.workerFetch.onMsgFetchFinished, !0 === e.workerFetch.onMsgFetchFinished && !0 === e.workerParse.frameListEmpty && !1 === e.workerParse.streamEmpty && e.workerParse.postMessage({
+ cmd: "last-nalu",
+ data: null,
+ msg: "last-nalu"
+ }), !0 === e.workerParse.parseEmpty && (e.workerParse.stopNaluInterval = !0), !0 !== e.workerParse.stopNaluInterval && t()
+ }), 1e3)
+ };
+ this._makeMP4PlayerViewEvent(-1, this.configFormat.extInfo.rawFps, -1, {
+ width: this.configFormat.playerW,
+ height: this.configFormat.playerH
+ }, !0, v.CODEC_H265), this.timerFeed && (window.clearInterval(this.timerFeed), this.timerFeed = null), e.workerFetch = new Worker(p.GetScriptPath((function() {
+ var e = new AbortController,
+ t = e.signal,
+ i = null;
+ onmessage = function(n) {
+ var r = n.data;
+ switch (void 0 === r.cmd || null === r.cmd ? "" : r.cmd) {
+ case "start":
+ var a = r.url;
+ "http" === r.type ? fetch(a, {
+ signal: t
+ }).then((function(e) {
+ return function e(t) {
+ return t.read().then((function(i) {
+ if (!i.done) {
+ var n = i.value;
+ return postMessage({
+ cmd: "fetch-chunk",
+ data: n,
+ msg: "fetch-chunk"
+ }), e(t)
+ }
+ postMessage({
+ cmd: "fetch-fin",
+ data: null,
+ msg: "fetch-fin"
+ })
+ }))
+ }(e.body.getReader())
+ })).catch((function(e) {})) : "websocket" === r.type && function(e) {
+ (i = new WebSocket(e)).binaryType = "arraybuffer", i.onopen = function(e) {
+ i.send("Hello WebSockets!")
+ }, i.onmessage = function(e) {
+ if (e.data instanceof ArrayBuffer) {
+ var t = e.data;
+ t.byteLength > 0 && postMessage({
+ cmd: "fetch-chunk",
+ data: new Uint8Array(t),
+ msg: "fetch-chunk"
+ })
+ }
+ }, i.onclose = function(e) {
+ postMessage({
+ cmd: "fetch-fin",
+ data: null,
+ msg: "fetch-fin"
+ })
+ }
+ }(a), postMessage({
+ cmd: "default",
+ data: "WORKER STARTED",
+ msg: "default"
+ });
+ break;
+ case "stop":
+ "http" === r.type ? e.abort() : "websocket" === r.type && i && i.close(), close()
+ }
+ }
+ }))), e.workerFetch.onMsgFetchFinished = !1, e.workerFetch.onmessage = function(i) {
+ var n = i.data;
+ switch (void 0 === n.cmd || null === n.cmd ? "" : n.cmd) {
+ case "fetch-chunk":
+ var r = n.data;
+ e.workerParse.postMessage({
+ cmd: "append-chunk",
+ data: r,
+ msg: "append-chunk"
+ });
+ break;
+ case "fetch-fin":
+ e.workerFetch.onMsgFetchFinished = !0, t()
+ }
+ }, e.workerParse = new Worker(p.GetScriptPath((function() {
+ var e, t = ((e = new Object).frameList = [], e.stream = null, e.frameListEmpty = function() {
+ return e.frameList.length <= 0
+ }, e.streamEmpty = function() {
+ return null === e.stream || e.stream.length <= 0
+ }, e.checkEmpty = function() {
+ return !0 === e.streamEmpty() && !0 === e.frameListEmpty() || (e.stream, e.frameList, !1)
+ }, e.pushFrameRet = function(t) {
+ return !(!t || null == t || null == t || (e.frameList && null != e.frameList && null != e.frameList || (e.frameList = []), e.frameList.push(t), 0))
+ }, e.nextFrame = function() {
+ return !e.frameList && null == e.frameList || null == e.frameList && e.frameList.length < 1 ? null : e.frameList.shift()
+ }, e.clearFrameRet = function() {
+ e.frameList = null
+ }, e.setStreamRet = function(t) {
+ e.stream = t
+ }, e.getStreamRet = function() {
+ return e.stream
+ }, e.appendStreamRet = function(t) {
+ if (!t || void 0 === t || null == t) return !1;
+ if (!e.stream || void 0 === e.stream || null == e.stream) return e.stream = t, !0;
+ var i = e.stream.length,
+ n = t.length,
+ r = new Uint8Array(i + n);
+ r.set(e.stream, 0), r.set(t, i), e.stream = r;
+ for (var a = 0; a < 9999; a++) {
+ var s = e.nextNalu();
+ if (!1 === s || null == s) break;
+ e.frameList.push(s)
+ }
+ return !0
+ }, e.subBuf = function(t, i) {
+ var n = new Uint8Array(e.stream.subarray(t, i + 1));
+ return e.stream = new Uint8Array(e.stream.subarray(i + 1)), n
+ }, e.lastNalu = function() {
+ var t = e.subBuf(0, e.stream.length);
+ e.frameList.push(t)
+ }, e.nextNalu = function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ if (null == e.stream || e.stream.length <= 4) return !1;
+ for (var i = -1, n = 0; n < e.stream.length; n++) {
+ if (n + 5 >= e.stream.length) return !1;
+ if (0 == e.stream[n] && 0 == e.stream[n + 1] && 1 == e.stream[n + 2] || 0 == e.stream[n] && 0 == e.stream[n + 1] && 0 == e.stream[n + 2] && 1 == e.stream[n + 3]) {
+ var r = n;
+ if (n += 3, -1 == i) i = r;
+ else {
+ if (t <= 1) return e.subBuf(i, r - 1);
+ t -= 1
+ }
+ }
+ }
+ return !1
+ }, e.nextNalu2 = function() {
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ if (null == e.stream || e.stream.length <= 4) return !1;
+ for (var i = -1, n = 0; n < e.stream.length; n++) {
+ if (n + 5 >= e.stream.length) return -1 != i && e.subBuf(i, e.stream.length - 1);
+ var r = "0 0 1" == e.stream.slice(n, n + 3).join(" "),
+ a = "0 0 0 1" == e.stream.slice(n, n + 4).join(" ");
+ if (r || a) {
+ var s = n;
+ if (n += 3, -1 == i) i = s;
+ else {
+ if (t <= 1) return e.subBuf(i, s - 1);
+ t -= 1
+ }
+ }
+ }
+ return !1
+ }, e);
+ onmessage = function(e) {
+ var i = e.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "append-chunk":
+ var n = i.data;
+ t.appendStreamRet(n);
+ var r = t.nextFrame();
+ postMessage({
+ cmd: "return-nalu",
+ data: r,
+ msg: "return-nalu",
+ parseEmpty: t.checkEmpty(),
+ streamEmpty: t.streamEmpty(),
+ frameListEmpty: t.frameListEmpty()
+ });
+ break;
+ case "get-nalu":
+ var a = t.nextFrame();
+ postMessage({
+ cmd: "return-nalu",
+ data: a,
+ msg: "return-nalu",
+ parseEmpty: t.checkEmpty(),
+ streamEmpty: t.streamEmpty(),
+ frameListEmpty: t.frameListEmpty()
+ });
+ break;
+ case "last-nalu":
+ var s = t.lastNalu();
+ postMessage({
+ cmd: "return-nalu",
+ data: s,
+ msg: "return-nalu",
+ parseEmpty: t.checkEmpty(),
+ streamEmpty: t.streamEmpty(),
+ frameListEmpty: t.frameListEmpty()
+ });
+ break;
+ case "stop":
+ postMessage("parse - WORKER STOPPED: " + i), close()
+ }
+ }
+ }))), e.workerParse.stopNaluInterval = !1, e.workerParse.parseEmpty = !1, e.workerParse.streamEmpty = !1, e.workerParse.frameListEmpty = !1, e.workerParse.onmessage = function(t) {
+ var i = t.data;
+ switch (void 0 === i.cmd || null === i.cmd ? "" : i.cmd) {
+ case "return-nalu":
+ var n = i.data,
+ r = i.parseEmpty,
+ a = i.streamEmpty,
+ s = i.frameListEmpty;
+ e.workerParse.parseEmpty = r, e.workerParse.streamEmpty = a, e.workerParse.frameListEmpty = s, !1 === n || null == n ? !0 === e.workerFetch.onMsgFetchFinished && !0 === r && (e.workerParse.stopNaluInterval = !0) : (e.append265NaluFrame(n), e.workerParse.postMessage({
+ cmd: "get-nalu",
+ data: null,
+ msg: "get-nalu"
+ }))
+ }
+ }, p.ParseGetMediaURL(this.videoURL), this.workerFetch.postMessage({
+ cmd: "start",
+ url: p.ParseGetMediaURL(this.videoURL),
+ type: this.mediaExtProtocol,
+ msg: "start"
+ }),
+ function t() {
+ setTimeout((function() {
+ e.configFormat.extInfo.readyShow && (e.player.cacheYuvBuf.getState() != CACHE_APPEND_STATUS_CODE.NULL ? (e.player.playFrameYUV(!0, !0), e.configFormat.extInfo.readyShow = !1, e.onReadyShowDone && e.onReadyShowDone()) : t())
+ }), 1e3)
+ }()
+ }
+ }, {
+ key: "append265NaluFrame",
+ value: function(e) {
+ var t = {
+ data: e,
+ pts: this.rawModePts
+ };
+ this.player.appendHevcFrame(t), this.configFormat.extInfo.readyShow && this.player.cacheYuvBuf.getState() != CACHE_APPEND_STATUS_CODE.NULL && (this.player.playFrameYUV(!0, !0), this.configFormat.extInfo.readyShow = !1, this.onReadyShowDone && this.onReadyShowDone()), this.rawModePts += 1 / this.configFormat.extInfo.rawFps
+ }
+ }]) && r(i.prototype, E), w && r(i, w), e
+ }();
+ i.H265webjs = E, t.new265webjs = function(e, t) {
+ return new E(e, t)
+ }
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {
+ "./consts": 52,
+ "./decoder/av-common": 56,
+ "./decoder/c-http-g711-core": 57,
+ "./decoder/c-httplive-core": 58,
+ "./decoder/c-native-core": 59,
+ "./decoder/c-wslive-core": 60,
+ "./decoder/cache": 61,
+ "./decoder/player-core": 65,
+ "./demuxer/m3u8": 69,
+ "./demuxer/mp4": 71,
+ "./demuxer/mpegts/mpeg.js": 74,
+ "./demuxer/ts": 75,
+ "./native/mp4-player": 77,
+ "./native/nv-flvjs-core": 78,
+ "./native/nv-mpegts-core": 79,
+ "./native/nv-videojs-core": 80,
+ "./render-engine/webgl-420p": 81,
+ "./utils/static-mem": 82,
+ "./utils/ui/ui": 83
+ }],
+ 77: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("../consts"),
+ a = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.configFormat = {
+ width: t.width || r.DEFAULT_WIDTH,
+ height: t.height || r.DEFAULT_HEIGHT,
+ fps: t.fps || r.DEFAULT_FPS,
+ fixed: t.fixed || r.DEFAULT_FIXED,
+ sampleRate: t.sampleRate || r.DEFAULT_SAMPLERATE,
+ appendHevcType: t.appendHevcType || r.APPEND_TYPE_STREAM,
+ frameDurMs: t.frameDur || r.DEFAULT_FRAME_DUR,
+ playerId: t.playerId || r.DEFAILT_WEBGL_PLAY_ID,
+ audioNone: t.audioNone || !1,
+ token: t.token || null,
+ videoCodec: t.videoCodec || r.CODEC_H265,
+ autoPlay: t.autoPlay || !1
+ }, this.videoTag = null, this.isPlaying = !1, this.duration = -1, this.bufferInterval = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onPlayState = null, this.onCacheProcess = null
+ }
+ var t, i, a;
+ return t = e, (i = [{
+ key: "makeIt",
+ value: function(e) {
+ var t = this,
+ i = document.querySelector("div#" + this.configFormat.playerId);
+ this.videoTag = document.createElement("video"), !0 === this.configFormat.autoPlay && (this.videoTag.muted = "muted", this.videoTag.autoplay = "autoplay", window.onclick = document.body.onclick = function(e) {
+ t.videoTag.muted = !1, t.isPlayingState()
+ }), this.videoTag.onplay = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.videoTag.onpause = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.videoTag.ontimeupdate = function() {
+ t.onPlayingTime && t.onPlayingTime(t.videoTag.currentTime)
+ }, this.videoTag.onended = function() {
+ t.onPlayingFinish && t.onPlayingFinish()
+ }, this.videoTag.onloadedmetadata = function(e) {
+ t.duration = t.videoTag.duration, t.onLoadFinish && t.onLoadFinish(), null !== t.bufferInterval && (window.clearInterval(t.bufferInterval), t.bufferInterval = null), t.bufferInterval = window.setInterval((function() {
+ var e = t.videoTag.buffered.end(0);
+ if (e >= t.duration - .04) return t.onCacheProcess && t.onCacheProcess(t.duration), void window.clearInterval(t.bufferInterval);
+ t.onCacheProcess && t.onCacheProcess(e)
+ }), 200)
+ }, this.videoTag.src = e, this.videoTag.style.width = "100%", this.videoTag.style.height = "100%", i.appendChild(this.videoTag)
+ }
+ }, {
+ key: "setPlaybackRate",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ return !(e <= 0 || null == this.videoTag || null === this.videoTag || (this.videoTag.playbackRate = e, 0))
+ }
+ }, {
+ key: "getPlaybackRate",
+ value: function() {
+ return null == this.videoTag || null === this.videoTag ? 0 : this.videoTag.playbackRate
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return {
+ width: this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.configFormat.width,
+ height: this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.configFormat.height
+ }
+ }
+ }, {
+ key: "play",
+ value: function() {
+ this.videoTag.play()
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ this.videoTag.currentTime = e
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.videoTag.pause()
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.videoTag.volume = e
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return !this.videoTag.paused
+ }
+ }, {
+ key: "release",
+ value: function() {
+ this.videoTag && this.videoTag.remove(), this.videoTag = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onPlayState = null, null !== this.bufferInterval && (window.clearInterval(this.bufferInterval), this.bufferInterval = null), window.onclick = document.body.onclick = null
+ }
+ }, {
+ key: "nativeNextFrame",
+ value: function() {
+ void 0 !== this.videoTag && null !== this.videoTag && (this.videoTag.currentTime += 1 / this.configFormat.fps)
+ }
+ }]) && n(t.prototype, i), a && n(t, a), e
+ }();
+ i.Mp4Player = a
+ }, {
+ "../consts": 52
+ }],
+ 78: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("../consts"),
+ a = (e("../version"), e("../demuxer/flv-hevc/flv-hevc.js")),
+ s = e("../decoder/av-common"),
+ o = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.configFormat = {
+ width: t.width || r.DEFAULT_WIDTH,
+ height: t.height || r.DEFAULT_HEIGHT,
+ playerId: t.playerId || r.DEFAILT_WEBGL_PLAY_ID,
+ ignoreAudio: t.ignoreAudio,
+ duration: t.duration,
+ autoPlay: t.autoPlay || !1,
+ audioNone: t.audioNone
+ }, this.audioVoice = 1, this.myPlayerID = this.configFormat.playerId + "-flv-hevc", this.myPlayer = null, this.videoContaner = null, this.videoTag = null, this.duration = -1, this.width = -1, this.height = -1, this.isPlaying = !1, this.vCodecID = r.V_CODEC_NAME_AVC, this.audioNone = !1, this.showScreen = !1, this.playPTS = 0, this.vCachePTS = 0, this.aCachePTS = 0, this.isInitDecodeFrames = !1, this.lastDecodedFrame = 0, this.lastDecodedFrameTime = -1, this.checkStartIntervalCount = 0, this.checkStartInterval = null, this.checkPicBlockInterval = null, this.bufferInterval = null, this.onPlayState = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onReadyShowDone = null, this.onCacheProcess = null
+ }
+ var t, i, o;
+ return t = e, (i = [{
+ key: "_reBuildFlvjs",
+ value: function(e) {
+ this._releaseFlvjs(), this.makeIt(e)
+ }
+ }, {
+ key: "_checkPicBlock",
+ value: function(e) {
+ var t = this;
+ this.checkPicBlockInterval = window.setInterval((function() {
+ if (t.lastDecodedFrameTime > 0 && s.GetMsTime() - t.lastDecodedFrameTime > 1e4) return window.clearInterval(t.checkPicBlockInterval), t.checkPicBlockInterval = null, void t._reBuildFlvjs(e)
+ }), 1e3)
+ }
+ }, {
+ key: "_checkLoadState",
+ value: function(e) {
+ var t = this;
+ this.checkStartIntervalCount = 0, this.checkStartInterval = window.setInterval((function() {
+ return t.lastDecodedFrame, t.isInitDecodeFrames, t.checkStartIntervalCount, !1 !== t.isInitDecodeFrames ? (t.checkStartIntervalCount = 0, window.clearInterval(t.checkStartInterval), void(t.checkStartInterval = null)) : (t.checkStartIntervalCount += 1, t.checkStartIntervalCount > 20 ? (window.clearInterval(t.checkStartInterval), t.checkStartIntervalCount = 0, t.checkStartInterval = null, void(!1 === t.isInitDecodeFrames && t._reBuildFlvjs(e))) : void 0)
+ }), 500)
+ }
+ }, {
+ key: "makeIt",
+ value: function(e) {
+ var t = this;
+ if (a.isSupported()) {
+ var i = document.querySelector("#" + this.configFormat.playerId);
+ this.videoTag = document.createElement("video"), this.videoTag.id = this.myPlayerID, this.videoTag.style.width = this.configFormat.width + "px", this.videoTag.style.height = this.configFormat.height + "px", i.appendChild(this.videoTag), !0 === this.configFormat.autoPlay && (this.videoTag.muted = "muted", this.videoTag.autoplay = "autoplay", window.onclick = document.body.onclick = function(e) {
+ t.videoTag.muted = !1, t.isPlayingState(), window.onclick = document.body.onclick = null
+ }), this.videoTag.onplay = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.videoTag.onpause = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ };
+ var n = {
+ hasVideo: !0,
+ hasAudio: !(!0 === this.configFormat.audioNone),
+ type: "flv",
+ url: e,
+ isLive: this.configFormat.duration <= 0,
+ withCredentials: !1
+ };
+ this.myPlayer = a.createPlayer(n), this.myPlayer.attachMediaElement(this.videoTag), this.myPlayer.on(a.Events.MEDIA_INFO, (function(e) {
+ t.videoTag.videoWidth, !1 === t.isInitDecodeFrames && (t.isInitDecodeFrames = !0, t.width = Math.max(t.videoTag.videoWidth, e.width), t.height = Math.max(t.videoTag.videoHeight, e.height), t.duration = t.videoTag.duration, t.duration, t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.isPlayingState(), t.videoTag.ontimeupdate = function() {
+ t.onPlayingTime && t.onPlayingTime(t.videoTag.currentTime)
+ }, t.duration !== 1 / 0 && t.duration > 0 && (t.videoTag.onended = function() {
+ t.onPlayingFinish && t.onPlayingFinish()
+ }))
+ })), this.myPlayer.on(a.Events.STATISTICS_INFO, (function(e) {
+ t.videoTag.videoWidth, t.videoTag.videoHeight, t.videoTag.duration, !1 === t.isInitDecodeFrames && t.videoTag.videoWidth > 0 && t.videoTag.videoHeight > 0 && (t.isInitDecodeFrames = !0, t.width = t.videoTag.videoWidth, t.height = t.videoTag.videoHeight, t.duration = t.videoTag.duration, t.duration, t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.isPlayingState(), t.videoTag.ontimeupdate = function() {
+ t.onPlayingTime && t.onPlayingTime(t.videoTag.currentTime)
+ }, t.duration !== 1 / 0 && (t.videoTag.onended = function() {
+ t.onPlayingFinish && t.onPlayingFinish()
+ })), t.lastDecodedFrame = e.decodedFrames, t.lastDecodedFrameTime = s.GetMsTime()
+ })), this.myPlayer.on(a.Events.SCRIPTDATA_ARRIVED, (function(e) {})), this.myPlayer.on(a.Events.METADATA_ARRIVED, (function(e) {
+ !1 === t.isInitDecodeFrames && e.width && e.width > 0 && (t.isInitDecodeFrames = !0, t.duration = e.duration, t.width = e.width, t.height = e.height, t.duration, t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.isPlayingState(), t.videoTag.ontimeupdate = function() {
+ t.onPlayingTime && t.onPlayingTime(t.videoTag.currentTime)
+ }, t.duration !== 1 / 0 && (t.videoTag.onended = function() {
+ t.onPlayingFinish && t.onPlayingFinish()
+ }))
+ })), this.myPlayer.on(a.Events.ERROR, (function(i, n, r) {
+ t.myPlayer && t._reBuildFlvjs(e)
+ })), this.myPlayer.load(), this._checkLoadState(e), this._checkPicBlock(e)
+ } else console.error("FLV is AVC/H.264, But your brower do not support mse!")
+ }
+ }, {
+ key: "setPlaybackRate",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ return !(e <= 0 || null == this.videoTag || null === this.videoTag || (this.videoTag.playbackRate = e, 0))
+ }
+ }, {
+ key: "getPlaybackRate",
+ value: function() {
+ return null == this.videoTag || null === this.videoTag ? 0 : this.videoTag.playbackRate
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return {
+ width: this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.width,
+ height: this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.height
+ }
+ }
+ }, {
+ key: "play",
+ value: function() {
+ this.myPlayer.play()
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ this.myPlayer.currentTime = e
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.myPlayer.pause()
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.myPlayer.volume = e
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return !this.videoTag.paused
+ }
+ }, {
+ key: "_loopBufferState",
+ value: function() {
+ var e = this;
+ e.duration <= 0 && (e.duration = e.videoTag.duration), null !== e.bufferInterval && (window.clearInterval(e.bufferInterval), e.bufferInterval = null), e.bufferInterval = window.setInterval((function() {
+ if (!e.duration || e.duration < 0) window.clearInterval(e.bufferInterval);
+ else {
+ var t = e.videoTag.buffered.end(0);
+ if (t >= e.duration - .04) return e.onCacheProcess && e.onCacheProcess(e.duration), void window.clearInterval(e.bufferInterval);
+ e.onCacheProcess && e.onCacheProcess(t)
+ }
+ }), 200)
+ }
+ }, {
+ key: "_releaseFlvjs",
+ value: function() {
+ this.myPlayer, this.myPlayer.pause(), this.myPlayer.unload(), this.myPlayer.detachMediaElement(), this.myPlayer.destroy(), this.myPlayer = null, this.videoTag.remove(), this.videoTag = null, null !== this.checkStartInterval && (this.checkStartIntervalCount = 0, window.clearInterval(this.checkStartInterval), this.checkStartInterval = null), null !== this.checkPicBlockInterval && (window.clearInterval(this.checkPicBlockInterval), this.checkPicBlockInterval = null), this.isInitDecodeFrames = !1, this.lastDecodedFrame = 0, this.lastDecodedFrameTime = -1
+ }
+ }, {
+ key: "release",
+ value: function() {
+ null !== this.checkStartInterval && (this.checkStartIntervalCount = 0, window.clearInterval(this.checkStartInterval), this.checkStartInterval = null), null !== this.checkPicBlockInterval && (window.clearInterval(this.checkPicBlockInterval), this.checkPicBlockInterval = null), null !== this.bufferInterval && (window.clearInterval(this.bufferInterval), this.bufferInterval = null), this._releaseFlvjs(), this.myPlayerID = null, this.videoContaner = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onReadyShowDone = null, this.onPlayState = null, window.onclick = document.body.onclick = null
+ }
+ }]) && n(t.prototype, i), o && n(t, o), e
+ }();
+ i.NvFlvjsCore = o
+ }, {
+ "../consts": 52,
+ "../decoder/av-common": 56,
+ "../demuxer/flv-hevc/flv-hevc.js": 68,
+ "../version": 84
+ }],
+ 79: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("../consts"),
+ a = (e("../version"), e("mpegts.js")),
+ s = e("../decoder/av-common"),
+ o = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.configFormat = {
+ width: t.width || r.DEFAULT_WIDTH,
+ height: t.height || r.DEFAULT_HEIGHT,
+ playerId: t.playerId || r.DEFAILT_WEBGL_PLAY_ID,
+ ignoreAudio: t.ignoreAudio,
+ duration: t.duration,
+ autoPlay: t.autoPlay || !1,
+ audioNone: t.audioNone
+ }, this.audioVoice = 1, this.myPlayerID = this.configFormat.playerId + "-jsmpegts", this.myPlayer = null, this.videoContaner = null, this.videoTag = null, this.duration = -1, this.width = -1, this.height = -1, this.isPlaying = !1, this.vCodecID = r.V_CODEC_NAME_AVC, this.audioNone = !1, this.showScreen = !1, this.playPTS = 0, this.vCachePTS = 0, this.aCachePTS = 0, this.isInitDecodeFrames = !1, this.lastDecodedFrame = 0, this.lastDecodedFrameTime = -1, this.checkStartIntervalCount = 0, this.checkStartInterval = null, this.checkPicBlockInterval = null, this.bufferInterval = null, this.onPlayState = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onReadyShowDone = null, this.onCacheProcess = null
+ }
+ var t, i, o;
+ return t = e, (i = [{
+ key: "_reBuildMpegTsjs",
+ value: function(e) {
+ this._releaseMpegTsjs(), this.makeIt(e)
+ }
+ }, {
+ key: "_checkPicBlock",
+ value: function(e) {
+ var t = this;
+ this.checkPicBlockInterval = window.setInterval((function() {
+ if (t.lastDecodedFrameTime > 0 && s.GetMsTime() - t.lastDecodedFrameTime > 1e4) return window.clearInterval(t.checkPicBlockInterval), t.checkPicBlockInterval = null, void t._reBuildMpegTsjs(e)
+ }), 1e3)
+ }
+ }, {
+ key: "_checkLoadState",
+ value: function(e) {
+ var t = this;
+ this.checkStartIntervalCount = 0, this.checkStartInterval = window.setInterval((function() {
+ return t.lastDecodedFrame, t.isInitDecodeFrames, t.checkStartIntervalCount, !1 !== t.isInitDecodeFrames ? (t.checkStartIntervalCount = 0, window.clearInterval(t.checkStartInterval), void(t.checkStartInterval = null)) : (t.checkStartIntervalCount += 1, t.checkStartIntervalCount > 20 ? (window.clearInterval(t.checkStartInterval), t.checkStartIntervalCount = 0, t.checkStartInterval = null, void(!1 === t.isInitDecodeFrames && t._reBuildMpegTsjs(e))) : void 0)
+ }), 500)
+ }
+ }, {
+ key: "makeIt",
+ value: function(e) {
+ var t = this;
+ if (a.isSupported()) {
+ var i = document.querySelector("#" + this.configFormat.playerId);
+ this.videoTag = document.createElement("video"), this.videoTag.id = this.myPlayerID, this.videoTag.style.width = this.configFormat.width + "px", this.videoTag.style.height = this.configFormat.height + "px", i.appendChild(this.videoTag), !0 === this.configFormat.autoPlay && (this.videoTag.muted = "muted", this.videoTag.autoplay = "autoplay", window.onclick = document.body.onclick = function(e) {
+ t.videoTag.muted = !1, t.isPlayingState(), window.onclick = document.body.onclick = null
+ }), this.videoTag.onplay = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.videoTag.onpause = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ };
+ var n = {
+ hasVideo: !0,
+ hasAudio: !(!0 === this.configFormat.audioNone),
+ type: "mse",
+ url: e,
+ isLive: this.configFormat.duration <= 0,
+ withCredentials: !1
+ };
+ this.myPlayer = a.createPlayer(n), this.myPlayer.attachMediaElement(this.videoTag), this.myPlayer.on(a.Events.MEDIA_INFO, (function(e) {
+ t.videoTag.videoWidth, !1 === t.isInitDecodeFrames && (t.isInitDecodeFrames = !0, t.width = Math.max(t.videoTag.videoWidth, e.width), t.height = Math.max(t.videoTag.videoHeight, e.height), t.videoTag.duration && e.duration ? t.videoTag.duration ? t.duration = t.videoTag.duration : e.duration && (t.duration = e.duration) : t.duration = t.configFormat.duration / 1e3, t.duration, t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.isPlayingState(), t.videoTag.ontimeupdate = function() {
+ t.onPlayingTime && t.onPlayingTime(t.videoTag.currentTime)
+ }, t.duration !== 1 / 0 && t.duration > 0 && (t.videoTag.onended = function() {
+ t.onPlayingFinish && t.onPlayingFinish()
+ }))
+ })), this.myPlayer.on(a.Events.SCRIPTDATA_ARRIVED, (function(e) {})), this.myPlayer.on(a.Events.ERROR, (function(i, n, r) {
+ t.myPlayer && t._reBuildMpegTsjs(e)
+ })), this.myPlayer.load(), this._checkLoadState(e), this._checkPicBlock(e)
+ } else console.error("FLV is AVC/H.264, But your brower do not support mse!")
+ }
+ }, {
+ key: "setPlaybackRate",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ return !(e <= 0 || null == this.videoTag || null === this.videoTag || (this.videoTag.playbackRate = e, 0))
+ }
+ }, {
+ key: "getPlaybackRate",
+ value: function() {
+ return null == this.videoTag || null === this.videoTag ? 0 : this.videoTag.playbackRate
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return {
+ width: this.videoTag.videoWidth > 0 ? this.videoTag.videoWidth : this.width,
+ height: this.videoTag.videoHeight > 0 ? this.videoTag.videoHeight : this.height
+ }
+ }
+ }, {
+ key: "play",
+ value: function() {
+ this.videoTag, this.videoTag.play()
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ this.videoTag.currentTime = e
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ this.videoTag.pause()
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ this.videoTag.volume = e
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return !this.videoTag.paused
+ }
+ }, {
+ key: "_loopBufferState",
+ value: function() {
+ var e = this;
+ e.duration <= 0 && e.videoTag.duration && (e.duration = e.videoTag.duration), null !== e.bufferInterval && (window.clearInterval(e.bufferInterval), e.bufferInterval = null), e.bufferInterval = window.setInterval((function() {
+ if (e.configFormat.duration <= 0) window.clearInterval(e.bufferInterval);
+ else {
+ var t = e.videoTag.buffered.end(0);
+ if (t >= e.duration - .04) return e.onCacheProcess && e.onCacheProcess(e.duration), void window.clearInterval(e.bufferInterval);
+ e.onCacheProcess && e.onCacheProcess(t)
+ }
+ }), 200)
+ }
+ }, {
+ key: "_releaseMpegTsjs",
+ value: function() {
+ this.myPlayer, this.myPlayer.pause(), this.myPlayer.unload(), this.myPlayer.detachMediaElement(), this.myPlayer.destroy(), this.myPlayer = null, this.videoTag.remove(), this.videoTag = null, null !== this.checkStartInterval && (this.checkStartIntervalCount = 0, window.clearInterval(this.checkStartInterval), this.checkStartInterval = null), null !== this.checkPicBlockInterval && (window.clearInterval(this.checkPicBlockInterval), this.checkPicBlockInterval = null), this.isInitDecodeFrames = !1, this.lastDecodedFrame = 0, this.lastDecodedFrameTime = -1
+ }
+ }, {
+ key: "release",
+ value: function() {
+ null !== this.checkStartInterval && (this.checkStartIntervalCount = 0, window.clearInterval(this.checkStartInterval), this.checkStartInterval = null), null !== this.checkPicBlockInterval && (window.clearInterval(this.checkPicBlockInterval), this.checkPicBlockInterval = null), null !== this.bufferInterval && (window.clearInterval(this.bufferInterval), this.bufferInterval = null), this._releaseMpegTsjs(), this.myPlayerID = null, this.videoContaner = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onReadyShowDone = null, this.onPlayState = null, window.onclick = document.body.onclick = null
+ }
+ }]) && n(t.prototype, i), o && n(t, o), e
+ }();
+ i.NvMpegTsCore = o
+ }, {
+ "../consts": 52,
+ "../decoder/av-common": 56,
+ "../version": 84,
+ "mpegts.js": 41
+ }],
+ 80: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = e("../consts"),
+ a = (e("../version"), e("video.js")),
+ s = function() {
+ function e(t) {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e), this.configFormat = {
+ probeDurationMS: t.probeDurationMS,
+ width: t.width || r.DEFAULT_WIDTH,
+ height: t.height || r.DEFAULT_HEIGHT,
+ playerId: t.playerId || r.DEFAILT_WEBGL_PLAY_ID,
+ ignoreAudio: t.ignoreAudio,
+ autoPlay: t.autoPlay || !1
+ }, this.configFormat, this.audioVoice = 1, this.myPlayerID = this.configFormat.playerId + "-vjs", this.myPlayer = null, this.videoContaner = null, this.videoTag = null, this.duration = -1, this.vCodecID = r.V_CODEC_NAME_AVC, this.audioNone = !1, this.showScreen = !1, this.playPTS = 0, this.loadSuccess = !1, this.bufferInterval = null, this.bootInterval = null, this.onMakeItReady = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onSeekFinish = null, this.onReadyShowDone = null, this.onPlayState = null, this.onCacheProcess = null
+ }
+ var t, i, s;
+ return t = e, (i = [{
+ key: "_hiddenUnusedPlugins",
+ value: function() {
+ this._hiddenUnused("vjs-loading-spinner"), this._hiddenUnused("vjs-hidden"), this._hiddenUnused("vjs-control-bar"), this._hiddenUnused("vjs-control"), this._hiddenUnused("vjs-text-track-display"), this._hiddenUnused("vjs-big-play-button")
+ }
+ }, {
+ key: "_hiddenUnused",
+ value: function(e) {
+ Array.from(document.getElementsByClassName(e)).forEach((function(e) {
+ status ? e && e.setAttribute("style", "display: block;") : e && e.setAttribute("style", "display: none;")
+ }))
+ }
+ }, {
+ key: "_onVideoJsReady",
+ value: function() {
+ var e = this;
+ this._hiddenUnusedPlugins(), this.videoContaner = document.querySelector("#" + this.myPlayerID), this.videoTag.style.width = this.configFormat.width + "px", this.videoTag.style.height = this.configFormat.height + "px", this.duration = this.myPlayer.duration(), this.videoTag, this.duration, this.getSize(), this.videoTag.videoWidth, this.myPlayer.on("progress", (function() {
+ e.myPlayer.buffered().length, e.myPlayer.duration()
+ })), this.myPlayer.on("timeupdate", (function() {
+ e.videoTag.currentTime, e.myPlayer.duration(), e.onPlayingTime && e.onPlayingTime(e.myPlayer.currentTime())
+ }))
+ }
+ }, {
+ key: "makeIt",
+ value: function(e) {
+ var t = this,
+ i = {
+ techOrder: ["html5"],
+ width: this.configFormat.width,
+ height: this.configFormat.height,
+ controls: !1,
+ bigPlayButton: !1,
+ textTrackDisplay: !1,
+ posterImage: !0,
+ errorDisplay: !1,
+ controlBar: !1,
+ preload: "auto",
+ autoplay: this.configFormat.autoPlay,
+ sources: [{
+ src: e,
+ type: "application/x-mpegURL"
+ }]
+ },
+ n = document.querySelector("#" + this.configFormat.playerId),
+ r = document.createElement("video");
+ r.id = this.myPlayerID, this.videoTag = r, n.appendChild(r), !0 === this.configFormat.autoPlay && (this.videoTag.muted = "muted", this.videoTag.autoplay = "autoplay", window.onclick = document.body.onclick = function(e) {
+ t.videoTag.muted = !1, t.isPlayingState(), window.onclick = document.body.onclick = null
+ }), this.videoTag, this.videoTag.onplay = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.videoTag.onpause = function() {
+ var e = t.isPlayingState();
+ t.onPlayState && t.onPlayState(e)
+ }, this.myPlayer = a(this.myPlayerID, i, (function() {
+ t.myPlayer.on("canplaythrough", (function() {
+ t.getSize(), t.videoTag.videoWidth, !0 !== t.loadSuccess && (t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.loadSuccess = !0)
+ })), t.myPlayer.on("loadedmetadata", (function(e) {
+ t._onVideoJsReady(), !0 !== t.loadSuccess && (t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.loadSuccess = !0)
+ })), t.myPlayer.on("ended", (function() {
+ t.pause(), t.onPlayingFinish && t.onPlayingFinish()
+ })), t.myPlayer.on("seeking", (function() {})), t.myPlayer.on("seeked", (function() {
+ t.onSeekFinish && t.onSeekFinish()
+ })), t.onMakeItReady && t.onMakeItReady(), setTimeout((function() {
+ !0 !== t.loadSuccess && t.configFormat.probeDurationMS < 0 && (t.onLoadFinish && t.onLoadFinish(), t.onReadyShowDone && t.onReadyShowDone(), t._loopBufferState(), t.loadSuccess = !0)
+ }), 1e3)
+ })), this.myPlayer.options.controls = !1, this.myPlayer.options.autoplay = !1, this._hiddenUnusedPlugins()
+ }
+ }, {
+ key: "_refreshVideoTagEvent",
+ value: function() {
+ this.videoTag = document.getElementById(this.myPlayerID).querySelector("video")
+ }
+ }, {
+ key: "setPlaybackRate",
+ value: function() {
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
+ return !(e <= 0 || null == this.videoTag || null === this.videoTag || (this.videoTag.playbackRate = e, 0))
+ }
+ }, {
+ key: "getPlaybackRate",
+ value: function() {
+ return null == this.videoTag || null === this.videoTag ? 0 : this.videoTag.playbackRate
+ }
+ }, {
+ key: "getSize",
+ value: function() {
+ return this.myPlayer.videoWidth() <= 0 ? {
+ width: this.videoTag.videoWidth,
+ height: this.videoTag.videoHeight
+ } : {
+ width: this.myPlayer.videoWidth(),
+ height: this.myPlayer.videoHeight()
+ }
+ }
+ }, {
+ key: "play",
+ value: function() {
+ void 0 === this.videoTag || null === this.videoTag ? this.myPlayer.play() : this.videoTag.play()
+ }
+ }, {
+ key: "seek",
+ value: function(e) {
+ void 0 === this.videoTag || null === this.videoTag ? this.myPlayer.currentTime = e : this.videoTag.currentTime = e
+ }
+ }, {
+ key: "pause",
+ value: function() {
+ void 0 === this.videoTag || null === this.videoTag ? this.myPlayer.pause() : this.videoTag.pause()
+ }
+ }, {
+ key: "setVoice",
+ value: function(e) {
+ void 0 === this.videoTag || null === this.videoTag ? this.myPlayer.volume = e : this.videoTag.volume = e
+ }
+ }, {
+ key: "isPlayingState",
+ value: function() {
+ return !this.myPlayer.paused()
+ }
+ }, {
+ key: "_loopBufferState",
+ value: function() {
+ var e = this;
+ e.duration <= 0 && (e.duration = e.videoTag.duration), null !== e.bufferInterval && (window.clearInterval(e.bufferInterval), e.bufferInterval = null), e.configFormat.probeDurationMS, e.configFormat.probeDurationMS <= 0 || e.duration <= 0 || (e.bufferInterval = window.setInterval((function() {
+ var t = e.videoTag.buffered.end(0);
+ if (t >= e.duration - .04) return e.onCacheProcess && e.onCacheProcess(e.duration), void window.clearInterval(e.bufferInterval);
+ e.onCacheProcess && e.onCacheProcess(t)
+ }), 200))
+ }
+ }, {
+ key: "release",
+ value: function() {
+ this.loadSuccess = !1, void 0 !== this.bootInterval && null !== this.bootInterval && (window.clearInterval(this.bootInterval), this.bootInterval = null), this.myPlayer.dispose(), this.myPlayerID = null, this.myPlayer = null, this.videoContaner = null, this.videoTag = null, this.onLoadFinish = null, this.onPlayingTime = null, this.onPlayingFinish = null, this.onSeekFinish = null, this.onReadyShowDone = null, this.onPlayState = null, null !== this.bufferInterval && (window.clearInterval(this.bufferInterval), this.bufferInterval = null), window.onclick = document.body.onclick = null
+ }
+ }]) && n(t.prototype, i), s && n(t, s), e
+ }();
+ i.NvVideojsCore = s
+ }, {
+ "../consts": 52,
+ "../version": 84,
+ "video.js": 47
+ }],
+ 81: [function(e, t, i) {
+ "use strict";
+ e("../decoder/av-common");
+
+ function n(e) {
+ this.gl = e, this.texture = e.createTexture(), e.bindTexture(e.TEXTURE_2D, this.texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE)
+ }
+ n.prototype.bind = function(e, t, i) {
+ var n = this.gl;
+ n.activeTexture([n.TEXTURE0, n.TEXTURE1, n.TEXTURE2][e]), n.bindTexture(n.TEXTURE_2D, this.texture), n.uniform1i(n.getUniformLocation(t, i), e)
+ }, n.prototype.fill = function(e, t, i) {
+ var n = this.gl;
+ n.bindTexture(n.TEXTURE_2D, this.texture), n.texImage2D(n.TEXTURE_2D, 0, n.LUMINANCE, e, t, 0, n.LUMINANCE, n.UNSIGNED_BYTE, i)
+ }, t.exports = {
+ renderFrame: function(e, t, i, n, r, a) {
+ e.viewport(0, 0, e.canvas.width, e.canvas.height), e.clearColor(0, 0, 0, 0), e.clear(e.COLOR_BUFFER_BIT), e.y.fill(r, a, t), e.u.fill(r >> 1, a >> 1, i), e.v.fill(r >> 1, a >> 1, n), e.drawArrays(e.TRIANGLE_STRIP, 0, 4)
+ },
+ setupCanvas: function(e, t) {
+ var i = e.getContext("webgl") || e.getContext("experimental-webgl");
+ if (!i) return i;
+ var r = i.createProgram(),
+ a = ["attribute highp vec4 aVertexPosition;", "attribute vec2 aTextureCoord;", "varying highp vec2 vTextureCoord;", "void main(void) {", " gl_Position = aVertexPosition;", " vTextureCoord = aTextureCoord;", "}"].join("\n"),
+ s = i.createShader(i.VERTEX_SHADER);
+ i.shaderSource(s, a), i.compileShader(s);
+ var o = ["precision highp float;", "varying lowp vec2 vTextureCoord;", "uniform sampler2D YTexture;", "uniform sampler2D UTexture;", "uniform sampler2D VTexture;", "const mat4 YUV2RGB = mat4", "(", " 1.1643828125, 0, 1.59602734375, -.87078515625,", " 1.1643828125, -.39176171875, -.81296875, .52959375,", " 1.1643828125, 2.017234375, 0, -1.081390625,", " 0, 0, 0, 1", ");", "void main(void) {", " gl_FragColor = vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB;", "}"].join("\n"),
+ u = i.createShader(i.FRAGMENT_SHADER);
+ i.shaderSource(u, o), i.compileShader(u), i.attachShader(r, s), i.attachShader(r, u), i.linkProgram(r), i.useProgram(r), i.getProgramParameter(r, i.LINK_STATUS);
+ var l = i.getAttribLocation(r, "aVertexPosition");
+ i.enableVertexAttribArray(l);
+ var h = i.getAttribLocation(r, "aTextureCoord");
+ i.enableVertexAttribArray(h);
+ var d = i.createBuffer();
+ i.bindBuffer(i.ARRAY_BUFFER, d), i.bufferData(i.ARRAY_BUFFER, new Float32Array([1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1, 0]), i.STATIC_DRAW), i.vertexAttribPointer(l, 3, i.FLOAT, !1, 0, 0);
+ var c = i.createBuffer();
+ return i.bindBuffer(i.ARRAY_BUFFER, c), i.bufferData(i.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), i.STATIC_DRAW), i.vertexAttribPointer(h, 2, i.FLOAT, !1, 0, 0), i.y = new n(i), i.u = new n(i), i.v = new n(i), i.y.bind(0, r, "YTexture"), i.u.bind(1, r, "UTexture"), i.v.bind(2, r, "VTexture"), i
+ },
+ releaseContext: function(e) {
+ e.deleteTexture(e.y.texture), e.deleteTexture(e.u.texture), e.deleteTexture(e.v.texture)
+ }
+ }
+ }, {
+ "../decoder/av-common": 56
+ }],
+ 82: [function(e, t, i) {
+ (function(e) {
+ "use strict";
+ e.STATIC_MEM_wasmDecoderState = -1, e.STATICE_MEM_playerCount = -1, e.STATICE_MEM_playerIndexPtr = 0
+ }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {})
+ }, {}],
+ 83: [function(e, t, i) {
+ "use strict";
+
+ function n(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var n = t[i];
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
+ }
+ }
+ var r = function() {
+ function e() {
+ ! function(e, t) {
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
+ }(this, e)
+ }
+ var t, i, r;
+ return t = e, r = [{
+ key: "createPlayerRender",
+ value: function(e, t, i) {
+ var n = document.querySelector("div#" + e);
+ return n.style.position = "relative", n.style.backgroundColor = "black", n.style.width = t + "px", n.style.height = i + "px", n
+ }
+ }], (i = null) && n(t.prototype, i), r && n(t, r), e
+ }();
+ i.UI = r
+ }, {}],
+ 84: [function(e, t, i) {
+ "use strict";
+ t.exports = {
+ PLAYER_VERSION: "4.2.0"
+ }
+ }, {}]
+}, {}, [76]); \ No newline at end of file