diff --git a/package.json b/package.json
index 8c52260..e76f523 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"amfe-flexible": "^2.2.1",
"axios": "^1.1.3",
"core-js": "^2.6.5",
+ "easy-player": "^2.2.7",
"echarts": "^5.4.0",
"echarts-gl": "^2.0.5",
"element-ui": "^2.15.6",
diff --git a/public/video/EasyPlayer-element.min.js b/public/video/EasyPlayer-element.min.js
new file mode 100644
index 0000000..465281e
--- /dev/null
+++ b/public/video/EasyPlayer-element.min.js
@@ -0,0 +1,40 @@
+!function(t,A){"object"==typeof exports&&"undefined"!=typeof module?module.exports=A():"function"==typeof define&&define.amd?define(A):t.videojs=A()}(this,function(){function t(t,A){return t(A={exports:{}},A.exports),A.exports}function A(t){return t.replace(/\n\r?\s*/g,"")}function e(t,A){eA(t).forEach(function(e){return A(t[e],e)})}function i(t){for(var A=arguments.length,i=Array(A>1?A-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:"div",A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],n=Gt.createElement(t);return Object.getOwnPropertyNames(A).forEach(function(t){var e=A[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?(Vt.warn(qt(iA,t,e)),n.setAttribute(t,e)):"textContent"===t?E(n,e):n[t]=e}),Object.getOwnPropertyNames(e).forEach(function(t){n.setAttribute(t,e[t])}),i&&Y(n,i),n}function E(t,A){return void 0===t.textContent?t.innerText=A:t.textContent=A,t}function h(t,A){A.firstChild?A.insertBefore(t,A.firstChild):A.appendChild(t)}function l(t,A){return s(A),t.classList?t.classList.contains(A):function(t){return new RegExp("(^|\\s)"+t+"($|\\s)")}(A).test(t.className)}function d(t,A){return t.classList?t.classList.add(A):l(t,A)||(t.className=(t.className+" "+A).trim()),t}function C(t,A){return t.classList?t.classList.remove(A):(s(A),t.className=t.className.split(/\s+/).filter(function(t){return t!==A}).join(" ")),t}function T(t,A,e){var i=l(t,A);if("function"==typeof e&&(e=e(t,A)),"boolean"!=typeof e&&(e=!i),e!==i)return e?d(t,A):C(t,A),t}function N(t,A){Object.getOwnPropertyNames(A).forEach(function(e){var i=A[e];null===i||void 0===i||!1===i?t.removeAttribute(e):t.setAttribute(e,!0===i?"":i)})}function D(t){var A={};if(t&&t.attributes&&t.attributes.length>0)for(var e=t.attributes,i=e.length-1;i>=0;i--){var n=e[i].name,r=e[i].value;"boolean"!=typeof t[n]&&-1===",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+n+",")||(r=null!==r),A[n]=r}return A}function y(t,A){return t.getAttribute(A)}function B(t,A,e){t.setAttribute(A,e)}function f(t,A){t.removeAttribute(A)}function Q(){Gt.body.focus(),Gt.onselectstart=function(){return!1}}function w(){Gt.onselectstart=function(){return!0}}function m(t){if(t&&t.getBoundingClientRect&&t.parentNode){var A=t.getBoundingClientRect(),e={};return["bottom","height","left","right","top","width"].forEach(function(t){void 0!==A[t]&&(e[t]=A[t])}),e.height||(e.height=parseFloat(o(t,"height"))),e.width||(e.width=parseFloat(o(t,"width"))),e}}function p(t){var A=void 0;if(t.getBoundingClientRect&&t.parentNode&&(A=t.getBoundingClientRect()),!A)return{left:0,top:0};var e=Gt.documentElement,i=Gt.body,n=e.clientLeft||i.clientLeft||0,r=zt.pageXOffset||i.scrollLeft,o=A.left+r-n,a=e.clientTop||i.clientTop||0,s=zt.pageYOffset||i.scrollTop,g=A.top+s-a;return{left:Math.round(o),top:Math.round(g)}}function S(t,A){var e={},i=p(t),n=t.offsetWidth,r=t.offsetHeight,o=i.top,a=i.left,s=A.pageY,g=A.pageX;return A.changedTouches&&(g=A.changedTouches[0].pageX,s=A.changedTouches[0].pageY),e.y=Math.max(0,Math.min(1,(o-s+r)/r)),e.x=Math.max(0,Math.min(1,(g-a)/n)),e}function L(t){return n(t)&&3===t.nodeType}function j(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function x(t){return"function"==typeof t&&(t=t()),(Array.isArray(t)?t:[t]).map(function(t){return"function"==typeof t&&(t=t()),M(t)||L(t)?t:"string"==typeof t&&/\S/.test(t)?Gt.createTextNode(t):void 0}).filter(function(t){return t})}function Y(t,A){return x(A).forEach(function(A){return t.appendChild(A)}),t}function U(t,A){return Y(j(t),A)}function O(t){return void 0===t.button&&void 0===t.buttons||0===t.button&&void 0===t.buttons||0===t.button&&1===t.buttons}function v(){return aA++}function k(t){var A=t[gA];return A||(A=t[gA]=v()),sA[A]||(sA[A]={}),sA[A]}function z(t){var A=t[gA];return!!A&&!!Object.getOwnPropertyNames(sA[A]).length}function F(t){var A=t[gA];if(A){delete sA[A];try{delete t[gA]}catch(A){t.removeAttribute?t.removeAttribute(gA):t[gA]=null}}}function b(t,A){var e=k(t);0===e.handlers[A].length&&(delete e.handlers[A],t.removeEventListener?t.removeEventListener(A,e.dispatcher,!1):t.detachEvent&&t.detachEvent("on"+A,e.dispatcher)),Object.getOwnPropertyNames(e.handlers).length<=0&&(delete e.handlers,delete e.dispatcher,delete e.disabled),0===Object.getOwnPropertyNames(e).length&&F(t)}function R(t,A,e,i){e.forEach(function(e){t(A,e,i)})}function J(t){function A(){return!0}function e(){return!1}if(!t||!t.isPropagationStopped){var i=t||zt.event;for(var n in t={},i)"layerX"!==n&&"layerY"!==n&&"keyLocation"!==n&&"webkitMovementX"!==n&&"webkitMovementY"!==n&&("returnValue"===n&&i.preventDefault||(t[n]=i[n]));if(t.target||(t.target=t.srcElement||Gt),t.relatedTarget||(t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement),t.preventDefault=function(){i.preventDefault&&i.preventDefault(),t.returnValue=!1,i.returnValue=!1,t.defaultPrevented=!0},t.defaultPrevented=!1,t.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),t.cancelBubble=!0,i.cancelBubble=!0,t.isPropagationStopped=A},t.isPropagationStopped=e,t.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),t.isImmediatePropagationStopped=A,t.stopPropagation()},t.isImmediatePropagationStopped=e,null!==t.clientX&&void 0!==t.clientX){var r=Gt.documentElement,o=Gt.body;t.pageX=t.clientX+(r&&r.scrollLeft||o&&o.scrollLeft||0)-(r&&r.clientLeft||o&&o.clientLeft||0),t.pageY=t.clientY+(r&&r.scrollTop||o&&o.scrollTop||0)-(r&&r.clientTop||o&&o.clientTop||0)}t.which=t.charCode||t.keyCode,null!==t.button&&void 0!==t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t}function G(t,A,e){if(Array.isArray(A))return R(G,t,A,e);var i=k(t);if(i.handlers||(i.handlers={}),i.handlers[A]||(i.handlers[A]=[]),e.guid||(e.guid=v()),i.handlers[A].push(e),i.dispatcher||(i.disabled=!1,i.dispatcher=function(A,e){if(!i.disabled){A=J(A);var n=i.handlers[A.type];if(n)for(var r=n.slice(0),o=0,a=r.length;o-1&&(n={passive:!0}),t.addEventListener(A,i.dispatcher,n)}else t.attachEvent&&t.attachEvent("on"+A,i.dispatcher)}function K(t,A,e){if(z(t)){var i=k(t);if(i.handlers){if(Array.isArray(A))return R(K,t,A,e);var n=function(t,A){i.handlers[A]=[],b(t,A)};if(void 0!==A){var r=i.handlers[A];if(r){if(!e)return void n(t,A);if(e.guid)for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{}).eventBusKey;if(A){if(!t[A].nodeName)throw new Error('The eventBusKey "'+A+'" does not refer to an element.');t.eventBusEl_=t[A]}else t.eventBusEl_=u("span",{className:"vjs-event-bus"});return i(t,LA),t.on("dispose",function(){t.off(),zt.setTimeout(function(){t.eventBusEl_=null},0)}),t}function q(t,A){return i(t,jA),t.state=i({},t.state,A),"function"==typeof t.handleStateChanged&&BA(t)&&t.on("statechanged",t.handleStateChanged),t}function X(t){return"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function Z(){for(var t={},A=arguments.length,i=Array(A),n=0;ne)throw new Error("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+A+") is non-numeric or out of bounds (0-"+e+").")}(t,i,e.length-1),e[i][A]}function $(t){return void 0===t||0===t.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:t.length,start:_.bind(null,"start",0,t),end:_.bind(null,"end",1,t)}}function tt(t,A){return Array.isArray(t)?$(t):void 0===t||void 0===A?$():$([[t,A]])}function At(t,A){var e=0,i=void 0,n=void 0;if(!A)return 0;t&&t.length||(t=tt(0,0));for(var r=0;rA&&(n=A),e+=n-i;return e/A}function et(t){if(t instanceof et)return t;"number"==typeof t?this.code=t:"string"==typeof t?this.message=t:n(t)&&("number"==typeof t.code&&(this.code=t.code),i(this,t)),this.message||(this.message=et.defaultMessages[this.code]||"")}function it(t){return void 0!==t&&null!==t&&"function"==typeof t.then}function nt(t){it(t)&&t.then(null,function(t){})}function rt(t,A,e){var i=t;return ze(A)?(e=A,"string"==typeof t&&(i={uri:t})):i=Ze(A,{uri:t}),i.callback=e,i}function ot(t,A,e){return at(A=rt(t,A,e))}function at(t){function A(t){return clearTimeout(s),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,h)}function e(){if(!a){var A;clearTimeout(s),A=t.useXDR&&void 0===r.status?200:1223===r.status?204:r.status;var e=h,i=null;return 0!==A?(e={body:function(){var t=void 0;if(t=r.response?r.response:r.responseText||function(t){if("document"===t.responseType)return t.responseXML;var A=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||A?null:t.responseXML}(r),E)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:A,method:M,headers:{},url:g,rawRequest:r},r.getAllResponseHeaders&&(e.headers=Xe(r.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),n(i,e,e.body)}}if(void 0===t.callback)throw new Error("callback argument missing");var i=!1,n=function(A,e,n){i||(i=!0,t.callback(A,e,n))},r=t.xhr||null;r||(r=t.cors||t.useXDR?new ot.XDomainRequest:new ot.XMLHttpRequest);var o,a,s,g=r.url=t.uri||t.url,M=r.method=t.method||"GET",I=t.body||t.data,c=r.headers=t.headers||{},u=!!t.sync,E=!1,h={body:void 0,headers:{},statusCode:0,method:M,url:g,rawRequest:r};if("json"in t&&!1!==t.json&&(E=!0,c.accept||c.Accept||(c.Accept="application/json"),"GET"!==M&&"HEAD"!==M&&(c["content-type"]||c["Content-Type"]||(c["Content-Type"]="application/json"),I=JSON.stringify(!0===t.json?I:t.json))),r.onreadystatechange=function(){4===r.readyState&&setTimeout(e,0)},r.onload=e,r.onerror=A,r.onprogress=function(){},r.onabort=function(){a=!0},r.ontimeout=A,r.open(M,g,!u,t.username,t.password),u||(r.withCredentials=!!t.withCredentials),!u&&t.timeout>0&&(s=setTimeout(function(){if(!a){a=!0,r.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",A(t)}},t.timeout)),r.setRequestHeader)for(o in c)c.hasOwnProperty(o)&&r.setRequestHeader(o,c[o]);else t.headers&&function(t){for(var A in t)if(t.hasOwnProperty(A))return!1}(t.headers);return"responseType"in t&&(r.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(r),r.send(I||null),r}function st(t,A){this.name="ParsingError",this.code=t.code,this.message=A||t.message}function gt(t){function A(t,A,e,i){return 3600*(0|t)+60*(0|A)+(0|e)+(0|i)/1e3}var e=t.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return e?e[3]?A(e[1],e[2],e[3].replace(":",""),e[4]):e[1]>59?A(e[1],e[2],0,e[4]):A(0,e[1],e[2],e[4]):null}function Mt(){this.values=Mi(null)}function It(t,A,e,i){var n=i?t.split(i):[t];for(var r in n)if("string"==typeof n[r]){var o=n[r].split(e);if(2===o.length)A(o[0],o[1])}}function ct(t,A,e){function i(){var A=gt(t);if(null===A)throw new st(st.Errors.BadTimeStamp,"Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),A}function n(){t=t.replace(/^\s+/,"")}var r=t;if(n(),A.startTime=i(),n(),"--\x3e"!==t.substr(0,3))throw new st(st.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.substr(3),n(),A.endTime=i(),n(),function(t,A){var i=new Mt;It(t,function(t,A){switch(t){case"region":for(var n=e.length-1;n>=0;n--)if(e[n].id===A){i.set(t,e[n].region);break}break;case"vertical":i.alt(t,A,["rl","lr"]);break;case"line":var r=A.split(","),o=r[0];i.integer(t,o),i.percent(t,o)&&i.set("snapToLines",!1),i.alt(t,o,["auto"]),2===r.length&&i.alt("lineAlign",r[1],["start","middle","end"]);break;case"position":r=A.split(","),i.percent(t,r[0]),2===r.length&&i.alt("positionAlign",r[1],["start","middle","end"]);break;case"size":i.percent(t,A);break;case"align":i.alt(t,A,["start","middle","end","left","right"])}},/:/,/\s/),A.region=i.get("region",null),A.vertical=i.get("vertical",""),A.line=i.get("line","auto"),A.lineAlign=i.get("lineAlign","start"),A.snapToLines=i.get("snapToLines",!0),A.size=i.get("size",100),A.align=i.get("align","middle"),A.position=i.get("position",{start:0,left:0,middle:50,end:100,right:100},A.align),A.positionAlign=i.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},A.align)}(t,A)}function ut(t,A){function e(t){return Ii[t]}for(var i,n=t.document.createElement("div"),r=n,o=[];null!==(i=function(){if(!A)return null;var t=A.match(/^([^<]*)(<[^>]*>?)?/);return function(t){return A=A.substr(t.length),t}(t[1]?t[1]:t[2])}());)if("<"!==i[0])r.appendChild(t.document.createTextNode(function(t){for(;g=t.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)t=t.replace(g[0],e);return t}(i)));else{if("/"===i[1]){o.length&&o[o.length-1]===i.substr(2).replace(">","")&&(o.pop(),r=r.parentNode);continue}var a,s=gt(i.substr(1,i.length-2));if(s){a=t.document.createProcessingInstruction("timestamp",s),r.appendChild(a);continue}var g=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!g)continue;if(!(a=function(A,e){var i=ci[A];if(!i)return null;var n=t.document.createElement(i);n.localName=i;var r=ui[A];return r&&e&&(n[r]=e.trim()),n}(g[1],g[3])))continue;if(!function(t,A){return!Ei[A.localName]||Ei[A.localName]===t.localName}(r,a))continue;g[2]&&(a.className=g[2].substr(1).replace("."," ")),o.push(g[1]),r.appendChild(a),r=a}return n}function Et(t){for(var A=0;A=e[0]&&t<=e[1])return!0}return!1}function ht(){}function lt(t,A,e){ht.call(this),this.cue=A,this.cueDiv=ut(t,A.text);var i={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:""===A.vertical?"horizontal-tb":"lr"===A.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=t.document.createElement("div"),i={direction:function(t){function A(t,A){for(var e=A.childNodes.length-1;e>=0;e--)t.push(A.childNodes[e])}function e(t){if(!t||!t.length)return null;var i=t.pop(),n=i.textContent||i.innerText;if(n){var r=n.match(/^.*(\n|\r)/);return r?(t.length=0,r[0]):n}return"ruby"===i.tagName?e(t):i.childNodes?(A(t,i),e(t)):void 0}var i=[],n="";if(!t||!t.childNodes)return"ltr";for(A(i,t);n=e(i);)for(var r=0;r=0&&t.line<=100))return t.line;if(!t.track||!t.track.textTrackList||!t.track.textTrackList.mediaElement)return-1;for(var A=t.track,e=A.textTrackList,i=0,n=0;nI&&(M=M<0?-1:1,M*=Math.ceil(I/g)*g),o<0&&(M+=""===r.vertical?e.height:e.width,a=a.reverse()),n.move(c,M)}else{var u=n.lineHeight/e.height*100;switch(r.lineAlign){case"middle":o-=u/2;break;case"end":o-=u}switch(r.vertical){case"":A.applyStyles({top:A.formatStyle(o,"%")});break;case"rl":A.applyStyles({left:A.formatStyle(o,"%")});break;case"lr":A.applyStyles({right:A.formatStyle(o,"%")})}a=["+y","-x","+x","-y"],n=new dt(A)}var E=function(t,A){for(var n,r=new dt(t),o=1,a=0;as&&(n=new dt(t),o=s),t=new dt(r)}return n||r}(n,a);A.move(E.toCSSCompatValues(e))}function Tt(){}function Nt(t){return"string"==typeof t&&!!Ni[t.toLowerCase()]&&t.toLowerCase()}function Dt(t,A,e){this.hasBeenReset=!1;var i="",n=!1,r=t,o=A,a=e,s=null,g="",M=!0,I="auto",c="start",u=50,E="middle",h=50,l="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return i},set:function(t){i=""+t}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(t){n=!!t}},startTime:{enumerable:!0,get:function(){return r},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");r=t,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");o=t,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return a},set:function(t){a=""+t,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return s},set:function(t){s=t,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return g},set:function(t){var A=function(t){return"string"==typeof t&&!!Ti[t.toLowerCase()]&&t.toLowerCase()}(t);if(!1===A)throw new SyntaxError("An invalid or illegal string was specified.");g=A,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return M},set:function(t){M=!!t,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return I},set:function(t){if("number"!=typeof t&&t!==Ci)throw new SyntaxError("An invalid number or illegal string was specified.");I=t,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(t){var A=Nt(t);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");c=A,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return u},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");u=t,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return E},set:function(t){var A=Nt(t);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");E=A,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return h},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");h=t,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return l},set:function(t){var A=Nt(t);if(!A)throw new SyntaxError("An invalid or illegal string was specified.");l=A,this.hasBeenReset=!0}}}),this.displayState=void 0}function yt(t){return"number"==typeof t&&t>=0&&t<=100}function Bt(t,A,e){t.setTimeout(function(){return function t(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments[2],r=arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=e[0],g=e.slice(1);if("string"==typeof s)t(A,ji[s],n,r,o,a);else if(s){var M=function(t,A){var e=xi[t.id()],i=null;if(void 0===e||null===e)return i=A(t),xi[t.id()]=[[A,i]],i;for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:null,n="call"+X(e),r=t.reduce(Qt(n),i),o=r===Yi,a=o?null:A[e](r);return function(t,A,e,i){for(var n=t.length-1;n>=0;n--){var r=t[n];r[A]&&r[A](i,e)}}(t,e,a,o),a}function Qt(t){return function(A,e){return A===Yi?Yi:e[t]?e[t](A):A}}function wt(t){var A=zi(t.src);return!t.type&&A&&(t.type=A),t}function mt(t,A){var e=void 0;if(4===t.length)e=t[1]+t[1]+t[2]+t[2]+t[3]+t[3];else{if(7!==t.length)throw new Error("Invalid color code provided, "+t+"; must be formatted as e.g. #f0e or #f604e2.");e=t.slice(1)}return"rgba("+parseInt(e.slice(0,2),16)+","+parseInt(e.slice(2,4),16)+","+parseInt(e.slice(4,6),16)+","+A+")"}function pt(t,A,e){try{t.style[A]=e}catch(t){return}}function St(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return Xi(t,A)}function Lt(t,A){if(A&&(t=A(t)),t&&"none"!==t)return t}function jt(t,A,e){var i=jt.getPlayer(t);if(i)return A&&Vt.warn('Player "'+t+'" is already initialised. Options will not be applied.'),e&&i.ready(e),i;var r="string"==typeof t?nA("#"+Qr(t)):t;if(!M(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");Gt.body.contains(r)||Vt.warn("The element supplied is not included in the DOM"),A=A||{},jt.hooks("beforesetup").forEach(function(t){var e=t(r,Z(A));n(e)&&!Array.isArray(e)?A=Z(A,e):Vt.error("please return an object in beforesetup hooks")});var o=xA.getComponent("Player");return i=new o(r,A,e),jt.hooks("setup").forEach(function(t){return t(i)}),i}function xt(t,A){return function(e){var i=this;if(!A)return new qI(t);if(qI&&!e){var n=Yt(A.toString().replace(/^function.+?{/,"").slice(0,-1));return this[HI]=new qI(n),function(t,A){if(t&&A){var e=t.terminate;t.objURL=A,t.terminate=function(){t.objURL&&VI.revokeObjectURL(t.objURL),e.call(t)}}}(this[HI],n),this[HI]}var r={postMessage:function(t){i.onmessage&&setTimeout(function(){i.onmessage({data:t,target:r})})}};A.call(r),this.postMessage=function(t){setTimeout(function(){r.onmessage({data:t,target:i})})},this.isThisThread=!0}}function Yt(t){try{return VI.createObjectURL(new Blob([t],{type:PI}))}catch(e){var A=new WI;return A.append(t),VI.createObjectURL(A.getBlob(type))}}function Ut(){}var Ot,vt="7.2.4",kt="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},zt="undefined"!=typeof window?window:void 0!==kt?kt:"undefined"!=typeof self?self:{},Ft={},bt=Object.freeze({default:Ft}),Rt=bt&&Ft||bt,Jt=void 0!==kt?kt:"undefined"!=typeof window?window:{};"undefined"!=typeof document?Ot=document:(Ot=Jt["__GLOBAL_DOCUMENT_CACHE@4"])||(Ot=Jt["__GLOBAL_DOCUMENT_CACHE@4"]=Rt);var Gt=Ot,Kt=void 0,Ht="info",Pt=[],Wt=function(t,A){var e=Kt.levels[Ht],i=new RegExp("^("+e+")$");if("log"!==t&&A.unshift(t.toUpperCase()+":"),Pt&&Pt.push([].concat(A)),A.unshift("VIDEOJS:"),zt.console){var n=zt.console[t];n||"debug"!==t||(n=zt.console.info||zt.console.log),!n||!e||i.test(t)}};(Kt=function(){for(var t=arguments.length,A=Array(t),e=0;e0)for(var n=0,r=i.length;n=A&&(t.apply(void 0,arguments),e=i)}},NA=function(t,A,e){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:zt,n=void 0,r=function(){var r=this,o=arguments,a=function(){n=null,a=null,e||t.apply(r,o)};!n&&e&&t.apply(r,o),i.clearTimeout(n),n=i.setTimeout(a,A)};return r.cancel=function(){i.clearTimeout(n),n=null},r},DA=function(){};DA.prototype.allowedEvents_={},DA.prototype.on=function(t,A){var e=this.addEventListener;this.addEventListener=function(){},G(this,t,A),this.addEventListener=e},DA.prototype.addEventListener=DA.prototype.on,DA.prototype.off=function(t,A){K(this,t,A)},DA.prototype.removeEventListener=DA.prototype.off,DA.prototype.one=function(t,A){var e=this.addEventListener;this.addEventListener=function(){},P(this,t,A),this.addEventListener=e},DA.prototype.trigger=function(t){var A=t.type||t;"string"==typeof t&&(t={type:A}),t=J(t),this.allowedEvents_[A]&&this["on"+A]&&this["on"+A](t),H(this,t)},DA.prototype.dispatchEvent=DA.prototype.trigger;var yA=void 0;DA.prototype.queueTrigger=function(t){var A=this;yA||(yA=new Map);var e=t.type||t,i=yA.get(this);i||(i=new Map,yA.set(this,i));var n=i.get(e);i.delete(e),zt.clearTimeout(n);var r=zt.setTimeout(function(){0===i.size&&(i=null,yA.delete(A)),A.trigger(t)},0);i.set(e,r)};var BA=function(t){return t instanceof DA||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(A){return"function"==typeof t[A]})},fA=function(t){return"string"==typeof t&&/\S/.test(t)||Array.isArray(t)&&!!t.length},QA=function(t){if(!t.nodeName&&!BA(t))throw new Error("Invalid target; must be a DOM node or evented object.")},wA=function(t){if(!fA(t))throw new Error("Invalid event type; must be a non-empty string or array.")},mA=function(t){if("function"!=typeof t)throw new Error("Invalid listener; must be a function.")},pA=function(t,A){var e=A.length<3||A[0]===t||A[0]===t.eventBusEl_,i=void 0,n=void 0,r=void 0;return e?(i=t.eventBusEl_,A.length>=3&&A.shift(),n=A[0],r=A[1]):(i=A[0],n=A[1],r=A[2]),QA(i),wA(n),mA(r),{isTargetingSelf:e,target:i,type:n,listener:r=CA(t,r)}},SA=function(t,A,e,i){QA(t),t.nodeName?cA[A](t,e,i):t[A](e,i)},LA={on:function(){for(var t=this,A=arguments.length,e=Array(A),i=0;i=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),F(this.el_),this.el_=null),this.player_=null},t.prototype.player=function(){return this.player_},t.prototype.options=function(t){return Vt.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),t?(this.options_=Z(this.options_,t),this.options_):this.options_},t.prototype.el=function(){return this.el_},t.prototype.createEl=function(t,A,e){return u(t,A,e)},t.prototype.localize=function(t,A){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,i=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),r=n&&n[i],o=i&&i.split("-")[0],a=n&&n[o],s=e;return r&&r[t]?s=r[t]:a&&a[t]&&(s=a[t]),A&&(s=s.replace(/\{(\d+)\}/g,function(t,e){var i=A[e-1],n=i;return void 0===i&&(n=t),n})),s},t.prototype.contentEl=function(){return this.contentEl_||this.el_},t.prototype.id=function(){return this.id_},t.prototype.name=function(){return this.name_},t.prototype.children=function(){return this.children_},t.prototype.getChildById=function(t){return this.childIndex_[t]},t.prototype.getChild=function(t){if(t)return t=X(t),this.childNameIndex_[t]},t.prototype.addChild=function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length,n=void 0,r=void 0;if("string"==typeof A){r=X(A);var o=e.componentClass||r;e.name=r;var a=t.getComponent(o);if(!a)throw new Error("Component "+o+" does not exist");if("function"!=typeof a)return null;n=new a(this.player_||this,e)}else n=A;if(this.children_.splice(i,0,n),"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(r=r||n.name&&X(n.name()))&&(this.childNameIndex_[r]=n),"function"==typeof n.el&&n.el()){var s=this.contentEl().children[i]||null;this.contentEl().insertBefore(n.el(),s)}return n},t.prototype.removeChild=function(t){if("string"==typeof t&&(t=this.getChild(t)),t&&this.children_){for(var A=!1,e=this.children_.length-1;e>=0;e--)if(this.children_[e]===t){A=!0,this.children_.splice(e,1);break}if(A){this.childIndex_[t.id()]=null,this.childNameIndex_[t.name()]=null;var i=t.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(t.el())}}},t.prototype.initChildren=function(){var A=this,e=this.options_.children;if(e){var i=this.options_,n=void 0,r=t.getComponent("Tech");(n=Array.isArray(e)?e:Object.keys(e)).concat(Object.keys(this.options_).filter(function(t){return!n.some(function(A){return"string"==typeof A?t===A:t===A.name})})).map(function(t){var i=void 0,n=void 0;return"string"==typeof t?n=e[i=t]||A.options_[i]||{}:(i=t.name,n=t),{name:i,opts:n}}).filter(function(A){var e=t.getComponent(A.opts.componentClass||X(A.name));return e&&!r.isTech(e)}).forEach(function(t){var e=t.name,n=t.opts;if(void 0!==i[e]&&(n=i[e]),!1!==n){!0===n&&(n={}),n.playerOptions=A.options_.playerOptions;var r=A.addChild(e,n);r&&(A[e]=r)}})}},t.prototype.buildCSSClass=function(){return""},t.prototype.ready=function(t){var A=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return this.isReady_?void(A?t.call(this):this.setTimeout(t,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(t))},t.prototype.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var t=this.readyQueue_;this.readyQueue_=[],t&&t.length>0&&t.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)},t.prototype.$=function(t,A){return nA(t,A||this.contentEl())},t.prototype.$$=function(t,A){return rA(t,A||this.contentEl())},t.prototype.hasClass=function(t){return l(this.el_,t)},t.prototype.addClass=function(t){d(this.el_,t)},t.prototype.removeClass=function(t){C(this.el_,t)},t.prototype.toggleClass=function(t,A){T(this.el_,t,A)},t.prototype.show=function(){this.removeClass("vjs-hidden")},t.prototype.hide=function(){this.addClass("vjs-hidden")},t.prototype.lockShowing=function(){this.addClass("vjs-lock-showing")},t.prototype.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.prototype.getAttribute=function(t){return y(this.el_,t)},t.prototype.setAttribute=function(t,A){B(this.el_,t,A)},t.prototype.removeAttribute=function(t){f(this.el_,t)},t.prototype.width=function(t,A){return this.dimension("width",t,A)},t.prototype.height=function(t,A){return this.dimension("height",t,A)},t.prototype.dimensions=function(t,A){this.width(t,!0),this.height(A)},t.prototype.dimension=function(t,A,e){if(void 0!==A)return null!==A&&A==A||(A=0),-1!==(""+A).indexOf("%")||-1!==(""+A).indexOf("px")?this.el_.style[t]=A:this.el_.style[t]="auto"===A?"":A+"px",void(e||this.trigger("componentresize"));if(!this.el_)return 0;var i=this.el_.style[t],n=i.indexOf("px");return-1!==n?parseInt(i.slice(0,n),10):parseInt(this.el_["offset"+X(t)],10)},t.prototype.currentDimension=function(t){var A=0;if("width"!==t&&"height"!==t)throw new Error("currentDimension only accepts width or height value");if("function"==typeof zt.getComputedStyle){var e=zt.getComputedStyle(this.el_);A=e.getPropertyValue(t)||e[t]}if(0===(A=parseFloat(A))){var i="offset"+X(t);A=this.el_[i]}return A},t.prototype.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.prototype.currentWidth=function(){return this.currentDimension("width")},t.prototype.currentHeight=function(){return this.currentDimension("height")},t.prototype.focus=function(){this.el_.focus()},t.prototype.blur=function(){this.el_.blur()},t.prototype.emitTapEvents=function(){var t=0,A=null,e=void 0;this.on("touchstart",function(i){1===i.touches.length&&(A={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},t=(new Date).getTime(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(A){var i=t.touches[0].pageX-A.pageX,n=t.touches[0].pageY-A.pageY;Math.sqrt(i*i+n*n)>10&&(e=!1)}});var i=function(){e=!1};this.on("touchleave",i),this.on("touchcancel",i),this.on("touchend",function(i){A=null,!0===e&&(new Date).getTime()-t<200&&(i.preventDefault(),this.trigger("tap"))})},t.prototype.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var t=CA(this.player(),this.player().reportUserActivity),A=void 0;this.on("touchstart",function(){t(),this.clearInterval(A),A=this.setInterval(t,250)});var e=function(e){t(),this.clearInterval(A)};this.on("touchmove",t),this.on("touchend",e),this.on("touchcancel",e)}},t.prototype.setTimeout=function(t,A){var e,i,n=this;return t=CA(this,t),e=zt.setTimeout(function(){n.off("dispose",i),t()},A),(i=function(){return n.clearTimeout(e)}).guid="vjs-timeout-"+e,this.on("dispose",i),e},t.prototype.clearTimeout=function(t){zt.clearTimeout(t);var A=function(){};return A.guid="vjs-timeout-"+t,this.off("dispose",A),t},t.prototype.setInterval=function(t,A){var e=this;t=CA(this,t);var i=zt.setInterval(t,A),n=function(){return e.clearInterval(i)};return n.guid="vjs-interval-"+i,this.on("dispose",n),i},t.prototype.clearInterval=function(t){zt.clearInterval(t);var A=function(){};return A.guid="vjs-interval-"+t,this.off("dispose",A),t},t.prototype.requestAnimationFrame=function(t){var A,e,i=this;return this.supportsRaf_?(t=CA(this,t),A=zt.requestAnimationFrame(function(){i.off("dispose",e),t()}),(e=function(){return i.cancelAnimationFrame(A)}).guid="vjs-raf-"+A,this.on("dispose",e),A):this.setTimeout(t,1e3/60)},t.prototype.cancelAnimationFrame=function(t){if(this.supportsRaf_){zt.cancelAnimationFrame(t);var A=function(){};return A.guid="vjs-raf-"+t,this.off("dispose",A),t}return this.clearTimeout(t)},t.registerComponent=function(A,e){if("string"!=typeof A||!A)throw new Error('Illegal component name, "'+A+'"; must be a non-empty string.');var i=t.getComponent("Tech"),n=i&&i.isTech(e),r=t===e||t.prototype.isPrototypeOf(e.prototype);if(n||!r){throw new Error('Illegal component, "'+A+'"; '+(n?"techs must be registered using Tech.registerTech()":"must be a Component subclass")+".")}A=X(A),t.components_||(t.components_={});var o=t.getComponent("Player");if("Player"===A&&o&&o.players){var a=o.players,s=Object.keys(a);if(a&&s.length>0&&s.map(function(t){return a[t]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return t.components_[A]=e,e},t.getComponent=function(A){if(A)return A=X(A),t.components_&&t.components_[A]?t.components_[A]:void 0},t}();xA.prototype.supportsRaf_="function"==typeof zt.requestAnimationFrame&&"function"==typeof zt.cancelAnimationFrame,xA.registerComponent("Component",xA);for(var YA=zt.navigator&&zt.navigator.userAgent||"",UA=/AppleWebKit\/([\d.]+)/i.exec(YA),OA=UA?parseFloat(UA.pop()):null,vA=/iPad/i.test(YA),kA=/iPhone/i.test(YA)&&!vA,zA=/iPod/i.test(YA),FA=kA||vA||zA,bA=function(){var t=YA.match(/OS (\d+)_/i);return t&&t[1]?t[1]:null}(),RA=/Android/i.test(YA),JA=function(){var t=YA.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;var A=t[1]&&parseFloat(t[1]),e=t[2]&&parseFloat(t[2]);return A&&e?parseFloat(t[1]+"."+t[2]):A||null}(),GA=RA&&JA<5&&OA<537,KA=/Firefox/i.test(YA),HA=/Edge/i.test(YA),PA=!HA&&(/Chrome/i.test(YA)||/CriOS/i.test(YA)),WA=function(){var t=YA.match(/(Chrome|CriOS)\/(\d+)/);return t&&t[2]?parseFloat(t[2]):null}(),VA=function(){var t=/MSIE\s(\d+)\.\d/.exec(YA),A=t&&parseFloat(t[1]);return!A&&/Trident\/7.0/i.test(YA)&&/rv:11.0/.test(YA)&&(A=11),A}(),qA=/Safari/i.test(YA)&&!PA&&!RA&&!HA,XA=(qA||FA)&&!PA,ZA=(g()&&("ontouchstart"in zt||zt.navigator.maxTouchPoints||zt.DocumentTouch&&zt.document instanceof zt.DocumentTouch)),_A=Object.freeze({IS_IPAD:vA,IS_IPHONE:kA,IS_IPOD:zA,IS_IOS:FA,IOS_VERSION:bA,IS_ANDROID:RA,ANDROID_VERSION:JA,IS_NATIVE_ANDROID:GA,IS_FIREFOX:KA,IS_EDGE:HA,IS_CHROME:PA,CHROME_VERSION:WA,IE_VERSION:VA,IS_SAFARI:qA,IS_ANY_SAFARI:XA,TOUCH_ENABLED:ZA}),$A={},te=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Ae=te[0],ee=void 0,ie=0;ie0&&void 0!==arguments[0]?arguments[0]:[];Zt(this,A);var i=$t(this,t.call(this));i.tracks_=[],Object.defineProperty(i,"length",{get:function(){return this.tracks_.length}});for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:[];Zt(this,A);for(var i=e.length-1;i>=0;i--)if(e[i].enabled){Ee(e,e[i]);break}var n=$t(this,t.call(this,e));return n.changing_=!1,n}return _t(A,t),A.prototype.addTrack=function(A){var e=this;A.enabled&&Ee(this,A),t.prototype.addTrack.call(this,A),A.addEventListener&&A.addEventListener("enabledchange",function(){e.changing_||(e.changing_=!0,Ee(e,A),e.changing_=!1,e.trigger("change"))})},A}(ce),le=function(t,A){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:[];Zt(this,A);for(var i=e.length-1;i>=0;i--)if(e[i].selected){le(e,e[i]);break}var n=$t(this,t.call(this,e));return n.changing_=!1,Object.defineProperty(n,"selectedIndex",{get:function(){for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:[];Zt(this,t),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var e=0,i=A.length;e0&&void 0!==arguments[0]?arguments[0]:{};Zt(this,A);var i=$t(this,t.call(this)),n={id:e.id||"vjs_track_"+v(),kind:e.kind||"",label:e.label||"",language:e.language||""};for(var r in n)!function(t){Object.defineProperty(i,t,{get:function(){return n[t]},set:function(){}})}(r);return i}return _t(A,t),A}(DA),we=function(t){var A=["protocol","hostname","port","pathname","search","hash","host"],e=Gt.createElement("a");e.href=t;var i=""===e.host&&"file:"!==e.protocol,n=void 0;i&&((n=Gt.createElement("div")).innerHTML='',e=n.firstChild,n.setAttribute("style","display:none; position:absolute;"),Gt.body.appendChild(n));for(var r={},o=0;ox',t=A.firstChild.href}return t},pe=function(t){if("string"==typeof t){var A=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(t);if(A)return A.pop().toLowerCase()}return""},Se=function(t){var A=zt.location,e=we(t);return(":"===e.protocol?A.protocol:e.protocol)+e.host!==A.protocol+A.host},Le=Object.freeze({parseUrl:we,getAbsoluteURL:me,getFileExtension:pe,isCrossOrigin:Se}),je=function(t){var A=xe.call(t);return"[object Function]"===A||"function"==typeof t&&"[object RegExp]"!==A||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)},xe=Object.prototype.toString,Ye=Object.freeze({default:je,__moduleExports:je}),Ue=t(function(t,A){(A=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},A.right=function(t){return t.replace(/\s*$/,"")}}),Oe=Ue.left,ve=Ue.right,ke=Object.freeze({default:Ue,__moduleExports:Ue,left:Oe,right:ve}),ze=Ye&&je||Ye,Fe=function(t,A,e){if(!ze(A))throw new TypeError("iterator must be a function");arguments.length<3&&(e=this),"[object Array]"===be.call(t)?function(t,A,e){for(var i=0,n=t.length;i0&&(zt.console&&zt.console.groupCollapsed&&zt.console.groupCollapsed("Text Track parsing errors for "+A.src),i.forEach(function(t){return Vt.error(t)}),zt.console&&zt.console.groupEnd&&zt.console.groupEnd()),e.flush()},ti=function(t,A){var e={uri:t},i=Se(t);i&&(e.cors=i),_e(e,CA(this,function(t,e,i){if(t)return Vt.error(t,e);if(A.loaded_=!0,"function"!=typeof zt.WebVTT){if(A.tech_){var n=function(){return $e(i,A)};A.tech_.on("vttjsloaded",n),A.tech_.on("vttjserror",function(){Vt.error("vttjs failed to load, stopping trying to process "+A.src),A.tech_.off("vttjsloaded",n)})}}else $e(i,A)}))},Ai=function(t){function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Zt(this,A),!e.tech)throw new Error("A tech was not provided.");var i=Z(e,{kind:Be[e.kind]||"subtitles",language:e.language||e.srclang||""}),n=fe[i.mode]||"disabled",r=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(n="hidden");var o=$t(this,t.call(this,i));o.tech_=i.tech,o.cues_=[],o.activeCues_=[];var a=new Ne(o.cues_),s=new Ne(o.activeCues_),g=!1,M=CA(o,function(){this.activeCues=this.activeCues,g&&(this.trigger("cuechange"),g=!1)});return"disabled"!==n&&o.tech_.ready(function(){o.tech_.on("timeupdate",M)},!0),Object.defineProperties(o,{default:{get:function(){return r},set:function(){}},mode:{get:function(){return n},set:function(t){var A=this;fe[t]&&("disabled"!==(n=t)?this.tech_.ready(function(){A.tech_.on("timeupdate",M)},!0):this.tech_.off("timeupdate",M),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?a:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return s;for(var t=this.tech_.currentTime(),A=[],e=0,i=this.cues.length;e=t?A.push(n):n.startTime===n.endTime&&n.startTime<=t&&n.startTime+.5>=t&&A.push(n)}if(g=!1,A.length!==this.activeCues_.length)g=!0;else for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};Zt(this,A);var i=Z(e,{kind:ye[e.kind]||""}),n=$t(this,t.call(this,i)),r=!1;return Object.defineProperty(n,"enabled",{get:function(){return r},set:function(t){"boolean"==typeof t&&t!==r&&(r=t,this.trigger("enabledchange"))}}),i.enabled&&(n.enabled=i.enabled),n.loaded_=!0,n}return _t(A,t),A}(Qe),ii=function(t){function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Zt(this,A);var i=Z(e,{kind:De[e.kind]||""}),n=$t(this,t.call(this,i)),r=!1;return Object.defineProperty(n,"selected",{get:function(){return r},set:function(t){"boolean"==typeof t&&t!==r&&(r=t,this.trigger("selectedchange"))}}),i.selected&&(n.selected=i.selected),n}return _t(A,t),A}(Qe),ni=0,ri=2,oi=function(t){function A(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Zt(this,A);var i=$t(this,t.call(this)),n=void 0,r=new Ai(e);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(i,{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=ni,r.addEventListener("loadeddata",function(){n=ri,i.trigger({type:"load",target:i})}),i}return _t(A,t),A}(DA);oi.prototype.allowedEvents_={load:"load"},oi.NONE=ni,oi.LOADING=1,oi.LOADED=ri,oi.ERROR=3;var ai={audio:{ListClass:he,TrackClass:ei,capitalName:"Audio"},video:{ListClass:de,TrackClass:ii,capitalName:"Video"},text:{ListClass:Ce,TrackClass:Ai,capitalName:"Text"}};Object.keys(ai).forEach(function(t){ai[t].getterName=t+"Tracks",ai[t].privateName=t+"Tracks_"});var si={remoteText:{ListClass:Ce,TrackClass:Ai,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Te,TrackClass:oi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gi=Z(ai,si);si.names=Object.keys(si),ai.names=Object.keys(ai),gi.names=[].concat(si.names).concat(ai.names);var Mi=Object.create||function(){function t(){}return function(A){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return t.prototype=A,new t}}();st.prototype=Mi(Error.prototype),st.prototype.constructor=st,st.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Mt.prototype={set:function(t,A){this.get(t)||""===A||(this.values[t]=A)},get:function(t,A,e){return e?this.has(t)?this.values[t]:A[e]:this.has(t)?this.values[t]:A},has:function(t){return t in this.values},alt:function(t,A,e){for(var i=0;i=0&&A<=100)&&(this.set(t,A),!0)}};var Ii={"&":"&","<":"<",">":">","":"","":""," ":" "},ci={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ui={v:"title",lang:"lang"},Ei={rt:"ruby"},hi=[[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]];ht.prototype.applyStyles=function(t,A){for(var e in A=A||this.div,t)t.hasOwnProperty(e)&&(A.style[e]=t[e])},ht.prototype.formatStyle=function(t,A){return 0===t?0:t+A},lt.prototype=Mi(ht.prototype),lt.prototype.constructor=lt,dt.prototype.move=function(t,A){switch(A=void 0!==A?A:this.lineHeight,t){case"+x":this.left+=A,this.right+=A;break;case"-x":this.left-=A,this.right-=A;break;case"+y":this.top+=A,this.bottom+=A;break;case"-y":this.top-=A,this.bottom-=A}},dt.prototype.overlaps=function(t){return this.leftt.left&&this.topt.top},dt.prototype.overlapsAny=function(t){for(var A=0;A=t.top&&this.bottom<=t.bottom&&this.left>=t.left&&this.right<=t.right},dt.prototype.overlapsOppositeAxis=function(t,A){switch(A){case"+x":return this.leftt.right;case"+y":return this.topt.bottom}},dt.prototype.intersectPercentage=function(t){return Math.max(0,Math.min(this.right,t.right)-Math.max(this.left,t.left))*Math.max(0,Math.min(this.bottom,t.bottom)-Math.max(this.top,t.top))/(this.height*this.width)},dt.prototype.toCSSCompatValues=function(t){return{top:this.top-t.top,bottom:t.bottom-this.bottom,left:this.left-t.left,right:t.right-this.right,height:this.height,width:this.width}},dt.getSimpleBoxPosition=function(t){var A=t.div?t.div.offsetHeight:t.tagName?t.offsetHeight:0,e=t.div?t.div.offsetWidth:t.tagName?t.offsetWidth:0,i=t.div?t.div.offsetTop:t.tagName?t.offsetTop:0;return{left:(t=t.div?t.div.getBoundingClientRect():t.tagName?t.getBoundingClientRect():t).left,right:t.right,top:t.top||i,height:t.height||A,bottom:t.bottom||i+(t.height||A),width:t.width||e}},Tt.StringDecoder=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}},Tt.convertCueToDOMTree=function(t,A){return t&&A?ut(t,A):null},Tt.processCues=function(t,A,e){if(!t||!A||!e)return null;for(;e.firstChild;)e.removeChild(e.firstChild);var i=t.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",e.appendChild(i),function(t){for(var A=0;A0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};Zt(this,A),e.reportTouchActivity=!1;var n=$t(this,t.call(this,null,e,i));return n.hasStarted_=!1,n.on("playing",function(){this.hasStarted_=!0}),n.on("loadstart",function(){this.hasStarted_=!1}),gi.names.forEach(function(t){var A=gi[t];e&&e[A.getterName]&&(n[A.privateName]=e[A.getterName])}),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){!1===e["native"+t+"Tracks"]&&(n["featuresNative"+t+"Tracks"]=!1)}),!1===e.nativeCaptions||!1===e.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.autoRemoteTextTracks_=new gi.text.ListClass,n.initTrackListeners(),e.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}return _t(A,t),A.prototype.triggerSourceset=function(t){var A=this;this.isReady_||this.one("ready",function(){return A.setTimeout(function(){return A.triggerSourceset(t)},1)}),this.trigger({src:t,type:"sourceset"})},A.prototype.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},A.prototype.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},A.prototype.trackProgress=function(t){this.stopTrackingProgress(),this.progressInterval=this.setInterval(CA(this,function(){var t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,1===t&&this.stopTrackingProgress()}),500)},A.prototype.onDurationChange=function(t){this.duration_=this.duration()},A.prototype.buffered=function(){return tt(0,0)},A.prototype.bufferedPercent=function(){return At(this.buffered(),this.duration_)},A.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},A.prototype.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},A.prototype.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},A.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},A.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},A.prototype.dispose=function(){this.clearTracks(ai.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),t.prototype.dispose.call(this)},A.prototype.clearTracks=function(t){var A=this;(t=[].concat(t)).forEach(function(t){for(var e=A[t+"Tracks"]()||[],i=e.length;i--;){var n=e[i];"text"===t&&A.removeRemoteTextTrack(n),e.removeTrack(n)}})},A.prototype.cleanupAutoTextTracks=function(){for(var t=this.autoRemoteTextTracks_||[],A=t.length;A--;){var e=t[A];this.removeRemoteTextTrack(e)}},A.prototype.reset=function(){},A.prototype.error=function(t){return void 0!==t&&(this.error_=new et(t),this.trigger("error")),this.error_},A.prototype.played=function(){return this.hasStarted_?tt(0,0):tt()},A.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},A.prototype.initTrackListeners=function(){var t=this;ai.names.forEach(function(A){var e=ai[A],i=function(){t.trigger(A+"trackchange")},n=t[e.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),t.on("dispose",function(){n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})},A.prototype.addWebVttScript_=function(){var t=this;if(!zt.WebVTT)if(Gt.body.contains(this.el())){if(!this.options_["vtt.js"]&&r(Si)&&Object.keys(Si).length>0)return void this.trigger("vttjsloaded");var A=Gt.createElement("script");A.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",A.onload=function(){t.trigger("vttjsloaded")},A.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){A.onload=null,A.onerror=null}),zt.WebVTT=!0,this.el().parentNode.appendChild(A)}else this.ready(this.addWebVttScript_)},A.prototype.emulateTextTracks=function(){var t=this,A=this.textTracks(),e=this.remoteTextTracks(),i=function(t){return A.addTrack(t.track)},n=function(t){return A.removeTrack(t.track)};e.on("addtrack",i),e.on("removetrack",n),this.addWebVttScript_();var r=function(){return t.trigger("texttrackchange")},o=function(){r();for(var t=0;t4&&void 0!==arguments[4]?arguments[4]:{},r=t.textTracks();n.kind=A,e&&(n.label=e),i&&(n.language=i),n.tech=t;var o=new gi.text.TrackClass(n);return r.addTrack(o),o}(this,t,A,e)},A.prototype.createRemoteTextTrack=function(t){var A=Z(t,{tech:this});return new si.remoteTextEl.TrackClass(A)},A.prototype.addRemoteTextTrack=function(){var t=this,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],i=this.createRemoteTextTrack(A);return!0!==e&&!1!==e&&(Vt.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),e=!0),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!0!==e&&this.ready(function(){return t.autoRemoteTextTracks_.addTrack(i.track)}),i},A.prototype.removeRemoteTextTrack=function(t){var A=this.remoteTextTrackEls().getTrackElementByTrack_(t);this.remoteTextTrackEls().removeTrackElement_(A),this.remoteTextTracks().removeTrack(t),this.autoRemoteTextTracks_.removeTrack(t)},A.prototype.getVideoPlaybackQuality=function(){return{}},A.prototype.setPoster=function(){},A.prototype.playsinline=function(){},A.prototype.setPlaysinline=function(){},A.prototype.overrideNativeAudioTracks=function(){},A.prototype.overrideNativeVideoTracks=function(){},A.prototype.canPlayType=function(){return""},A.canPlayType=function(){return""},A.canPlaySource=function(t,e){return A.canPlayType(t.type)},A.isTech=function(t){return t.prototype instanceof A||t instanceof A||t===A},A.registerTech=function(t,e){if(A.techs_||(A.techs_={}),!A.isTech(e))throw new Error("Tech "+t+" must be a Tech");if(!A.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!A.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=X(t),A.techs_[t]=e,"Tech"!==t&&A.defaultTechOrder_.push(t),e},A.getTech=function(t){if(t)return t=X(t),A.techs_&&A.techs_[t]?A.techs_[t]:zt&&zt.videojs&&zt.videojs[t]?(Vt.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),zt.videojs[t]):void 0},A}(xA));gi.names.forEach(function(t){var A=gi[t];Li.prototype[A.getterName]=function(){return this[A.privateName]=this[A.privateName]||new A.ListClass,this[A.privateName]}}),Li.prototype.featuresVolumeControl=!0,Li.prototype.featuresMuteControl=!0,Li.prototype.featuresFullscreenResize=!1,Li.prototype.featuresPlaybackRate=!1,Li.prototype.featuresProgressEvents=!1,Li.prototype.featuresSourceset=!1,Li.prototype.featuresTimeupdateEvents=!1,Li.prototype.featuresNativeTextTracks=!1,Li.withSourceHandlers=function(t){t.registerSourceHandler=function(A,e){var i=t.sourceHandlers;i||(i=t.sourceHandlers=[]),void 0===e&&(e=i.length),i.splice(e,0,A)},t.canPlayType=function(A){for(var e=t.sourceHandlers||[],i=void 0,n=0;n0&&void 0!==arguments[0]?arguments[0]:"",A=pe(t);return ki[A.toLowerCase()]||""},Fi=function(t){function A(e,i,n){Zt(this,A);var r=Z({createEl:!1},i),o=$t(this,t.call(this,e,r,n));if(i.playerOptions.sources&&0!==i.playerOptions.sources.length)e.src(i.playerOptions.sources);else for(var a=0,s=i.playerOptions.techOrder;a0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e=i({innerHTML:'',className:this.buildCSSClass(),tabIndex:0},e),"button"===A&&Vt.error("Creating a ClickableComponent with an HTML element of "+A+" is not supported; use a Button instead."),n=i({role:"button"},n),this.tabIndex_=e.tabIndex;var r=t.prototype.createEl.call(this,A,e,n);return this.createControlTextEl(r),r},A.prototype.dispose=function(){this.controlTextEl_=null,t.prototype.dispose.call(this)},A.prototype.createControlTextEl=function(t){return this.controlTextEl_=u("span",{className:"vjs-control-text"},{"aria-live":"polite"}),t&&t.appendChild(this.controlTextEl_),this.controlText(this.controlText_,t),this.controlTextEl_},A.prototype.controlText=function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(void 0===t)return this.controlText_||"Need Text";var e=this.localize(t);this.controlText_=t,E(this.controlTextEl_,e),this.nonIconControl||A.setAttribute("title",e)},A.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+t.prototype.buildCSSClass.call(this)},A.prototype.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("focus",this.handleFocus),this.on("blur",this.handleBlur))},A.prototype.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(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur)},A.prototype.handleClick=function(t){},A.prototype.handleFocus=function(t){G(Gt,"keydown",CA(this,this.handleKeyPress))},A.prototype.handleKeyPress=function(A){32===A.which||13===A.which?(A.preventDefault(),this.trigger("click")):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,A)},A.prototype.handleBlur=function(t){K(Gt,"keydown",CA(this,this.handleKeyPress))},A}(xA);xA.registerComponent("ClickableComponent",bi);var Ri=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.update(),e.on("posterchange",CA(n,n.update)),n}return _t(A,t),A.prototype.dispose=function(){this.player().off("posterchange",this.update),t.prototype.dispose.call(this)},A.prototype.createEl=function(){return u("div",{className:"vjs-poster",tabIndex:-1})},A.prototype.update=function(t){var A=this.player().poster();this.setSrc(A),A?this.show():this.hide()},A.prototype.setSrc=function(t){var A="";t&&(A='url("'+t+'")'),this.el_.style.backgroundImage=A},A.prototype.handleClick=function(t){this.player_.controls()&&(this.player_.paused()?nt(this.player_.play()):this.player_.pause())},A}(bi);xA.registerComponent("PosterImage",Ri);var Ji={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'},Gi=function(t){function A(e,i,n){Zt(this,A);var r=$t(this,t.call(this,e,i,n)),o=CA(r,r.updateDisplay);return e.on("loadstart",CA(r,r.toggleDisplay)),e.on("texttrackchange",o),e.on("loadstart",CA(r,r.preselectTrack)),e.ready(CA(r,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)this.hide();else{e.on("fullscreenchange",o),e.on("playerresize",o),zt.addEventListener("orientationchange",o),e.on("dispose",function(){return zt.removeEventListener("orientationchange",o)});for(var t=this.options_.playerOptions.tracks||[],A=0;A1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t="button",A=i({innerHTML:'',className:this.buildCSSClass()},A),e=i({type:"button"},e);var n=xA.prototype.createEl.call(this,t,A,e);return this.createControlTextEl(n),n},A.prototype.addChild=function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=this.constructor.name;return Vt.warn("Adding an actionable (user controllable) child to a Button ("+e+") is not supported; use a ClickableComponent instead."),xA.prototype.addChild.call(this,t,A)},A.prototype.enable=function(){t.prototype.enable.call(this),this.el_.removeAttribute("disabled")},A.prototype.disable=function(){t.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},A.prototype.handleKeyPress=function(A){32!==A.which&&13!==A.which&&t.prototype.handleKeyPress.call(this,A)},A}(bi);xA.registerComponent("Button",Hi);var Pi=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.mouseused_=!1,n.on("mousedown",n.handleMouseDown),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-big-play-button"},A.prototype.handleClick=function(t){var A=this.player_.play();if(this.mouseused_&&t.clientX&&t.clientY)nt(A);else{var e=this.player_.getChild("controlBar"),i=e&&e.getChild("playToggle");if(i){var n=function(){return i.focus()};it(A)?A.then(n,function(){}):this.setTimeout(n,1)}else this.player_.focus()}},A.prototype.handleKeyPress=function(A){this.mouseused_=!1,t.prototype.handleKeyPress.call(this,A)},A.prototype.handleMouseDown=function(t){this.mouseused_=!0},A}(Hi);Pi.prototype.controlText_="Play Video",xA.registerComponent("BigPlayButton",Pi);var Wi=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.controlText(i&&i.controlText||n.localize("Close")),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-close-button "+t.prototype.buildCSSClass.call(this)},A.prototype.handleClick=function(t){this.trigger({type:"close",bubbles:!1})},A}(Hi);xA.registerComponent("CloseButton",Wi);var Vi=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"play",n.handlePlay),n.on(e,"pause",n.handlePause),n.on(e,"ended",n.handleEnded),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-play-control "+t.prototype.buildCSSClass.call(this)},A.prototype.handleClick=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},A.prototype.handleSeeked=function(t){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(t):this.handlePlay(t)},A.prototype.handlePlay=function(t){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},A.prototype.handlePause=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},A.prototype.handleEnded=function(t){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",this.handleSeeked)},A}(Hi);Vi.prototype.controlText_="Play",xA.registerComponent("PlayToggle",Vi);var qi=function(t,A){t=t<0?0:t;var e=Math.floor(t%60),i=Math.floor(t/60%60),n=Math.floor(t/3600),r=Math.floor(A/60%60),o=Math.floor(A/3600);return(isNaN(t)||t===1/0)&&(n=i=e="-"),(n=n>0||o>0?n+":":"")+(i=((n||r>=10)&&i<10?"0"+i:i)+":")+(e=e<10?"0"+e:e)},Xi=qi,Zi=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.throttledUpdateContent=TA(CA(n,n.updateContent),25),n.on(e,"timeupdate",n.throttledUpdateContent),n}return _t(A,t),A.prototype.createEl=function(A){var e=this.buildCSSClass(),i=t.prototype.createEl.call(this,"div",{className:e+" vjs-time-control vjs-control",innerHTML:''+this.localize(this.labelText_)+" "});return this.contentEl_=u("span",{className:e+"-display"},{"aria-live":"off"}),this.updateTextNode_(),i.appendChild(this.contentEl_),i},A.prototype.dispose=function(){this.contentEl_=null,this.textNode_=null,t.prototype.dispose.call(this)},A.prototype.updateTextNode_=function(){if(this.contentEl_){for(;this.contentEl_.firstChild;)this.contentEl_.removeChild(this.contentEl_.firstChild);this.textNode_=Gt.createTextNode(this.formattedTime_||this.formatTime_(0)),this.contentEl_.appendChild(this.textNode_)}},A.prototype.formatTime_=function(t){return St(t)},A.prototype.updateFormattedTime_=function(t){var A=this.formatTime_(t);A!==this.formattedTime_&&(this.formattedTime_=A,this.requestAnimationFrame(this.updateTextNode_))},A.prototype.updateContent=function(t){},A}(xA);Zi.prototype.labelText_="Time",Zi.prototype.controlText_="Time",xA.registerComponent("TimeDisplay",Zi);var _i=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"ended",n.handleEnded),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-current-time"},A.prototype.updateContent=function(t){var A=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(A)},A.prototype.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(this.player_.duration())},A}(Zi);_i.prototype.labelText_="Current Time",_i.prototype.controlText_="Current Time",xA.registerComponent("CurrentTimeDisplay",_i);var $i=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"durationchange",n.updateContent),n.on(e,"loadedmetadata",n.throttledUpdateContent),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-duration"},A.prototype.updateContent=function(t){var A=this.player_.duration();A&&this.duration_!==A&&(this.duration_=A,this.updateFormattedTime_(A))},A}(Zi);$i.prototype.labelText_="Duration",$i.prototype.controlText_="Duration",xA.registerComponent("DurationDisplay",$i);var tn=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"/
"})},A}(xA);xA.registerComponent("TimeDivider",tn);var An=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"durationchange",n.throttledUpdateContent),n.on(e,"ended",n.handleEnded),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-remaining-time"},A.prototype.formatTime_=function(A){return"-"+t.prototype.formatTime_.call(this,A)},A.prototype.updateContent=function(t){this.player_.duration()&&(this.player_.remainingTimeDisplay?this.updateFormattedTime_(this.player_.remainingTimeDisplay()):this.updateFormattedTime_(this.player_.remainingTime()))},A.prototype.handleEnded=function(t){this.player_.duration()&&this.updateFormattedTime_(0)},A}(Zi);An.prototype.labelText_="Remaining Time",An.prototype.controlText_="Remaining Time",xA.registerComponent("RemainingTimeDisplay",An);var en=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.updateShowing(),n.on(n.player(),"durationchange",n.updateShowing),n}return _t(A,t),A.prototype.createEl=function(){var A=t.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=u("div",{className:"vjs-live-display",innerHTML:''+this.localize("Stream Type")+" "+this.localize("LIVE")},{"aria-live":"off"}),A.appendChild(this.contentEl_),A},A.prototype.dispose=function(){this.contentEl_=null,t.prototype.dispose.call(this)},A.prototype.updateShowing=function(t){this.player().duration()===1/0?this.show():this.hide()},A}(xA);xA.registerComponent("LiveDisplay",en);var nn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}return _t(A,t),A.prototype.enabled=function(){return this.enabled_},A.prototype.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown),this.on("touchstart",this.handleMouseDown),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),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)},A.prototype.disable=function(){if(this.enabled()){var t=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown),this.off("touchstart",this.handleMouseDown),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.off("click",this.handleClick),this.off(this.player_,"controlsvisible",this.update),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},A.prototype.createEl=function(A){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.className=e.className+" vjs-slider",e=i({tabIndex:0},e),n=i({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),t.prototype.createEl.call(this,A,e,n)},A.prototype.handleMouseDown=function(t){var A=this.bar.el_.ownerDocument;"mousedown"===t.type&&t.preventDefault(),"touchstart"!==t.type||PA||t.preventDefault(),Q(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(A,"mousemove",this.handleMouseMove),this.on(A,"mouseup",this.handleMouseUp),this.on(A,"touchmove",this.handleMouseMove),this.on(A,"touchend",this.handleMouseUp),this.handleMouseMove(t)},A.prototype.handleMouseMove=function(t){},A.prototype.handleMouseUp=function(){var t=this.bar.el_.ownerDocument;w(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove),this.off(t,"mouseup",this.handleMouseUp),this.off(t,"touchmove",this.handleMouseMove),this.off(t,"touchend",this.handleMouseUp),this.update()},A.prototype.update=function(){if(this.el_){var t=this.getPercent(),A=this.bar;if(A){("number"!=typeof t||t!=t||t<0||t===1/0)&&(t=0);var e=(100*t).toFixed(2)+"%",i=A.el().style;return this.vertical()?i.height=e:i.width=e,t}}},A.prototype.calculateDistance=function(t){var A=S(this.el_,t);return this.vertical()?A.y:A.x},A.prototype.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},A.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepBack()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepForward())},A.prototype.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},A.prototype.handleClick=function(t){t.stopImmediatePropagation(),t.preventDefault()},A.prototype.vertical=function(t){if(void 0===t)return this.vertical_||!1;this.vertical_=!!t,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},A}(xA);xA.registerComponent("Slider",nn);var rn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.partEls_=[],n.on(e,"progress",n.update),n}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:''+this.localize("Loaded")+": 0%"})},A.prototype.dispose=function(){this.partEls_=null,t.prototype.dispose.call(this)},A.prototype.update=function(t){var A=this.player_.buffered(),e=this.player_.duration(),i=this.player_.bufferedEnd(),n=this.partEls_,r=function(t,A){var e=t/A||0;return 100*(e>=1?1:e)+"%"};this.el_.style.width=r(i,e);for(var o=0;oA.length;M--)this.el_.removeChild(n[M-1]);n.length=A.length},A}(xA);xA.registerComponent("LoadProgressBar",rn);var on=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"})},A.prototype.update=function(t,A,e){var i=m(this.el_),n=m(this.player_.el()),r=t.width*A;if(n&&i){var o=t.left-n.left+r,a=t.width-r+(n.right-t.right),s=i.width/2;oi.width&&(s=i.width),this.el_.style.right="-"+s+"px",E(this.el_,e)}},A}(xA);xA.registerComponent("TimeTooltip",on);var an=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:''+this.localize("Progress")+": 0%"})},A.prototype.update=function(t,A){var e=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var i=St(e.player_.scrubbing()?e.player_.getCache().currentTime:e.player_.currentTime(),e.player_.duration()),n=e.getChild("timeTooltip");n&&n.update(t,A,i)})},A}(xA);an.prototype.options_={children:[]},FA||RA||an.prototype.options_.children.push("timeTooltip"),xA.registerComponent("PlayProgressBar",an);var sn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.update=TA(CA(n,n.update),25),n}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},A.prototype.update=function(t,A){var e=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_),this.rafId_=this.requestAnimationFrame(function(){var i=e.player_.duration(),n=St(A*i,i);e.el_.style.left=t.width*A+"px",e.getChild("timeTooltip").update(t,A,n)})},A}(xA);sn.prototype.options_={children:["timeTooltip"]},xA.registerComponent("MouseTimeDisplay",sn);var gn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.setEventHandlers_(),n}return _t(A,t),A.prototype.setEventHandlers_=function(){var t=this;this.update=TA(CA(this,this.update),30),this.on(this.player_,"timeupdate",this.update),this.on(this.player_,"ended",this.handleEnded),this.updateInterval=null,this.on(this.player_,["playing"],function(){t.clearInterval(t.updateInterval),t.updateInterval=t.setInterval(function(){t.requestAnimationFrame(function(){t.update()})},30)}),this.on(this.player_,["ended","pause","waiting"],function(){t.clearInterval(t.updateInterval)}),this.on(this.player_,["timeupdate","ended"],this.update)},A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},A.prototype.update_=function(t,A){var e=this.player_.duration();this.el_.setAttribute("aria-valuenow",(100*A).toFixed(2)),this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[St(t,e),St(e,e)],"{1} of {2}")),this.bar.update(m(this.el_),A)},A.prototype.update=function(A){var e=t.prototype.update.call(this);return this.update_(this.getCurrentTime_(),e),e},A.prototype.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},A.prototype.handleEnded=function(t){this.update_(this.player_.duration(),1)},A.prototype.getPercent=function(){var t=this.getCurrentTime_()/this.player_.duration();return t>=1?1:t||0},A.prototype.handleMouseDown=function(A){O(A)&&(A.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),t.prototype.handleMouseDown.call(this,A))},A.prototype.handleMouseMove=function(t){if(O(t)){var A=this.calculateDistance(t)*this.player_.duration();A===this.player_.duration()&&(A-=.1),this.player_.currentTime(A)}},A.prototype.enable=function(){t.prototype.enable.call(this);var A=this.getChild("mouseTimeDisplay");A&&A.show()},A.prototype.disable=function(){t.prototype.disable.call(this);var A=this.getChild("mouseTimeDisplay");A&&A.hide()},A.prototype.handleMouseUp=function(A){t.prototype.handleMouseUp.call(this,A),A&&A.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying&&nt(this.player_.play())},A.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},A.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},A.prototype.handleAction=function(t){this.player_.paused()?this.player_.play():this.player_.pause()},A.prototype.handleKeyPress=function(A){32===A.which||13===A.which?(A.preventDefault(),this.handleAction(A)):t.prototype.handleKeyPress&&t.prototype.handleKeyPress.call(this,A)},A}(nn);gn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},FA||RA||gn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),gn.prototype.playerEvent="timeupdate",xA.registerComponent("SeekBar",gn);var Mn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.handleMouseMove=TA(CA(n,n.handleMouseMove),25),n.throttledHandleMouseSeek=TA(CA(n,n.handleMouseSeek),25),n.enable(),n}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},A.prototype.handleMouseMove=function(t){var A=this.getChild("seekBar");if(A){var e=A.getChild("mouseTimeDisplay"),i=A.el(),n=m(i),r=S(i,t).x;r>1?r=1:r<0&&(r=0),e&&e.update(n,r)}},A.prototype.handleMouseSeek=function(t){var A=this.getChild("seekBar");A&&A.handleMouseMove(t)},A.prototype.enabled=function(){return this.enabled_},A.prototype.disable=function(){this.children().forEach(function(t){return t.disable&&t.disable()}),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},A.prototype.enable=function(){this.children().forEach(function(t){return t.enable&&t.enable()}),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDown),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},A.prototype.handleMouseDown=function(t){var A=this.el_.ownerDocument,e=this.getChild("seekBar");e&&e.handleMouseDown(t),this.on(A,"mousemove",this.throttledHandleMouseSeek),this.on(A,"touchmove",this.throttledHandleMouseSeek),this.on(A,"mouseup",this.handleMouseUp),this.on(A,"touchend",this.handleMouseUp)},A.prototype.handleMouseUp=function(t){var A=this.el_.ownerDocument,e=this.getChild("seekBar");e&&e.handleMouseUp(t),this.off(A,"mousemove",this.throttledHandleMouseSeek),this.off(A,"touchmove",this.throttledHandleMouseSeek),this.off(A,"mouseup",this.handleMouseUp),this.off(A,"touchend",this.handleMouseUp)},A}(xA);Mn.prototype.options_={children:["seekBar"]},xA.registerComponent("ProgressControl",Mn);var In=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"fullscreenchange",n.handleFullscreenChange),!1===Gt[$A.fullscreenEnabled]&&n.disable(),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+t.prototype.buildCSSClass.call(this)},A.prototype.handleFullscreenChange=function(t){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},A.prototype.handleClick=function(t){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},A}(Hi);In.prototype.controlText_="Fullscreen",xA.registerComponent("FullscreenToggle",In);var cn=function(t,A){A.tech_&&!A.tech_.featuresVolumeControl&&t.addClass("vjs-hidden"),t.on(A,"loadstart",function(){A.tech_.featuresVolumeControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},un=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:''})},A}(xA);xA.registerComponent("VolumeLevel",un);var En=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on("slideractive",n.updateLastVolume_),n.on(e,"volumechange",n.updateARIAAttributes),e.ready(function(){return n.updateARIAAttributes()}),n}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},A.prototype.handleMouseDown=function(A){O(A)&&t.prototype.handleMouseDown.call(this,A)},A.prototype.handleMouseMove=function(t){O(t)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(t)))},A.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},A.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},A.prototype.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},A.prototype.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},A.prototype.updateARIAAttributes=function(t){var A=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",A),this.el_.setAttribute("aria-valuetext",A+"%")},A.prototype.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},A.prototype.updateLastVolume_=function(){var t=this,A=this.player_.volume();this.one("sliderinactive",function(){0===t.player_.volume()&&t.player_.lastVolume_(A)})},A}(nn);En.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},En.prototype.playerEvent="volumechange",xA.registerComponent("VolumeBar",En);var hn=function(t){function A(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt(this,A),i.vertical=i.vertical||!1,(void 0===i.volumeBar||r(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical);var n=$t(this,t.call(this,e,i));return cn(n,e),n.throttledHandleMouseMove=TA(CA(n,n.handleMouseMove),25),n.on("mousedown",n.handleMouseDown),n.on("touchstart",n.handleMouseDown),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}return _t(A,t),A.prototype.createEl=function(){var A="vjs-volume-horizontal";return this.options_.vertical&&(A="vjs-volume-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+A})},A.prototype.handleMouseDown=function(t){var A=this.el_.ownerDocument;this.on(A,"mousemove",this.throttledHandleMouseMove),this.on(A,"touchmove",this.throttledHandleMouseMove),this.on(A,"mouseup",this.handleMouseUp),this.on(A,"touchend",this.handleMouseUp)},A.prototype.handleMouseUp=function(t){var A=this.el_.ownerDocument;this.off(A,"mousemove",this.throttledHandleMouseMove),this.off(A,"touchmove",this.throttledHandleMouseMove),this.off(A,"mouseup",this.handleMouseUp),this.off(A,"touchend",this.handleMouseUp)},A.prototype.handleMouseMove=function(t){this.volumeBar.handleMouseMove(t)},A}(xA);hn.prototype.options_={children:["volumeBar"]},xA.registerComponent("VolumeControl",hn);var ln=function(t,A){A.tech_&&!A.tech_.featuresMuteControl&&t.addClass("vjs-hidden"),t.on(A,"loadstart",function(){A.tech_.featuresMuteControl?t.removeClass("vjs-hidden"):t.addClass("vjs-hidden")})},dn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return ln(n,e),n.on(e,["loadstart","volumechange"],n.update),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-mute-control "+t.prototype.buildCSSClass.call(this)},A.prototype.handleClick=function(t){var A=this.player_.volume(),e=this.player_.lastVolume_();if(0===A){var i=e<.1?.1:e;this.player_.volume(i),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},A.prototype.update=function(t){this.updateIcon_(),this.updateControlText_()},A.prototype.updateIcon_=function(){var t=this.player_.volume(),A=3;FA&&this.player_.muted(this.player_.tech_.el_.muted),0===t||this.player_.muted()?A=0:t<.33?A=1:t<.67&&(A=2);for(var e=0;e<4;e++)C(this.el_,"vjs-vol-"+e);d(this.el_,"vjs-vol-"+A)},A.prototype.updateControlText_=function(){var t=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)},A}(Hi);dn.prototype.controlText_="Mute",xA.registerComponent("MuteToggle",dn);var Cn=function(t){function A(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt(this,A),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||r(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline);var n=$t(this,t.call(this,e,i));return n.on(e,["loadstart"],n.volumePanelState_),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}return _t(A,t),A.prototype.sliderActive_=function(){this.addClass("vjs-slider-active")},A.prototype.sliderInactive_=function(){this.removeClass("vjs-slider-active")},A.prototype.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")},A.prototype.createEl=function(){var A="vjs-volume-panel-horizontal";return this.options_.inline||(A="vjs-volume-panel-vertical"),t.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+A})},A}(xA);Cn.prototype.options_={children:["muteToggle","volumeControl"]},xA.registerComponent("VolumePanel",Cn);var Tn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",n.handleKeyPress),n}return _t(A,t),A.prototype.addItem=function(t){this.addChild(t),t.on("click",CA(this,function(A){this.menuButton_&&(this.menuButton_.unpressButton(),"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus())}))},A.prototype.createEl=function(){var A=this.options_.contentElType||"ul";this.contentEl_=u(A,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var e=t.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return e.appendChild(this.contentEl_),G(e,"click",function(t){t.preventDefault(),t.stopImmediatePropagation()}),e},A.prototype.dispose=function(){this.contentEl_=null,t.prototype.dispose.call(this)},A.prototype.handleKeyPress=function(t){37===t.which||40===t.which?(t.preventDefault(),this.stepForward()):38!==t.which&&39!==t.which||(t.preventDefault(),this.stepBack())},A.prototype.stepForward=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_+1),this.focus(t)},A.prototype.stepBack=function(){var t=0;void 0!==this.focusedChild_&&(t=this.focusedChild_-1),this.focus(t)},A.prototype.focus=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,A=this.children().slice();A.length&&A[0].className&&/vjs-menu-title/.test(A[0].className)&&A.shift(),A.length>0&&(t<0?t=0:t>=A.length&&(t=A.length-1),this.focusedChild_=t,A[t].el_.focus())},A}(xA);xA.registerComponent("Menu",Tn);var Nn=function(t){function A(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt(this,A);var n=$t(this,t.call(this,e,i));n.menuButton_=new Hi(e,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Hi.prototype.buildCSSClass();return n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0,n.on(n.menuButton_,"tap",n.handleClick),n.on(n.menuButton_,"click",n.handleClick),n.on(n.menuButton_,"focus",n.handleFocus),n.on(n.menuButton_,"blur",n.handleBlur),n.on("keydown",n.handleSubmenuKeyPress),n}return _t(A,t),A.prototype.update=function(){var t=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=t,this.addChild(t),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},A.prototype.createMenu=function(){var t=new Tn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var A=u("li",{className:"vjs-menu-title",innerHTML:X(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,t.children_.unshift(A),h(A,t.contentEl())}if(this.items=this.createItems(),this.items)for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(t,A)},A.prototype.handleClick=function(t){this.one(this.menu.contentEl(),"mouseleave",CA(this,function(t){this.unpressButton(),this.el_.blur()})),this.buttonPressed_?this.unpressButton():this.pressButton()},A.prototype.focus=function(){this.menuButton_.focus()},A.prototype.blur=function(){this.menuButton_.blur()},A.prototype.handleFocus=function(){G(Gt,"keydown",CA(this,this.handleKeyPress))},A.prototype.handleBlur=function(){K(Gt,"keydown",CA(this,this.handleKeyPress))},A.prototype.handleKeyPress=function(t){27===t.which||9===t.which?(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus())):38!==t.which&&40!==t.which||this.buttonPressed_||(this.pressButton(),t.preventDefault())},A.prototype.handleSubmenuKeyPress=function(t){27!==t.which&&9!==t.which||(this.buttonPressed_&&this.unpressButton(),9!==t.which&&(t.preventDefault(),this.menuButton_.el_.focus()))},A.prototype.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),FA&&I())return;this.menu.focus()}},A.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},A.prototype.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},A.prototype.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},A}(xA);xA.registerComponent("MenuButton",Nn);var Dn=function(t){function A(e,i){Zt(this,A);var n=i.tracks,r=$t(this,t.call(this,e,i));if(r.items.length<=1&&r.hide(),!n)return $t(r);var o=CA(r,r.update);return n.addEventListener("removetrack",o),n.addEventListener("addtrack",o),r.player_.on("ready",o),r.player_.on("dispose",function(){n.removeEventListener("removetrack",o),n.removeEventListener("addtrack",o)}),r}return _t(A,t),A}(Nn);xA.registerComponent("TrackButton",Dn);var yn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.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}return _t(A,t),A.prototype.createEl=function(A,e,n){return this.nonIconControl=!0,t.prototype.createEl.call(this,"li",i({className:"vjs-menu-item",innerHTML:'",tabIndex:-1},e),n)},A.prototype.handleClick=function(t){this.selected(!0)},A.prototype.selected=function(t){this.selectable&&(t?(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))},A}(bi);xA.registerComponent("MenuItem",yn);var Bn=function(t){function A(e,i){Zt(this,A);var n=i.track,r=e.textTracks();i.label=n.label||n.language||"Unknown",i.selected="showing"===n.mode;var o=$t(this,t.call(this,e,i));o.track=n;var a=function(){for(var t=arguments.length,A=Array(t),e=0;e-1?"showing"!==o.mode&&(o.mode="showing"):"disabled"!==o.mode&&(o.mode="disabled")}},A.prototype.handleTracksChange=function(t){var A="showing"===this.track.mode;A!==this.isSelected_&&this.selected(A)},A.prototype.handleSelectedLanguageChange=function(t){if("showing"===this.track.mode){var A=this.player_.cache_.selectedLanguage;if(A&&A.enabled&&A.language===this.track.language&&A.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},A.prototype.dispose=function(){this.track=null,t.prototype.dispose.call(this)},A}(yn);xA.registerComponent("TextTrackMenuItem",Bn);var fn=function(t){function A(e,i){return Zt(this,A),i.track={player:e,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,$t(this,t.call(this,e,i))}return _t(A,t),A.prototype.handleTracksChange=function(t){for(var A=this.player().textTracks(),e=!0,i=0,n=A.length;i-1&&"showing"===r.mode){e=!1;break}}e!==this.isSelected_&&this.selected(e)},A.prototype.handleSelectedLanguageChange=function(t){for(var A=this.player().textTracks(),e=!0,i=0,n=A.length;i-1&&"showing"===r.mode){e=!1;break}}e&&(this.player_.cache_.selectedLanguage={enabled:!1})},A}(Bn);xA.registerComponent("OffTextTrackMenuItem",fn);var Qn=function(t){function A(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Zt(this,A),i.tracks=e.textTracks(),$t(this,t.call(this,e,i))}return _t(A,t),A.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bn,e=void 0;this.label_&&(e=this.label_+" off"),t.push(new fn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:e})),this.hideThreshold_+=1;var i=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var n=0;n-1){var o=new A(this.player_,{track:r,selectable:!0,multiSelectable:!1});o.addClass("vjs-"+r.kind+"-menu-item"),t.push(o)}}return t},A}(Dn);xA.registerComponent("TextTrackButton",Qn);var wn=function(t){function A(e,i){Zt(this,A);var n=i.track,r=i.cue,o=e.currentTime();i.selectable=!0,i.multiSelectable=!1,i.label=r.text,i.selected=r.startTime<=o&&o=0;A--){var e=t[A];if(e.kind===this.kind_)return e}},A.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(X(this.kind_))},A.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),t.prototype.createMenu.call(this)},A.prototype.createItems=function(){var t=[];if(!this.track_)return t;var A=this.track_.cues;if(!A)return t;for(var e=0,i=A.length;e\n '+this.localize("Captions")+"\n "),r+="",t.prototype.createEl.call(this,A,i({innerHTML:r},e),n)},A}(Bn);xA.registerComponent("SubsCapsMenuItem",xn);var Yn=function(t){function A(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt(this,A);var n=$t(this,t.call(this,e,i));return n.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(X(n.label_)),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildCSSClass.call(this)},A.prototype.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+t.prototype.buildWrapperCSSClass.call(this)},A.prototype.createItems=function(){var A=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(A.push(new Ln(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t.prototype.createItems.call(this,A,xn)},A}(Qn);Yn.prototype.kinds_=["captions","subtitles"],Yn.prototype.controlText_="Subtitles",xA.registerComponent("SubsCapsButton",Yn);var Un=function(t){function A(e,i){Zt(this,A);var n=i.track,r=e.audioTracks();i.label=n.label||n.language||"Unknown",i.selected=n.enabled;var o=$t(this,t.call(this,e,i));o.track=n,o.addClass("vjs-"+n.kind+"-menu-item");var a=function(){for(var t=arguments.length,A=Array(t),e=0;e\n '+this.localize("Descriptions")+"\n "),r+="",t.prototype.createEl.call(this,A,i({innerHTML:r},e),n)},A.prototype.handleClick=function(A){var e=this.player_.audioTracks();t.prototype.handleClick.call(this,A);for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};return Zt(this,A),i.tracks=e.audioTracks(),$t(this,t.call(this,e,i))}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-audio-button "+t.prototype.buildCSSClass.call(this)},A.prototype.buildWrapperCSSClass=function(){return"vjs-audio-button "+t.prototype.buildWrapperCSSClass.call(this)},A.prototype.createItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;for(var A=this.player_.audioTracks(),e=0;e=0;e--)t.addChild(new vn(this.player(),{rate:A[e]+"x"}));return t},A.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},A.prototype.handleClick=function(t){for(var A=this.player().playbackRate(),e=this.playbackRates(),i=e[0],n=0;nA){i=e[n];break}this.player().playbackRate(i)},A.prototype.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},A.prototype.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},A.prototype.updateVisibility=function(t){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},A.prototype.updateLabel=function(t){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},A}(Nn);kn.prototype.controlText_="Playback Rate",xA.registerComponent("PlaybackRateMenuButton",kn);var zn=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-spacer "+t.prototype.buildCSSClass.call(this)},A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},A}(xA);xA.registerComponent("Spacer",zn);var Fn=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-custom-control-spacer "+t.prototype.buildCSSClass.call(this)},A.prototype.createEl=function(){var A=t.prototype.createEl.call(this,{className:this.buildCSSClass()});return A.innerHTML=" ",A},A}(zn);xA.registerComponent("CustomControlSpacer",Fn);var bn=function(t){function A(){return Zt(this,A),$t(this,t.apply(this,arguments))}return _t(A,t),A.prototype.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},A}(xA);bn.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},xA.registerComponent("ControlBar",bn);var Rn=function(t){function A(e,i){Zt(this,A);var n=$t(this,t.call(this,e,i));return n.on(e,"error",n.open),n}return _t(A,t),A.prototype.buildCSSClass=function(){return"vjs-error-display "+t.prototype.buildCSSClass.call(this)},A.prototype.content=function(){var t=this.player().error();return t?this.localize(t.message):""},A}(Ie);Rn.prototype.options_=Z(Ie.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),xA.registerComponent("ErrorDisplay",Rn);var Jn=["#000","Black"],Gn=["#00F","Blue"],Kn=["#0FF","Cyan"],Hn=["#0F0","Green"],Pn=["#F0F","Magenta"],Wn=["#F00","Red"],Vn=["#FFF","White"],qn=["#FF0","Yellow"],Xn=["1","Opaque"],Zn=["0.5","Semi-Transparent"],_n=["0","Transparent"],$n={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Jn,Vn,Wn,Hn,Gn,qn,Pn,Kn]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Xn,Zn,_n]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Vn,Jn,Wn,Hn,Gn,qn,Pn,Kn]},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(t){return"1.00"===t?null:Number(t)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Xn,Zn]},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:[_n,Zn,Xn]}};$n.windowColor.options=$n.backgroundColor.options;var tr=function(t){function A(i,n){Zt(this,A),n.temporary=!1;var r=$t(this,t.call(this,i,n));return r.updateDisplay=CA(r,r.updateDisplay),r.fill(),r.hasBeenOpened_=r.hasBeenFilled_=!0,r.endDialog=u("p",{className:"vjs-control-text",textContent:r.localize("End of dialog window.")}),r.el().appendChild(r.endDialog),r.setDefaults(),void 0===n.persistTextTrackSettings&&(r.options_.persistTextTrackSettings=r.options_.playerOptions.persistTextTrackSettings),r.on(r.$(".vjs-done-button"),"click",function(){r.saveSettings(),r.close()}),r.on(r.$(".vjs-default-button"),"click",function(){r.setDefaults(),r.updateDisplay()}),e($n,function(t){r.on(r.$(t.selector),"change",r.updateDisplay)}),r.options_.persistTextTrackSettings&&r.restoreSettings(),r}return _t(A,t),A.prototype.dispose=function(){this.endDialog=null,t.prototype.dispose.call(this)},A.prototype.createElSelect_=function(t){var A=this,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"label",n=$n[t],r=n.id.replace("%s",this.id_),o=[e,r].join(" ").trim();return["<"+i+' id="'+r+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(n.label),""+i+">",'").join("")},A.prototype.createElFgColor_=function(){var t="captions-text-legend-"+this.id_;return['"].join("")},A.prototype.createElBgColor_=function(){var t="captions-background-"+this.id_;return['"].join("")},A.prototype.createElWinColor_=function(){var t="captions-window-"+this.id_;return['"].join("")},A.prototype.createElColors_=function(){return u("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},A.prototype.createElFont_=function(){return u("div",{className:"vjs-track-settings-font",innerHTML:['",'",'"].join("")})},A.prototype.createElControls_=function(){var t=this.localize("restore all settings to the default values");return u("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},A.prototype.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},A.prototype.label=function(){return this.localize("Caption Settings Dialog")},A.prototype.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},A.prototype.buildCSSClass=function(){return t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},A.prototype.getValues=function(){var t=this;return function(t,A){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return eA(t).reduce(function(e,i){return A(e,t[i],i)},e)}($n,function(A,e,i){var n=function(t,A){return Lt(t.options[t.options.selectedIndex].value,A)}(t.$(e.selector),e.parser);return void 0!==n&&(A[i]=n),A},{})},A.prototype.setValues=function(t){var A=this;e($n,function(e,i){!function(t,A,e){if(A)for(var i=0;i=2&&n.push("loadeddata"),t.readyState>=3&&n.push("canplay"),t.readyState>=4&&n.push("canplaythrough"),this.ready(function(){n.forEach(function(t){this.trigger(t)},this)})}},A.prototype.setCurrentTime=function(t){try{this.el_.currentTime=t}catch(t){Vt(t,"Video is not ready. (Video.js)")}},A.prototype.duration=function(){var t=this;if(this.el_.duration===1/0&&RA&&PA&&0===this.el_.currentTime){return this.on("timeupdate",function A(){t.el_.currentTime>0&&(t.el_.duration===1/0&&t.trigger("durationchange"),t.off("timeupdate",A))}),NaN}return this.el_.duration||NaN},A.prototype.width=function(){return this.el_.offsetWidth},A.prototype.height=function(){return this.el_.offsetHeight},A.prototype.proxyWebkitFullscreen_=function(){var t=this;if("webkitDisplayingFullscreen"in this.el_){var A=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},e=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",A),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",e),this.on("dispose",function(){t.off("webkitbeginfullscreen",e),t.off("webkitendfullscreen",A)})}},A.prototype.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var t=zt.navigator&&zt.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},A.prototype.enterFullScreen=function(){var t=this.el_;t.paused&&t.networkState<=t.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){t.pause(),t.webkitEnterFullScreen()},0)):t.webkitEnterFullScreen()},A.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},A.prototype.src=function(t){if(void 0===t)return this.el_.src;this.setSrc(t)},A.prototype.reset=function(){A.resetMediaElement(this.el_)},A.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},A.prototype.setControls=function(t){this.el_.controls=!!t},A.prototype.addTextTrack=function(A,e,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(A,e,i):t.prototype.addTextTrack.call(this,A,e,i)},A.prototype.createRemoteTextTrack=function(A){if(!this.featuresNativeTextTracks)return t.prototype.createRemoteTextTrack.call(this,A);var e=Gt.createElement("track");return A.kind&&(e.kind=A.kind),A.label&&(e.label=A.label),(A.language||A.srclang)&&(e.srclang=A.language||A.srclang),A.default&&(e.default=A.default),A.id&&(e.id=A.id),A.src&&(e.src=A.src),e},A.prototype.addRemoteTextTrack=function(A,e){var i=t.prototype.addRemoteTextTrack.call(this,A,e);return this.featuresNativeTextTracks&&this.el().appendChild(i),i},A.prototype.removeRemoteTextTrack=function(A){if(t.prototype.removeRemoteTextTrack.call(this,A),this.featuresNativeTextTracks)for(var e=this.$$("track"),i=e.length;i--;)A!==e[i]&&A!==e[i].track||this.el().removeChild(e[i])},A.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var t={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),zt.performance&&"function"==typeof zt.performance.now?t.creationTime=zt.performance.now():zt.performance&&zt.performance.timing&&"number"==typeof zt.performance.timing.navigationStart&&(t.creationTime=zt.Date.now()-zt.performance.timing.navigationStart),t},A}(Li);if(g()){gr.TEST_VID=Gt.createElement("video");var Mr=Gt.createElement("track");Mr.kind="captions",Mr.srclang="en",Mr.label="English",gr.TEST_VID.appendChild(Mr)}gr.isSupported=function(){try{gr.TEST_VID.volume=.5}catch(t){return!1}return!(!gr.TEST_VID||!gr.TEST_VID.canPlayType)},gr.canPlayType=function(t){return gr.TEST_VID.canPlayType(t)},gr.canPlaySource=function(t,A){return gr.canPlayType(t.type)},gr.canControlVolume=function(){try{var t=gr.TEST_VID.volume;return gr.TEST_VID.volume=t/2+.1,t!==gr.TEST_VID.volume}catch(t){return!1}},gr.canMuteVolume=function(){try{var t=gr.TEST_VID.muted;return gr.TEST_VID.muted=!t,gr.TEST_VID.muted?B(gr.TEST_VID,"muted","muted"):f(gr.TEST_VID,"muted"),t!==gr.TEST_VID.muted}catch(t){return!1}},gr.canControlPlaybackRate=function(){if(RA&&PA&&WA<58)return!1;try{var t=gr.TEST_VID.playbackRate;return gr.TEST_VID.playbackRate=t/2+.1,t!==gr.TEST_VID.playbackRate}catch(t){return!1}},gr.canOverrideAttributes=function(){try{var t=function(){};Object.defineProperty(Gt.createElement("video"),"src",{get:t,set:t}),Object.defineProperty(Gt.createElement("audio"),"src",{get:t,set:t}),Object.defineProperty(Gt.createElement("video"),"innerHTML",{get:t,set:t}),Object.defineProperty(Gt.createElement("audio"),"innerHTML",{get:t,set:t})}catch(t){return!1}return!0},gr.supportsNativeTextTracks=function(){return XA||FA&&PA},gr.supportsNativeVideoTracks=function(){return!(!gr.TEST_VID||!gr.TEST_VID.videoTracks)},gr.supportsNativeAudioTracks=function(){return!(!gr.TEST_VID||!gr.TEST_VID.audioTracks)},gr.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],gr.prototype.featuresVolumeControl=gr.canControlVolume(),gr.prototype.featuresMuteControl=gr.canMuteVolume(),gr.prototype.featuresPlaybackRate=gr.canControlPlaybackRate(),gr.prototype.featuresSourceset=gr.canOverrideAttributes(),gr.prototype.movingMediaElementInDOM=!FA,gr.prototype.featuresFullscreenResize=!0,gr.prototype.featuresProgressEvents=!0,gr.prototype.featuresTimeupdateEvents=!0,gr.prototype.featuresNativeTextTracks=gr.supportsNativeTextTracks(),gr.prototype.featuresNativeVideoTracks=gr.supportsNativeVideoTracks(),gr.prototype.featuresNativeAudioTracks=gr.supportsNativeAudioTracks();var Ir=gr.TEST_VID&&gr.TEST_VID.constructor.prototype.canPlayType,cr=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;gr.patchCanPlayType=function(){JA>=4&&!KA&&!PA&&(gr.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&cr.test(t)?"maybe":Ir.call(this,t)})},gr.unpatchCanPlayType=function(){var t=gr.TEST_VID.constructor.prototype.canPlayType;return gr.TEST_VID.constructor.prototype.canPlayType=Ir,t},gr.patchCanPlayType(),gr.disposeMediaElement=function(t){if(t){for(t.parentNode&&t.parentNode.removeChild(t);t.hasChildNodes();)t.removeChild(t.firstChild);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},gr.resetMediaElement=function(t){if(t){for(var A=t.querySelectorAll("source"),e=A.length;e--;)t.removeChild(A[e]);t.removeAttribute("src"),"function"==typeof t.load&&function(){try{t.load()}catch(t){}}()}},["muted","defaultMuted","autoplay","stretch","fluent","controls","loop","playsinline"].forEach(function(t){gr.prototype[t]=function(){return this.el_[t]||this.el_.hasAttribute(t)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){gr.prototype["set"+X(t)]=function(A){this.el_[t]=A,A?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(t){gr.prototype[t]=function(){return this.el_[t]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(t){gr.prototype["set"+X(t)]=function(A){this.el_[t]=A}}),["pause","load","play"].forEach(function(t){gr.prototype[t]=function(){return this.el_[t]()}}),Li.withSourceHandlers(gr),gr.nativeSourceHandler={},gr.nativeSourceHandler.canPlayType=function(t){try{return gr.TEST_VID.canPlayType(t)}catch(t){return""}},gr.nativeSourceHandler.canHandleSource=function(t,A){if(t.type)return gr.nativeSourceHandler.canPlayType(t.type);if(t.src){var e=pe(t.src);return gr.nativeSourceHandler.canPlayType("video/"+e)}return""},gr.nativeSourceHandler.handleSource=function(t,A,e){A.setSrc(t.src)},gr.nativeSourceHandler.dispose=function(){},gr.registerSourceHandler(gr.nativeSourceHandler),Li.registerTech("Html5",gr);var ur=tA(["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "],["\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "]),Er=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],hr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},lr=function(t){function A(e,n,r){if(Zt(this,A),e.id=e.id||n.id||"vjs_video_"+v(),(n=i(A.getTagSettings(e),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof e.closest){var o=e.closest("[lang]");o&&o.getAttribute&&(n.language=o.getAttribute("lang"))}else for(var a=e;a&&1===a.nodeType;){if(D(a).hasOwnProperty("lang")){n.language=a.getAttribute("lang");break}a=a.parentNode}var s=$t(this,t.call(this,null,n,r));if(s.isPosterFromTech_=!1,s.queuedCallbacks_=[],s.isReady_=!1,s.hasStarted_=!1,s.userActive_=!1,!s.options_||!s.options_.techOrder||!s.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(s.tag=e,s.tagAttributes=e&&D(e),s.language(s.options_.language),n.languages){var g={};Object.getOwnPropertyNames(n.languages).forEach(function(t){g[t.toLowerCase()]=n.languages[t]}),s.languages_=g}else s.languages_=A.prototype.options_.languages;s.cache_={},s.poster_=n.poster||"",s.controls_=!!n.controls,s.cache_.lastVolume=1,e.controls=!1,e.removeAttribute("controls"),e.hasAttribute("autoplay")?s.options_.autoplay=!0:s.autoplay(s.options_.autoplay),s.scrubbing_=!1,s.el_=s.createEl(),s.cache_.lastPlaybackRate=s.defaultPlaybackRate(),V(s,{eventBusKey:"el_"});var M=Z(s.options_);if(n.plugins){var I=n.plugins;Object.keys(I).forEach(function(t){if("function"!=typeof this[t])throw new Error('plugin "'+t+'" does not exist');this[t](I[t])},s)}s.options_.playerOptions=M,s.middleware_=[],s.initChildren(),s.isAudio("audio"===e.nodeName.toLowerCase()),s.controls()?s.addClass("vjs-controls-enabled"):s.addClass("vjs-controls-disabled"),s.el_.setAttribute("role","region"),s.isAudio()?s.el_.setAttribute("aria-label",s.localize("Audio Player")):s.el_.setAttribute("aria-label",s.localize("Video Player")),s.isAudio()&&s.addClass("vjs-audio"),s.flexNotSupported_()&&s.addClass("vjs-no-flex"),FA||s.addClass("vjs-workinghover"),A.players[s.id_]=s;var c=vt.split(".")[0];return s.addClass("vjs-v"+c),s.userActive(!0),s.reportUserActivity(),s.one("play",s.listenForUserActivity_),s.on("fullscreenchange",s.handleFullscreenChange_),s.on("stageclick",s.handleStageClick_),s.changingSrc_=!1,s.playWaitingForReady_=!1,s.playOnLoadstart_=null,s}return _t(A,t),A.prototype.dispose=function(){this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),A.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),function(t){xi[t.id()]=null}(this),t.prototype.dispose.call(this)},A.prototype.createEl=function(){var A=this.tag,e=void 0,i=this.playerElIngest_=A.parentNode&&A.parentNode.hasAttribute&&A.parentNode.hasAttribute("data-vjs-player"),n="video-js"===this.tag.tagName.toLowerCase();i?e=this.el_=A.parentNode:n||(e=this.el_=t.prototype.createEl.call(this,"div"));var r=D(A);if(n){for(e=this.el_=A,A=this.tag=Gt.createElement("video");e.children.length;)A.appendChild(e.firstChild);l(e,"video-js")||d(e,"video-js"),e.appendChild(A),i=this.playerElIngest_=e,Object.keys(e).forEach(function(t){A[t]=e[t]})}if(A.setAttribute("tabindex","-1"),r.tabindex="-1",VA&&(A.setAttribute("role","application"),r.role="application"),A.removeAttribute("width"),A.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(t){n&&"class"===t||e.setAttribute(t,r[t]),n&&A.setAttribute(t,r[t])}),A.playerId=A.id,A.id+="_html5_api",A.className="vjs-tech",A.player=e.player=this,this.addClass("vjs-paused"),!0!==zt.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=lA("vjs-styles-dimensions");var o=nA(".vjs-styles-defaults"),a=nA("head");a.insertBefore(this.styleEl_,o?o.nextSibling:a.firstChild)}this.width(this.options_.width),this.height(this.options_.height),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var s=A.getElementsByTagName("a"),g=0;g0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),n=i[1]/i[0];t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/n:this.videoWidth()||300,A=void 0!==this.height_?this.height_:t*n,e=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(e),dA(this.styleEl_,"\n ."+e+" {\n width: "+t+"px;\n height: "+A+"px;\n }\n\n ."+e+".vjs-fluid {\n padding-top: "+100*n+"%;\n }\n ")}else{var r="number"==typeof this.width_?this.width_:this.options_.width,o="number"==typeof this.height_?this.height_:this.options_.height,a=this.tech_&&this.tech_.el();a&&(r>=0&&(a.width=r),o>=0&&(a.height=o))}},A.prototype.loadTech_=function(t,A){var e=this;this.tech_&&this.unloadTech_();var n=X(t),r=t.charAt(0).toLowerCase()+t.slice(1);"Html5"!==n&&this.tag&&(Li.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var o={source:A,autoplay:"string"!=typeof this.autoplay()&&this.autoplay(),nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,stretch:this.options_.stretch,fluent:this.options_.fluent,preload:this.options_.preload,loop:this.options_.loop,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};gi.names.forEach(function(t){var A=gi[t];o[A.getterName]=e[A.privateName]}),i(o,this.options_[n]),i(o,this.options_[r]),i(o,this.options_[t.toLowerCase()]),this.tag&&(o.tag=this.tag),A&&A.src===this.cache_.src&&this.cache_.currentTime>0&&(o.startTime=this.cache_.currentTime);var a=Li.getTech(t);if(!a)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new a(o),this.tech_.ready(CA(this,this.handleTechReady_),!0),ge(this.textTracksJson_||[],this.tech_),Er.forEach(function(t){e.on(e.tech_,t,e["handleTech"+X(t)+"_"])}),Object.keys(hr).forEach(function(t){e.on(e.tech_,t,function(A){0===e.tech_.playbackRate()&&e.tech_.seeking()?e.queuedCallbacks_.push({callback:e["handleTech"+hr[t]+"_"].bind(e),event:A}):e["handleTech"+hr[t]+"_"](A)})}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"sourceset",this.handleTechSourceset_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"fullscreentoggle",this.handleTechFullscreenToggle_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.on(this.tech_,"ratechange",this.handleTechRateChange_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||h(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},A.prototype.unloadTech_=function(){var t=this;gi.names.forEach(function(A){var e=gi[A];t[e.privateName]=t[e.getterName]()}),this.textTracksJson_=se(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},A.prototype.tech=function(t){return void 0===t&&Vt.warn(qt(ur)),this.tech_},A.prototype.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"dblclick",this.handleTechDoubleClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},A.prototype.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_),this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},A.prototype.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},A.prototype.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(this.autoplay())},A.prototype.manualAutoplay_=function(t){var A=this;if(this.tech_&&"string"==typeof t){var e=function(){var t=A.muted();A.muted(!0);var e=A.play();if(e&&e.then&&e.catch)return e.catch(function(e){A.muted(t)})},i=void 0;if("any"===t?(i=this.play())&&i.then&&i.catch&&i.catch(function(){return e()}):i="muted"===t?e():this.play(),i&&i.then&&i.catch)return i.then(function(){A.trigger({type:"autoplay-success",autoplay:t})}).catch(function(e){A.trigger({type:"autoplay-failure",autoplay:t})})}},A.prototype.updateSourceCaches_=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",A=t,e="";if("string"!=typeof A&&(A=t.src,e=t.type),!/^blob:/.test(A)){this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],A&&!e&&(e=function(t,A){if(!A)return"";if(t.cache_.source.src===A&&t.cache_.source.type)return t.cache_.source.type;var e=t.cache_.sources.filter(function(t){return t.src===A});if(e.length)return e[0].type;for(var i=t.$$("source"),n=0;n0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(t){return t.callback(t.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},A.prototype.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting"),this.one("timeupdate",function(){return t.removeClass("vjs-waiting")})},A.prototype.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},A.prototype.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},A.prototype.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},A.prototype.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},A.prototype.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},A.prototype.handleTechFirstPlay_=function(){this.options_.starttime&&(Vt.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")},A.prototype.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},A.prototype.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},A.prototype.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},A.prototype.handleTechClick_=function(t){O(t)&&this.controls_&&this.paused()},A.prototype.handleTechDoubleClick_=function(t){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(A){return A.contains(t.target)})||(this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},A.prototype.handleTechTap_=function(){this.userActive(!this.userActive())},A.prototype.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},A.prototype.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},A.prototype.handleTechTouchEnd_=function(t){t.preventDefault()},A.prototype.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},A.prototype.handleStageClick_=function(){this.reportUserActivity()},A.prototype.handleTechFullscreenChange_=function(t,A){A&&this.isFullscreen(A.isFullscreen),this.trigger("fullscreenchange")},A.prototype.handleTechFullscreenToggle_=function(t,A){this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()},A.prototype.handleTechError_=function(){var t=this.tech_.error();this.error(t)},A.prototype.handleTechTextData_=function(){var t=null;arguments.length>1&&(t=arguments[1]),this.trigger("textdata",t)},A.prototype.getCache=function(){return this.cache_},A.prototype.techCall_=function(t,A){this.ready(function(){if(t in Oi)return function(t,A,e,i){return A[e](t.reduce(Qt(e),i))}(this.middleware_,this.tech_,t,A);if(t in vi)return ft(this.middleware_,this.tech_,t,A);try{this.tech_&&this.tech_[t](A)}catch(t){throw Vt(t),t}},!0)},A.prototype.techGet_=function(t){if(this.tech_&&this.tech_.isReady_){if(t in Ui)return function(t,A,e){return t.reduceRight(Qt(e),A[e]())}(this.middleware_,this.tech_,t);if(t in vi)return ft(this.middleware_,this.tech_,t);try{return this.tech_[t]()}catch(A){if(void 0===this.tech_[t])throw Vt("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",A),A;if("TypeError"===A.name)throw Vt("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",A),this.tech_.isReady_=!1,A;throw Vt(A),A}}},A.prototype.play=function(){var t=this,A=this.options_.Promise||zt.Promise;return A?new A(function(A){t.play_(A)}):this.play_()},A.prototype.play_=function(){var t=this,A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt;if(this.playOnLoadstart_&&this.off("loadstart",this.playOnLoadstart_),this.isReady_){if(!this.changingSrc_&&(this.src()||this.currentSrc()))return void A(this.techGet_("play"));this.playOnLoadstart_=function(){t.playOnLoadstart_=null,A(t.play())},this.one("loadstart",this.playOnLoadstart_)}else{if(this.playWaitingForReady_)return;this.playWaitingForReady_=!0,this.ready(function(){t.playWaitingForReady_=!1,A(t.play())})}},A.prototype.pause=function(){this.techCall_("pause")},A.prototype.paused=function(){return!1!==this.techGet_("paused")},A.prototype.played=function(){return this.techGet_("played")||tt(0,0)},A.prototype.scrubbing=function(t){if(void 0===t)return this.scrubbing_;this.scrubbing_=!!t,t?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},A.prototype.currentTime=function(t){return void 0!==t?(t<0&&(t=0),void this.techCall_("setCurrentTime",t)):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},A.prototype.duration=function(t){if(void 0===t)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(t=parseFloat(t))<0&&(t=1/0),t!==this.cache_.duration&&(this.cache_.duration=t,t===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange"))},A.prototype.remainingTime=function(){return this.duration()-this.currentTime()},A.prototype.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},A.prototype.buffered=function(){var t=this.techGet_("buffered");return t&&t.length||(t=tt(0,0)),t},A.prototype.bufferedPercent=function(){return At(this.buffered(),this.duration())},A.prototype.bufferedEnd=function(){var t=this.buffered(),A=this.duration(),e=t.end(t.length-1);return e>A&&(e=A),e},A.prototype.volume=function(t){var A=void 0;return void 0!==t?(A=Math.max(0,Math.min(1,parseFloat(t))),this.cache_.volume=A,this.techCall_("setVolume",A),void(A>0&&this.lastVolume_(A))):(A=parseFloat(this.techGet_("volume")),isNaN(A)?1:A)},A.prototype.muted=function(t){return void 0!==t?void this.techCall_("setMuted",t):this.techGet_("muted")||!1},A.prototype.defaultMuted=function(t){return void 0!==t?this.techCall_("setDefaultMuted",t):this.techGet_("defaultMuted")||!1},A.prototype.lastVolume_=function(t){return void 0!==t&&0!==t?void(this.cache_.lastVolume=t):this.cache_.lastVolume},A.prototype.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},A.prototype.isFullscreen=function(t){return void 0!==t?void(this.isFullscreen_=!!t):!!this.isFullscreen_},A.prototype.requestFullscreen=function(){var t=$A;this.isFullscreen(!0),t.requestFullscreen?(G(Gt,t.fullscreenchange,CA(this,function A(e){this.isFullscreen(Gt[t.fullscreenElement]),!1===this.isFullscreen()&&K(Gt,t.fullscreenchange,A),this.trigger("fullscreenchange")})),this.el_[t.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange"))},A.prototype.exitFullscreen=function(){var t=$A;this.isFullscreen(!1),t.requestFullscreen?Gt[t.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange"))},A.prototype.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=Gt.documentElement.style.overflow,G(Gt,"keydown",CA(this,this.fullWindowOnEscKey)),Gt.documentElement.style.overflow="hidden",d(Gt.body,"vjs-full-window"),this.trigger("enterFullWindow")},A.prototype.fullWindowOnEscKey=function(t){27===t.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},A.prototype.exitFullWindow=function(){this.isFullWindow=!1,K(Gt,"keydown",this.fullWindowOnEscKey),Gt.documentElement.style.overflow=this.docOrigOverflow,C(Gt.body,"vjs-full-window"),this.trigger("exitFullWindow")},A.prototype.canPlayType=function(t){for(var A=void 0,e=0,i=this.options_.techOrder;e1?A.src(e.slice(1)):(A.changingSrc_=!1,A.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),void A.triggerReady());!function(t,A){t.forEach(function(t){return t.setTech&&t.setTech(A)})}(i,A.tech_)})):this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0)},A.prototype.src_=function(t){var A=this,e=this.selectSource([t]);return!e||(function(t,A){return X(t)===X(A)}(e.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",t):this.techCall_("src",t.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(e.tech,e.source),this.tech_.ready(function(){A.changingSrc_=!1}),!1))},A.prototype.load=function(){this.techCall_("load")},A.prototype.reset=function(){this.tech_&&this.tech_.clearTracks("text"),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset")},A.prototype.currentSources=function(){var t=this.currentSource(),A=[];return 0!==Object.keys(t).length&&A.push(t),this.cache_.sources||A},A.prototype.currentSource=function(){return this.cache_.source||{}},A.prototype.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},A.prototype.currentType=function(){return this.currentSource()&&this.currentSource().type||""},A.prototype.preload=function(t){return void 0!==t?(this.techCall_("setPreload",t),void(this.options_.preload=t)):this.techGet_("preload")},A.prototype.autoplay=function(t){if(void 0===t)return this.options_.autoplay||!1;var A=void 0;"string"==typeof t&&/(any|play|muted)/.test(t)?(this.options_.autoplay=t,this.manualAutoplay_(t),A=!1):this.options_.autoplay=!!t,A=A||this.options_.autoplay,this.tech_&&this.techCall_("setAutoplay",A)},A.prototype.playsinline=function(t){return void 0!==t?(this.techCall_("setPlaysinline",t),this.options_.playsinline=t,this):this.techGet_("playsinline")},A.prototype.loop=function(t){return void 0!==t?(this.techCall_("setLoop",t),void(this.options_.loop=t)):this.techGet_("loop")},A.prototype.stretch=function(t){return void 0!==t?(this.techCall_("setStretch",t),this.options_.stretch=t,this):this.techGet_("stretch",t)},A.prototype.fluent=function(t){return void 0!=t?(this.techCall_("setFluent",t),this.options_.fluent=t,this):this.techGet_("fluent",t)},A.prototype.poster=function(t){if(void 0===t)return this.poster_;t||(t=""),t!==this.poster_&&(this.poster_=t,this.techCall_("setPoster",t),this.isPosterFromTech_=!1,this.trigger("posterchange"))},A.prototype.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var t=this.tech_.poster()||"";t!==this.poster_&&(this.poster_=t,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},A.prototype.controls=function(t){if(void 0===t)return!!this.controls_;t=!!t,this.controls_!==t&&(this.controls_=t,this.usingNativeControls()&&this.techCall_("setControls",t),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_()))},A.prototype.usingNativeControls=function(t){if(void 0===t)return!!this.usingNativeControls_;t=!!t,this.usingNativeControls_!==t&&(this.usingNativeControls_=t,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},A.prototype.error=function(t){return void 0===t?this.error_||null:null===t?(this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close())):(this.error_=new et(t),this.addClass("vjs-error"),Vt.error("(CODE:"+this.error_.code+" "+et.errorTypes[this.error_.code]+")",this.error_.message,this.error_),void this.trigger("error"))},A.prototype.reportUserActivity=function(t){this.userActivity_=!0},A.prototype.userActive=function(t){if(void 0===t)return this.userActive_;if((t=!!t)!==this.userActive_){if(this.userActive_=t,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(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},A.prototype.listenForUserActivity_=function(){var t=void 0,A=void 0,e=void 0,i=CA(this,this.reportUserActivity);this.on("mousedown",function(){i(),this.clearInterval(t),t=this.setInterval(i,250)}),this.on("mousemove",function(t){t.screenX===A&&t.screenY===e||(A=t.screenX,e=t.screenY,i())}),this.on("mouseup",function(A){i(),this.clearInterval(t)}),this.on("keydown",i),this.on("keyup",i);var n=void 0;this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(n);var t=this.options_.inactivityTimeout;t<=0||(n=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},t))}},250)},A.prototype.playbackRate=function(t){return void 0!==t?void this.techCall_("setPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1},A.prototype.defaultPlaybackRate=function(t){return void 0!==t?this.techCall_("setDefaultPlaybackRate",t):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},A.prototype.isAudio=function(t){return void 0!==t?void(this.isAudio_=!!t):!!this.isAudio_},A.prototype.addTextTrack=function(t,A,e){if(this.tech_)return this.tech_.addTextTrack(t,A,e)},A.prototype.addRemoteTextTrack=function(t,A){if(this.tech_)return this.tech_.addRemoteTextTrack(t,A)},A.prototype.removeRemoteTextTrack=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).track,A=void 0===t?arguments[0]:t;if(this.tech_)return this.tech_.removeRemoteTextTrack(A)},A.prototype.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},A.prototype.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},A.prototype.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},A.prototype.language=function(t){if(void 0===t)return this.language_;this.language_=String(t).toLowerCase()},A.prototype.languages=function(){return Z(A.prototype.options_.languages,this.languages_)},A.prototype.toJSON=function(){var t=Z(this.options_),A=t.tracks;t.tracks=[];for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{};return t.name=this.name,t.plugin=this.constructor,t.instance=this,t},t.prototype.trigger=function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return H(this.eventBusEl_,t,this.getEventHash(A))},t.prototype.handleStateChanged=function(t){},t.prototype.dispose=function(){var t=this.name,A=this.player;this.trigger("dispose"),this.off(),A.off("dispose",this.dispose),A.activePlugins_[t]=!1,this.player=this.state=null,A[t]=Br(t,Cr[t])},t.isBasic=function(A){var e="string"==typeof A?Nr(A):A;return"function"==typeof e&&!t.prototype.isPrototypeOf(e.prototype)},t.registerPlugin=function(A,e){if("string"!=typeof A)throw new Error('Illegal plugin name, "'+A+'", must be a string, was '+(void 0===A?"undefined":Xt(A))+".");if(Tr(A))Vt.warn('A plugin named "'+A+'" already exists. You may want to avoid re-registering plugins!');else if(lr.prototype.hasOwnProperty(A))throw new Error('Illegal plugin name, "'+A+'", cannot share a name with an existing player method!');if("function"!=typeof e)throw new Error('Illegal plugin for "'+A+'", must be a function, was '+(void 0===e?"undefined":Xt(e))+".");return Cr[A]=e,"plugin"!==A&&(t.isBasic(e)?lr.prototype[A]=function(t,A){var e=function(){yr(this,{name:t,plugin:A,instance:null},!0);var e=A.apply(this,arguments);return Dr(this,t),yr(this,{name:t,plugin:A,instance:e}),e};return Object.keys(A).forEach(function(t){e[t]=A[t]}),e}(A,e):lr.prototype[A]=Br(A,e)),e},t.deregisterPlugin=function(t){if("plugin"===t)throw new Error("Cannot de-register base plugin.");Tr(t)&&(delete Cr[t],delete lr.prototype[t])},t.getPlugins=function(){var t=void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object.keys(Cr)).forEach(function(A){var e=Nr(A);e&&((t=t||{})[A]=e)}),t},t.getPluginVersion=function(t){var A=Nr(t);return A&&A.VERSION||""},t}();fr.getPlugin=Nr,fr.BASE_PLUGIN_NAME="plugin",fr.registerPlugin("plugin",fr),lr.prototype.usingPlugin=function(t){return!!this.activePlugins_&&!0===this.activePlugins_[t]},lr.prototype.hasPlugin=function(t){return!!Tr(t)};var Qr=function(t){return 0===t.indexOf("#")?t.slice(1):t};if(jt.hooks_={},jt.hooks=function(t,A){return jt.hooks_[t]=jt.hooks_[t]||[],A&&(jt.hooks_[t]=jt.hooks_[t].concat(A)),jt.hooks_[t]},jt.hook=function(t,A){jt.hooks(t,A)},jt.hookOnce=function(t,A){jt.hooks(t,[].concat(A).map(function(A){return function e(){return jt.removeHook(t,e),A.apply(void 0,arguments)}}))},jt.removeHook=function(t,A){var e=jt.hooks(t).indexOf(A);return!(e<=-1||(jt.hooks_[t]=jt.hooks_[t].slice(),jt.hooks_[t].splice(e,1),0))},!0!==zt.VIDEOJS_NO_DYNAMIC_STYLE&&g()){var wr=nA(".vjs-styles-defaults");if(!wr){wr=lA("vjs-styles-defaults");var mr=nA("head");mr&&mr.insertBefore(wr,mr.firstChild),dA(wr,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n ")}}W(1,jt),jt.VERSION=vt,jt.options=lr.prototype.options_,jt.getPlayers=function(){return lr.players},jt.getPlayer=function(t){var A=lr.players,e=void 0;if("string"==typeof t){var i=Qr(t),n=A[i];if(n)return n;e=nA("#"+i)}else e=t;if(M(e)){var r=e,o=r.player,a=r.playerId;if(o||A[a])return o||A[a]}},jt.getAllPlayers=function(){return Object.keys(lr.players).map(function(t){return lr.players[t]}).filter(Boolean)},jt.players=lr.players,jt.getComponent=xA.getComponent,jt.registerComponent=function(t,A){Li.isTech(A)&&Vt.warn("The "+t+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),xA.registerComponent.call(xA,t,A)},jt.getTech=Li.getTech,jt.registerTech=Li.registerTech,jt.use=function(t,A){ji[t]=ji[t]||[],ji[t].push(A)},Object.defineProperty(jt,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(jt.middleware,"TERMINATOR",{value:Yi,writeable:!1,enumerable:!0}),jt.browser=_A,jt.TOUCH_ENABLED=ZA,jt.extend=function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=function(){t.apply(this,arguments)},i={};for(var n in"object"===(void 0===A?"undefined":Xt(A))?(A.constructor!==Object.prototype.constructor&&(e=A.constructor),i=A):"function"==typeof A&&(e=A),function(t,A){if("function"!=typeof A&&null!==A)throw new TypeError("Super expression must either be null or a function, not "+(void 0===A?"undefined":Xt(A)));t.prototype=Object.create(A&&A.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),A&&(t.super_=A)}(e,t),i)i.hasOwnProperty(n)&&(e.prototype[n]=i[n]);return e},jt.mergeOptions=Z,jt.bind=CA,jt.registerPlugin=fr.registerPlugin,jt.deregisterPlugin=fr.deregisterPlugin,jt.plugin=function(t,A){return Vt.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),fr.registerPlugin(t,A)},jt.getPlugins=fr.getPlugins,jt.getPlugin=fr.getPlugin,jt.getPluginVersion=fr.getPluginVersion,jt.addLanguage=function(t,A){var e;return t=(""+t).toLowerCase(),jt.options.languages=Z(jt.options.languages,((e={})[t]=A,e)),jt.options.languages[t]},jt.log=Vt,jt.createTimeRange=jt.createTimeRanges=tt,jt.formatTime=St,jt.setFormatTime=function(t){Xi=t},jt.resetFormatTime=function(){Xi=qi},jt.parseUrl=we,jt.isCrossOrigin=Se,jt.EventTarget=DA,jt.on=G,jt.one=P,jt.off=K,jt.trigger=H,jt.xhr=_e,jt.TextTrack=Ai,jt.AudioTrack=ei,jt.VideoTrack=ii,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(t){jt[t]=function(){return Vt.warn("videojs."+t+"() is deprecated; use videojs.dom."+t+"() instead"),oA[t].apply(null,arguments)}}),jt.computedStyle=o,jt.dom=oA,jt.url=Le;var pr,Sr,Lr,jr,xr,Yr,Ur,Or,vr,kr,zr,Fr,br,Rr,Jr,Gr,Kr,Hr,Pr,Wr,Vr,qr,Xr,Zr,_r,$r,to,Ao,eo,io,no,ro,oo,ao,so,go,Mo,Io,co=t(function(t,A){var e,i,n,r,o;e=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(t,A,e){if(e=e||{},t=t.trim(),!(A=A.trim())){if(!e.alwaysNormalize)return t;var n=o.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=o.normalizePath(n.path),o.buildURLFromParts(n)}var r=o.parseURL(A);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return e.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):A;var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=i.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var g={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(g.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var M=a.path,I=M.substring(0,M.lastIndexOf("/")+1)+r.path;g.path=o.normalizePath(I)}else g.path=a.path,r.params||(g.params=a.params,r.query||(g.query=a.query));return null===g.path&&(g.path=e.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(g)},parseURL:function(t){var A=e.exec(t);return A?{scheme:A[1]||"",netLoc:A[2]||"",path:A[3]||"",params:A[4]||"",query:A[5]||"",fragment:A[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(r,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=o}),uo=function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")},Eo=Object.assign||function(t){for(var A=1;A-1},t.prototype.trigger=function(t){var A=this.listeners[t],e=void 0,i=void 0,n=void 0;if(A)if(2===arguments.length)for(i=A.length,e=0;e-1;A=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,A)),this.buffer=this.buffer.substring(A+1)},A}(Co),No=function(t){for(var A=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),e={},i=A.length,n=void 0;i--;)""!==A[i]&&((n=/([^=]*)=(.*)/.exec(A[i]).slice(1))[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},Do=function(t){function A(){uo(this,A);var e=lo(this,t.call(this));return e.customParsers=[],e}return ho(A,t),A.prototype.push=function(t){var A=void 0,e=void 0;if(0!==(t=t.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"")).length){if("#"!==t[0])return void this.trigger("data",{type:"uri",uri:t});for(var i=0;i0&&(r.duration=t.duration),0===t.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key:function(){return t.attributes?"NONE"===t.attributes.METHOD?void(a=null):t.attributes.URI?(t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void(void 0!==t.attributes.IV&&(a.iv=t.attributes.IV))):void this.trigger("warn",{message:"ignoring key declaration without URI"}):void this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,g=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){o={},t.uri&&(o.uri=t.uri),t.byterange&&(o.byterange=t.byterange)},"stream-inf":function(){this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||s,t.attributes?(r.attributes||(r.attributes={}),Eo(r.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||s,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var i=this.manifest.mediaGroups[t.attributes.TYPE];i[t.attributes["GROUP-ID"]]=i[t.attributes["GROUP-ID"]]||{},A=i[t.attributes["GROUP-ID"]],(e={default:/yes/i.test(t.attributes.DEFAULT)}).default?e.autoselect=!0:e.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(e.language=t.attributes.LANGUAGE),t.attributes.URI&&(e.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(e.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(e.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(e.forced=/yes/i.test(t.attributes.FORCED)),A[t.attributes.NAME]=e}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){g+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),r.dateTimeString=t.dateTimeString,r.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):this.manifest.targetDuration=t.duration},totalduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+t.duration}):this.manifest.totalDuration=t.duration},start:function(){t.attributes&&!isNaN(t.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:t.attributes["TIME-OFFSET"],precise:t.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){r.cueOut=t.data},"cue-out-cont":function(){r.cueOutCont=t.data},"cue-in":function(){r.cueIn=t.data}})[t.tagType]||function(){}).call(i)},uri:function(){r.uri=t.uri,n.push(r),!this.manifest.targetDuration||"duration"in r||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),a&&(r.key=a),r.timeline=g,o&&(r.map=o),r={}},comment:function(){},custom:function(){t.segment?(r.custom=r.custom||{},r.custom[t.customType]=t.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[t.customType]=t.data)}})[t.type].call(i)}),e}return ho(A,t),A.prototype.push=function(t){this.lineStream.push(t)},A.prototype.end=function(){this.lineStream.push("\n")},A.prototype.addParser=function(t){this.parseStream.addParser(t)},A}(Co),Bo=function(t){var A,e=t.attributes,i=t.segments,n={attributes:(A={NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth},A["PROGRAM-ID"]=1,A),uri:"",endList:"static"===(e.type||"static"),timeline:e.periodIndex,resolvedUri:"",targetDuration:e.duration,segments:i,mediaSequence:i.length?i[0].number:1};return e.contentProtection&&(n.contentProtection=e.contentProtection),n},fo="function"==typeof Symbol&&"symbol"===Xt(Symbol.iterator)?function(t){return void 0===t?"undefined":Xt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":Xt(t)},Qo=function(t){return!!t&&"object"===(void 0===t?"undefined":fo(t))},wo=function t(){for(var A=arguments.length,e=Array(A),i=0;ih&&(h=N);var D=void 0;if(T<0){var y=l+1;D=y===A.length?"dynamic"===i&&r>0&&a.indexOf("$Number$")>0?So(t,h,C):(s*M-h)/C:(A[y].t-h)/C}else D=T+1;for(var B=c+E.length+D,f=c+E.length;f=n?r:""+new Array(n-r.length+1).join("0")+r)}}(A))},ko=function(t,A){var e={RepresentationID:t.id,Bandwidth:t.bandwidth||0},i=t.initialization,n=void 0===i?{sourceURL:"",range:""}:i,r=po({baseUrl:t.baseUrl,source:vo(n.sourceURL,e),range:n.range});return function(t,A){return t.duration||A?t.duration?Uo(t):Lo(t,A):[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodIndex}]}(t,A).map(function(A){e.Number=A.number,e.Time=A.time;var i=vo(t.media||"",e);return{uri:i,timeline:A.timeline,duration:A.duration,resolvedUri:mo(t.baseUrl||"",i),map:r,number:A.number}})},zo="INVALID_NUMBER_OF_PERIOD",Fo="DASH_EMPTY_MANIFEST",bo="DASH_INVALID_XML",Ro="NO_BASE_URL",Jo="SEGMENT_TIME_UNSPECIFIED",Go="UNSUPPORTED_UTC_TIMING_SCHEME",Ko=function(t,A){var e=t.duration,i=t.segmentUrls,n=void 0===i?[]:i;if(!e&&!A||e&&A)throw new Error(Jo);var r=n.map(function(A){return function(t,A){var e=t.baseUrl,i=t.initialization,n=void 0===i?{}:i,r=po({baseUrl:e,source:n.sourceURL,range:n.range}),o=po({baseUrl:e,source:A.media,range:A.mediaRange});return o.map=r,o}(t,A)}),o=void 0;return e&&(o=Uo(t)),A&&(o=Lo(t,A)),o.map(function(t,A){if(r[A]){var e=r[A];return e.timeline=t.timeline,e.duration=t.duration,e.number=t.number,e}}).filter(function(t){return t})},Ho=function(t){var A=t.baseUrl,e=t.initialization,i=void 0===e?{}:e,n=t.sourceDuration,r=t.timescale,o=void 0===r?1:r,a=t.indexRange,s=void 0===a?"":a,g=t.duration;if(!A)throw new Error(Ro);var M=po({baseUrl:A,source:i.sourceURL,range:i.range}),I=po({baseUrl:A,source:A,range:s});if(I.map=M,g){var c=Uo(t);c.length&&(I.duration=c[0].duration,I.timeline=c[0].timeline)}else n&&(I.duration=n/o,I.timeline=0);return I.number=0,[I]},Po=function(t){var A=t.attributes,e=t.segmentInfo,i=void 0,n=void 0;if(e.template?(n=ko,i=wo(A,e.template)):e.base?(n=Ho,i=wo(A,e.base)):e.list&&(n=Ko,i=wo(A,e.list)),!n)return{attributes:A};var r=n(i,e.timeline);if(i.duration){var o=i,a=o.duration,s=o.timescale,g=void 0===s?1:s;i.duration=a/g}else r.length?i.duration=r.reduce(function(t,A){return Math.max(t,Math.ceil(A.duration))},0):i.duration=0;return{attributes:i,segments:r}},Wo=function(t,A){return xo(t.childNodes).filter(function(t){return t.tagName===A})},Vo=function(t){return t.textContent.trim()},qo=function(t){var A=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(t);if(!A)return 0;var e=A.slice(1),i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5];return 31536e3*parseFloat(i||0)+2592e3*parseFloat(n||0)+86400*parseFloat(r||0)+3600*parseFloat(o||0)+60*parseFloat(a||0)+parseFloat(s||0)},Xo={mediaPresentationDuration:function(t){return qo(t)},availabilityStartTime:function(t){return function(t){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),Date.parse(t)}(t)/1e3},minimumUpdatePeriod:function(t){return qo(t)},timeShiftBufferDepth:function(t){return qo(t)},start:function(t){return qo(t)},width:function(t){return parseInt(t,10)},height:function(t){return parseInt(t,10)},bandwidth:function(t){return parseInt(t,10)},startNumber:function(t){return parseInt(t,10)},timescale:function(t){return parseInt(t,10)},duration:function(t){var A=parseInt(t,10);return isNaN(A)?qo(t):A},d:function(t){return parseInt(t,10)},t:function(t){return parseInt(t,10)},r:function(t){return parseInt(t,10)},DEFAULT:function(t){return t}},Zo=function(t){return t&&t.attributes?xo(t.attributes).reduce(function(t,A){var e=Xo[A.name]||Xo.DEFAULT;return t[A.name]=e(A.value),t},{}):{}},_o={"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"},$o=function(t,A){return A.length?jo(t.map(function(t){return A.map(function(A){return mo(t,Vo(A))})})):t},ta=function(t){var A=Wo(t,"SegmentTemplate")[0],e=Wo(t,"SegmentList")[0],i=e&&Wo(e,"SegmentURL").map(function(t){return wo({tag:"SegmentURL"},Zo(t))}),n=Wo(t,"SegmentBase")[0],r=e||A,o=r&&Wo(r,"SegmentTimeline")[0],a=e||n||A,s=a&&Wo(a,"Initialization")[0],g=A&&Zo(A);g&&s?g.initialization=s&&Zo(s):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});var M={template:g,timeline:o&&Wo(o,"S").map(function(t){return Zo(t)}),list:e&&wo(Zo(e),{segmentUrls:i,initialization:Zo(s)}),base:n&&wo(Zo(n),{initialization:Zo(s)})};return Object.keys(M).forEach(function(t){M[t]||delete M[t]}),M},Aa=function(t){return t.reduce(function(t,A){var e=Zo(A),i=_o[e.schemeIdUri];if(i){t[i]={attributes:e};var n=Wo(A,"cenc:pssh")[0];if(n){var r=Vo(n),o=r&&function(t){for(var A=zt.atob(t),e=new Uint8Array(A.length),i=0;i1&&void 0!==arguments[1]?arguments[1]:{},e=A.manifestUri,i=void 0===e?"":e,n=A.NOW,r=void 0===n?Date.now():n,o=A.clientOffset,a=void 0===o?0:o,s=Wo(t,"Period");if(1!==s.length)throw new Error(zo);var g=Zo(t),M=$o([i],Wo(t,"BaseURL"));return g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=r,g.clientOffset=a,jo(s.map(function(t,A){return function(e,i){var n=$o(A,Wo(e,"BaseURL")),r=Zo(e),o=wo(t,r,{periodIndex:i}),a=Wo(e,"AdaptationSet"),s=ta(e);return jo(a.map(ea(o,n,s)))}}(g,M)))},na=function(t){if(""===t)throw new Error(Fo);var A=(new zt.DOMParser).parseFromString(t,"application/xml"),e=A&&"MPD"===A.documentElement.tagName?A.documentElement:null;if(!e||e&&e.getElementsByTagName("parsererror").length>0)throw new Error(bo);return e},ra=function(t,A){return function(t){var A;if(!t.length)return{};var e=t[0].attributes,i=e.sourceDuration,n=e.minimumUpdatePeriod,r=void 0===n?0:n,o=t.filter(function(t){var A=t.attributes;return"video/mp4"===A.mimeType||"video"===A.contentType}).map(Bo),a=t.filter(function(t){var A=t.attributes;return"audio/mp4"===A.mimeType||"audio"===A.contentType}),s=t.filter(function(t){var A=t.attributes;return"text/vtt"===A.mimeType||"text"===A.contentType}),g={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(A={AUDIO:{},VIDEO:{}},A["CLOSED-CAPTIONS"]={},A.SUBTITLES={},A),uri:"",duration:i,playlists:o,minimumUpdatePeriod:1e3*r};return a.length&&(g.mediaGroups.AUDIO.audio=function(t){return t.reduce(function(t,A){var e=A.attributes.role&&A.attributes.role.value||"main",i=A.attributes.lang||"",n="main";return i&&(n=A.attributes.lang+" ("+e+")"),t[n]&&t[n].playlists[0].attributes.BANDWIDTH>A.attributes.bandwidth?t:(t[n]={language:i,autoselect:!0,default:"main"===e,playlists:[function(t){var A,e=t.attributes,i=t.segments,n={attributes:(A={NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs},A["PROGRAM-ID"]=1,A),uri:"",endList:"static"===(e.type||"static"),timeline:e.periodIndex,resolvedUri:"",targetDuration:e.duration,segments:i,mediaSequence:i.length?i[0].number:1};return e.contentProtection&&(n.contentProtection=e.contentProtection),n}(A)],uri:""},t)},{})}(a)),s.length&&(g.mediaGroups.SUBTITLES.subs=function(t){return t.reduce(function(t,A){var e=A.attributes.lang||"text";return t[e]?t:(t[e]={language:e,default:!1,autoselect:!1,playlists:[function(t){var A,e=t.attributes,i=t.segments;return void 0===i&&(i=[{uri:e.baseUrl,timeline:e.periodIndex,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration),{attributes:(A={NAME:e.id,BANDWIDTH:e.bandwidth},A["PROGRAM-ID"]=1,A),uri:"",endList:"static"===(e.type||"static"),timeline:e.periodIndex,resolvedUri:e.baseUrl||"",targetDuration:e.duration,segments:i,mediaSequence:i.length?i[0].number:1}}(A)],uri:""},t)},{})}(s)),g}(function(t){return t.map(Po)}(ia(na(t),A)))},oa=function(t){return function(t){var A=Wo(t,"UTCTiming")[0];if(!A)return null;var e=Zo(A);switch(e.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":e.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":e.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":e.method="DIRECT",e.value=Date.parse(e.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(Go)}return e}(na(t))},aa={toUnsigned:function(t){return t>>>0}},sa=aa.toUnsigned,ga=Object.freeze({default:aa,__moduleExports:aa,toUnsigned:sa}),Ma=(ga&&aa||ga).toUnsigned,Ia={findBox:pr=function(t,A){var e,i,n,r,o,a=[];if(!A.length)return null;for(e=0;e1?e+i:t.byteLength,n===A[0]&&(1===A.length?a.push(t.subarray(e+8,r)):(o=pr(t.subarray(e+8,r),A.slice(1))).length&&(a=a.concat(o))),e=r;return a},parseType:Sr=function(t){var A="";return A+=String.fromCharCode(t[0]),A+=String.fromCharCode(t[1]),(A+=String.fromCharCode(t[2]))+String.fromCharCode(t[3])},timescale:function(t){return pr(t,["moov","trak"]).reduce(function(t,A){var e,i,n,r,o;return(e=pr(A,["tkhd"])[0])?(i=e[0],r=Ma(e[n=0===i?12:20]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),(o=pr(A,["mdia","mdhd"])[0])?(n=0===(i=o[0])?12:20,t[r]=Ma(o[n]<<24|o[n+1]<<16|o[n+2]<<8|o[n+3]),t):null):null},{})},startTime:function(t,A){var e,i,n;return e=pr(A,["moof","traf"]),i=[].concat.apply([],e.map(function(A){return pr(A,["tfhd"]).map(function(e){var i,n;return i=Ma(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),n=t[i]||9e4,(pr(A,["tfdt"]).map(function(t){var A,e;return A=t[0],e=Ma(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===A&&(e*=Math.pow(2,32),e+=Ma(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),e})[0]||1/0)/n})})),n=Math.min.apply(null,i),isFinite(n)?n:0},videoTrackIds:function(t){var A=[];return pr(t,["moov","trak"]).forEach(function(t){var e=pr(t,["mdia","hdlr"]),i=pr(t,["tkhd"]);e.forEach(function(t,e){var n,r,o=Sr(t.subarray(8,12)),a=i[e];"vide"===o&&(r=0===(n=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0)?n.getUint32(12):n.getUint32(20),A.push(r))})}),A}},ca=Math.pow(2,32)-1;!function(){var t;if(_r={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(t in _r)_r.hasOwnProperty(t)&&(_r[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);$r=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),Ao=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),to=new Uint8Array([0,0,0,1]),eo=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]),io=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]),no={video:eo,audio:io},ao=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),oo=new Uint8Array([0,0,0,0,0,0,0,0]),so=new Uint8Array([0,0,0,0,0,0,0,0]),go=so,Mo=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Io=so,ro=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),Lr=function(t){var A,e,i=[],n=0;for(A=1;A>>1,t.samplingfrequencyindex<<7|t.channelcount<<3,6,1,2]))},Yr=function(){return Lr(_r.ftyp,$r,to,$r,Ao)},Hr=function(t){return Lr(_r.hdlr,no[t])},Ur=function(t){return Lr(_r.mdat,t)},Kr=function(t){var A=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,t.duration>>>24&255,t.duration>>>16&255,t.duration>>>8&255,255&t.duration,85,196,0,0]);return t.samplerate&&(A[12]=t.samplerate>>>24&255,A[13]=t.samplerate>>>16&255,A[14]=t.samplerate>>>8&255,A[15]=255&t.samplerate),Lr(_r.mdhd,A)},Gr=function(t){return Lr(_r.mdia,Kr(t),Hr(t.type),vr(t))},Or=function(t){return Lr(_r.mfhd,new Uint8Array([0,0,0,0,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t]))},vr=function(t){return Lr(_r.minf,"video"===t.type?Lr(_r.vmhd,ro):Lr(_r.smhd,oo),jr(),Wr(t))},kr=function(t,A){for(var e=[],i=A.length;i--;)e[i]=qr(A[i]);return Lr.apply(null,[_r.moof,Or(t)].concat(e))},zr=function(t){for(var A=t.length,e=[];A--;)e[A]=Rr(t[A]);return Lr.apply(null,[_r.moov,br(4294967295)].concat(e).concat(Fr(t)))},Fr=function(t){for(var A=t.length,e=[];A--;)e[A]=Xr(t[A]);return Lr.apply(null,[_r.mvex].concat(e))},br=function(t){var A=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&t)>>24,(16711680&t)>>16,(65280&t)>>8,255&t,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 Lr(_r.mvhd,A)},Pr=function(t){var A,e,i=t.samples||[],n=new Uint8Array(4+i.length);for(e=0;e>>8),n.push(255&e[A].byteLength),n=n.concat(Array.prototype.slice.call(e[A]));for(A=0;A>>8),r.push(255&i[A].byteLength),r=r.concat(Array.prototype.slice.call(i[A]));return Lr(_r.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&t.width)>>8,255&t.width,(65280&t.height)>>8,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,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]),Lr(_r.avcC,new Uint8Array([1,t.profileIdc,t.profileCompatibility,t.levelIdc,255].concat([e.length]).concat(n).concat([i.length]).concat(r))),Lr(_r.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},A=function(t){return Lr(_r.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&t.channelcount)>>8,255&t.channelcount,(65280&t.samplesize)>>8,255&t.samplesize,0,0,0,0,(65280&t.samplerate)>>8,255&t.samplerate,0,0]),xr(t))}}(),Jr=function(t){var A=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,0,(4278190080&t.duration)>>24,(16711680&t.duration)>>16,(65280&t.duration)>>8,255&t.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&t.width)>>8,255&t.width,0,0,(65280&t.height)>>8,255&t.height,0,0]);return Lr(_r.tkhd,A)},qr=function(t){var A,e,i,n,r,o;return A=Lr(_r.tfhd,new Uint8Array([0,0,0,58,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(t.baseMediaDecodeTime/(ca+1)),o=Math.floor(t.baseMediaDecodeTime%(ca+1)),e=Lr(_r.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===t.type?(i=Zr(t,92),Lr(_r.traf,A,e,i)):(n=Pr(t),i=Zr(t,n.length+92),Lr(_r.traf,A,e,i,n))},Rr=function(t){return t.duration=t.duration||4294967295,Lr(_r.trak,Jr(t),Gr(t))},Xr=function(t){var A=new Uint8Array([0,0,0,0,(4278190080&t.id)>>24,(16711680&t.id)>>16,(65280&t.id)>>8,255&t.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==t.type&&(A[A.length-1]=0),Lr(_r.trex,A)},function(){var t,A,e;e=function(t,A){var e=0,i=0,n=0,r=0;return t.length&&(void 0!==t[0].duration&&(e=1),void 0!==t[0].size&&(i=2),void 0!==t[0].flags&&(n=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,e|i|n|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&A)>>>24,(16711680&A)>>>16,(65280&A)>>>8,255&A]},A=function(t,A){var i,n,r,o;for(A+=20+16*(n=t.samples||[]).length,i=e(n,A),o=0;o>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size,r.flags.isLeading<<2|r.flags.dependsOn,r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,61440&r.flags.degradationPriority,15&r.flags.degradationPriority,(4278190080&r.compositionTimeOffset)>>>24,(16711680&r.compositionTimeOffset)>>>16,(65280&r.compositionTimeOffset)>>>8,255&r.compositionTimeOffset]);return Lr(_r.trun,new Uint8Array(i))},t=function(t,A){var i,n,r,o;for(A+=20+8*(n=t.samples||[]).length,i=e(n,A),o=0;o>>24,(16711680&r.duration)>>>16,(65280&r.duration)>>>8,255&r.duration,(4278190080&r.size)>>>24,(16711680&r.size)>>>16,(65280&r.size)>>>8,255&r.size]);return Lr(_r.trun,new Uint8Array(i))},Zr=function(e,i){return"audio"===e.type?t(e,i):A(e,i)}}();var ua={ftyp:Yr,mdat:Ur,moof:kr,moov:zr,initSegment:function(t){var A,e=Yr(),i=zr(t);return(A=new Uint8Array(e.byteLength+i.byteLength)).set(e),A.set(i,e.byteLength),A}},Ea=ua.ftyp,ha=ua.mdat,la=ua.moof,da=ua.moov,Ca=ua.initSegment,Ta=Object.freeze({default:ua,__moduleExports:ua,ftyp:Ea,mdat:ha,moof:la,moov:da,initSegment:Ca}),Na=function(){this.init=function(){var t={};this.on=function(A,e){t[A]||(t[A]=[]),t[A]=t[A].concat(e)},this.off=function(A,e){var i;return!!t[A]&&(i=t[A].indexOf(e),t[A]=t[A].slice(),t[A].splice(i,1),i>-1)},this.trigger=function(A){var e,i,n,r;if(e=t[A])if(2===arguments.length)for(n=e.length,i=0;i1&&(A=t.shift(),t.byteLength-=A.byteLength,t.nalCount-=A.nalCount,t[0][0].dts=A.dts,t[0][0].pts=A.pts,t[0][0].duration+=A.duration),t},generateSampleTable:function(t,A){var e,i,n,r,o,a=A||0,s=[];for(e=0;e>>8,n=255&A,A!==this.PADDING_)if(A===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(A===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=t.pts;else if(A===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(A===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(A===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(A===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(A===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(A===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=qa();else if(A===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=qa();else if(A===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=qa()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(i,n))r=Wa((i=(3&i)<<8)|n),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(i,n))"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),r=Wa((i=(3&i)<<8)|n),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(i,n))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&n)&&this.addFormatting(t.pts,["i"]),1==(1&n)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(i,n))this.column_+=3&n;else if(this.isPAC(i,n)){var o=Va.indexOf(7968&A);"rollUp"===this.mode_&&this.setRollUp(t.pts,o),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&A)&&(this.column_=4*((14&A)>>1)),this.isColorPAC(n)&&14==(14&n)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(i)&&(0===n&&(n=null),r=Wa(i),r+=Wa(n),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Xa.prototype=new Ga,Xa.prototype.flushDisplayed=function(t){var A=this.displayed_.map(function(t){return t.trim()}).join("\n").replace(/^\n+|\n+$/g,"");A.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:A,stream:this.name_})},Xa.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=qa(),this.nonDisplayed_=qa(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Xa.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_},Xa.prototype.isSpecialCharacter=function(t,A){return t===this.EXT_&&A>=48&&A<=63},Xa.prototype.isExtCharacter=function(t,A){return(t===this.EXT_+1||t===this.EXT_+2)&&A>=32&&A<=63},Xa.prototype.isMidRowCode=function(t,A){return t===this.EXT_&&A>=32&&A<=47},Xa.prototype.isOffsetControlCode=function(t,A){return t===this.OFFSET_&&A>=33&&A<=35},Xa.prototype.isPAC=function(t,A){return t>=this.BASE_&&t=64&&A<=127},Xa.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Xa.prototype.isNormalChar=function(t){return t>=32&&t<=127},Xa.prototype.setRollUp=function(t,A){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=qa(),this.displayed_=qa()),void 0!==A&&A!==this.row_)for(var e=0;e"},"");this[this.mode_](t,e)},Xa.prototype.clearFormatting=function(t){if(this.formatting_.length){var A=this.formatting_.reverse().reduce(function(t,A){return t+""+A+">"},"");this.formatting_=[],this[this.mode_](t,A)}},Xa.prototype.popOn=function(t,A){var e=this.nonDisplayed_[this.row_];e+=A,this.nonDisplayed_[this.row_]=e},Xa.prototype.rollUp=function(t,A){var e=this.displayed_[this.row_];e+=A,this.displayed_[this.row_]=e},Xa.prototype.shiftRowsUp_=function(){var t;for(t=0;tA&&(e=-1);Math.abs(A-t)>4294967296;)t+=8589934592*e;return t},as=function t(A){var e,i;t.prototype.init.call(this),this.type_=A,this.push=function(t){t.type===this.type_&&(void 0===i&&(i=t.dts),t.dts=os(t.dts,i),t.pts=os(t.pts,i),e=t.dts,this.trigger("data",t))},this.flush=function(){i=e,this.trigger("done")},this.discontinuity=function(){i=void 0,e=void 0}};as.prototype=new Ga;var ss,gs={TimestampRolloverStream:as,handleRollover:os},Ms=gs.TimestampRolloverStream,Is=gs.handleRollover,cs=Object.freeze({default:gs,__moduleExports:gs,TimestampRolloverStream:Ms,handleRollover:Is}),us=rs&&As||rs,Es=function(t,A,e){var i,n="";for(i=A;i>>2;I*=4,I+=3&M[7],s.timeStamp=I,void 0===A.pts&&void 0===A.dts&&(A.pts=s.timeStamp,A.dts=s.timeStamp),this.trigger("timestamp",s)}A.frames.push(s),o+=10,o+=a}while(o>>4>1&&(i+=A[i]+1),0===e.pid)e.type="pat",t(A.subarray(i),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",t(A.subarray(i),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([A,i,e]):this.processPes_(A,i,e)},this.processPes_=function(t,A,e){e.pid===this.programMapTable.video?e.streamType=us.H264_STREAM_TYPE:e.pid===this.programMapTable.audio?e.streamType=us.ADTS_STREAM_TYPE:e.streamType=this.programMapTable["timed-metadata"][e.pid],e.type="pes",e.data=t.subarray(A),this.trigger("data",e)}}).prototype=new Ga,Ns.STREAM_TYPES={h264:27,adts:15},(Ds=function(){var t=this,A={data:[],size:0},e={data:[],size:0},i={data:[],size:0},n=function(A,e,i){var n,r=new Uint8Array(A.size),o={type:e},a=0,s=0,g=!1;if(A.data.length&&!(A.size<9)){for(o.trackId=A.data[0].pid,a=0;a>>3,A.pts*=4,A.pts+=(6&t[13])>>>1,A.dts=A.pts,64&e&&(A.dts=(14&t[14])<<27|(255&t[15])<<20|(254&t[16])<<12|(255&t[17])<<5|(254&t[18])>>>3,A.dts*=4,A.dts+=(6&t[18])>>>1)),A.data=t.subarray(9+t[8])})(r,o),g="video"===e||o.packetLength<=A.size,(i||g)&&(A.size=0,A.data.length=0),g&&t.trigger("data",o)}};Ds.prototype.init.call(this),this.push=function(r){({pat:function(){},pes:function(){var t,o;switch(r.streamType){case us.H264_STREAM_TYPE:case us.H264_STREAM_TYPE:t=A,o="video";break;case us.ADTS_STREAM_TYPE:t=e,o="audio";break;case us.METADATA_STREAM_TYPE:t=i,o="timed-metadata";break;default:return}r.payloadUnitStartIndicator&&n(t,o,!0),t.data.push(r),t.size+=r.data.byteLength},pmt:function(){var A={type:"metadata",tracks:[]},e=r.programMapTable;null!==e.video&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",A)}})[r.type]()},this.flush=function(){n(A,"video"),n(e,"audio"),n(i,"timed-metadata"),this.trigger("done")}}).prototype=new Ga;var ps={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ts,TransportParseStream:Ns,ElementaryStream:Ds,TimestampRolloverStream:ms,CaptionStream:fs.CaptionStream,Cea608Stream:fs.Cea608Stream,MetadataStream:ws};for(var Ss in us)us.hasOwnProperty(Ss)&&(ps[Ss]=us[Ss]);var Ls,js=ps,xs=Object.freeze({default:js,__moduleExports:js}),Ys=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(Ls=function(){var t;Ls.prototype.init.call(this),this.push=function(A){var e,i,n,r,o,a,s=0,g=0;if("audio"===A.type)for(t?(r=t,(t=new Uint8Array(r.byteLength+A.data.byteLength)).set(r),t.set(A.data,r.byteLength)):t=A.data;s+5>5,a=9e4*(o=1024*(1+(3&t[s+6])))/Ys[(60&t[s+2])>>>2],n=s+e,t.byteLength>>6&3),channelcount:(1&t[s+2])<<2|(192&t[s+3])>>>6,samplerate:Ys[(60&t[s+2])>>>2],samplingfrequencyindex:(60&t[s+2])>>>2,samplesize:16,data:t.subarray(s+7+i,n)}),t.byteLength===n)return void(t=void 0);g++,t=t.subarray(n)}else s++},this.flush=function(){this.trigger("done")}}).prototype=new Ga;var Us,Os,vs,ks=Ls,zs=Object.freeze({default:ks,__moduleExports:ks}),Fs=function(t){var A=t.byteLength,e=0,i=0;this.length=function(){return 8*A},this.bitsAvailable=function(){return 8*A+i},this.loadWord=function(){var n=t.byteLength-A,r=new Uint8Array(4),o=Math.min(4,A);if(0===o)throw new Error("no bytes available");r.set(t.subarray(n,n+o)),e=new DataView(r.buffer).getUint32(0),i=8*o,A-=o},this.skipBits=function(t){var n;i>t?(e<<=t,i-=t):(t-=i,t-=8*(n=Math.floor(t/8)),A-=n,this.loadWord(),e<<=t,i-=t)},this.readBits=function(t){var n=Math.min(i,t),r=e>>>32-n;return(i-=n)>0?e<<=n:A>0&&this.loadWord(),(n=t-n)>0?r<>>t))return e<<=t,i-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},bs=Object.freeze({default:Fs,__moduleExports:Fs}),Rs=bs&&Fs||bs;(Os=function(){var t,A,e=0;Os.prototype.init.call(this),this.push=function(i){var n;for(A?((n=new Uint8Array(A.byteLength+i.data.byteLength)).set(A),n.set(i.data,A.byteLength),A=n):A=i.data;e3&&this.trigger("data",A.subarray(e+3)),A=null,e=0,this.trigger("done")}}).prototype=new Ga,vs={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(Us=function(){var t,A,e,i,n,r,o,a=new Os;Us.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(A=t.trackId,e=t.pts,i=t.dts,a.push(t))},a.on("data",function(o){var a={trackId:A,pts:e,dts:i,data:o};switch(31&o[0]){case 5:a.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:a.nalUnitType="sei_rbsp",a.escapedRBSP=n(o.subarray(1));break;case 7:a.nalUnitType="seq_parameter_set_rbsp",a.escapedRBSP=n(o.subarray(1)),a.config=r(a.escapedRBSP);break;case 8:a.nalUnitType="pic_parameter_set_rbsp";break;case 9:a.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",a)}),a.on("done",function(){t.trigger("done")}),this.flush=function(){a.flush()},o=function(t,A){var e,i=8,n=8;for(e=0;e>4?e+20:e+10},this.parseAdtsSize=function(t,A){var e=(224&t[A+5])>>5,i=t[A+4]<<3;return 6144&t[A+3]|i|e},this.push=function(e){var i,n,r,o,a=0,s=0;for(t.length?(o=t.length,(t=new Uint8Array(e.byteLength+o)).set(t.subarray(0,o)),t.set(e,o)):t=e;t.length-s>=3;)if(t[s]!=="I".charCodeAt(0)||t[s+1]!=="D".charCodeAt(0)||t[s+2]!=="3".charCodeAt(0))if(!0&t[s]&&240==(240&t[s+1])){if(t.length-s<7)break;if((a=this.parseAdtsSize(t,s))>t.length)break;r={type:"audio",data:t.subarray(s,s+a),pts:A,dts:A},this.trigger("data",r),s+=a}else s++;else{if(t.length-s<10)break;if((a=this.parseId3TagSize(t,s))>t.length)break;n={type:"timed-metadata",data:t.subarray(s,s+a)},this.trigger("data",n),s+=a}i=t.length-s,t=i>0?t.subarray(s):new Uint8Array}}).prototype=new Ga;var Ws,Vs,qs,Xs,Zs,_s,$s,tg,Ag,eg,ig,ng=Js,rg=Object.freeze({default:ng,__moduleExports:ng}),og=[33,16,5,32,164,27],ag=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],sg=function(t){for(var A=[];t--;)A.push(0);return A},gg=function(t){return Object.keys(t).reduce(function(A,e){return A[e]=new Uint8Array(t[e].reduce(function(t,A){return t.concat(A)},[])),A},{})}({96000:[og,[227,64],sg(154),[56]],88200:[og,[231],sg(170),[56]],64000:[og,[248,192],sg(240),[56]],48000:[og,[255,192],sg(268),[55,148,128],sg(54),[112]],44100:[og,[255,192],sg(268),[55,163,128],sg(84),[112]],32000:[og,[255,192],sg(268),[55,234],sg(226),[112]],24000:[og,[255,192],sg(268),[55,255,128],sg(268),[111,112],sg(126),[224]],16000:[og,[255,192],sg(268),[55,255,128],sg(268),[111,255],sg(269),[223,108],sg(195),[1,192]],12000:[ag,sg(268),[3,127,248],sg(268),[6,255,240],sg(268),[13,255,224],sg(268),[27,253,128],sg(259),[56]],11025:[ag,sg(268),[3,127,248],sg(268),[6,255,240],sg(268),[13,255,224],sg(268),[27,255,192],sg(268),[55,175,128],sg(108),[112]],8000:[ag,sg(268),[3,121,16],sg(47),[7]]}),Mg=Object.freeze({default:gg,__moduleExports:gg}),Ig={secondsToVideoTs:Ws=function(t){return 9e4*t},secondsToAudioTs:Vs=function(t,A){return t*A},videoTsToSeconds:qs=function(t){return t/9e4},audioTsToSeconds:Xs=function(t,A){return t/A},audioTsToVideoTs:function(t,A){return Ws(Xs(t,A))},videoTsToAudioTs:function(t,A){return Vs(qs(t),A)}},cg=Ig.secondsToVideoTs,ug=Ig.secondsToAudioTs,Eg=Ig.videoTsToSeconds,hg=Ig.audioTsToSeconds,lg=Ig.audioTsToVideoTs,dg=Ig.videoTsToAudioTs,Cg=Object.freeze({default:Ig,__moduleExports:Ig,secondsToVideoTs:cg,secondsToAudioTs:ug,videoTsToSeconds:Eg,audioTsToSeconds:hg,audioTsToVideoTs:lg,videoTsToAudioTs:dg}),Tg=Ta&&ua||Ta,Ng=La&&fa||La,Dg=Oa&&ja||Oa,yg=xs&&js||xs,Bg=zs&&ks||zs,fg=rg&&ng||rg,Qg=Mg&&gg||Mg,wg=Cg&&Ig||Cg,mg=(Ps&&Gs||Ps).H264Stream,pg=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Sg=["width","height","profileIdc","levelIdc","profileCompatibility"];Ag=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},eg=function(t,A){var e;if(t.length!==A.length)return!1;for(e=0;e45e3))){for((i=Qg[t.samplerate])||(i=A[0].data),n=0;n=n?A:(t.minSegmentDts=1/0,A.filter(function(A){return A.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,A.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},this.generateSampleTable_=function(t){var A,e,i=[];for(A=0;A=-1e4&&e<=45e3&&(!i||a>e)&&(i=r,a=e));return i?i.gop:null},this.alignGopsAtStart_=function(t){var A,e,i,n,r,a,s,g;for(r=t.byteLength,a=t.nalCount,s=t.duration,A=e=0;Ai.pts?A++:(e++,r-=n.byteLength,a-=n.nalCount,s-=n.duration);return 0===e?t:e===t.length?null:((g=t.slice(e)).byteLength=r,g.duration=s,g.nalCount=a,g.pts=g[0].pts,g.dts=g[0].dts,g)},this.alignGopsAtEnd_=function(t){var A,e,i,n,r,a,s;for(A=o.length-1,e=t.length-1,r=null,a=!1;A>=0&&e>=0;){if(i=o[A],n=t[e],i.pts===n.pts){a=!0;break}i.pts>n.pts?A--:(A===o.length-1&&(r=e),e--)}if(!a&&null===r)return null;if(0===(s=a?e:r))return t;var g=t.slice(s),M=g.reduce(function(t,A){return t.byteLength+=A.byteLength,t.duration+=A.duration,t.nalCount+=A.nalCount,t},{byteLength:0,duration:0,nalCount:0});return g.byteLength=M.byteLength,g.duration=M.duration,g.nalCount=M.nalCount,g.pts=g[0].pts,g.dts=g[0].dts,g},this.alignGopsWith=function(t){o=t}}).prototype=new Ga,(tg=function(t,A){this.numberOfTracks=0,this.metadataStream=A,void 0!==t.remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,tg.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBoxes.push(t.boxes),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track),void("audio"===t.track.type&&(this.audioTrack=t.track)))}}).prototype=new Ga,tg.prototype.flush=function(t){var A,e,i,n,r=0,o={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Sg.forEach(function(t){o.info[t]=this.videoTrack[t]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,pg.forEach(function(t){o.info[t]=this.audioTrack[t]},this)),1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,i=Tg.initSegment(this.pendingTracks),o.initSegment=new Uint8Array(i.byteLength),o.initSegment.set(i),o.data=new Uint8Array(this.pendingBytes),n=0;n=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},($s=function(t){var A,e,i=this,n=!0;$s.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new yg.MetadataStream,A.aacStream=new fg,A.audioTimestampRolloverStream=new yg.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new yg.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Bg,A.coalesceStream=new tg(t,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(t){A.aacStream.setTimestamp(t.timeStamp)}),A.aacStream.on("data",function(n){"timed-metadata"!==n.type||A.audioSegmentStream||(e=e||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new _s(e,t),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="ts",n.metadataStream=new yg.MetadataStream,n.packetStream=new yg.TransportPacketStream,n.parseStream=new yg.TransportParseStream,n.elementaryStream=new yg.ElementaryStream,n.videoTimestampRolloverStream=new yg.TimestampRolloverStream("video"),n.audioTimestampRolloverStream=new yg.TimestampRolloverStream("audio"),n.timedMetadataTimestampRolloverStream=new yg.TimestampRolloverStream("timed-metadata"),n.adtsStream=new Bg,n.h264Stream=new mg,n.captionStream=new yg.CaptionStream,n.coalesceStream=new tg(t,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream),n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream),n.elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.elementaryStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on("data",function(r){var o;if("metadata"===r.type){for(o=r.tracks.length;o--;)A||"video"!==r.tracks[o].type?e||"audio"!==r.tracks[o].type||((e=r.tracks[o]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(A=r.tracks[o]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;A&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new Zs(A,t),n.videoSegmentStream.on("timelineStartInfo",function(t){e&&(e.timelineStartInfo=t,n.audioSegmentStream.setEarliestDts(t.dts))}),n.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),n.videoSegmentStream.on("baseMediaDecodeTime",function(t){e&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(t)}),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),e&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new _s(e,t),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))}}),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(t){var i=this.transmuxPipeline_;this.baseMediaDecodeTime=t,e&&(e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,Dg.clearDtsInfo(e),e.timelineStartInfo.baseMediaDecodeTime=t,i.audioTimestampRolloverStream&&i.audioTimestampRolloverStream.discontinuity()),A&&(i.videoSegmentStream&&(i.videoSegmentStream.gopCache_=[],i.videoTimestampRolloverStream.discontinuity()),A.timelineStartInfo.dts=void 0,A.timelineStartInfo.pts=void 0,Dg.clearDtsInfo(A),i.captionStream.reset(),A.timelineStartInfo.baseMediaDecodeTime=t),i.timedMetadataTimestampRolloverStream&&i.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){e&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.alignGopsWith=function(t){A&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(n){var A=Ag(t);A&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():A||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Ga;var Lg,jg,xg={Transmuxer:$s,VideoSegmentStream:Zs,AudioSegmentStream:_s,AUDIO_PROPERTIES:pg,VIDEO_PROPERTIES:Sg},Yg=xg.Transmuxer,Ug=xg.VideoSegmentStream,Og=xg.AudioSegmentStream,vg=xg.AUDIO_PROPERTIES,kg=xg.VIDEO_PROPERTIES,zg=Object.freeze({default:xg,__moduleExports:xg,Transmuxer:Yg,VideoSegmentStream:Ug,AudioSegmentStream:Og,AUDIO_PROPERTIES:vg,VIDEO_PROPERTIES:kg}),Fg=Ia.parseType,bg=function(t){return new Date(1e3*t-20828448e5)},Rg=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},Jg={avc1:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:A.getUint16(6),width:A.getUint16(24),height:A.getUint16(26),horizresolution:A.getUint16(28)+A.getUint16(30)/16,vertresolution:A.getUint16(32)+A.getUint16(34)/16,frameCount:A.getUint16(40),depth:A.getUint16(74),config:Lg(t.subarray(78,t.byteLength))}},avcC:function(t){var A,e,i,n,r=new DataView(t.buffer,t.byteOffset,t.byteLength),o={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},a=31&t[5];for(i=6,n=0;n>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e={majorBrand:Fg(t.subarray(0,4)),minorVersion:A.getUint32(4),compatibleBrands:[]},i=8;iMALFORMED DATA");else switch(31&t[A]){case 1:n.push("slice_layer_without_partitioning_rbsp");break;case 5:n.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:n.push("sei_rbsp");break;case 7:n.push("seq_parameter_set_rbsp");break;case 8:n.push("pic_parameter_set_rbsp");break;case 9:n.push("access_unit_delimiter_rbsp");break;default:n.push("UNKNOWN NAL - "+t[A]&31)}return n}(t)}},mdhd:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),language:""};return 1===n.version?(i+=4,n.creationTime=bg(e.getUint32(i)),i+=8,n.modificationTime=bg(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=bg(e.getUint32(i)),i+=4,n.modificationTime=bg(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,A=e.getUint16(i),n.language+=String.fromCharCode(96+(A>>10)),n.language+=String.fromCharCode(96+((992&A)>>5)),n.language+=String.fromCharCode(96+(31&A)),n},mdia:function(t){return{boxes:Lg(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:Lg(t)}},mp4a:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e={dataReferenceIndex:A.getUint16(6),channelcount:A.getUint16(16),samplesize:A.getUint16(18),samplerate:A.getUint16(24)+A.getUint16(26)/65536};return t.byteLength>28&&(e.streamDescriptor=Lg(t.subarray(28))[0]),e},moof:function(t){return{boxes:Lg(t)}},moov:function(t){return{boxes:Lg(t)}},mvex:function(t){return{boxes:Lg(t)}},mvhd:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e=4,i={version:A.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===i.version?(e+=4,i.creationTime=bg(A.getUint32(e)),e+=8,i.modificationTime=bg(A.getUint32(e)),e+=4,i.timescale=A.getUint32(e),e+=8,i.duration=A.getUint32(e)):(i.creationTime=bg(A.getUint32(e)),e+=4,i.modificationTime=bg(A.getUint32(e)),e+=4,i.timescale=A.getUint32(e),e+=4,i.duration=A.getUint32(e)),e+=4,i.rate=A.getUint16(e)+A.getUint16(e+2)/16,e+=4,i.volume=A.getUint8(e)+A.getUint8(e+1)/8,e+=2,e+=2,e+=8,i.matrix=new Uint32Array(t.subarray(e,e+36)),e+=36,e+=24,i.nextTrackId=A.getUint32(e),i},pdin:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:A.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:A.getUint32(4),initialDelay:A.getUint32(8)}},sdtp:function(t){var A,e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(A=4;A>4,isDependedOn:(12&t[A])>>2,hasRedundancy:3&t[A]});return e},sidx:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8),earliestPresentationTime:e.getUint32(12),firstOffset:e.getUint32(16)},n=e.getUint16(22);for(A=24;n;A+=12,n--)i.references.push({referenceType:(128&t[A])>>>7,referencedSize:2147483647&e.getUint32(A),subsegmentDuration:e.getUint32(A+4),startsWithSap:!!(128&t[A+8]),sapType:(112&t[A+8])>>>4,sapDeltaTime:268435455&e.getUint32(A+8)});return i},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:Lg(t)}},stco:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},n=e.getUint32(4);for(A=8;n;A+=4,n--)i.chunkOffsets.push(e.getUint32(A));return i},stsc:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=e.getUint32(4),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(A=8;i;A+=12,i--)n.sampleToChunks.push({firstChunk:e.getUint32(A),samplesPerChunk:e.getUint32(A+4),sampleDescriptionIndex:e.getUint32(A+8)});return n},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:Lg(t.subarray(8))}},stsz:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:e.getUint32(4),entries:[]};for(A=12;A>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:A.getUint16(22)}},trun:function(t){var A,e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=1&e.flags[2],r=4&e.flags[2],o=1&e.flags[1],a=2&e.flags[1],s=4&e.flags[1],g=8&e.flags[1],M=i.getUint32(4),I=8;for(n&&(e.dataOffset=i.getInt32(I),I+=4),r&&M&&(A={flags:Rg(t.subarray(I,I+4))},I+=4,o&&(A.duration=i.getUint32(I),I+=4),a&&(A.size=i.getUint32(I),I+=4),g&&(A.compositionTimeOffset=i.getUint32(I),I+=4),e.samples.push(A),M--);M--;)A={},o&&(A.duration=i.getUint32(I),I+=4),a&&(A.size=i.getUint32(I),I+=4),s&&(A.flags=Rg(t.subarray(I,I+4)),I+=4),g&&(A.compositionTimeOffset=i.getUint32(I),I+=4),e.samples.push(A);return e},"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:A.getUint16(4),opcolor:new Uint16Array([A.getUint16(6),A.getUint16(8),A.getUint16(10)])}}},Gg={inspect:Lg=function(t){for(var A,e,i,n,r,o=0,a=[],s=new ArrayBuffer(t.length),g=new Uint8Array(s),M=0;M1?o+e:t.byteLength,(r=(Jg[i]||function(t){return{data:t}})(t.subarray(o+8,n))).size=e,r.type=i,a.push(r),o=n;return a},textify:jg=function(t,A){var e;return A=A||0,e=new Array(2*A+1).join(" "),t.map(function(t,i){return e+t.type+"\n"+Object.keys(t).filter(function(t){return"type"!==t&&"boxes"!==t}).map(function(A){var i=e+" "+A+": ",n=t[A];if(n instanceof Uint8Array||n instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).map(function(t){return" "+("00"+t.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return r?1===r.length?i+"<"+r.join("").slice(1)+">":i+"<\n"+r.map(function(t){return e+" "+t}).join("\n")+"\n"+e+" >":i+"<>"}return i+JSON.stringify(n,null,2).split("\n").map(function(t,A){return 0===A?t:e+" "+t}).join("\n")}).join("\n")+(t.boxes?"\n"+jg(t.boxes,A+1):"")}).join("\n")},parseTfdt:Jg.tfdt,parseHdlr:Jg.hdlr,parseTfhd:Jg.tfhd,parseTrun:Jg.trun},Kg=Gg.inspect,Hg=Gg.textify,Pg=Gg.parseTfdt,Wg=Gg.parseHdlr,Vg=Gg.parseTfhd,qg=Gg.parseTrun,Xg=Object.freeze({default:Gg,__moduleExports:Gg,inspect:Kg,textify:Hg,parseTfdt:Pg,parseHdlr:Wg,parseTfhd:Vg,parseTrun:qg}),Zg=Xg&&Gg||Xg,_g=Ka.discardEmulationPreventionBytes,$g=fs.CaptionStream,tM=function(t,A){for(var e=t,i=0;i0?Zg.parseTfdt(M[0]).baseMediaDecodeTime:0,c=Ia.findBox(o,["trun"]);A===g&&c.length>0&&(e=function(t,A,e){var i=A,n=e.defaultSampleDuration||0,r=e.defaultSampleSize||0,o=e.trackId,a=[];return t.forEach(function(t){var A=Zg.parseTrun(t).samples;A.forEach(function(t){void 0===t.duration&&(t.duration=n),void 0===t.size&&(t.size=r),t.trackId=o,t.dts=i,void 0===t.compositionTimeOffset&&(t.compositionTimeOffset=0),t.pts=i+t.compositionTimeOffset,i+=t.duration}),a=a.concat(A)}),a}(c,I,s),n=function(t,A,e){var i,n,r,o,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=[];for(n=0;n+40;){var s=A.shift();this.parse(s,r,o)}return null!==(a=function(t,A,e){return A?{seiNals:AM(t,A)[A],timescale:e}:null}(t,e,i))&&a.seiNals?(this.pushNals(a.seiNals),this.flushStream(),n):null},this.pushNals=function(A){if(!this.isInitialized()||!A||0===A.length)return null;A.forEach(function(A){t.push(A)})},this.flushStream=function(){if(!this.isInitialized())return null;t.flush()},this.clearParsedCaptions=function(){n.captions=[],n.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){A=[],e=null,i=null,n?this.clearParsedCaptions():n={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()},iM=Object.freeze({default:eM,__moduleExports:eM}),nM=zg&&xg||zg,rM=iM&&eM||iM,oM={generator:Tg,probe:Ia,Transmuxer:nM.Transmuxer,AudioSegmentStream:nM.AudioSegmentStream,VideoSegmentStream:nM.VideoSegmentStream,CaptionParser:rM}.CaptionParser,aM=function(t){var A=31&t[1];return(A<<=8)|t[2]},sM=function(t){return!!(64&t[1])},gM=function(t){var A=0;return(48&t[3])>>>4>1&&(A+=t[4]+1),A},MM=function(t){switch(t){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}},IM={parseType:function(t,A){var e=aM(t);return 0===e?"pat":e===A?"pmt":A?"pes":null},parsePat:function(t){var A=sM(t),e=4+gM(t);return A&&(e+=t[e]+1),(31&t[e+10])<<8|t[e+11]},parsePmt:function(t){var A={},e=sM(t),i=4+gM(t);if(e&&(i+=t[i]+1),1&t[i+5]){var n;n=3+((15&t[i+1])<<8|t[i+2])-4;for(var r=12+((15&t[i+10])<<8|t[i+11]);r=t.byteLength)return null;var e,i=null;return 192&(e=t[A+7])&&((i={}).pts=(14&t[A+9])<<27|(255&t[A+10])<<20|(254&t[A+11])<<12|(255&t[A+12])<<5|(254&t[A+13])>>>3,i.pts*=4,i.pts+=(6&t[A+13])>>>1,i.dts=i.pts,64&e&&(i.dts=(14&t[A+14])<<27|(255&t[A+15])<<20|(254&t[A+16])<<12|(255&t[A+17])<<5|(254&t[A+18])>>>3,i.dts*=4,i.dts+=(6&t[A+18])>>>1)),i},videoPacketContainsKeyFrame:function(t){for(var A=4+gM(t),e=t.subarray(A),i=0,n=0,r=!1;n3&&"slice_layer_without_partitioning_rbsp_idr"===MM(31&e[n+3])&&(r=!0),r}},cM=IM.parseType,uM=IM.parsePat,EM=IM.parsePmt,hM=IM.parsePayloadUnitStartIndicator,lM=IM.parsePesType,dM=IM.parsePesTime,CM=IM.videoPacketContainsKeyFrame,TM=Object.freeze({default:IM,__moduleExports:IM,parseType:cM,parsePat:uM,parsePmt:EM,parsePayloadUnitStartIndicator:hM,parsePesType:lM,parsePesTime:dM,videoPacketContainsKeyFrame:CM}),NM=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],DM=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},yM=function(t,A,e){return unescape(function(t,A,e){var i,n="";for(i=A;i>4?e+20:e+10},parseAdtsSize:function(t,A){var e=(224&t[A+5])>>5,i=t[A+4]<<3;return 6144&t[A+3]|i|e},parseType:function(t,A){return t[A]==="I".charCodeAt(0)&&t[A+1]==="D".charCodeAt(0)&&t[A+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[A]&&240==(240&t[A+1])?"audio":null},parseSampleRate:function(t){for(var A=0;A+5>>2];A++}return null},parseAacTimestamp:function(t){var A,e,i;A=10,64&t[5]&&(A+=4,A+=DM(t.subarray(10,14)));do{if((e=DM(t.subarray(A+4,A+8)))<1)return null;if("PRIV"===String.fromCharCode(t[A],t[A+1],t[A+2],t[A+3])){i=t.subarray(A+10,A+e+10);for(var n=0;n>>2;return(o*=4)+(3&r[7])}break}}A+=10,A+=e}while(A=0;)if(71!==t[a]||71!==t[s])a--,s--;else{switch(i=t.subarray(a,s),YM.ts.parseType(i,A.pid)){case"pes":n=YM.ts.parsePesType(i,A.table),r=YM.ts.parsePayloadUnitStartIndicator(i),"audio"===n&&r&&(o=YM.ts.parsePesTime(i))&&(o.type="audio",e.audio.push(o),g=!0)}if(g)break;a-=188,s-=188}},OM=function(t,A,e){for(var i,n,r,o,a,s,g,M=0,I=188,c=!1,u={data:[],size:0};I=0;)if(71!==t[M]||71!==t[I])M--,I--;else{switch(i=t.subarray(M,I),YM.ts.parseType(i,A.pid)){case"pes":n=YM.ts.parsePesType(i,A.table),r=YM.ts.parsePayloadUnitStartIndicator(i),"video"===n&&r&&(o=YM.ts.parsePesTime(i))&&(o.type="video",e.video.push(o),c=!0)}if(c)break;M-=188,I-=188}},vM=function(t){var A={pid:null,table:null},e={};for(var i in function(t,A){for(var e,i=0,n=188;n=3;){switch(YM.aac.parseType(t,a)){case"timed-metadata":if(t.length-a<10){e=!0;break}if((o=YM.aac.parseId3TagSize(t,a))>t.length){e=!0;break}null===r&&(A=t.subarray(a,a+o),r=YM.aac.parseAacTimestamp(A)),a+=o;break;case"audio":if(t.length-a<7){e=!0;break}if((o=YM.aac.parseAdtsSize(t,a))>t.length){e=!0;break}null===n&&(A=t.subarray(a,a+o),n=YM.aac.parseSampleRate(A)),i++,a+=o;break;default:a++}if(e)return null}if(null===n||null===r)return null;var s=9e4/n;return{audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+1024*i*s,pts:r+1024*i*s}]}}(t):vM(t))&&(e.audio||e.video)?(function(t,A){if(t.audio&&t.audio.length){var e=A;void 0===e&&(e=t.audio[0].dts),t.audio.forEach(function(t){t.dts=xM(t.dts,e),t.pts=xM(t.pts,e),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4})}if(t.video&&t.video.length){var i=A;if(void 0===i&&(i=t.video[0].dts),t.video.forEach(function(t){t.dts=xM(t.dts,i),t.pts=xM(t.pts,i),t.dtsTime=t.dts/9e4,t.ptsTime=t.pts/9e4}),t.firstKeyFrame){var n=t.firstKeyFrame;n.dts=xM(n.dts,i),n.pts=xM(n.pts,i),n.dtsTime=n.dts/9e4,n.ptsTime=n.dts/9e4}}}(e,A),e):null},zM=function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")},FM=function(){function t(t,A){for(var e=0;e>7))^r]=r;for(o=a=0;!i[o];o^=M||1,a=g[a]||1)for(c=(c=a^a<<1^a<<2^a<<3^a<<4)>>8^255&c^99,i[o]=c,n[c]=o,E=16843009*s[I=s[M=s[o]]]^65537*I^257*M^16843008*o,u=257*s[c]^16843008*c,r=0;r<4;r++)A[r][o]=u=u<<24^u>>>8,e[r][c]=E=E<<24^E>>>8;for(r=0;r<5;r++)A[r]=A[r].slice(0),e[r]=e[r].slice(0);return t},JM=null,GM=function(){function t(A){zM(this,t),JM||(JM=RM()),this._tables=[[JM[0][0].slice(),JM[0][1].slice(),JM[0][2].slice(),JM[0][3].slice(),JM[0][4].slice()],[JM[1][0].slice(),JM[1][1].slice(),JM[1][2].slice(),JM[1][3].slice(),JM[1][4].slice()]];var e=void 0,i=void 0,n=void 0,r=void 0,o=void 0,a=this._tables[0][4],s=this._tables[1],g=A.length,M=1;if(4!==g&&6!==g&&8!==g)throw new Error("Invalid aes key size");for(r=A.slice(0),o=[],this._key=[r,o],e=g;e<4*g+28;e++)n=r[e-1],(e%g==0||8===g&&e%g==4)&&(n=a[n>>>24]<<24^a[n>>16&255]<<16^a[n>>8&255]<<8^a[255&n],e%g==0&&(n=n<<8^n>>>24^M<<24,M=M<<1^283*(M>>7))),r[e]=r[e-g]^n;for(i=0;e;i++,e--)n=r[3&i?e:e-4],o[i]=e<=4||i<4?n:s[0][a[n>>>24]]^s[1][a[n>>16&255]]^s[2][a[n>>8&255]]^s[3][a[255&n]]}return t.prototype.decrypt=function(t,A,e,i,n,r){var o=this._key[1],a=t^o[0],s=i^o[1],g=e^o[2],M=A^o[3],I=void 0,c=void 0,u=void 0,E=o.length/4-2,h=void 0,l=4,d=this._tables[1],C=d[0],T=d[1],N=d[2],D=d[3],y=d[4];for(h=0;h>>24]^T[s>>16&255]^N[g>>8&255]^D[255&M]^o[l],c=C[s>>>24]^T[g>>16&255]^N[M>>8&255]^D[255&a]^o[l+1],u=C[g>>>24]^T[M>>16&255]^N[a>>8&255]^D[255&s]^o[l+2],M=C[M>>>24]^T[a>>16&255]^N[s>>8&255]^D[255&g]^o[l+3],l+=4,a=I,s=c,g=u;for(h=0;h<4;h++)n[(3&-h)+r]=y[a>>>24]<<24^y[s>>16&255]<<16^y[g>>8&255]<<8^y[255&M]^o[l++],I=a,a=s,s=g,g=M,M=I},t}(),KM=function(){function t(){zM(this,t),this.listeners={}}return t.prototype.on=function(t,A){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(A)},t.prototype.off=function(t,A){if(!this.listeners[t])return!1;var e=this.listeners[t].indexOf(A);return this.listeners[t].splice(e,1),e>-1},t.prototype.trigger=function(t){var A=this.listeners[t];if(A)if(2===arguments.length)for(var e=A.length,i=0;i>8|t>>>24},WM=function(t,A,e){var i=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),n=new GM(Array.prototype.slice.call(A)),r=new Uint8Array(t.byteLength),o=new Int32Array(r.buffer),a=void 0,s=void 0,g=void 0,M=void 0,I=void 0,c=void 0,u=void 0,E=void 0,h=void 0;for(a=e[0],s=e[1],g=e[2],M=e[3],h=0;h=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,A){var e=this;this.request=null,this.state="HAVE_METADATA";var i=new yo;i.push(t.responseText),i.end(),i.manifest.uri=A,i.manifest.attributes=i.manifest.attributes||{};var n=rI(this.master,i.manifest);this.targetDuration=i.manifest.targetDuration,n?(this.master=n,this.media_=this.master.playlists[i.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(zt.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=zt.setTimeout(function(){e.trigger("mediaupdatetimeout")},sI(this.media(),!!n))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),zt.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}},{key:"media",value:function(t){var A=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var e=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var i=!this.media_||t.uri!==this.media_.uri;if(this.master.playlists[t.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(i){if(this.state="SWITCHING_MEDIA",this.request){if(qM(this.master.uri,t.uri)===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:qM(this.master.uri,t.uri),withCredentials:this.withCredentials},function(i,n){if(A.request){if(i)return A.playlistRequestError(A.request,t.uri,e);A.haveMetadata(n,t.uri),"HAVE_MASTER"===e?A.trigger("loadedmetadata"):A.trigger("mediachange")}})}}},{key:"pause",value:function(){this.stopRequest(),zt.clearTimeout(this.mediaUpdateTimeout),"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")}},{key:"load",value:function(t){var A=this;zt.clearTimeout(this.mediaUpdateTimeout);var e=this.media();if(t){var i=e?e.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=zt.setTimeout(function(){return A.load()},i)}else this.started?e&&!e.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var t=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(A,e){if(t.request){if(t.request=null,A)return t.error={status:e.status,message:"HLS playlist request error at URL: "+t.srcUrl,responseText:e.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");var i=new yo;return i.push(e.responseText),i.end(),t.state="HAVE_MASTER",i.manifest.uri=t.srcUrl,i.manifest.playlists?(t.master=i.manifest,oI(t.master),aI(t.master),t.trigger("loadedplaylist"),void(t.request||t.media(i.manifest.playlists[0]))):(t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:zt.location.href,playlists:[{uri:t.srcUrl,id:0}]},t.master.playlists[t.srcUrl]=t.master.playlists[0],t.master.playlists[0].resolvedUri=t.srcUrl,t.master.playlists[0].attributes=t.master.playlists[0].attributes||{},t.haveMetadata(e,t.srcUrl),t.trigger("loadedmetadata"))}})}}]),A}(),MI=jt.createTimeRange,II=function(t,A,e){var i=void 0,n=void 0;return void 0===A&&(A=t.mediaSequence+t.segments.length),Ae){var n=[e,A];A=n[0],e=n[1]}if(A<0){for(var r=A;r=i););return Math.max(0,A)},hI=function(t,A,e){if(!t||!t.segments)return null;if(t.endList)return cI(t);if(null===A)return null;A=A||0;var i=e?EI(t):t.segments.length;return II(t,t.mediaSequence+i,A)},lI=function(t){return t-Math.floor(t)==0},dI=function(t,A){if(lI(A))return A+.1*t;for(var e=A.toString().split(".")[1].length,i=1;i<=e;i++){var n=Math.pow(10,i),r=A*n;if(lI(r)||i===e)return(r+t)/n}},CI=dI.bind(null,1),TI=dI.bind(null,-1),NI=function(t){return t.excludeUntil&&t.excludeUntil>Date.now()},DI=function(t){return t.excludeUntil&&t.excludeUntil===1/0},yI=function(t){var A=NI(t);return!t.disabled&&!A},BI=function(t,A){return A.attributes&&A.attributes[t]},fI=function(t,A){if(1===t.playlists.length)return!0;var e=A.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===t.playlists.filter(function(t){return!!yI(t)&&(t.attributes.BANDWIDTH||0)0)for(n=e-1;n>=0;n--)if(r=t.segments[n],(a+=TI(r.duration))>0)return{mediaIndex:n,startTime:i-uI(t,e,n)};return{mediaIndex:0,startTime:A}}if(e<0){for(n=e;n<0;n++)if((a-=t.targetDuration)<0)return{mediaIndex:0,startTime:A};e=0}for(n=e;n3&&void 0!==arguments[3]?arguments[3]:0;return BI("BANDWIDTH",e)?(t*e.attributes.BANDWIDTH-8*i)/A:NaN},isLowestEnabledRendition:fI},wI=jt.xhr,mI=jt.mergeOptions,pI=function(){return function t(A,e){A=mI({timeout:45e3},A);var i=t.beforeRequest||jt.Hls.xhr.beforeRequest;if(i&&"function"==typeof i){var n=i(A);n&&(A=n)}var r=wI(A,function(t,A){var i=r.response;!t&&i&&(r.responseTime=Date.now(),r.roundTripTime=r.responseTime-r.requestTime,r.bytesReceived=i.byteLength||i.length,r.bandwidth||(r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3))),A.headers&&(r.responseHeaders=A.headers),t&&"ETIMEDOUT"===t.code&&(r.timedout=!0),t||r.aborted||200===A.statusCode||206===A.statusCode||0===A.statusCode||(t=new Error("XHR Failed with a response of: "+(r&&(i||r.responseText)))),e(t,r)}),o=r.abort;return r.abort=function(){return r.aborted=!0,o.apply(r,arguments)},r.uri=A.uri,r.requestTime=Date.now(),r}},SI=function(t,A){return t.start(A)+"-"+t.end(A)},LI=function(t,A){var e=t.toString(16);return"00".substring(0,2-e.length)+e+(A%2?" ":"")},jI=function(t){return t>=32&&t<126?String.fromCharCode(t):"."},xI=function(t){var A={};return Object.keys(t).forEach(function(e){var i=t[e];ArrayBuffer.isView(i)?A[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:A[e]=i}),A},YI=function(t){var A=t.byterange||{length:1/0,offset:0};return[A.length,A.offset,t.resolvedUri].join(",")},UI=function(t){for(var A=Array.prototype.slice.call(t),e="",i=0;i=A})},zI=function(t,A){return vI(t,function(t){return t-1/30>=A})},FI=function(t){var A=[];if(!t||!t.length)return"";for(var e=0;e "+t.end(e));return A.join(", ")},bI=function(t){for(var A=[],e=0;e=t&&e.removeCue(n)},JI=function(t){return isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t},GI=function(t,A,e){var i=zt.WebKitDataCue||zt.VTTCue;if(A&&A.forEach(function(t){var A=t.stream;this.inbandTextTracks_[A].addCue(new i(t.startTime+this.timestampOffset,t.endTime+this.timestampOffset,t.text))},t),e){var n=JI(t.mediaSource_.duration);if(e.forEach(function(t){var A=t.cueTime+this.timestampOffset;t.frames.forEach(function(t){var e=new i(A,A,t.value||t.url||t.data||"");e.frame=t,e.value=t,function(t){Object.defineProperties(t.frame,{id:{get:function(){return jt.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get:function(){return jt.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get:function(){return jt.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}})}(e),this.metadataTrack_.addCue(e)},this)},t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){for(var r=t.metadataTrack_.cues,o=[],a=0;a>>1,A.samplingfrequencyindex<<7|A.channelcount<<3,6,1,2]))},n=function(){return t(B.ftyp,f,Q,f,w)},l=function(A){return t(B.hdlr,S[A])},r=function(A){return t(B.mdat,A)},h=function(A){var e=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,A.duration>>>24&255,A.duration>>>16&255,A.duration>>>8&255,255&A.duration,85,196,0,0]);return A.samplerate&&(e[12]=A.samplerate>>>24&255,e[13]=A.samplerate>>>16&255,e[14]=A.samplerate>>>8&255,e[15]=255&A.samplerate),t(B.mdhd,e)},E=function(A){return t(B.mdia,h(A),l(A.type),a(A))},o=function(A){return t(B.mfhd,new Uint8Array([0,0,0,0,(4278190080&A)>>24,(16711680&A)>>16,(65280&A)>>8,255&A]))},a=function(e){return t(B.minf,"video"===e.type?t(B.vmhd,L):t(B.smhd,j),A(),C(e))},s=function(A,e){for(var i=[],n=e.length;n--;)i[n]=N(e[n]);return t.apply(null,[B.moof,o(A)].concat(i))},g=function(A){for(var e=A.length,i=[];e--;)i[e]=c(A[e]);return t.apply(null,[B.moov,I(4294967295)].concat(i).concat(M(A)))},M=function(A){for(var e=A.length,i=[];e--;)i[e]=D(A[e]);return t.apply(null,[B.mvex].concat(i))},I=function(A){var e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&A)>>24,(16711680&A)>>16,(65280&A)>>8,255&A,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(B.mvhd,e)},d=function(A){var e,i,n=A.samples||[],r=new Uint8Array(4+n.length);for(i=0;i>>8),r.push(255&i[e].byteLength),r=r.concat(Array.prototype.slice.call(i[e]));for(e=0;e>>8),o.push(255&n[e].byteLength),o=o.concat(Array.prototype.slice.call(n[e]));return t(B.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&A.width)>>8,255&A.width,(65280&A.height)>>8,255&A.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(B.avcC,new Uint8Array([1,A.profileIdc,A.profileCompatibility,A.levelIdc,255].concat([i.length]).concat(r).concat([n.length]).concat(o))),t(B.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},e=function(A){return t(B.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&A.channelcount)>>8,255&A.channelcount,(65280&A.samplesize)>>8,255&A.samplesize,0,0,0,0,(65280&A.samplerate)>>8,255&A.samplerate,0,0]),i(A))}}(),u=function(A){var e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&A.id)>>24,(16711680&A.id)>>16,(65280&A.id)>>8,255&A.id,0,0,0,0,(4278190080&A.duration)>>24,(16711680&A.duration)>>16,(65280&A.duration)>>8,255&A.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&A.width)>>8,255&A.width,0,0,(65280&A.height)>>8,255&A.height,0,0]);return t(B.tkhd,e)},N=function(A){var e,i,n,r,o,a;return e=t(B.tfhd,new Uint8Array([0,0,0,58,(4278190080&A.id)>>24,(16711680&A.id)>>16,(65280&A.id)>>8,255&A.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),o=Math.floor(A.baseMediaDecodeTime/(k+1)),a=Math.floor(A.baseMediaDecodeTime%(k+1)),i=t(B.tfdt,new Uint8Array([1,0,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a])),92,"audio"===A.type?(n=y(A,92),t(B.traf,e,i,n)):(r=d(A),n=y(A,r.length+92),t(B.traf,e,i,n,r))},c=function(A){return A.duration=A.duration||4294967295,t(B.trak,u(A),E(A))},D=function(A){var e=new Uint8Array([0,0,0,0,(4278190080&A.id)>>24,(16711680&A.id)>>16,(65280&A.id)>>8,255&A.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==A.type&&(e[e.length-1]=0),t(B.trex,e)},function(){var A,e,i;i=function(t,A){var e=0,i=0,n=0,r=0;return t.length&&(void 0!==t[0].duration&&(e=1),void 0!==t[0].size&&(i=2),void 0!==t[0].flags&&(n=4),void 0!==t[0].compositionTimeOffset&&(r=8)),[0,0,e|i|n|r,1,(4278190080&t.length)>>>24,(16711680&t.length)>>>16,(65280&t.length)>>>8,255&t.length,(4278190080&A)>>>24,(16711680&A)>>>16,(65280&A)>>>8,255&A]},e=function(A,e){var n,r,o,a;for(e+=20+16*(r=A.samples||[]).length,n=i(r,e),a=0;a>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size,o.flags.isLeading<<2|o.flags.dependsOn,o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,61440&o.flags.degradationPriority,15&o.flags.degradationPriority,(4278190080&o.compositionTimeOffset)>>>24,(16711680&o.compositionTimeOffset)>>>16,(65280&o.compositionTimeOffset)>>>8,255&o.compositionTimeOffset]);return t(B.trun,new Uint8Array(n))},A=function(A,e){var n,r,o,a;for(e+=20+8*(r=A.samples||[]).length,n=i(r,e),a=0;a>>24,(16711680&o.duration)>>>16,(65280&o.duration)>>>8,255&o.duration,(4278190080&o.size)>>>24,(16711680&o.size)>>>16,(65280&o.size)>>>8,255&o.size]);return t(B.trun,new Uint8Array(n))},y=function(t,i){return"audio"===t.type?A(t,i):e(t,i)}}();var z,F,b={ftyp:n,mdat:r,moof:s,moov:g,initSegment:function(t){var A,e=n(),i=g(t);return(A=new Uint8Array(e.byteLength+i.byteLength)).set(e),A.set(i,e.byteLength),A}},R=function(t){return t>>>0},J={findBox:z=function(t,A){var e,i,n,r,o,a=[];if(!A.length)return null;for(e=0;e1?e+i:t.byteLength,n===A[0]&&(1===A.length?a.push(t.subarray(e+8,r)):(o=z(t.subarray(e+8,r),A.slice(1))).length&&(a=a.concat(o))),e=r;return a},parseType:F=function(t){var A="";return A+=String.fromCharCode(t[0]),A+=String.fromCharCode(t[1]),(A+=String.fromCharCode(t[2]))+String.fromCharCode(t[3])},timescale:function(t){return z(t,["moov","trak"]).reduce(function(t,A){var e,i,n,r,o;return(e=z(A,["tkhd"])[0])?(i=e[0],r=R(e[n=0===i?12:20]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),(o=z(A,["mdia","mdhd"])[0])?(n=0===(i=o[0])?12:20,t[r]=R(o[n]<<24|o[n+1]<<16|o[n+2]<<8|o[n+3]),t):null):null},{})},startTime:function(t,A){var e,i,n;return e=z(A,["moof","traf"]),i=[].concat.apply([],e.map(function(A){return z(A,["tfhd"]).map(function(e){var i,n;return i=R(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),n=t[i]||9e4,(z(A,["tfdt"]).map(function(t){var A,e;return A=t[0],e=R(t[4]<<24|t[5]<<16|t[6]<<8|t[7]),1===A&&(e*=Math.pow(2,32),e+=R(t[8]<<24|t[9]<<16|t[10]<<8|t[11])),e})[0]||1/0)/n})})),n=Math.min.apply(null,i),isFinite(n)?n:0},videoTrackIds:function(t){var A=[];return z(t,["moov","trak"]).forEach(function(t){var e=z(t,["mdia","hdlr"]),i=z(t,["tkhd"]);e.forEach(function(t,e){var n,r,o=F(t.subarray(8,12)),a=i[e];"vide"===o&&(r=0===(n=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0)?n.getUint32(12):n.getUint32(20),A.push(r))})}),A}},G=function(){this.init=function(){var t={};this.on=function(A,e){t[A]||(t[A]=[]),t[A]=t[A].concat(e)},this.off=function(A,e){var i;return!!t[A]&&(i=t[A].indexOf(e),t[A]=t[A].slice(),t[A].splice(i,1),i>-1)},this.trigger=function(A){var e,i,n,r;if(e=t[A])if(2===arguments.length)for(n=e.length,i=0;i1&&(A=t.shift(),t.byteLength-=A.byteLength,t.nalCount-=A.nalCount,t[0][0].dts=A.dts,t[0][0].pts=A.pts,t[0][0].duration+=A.duration),t},q=function(t,A){var e,i,n,r,o,a=A||0,s=[];for(e=0;e>>8,n=255&A,A!==this.PADDING_)if(A===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(A===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(t.pts),this.flushDisplayed(t.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=t.pts;else if(A===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(t.pts);else if(A===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(t.pts);else if(A===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(t.pts);else if(A===this.CARRIAGE_RETURN_)this.clearFormatting(t.pts),this.flushDisplayed(t.pts),this.shiftRowsUp_(),this.startPts_=t.pts;else if(A===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(A===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(t.pts),this.displayed_=gt();else if(A===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=gt();else if(A===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(t.pts),this.displayed_=gt()),this.mode_="paintOn",this.startPts_=t.pts;else if(this.isSpecialCharacter(i,n))r=at((i=(3&i)<<8)|n),this[this.mode_](t.pts,r),this.column_++;else if(this.isExtCharacter(i,n))"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),r=at((i=(3&i)<<8)|n),this[this.mode_](t.pts,r),this.column_++;else if(this.isMidRowCode(i,n))this.clearFormatting(t.pts),this[this.mode_](t.pts," "),this.column_++,14==(14&n)&&this.addFormatting(t.pts,["i"]),1==(1&n)&&this.addFormatting(t.pts,["u"]);else if(this.isOffsetControlCode(i,n))this.column_+=3&n;else if(this.isPAC(i,n)){var o=st.indexOf(7968&A);"rollUp"===this.mode_&&this.setRollUp(t.pts,o),o!==this.row_&&(this.clearFormatting(t.pts),this.row_=o),1&n&&-1===this.formatting_.indexOf("u")&&this.addFormatting(t.pts,["u"]),16==(16&A)&&(this.column_=4*((14&A)>>1)),this.isColorPAC(n)&&14==(14&n)&&this.addFormatting(t.pts,["i"])}else this.isNormalChar(i)&&(0===n&&(n=null),r=at(i),r+=at(n),this[this.mode_](t.pts,r),this.column_+=r.length)}else this.lastControlCode_=null}};Mt.prototype=new K,Mt.prototype.flushDisplayed=function(t){var A=this.displayed_.map(function(t){return t.trim()}).join("\n").replace(/^\n+|\n+$/g,"");A.length&&this.trigger("data",{startPts:this.startPts_,endPts:t,text:A,stream:this.name_})},Mt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=gt(),this.nonDisplayed_=gt(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Mt.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_},Mt.prototype.isSpecialCharacter=function(t,A){return t===this.EXT_&&A>=48&&A<=63},Mt.prototype.isExtCharacter=function(t,A){return(t===this.EXT_+1||t===this.EXT_+2)&&A>=32&&A<=63},Mt.prototype.isMidRowCode=function(t,A){return t===this.EXT_&&A>=32&&A<=47},Mt.prototype.isOffsetControlCode=function(t,A){return t===this.OFFSET_&&A>=33&&A<=35},Mt.prototype.isPAC=function(t,A){return t>=this.BASE_&&t=64&&A<=127},Mt.prototype.isColorPAC=function(t){return t>=64&&t<=79||t>=96&&t<=127},Mt.prototype.isNormalChar=function(t){return t>=32&&t<=127},Mt.prototype.setRollUp=function(t,A){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(t),this.nonDisplayed_=gt(),this.displayed_=gt()),void 0!==A&&A!==this.row_)for(var e=0;e"},"");this[this.mode_](t,e)},Mt.prototype.clearFormatting=function(t){if(this.formatting_.length){var A=this.formatting_.reverse().reduce(function(t,A){return t+""+A+">"},"");this.formatting_=[],this[this.mode_](t,A)}},Mt.prototype.popOn=function(t,A){var e=this.nonDisplayed_[this.row_];e+=A,this.nonDisplayed_[this.row_]=e},Mt.prototype.rollUp=function(t,A){var e=this.displayed_[this.row_];e+=A,this.displayed_[this.row_]=e},Mt.prototype.shiftRowsUp_=function(){var t;for(t=0;tA&&(e=-1);Math.abs(A-t)>4294967296;)t+=8589934592*e;return t},Et=function t(A){var e,i;t.prototype.init.call(this),this.type_=A,this.push=function(t){t.type===this.type_&&(void 0===i&&(i=t.dts),t.dts=ut(t.dts,i),t.pts=ut(t.pts,i),e=t.dts,this.trigger("data",t))},this.flush=function(){i=e,this.trigger("done")},this.discontinuity=function(){i=void 0,e=void 0}};Et.prototype=new K;var ht,lt=Et,dt=function(t,A,e){var i,n="";for(i=A;i>>2;I*=4,I+=3&M[7],s.timeStamp=I,void 0===A.pts&&void 0===A.dts&&(A.pts=s.timeStamp,A.dts=s.timeStamp),this.trigger("timestamp",s)}A.frames.push(s),o+=10,o+=a}while(o>>4>1&&(i+=A[i]+1),0===e.pid)e.type="pat",t(A.subarray(i),e),this.trigger("data",e);else if(e.pid===this.pmtPid)for(e.type="pmt",t(A.subarray(i),e),this.trigger("data",e);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([A,i,e]):this.processPes_(A,i,e)},this.processPes_=function(t,A,e){e.pid===this.programMapTable.video?e.streamType=ct.H264_STREAM_TYPE:e.pid===this.programMapTable.audio?e.streamType=ct.ADTS_STREAM_TYPE:e.streamType=this.programMapTable["timed-metadata"][e.pid],e.type="pes",e.data=t.subarray(A),this.trigger("data",e)}}).prototype=new K,Bt.STREAM_TYPES={h264:27,adts:15},(ft=function(){var t=this,A={data:[],size:0},e={data:[],size:0},i={data:[],size:0},n=function(A,e,i){var n,r=new Uint8Array(A.size),o={type:e},a=0,s=0,g=!1;if(A.data.length&&!(A.size<9)){for(o.trackId=A.data[0].pid,a=0;a>>3,A.pts*=4,A.pts+=(6&t[13])>>>1,A.dts=A.pts,64&e&&(A.dts=(14&t[14])<<27|(255&t[15])<<20|(254&t[16])<<12|(255&t[17])<<5|(254&t[18])>>>3,A.dts*=4,A.dts+=(6&t[18])>>>1)),A.data=t.subarray(9+t[8])})(r,o),g="video"===e||o.packetLength<=A.size,(i||g)&&(A.size=0,A.data.length=0),g&&t.trigger("data",o)}};ft.prototype.init.call(this),this.push=function(r){({pat:function(){},pes:function(){var t,o;switch(r.streamType){case ct.H264_STREAM_TYPE:case ct.H264_STREAM_TYPE:t=A,o="video";break;case ct.ADTS_STREAM_TYPE:t=e,o="audio";break;case ct.METADATA_STREAM_TYPE:t=i,o="timed-metadata";break;default:return}r.payloadUnitStartIndicator&&n(t,o,!0),t.data.push(r),t.size+=r.data.byteLength},pmt:function(){var A={type:"metadata",tracks:[]},e=r.programMapTable;null!==e.video&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",A)}})[r.type]()},this.flush=function(){n(A,"video"),n(e,"audio"),n(i,"timed-metadata"),this.trigger("done")}}).prototype=new K;var mt={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:yt,TransportParseStream:Bt,ElementaryStream:ft,TimestampRolloverStream:wt,CaptionStream:It.CaptionStream,Cea608Stream:It.Cea608Stream,MetadataStream:Qt};for(var pt in ct)ct.hasOwnProperty(pt)&&(mt[pt]=ct[pt]);var St,Lt=mt,jt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(St=function(){var t;St.prototype.init.call(this),this.push=function(A){var e,i,n,r,o,a,s=0,g=0;if("audio"===A.type)for(t?(r=t,(t=new Uint8Array(r.byteLength+A.data.byteLength)).set(r),t.set(A.data,r.byteLength)):t=A.data;s+5>5,a=9e4*(o=1024*(1+(3&t[s+6])))/jt[(60&t[s+2])>>>2],n=s+e,t.byteLength>>6&3),channelcount:(1&t[s+2])<<2|(192&t[s+3])>>>6,samplerate:jt[(60&t[s+2])>>>2],samplingfrequencyindex:(60&t[s+2])>>>2,samplesize:16,data:t.subarray(s+7+i,n)}),t.byteLength===n)return void(t=void 0);g++,t=t.subarray(n)}else s++},this.flush=function(){this.trigger("done")}}).prototype=new K;var xt,Yt,Ut,Ot=St,vt=function(t){var A=t.byteLength,e=0,i=0;this.length=function(){return 8*A},this.bitsAvailable=function(){return 8*A+i},this.loadWord=function(){var n=t.byteLength-A,r=new Uint8Array(4),o=Math.min(4,A);if(0===o)throw new Error("no bytes available");r.set(t.subarray(n,n+o)),e=new DataView(r.buffer).getUint32(0),i=8*o,A-=o},this.skipBits=function(t){var n;i>t?(e<<=t,i-=t):(t-=i,t-=8*(n=Math.floor(t/8)),A-=n,this.loadWord(),e<<=t,i-=t)},this.readBits=function(t){var n=Math.min(i,t),r=e>>>32-n;return(i-=n)>0?e<<=n:A>0&&this.loadWord(),(n=t-n)>0?r<>>t))return e<<=t,i-=t,t;return this.loadWord(),t+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var t=this.skipLeadingZeros();return this.readBits(t+1)-1},this.readExpGolomb=function(){var t=this.readUnsignedExpGolomb();return 1&t?1+t>>>1:-1*(t>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(Yt=function(){var t,A,e=0;Yt.prototype.init.call(this),this.push=function(i){var n;for(A?((n=new Uint8Array(A.byteLength+i.data.byteLength)).set(A),n.set(i.data,A.byteLength),A=n):A=i.data;e3&&this.trigger("data",A.subarray(e+3)),A=null,e=0,this.trigger("done")}}).prototype=new K,Ut={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(xt=function(){var t,A,e,i,n,r,o,a=new Yt;xt.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(A=t.trackId,e=t.pts,i=t.dts,a.push(t))},a.on("data",function(o){var a={trackId:A,pts:e,dts:i,data:o};switch(31&o[0]){case 5:a.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:a.nalUnitType="sei_rbsp",a.escapedRBSP=n(o.subarray(1));break;case 7:a.nalUnitType="seq_parameter_set_rbsp",a.escapedRBSP=n(o.subarray(1)),a.config=r(a.escapedRBSP);break;case 8:a.nalUnitType="pic_parameter_set_rbsp";break;case 9:a.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",a)}),a.on("done",function(){t.trigger("done")}),this.flush=function(){a.flush()},o=function(t,A){var e,i=8,n=8;for(e=0;e>4?e+20:e+10},this.parseAdtsSize=function(t,A){var e=(224&t[A+5])>>5,i=t[A+4]<<3;return 6144&t[A+3]|i|e},this.push=function(e){var i,n,r,o,a=0,s=0;for(t.length?(o=t.length,(t=new Uint8Array(e.byteLength+o)).set(t.subarray(0,o)),t.set(e,o)):t=e;t.length-s>=3;)if(t[s]!=="I".charCodeAt(0)||t[s+1]!=="D".charCodeAt(0)||t[s+2]!=="3".charCodeAt(0))if(!0&t[s]&&240==(240&t[s+1])){if(t.length-s<7)break;if((a=this.parseAdtsSize(t,s))>t.length)break;r={type:"audio",data:t.subarray(s,s+a),pts:A,dts:A},this.trigger("data",r),s+=a}else s++;else{if(t.length-s<10)break;if((a=this.parseId3TagSize(t,s))>t.length)break;n={type:"timed-metadata",data:t.subarray(s,s+a)},this.trigger("data",n),s+=a}i=t.length-s,t=i>0?t.subarray(s):new Uint8Array}}).prototype=new K;var Ft,bt,Rt,Jt,Gt,Kt,Ht,Pt,Wt,Vt,qt,Zt=kt,_t=[33,16,5,32,164,27],$t=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],tA=function(t){for(var A=[];t--;)A.push(0);return A},AA=function(t){return Object.keys(t).reduce(function(A,e){return A[e]=new Uint8Array(t[e].reduce(function(t,A){return t.concat(A)},[])),A},{})}({96000:[_t,[227,64],tA(154),[56]],88200:[_t,[231],tA(170),[56]],64000:[_t,[248,192],tA(240),[56]],48000:[_t,[255,192],tA(268),[55,148,128],tA(54),[112]],44100:[_t,[255,192],tA(268),[55,163,128],tA(84),[112]],32000:[_t,[255,192],tA(268),[55,234],tA(226),[112]],24000:[_t,[255,192],tA(268),[55,255,128],tA(268),[111,112],tA(126),[224]],16000:[_t,[255,192],tA(268),[55,255,128],tA(268),[111,255],tA(269),[223,108],tA(195),[1,192]],12000:[$t,tA(268),[3,127,248],tA(268),[6,255,240],tA(268),[13,255,224],tA(268),[27,253,128],tA(259),[56]],11025:[$t,tA(268),[3,127,248],tA(268),[6,255,240],tA(268),[13,255,224],tA(268),[27,255,192],tA(268),[55,175,128],tA(108),[112]],8000:[$t,tA(268),[3,121,16],tA(47),[7]]}),eA=(Ft=function(t){return 9e4*t},bt=function(t,A){return t*A},Rt=function(t){return t/9e4},Jt=function(t,A){return t/A},function(t,A){return Ft(Jt(t,A))}),iA=function(t,A){return bt(Rt(t),A)},nA=zt.H264Stream,rA=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],oA=["width","height","profileIdc","levelIdc","profileCompatibility"];Wt=function(t){return t[0]==="I".charCodeAt(0)&&t[1]==="D".charCodeAt(0)&&t[2]==="3".charCodeAt(0)},Vt=function(t,A){var e;if(t.length!==A.length)return!1;for(e=0;e45e3))){for((i=AA[t.samplerate])||(i=A[0].data),n=0;n=n?A:(t.minSegmentDts=1/0,A.filter(function(A){return A.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,A.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},this.generateSampleTable_=function(t){var A,e,i=[];for(A=0;A=-1e4&&e<=45e3&&(!i||a>e)&&(i=r,a=e));return i?i.gop:null},this.alignGopsAtStart_=function(t){var A,e,i,n,r,a,s,g;for(r=t.byteLength,a=t.nalCount,s=t.duration,A=e=0;Ai.pts?A++:(e++,r-=n.byteLength,a-=n.nalCount,s-=n.duration);return 0===e?t:e===t.length?null:((g=t.slice(e)).byteLength=r,g.duration=s,g.nalCount=a,g.pts=g[0].pts,g.dts=g[0].dts,g)},this.alignGopsAtEnd_=function(t){var A,e,i,n,r,a,s;for(A=o.length-1,e=t.length-1,r=null,a=!1;A>=0&&e>=0;){if(i=o[A],n=t[e],i.pts===n.pts){a=!0;break}i.pts>n.pts?A--:(A===o.length-1&&(r=e),e--)}if(!a&&null===r)return null;if(0===(s=a?e:r))return t;var g=t.slice(s),M=g.reduce(function(t,A){return t.byteLength+=A.byteLength,t.duration+=A.duration,t.nalCount+=A.nalCount,t},{byteLength:0,duration:0,nalCount:0});return g.byteLength=M.byteLength,g.duration=M.duration,g.nalCount=M.nalCount,g.pts=g[0].pts,g.dts=g[0].dts,g},this.alignGopsWith=function(t){o=t}}).prototype=new K,(Pt=function(t,A){this.numberOfTracks=0,this.metadataStream=A,void 0!==t.remux?this.remuxTracks=!!t.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Pt.prototype.init.call(this),this.push=function(t){return t.text?this.pendingCaptions.push(t):t.frames?this.pendingMetadata.push(t):(this.pendingTracks.push(t.track),this.pendingBoxes.push(t.boxes),this.pendingBytes+=t.boxes.byteLength,"video"===t.track.type&&(this.videoTrack=t.track),void("audio"===t.track.type&&(this.audioTrack=t.track)))}}).prototype=new K,Pt.prototype.flush=function(t){var A,e,i,n,r=0,o={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,oA.forEach(function(t){o.info[t]=this.videoTrack[t]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,rA.forEach(function(t){o.info[t]=this.audioTrack[t]},this)),1===this.pendingTracks.length?o.type=this.pendingTracks[0].type:o.type="combined",this.emittedTracks+=this.pendingTracks.length,i=b.initSegment(this.pendingTracks),o.initSegment=new Uint8Array(i.byteLength),o.initSegment.set(i),o.data=new Uint8Array(this.pendingBytes),n=0;n=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(Ht=function(t){var A,e,i=this,n=!0;Ht.prototype.init.call(this),t=t||{},this.baseMediaDecodeTime=t.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new Lt.MetadataStream,A.aacStream=new Zt,A.audioTimestampRolloverStream=new Lt.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new Lt.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Ot,A.coalesceStream=new Pt(t,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(t){A.aacStream.setTimestamp(t.timeStamp)}),A.aacStream.on("data",function(n){"timed-metadata"!==n.type||A.audioSegmentStream||(e=e||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Kt(e,t),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var n={};this.transmuxPipeline_=n,n.type="ts",n.metadataStream=new Lt.MetadataStream,n.packetStream=new Lt.TransportPacketStream,n.parseStream=new Lt.TransportParseStream,n.elementaryStream=new Lt.ElementaryStream,n.videoTimestampRolloverStream=new Lt.TimestampRolloverStream("video"),n.audioTimestampRolloverStream=new Lt.TimestampRolloverStream("audio"),n.timedMetadataTimestampRolloverStream=new Lt.TimestampRolloverStream("timed-metadata"),n.adtsStream=new Ot,n.h264Stream=new nA,n.captionStream=new Lt.CaptionStream,n.coalesceStream=new Pt(t,n.metadataStream),n.headOfPipeline=n.packetStream,n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream),n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream),n.elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream),n.elementaryStream.pipe(n.timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream),n.h264Stream.pipe(n.captionStream).pipe(n.coalesceStream),n.elementaryStream.on("data",function(r){var o;if("metadata"===r.type){for(o=r.tracks.length;o--;)A||"video"!==r.tracks[o].type?e||"audio"!==r.tracks[o].type||((e=r.tracks[o]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(A=r.tracks[o]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;A&&!n.videoSegmentStream&&(n.coalesceStream.numberOfTracks++,n.videoSegmentStream=new Gt(A,t),n.videoSegmentStream.on("timelineStartInfo",function(t){e&&(e.timelineStartInfo=t,n.audioSegmentStream.setEarliestDts(t.dts))}),n.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),n.videoSegmentStream.on("baseMediaDecodeTime",function(t){e&&n.audioSegmentStream.setVideoBaseMediaDecodeTime(t)}),n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)),e&&!n.audioSegmentStream&&(n.coalesceStream.numberOfTracks++,n.audioSegmentStream=new Kt(e,t),n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))}}),n.coalesceStream.on("data",this.trigger.bind(this,"data")),n.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(t){var i=this.transmuxPipeline_;this.baseMediaDecodeTime=t,e&&(e.timelineStartInfo.dts=void 0,e.timelineStartInfo.pts=void 0,Z(e),e.timelineStartInfo.baseMediaDecodeTime=t,i.audioTimestampRolloverStream&&i.audioTimestampRolloverStream.discontinuity()),A&&(i.videoSegmentStream&&(i.videoSegmentStream.gopCache_=[],i.videoTimestampRolloverStream.discontinuity()),A.timelineStartInfo.dts=void 0,A.timelineStartInfo.pts=void 0,Z(A),i.captionStream.reset(),A.timelineStartInfo.baseMediaDecodeTime=t),i.timedMetadataTimestampRolloverStream&&i.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(t){e&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(t)},this.alignGopsWith=function(t){A&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(t)},this.push=function(t){if(n){var A=Wt(t);A&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():A||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),n=!1}this.transmuxPipeline_.headOfPipeline.push(t)},this.flush=function(){n=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new K;var aA,sA,gA={Transmuxer:Ht,VideoSegmentStream:Gt,AudioSegmentStream:Kt,AUDIO_PROPERTIES:rA,VIDEO_PROPERTIES:oA},MA=J.parseType,IA=function(t){return new Date(1e3*t-20828448e5)},cA=function(t){return{isLeading:(12&t[0])>>>2,dependsOn:3&t[0],isDependedOn:(192&t[1])>>>6,hasRedundancy:(48&t[1])>>>4,paddingValue:(14&t[1])>>>1,isNonSyncSample:1&t[1],degradationPriority:t[2]<<8|t[3]}},uA={avc1:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{dataReferenceIndex:A.getUint16(6),width:A.getUint16(24),height:A.getUint16(26),horizresolution:A.getUint16(28)+A.getUint16(30)/16,vertresolution:A.getUint16(32)+A.getUint16(34)/16,frameCount:A.getUint16(40),depth:A.getUint16(74),config:aA(t.subarray(78,t.byteLength))}},avcC:function(t){var A,e,i,n,r=new DataView(t.buffer,t.byteOffset,t.byteLength),o={configurationVersion:t[0],avcProfileIndication:t[1],profileCompatibility:t[2],avcLevelIndication:t[3],lengthSizeMinusOne:3&t[4],sps:[],pps:[]},a=31&t[5];for(i=6,n=0;n>>2&63,bufferSize:t[13]<<16|t[14]<<8|t[15],maxBitrate:t[16]<<24|t[17]<<16|t[18]<<8|t[19],avgBitrate:t[20]<<24|t[21]<<16|t[22]<<8|t[23],decoderConfigDescriptor:{tag:t[24],length:t[25],audioObjectType:t[26]>>>3&31,samplingFrequencyIndex:(7&t[26])<<1|t[27]>>>7&1,channelConfiguration:t[27]>>>3&15}}}},ftyp:function(t){for(var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e={majorBrand:MA(t.subarray(0,4)),minorVersion:A.getUint32(4),compatibleBrands:[]},i=8;iMALFORMED DATA");else switch(31&t[A]){case 1:n.push("slice_layer_without_partitioning_rbsp");break;case 5:n.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:n.push("sei_rbsp");break;case 7:n.push("seq_parameter_set_rbsp");break;case 8:n.push("pic_parameter_set_rbsp");break;case 9:n.push("access_unit_delimiter_rbsp");break;default:n.push("UNKNOWN NAL - "+t[A]&31)}return n}(t)}},mdhd:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=4,n={version:e.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),language:""};return 1===n.version?(i+=4,n.creationTime=IA(e.getUint32(i)),i+=8,n.modificationTime=IA(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=8,n.duration=e.getUint32(i)):(n.creationTime=IA(e.getUint32(i)),i+=4,n.modificationTime=IA(e.getUint32(i)),i+=4,n.timescale=e.getUint32(i),i+=4,n.duration=e.getUint32(i)),i+=4,A=e.getUint16(i),n.language+=String.fromCharCode(96+(A>>10)),n.language+=String.fromCharCode(96+((992&A)>>5)),n.language+=String.fromCharCode(96+(31&A)),n},mdia:function(t){return{boxes:aA(t)}},mfhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sequenceNumber:t[4]<<24|t[5]<<16|t[6]<<8|t[7]}},minf:function(t){return{boxes:aA(t)}},mp4a:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e={dataReferenceIndex:A.getUint16(6),channelcount:A.getUint16(16),samplesize:A.getUint16(18),samplerate:A.getUint16(24)+A.getUint16(26)/65536};return t.byteLength>28&&(e.streamDescriptor=aA(t.subarray(28))[0]),e},moof:function(t){return{boxes:aA(t)}},moov:function(t){return{boxes:aA(t)}},mvex:function(t){return{boxes:aA(t)}},mvhd:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength),e=4,i={version:A.getUint8(0),flags:new Uint8Array(t.subarray(1,4))};return 1===i.version?(e+=4,i.creationTime=IA(A.getUint32(e)),e+=8,i.modificationTime=IA(A.getUint32(e)),e+=4,i.timescale=A.getUint32(e),e+=8,i.duration=A.getUint32(e)):(i.creationTime=IA(A.getUint32(e)),e+=4,i.modificationTime=IA(A.getUint32(e)),e+=4,i.timescale=A.getUint32(e),e+=4,i.duration=A.getUint32(e)),e+=4,i.rate=A.getUint16(e)+A.getUint16(e+2)/16,e+=4,i.volume=A.getUint8(e)+A.getUint8(e+1)/8,e+=2,e+=2,e+=8,i.matrix=new Uint32Array(t.subarray(e,e+36)),e+=36,e+=24,i.nextTrackId=A.getUint32(e),i},pdin:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:A.getUint8(0),flags:new Uint8Array(t.subarray(1,4)),rate:A.getUint32(4),initialDelay:A.getUint32(8)}},sdtp:function(t){var A,e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]};for(A=4;A>4,isDependedOn:(12&t[A])>>2,hasRedundancy:3&t[A]});return e},sidx:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8),earliestPresentationTime:e.getUint32(12),firstOffset:e.getUint32(16)},n=e.getUint16(22);for(A=24;n;A+=12,n--)i.references.push({referenceType:(128&t[A])>>>7,referencedSize:2147483647&e.getUint32(A),subsegmentDuration:e.getUint32(A+4),startsWithSap:!!(128&t[A+8]),sapType:(112&t[A+8])>>>4,sapDeltaTime:268435455&e.getUint32(A+8)});return i},smhd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),balance:t[4]+t[5]/256}},stbl:function(t){return{boxes:aA(t)}},stco:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),chunkOffsets:[]},n=e.getUint32(4);for(A=8;n;A+=4,n--)i.chunkOffsets.push(e.getUint32(A));return i},stsc:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i=e.getUint32(4),n={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleToChunks:[]};for(A=8;i;A+=12,i--)n.sampleToChunks.push({firstChunk:e.getUint32(A),samplesPerChunk:e.getUint32(A+4),sampleDescriptionIndex:e.getUint32(A+8)});return n},stsd:function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleDescriptions:aA(t.subarray(8))}},stsz:function(t){var A,e=new DataView(t.buffer,t.byteOffset,t.byteLength),i={version:t[0],flags:new Uint8Array(t.subarray(1,4)),sampleSize:e.getUint32(4),entries:[]};for(A=12;A>6,sampleHasRedundancy:(48&t[21])>>4,samplePaddingValue:(14&t[21])>>1,sampleIsDifferenceSample:!!(1&t[21]),sampleDegradationPriority:A.getUint16(22)}},trun:function(t){var A,e={version:t[0],flags:new Uint8Array(t.subarray(1,4)),samples:[]},i=new DataView(t.buffer,t.byteOffset,t.byteLength),n=1&e.flags[2],r=4&e.flags[2],o=1&e.flags[1],a=2&e.flags[1],s=4&e.flags[1],g=8&e.flags[1],M=i.getUint32(4),I=8;for(n&&(e.dataOffset=i.getInt32(I),I+=4),r&&M&&(A={flags:cA(t.subarray(I,I+4))},I+=4,o&&(A.duration=i.getUint32(I),I+=4),a&&(A.size=i.getUint32(I),I+=4),g&&(A.compositionTimeOffset=i.getUint32(I),I+=4),e.samples.push(A),M--);M--;)A={},o&&(A.duration=i.getUint32(I),I+=4),a&&(A.size=i.getUint32(I),I+=4),s&&(A.flags=cA(t.subarray(I,I+4)),I+=4),g&&(A.compositionTimeOffset=i.getUint32(I),I+=4),e.samples.push(A);return e},"url ":function(t){return{version:t[0],flags:new Uint8Array(t.subarray(1,4))}},vmhd:function(t){var A=new DataView(t.buffer,t.byteOffset,t.byteLength);return{version:t[0],flags:new Uint8Array(t.subarray(1,4)),graphicsmode:A.getUint16(4),opcolor:new Uint16Array([A.getUint16(6),A.getUint16(8),A.getUint16(10)])}}},EA={inspect:aA=function(t){for(var A,e,i,n,r,o=0,a=[],s=new ArrayBuffer(t.length),g=new Uint8Array(s),M=0;M1?o+e:t.byteLength,(r=(uA[i]||function(t){return{data:t}})(t.subarray(o+8,n))).size=e,r.type=i,a.push(r),o=n;return a},textify:sA=function(t,A){var e;return A=A||0,e=new Array(2*A+1).join(" "),t.map(function(t,i){return e+t.type+"\n"+Object.keys(t).filter(function(t){return"type"!==t&&"boxes"!==t}).map(function(A){var i=e+" "+A+": ",n=t[A];if(n instanceof Uint8Array||n instanceof Uint32Array){var r=Array.prototype.slice.call(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)).map(function(t){return" "+("00"+t.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return r?1===r.length?i+"<"+r.join("").slice(1)+">":i+"<\n"+r.map(function(t){return e+" "+t}).join("\n")+"\n"+e+" >":i+"<>"}return i+JSON.stringify(n,null,2).split("\n").map(function(t,A){return 0===A?t:e+" "+t}).join("\n")}).join("\n")+(t.boxes?"\n"+sA(t.boxes,A+1):"")}).join("\n")},parseTfdt:uA.tfdt,parseHdlr:uA.hdlr,parseTfhd:uA.tfhd,parseTrun:uA.trun},hA=it,lA=It.CaptionStream,dA=function(t,A){for(var e=t,i=0;i0?EA.parseTfdt(M[0]).baseMediaDecodeTime:0,c=J.findBox(o,["trun"]);A===g&&c.length>0&&(e=function(t,A,e){var i=A,n=e.defaultSampleDuration||0,r=e.defaultSampleSize||0,o=e.trackId,a=[];return t.forEach(function(t){var A=EA.parseTrun(t).samples;A.forEach(function(t){void 0===t.duration&&(t.duration=n),void 0===t.size&&(t.size=r),t.trackId=o,t.dts=i,void 0===t.compositionTimeOffset&&(t.compositionTimeOffset=0),t.pts=i+t.compositionTimeOffset,i+=t.duration}),a=a.concat(A)}),a}(c,I,s),n=function(t,A,e){var i,n,r,o,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=[];for(n=0;n+40;){var s=A.shift();this.parse(s,r,o)}return null!==(a=function(t,A,e){return A?{seiNals:CA(t,A)[A],timescale:e}:null}(t,e,i))&&a.seiNals?(this.pushNals(a.seiNals),this.flushStream(),n):null},this.pushNals=function(A){if(!this.isInitialized()||!A||0===A.length)return null;A.forEach(function(A){t.push(A)})},this.flushStream=function(){if(!this.isInitialized())return null;t.flush()},this.clearParsedCaptions=function(){n.captions=[],n.captionStreams={}},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){A=[],e=null,i=null,n?this.clearParsedCaptions():n={captions:[],captionStreams:{}},this.resetCaptionStream()},this.reset()}},NA=function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")},DA=function(){function t(t,A){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:"",e={codecCount:0};return e.codecCount=A.split(",").length,e.codecCount=e.codecCount||2,(t=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(A))&&(e.videoCodec=t[2],e.videoObjectTypeIndicator=t[3]),e.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(A),e.audioProfile=e.audioProfile&&e.audioProfile[2],e},ic=function(t,A,e){return t+"/"+A+'; codecs="'+e.filter(function(t){return!!t}).join(", ")+'"'},nc=function(t,A){var e=function(t){return t.segments&&t.segments.length&&t.segments[0].map?"mp4":"mp2t"}(A),i=function(t){var A=t.attributes||{};return A.CODECS?ec(A.CODECS):tc}(A),n=A.attributes||{},r=!0,o=!1;if(!A)return[];if(t.mediaGroups.AUDIO&&n.AUDIO){var a=t.mediaGroups.AUDIO[n.AUDIO];if(a)for(var s in o=!0,r=!1,a)if(!a[s].uri&&!a[s].playlists){r=!0;break}}o&&!i.audioProfile&&(r||(i.audioProfile=function(t,A){if(!t.mediaGroups.AUDIO||!A)return null;var e=t.mediaGroups.AUDIO[A];if(!e)return null;for(var i in e){var n=e[i];if(n.default&&n.playlists)return ec(n.playlists[0].attributes.CODECS).audioProfile}return null}(t,n.AUDIO)),i.audioProfile||(jt.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),i.audioProfile=tc.audioProfile));var g={};i.videoCodec&&(g.video=""+i.videoCodec+i.videoObjectTypeIndicator),i.audioProfile&&(g.audio="mp4a.40."+i.audioProfile);var M=ic("audio",e,[g.audio]),I=ic("video",e,[g.video]),c=ic("video",e,[g.video,g.audio]);return o?!r&&g.video?[I,M]:r||g.video?[c,M]:[M,M]:g.video?[c]:[M]},rc=function(t){return/mp4a\.\d+.\d+/i.test(t)},oc=function(t){return/avc1\.[\da-f]+/i.test(t)},ac=function(t,A,e){var i=null,n=null,r=0,o=[],a=[];if(!t&&!A)return jt.createTimeRange();if(!t)return A.buffered;if(!A)return t.buffered;if(e)return t.buffered;if(0===t.buffered.length&&0===A.buffered.length)return jt.createTimeRange();for(var s=t.buffered,g=A.buffered,M=s.length;M--;)o.push({time:s.start(M),type:"start"}),o.push({time:s.end(M),type:"end"});for(M=g.length;M--;)o.push({time:g.start(M),type:"start"}),o.push({time:g.end(M),type:"end"});for(o.sort(function(t,A){return t.time-A.time}),M=0;M=11;var n={remux:!1,alignGopsAtEnd:i.safeAppend_};return i.codecs_.forEach(function(t){rc(t)?i.audioCodec_=t:oc(t)&&(i.videoCodec_=t)}),i.transmuxer_=new $I,i.transmuxer_.postMessage({action:"init",options:n}),i.transmuxer_.onmessage=function(t){return"data"===t.data.action?i.data_(t):"done"===t.data.action?i.done_(t):"gopInfo"===t.data.action?i.appendGopInfo_(t):void 0},Object.defineProperty(i,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(t){"number"==typeof t&&t>=0&&(this.timestampOffset_=t,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:t}))}}),Object.defineProperty(i,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(t){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=t),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=t)}}),Object.defineProperty(i,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(i,"buffered",{get:function(){return ac(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),i}return _M(A,t),ZM(A,[{key:"data_",value:function(t){var A=t.data.segment;A.data=new Uint8Array(A.data,t.data.byteOffset,t.data.byteLength),A.initSegment=new Uint8Array(A.initSegment.data,A.initSegment.byteOffset,A.initSegment.byteLength),function(t,A,e){var i=A.player_;if(e.captions&&e.captions.length)for(var n in t.inbandTextTracks_||(t.inbandTextTracks_={}),e.captionStreams)if(!t.inbandTextTracks_[n]){i.tech_.trigger({type:"usage",name:"hls-608"});var r=i.textTracks().getTrackById(n);t.inbandTextTracks_[n]=r||i.addRemoteTextTrack({kind:"captions",id:n,label:n},!1).track}e.metadata&&e.metadata.length&&!t.metadataTrack_&&(t.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,t.metadataTrack_.inBandMetadataTrackDispatchType=e.metadata.dispatchType)}(this,this.mediaSource_,A),this.pendingBuffers_.push(A)}},{key:"done_",value:function(t){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"createRealSourceBuffers_",value:function(){var t=this,A=["audio","video"];A.forEach(function(e){if(t[e+"Codec_"]&&!t[e+"Buffer_"]){var i=null;if(t.mediaSource_[e+"Buffer_"])(i=t.mediaSource_[e+"Buffer_"]).updating=!1;else{var n=e+'/mp4;codecs="'+t[e+"Codec_"]+'"';i=function(t,A){var e=t.addSourceBuffer(A),i=Object.create(null);for(var n in i.updating=!1,i.realBuffer_=e,e)!function(t){"function"==typeof e[t]?i[t]=function(){return e[t].apply(e,arguments)}:void 0===i[t]&&Object.defineProperty(i,t,{get:function(){return e[t]},set:function(A){return e[t]=A}})}(n);return i}(t.mediaSource_.nativeMediaSource_,n),t.mediaSource_[e+"Buffer_"]=i}t[e+"Buffer_"]=i,["update","updatestart","updateend"].forEach(function(n){i.addEventListener(n,function(){if("audio"!==e||!t.audioDisabled_)return"updateend"===n&&(t[e+"Buffer_"].updating=!1),A.every(function(A){return!("audio"!==A||!t.audioDisabled_)||e===A||!t[A+"Buffer_"]||!t[A+"Buffer_"].updating})?t.trigger(n):void 0})})}})}},{key:"appendBuffer",value:function(t){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var A=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:A.end(A.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:function(t,A,e){if(void 0===A||null===A||!t.length)return[];var i=Math.ceil(9e4*(A-e+3)),n=void 0;for(n=0;ni);n++);return t.slice(n)}(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)}),this.transmuxer_.postMessage({action:"push",data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},[t.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(t){this.gopBuffer_=function(t,A,e){if(!A.length)return t;if(e)return A.slice();for(var i=A[0].pts,n=0;n=i);n++);return t.slice(0,n).concat(A)}(this.gopBuffer_,t.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(t,A){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(t,A),this.gopBuffer_=function(t,A,e,i){for(var n=Math.ceil(9e4*(A-i)),r=Math.ceil(9e4*(e-i)),o=t.slice(),a=t.length;a--&&!(t[a].pts<=r););if(-1===a)return o;for(var s=a+1;s--&&!(t[s].pts<=n););return s=Math.max(s,0),o.splice(s,a-s+1),o}(this.gopBuffer_,t,A,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(t,A)),RI(t,A,this.metadataTrack_),this.inbandTextTracks_)for(var e in this.inbandTextTracks_)RI(t,A,this.inbandTextTracks_[e])}},{key:"processPendingSegments_",value:function(){var t={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};t=this.pendingBuffers_.reduce(function(t,A){var e=A.type,i=A.data,n=A.initSegment;return t[e].segments.push(i),t[e].bytes+=i.byteLength,t[e].initSegment=n,A.captions&&(t.captions=t.captions.concat(A.captions)),A.info&&(t[e].info=A.info),A.metadata&&(t.metadata=t.metadata.concat(A.metadata)),t},t),this.videoBuffer_||this.audioBuffer_||(0===t.video.bytes&&(this.videoCodec_=null),0===t.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),t.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:t.audio.info}),t.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:t.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(t.audio.segments.unshift(t.audio.initSegment),t.audio.bytes+=t.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);var A=!1;this.videoBuffer_&&t.video.bytes?(t.video.segments.unshift(t.video.initSegment),t.video.bytes+=t.video.initSegment.byteLength,this.concatAndAppendSegments_(t.video,this.videoBuffer_),GI(this,t.captions,t.metadata)):!this.videoBuffer_||!this.audioDisabled_&&this.audioBuffer_||(A=!0),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(t.audio,this.audioBuffer_),this.pendingBuffers_.length=0,A&&this.trigger("updateend"),this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(t,A){var e=0,i=void 0;if(t.bytes){i=new Uint8Array(t.bytes),t.segments.forEach(function(t){i.set(t,e),e+=t.byteLength});try{A.updating=!0,A.appendBuffer(i)}catch(t){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:t.message,originalError:t})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),A}(jt.EventTarget),gc=function(t){function A(){XM(this,A);var t=$M(this,(A.__proto__||Object.getPrototypeOf(A)).call(this)),e=void 0;for(e in t.nativeMediaSource_=new zt.MediaSource,t.nativeMediaSource_)e in A.prototype||"function"!=typeof t.nativeMediaSource_[e]||(t[e]=t.nativeMediaSource_[e].bind(t.nativeMediaSource_));return t.duration_=NaN,Object.defineProperty(t,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(t){this.duration_=t,t===1/0||(this.nativeMediaSource_.duration=t)}}),Object.defineProperty(t,"seekable",{get:function(){return this.duration_===1/0?jt.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(t,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(t,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),t.sourceBuffers=[],t.activeSourceBuffers_=[],t.updateActiveSourceBuffers_=function(){if(t.activeSourceBuffers_.length=0,1===t.sourceBuffers.length){var A=t.sourceBuffers[0];return A.appendAudioInitSegment_=!0,A.audioDisabled_=!A.audioCodec_,void t.activeSourceBuffers_.push(A)}for(var e=!1,i=!0,n=0;nthis.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=A)}},{key:"addSourceBuffer",value:function(t){var A=void 0,e=function(t){var A={type:"",parameters:{}},e=t.trim().split(";");return A.type=e.shift().trim(),e.forEach(function(t){var e=t.trim().split("=");if(e.length>1){var i=e[0].replace(/"/g,"").trim(),n=e[1].replace(/"/g,"").trim();A.parameters[i]=n}}),A}(t);if(/^(video|audio)\/mp2t$/i.test(e.type)){var i=[];e.parameters&&e.parameters.codecs&&(i=e.parameters.codecs.split(","),i=(i=Ac(i)).filter(function(t){return rc(t)||oc(t)})),0===i.length&&(i=["avc1.4d400d","mp4a.40.2"]),A=new sc(this,i),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),A.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else A=this.nativeMediaSource_.addSourceBuffer(t);return this.sourceBuffers.push(A),A}}]),A}(jt.EventTarget),Mc=0;jt.mediaSources={};var Ic=function(t,A){var e=jt.mediaSources[t];if(!e)throw new Error("Media Source not found (Video.js)");e.trigger({type:"sourceopen",swfId:A})},cc=function(){return!!zt.MediaSource&&!!zt.MediaSource.isTypeSupported&&zt.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},uc=function(){if(this.MediaSource={open:Ic,supportsNativeMediaSources:cc},cc())return new gc;throw new Error("Cannot use create a virtual MediaSource for this video")};uc.open=Ic,uc.supportsNativeMediaSources=cc;var Ec={createObjectURL:function(t){var A=void 0;return t instanceof gc?(A=zt.URL.createObjectURL(t.nativeMediaSource_),t.url_=A,A):t instanceof gc?(A="blob:vjs-media-source/"+Mc,Mc++,jt.mediaSources[A]=t,A):(A=zt.URL.createObjectURL(t),t.url_=A,A)}};jt.MediaSource=uc,jt.URL=Ec;var hc=jt.EventTarget,lc=jt.mergeOptions,dc=function(t,A){for(var e=lc(t,{duration:A.duration,minimumUpdatePeriod:A.minimumUpdatePeriod}),i=0;i"):function(){}},Nc=function(){function t(A,e,i,n){XM(this,t),this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=A,this.processedAppend_=!1,this.type_=i,this.mimeType_=e,this.logger_=Tc("SourceUpdater["+i+"]["+e+"]"),"closed"===A.readyState?A.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,e,n)):this.createSourceBuffer_(e,n)}return ZM(t,[{key:"createSourceBuffer_",value:function(t,A){var e=this;this.sourceBuffer_=this.mediaSource.addSourceBuffer(t),this.logger_("created SourceBuffer"),A&&(A.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)?A.on("sourcebufferadded",function(){e.start_()}):this.start_()}},{key:"start_",value:function(){var t=this;this.started_=!0,this.onUpdateendCallback_=function(){var A=t.pendingCallback_;t.pendingCallback_=null,t.logger_("buffered ["+FI(t.buffered())+"]"),A&&A(),t.runCallback_()},this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_),this.runCallback_()}},{key:"abort",value:function(t){var A=this;this.processedAppend_&&this.queueCallback_(function(){A.sourceBuffer_.abort()},t)}},{key:"appendBuffer",value:function(t,A){var e=this;this.processedAppend_=!0,this.queueCallback_(function(){e.sourceBuffer_.appendBuffer(t)},A)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:jt.createTimeRanges()}},{key:"remove",value:function(t,A){var e=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ut;this.processedAppend_&&this.queueCallback_(function(){e.logger_("remove ["+t+" => "+A+"]"),e.sourceBuffer_.remove(t,A)},i)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(t){var A=this;return void 0!==t&&(this.queueCallback_(function(){A.sourceBuffer_.timestampOffset=t}),this.timestampOffset_=t),this.timestampOffset_}},{key:"queueCallback_",value:function(t,A){this.callbacks_.push([t.bind(this),A]),this.runCallback_()}},{key:"runCallback_",value:function(){var t=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(t=this.callbacks_.shift(),this.pendingCallback_=t[1],t[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),t}(),Dc={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},yc=2,Bc=-101,fc=-102,Qc=function(t){var A={};return t.byterange&&(A.Range=function(t){var A;return A=t.offset+t.length-1,"bytes="+t.offset+"-"+A}(t.byterange)),A},wc=function(t){t.forEach(function(t){t.abort()})},mc=function(t,A){return A.timedout?{status:A.status,message:"HLS request timed-out at URL: "+A.uri,code:Bc,xhr:A}:A.aborted?{status:A.status,message:"HLS request aborted at URL: "+A.uri,code:fc,xhr:A}:t?{status:A.status,message:"HLS request errored at URL: "+A.uri,code:yc,xhr:A}:null},pc=function(t,A,e){var i=[],n=0;return function(r,o){if(r&&(wc(t),i.push(r)),(n+=1)===t.length){if(o.endOfAllRequests=Date.now(),i.length>0){var a=function(t){return t.reduce(function(t,A){return A.code>t.code?A:t})}(i);return e(a,o)}return o.encryptedBytes?function(t,A,e){t.addEventListener("message",function i(n){if(n.data.source===A.requestId){t.removeEventListener("message",i);var r=n.data.decrypted;return A.bytes=new Uint8Array(r.bytes,r.byteOffset,r.byteLength),e(null,A)}}),t.postMessage(xI({source:A.requestId,encrypted:A.encryptedBytes,key:A.key.bytes,iv:A.key.iv}),[A.encryptedBytes.buffer,A.key.bytes.buffer])}(A,o,e):e(null,o)}}},Sc=function(t,A){return function(e){return t.stats=jt.mergeOptions(t.stats,function(t){var A=t.target,e={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-A.requestTime||0};return e.bytesReceived=t.loaded,e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3),e}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),A(e,t)}},Lc=function(t,A,e,i,n,r,o){var a=[],s=pc(a,e,o);if(n.key){var g=jt.mergeOptions(A,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),M=function(t,A){return function(e,i){var n=i.response,r=mc(e,i);if(r)return A(r,t);if(16!==n.byteLength)return A({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:yc,xhr:i},t);var o=new DataView(n);return t.key.bytes=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),A(null,t)}}(n,s),I=t(g,M);a.push(I)}if(n.map&&!n.map.bytes){var c=jt.mergeOptions(A,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Qc(n.map)}),u=function(t,A,e){return function(i,n){var r=n.response,o=mc(i,n);return o?e(o,t):0===r.byteLength?e({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:yc,xhr:n},t):(t.map.bytes=new Uint8Array(n.response),A.isInitialized()||A.init(),t.map.timescales=Ia.timescale(t.map.bytes),t.map.videoTrackIds=Ia.videoTrackIds(t.map.bytes),e(null,t))}}(n,i,s),E=t(c,u);a.push(E)}var h=jt.mergeOptions(A,{uri:n.resolvedUri,responseType:"arraybuffer",headers:Qc(n)}),l=function(t,A,e){return function(i,n){var r=n.response,o=mc(i,n),a=void 0;return o?e(o,t):0===r.byteLength?e({status:n.status,message:"Empty HLS segment content at URL: "+n.uri,code:yc,xhr:n},t):(t.stats=function(t){return{bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}}(n),t.key?t.encryptedBytes=new Uint8Array(n.response):t.bytes=new Uint8Array(n.response),t.map&&t.map.bytes&&(A.isInitialized()||A.init(),(a=A.parse(t.bytes,t.map.videoTrackIds,t.map.timescales))&&a.captions&&(t.captionStreams=a.captionStreams,t.fmp4Captions=a.captions)),e(null,t))}}(n,i,s),d=t(h,l);return d.addEventListener("progress",Sc(n,r)),a.push(d),function(){return wc(a)}},jc=function(t,A){var e=void 0;return t?(e=zt.getComputedStyle(t))?e[A]:"":""},xc=function(t,A){var e=t.slice();t.sort(function(t,i){var n=A(t,i);return 0===n?e.indexOf(t)-e.indexOf(i):n})},Yc=function(t,A){var e=void 0,i=void 0;return t.attributes.BANDWIDTH&&(e=t.attributes.BANDWIDTH),e=e||zt.Number.MAX_VALUE,A.attributes.BANDWIDTH&&(i=A.attributes.BANDWIDTH),e-(i=i||zt.Number.MAX_VALUE)},Uc=function(t,A,e){if(!t||!A)return!1;var i=e===t.segments.length;return t.endList&&"open"===A.readyState&&i},Oc=function(t){return"number"==typeof t&&isFinite(t)},vc=function(t){function A(t){XM(this,A);var e=$M(this,(A.__proto__||Object.getPrototypeOf(A)).call(this));if(!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 e.bandwidth=t.bandwidth,e.throughput={rate:0,count:0},e.roundTrip=NaN,e.resetStats_(),e.mediaIndex=null,e.hasPlayed_=t.hasPlayed,e.currentTime_=t.currentTime,e.seekable_=t.seekable,e.seeking_=t.seeking,e.duration_=t.duration,e.mediaSource_=t.mediaSource,e.hls_=t.hls,e.loaderType_=t.loaderType,e.startingMedia_=void 0,e.segmentMetadataTrack_=t.segmentMetadataTrack,e.goalBufferLength_=t.goalBufferLength,e.sourceType_=t.sourceType,e.inbandTextTracks_=t.inbandTextTracks,e.state_="INIT",e.checkBufferTimeout_=null,e.error_=void 0,e.currentTimeline_=-1,e.pendingSegment_=null,e.mimeType_=null,e.sourceUpdater_=null,e.xhrOptions_=null,e.activeInitSegmentId_=null,e.initSegments_={},e.captionParser_=new oM,e.decrypter_=t.decrypter,e.syncController_=t.syncController,e.syncPoint_={segmentIndex:0,time:0},e.syncController_.on("syncinfoupdate",function(){return e.trigger("syncinfoupdate")}),e.mediaSource_.addEventListener("sourceopen",function(){return e.ended_=!1}),e.fetchAtBuffer_=!1,e.logger_=Tc("SegmentLoader["+e.loaderType_+"]"),Object.defineProperty(e,"state",{get:function(){return this.state_},set:function(t){t!==this.state_&&(this.logger_(this.state_+" -> "+t),this.state_=t)}}),e}return _M(A,t),ZM(A,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_(),this.captionParser_.reset()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(t){return void 0!==t&&(this.error_=t),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():jt.createTimeRanges()}},{key:"initSegment",value:function(t){var A=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return null;var e=YI(t),i=this.initSegments_[e];return A&&!i&&t.bytes&&(this.initSegments_[e]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:t.bytes,timescales:t.timescales,videoTrackIds:t.videoTrackIds}),i||t}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new Nc(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){var e=this.playlist_,i=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=A,this.hasPlayed_()||(t.syncInfo={mediaSequence:t.mediaSequence,time:0});var n=e?e.id:null;if(this.logger_("playlist update ["+n+" => "+t.id+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!e||e.uri!==t.uri)return void(null!==this.mediaIndex&&this.resyncLoader());var r=t.mediaSequence-e.mediaSequence;this.logger_("live window shift ["+r+"]"),null!==this.mediaIndex&&(this.mediaIndex-=r),i&&(i.mediaIndex-=r,i.mediaIndex>=0&&(i.segment=t.segments[i.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(e,t)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(zt.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(t,A){this.mimeType_||(this.mimeType_=t,this.sourceBufferEmitter_=A,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(t){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_(),t),this.captionParser_.clearAllCaptions(),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(t,A,e){if(this.sourceUpdater_&&this.sourceUpdater_.remove(t,A,e),RI(t,A,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)RI(t,A,this.inbandTextTracks_[i])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&zt.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=zt.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&zt.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=zt.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t){if(Uc(this.playlist_,this.mediaSource_,t.mediaIndex))return void this.endOfStream();(t.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((t.timeline!==this.currentTimeline_||null!==t.startOfSegment&&t.startOfSegment=this.goalBufferLength_())return null;if(!i&&s>=1)return null;if(null===r)return e=this.getSyncSegmentCandidate_(A),this.generateSegmentInfo_(A,e,null,!0);if(null!==e){var g=A.segments[e];return a=g&&g.end?g.end:o,this.generateSegmentInfo_(A,e+1,a,!1)}if(this.fetchAtBuffer_){var M=QI.getMediaInfoForTime(A,o,r.segmentIndex,r.time);e=M.mediaIndex,a=M.startTime}else{var I=QI.getMediaInfoForTime(A,n,r.segmentIndex,r.time);e=I.mediaIndex,a=I.startTime}return this.generateSegmentInfo_(A,e,a,!1)}},{key:"getSyncSegmentCandidate_",value:function(t){var A=this;if(-1===this.currentTimeline_)return 0;var e=t.segments.map(function(t,A){return{timeline:t.timeline,segmentIndex:A}}).filter(function(t){return t.timeline===A.currentTimeline_});return e.length?e[Math.min(e.length-1,1)].segmentIndex:Math.max(t.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(t,A,e,i){if(A<0||A>=t.segments.length)return null;var n=t.segments[A];return{requestId:"segment-loader-"+Math.random(),uri:n.resolvedUri,mediaIndex:A,isSyncRequest:i,startOfSegment:e,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:n.timeline,duration:n.duration,segment:n}}},{key:"abortRequestEarly_",value:function(t){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(t.firstBytesReceivedAt||Date.now())<1e3)return!1;var A=this.currentTime_(),e=t.bandwidth,i=this.pendingSegment_.duration,n=QI.estimateSegmentRequestTime(i,e,this.playlist_,t.bytesReceived),r=function(t,A){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((t.length?t.end(t.length-1):0)-A)/e}(this.buffered_(),A,this.hls_.tech_.playbackRate())-1;if(n<=r)return!1;var o=function(t){var A=t.master,e=t.currentTime,i=t.bandwidth,n=t.duration,r=t.segmentDuration,o=t.timeUntilRebuffer,a=t.currentTimeline,s=t.syncController,g=A.playlists.filter(function(t){return!QI.isIncompatible(t)}),M=g.filter(QI.isEnabled);M.length||(M=g.filter(function(t){return!QI.isDisabled(t)}));var I=M.filter(QI.hasAttribute.bind(null,"BANDWIDTH")).map(function(t){var A=s.getSyncPoint(t,n,a,e)?1:2;return{playlist:t,rebufferingImpact:QI.estimateSegmentRequestTime(r,i,t)*A-o}}),c=I.filter(function(t){return t.rebufferingImpact<=0});return xc(c,function(t,A){return Yc(A.playlist,t.playlist)}),c.length?c[0]:(xc(I,function(t,A){return t.rebufferingImpact-A.rebufferingImpact}),I[0]||null)}({master:this.hls_.playlists.master,currentTime:A,bandwidth:e,duration:this.duration_(),segmentDuration:i,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(o){var a=n-r-o.rebufferingImpact,s=.5;return r<=1/30&&(s=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||a0&&t.start(0)0&&this.remove(0,A)}},{key:"createSimplifiedSegmentObj_",value:function(t){var A=t.segment,e={resolvedUri:A.resolvedUri,byterange:A.byterange,requestId:t.requestId};if(A.key){var i=A.key.iv||new Uint32Array([0,0,0,t.mediaIndex+t.playlist.mediaSequence]);e.key={resolvedUri:A.key.resolvedUri,iv:i}}return A.map&&(e.map=this.initSegment(A.map)),e}},{key:"segmentRequestFinished_",value:function(t,A){if(this.mediaRequests+=1,A.stats&&(this.mediaBytesTransferred+=A.stats.bytesReceived,this.mediaTransferDuration+=A.stats.roundTripTime),this.pendingSegment_){if(A.requestId===this.pendingSegment_.requestId){if(t)return this.pendingSegment_=null,this.state="READY",t.code===fc?void(this.mediaRequestsAborted+=1):(this.pause(),t.code===Bc?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(t),void this.trigger("error")));this.bandwidth=A.stats.bandwidth,this.roundTrip=A.stats.roundTripTime,A.map&&(A.map=this.initSegment(A.map,!0)),this.processSegmentResponse_(A)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(t){var A=this.pendingSegment_;A.bytes=t.bytes,t.map&&(A.segment.map.bytes=t.map.bytes),A.endOfAllRequests=t.endOfAllRequests,t.fmp4Captions&&(function(t,A,e){for(var i in e)if(!t[i]){A.trigger({type:"usage",name:"hls-608"});var n=A.textTracks().getTrackById(i);t[i]=n||A.addRemoteTextTrack({kind:"captions",id:i,label:i},!1).track}}(this.inbandTextTracks_,this.hls_.tech_,t.captionStreams),function(t){var A=t.inbandTextTracks,e=t.captionArray,i=t.timestampOffset;if(e){var n=window.WebKitDataCue||window.VTTCue;e.forEach(function(t){var e=t.stream,r=t.startTime,o=t.endTime;A[e]&&(r+=i,o+=i,A[e].addCue(new n(r,o,t.text)))})}}({inbandTextTracks:this.inbandTextTracks_,captionArray:t.fmp4Captions,timestampOffset:0}),this.captionParser_.clearParsedCaptions()),this.handleSegment_()}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_){var A=this.pendingSegment_,e=A.segment,i=this.syncController_.probeSegmentInfo(A);void 0===this.startingMedia_&&i&&(i.containsAudio||i.containsVideo)&&(this.startingMedia_={containsAudio:i.containsAudio,containsVideo:i.containsVideo});var n=function(t,A,e){return"main"===t&&A&&e?e.containsAudio||e.containsVideo?A.containsVideo&&!e.containsVideo?"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.":!A.containsVideo&&e.containsVideo?"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.startingMedia_,i);if(n)return this.error({message:n,blacklistDuration:1/0}),void this.trigger("error");if(A.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==A.timestampOffset&&A.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(A.timestampOffset),this.trigger("timestampoffset"));var r=this.syncController_.mappingForTimeline(A.timeline);if(null!==r&&this.trigger({type:"segmenttimemapping",mapping:r}),this.state="APPENDING",e.map){var o=YI(e.map);if(!this.activeInitSegmentId_||this.activeInitSegmentId_!==o){var a=this.initSegment(e.map);this.sourceUpdater_.appendBuffer(a.bytes,function(){t.activeInitSegmentId_=o})}}A.byteLength=A.bytes.byteLength,"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration,this.logger_(function(t){var A=t.segment,e=A.start,i=A.end,n=t.playlist,r=n.mediaSequence,o=n.id,a=n.segments,s=void 0===a?[]:a,g=t.mediaIndex,M=t.timeline;return["appending ["+g+"] of ["+r+", "+(r+s.length)+"] from playlist ["+o+"]","["+e+" => "+i+"] in timeline ["+M+"]"].join(" ")}(A)),this.sourceUpdater_.appendBuffer(A.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var t=this.pendingSegment_,A=t.segment,e=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(t),this.addSegmentMetadataCue_(t),this.state="READY",this.mediaIndex=t.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate"),A.end&&this.currentTime_()-A.end>3*t.playlist.targetDuration?this.resetEverything():(e&&this.trigger("bandwidthupdate"),this.trigger("progress"),Uc(t.playlist,this.mediaSource_,t.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(t){var A=this.throughput.rate,e=Date.now()-t.endOfAllRequests+1,i=Math.floor(t.byteLength/e*8*1e3);this.throughput.rate+=(i-A)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var A=t.segment,e=A.start,i=A.end;if(Oc(e)&&Oc(i)){RI(e,i,this.segmentMetadataTrack_);var n=zt.WebKitDataCue||zt.VTTCue,r={bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:e,end:i},o=new n(e,i,JSON.stringify(r));o.value=r,this.segmentMetadataTrack_.addCue(o)}}}}]),A}(jt.EventTarget),kc=function(t){return decodeURIComponent(escape(String.fromCharCode.apply(null,t)))},zc=new Uint8Array("\n\n".split("").map(function(t){return t.charCodeAt(0)})),Fc=function(t){function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};XM(this,A);var i=$M(this,(A.__proto__||Object.getPrototypeOf(A)).call(this,t,e));return i.mediaSource_=null,i.subtitlesTrack_=null,i}return _M(A,vc),ZM(A,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return jt.createTimeRanges();var t=this.subtitlesTrack_.cues,A=t[0].startTime,e=t[t.length-1].startTime;return jt.createTimeRanges([[A,e]])}},{key:"initSegment",value:function(t){var A=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return null;var e=YI(t),i=this.initSegments_[e];if(A&&!i&&t.bytes){var n=zc.byteLength+t.bytes.byteLength,r=new Uint8Array(n);r.set(t.bytes),r.set(zc,t.bytes.byteLength),this.initSegments_[e]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:r}}return i||t}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(t){return void 0===t?this.subtitlesTrack_:(this.subtitlesTrack_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}},{key:"remove",value:function(t,A){RI(t,A,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var t=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var A=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(A=this.skipEmptySegments_(A)){if(null===this.syncController_.timestampOffsetForTimeline(A.timeline)){return this.syncController_.one("timestampoffset",function(){t.state="READY",t.paused()||t.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(A)}}},{key:"skipEmptySegments_",value:function(t){for(;t&&t.segment.empty;)t=this.generateSegmentInfo_(t.playlist,t.mediaIndex+1,t.startOfSegment+t.duration,t.isSyncRequest);return t}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_&&this.subtitlesTrack_){this.state="APPENDING";var A=this.pendingSegment_,e=A.segment;if("function"!=typeof zt.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var i=function(){t.handleSegment_()};return this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",i),void this.subtitlesTrack_.tech_.one("vttjserror",function(){t.subtitlesTrack_.tech_.off("vttjsloaded",i),t.error({message:"Error loading vtt.js"}),t.state="READY",t.pause(),t.trigger("error")})}e.requested=!0;try{this.parseVTTCues_(A)}catch(t){return this.error({message:t.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(A,this.syncController_.timelines[A.timeline],this.playlist_),A.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");A.byteLength=A.bytes.byteLength,this.mediaSecondsLoaded+=e.duration,A.cues.length&&this.remove(A.cues[0].endTime,A.cues[A.cues.length-1].endTime),A.cues.forEach(function(A){t.subtitlesTrack_.addCue(A)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(t){var A=void 0,e=!1;"function"==typeof zt.TextDecoder?A=new zt.TextDecoder("utf8"):(A=zt.WebVTT.StringDecoder(),e=!0);var i=new zt.WebVTT.Parser(zt,zt.vttjs,A);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},i.oncue=t.cues.push.bind(t.cues),i.ontimestampmap=function(A){return t.timestampmap=A},i.onparsingerror=function(t){jt.log.warn("Error encountered when parsing cues: "+t.message)},t.segment.map){var n=t.segment.map.bytes;e&&(n=kc(n)),i.parse(n)}var r=t.bytes;e&&(r=kc(r)),i.parse(r),i.flush()}},{key:"updateTimeMapping_",value:function(t,A,e){var i=t.segment;if(A){if(!t.cues.length)return void(i.empty=!0);var n=t.timestampmap,r=n.MPEGTS/9e4-n.LOCAL+A.mapping;if(t.cues.forEach(function(t){t.startTime+=r,t.endTime+=r}),!e.syncInfo){var o=t.cues[0].startTime,a=t.cues[t.cues.length-1].startTime;e.syncInfo={mediaSequence:e.mediaSequence+t.mediaIndex,time:Math.min(o,a-i.duration)}}}}}]),A}(),bc=function(t,A){for(var e=t.cues,i=0;i=n.adStartTime&&A<=n.adEndTime)return n}return null},Rc=kM,Jc=[{name:"VOD",run:function(t,A,e,i,n){return e!==1/0?{time:0,segmentIndex:0}:null}},{name:"ProgramDateTime",run:function(t,A,e,i,n){if(!t.datetimeToDisplayTime)return null;var r=A.segments||[],o=null,a=null;n=n||0;for(var s=0;s=M)&&(a=M,o={time:g.start,segmentIndex:s})}}return o}},{name:"Discontinuity",run:function(t,A,e,i,n){var r=null;if(n=n||0,A.discontinuityStarts&&A.discontinuityStarts.length)for(var o=null,a=0;a=I)&&(o=I,r={time:M.time,segmentIndex:s})}}return r}},{name:"Playlist",run:function(t,A,e,i,n){return A.syncInfo?{time:A.syncInfo.time,segmentIndex:A.syncInfo.mediaSequence-A.mediaSequence}:null}}],Gc=function(t){function A(){XM(this,A);var t=$M(this,(A.__proto__||Object.getPrototypeOf(A)).call(this));return t.inspectCache_=void 0,t.timelines=[],t.discontinuities=[],t.datetimeToDisplayTime=null,t.logger_=Tc("SyncController"),t}return _M(A,t),ZM(A,[{key:"getSyncPoint",value:function(t,A,e,i){var n=this.runStrategies_(t,A,e,i);return n.length?this.selectSyncPoint_(n,{key:"time",value:i}):null}},{key:"getExpiredTime",value:function(t,A){if(!t||!t.segments)return null;var e=this.runStrategies_(t,A,t.discontinuitySequence,0);if(!e.length)return null;var i=this.selectSyncPoint_(e,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+uI(t,i.segmentIndex,0))}},{key:"runStrategies_",value:function(t,A,e,i){for(var n=[],r=0;r=0;e--){var i=t.segments[e];if(i&&void 0!==i.start){A.syncInfo={mediaSequence:t.mediaSequence+e,time:i.start},this.logger_("playlist refresh sync: [time:"+A.syncInfo.time+", mediaSequence: "+A.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(t){if(!this.datetimeToDisplayTime&&t.segments&&t.segments.length&&t.segments[0].dateTimeObject){var A=t.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-A}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(t){var A,e=t.segment,i=t.playlist;return(A=e.map?this.probeMp4Segment_(t):this.probeTsSegment_(t))&&this.calculateSegmentTimeMapping_(t,A)&&(this.saveDiscontinuitySyncInfo_(t),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+t.mediaIndex,time:e.start})),A}},{key:"probeMp4Segment_",value:function(t){var A=t.segment,e=Ia.timescale(A.map.bytes),i=Ia.startTime(e,t.bytes);return null!==t.timestampOffset&&(t.timestampOffset-=i),{start:i,end:i+A.duration}}},{key:"probeTsSegment_",value:function(t){var A=Rc(t.bytes,this.inspectCache_),e=void 0,i=void 0;return A?(A.video&&2===A.video.length?(this.inspectCache_=A.video[1].dts,e=A.video[0].dtsTime,i=A.video[1].dtsTime):A.audio&&2===A.audio.length&&(this.inspectCache_=A.audio[1].dts,e=A.audio[0].dtsTime,i=A.audio[1].dtsTime),{start:e,end:i,containsVideo:A.video&&2===A.video.length,containsAudio:A.audio&&2===A.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(t){return void 0===this.timelines[t]?null:this.timelines[t].time}},{key:"mappingForTimeline",value:function(t){return void 0===this.timelines[t]?null:this.timelines[t].mapping}},{key:"calculateSegmentTimeMapping_",value:function(t,A){var e=t.segment,i=this.timelines[t.timeline];if(null!==t.timestampOffset)i={time:t.startOfSegment,mapping:t.startOfSegment-A.start},this.timelines[t.timeline]=i,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+t.timeline+": [time: "+i.time+"] [mapping: "+i.mapping+"]"),e.start=t.startOfSegment,e.end=A.end+i.mapping;else{if(!i)return!1;e.start=A.start+i.mapping,e.end=A.end+i.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(t){var A=t.playlist,e=t.segment;if(e.discontinuity)this.discontinuities[e.timeline]={time:e.start,accuracy:0};else if(A.discontinuityStarts&&A.discontinuityStarts.length)for(var i=0;ia){var s;s=o<0?e.start-uI(A,t.mediaIndex,n):e.end+uI(A,t.mediaIndex+1,n),this.discontinuities[r]={time:s,accuracy:a}}}}}]),A}(jt.EventTarget),Kc=new xt("./decrypter-worker.worker.js",function(t,A){var e=this;!function(){var t=function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")},A=function(){function t(t,A){for(var e=0;e>7))^r]=r;for(o=a=0;!i[o];o^=M||1,a=g[a]||1)for(c=(c=a^a<<1^a<<2^a<<3^a<<4)>>8^255&c^99,i[o]=c,n[c]=o,E=16843009*s[I=s[M=s[o]]]^65537*I^257*M^16843008*o,u=257*s[c]^16843008*c,r=0;r<4;r++)A[r][o]=u=u<<24^u>>>8,e[r][c]=E=E<<24^E>>>8;for(r=0;r<5;r++)A[r]=A[r].slice(0),e[r]=e[r].slice(0);return t},r=null,o=function(){function A(e){t(this,A),r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];var i=void 0,o=void 0,a=void 0,s=void 0,g=void 0,M=this._tables[0][4],I=this._tables[1],c=e.length,u=1;if(4!==c&&6!==c&&8!==c)throw new Error("Invalid aes key size");for(s=e.slice(0),g=[],this._key=[s,g],i=c;i<4*c+28;i++)a=s[i-1],(i%c==0||8===c&&i%c==4)&&(a=M[a>>>24]<<24^M[a>>16&255]<<16^M[a>>8&255]<<8^M[255&a],i%c==0&&(a=a<<8^a>>>24^u<<24,u=u<<1^283*(u>>7))),s[i]=s[i-c]^a;for(o=0;i;o++,i--)a=s[3&o?i:i-4],g[o]=i<=4||o<4?a:I[0][M[a>>>24]]^I[1][M[a>>16&255]]^I[2][M[a>>8&255]]^I[3][M[255&a]]}return A.prototype.decrypt=function(t,A,e,i,n,r){var o=this._key[1],a=t^o[0],s=i^o[1],g=e^o[2],M=A^o[3],I=void 0,c=void 0,u=void 0,E=o.length/4-2,h=void 0,l=4,d=this._tables[1],C=d[0],T=d[1],N=d[2],D=d[3],y=d[4];for(h=0;h>>24]^T[s>>16&255]^N[g>>8&255]^D[255&M]^o[l],c=C[s>>>24]^T[g>>16&255]^N[M>>8&255]^D[255&a]^o[l+1],u=C[g>>>24]^T[M>>16&255]^N[a>>8&255]^D[255&s]^o[l+2],M=C[M>>>24]^T[a>>16&255]^N[s>>8&255]^D[255&g]^o[l+3],l+=4,a=I,s=c,g=u;for(h=0;h<4;h++)n[(3&-h)+r]=y[a>>>24]<<24^y[s>>16&255]<<16^y[g>>8&255]<<8^y[255&M]^o[l++],I=a,a=s,s=g,g=M,M=I},A}(),a=function(){function A(){t(this,A),this.listeners={}}return A.prototype.on=function(t,A){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(A)},A.prototype.off=function(t,A){if(!this.listeners[t])return!1;var e=this.listeners[t].indexOf(A);return this.listeners[t].splice(e,1),e>-1},A.prototype.trigger=function(t){var A=this.listeners[t];if(A)if(2===arguments.length)for(var e=A.length,i=0;i>8|t>>>24},M=function(){function e(A,i,n,r){t(this,e);var o=e.STEP,a=new Int32Array(A.buffer),M=new Uint8Array(A.byteLength),I=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(a.subarray(I,I+o),i,n,M)),I=o;I>2),n=new o(Array.prototype.slice.call(A)),r=new Uint8Array(t.byteLength),a=new Int32Array(r.buffer),s=void 0,M=void 0,I=void 0,c=void 0,u=void 0,E=void 0,h=void 0,l=void 0,d=void 0;for(s=e[0],M=e[1],I=e[2],c=e[3],d=0;d=0&&(A="main-desc"),A},Pc=function(t,A){t.abort(),t.pause(),A&&A.activePlaylistLoader&&(A.activePlaylistLoader.pause(),A.activePlaylistLoader=null)},Wc=function(t,A){A.activePlaylistLoader=t,t.load()},Vc={AUDIO:function(t,A){return function(){var e=A.segmentLoaders[t],i=A.mediaTypes[t],n=A.blacklistCurrentPlaylist;Pc(e,i);var r=i.activeTrack(),o=i.activeGroup(),a=(o.filter(function(t){return t.default})[0]||o[0]).id,s=i.tracks[a];if(r!==s){for(var g in jt.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[g].enabled=i.tracks[g]===s;i.onTrackChanged()}else n({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(t,A){return function(){var e=A.segmentLoaders[t],i=A.mediaTypes[t];jt.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),Pc(e,i);var n=i.activeTrack();n&&(n.mode="disabled"),i.onTrackChanged()}}},qc={AUDIO:function(t,A,e){if(A){var i=e.tech,n=e.requestOptions,r=e.segmentLoaders[t];A.on("loadedmetadata",function(){var t=A.media();r.playlist(t,n),(!i.paused()||t.endList&&"none"!==i.preload())&&r.load()}),A.on("loadedplaylist",function(){r.playlist(A.media(),n),i.paused()||r.load()}),A.on("error",Vc[t](t,e))}},SUBTITLES:function(t,A,e){var i=e.tech,n=e.requestOptions,r=e.segmentLoaders[t],o=e.mediaTypes[t];A.on("loadedmetadata",function(){var t=A.media();r.playlist(t,n),r.track(o.activeTrack()),(!i.paused()||t.endList&&"none"!==i.preload())&&r.load()}),A.on("loadedplaylist",function(){r.playlist(A.media(),n),i.paused()||r.load()}),A.on("error",Vc[t](t,e))}},Xc=function(t,A){return function(e){return e.attributes[t]===A}},Zc=function(t){return function(A){return A.resolvedUri===t}},_c={AUDIO:function(t,A){var e=A.hls,i=A.sourceType,n=A.segmentLoaders[t],r=A.requestOptions.withCredentials,o=A.master,a=o.mediaGroups,s=o.playlists,g=A.mediaTypes[t],M=g.groups,I=g.tracks,c=A.masterPlaylistLoader;for(var u in a[t]&&0!==Object.keys(a[t]).length||(a[t]={main:{default:{default:!0}}}),a[t]){M[u]||(M[u]=[]);var E=s.filter(Xc(t,u));for(var h in a[t][u]){var l=a[t][u][h];E.filter(Zc(l.resolvedUri)).length&&delete l.resolvedUri;var d;if(d=l.resolvedUri?new gI(l.resolvedUri,e,r):l.playlists&&"dash"===i?new Cc(l.playlists[0],e,r,c):null,l=jt.mergeOptions({id:h,playlistLoader:d},l),qc[t](t,l.playlistLoader,A),M[u].push(l),void 0===I[h]){var C=new jt.AudioTrack({id:h,kind:Hc(l),enabled:!1,language:l.language,default:l.default,label:h});I[h]=C}}}n.on("error",Vc[t](t,A))},SUBTITLES:function(t,A){var e=A.tech,i=A.hls,n=A.sourceType,r=A.segmentLoaders[t],o=A.requestOptions.withCredentials,a=A.master.mediaGroups,s=A.mediaTypes[t],g=s.groups,M=s.tracks,I=A.masterPlaylistLoader;for(var c in a[t])for(var u in g[c]||(g[c]=[]),a[t][c])if(!a[t][c][u].forced){var E=a[t][c][u],h=void 0;if("hls"===n?h=new gI(E.resolvedUri,i,o):"dash"===n&&(h=new Cc(E.playlists[0],i,o,I)),E=jt.mergeOptions({id:u,playlistLoader:h},E),qc[t](t,E.playlistLoader,A),g[c].push(E),void 0===M[u]){var l=e.addRemoteTextTrack({id:u,kind:"subtitles",enabled:!1,language:E.language,label:u},!1).track;M[u]=l}}r.on("error",Vc[t](t,A))},"CLOSED-CAPTIONS":function(t,A){var e=A.tech,i=A.master.mediaGroups,n=A.mediaTypes[t],r=n.groups,o=n.tracks;for(var a in i[t])for(var s in r[a]||(r[a]=[]),i[t][a]){var g=i[t][a][s];if(g.instreamId.match(/CC\d/)&&(r[a].push(jt.mergeOptions({id:s},g)),void 0===o[s])){var M=e.addRemoteTextTrack({id:g.instreamId,kind:"captions",enabled:!1,language:g.language,label:s},!1).track;o[s]=M}}}},$c={AUDIO:function(t,A){return function(){var e=A.mediaTypes[t].tracks;for(var i in e)if(e[i].enabled)return e[i];return null}},SUBTITLES:function(t,A){return function(){var e=A.mediaTypes[t].tracks;for(var i in e)if("showing"===e[i].mode)return e[i];return null}}},tu=function(t){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(A){_c[A](A,t)});var A=t.mediaTypes,e=t.masterPlaylistLoader,i=t.tech,n=t.hls;["AUDIO","SUBTITLES"].forEach(function(e){A[e].activeGroup=function(t,A){return function(e){var i=A.masterPlaylistLoader,n=A.mediaTypes[t].groups,r=i.media();if(!r)return null;var o=null;return r.attributes[t]&&(o=n[r.attributes[t]]),o=o||n.main,void 0===e?o:null===e?null:o.filter(function(t){return t.id===e.id})[0]||null}}(e,t),A[e].activeTrack=$c[e](e,t),A[e].onGroupChanged=function(t,A){return function(){var e=A.segmentLoaders,i=e[t],n=e.main,r=A.mediaTypes[t],o=r.activeTrack(),a=r.activeGroup(o),s=r.activePlaylistLoader;if(Pc(i,r),a){if(!a.playlistLoader)return void(s&&n.resetEverything());i.resyncLoader(),Wc(a.playlistLoader,r)}}}(e,t),A[e].onTrackChanged=function(t,A){return function(){var e=A.segmentLoaders,i=e[t],n=e.main,r=A.mediaTypes[t],o=r.activeTrack(),a=r.activeGroup(o),s=r.activePlaylistLoader;if(Pc(i,r),a){if(!a.playlistLoader)return void n.resetEverything();if(s===a.playlistLoader)return void Wc(a.playlistLoader,r);i.track&&i.track(o),i.resetEverything(),Wc(a.playlistLoader,r)}}}(e,t)});var r=A.AUDIO.activeGroup(),o=(r.filter(function(t){return t.default})[0]||r[0]).id;A.AUDIO.tracks[o].enabled=!0,A.AUDIO.onTrackChanged(),e.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(t){return A[t].onGroupChanged()})});var a=function(){A.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"hls-audio-change"})};for(var s in i.audioTracks().addEventListener("change",a),i.remoteTextTracks().addEventListener("change",A.SUBTITLES.onTrackChanged),n.on("dispose",function(){i.audioTracks().removeEventListener("change",a),i.remoteTextTracks().removeEventListener("change",A.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),A.AUDIO.tracks)i.audioTracks().addTrack(A.AUDIO.tracks[s])},Au=function(){var t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(A){t[A]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ut,activeTrack:Ut,onGroupChanged:Ut,onTrackChanged:Ut}}),t},eu=void 0,iu=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],nu=function(t){return this.audioSegmentLoader_[t]+this.mainSegmentLoader_[t]},ru=function(t){function A(t){XM(this,A);var e=$M(this,(A.__proto__||Object.getPrototypeOf(A)).call(this)),i=t.url,n=t.withCredentials,r=t.tech,o=t.bandwidth,a=t.externHls,s=t.useCueTags,g=t.blacklistDuration,M=t.enableLowInitialPlaylist,I=t.sourceType,c=t.seekTo;if(!i)throw new Error("A non-empty playlist URL is required");eu=a,e.withCredentials=n,e.tech_=r,e.hls_=r.hls,e.seekTo_=c,e.sourceType_=I,e.useCueTags_=s,e.blacklistDuration=g,e.enableLowInitialPlaylist=M,e.useCueTags_&&(e.cueTagsTrack_=e.tech_.addTextTrack("metadata","ad-cues"),e.cueTagsTrack_.inBandMetadataTrackDispatchType=""),e.requestOptions_={withCredentials:e.withCredentials,timeout:null},e.mediaTypes_=Au(),e.mediaSource=new jt.MediaSource,e.mediaSource.addEventListener("sourceopen",e.handleSourceOpen_.bind(e)),e.seekable_=jt.createTimeRanges(),e.hasPlayed_=function(){return!1},e.syncController_=new Gc(t),e.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,e.decrypter_=new Kc,e.inbandTextTracks_={};var u={hls:e.hls_,mediaSource:e.mediaSource,currentTime:e.tech_.currentTime.bind(e.tech_),seekable:function(){return e.seekable()},seeking:function(){return e.tech_.seeking()},duration:function(){return e.mediaSource.duration},hasPlayed:function(){return e.hasPlayed_()},goalBufferLength:function(){return e.goalBufferLength()},bandwidth:o,syncController:e.syncController_,decrypter:e.decrypter_,sourceType:e.sourceType_,inbandTextTracks:e.inbandTextTracks_};return e.masterPlaylistLoader_="dash"===e.sourceType_?new Cc(i,e.hls_,e.withCredentials):new gI(i,e.hls_,e.withCredentials),e.setupMasterPlaylistLoaderListeners_(),e.mainSegmentLoader_=new vc(jt.mergeOptions(u,{segmentMetadataTrack:e.segmentMetadataTrack_,loaderType:"main"}),t),e.audioSegmentLoader_=new vc(jt.mergeOptions(u,{loaderType:"audio"}),t),e.subtitleSegmentLoader_=new Fc(jt.mergeOptions(u,{loaderType:"vtt"}),t),e.setupSegmentLoaderListeners_(),iu.forEach(function(t){e[t+"_"]=nu.bind(e,t)}),e.logger_=Tc("MPC"),e.masterPlaylistLoader_.load(),e}return _M(A,t),ZM(A,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var t=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var A=t.masterPlaylistLoader_.media(),e=1.5*t.masterPlaylistLoader_.targetDuration*1e3;fI(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())?t.requestOptions_.timeout=0:t.requestOptions_.timeout=e,A.endList&&"none"!==t.tech_.preload()&&(t.mainSegmentLoader_.playlist(A,t.requestOptions_),t.mainSegmentLoader_.load()),tu({sourceType:t.sourceType_,segmentLoaders:{AUDIO:t.audioSegmentLoader_,SUBTITLES:t.subtitleSegmentLoader_,main:t.mainSegmentLoader_},tech:t.tech_,requestOptions:t.requestOptions_,masterPlaylistLoader:t.masterPlaylistLoader_,hls:t.hls_,master:t.master(),mediaTypes:t.mediaTypes_,blacklistCurrentPlaylist:t.blacklistCurrentPlaylist.bind(t)}),t.triggerPresenceUsage_(t.master(),A);try{t.setupSourceBuffers_()}catch(A){return jt.log.warn("Failed to create SourceBuffers",A),t.mediaSource.endOfStream("decode")}t.setupFirstPlay(),t.trigger("selectedinitialmedia")}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var A=t.masterPlaylistLoader_.media();if(!A){t.excludeUnsupportedVariants_();var e=void 0;return t.enableLowInitialPlaylist&&(e=t.selectInitialPlaylist()),e||(e=t.selectPlaylist()),t.initialMedia_=e,void t.masterPlaylistLoader_.media(t.initialMedia_)}if(t.useCueTags_&&t.updateAdCues_(A),t.mainSegmentLoader_.playlist(A,t.requestOptions_),t.updateDuration(),t.tech_.paused()||(t.mainSegmentLoader_.load(),t.audioSegmentLoader_&&t.audioSegmentLoader_.load()),!A.endList){var i=function(){var A=t.seekable();0!==A.length&&t.mediaSource.addSeekableRange_(A.start(0),A.end(0))};if(t.duration()!==1/0){t.tech_.one("durationchange",function A(){t.duration()===1/0?i():t.tech_.one("durationchange",A)})}else i()}}),this.masterPlaylistLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){t.mainSegmentLoader_.abort(),t.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var A=t.masterPlaylistLoader_.media(),e=1.5*t.masterPlaylistLoader_.targetDuration*1e3;fI(t.masterPlaylistLoader_.master,t.masterPlaylistLoader_.media())?t.requestOptions_.timeout=0:t.requestOptions_.timeout=e,t.mainSegmentLoader_.playlist(A,t.requestOptions_),t.mainSegmentLoader_.load(),t.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var A=t.masterPlaylistLoader_.media();t.stuckAtPlaylistEnd_(A)&&(t.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),t.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){t.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(t,A){var e=t.mediaGroups||{},i=!0,n=Object.keys(e.AUDIO);for(var r in e.AUDIO)for(var o in e.AUDIO[r]){e.AUDIO[r][o].uri||(i=!1)}i&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(e.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),eu.Playlist.isAes(A)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),eu.Playlist.isFmp4(A)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),n.length&&Object.keys(e.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var t=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var A=t.selectPlaylist(),e=t.masterPlaylistLoader_.media(),i=t.tech_.buffered(),n=i.length?i.end(i.length-1)-t.tech_.currentTime():0,r=t.bufferLowWaterLine();(!e.endList||t.duration()=r)&&t.masterPlaylistLoader_.media(A),t.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){t.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){t.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){t.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){t.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){t.tech_.trigger("hls-reset")}),this.mainSegmentLoader_.on("segmenttimemapping",function(A){t.tech_.trigger({type:"hls-segment-time-mapping",mapping:A.mapping})}),this.audioSegmentLoader_.on("ended",function(){t.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var t=this,A=this.selectPlaylist();A!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(A),this.mainSegmentLoader_.resetEverything(function(){jt.browser.IE_VERSION||jt.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0),this.hasPlayed_()&&this.load();var t=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()0&&void 0!==arguments[0]?arguments[0]:{},A=arguments[1],e=void 0,i=void 0;if(e=t.playlist||this.masterPlaylistLoader_.media(),A=A||t.blacklistDuration||this.blacklistDuration,!e){this.error=t;try{return this.mediaSource.endOfStream("network")}catch(t){return this.trigger("error")}}var n=1===this.masterPlaylistLoader_.master.playlists.filter(yI).length;return n?(jt.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(n)):(e.excludeUntil=Date.now()+1e3*A,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),i=this.selectPlaylist(),jt.log.warn("Problem encountered with the current HLS playlist."+(t.message?" "+t.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(i))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(t){var A=kI(this.tech_.buffered(),t);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?A&&A.length?t:(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}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:eu.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var t=void 0,A=void 0;if(this.masterPlaylistLoader_){var e=this.masterPlaylistLoader_.media();if(e){var i=this.syncController_.getExpiredTime(e,this.mediaSource.duration);if(null!==i&&0!==(t=eu.Playlist.seekable(e,i)).length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(e=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(e,this.mediaSource.duration)))return;if(0===(A=eu.Playlist.seekable(e,i)).length)return}A?A.start(0)>t.end(0)||t.start(0)>A.end(0)?this.seekable_=t:this.seekable_=jt.createTimeRanges([[A.start(0)>t.start(0)?A.start(0):t.start(0),A.end(0)0&&(e=Math.max(e,i.end(i.length-1))),A!==e&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",n):n())}},{key:"dispose",value:function(){var t=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(A){var e=t.mediaTypes_[A].groups;for(var i in e)e[i].forEach(function(t){t.playlistLoader&&t.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var t=this.masterPlaylistLoader_.media(),A=void 0;if(t&&"open"===this.mediaSource.readyState){if((A=nc(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(A),this.excludeIncompatibleVariants_(t)}}},{key:"configureLoaderMimeTypes_",value:function(t){var A=t.length>1&&-1===t[0].indexOf(",")&&t[0]!==t[1]?new jt.EventTarget:null;this.mainSegmentLoader_.mimeType(t[0],A),t[1]&&this.audioSegmentLoader_.mimeType(t[1],A)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){t.attributes.CODECS&&zt.MediaSource&&zt.MediaSource.isTypeSupported&&!zt.MediaSource.isTypeSupported('video/mp4; codecs="'+function(t){return t.replace(/avc1\.(\d+)\.(\d+)/i,function(t){return Ac([t])[0]})}(t.attributes.CODECS)+'"')&&(t.excludeUntil=1/0)})}},{key:"excludeIncompatibleVariants_",value:function(t){var A=2,e=null,i=void 0;t.attributes.CODECS&&(i=ec(t.attributes.CODECS),e=i.videoCodec,A=i.codecCount),this.master().playlists.forEach(function(t){var i={codecCount:2,videoCodec:null};t.attributes.CODECS&&(i=ec(t.attributes.CODECS)),i.codecCount!==A&&(t.excludeUntil=1/0),i.videoCodec!==e&&(t.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var A=0,e=this.seekable();e.length&&(A=e.start(0)),function(t,A){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.segments)for(var i=e,n=void 0,r=0;r=A.end(A.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&t===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):t===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=t)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var t=this.tech_.seeking(),A=this.seekable(),e=this.tech_.currentTime(),i=void 0;return t&&this.afterSeekableWindow_(A,e)&&(i=A.end(A.length-1)),t&&this.beforeSeekableWindow_(A,e)&&(i=A.start(0)+.1),void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+e+" with seekable range "+FI(A)+". Seeking to "+i+"."),this.seekTo(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var t=this.tech_.currentTime(),A=this.tech_.buffered(),e=kI(A,t);return e.length&&t+3<=e.end(0)?(this.cancelTimer_(),this.seekTo(t),this.logger_("Stopped at "+t+" while inside a buffered region ["+e.start(0)+" -> "+e.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var t=this.seekable(),A=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(t,A)){var e=t.end(t.length-1);return this.logger_("Fell out of live window at time "+A+". Seeking to live point (seekable end) "+e),this.cancelTimer_(),this.seekTo(e),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var i=this.tech_.buffered(),n=zI(i,A);if(this.videoUnderflow_(n,i,A))return this.cancelTimer_(),this.seekTo(A),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(n.length>0){var r=n.start(0)-A;return this.logger_("Stopped at "+A+", setting timer for "+r+", seeking to "+n.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*r,A),!0}return!1}},{key:"afterSeekableWindow_",value:function(t,A){return!!t.length&&A>t.end(t.length-1)+.1}},{key:"beforeSeekableWindow_",value:function(t,A){return!!(t.length&&t.start(0)>0&&A2)return{start:n,end:r}}return null}}]),t}(),gu={errorInterval:30,getSource:function(t){return t(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},Mu=function(t){!function t(A,e){var i=0,n=0,r=jt.mergeOptions(gu,e);A.ready(function(){A.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){n&&A.currentTime(n)},a=function(t){null!==t&&void 0!==t&&(n=A.duration()!==1/0&&A.currentTime()||0,A.one("loadedmetadata",o),A.src(t),A.trigger({type:"usage",name:"hls-error-reload"}),A.play())},s=function(){return Date.now()-i<1e3*r.errorInterval?void A.trigger({type:"usage",name:"hls-error-reload-canceled"}):r.getSource&&"function"==typeof r.getSource?(i=Date.now(),r.getSource.call(A,a)):void jt.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},g=function t(){A.off("loadedmetadata",o),A.off("error",s),A.off("dispose",t)};A.on("error",s),A.on("dispose",g),A.reloadSourceOnError=function(e){g(),t(A,e)}}(this,t)};jt.use("*",function(t){return{setSource:function(t,A){A(null,t)},setCurrentTime:function(A){return t.vhs&&t.currentSource().src===t.vhs.source_.src&&t.vhs.setCurrentTime(A),A},play:function(){t.vhs&&t.currentSource().src===t.vhs.source_.src&&t.vhs.setCurrentTime(t.currentTime())}}});var Iu={PlaylistLoader:gI,Playlist:QI,Decrypter:VM,AsyncStream:HM,decrypt:WM,utils:OI,STANDARD_PLAYLIST_SELECTOR:function(){return function(t,A,e,i){var n=t.playlists.map(function(t){var A,e;return A=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,e=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||zt.Number.MAX_VALUE,width:A,height:e,playlist:t}});xc(n,function(t,A){return t.bandwidth-A.bandwidth});var r=(n=n.filter(function(t){return!QI.isIncompatible(t.playlist)})).filter(function(t){return QI.isEnabled(t.playlist)});r.length||(r=n.filter(function(t){return!QI.isDisabled(t.playlist)}));var o=r.filter(function(t){return t.bandwidth*Dc.BANDWIDTH_VARIANCEe||t.height>i})).filter(function(t){return t.width===c[0].width&&t.height===c[0].height}),a=u[u.length-1],E=u.filter(function(t){return t.bandwidth===a.bandwidth})[0]);var h=E||I||s||r[0]||n[0];return h?h.playlist:null}(this.playlists.master,this.systemBandwidth,parseInt(jc(this.tech_.el(),"width"),10),parseInt(jc(this.tech_.el(),"height"),10))},INITIAL_PLAYLIST_SELECTOR:function(){var t=this.playlists.master.playlists.filter(QI.isEnabled);return xc(t,function(t,A){return Yc(t,A)}),t.filter(function(t){return ec(t.attributes.CODECS).videoCodec})[0]||null},comparePlaylistBandwidth:Yc,comparePlaylistResolution:function(t,A){var e=void 0,i=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(e=t.attributes.RESOLUTION.width),e=e||zt.Number.MAX_VALUE,A.attributes.RESOLUTION&&A.attributes.RESOLUTION.width&&(i=A.attributes.RESOLUTION.width),e===(i=i||zt.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&A.attributes.BANDWIDTH?t.attributes.BANDWIDTH-A.attributes.BANDWIDTH:e-i},xhr:pI()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(t){Object.defineProperty(Iu,t,{get:function(){return jt.log.warn("using Hls."+t+" is UNSAFE be sure you know what you are doing"),Dc[t]},set:function(A){jt.log.warn("using Hls."+t+" is UNSAFE be sure you know what you are doing"),"number"!=typeof A||A<0?jt.log.warn("value of Hls."+t+" must be greater than or equal to 0"):Dc[t]=A}})});var cu=function(t){return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(t)?"hls":/^application\/dash\+xml/i.test(t)?"dash":null},uu=function(t,A){for(var e=A.media(),i=-1,n=0;n0?1/this.throughput:0,Math.floor(1/(A+t))},set:function(){jt.log.error('The "systemBandwidth" property is read-only')}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return e.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return e.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return e.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return e.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return e.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return e.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return e.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return e.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return bI(e.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return e.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return e.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return e.tech_.name_},enumerable:!0},duration:{get:function(){return e.tech_.duration()},enumerable:!0},master:{get:function(){return e.playlists.master},enumerable:!0},playerDimensions:{get:function(){return e.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return bI(e.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return e.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("selectedinitialmedia",function(){var t,A;A=(t=e).playlists,t.representations=function(){return A.master.playlists.filter(function(t){return!DI(t)}).map(function(A,e){return new ou(t,A,A.uri)})},Eu(e)}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.tech_.ready(function(){return e.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(jt.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var t=this,A=jt.players[this.tech_.options_.playerId];A&&A.qualityLevels&&(this.qualityLevels_=A.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){!function(t,A){A.representations().forEach(function(A){t.addQualityLevel(A)}),uu(t,A.playlists)}(t.qualityLevels_,t)}),this.playlists.on("mediachange",function(){uu(t.qualityLevels_,t.playlists)}))}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(t){this.masterPlaylistController_.setCurrentTime(t)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),function t(A,e,i){null===A&&(A=Function.prototype);var n=Object.getOwnPropertyDescriptor(A,e);if(void 0===n){var r=Object.getPrototypeOf(A);return null===r?void 0:t(r,e,i)}if("value"in n)return n.value;var o=n.get;return void 0!==o?o.call(i):void 0}(A.prototype.__proto__||Object.getPrototypeOf(A.prototype),"dispose",this).call(this)}}]),A}(),du={name:"videojs-http-streaming",VERSION:"1.2.6",canHandleSource:function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=jt.mergeOptions(jt.options,A);return du.canPlayType(t.type,e)},handleSource:function(t,A){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=jt.mergeOptions(jt.options,e);return A.hls=new lu(t,A,i),A.hls.xhr=pI(),A.hls.src(t.src,t.type),A.hls},canPlayType:function(t){var A=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=jt.mergeOptions(jt.options,A).hls.overrideNative,i=cu(t);return!i||Iu.supportsTypeNatively(i)&&!e?"":"maybe"}};return void 0!==jt.MediaSource&&void 0!==jt.URL||(jt.MediaSource=uc,jt.URL=Ec),uc.supportsNativeMediaSources()&&jt.getTech("Html5").registerSourceHandler(du,0),jt.HlsHandler=lu,jt.HlsSourceHandler=du,jt.Hls=Iu,jt.use||jt.registerComponent("Hls",Iu),jt.options.hls=jt.options.hls||{},jt.registerPlugin?jt.registerPlugin("reloadSourceOnError",Mu):jt.plugin("reloadSourceOnError",Mu),jt}),function(){var t,A;t=window,(A=t&&t.videojs)&&(A.CDN_VERSION="7.2.4")}(),function(t,A){"object"==typeof exports&&"object"==typeof module?module.exports=A():"function"==typeof define&&define.amd?define([],A):"object"==typeof exports?exports.flvjs=A():t.flvjs=A()}(self,function(){return function(){function t(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return A[i].call(r.exports,r,r.exports,t),r.exports}var A={479:function(t,A,e){t.exports=function(){"use strict";function t(t){return"function"==typeof t}function A(){var t=setTimeout;return function(){return t(i,1)}}function i(){for(var t=0;t0&&s.length>o&&!s.warned){s.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(A)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=t,M.type=A,M.count=s.length,g=M,console&&console.warn&&console.warn(g)}return t}function r(t,A,e){var i={fired:!1,wrapFn:void 0,target:t,type:A,listener:e},n=function(){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)}.bind(i);return n.listener=e,i.wrapFn=n,n}function o(t,A,e){var i=t._events;if(void 0===i)return[];var n=i[A];return void 0===n?[]:"function"==typeof n?e?[n.listener||n]:[n]:e?function(t){for(var A=new Array(t.length),e=0;e0&&(r=A[0]),r instanceof Error)throw r;var o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var a=n[t];if(void 0===a)return!1;if("function"==typeof a)c(a,this,A);else{var g=a.length,M=s(a,g);for(e=0;e=0;o--)if(i[o]===A||i[o].listener===A){a=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(t,A){for(;A+1=0;i--)this.removeListener(t,A[i]);return this},A.prototype.listeners=function(t){return o(this,t,!0)},A.prototype.rawListeners=function(t){return o(this,t,!1)},A.listenerCount=function(t,A){return"function"==typeof t.listenerCount?t.listenerCount(A):a.call(t,A)},A.prototype.listenerCount=a,A.prototype.eventNames=function(){return this._eventsCount>0?M(this._events):[]}},548:function(t,A,e){function i(t){function A(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,A),n.l=!0,n.exports}var e={};A.m=t,A.c=e,A.i=function(t){return t},A.d=function(t,e,i){A.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},A.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},A.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return A.d(e,"a",e),e},A.o=function(t,A){return Object.prototype.hasOwnProperty.call(t,A)},A.p="/",A.oe=function(t){throw console.error(t),t};var i=A(A.s=ENTRY_MODULE);return i.default||i}function n(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function r(t,A,i){var r={};r[i]=[];var o=A.toString(),g=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!g)return r;for(var M,I=g[1],c=new RegExp("(\\\\n|\\W)"+n(I)+s,"g");M=c.exec(o);)"dll-reference"!==M[3]&&r[i].push(M[3]);for(c=new RegExp("\\("+n(I)+'\\("(dll-reference\\s('+a+'))"\\)\\)'+s,"g");M=c.exec(o);)t[M[2]]||(r[i].push(M[1]),t[M[2]]=e(M[1]).m),r[M[2]]=r[M[2]]||[],r[M[2]].push(M[4]);for(var u,E=Object.keys(r),h=0;h0},!1)}var a="[\\.|\\-|\\+|\\w|/|@]+",s="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";t.exports=function(t,A){A=A||{};var n={main:e.m},a=A.all?{main:Object.keys(n.main)}:function(t,A){for(var e={main:[A]},i={main:[]},n={main:{}};o(e);)for(var a=Object.keys(e),s=0;s=t[n]&&A0&&t[0].originalDts=A[n].dts&&tA[i].lastSample.originalDts&&t=A[i].lastSample.originalDts&&(i===A.length-1||i0&&(n=this._searchNearestSegmentBefore(e.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,e)},t.prototype.getLastSegmentBefore=function(t){var A=this._searchNearestSegmentBefore(t);return A>=0?this._list[A]:null},t.prototype.getLastSampleBefore=function(t){var A=this.getLastSegmentBefore(t);return null!=A?A.lastSample:null},t.prototype.getLastSyncPointBefore=function(t){for(var A=this._searchNearestSegmentBefore(t),e=this._list[A].syncPoints;0===e.length&&A>0;)A--,e=this._list[A].syncPoints;return e.length>0?e[e.length-1]:null},t}()},105:function(t,A,e){"use strict";function i(t,A,e){var i=t;if(A+e=128){A.push(String.fromCharCode(65535&o)),n+=2;continue}}else if(e[n]<240){if(i(e,n,2)&&(o=(15&e[n])<<12|(63&e[n+1])<<6|63&e[n+2])>=2048&&55296!=(63488&o)){A.push(String.fromCharCode(65535&o)),n+=3;continue}}else if(e[n]<248){var o;if(i(e,n,3)&&(o=(7&e[n])<<18|(63&e[n+1])<<12|(63&e[n+2])<<6|63&e[n+3])>65536&&o<1114112){o-=65536,A.push(String.fromCharCode(o>>>10|55296)),A.push(String.fromCharCode(1023&o|56320)),n+=4;continue}}A.push(String.fromCharCode(65533)),++n}return A.join("")},I=e(289),c=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),u=function(){function t(){}return t.parseScriptData=function(A,e,i){var n={};try{var r=t.parseValue(A,e,i),o=t.parseValue(A,e+r.size,i-r.size);n[r.data]=o.data}catch(t){a.Z.e("AMF",t.toString())}return n},t.parseObject=function(A,e,i){if(i<3)throw new I.rT("Data not enough when parse ScriptDataObject");var n=t.parseString(A,e,i),r=t.parseValue(A,e+n.size,i-n.size),o=r.objectEnd;return{data:{name:n.data,value:r.data},size:n.size+r.size,objectEnd:o}},t.parseVariable=function(A,e,i){return t.parseObject(A,e,i)},t.parseString=function(t,A,e){if(e<2)throw new I.rT("Data not enough when parse String");var i=new DataView(t,A,e).getUint16(0,!c);return{data:i>0?M(new Uint8Array(t,A+2,i)):"",size:2+i}},t.parseLongString=function(t,A,e){if(e<4)throw new I.rT("Data not enough when parse LongString");var i=new DataView(t,A,e).getUint32(0,!c);return{data:i>0?M(new Uint8Array(t,A+4,i)):"",size:4+i}},t.parseDate=function(t,A,e){if(e<10)throw new I.rT("Data size invalid when parse Date");var i=new DataView(t,A,e),n=i.getFloat64(0,!c),r=i.getInt16(8,!c);return{data:new Date(n+=60*r*1e3),size:10}},t.parseValue=function(A,e,i){if(i<1)throw new I.rT("Data not enough when parse Value");var n,r=new DataView(A,e,i),o=1,s=r.getUint8(0),g=!1;try{switch(s){case 0:n=r.getFloat64(1,!c),o+=8;break;case 1:n=!!r.getUint8(1),o+=1;break;case 2:var M=t.parseString(A,e+1,i-1);n=M.data,o+=M.size;break;case 3:n={};var u=0;for(9==(16777215&r.getUint32(i-4,!c))&&(u=3);o32)throw new I.OC("ExpGolomb: readBits() bits exceeded max 32bits!");if(t<=this._current_word_bits_left){var A=this._current_word>>>32-t;return this._current_word<<=t,this._current_word_bits_left-=t,A}var e=this._current_word_bits_left?this._current_word:0;e>>>=32-this._current_word_bits_left;var i=t-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,e<>>t))return this._current_word<<=t,this._current_word_bits_left-=t,t;return this._fillCurrentWord(),t+this._skipLeadingZero()},t.prototype.readUEG=function(){var t=this._skipLeadingZero();return this.readBits(t+1)-1},t.prototype.readSEG=function(){var t=this.readUEG();return 1&t?t+1>>>1:-1*(t>>>1)},t}(),h=function(){function t(){}return t._ebsp2rbsp=function(t){for(var A=t,e=A.byteLength,i=new Uint8Array(e),n=0,r=0;r=2&&3===A[r]&&0===A[r-1]&&0===A[r-2]||(i[n]=A[r],n++);return new Uint8Array(i.buffer,0,n)},t.parseSPS=function(A){var e=t._ebsp2rbsp(A),i=new E(e);i.readByte();var n=i.readByte();i.readByte();var r=i.readByte();i.readUEG();var o=t.getProfileString(n),a=t.getLevelString(r),s=1,g=420,M=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(3===(s=i.readUEG())&&i.readBits(1),s<=3&&(g=[0,420,422,444][s]),M=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var I=3!==s?8:12,c=0;c0&&L<16?(f=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][L-1],Q=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][L-1]):255===L&&(f=i.readByte()<<8|i.readByte(),Q=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var j=i.readBits(32),x=i.readBits(32);m=i.readBool(),w=(p=x)/(S=2*j)}}var Y=1;1===f&&1===Q||(Y=f/Q);var U=0,O=0;0===s?(U=1,O=2-T):(U=3===s?1:2,O=(1===s?2:1)*(2-T));var v=16*(d+1),k=16*(C+1)*(2-T);v-=(N+D)*U,k-=(y+B)*O;var z=Math.ceil(v*Y);return i.destroy(),i=null,{profile_string:o,level_string:a,bit_depth:M,ref_frames:l,chroma_format:g,chroma_format_string:t.getChromaFormatString(g),frame_rate:{fixed:m,fps:w,fps_den:S,fps_num:p},sar_ratio:{width:f,height:Q},codec_size:{width:v,height:k},present_size:{width:z,height:k}}},t._skipScalingList=function(t,A){for(var e=8,i=8,n=0;n>>2!=0,r=0!=(1&A[4]),o=(i=A)[5]<<24|i[6]<<16|i[7]<<8|i[8];return o<9?e:{match:!0,consumed:o,dataOffset:o,hasAudioTrack:n,hasVideoTrack:r}},t.prototype.bindDataSource=function(t){return t.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(t.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(t){this._onTrackMetadata=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(t){this._onMediaInfo=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(t){this._onMetaDataArrived=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(t){this._onScriptDataArrived=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{get:function(){return this._onError},set:function(t){this._onError=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(t){this._onDataAvailable=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(t){this._timestampBase=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overridedDuration",{get:function(){return this._duration},set:function(t){this._durationOverrided=!0,this._duration=t,this._mediaInfo.duration=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overridedHasAudio",{set:function(t){this._hasAudioFlagOverrided=!0,this._hasAudio=t,this._mediaInfo.hasAudio=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"overridedHasVideo",{set:function(t){this._hasVideoFlagOverrided=!0,this._hasVideo=t,this._mediaInfo.hasVideo=t},enumerable:!1,configurable:!0}),t.prototype.resetMediaInfo=function(){this._mediaInfo=new g.Z},t.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},t.prototype.parseChunks=function(A,e){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new I.rT("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0,n=this._littleEndian;if(0===e){if(!(A.byteLength>13))return 0;i=t.probe(A).dataOffset}for(this._firstParse&&(this._firstParse=!1,e+i!==this._dataOffset&&a.Z.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(r=new DataView(A,i)).getUint32(0,!n)&&a.Z.w(this.TAG,"PrevTagSize0 !== 0 !!!"),i+=4);iA.byteLength)break;var o=r.getUint8(0),s=16777215&r.getUint32(0,!n);if(i+11+s+4>A.byteLength)break;if(8===o||9===o||18===o){var g=r.getUint8(4),M=r.getUint8(5),c=r.getUint8(6)|M<<8|g<<16|r.getUint8(7)<<24;0!=(16777215&r.getUint32(7,!n))&&a.Z.w(this.TAG,"Meet tag which has StreamID != 0!");var u=i+11;switch(o){case 8:this._parseAudioData(A,u,s,c);break;case 9:this._parseVideoData(A,u,s,c,e+i);break;case 18:this._parseScriptData(A,u,s)}var E=r.getUint32(11+s,!n);E!==11+s&&a.Z.w(this.TAG,"Invalid PrevTagSize ".concat(E)),i+=11+s+4}else a.Z.w(this.TAG,"Unsupported tag type ".concat(o,", skipped")),i+=11+s+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),i},t.prototype._parseScriptData=function(t,A,e){var i=u.parseScriptData(t,A,e);if(i.hasOwnProperty("onMetaData")){if(null==i.onMetaData||"object"!=typeof i.onMetaData)return void a.Z.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.Z.w(this.TAG,"Found another onMetaData tag!"),this._metadata=i;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var r=Math.floor(n.duration*this._timescale);this._duration=r,this._mediaInfo.duration=r}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var o=Math.floor(1e3*n.framerate);if(o>0){var s=o/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=s,this._referenceFrameRate.fps_num=o,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=s}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var g=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(g),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,a.Z.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(i).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},i))},t.prototype._parseKeyframesIndex=function(t){for(var A=[],e=[],i=1;i>>4;if(2===r||10===r){var o=0,s=(12&n)>>>2;if(s>=0&&s<=4){o=this._flvSoundRateTable[s];var g=1&n,M=this._audioMetadata,I=this._audioTrack;if(M||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(M=this._audioMetadata={}).type="audio",M.id=I.id,M.timescale=this._timescale,M.duration=this._duration,M.audioSampleRate=o,M.channelCount=0===g?1:2),10===r){var c=this._parseAACAudioData(t,A+1,e-1);if(null==c)return;if(0===c.packetType){M.config&&a.Z.w(this.TAG,"Found another AudioSpecificConfig!");var u=c.data;M.audioSampleRate=u.samplingRate,M.channelCount=u.channelCount,M.codec=u.codec,M.originalCodec=u.originalCodec,M.config=u.config,M.refSampleDuration=1024/M.audioSampleRate*M.timescale,a.Z.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",M),(d=this._mediaInfo).audioCodec=M.originalCodec,d.audioSampleRate=M.audioSampleRate,d.audioChannelCount=M.channelCount,d.hasVideo?null!=d.videoCodec&&(d.mimeType='video/x-flv; codecs="'+d.videoCodec+","+d.audioCodec+'"'):d.mimeType='video/x-flv; codecs="'+d.audioCodec+'"',d.isComplete()&&this._onMediaInfo(d)}else if(1===c.packetType){var E=this._timestampBase+i,h={unit:c.data,length:c.data.byteLength,dts:E,pts:E};I.samples.push(h),I.length+=c.data.length}else a.Z.e(this.TAG,"Flv: Unsupported AAC data type ".concat(c.packetType))}else if(2===r){if(!M.codec){var d;if(null==(u=this._parseMP3AudioData(t,A+1,e-1,!0)))return;M.audioSampleRate=u.samplingRate,M.channelCount=u.channelCount,M.codec=u.codec,M.originalCodec=u.originalCodec,M.refSampleDuration=1152/M.audioSampleRate*M.timescale,a.Z.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",M),(d=this._mediaInfo).audioCodec=M.codec,d.audioSampleRate=M.audioSampleRate,d.audioChannelCount=M.channelCount,d.audioDataRate=u.bitRate,d.hasVideo?null!=d.videoCodec&&(d.mimeType='video/x-flv; codecs="'+d.videoCodec+","+d.audioCodec+'"'):d.mimeType='video/x-flv; codecs="'+d.audioCodec+'"',d.isComplete()&&this._onMediaInfo(d)}var C=this._parseMP3AudioData(t,A+1,e-1,!1);if(null==C)return;E=this._timestampBase+i;var T={unit:C,length:C.byteLength,dts:E,pts:E};I.samples.push(T),I.length+=C.length}}else this._onError(l.Z.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+s)}else this._onError(l.Z.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+r)}},t.prototype._parseAACAudioData=function(t,A,e){if(!(e<=1)){var i={},n=new Uint8Array(t,A,e);return i.packetType=n[0],0===n[0]?i.data=this._parseAACAudioSpecificConfig(t,A+1,e-1):i.data=n.subarray(1),i}a.Z.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},t.prototype._parseAACAudioSpecificConfig=function(t,A,e){var i,n,r=new Uint8Array(t,A,e),o=null,a=0,s=null;if(a=i=r[0]>>>3,(n=(7&r[0])<<1|r[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(l.Z.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var g=this._mpegSamplingRates[n],M=(120&r[1])>>>3;if(!(M<0||M>=8)){5===a&&(s=(7&r[1])<<1|r[2]>>>7,r[2]);var I=self.navigator.userAgent.toLowerCase();return-1!==I.indexOf("firefox")?n>=6?(a=5,o=new Array(4),s=n-3):(a=2,o=new Array(2),s=n):-1!==I.indexOf("android")?(a=2,o=new Array(2),s=n):(a=5,s=n,o=new Array(4),n>=6?s=n-3:1===M&&(a=2,o=new Array(2),s=n)),o[0]=a<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&M)<<3,5===a&&(o[1]|=(15&s)>>>1,o[2]=(1&s)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:g,channelCount:M,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+i}}this._onError(l.Z.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},t.prototype._parseMP3AudioData=function(t,A,e,i){if(!(e<4)){this._littleEndian;var n=new Uint8Array(t,A,e),r=null;if(i){if(255!==n[0])return;var o=n[1]>>>3&3,s=(6&n[1])>>1,g=(240&n[2])>>>4,M=(12&n[2])>>>2,I=3!=(n[3]>>>6&3)?2:1,c=0,u=0;switch(o){case 0:c=this._mpegAudioV25SampleRateTable[M];break;case 2:c=this._mpegAudioV20SampleRateTable[M];break;case 3:c=this._mpegAudioV10SampleRateTable[M]}switch(s){case 1:g>>4,s=15&r;12!==s?7===s?this._parseAVCVideoPacket(t,A+1,e-1,i,n,o):this._onError(l.Z.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(s)):this._config.callback(s)}},t.prototype._parseAVCVideoPacket=function(t,A,e,i,n,r){if(e<4)a.Z.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var o=this._littleEndian,s=new DataView(t,A,e),g=s.getUint8(0),M=(16777215&s.getUint32(0,!o))<<8>>8;if(0===g)this._parseAVCDecoderConfigurationRecord(t,A+4,e-4);else if(1===g)this._parseAVCVideoData(t,A+4,e-4,i,n,r,M);else if(2!==g)return void this._onError(l.Z.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(g))}},t.prototype._parseAVCDecoderConfigurationRecord=function(t,A,e){if(e<7)a.Z.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var i=this._videoMetadata,n=this._videoTrack,r=this._littleEndian,o=new DataView(t,A,e);i?void 0!==i.avcc&&a.Z.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(i=this._videoMetadata={}).type="video",i.id=n.id,i.timescale=this._timescale,i.duration=this._duration);var s=o.getUint8(0),g=o.getUint8(1);if(o.getUint8(2),o.getUint8(3),1===s&&0!==g)if(this._naluLengthSize=1+(3&o.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var M=31&o.getUint8(5);if(0!==M){M>1&&a.Z.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(M));for(var I=6,c=0;c1&&a.Z.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(Q)),I++,c=0;c=e){a.Z.w(this.TAG,"Malformed Nalu near timestamp ".concat(E,", offset = ").concat(c,", dataSize = ").concat(e));break}var l=g.getUint32(c,!s);if(3===u&&(l>>>=8),l>e-u)return void a.Z.w(this.TAG,"Malformed Nalus near timestamp ".concat(E,", NaluSize > DataSize!"));var d=31&g.getUint8(c+u);5===d&&(h=!0);var C=new Uint8Array(t,A+c,u+l),T={type:d,data:C};M.push(T),I+=C.byteLength,c+=u+l}if(M.length){var N=this._videoTrack,D={units:M,length:I,isKeyframe:h,dts:E,cts:o,pts:E+o};h&&(D.fileposition=n),N.samples.push(D),N.length+=I}},t}(),C=function(){function t(){}return t.init=function(){for(var A in t.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":[]},t.types)t.types.hasOwnProperty(A)&&(t.types[A]=[A.charCodeAt(0),A.charCodeAt(1),A.charCodeAt(2),A.charCodeAt(3)]);var e=t.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},t.box=function(t){for(var A=8,e=null,i=Array.prototype.slice.call(arguments,1),n=i.length,r=0;r>>24&255,e[1]=A>>>16&255,e[2]=A>>>8&255,e[3]=255&A,e.set(t,4);var o=8;for(r=0;r>>24&255,A>>>16&255,A>>>8&255,255&A,e>>>24&255,e>>>16&255,e>>>8&255,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]))},t.trak=function(A){return t.box(t.types.trak,t.tkhd(A),t.mdia(A))},t.tkhd=function(A){var e=A.id,i=A.duration,n=A.presentWidth,r=A.presentHeight;return t.box(t.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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,n>>>8&255,255&n,0,0,r>>>8&255,255&r,0,0]))},t.mdia=function(A){return t.box(t.types.mdia,t.mdhd(A),t.hdlr(A),t.minf(A))},t.mdhd=function(A){var e=A.timescale,i=A.duration;return t.box(t.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))},t.hdlr=function(A){var e;return e="audio"===A.type?t.constants.HDLR_AUDIO:t.constants.HDLR_VIDEO,t.box(t.types.hdlr,e)},t.minf=function(A){var e;return e="audio"===A.type?t.box(t.types.smhd,t.constants.SMHD):t.box(t.types.vmhd,t.constants.VMHD),t.box(t.types.minf,e,t.dinf(),t.stbl(A))},t.dinf=function(){return t.box(t.types.dinf,t.box(t.types.dref,t.constants.DREF))},t.stbl=function(A){return t.box(t.types.stbl,t.stsd(A),t.box(t.types.stts,t.constants.STTS),t.box(t.types.stsc,t.constants.STSC),t.box(t.types.stsz,t.constants.STSZ),t.box(t.types.stco,t.constants.STCO))},t.stsd=function(A){return"audio"===A.type?"mp3"===A.codec?t.box(t.types.stsd,t.constants.STSD_PREFIX,t.mp3(A)):t.box(t.types.stsd,t.constants.STSD_PREFIX,t.mp4a(A)):t.box(t.types.stsd,t.constants.STSD_PREFIX,t.avc1(A))},t.mp3=function(A){var e=A.channelCount,i=A.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return t.box(t.types[".mp3"],n)},t.mp4a=function(A){var e=A.channelCount,i=A.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return t.box(t.types.mp4a,n,t.esds(A))},t.esds=function(A){var e=A.config||[],i=e.length,n=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(e).concat([6,1,2]));return t.box(t.types.esds,n)},t.avc1=function(A){var e=A.avcc,i=A.codecWidth,n=A.codecHeight,r=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,i>>>8&255,255&i,n>>>8&255,255&n,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.box(t.types.avc1,r,t.box(t.types.avcC,e))},t.mvex=function(A){return t.box(t.types.mvex,t.trex(A))},t.trex=function(A){var e=A.id,i=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return t.box(t.types.trex,i)},t.moof=function(A,e){return t.box(t.types.moof,t.mfhd(A.sequenceNumber),t.traf(A,e))},t.mfhd=function(A){var e=new Uint8Array([0,0,0,0,A>>>24&255,A>>>16&255,A>>>8&255,255&A]);return t.box(t.types.mfhd,e)},t.traf=function(A,e){var i=A.id,n=t.box(t.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=t.box(t.types.tfdt,new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])),o=t.sdtp(A),a=t.trun(A,o.byteLength+16+16+8+16+8+8);return t.box(t.types.traf,n,r,a,o)},t.sdtp=function(A){for(var e=A.samples||[],i=e.length,n=new Uint8Array(4+i),r=0;r>>24&255,n>>>16&255,n>>>8&255,255&n,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0);for(var a=0;a>>24&255,s>>>16&255,s>>>8&255,255&s,g>>>24&255,g>>>16&255,g>>>8&255,255&g,M.isLeading<<2|M.dependsOn,M.isDependedOn<<6|M.hasRedundancy<<4|M.isNonSync,0,0,I>>>24&255,I>>>16&255,I>>>8&255,255&I],12+16*a)}return t.box(t.types.trun,o)},t.mdat=function(A){return t.box(t.types.mdat,A)},t}();C.init();var T=C,N=function(){function t(){}return t.getSilentFrame=function(t,A){if("mp4a.40.2"===t){if(1===A)return new Uint8Array([0,200,0,128,35,128]);if(2===A)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===A)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===A)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===A)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===A)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===A)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===A)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===A)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},t}(),D=e(449),y=function(){function t(t){this.TAG="MP4Remuxer",this._config=t,this._isLive=!0===t.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 D.J1("audio"),this._videoSegmentInfoList=new D.J1("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!s.Z.chrome||!(s.Z.version.major<50||50===s.Z.version.major&&s.Z.version.build<2661)),this._fillSilentAfterSeek=s.Z.msedge||s.Z.msie,this._mp3UseMpegAudio=!s.Z.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return t.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},t.prototype.bindDataSource=function(t){return t.onDataAvailable=this.remux.bind(this),t.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(t.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(t){this._onInitSegment=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(t){this._onMediaSegment=t},enumerable:!1,configurable:!0}),t.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},t.prototype.seek=function(t){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},t.prototype.remux=function(t,A){if(!this._onMediaSegment)throw new I.rT("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(t,A),this._remuxVideo(A),this._remuxAudio(t)},t.prototype._onTrackMetadataReceived=function(t,A){var e=null,i="mp4",n=A.codec;if("audio"===t)this._audioMeta=A,"mp3"===A.codec&&this._mp3UseMpegAudio?(i="mpeg",n="",e=new Uint8Array):e=T.generateInitSegment(A);else{if("video"!==t)return;this._videoMeta=A,e=T.generateInitSegment(A)}if(!this._onInitSegment)throw new I.rT("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(t,{type:t,data:e.buffer,codec:n,container:"".concat(t,"/").concat(i),mediaDuration:A.duration})},t.prototype._calculateDtsBase=function(t,A){this._dtsBaseInited||(t.samples&&t.samples.length&&(this._audioDtsBase=t.samples[0].dts),A.samples&&A.samples.length&&(this._videoDtsBase=A.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},t.prototype.flushStashedSamples=function(){var t=this._videoStashedLastSample,A=this._audioStashedLastSample,e={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=t&&(e.samples.push(t),e.length=t.length);var i={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=A&&(i.samples.push(A),i.length=A.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(e,!0),this._remuxAudio(i,!0)},t.prototype._remuxAudio=function(t,A){if(null!=this._audioMeta){var e,i=t,n=i.samples,r=void 0,o=-1,g=this._audioMeta.refSampleDuration,M="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,I=this._dtsBaseInited&&void 0===this._audioNextDts,c=!1;if(n&&0!==n.length&&(1!==n.length||A)){var u=0,E=null,h=0;M?(u=0,h=i.length):(u=8,h=8+i.length);var l=null;if(n.length>1&&(h-=(l=n.pop()).length),null!=this._audioStashedLastSample){var d=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(d),h+=d.length}null!=l&&(this._audioStashedLastSample=l);var C=n[0].dts-this._dtsBase;if(this._audioNextDts)r=C-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())r=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(c=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(C);if(null!=y){var B=C-(y.originalDts+y.duration);B<=3&&(B=0),r=C-(y.dts+y.duration+B)}else r=0}if(c){var f=C-r,Q=this._videoSegmentInfoList.getLastSegmentBefore(C);if(null!=Q&&Q.beginDts=3*g&&this._fillAudioTimestampGap&&!s.Z.safari){x=!0;var v,k=Math.floor(r/g);a.Z.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+"originalDts: ".concat(j," ms, curRefDts: ").concat(O," ms, ")+"dtsCorrection: ".concat(Math.round(r)," ms, generate: ").concat(k," frames")),w=Math.floor(O),U=Math.floor(O+g)-w,null==(v=N.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(a.Z.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),v=L),Y=[];for(var z=0;z=1?p[p.length-1].duration:Math.floor(g),this._audioNextDts=w+U;-1===o&&(o=w),p.push({dts:w,pts:w,cts:0,unit:d.unit,size:d.unit.byteLength,duration:U,originalDts:j,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),x&&p.push.apply(p,Y)}}if(0===p.length)return i.samples=[],void(i.length=0);for(M?E=new Uint8Array(h):((E=new Uint8Array(h))[0]=h>>>24&255,E[1]=h>>>16&255,E[2]=h>>>8&255,E[3]=255&h,E.set(T.types.mdat,4)),S=0;S1&&(I-=(c=r.pop()).length),null!=this._videoStashedLastSample){var u=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(u),I+=u.length}null!=c&&(this._videoStashedLastSample=c);var E=r[0].dts-this._dtsBase;if(this._videoNextDts)o=E-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var h=this._videoSegmentInfoList.getLastSampleBefore(E);if(null!=h){var l=E-(h.originalDts+h.duration);l<=3&&(l=0),o=E-(h.dts+h.duration+l)}else o=0}for(var d=new D.Yy,C=[],N=0;N=1?C[C.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),B){var p=new D.Wk(f,w,m,u.dts,!0);p.fileposition=u.fileposition,d.appendSyncPoint(p)}C.push({dts:f,pts:w,cts:Q,units:u.units,size:u.length,isKeyframe:B,duration:m,originalDts:y,flags:{isLeading:0,dependsOn:B?2:1,isDependedOn:B?1:0,hasRedundancy:0,isNonSync:B?0:1}})}for((M=new Uint8Array(I))[0]=I>>>24&255,M[1]=I>>>16&255,M[2]=I>>>8&255,M[3]=255&I,M.set(T.types.mdat,4),N=0;N0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(t,A);else if((i=d.probe(t)).match){this._demuxer=new d(i,this._config),this._remuxer||(this._remuxer=new y(this._config));var r=this._mediaDataSource;null==r.duration||isNaN(r.duration)||(this._demuxer.overridedDuration=r.duration),"boolean"==typeof r.hasAudio&&(this._demuxer.overridedHasAudio=r.hasAudio),"boolean"==typeof r.hasVideo&&(this._demuxer.overridedHasVideo=r.hasVideo),this._demuxer.timestampBase=r.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),n=this._demuxer.parseChunks(t,A)}else i=null,a.Z.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){e._internalAbort()}),this._emitter.emit(f.Z.DEMUX_ERROR,l.Z.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),n=0;return n},t.prototype._onMediaInfo=function(t){var A=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},t),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,g.Z.prototype));var e=Object.assign({},t);Object.setPrototypeOf(e,g.Z.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=e,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then(function(){var t=A._pendingSeekTime;A._pendingSeekTime=null,A.seek(t)})},t.prototype._onMetaDataArrived=function(t){this._emitter.emit(f.Z.METADATA_ARRIVED,t)},t.prototype._onScriptDataArrived=function(t){this._emitter.emit(f.Z.SCRIPTDATA_ARRIVED,t)},t.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},t.prototype._onIOComplete=function(t){var A=t+1;A0&&e[0].originalDts===i&&(i=e[0].pts),this._emitter.emit(f.Z.RECOMMEND_SEEKPOINT,i)}},t.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},t.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},t.prototype._reportSegmentMediaInfo=function(t){var A=this._mediaInfo.segments[t],e=Object.assign({},A);e.duration=this._mediaInfo.duration,e.segmentCount=this._mediaInfo.segmentCount,delete e.segments,delete e.keyframesIndex,this._emitter.emit(f.Z.MEDIA_INFO,e)},t.prototype._reportStatisticsInfo=function(){var t={};t.url=this._ioctl.currentURL,t.hasRedirect=this._ioctl.hasRedirect,t.hasRedirect&&(t.redirectedURL=this._ioctl.currentRedirectedURL),t.speed=this._ioctl.currentSpeed,t.loaderType=this._ioctl.loaderType,t.currentSegmentIndex=this._currentSegmentIndex,t.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(f.Z.STATISTICS_INFO,t)},t}()},433:function(t,A){"use strict";A.Z={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"}},955:function(t,A,e){"use strict";e(879),e(195),e(105),e(433)},363:function(t,A){"use strict";A.Z={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},593:function(t,A,e){"use strict";function i(){return Object.assign({},o)}e.d(A,{default:function(){return U}});var n=e(195),r=e(70),o={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},a=function(){function t(){}return t.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},t.supportNetworkStreamIO=function(){var t=new r.Z({},i()),A=t.loaderType;return t.destroy(),"fetch-stream-loader"==A||"xhr-moz-chunked-loader"==A},t.getNetworkLoaderTypeName=function(){var t=new r.Z({},i()),A=t.loaderType;return t.destroy(),A},t.supportNativeMediaPlayback=function(A){null==t.videoElement&&(t.videoElement=window.document.createElement("video"));var e=t.videoElement.canPlayType(A);return"probably"===e||"maybe"==e},t.getFeatureList=function(){var A={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return A.mseFlvPlayback=t.supportMSEH264Playback(),A.networkStreamIO=t.supportNetworkStreamIO(),A.networkLoaderName=t.getNetworkLoaderTypeName(),A.mseLiveFlvPlayback=A.mseFlvPlayback&&A.networkStreamIO,A.nativeMP4H264Playback=t.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),A.nativeWebmVP8Playback=t.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),A.nativeWebmVP9Playback=t.supportNativeMediaPlayback('video/webm; codecs="vp9"'),A},t}(),s=e(206),g=e(523),M=e.n(g),I=e(324),c=e(420),u={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"},E=e(548),h=e.n(E),l=e(879),d=e(105),C=e(433),T=e(486),N=function(){function t(t,A){if(this.TAG="Transmuxer",this._emitter=new(M()),A.enableWorker&&"undefined"!=typeof Worker)try{this._worker=h()(955),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[t,A]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},l.Z.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:l.Z.getConfig()})}catch(e){I.Z.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new d.Z(t,A)}else this._controller=new d.Z(t,A);if(this._controller){var e=this._controller;e.on(C.Z.IO_ERROR,this._onIOError.bind(this)),e.on(C.Z.DEMUX_ERROR,this._onDemuxError.bind(this)),e.on(C.Z.INIT_SEGMENT,this._onInitSegment.bind(this)),e.on(C.Z.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),e.on(C.Z.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),e.on(C.Z.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),e.on(C.Z.MEDIA_INFO,this._onMediaInfo.bind(this)),e.on(C.Z.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),e.on(C.Z.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),e.on(C.Z.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),e.on(C.Z.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return t.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),l.Z.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},t.prototype.on=function(t,A){this._emitter.addListener(t,A)},t.prototype.off=function(t,A){this._emitter.removeListener(t,A)},t.prototype.hasWorker=function(){return null!=this._worker},t.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},t.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},t.prototype.seek=function(t){this._worker?this._worker.postMessage({cmd:"seek",param:t}):this._controller.seek(t)},t.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},t.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},t.prototype._onInitSegment=function(t,A){var e=this;Promise.resolve().then(function(){e._emitter.emit(C.Z.INIT_SEGMENT,t,A)})},t.prototype._onMediaSegment=function(t,A){var e=this;Promise.resolve().then(function(){e._emitter.emit(C.Z.MEDIA_SEGMENT,t,A)})},t.prototype._onLoadingComplete=function(){var t=this;Promise.resolve().then(function(){t._emitter.emit(C.Z.LOADING_COMPLETE)})},t.prototype._onRecoveredEarlyEof=function(){var t=this;Promise.resolve().then(function(){t._emitter.emit(C.Z.RECOVERED_EARLY_EOF)})},t.prototype._onMediaInfo=function(t){var A=this;Promise.resolve().then(function(){A._emitter.emit(C.Z.MEDIA_INFO,t)})},t.prototype._onMetaDataArrived=function(t){var A=this;Promise.resolve().then(function(){A._emitter.emit(C.Z.METADATA_ARRIVED,t)})},t.prototype._onScriptDataArrived=function(t){var A=this;Promise.resolve().then(function(){A._emitter.emit(C.Z.SCRIPTDATA_ARRIVED,t)})},t.prototype._onStatisticsInfo=function(t){var A=this;Promise.resolve().then(function(){A._emitter.emit(C.Z.STATISTICS_INFO,t)})},t.prototype._onIOError=function(t,A){var e=this;Promise.resolve().then(function(){e._emitter.emit(C.Z.IO_ERROR,t,A)})},t.prototype._onDemuxError=function(t,A){var e=this;Promise.resolve().then(function(){e._emitter.emit(C.Z.DEMUX_ERROR,t,A)})},t.prototype._onRecommendSeekpoint=function(t){var A=this;Promise.resolve().then(function(){A._emitter.emit(C.Z.RECOMMEND_SEEKPOINT,t)})},t.prototype._onLoggingConfigChanged=function(t){this._worker&&this._worker.postMessage({cmd:"logging_config",param:t})},t.prototype._onWorkerMessage=function(t){var A=t.data,e=A.data;if("destroyed"===A.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(A.msg){case C.Z.INIT_SEGMENT:case C.Z.MEDIA_SEGMENT:this._emitter.emit(A.msg,e.type,e.data);break;case C.Z.LOADING_COMPLETE:case C.Z.RECOVERED_EARLY_EOF:this._emitter.emit(A.msg);break;case C.Z.MEDIA_INFO:Object.setPrototypeOf(e,T.Z.prototype),this._emitter.emit(A.msg,e);break;case C.Z.METADATA_ARRIVED:case C.Z.SCRIPTDATA_ARRIVED:case C.Z.STATISTICS_INFO:this._emitter.emit(A.msg,e);break;case C.Z.IO_ERROR:case C.Z.DEMUX_ERROR:this._emitter.emit(A.msg,e.type,e.info);break;case C.Z.RECOMMEND_SEEKPOINT:this._emitter.emit(A.msg,e);break;case"logcat_callback":I.Z.emitter.emit("log",e.type,e.logcat)}},t}(),D="error",y="source_open",B="update_end",f="buffer_full",Q=e(449),w=e(289),m=function(){function t(t){this.TAG="MSEController",this._config=t,this._emitter=new(M()),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 Q.Vn}return t.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},t.prototype.on=function(t,A){this._emitter.addListener(t,A)},t.prototype.off=function(t,A){this._emitter.removeListener(t,A)},t.prototype.attachMediaElement=function(t){if(this._mediaSource)throw new w.rT("MediaSource has been attached to an HTMLMediaElement!");var A=this._mediaSource=new window.MediaSource;A.addEventListener("sourceopen",this.e.onSourceOpen),A.addEventListener("sourceended",this.e.onSourceEnded),A.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=t,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),t.src=this._mediaSourceObjectURL},t.prototype.detachMediaElement=function(){if(this._mediaSource){var t=this._mediaSource;for(var A in this._sourceBuffers){var e=this._pendingSegments[A];e.splice(0,e.length),this._pendingSegments[A]=null,this._pendingRemoveRanges[A]=null,this._lastInitSegments[A]=null;var i=this._sourceBuffers[A];if(i){if("closed"!==t.readyState){try{t.removeSourceBuffer(i)}catch(t){I.Z.e(this.TAG,t.message)}i.removeEventListener("error",this.e.onSourceBufferError),i.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[A]=null,this._sourceBuffers[A]=null}}if("open"===t.readyState)try{t.endOfStream()}catch(t){I.Z.e(this.TAG,t.message)}t.removeEventListener("sourceopen",this.e.onSourceOpen),t.removeEventListener("sourceended",this.e.onSourceEnded),t.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)},t.prototype.appendInitSegment=function(t,A){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(t),void this._pendingSegments[t.type].push(t);var e=t,i="".concat(e.container);e.codec&&e.codec.length>0&&(i+=";codecs=".concat(e.codec));var n=!1;if(I.Z.v(this.TAG,"Received Initialization Segment, mimeType: "+i),this._lastInitSegments[e.type]=e,i!==this._mimeTypes[e.type]){if(this._mimeTypes[e.type])I.Z.v(this.TAG,"Notice: ".concat(e.type," mimeType changed, origin: ").concat(this._mimeTypes[e.type],", target: ").concat(i));else{n=!0;try{var r=this._sourceBuffers[e.type]=this._mediaSource.addSourceBuffer(i);r.addEventListener("error",this.e.onSourceBufferError),r.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(t){return I.Z.e(this.TAG,t.message),void this._emitter.emit(D,{code:t.code,msg:t.message})}}this._mimeTypes[e.type]=i}A||this._pendingSegments[e.type].push(e),n||this._sourceBuffers[e.type]&&!this._sourceBuffers[e.type].updating&&this._doAppendSegments(),c.Z.safari&&"audio/mpeg"===e.container&&e.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=e.mediaDuration/1e3,this._updateMediaSourceDuration())},t.prototype.appendMediaSegment=function(t){var A=t;this._pendingSegments[A.type].push(A),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var e=this._sourceBuffers[A.type];!e||e.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},t.prototype.seek=function(t){for(var A in this._sourceBuffers)if(this._sourceBuffers[A]){var e=this._sourceBuffers[A];if("open"===this._mediaSource.readyState)try{e.abort()}catch(t){I.Z.e(this.TAG,t.message)}this._idrList.clear();var i=this._pendingSegments[A];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var n=0;n=1&&t-i.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},t.prototype._doCleanupSourceBuffer=function(){var t=this._mediaElement.currentTime;for(var A in this._sourceBuffers){var e=this._sourceBuffers[A];if(e){for(var i=e.buffered,n=!1,r=0;r=this._config.autoCleanupMaxBackwardDuration){n=!0;var s=t-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[A].push({start:o,end:s})}}else a0&&(isNaN(A)||e>A)&&(I.Z.v(this.TAG,"Update MediaSource duration from ".concat(A," to ").concat(e)),this._mediaSource.duration=e),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},t.prototype._doRemoveRanges=function(){for(var t in this._pendingRemoveRanges)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating)for(var A=this._sourceBuffers[t],e=this._pendingRemoveRanges[t];e.length&&!A.updating;){var i=e.shift();A.remove(i.start,i.end)}},t.prototype._doAppendSegments=function(){var t=this._pendingSegments;for(var A in t)if(this._sourceBuffers[A]&&!this._sourceBuffers[A].updating&&t[A].length>0){var e=t[A].shift();if(e.timestampOffset){var i=this._sourceBuffers[A].timestampOffset,n=e.timestampOffset/1e3;Math.abs(i-n)>.1&&(I.Z.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(i," to ").concat(n)),this._sourceBuffers[A].timestampOffset=n),delete e.timestampOffset}if(!e.data||0===e.data.byteLength)continue;try{this._sourceBuffers[A].appendBuffer(e.data),this._isBufferFull=!1,"video"===A&&e.hasOwnProperty("info")&&this._idrList.appendArray(e.info.syncPoints)}catch(t){this._pendingSegments[A].unshift(e),22===t.code?(this._isBufferFull||this._emitter.emit(f),this._isBufferFull=!0):(I.Z.e(this.TAG,t.message),this._emitter.emit(D,{code:t.code,msg:t.message}))}}},t.prototype._onSourceOpen=function(){if(I.Z.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var t=this._pendingSourceBufferInit;t.length;){var A=t.shift();this.appendInitSegment(A,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(y)},t.prototype._onSourceEnded=function(){I.Z.v(this.TAG,"MediaSource onSourceEnded")},t.prototype._onSourceClose=function(){I.Z.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))},t.prototype._hasPendingSegments=function(){var t=this._pendingSegments;return t.video.length>0||t.audio.length>0},t.prototype._hasPendingRemoveRanges=function(){var t=this._pendingRemoveRanges;return t.video.length>0||t.audio.length>0},t.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(B)},t.prototype._onSourceBufferError=function(t){I.Z.e(this.TAG,"SourceBuffer Error: ".concat(t))},t}(),p=e(363),S={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},L={NETWORK_EXCEPTION:s.nm.EXCEPTION,NETWORK_STATUS_CODE_INVALID:s.nm.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:s.nm.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:s.nm.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:p.Z.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:p.Z.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:p.Z.CODEC_UNSUPPORTED},j=function(){function t(t,A){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(M()),this._config=i(),"object"==typeof A&&Object.assign(this._config,A),"flv"!==t.type.toLowerCase())throw new w.OC("FlvPlayer requires an flv MediaDataSource input!");!0===t.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=t,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 e=c.Z.chrome&&(c.Z.version.major<50||50===c.Z.version.major&&c.Z.version.build<2661);this._alwaysSeekKeyframe=!!(e||c.Z.msedge||c.Z.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return t.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},t.prototype.on=function(t,A){var e=this;t===u.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then(function(){e._emitter.emit(u.MEDIA_INFO,e.mediaInfo)}):t===u.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then(function(){e._emitter.emit(u.STATISTICS_INFO,e.statisticsInfo)}),this._emitter.addListener(t,A)},t.prototype.off=function(t,A){this._emitter.removeListener(t,A)},t.prototype.attachMediaElement=function(t){var A=this;if(this._mediaElement=t,t.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),t.addEventListener("seeking",this.e.onvSeeking),t.addEventListener("canplay",this.e.onvCanPlay),t.addEventListener("stalled",this.e.onvStalled),t.addEventListener("progress",this.e.onvProgress),this._msectl=new m(this._config),this._msectl.on(B,this._onmseUpdateEnd.bind(this)),this._msectl.on(f,this._onmseBufferFull.bind(this)),this._msectl.on(y,function(){A._mseSourceOpened=!0,A._hasPendingLoad&&(A._hasPendingLoad=!1,A.load())}),this._msectl.on(D,function(t){A._emitter.emit(u.ERROR,S.MEDIA_ERROR,L.MEDIA_MSE_ERROR,t)}),this._msectl.attachMediaElement(t),null!=this._pendingSeekTime)try{t.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(t){}},t.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)},t.prototype.load=function(){var t=this;if(!this._mediaElement)throw new w.rT("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new w.rT("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 N(this._mediaDataSource,this._config),this._transmuxer.on(C.Z.INIT_SEGMENT,function(A,e){t._msectl.appendInitSegment(e)}),this._transmuxer.on(C.Z.MEDIA_SEGMENT,function(A,e){if(t._msectl.appendMediaSegment(e),t._config.lazyLoad&&!t._config.isLive){var i=t._mediaElement.currentTime;e.info.endDts>=1e3*(i+t._config.lazyLoadMaxDuration)&&null==t._progressChecker&&(I.Z.v(t.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),t._suspendTransmuxer())}}),this._transmuxer.on(C.Z.LOADING_COMPLETE,function(){t._msectl.endOfStream(),t._emitter.emit(u.LOADING_COMPLETE)}),this._transmuxer.on(C.Z.RECOVERED_EARLY_EOF,function(){t._emitter.emit(u.RECOVERED_EARLY_EOF)}),this._transmuxer.on(C.Z.IO_ERROR,function(A,e){t._emitter.emit(u.ERROR,S.NETWORK_ERROR,A,e)}),this._transmuxer.on(C.Z.DEMUX_ERROR,function(A,e){t._emitter.emit(u.ERROR,S.MEDIA_ERROR,A,{code:-1,msg:e})}),this._transmuxer.on(C.Z.MEDIA_INFO,function(A){t._mediaInfo=A,t._emitter.emit(u.MEDIA_INFO,Object.assign({},A))}),this._transmuxer.on(C.Z.METADATA_ARRIVED,function(A){t._emitter.emit(u.METADATA_ARRIVED,A)}),this._transmuxer.on(C.Z.SCRIPTDATA_ARRIVED,function(A){t._emitter.emit(u.SCRIPTDATA_ARRIVED,A)}),this._transmuxer.on(C.Z.STATISTICS_INFO,function(A){t._statisticsInfo=t._fillStatisticsInfo(A),t._emitter.emit(u.STATISTICS_INFO,Object.assign({},t._statisticsInfo))}),this._transmuxer.on(C.Z.RECOMMEND_SEEKPOINT,function(A){t._mediaElement&&!t._config.accurateSeek&&(t._requestSetTime=!0,t._mediaElement.currentTime=A/1e3)}),this._transmuxer.open()))},t.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)},t.prototype.play=function(){return this._mediaElement.play()},t.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(t){this._mediaElement.volume=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(t){this._mediaElement.muted=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(t){this._mediaElement?this._internalSeek(t):this._pendingSeekTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),t.prototype._fillStatisticsInfo=function(t){if(t.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return t;var A=!0,e=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();e=n.totalVideoFrames,i=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(e=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):A=!1;return A&&(t.decodedFrames=e,t.droppedFrames=i),t},t.prototype._onmseUpdateEnd=function(){if(this._config.lazyLoad&&!this._config.isLive){for(var t=this._mediaElement.buffered,A=this._mediaElement.currentTime,e=0,i=0;i=A+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(I.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},t.prototype._onmseBufferFull=function(){I.Z.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},t.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},t.prototype._checkProgressAndResume=function(){for(var t=this._mediaElement.currentTime,A=this._mediaElement.buffered,e=!1,i=0;i=n&&t=r-this._config.lazyLoadRecoverDuration&&(e=!0);break}}e&&(window.clearInterval(this._progressChecker),this._progressChecker=null,e&&(I.Z.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},t.prototype._isTimepointBuffered=function(t){for(var A=this._mediaElement.buffered,e=0;e=i&&t0){var n=this._mediaElement.buffered.start(0);(n<1&&t0&&A.currentTime0){var i=e.start(0);if(i<1&&A0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},t.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},t.prototype.play=function(){return this._mediaElement.play()},t.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(t){this._mediaElement.volume=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(t){this._mediaElement.muted=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(t){this._mediaElement?this._mediaElement.currentTime=t:this._pendingSeekTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mediaInfo",{get:function(){var t={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(t.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(t.width=this._mediaElement.videoWidth,t.height=this._mediaElement.videoHeight)),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"statisticsInfo",{get:function(){var t={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return t;var A=!0,e=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();e=n.totalVideoFrames,i=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(e=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):A=!1;return A&&(t.decodedFrames=e,t.droppedFrames=i),t},enumerable:!1,configurable:!0}),t.prototype._onvLoadedMetadata=function(t){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(u.MEDIA_INFO,this.mediaInfo)},t.prototype._reportStatisticsInfo=function(){this._emitter.emit(u.STATISTICS_INFO,this.statisticsInfo)},t}();n.Z.install();var Y={createPlayer:function(t,A){var e=t;if(null==e||"object"!=typeof e)throw new w.OC("MediaDataSource must be an javascript object!");if(!e.hasOwnProperty("type"))throw new w.OC("MediaDataSource must has type field to indicate video file type!");return"flv"===e.type?new j(e,A):new x(e,A)},isSupported:function(){return a.supportMSEH264Playback()},getFeatureList:function(){return a.getFeatureList()}};Y.BaseLoader=s.fp,Y.LoaderStatus=s.GM,Y.LoaderErrors=s.nm,Y.Events=u,Y.ErrorTypes=S,Y.ErrorDetails=L,Y.FlvPlayer=j,Y.NativePlayer=x,Y.LoggingControl=l.Z,Object.defineProperty(Y,"version",{enumerable:!0,get:function(){return"1.6.2"}});var U=Y},392:function(t,A,e){t.exports=e(593).default},70:function(t,A,e){"use strict";e.d(A,{Z:function(){return T}});var i,n=e(324),r=function(){function t(){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 t.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},t.prototype.addBytes=function(t){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=t,this._totalBytes+=t):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=t,this._totalBytes+=t):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=t,this._totalBytes+=t,this._lastCheckpoint=this._now())},Object.defineProperty(t.prototype,"currentKBps",{get:function(){this.addBytes(0);var t=(this._now()-this._lastCheckpoint)/1e3;return 0==t&&(t=1),this._intervalBytes/t/1024},enumerable:!1,configurable:!0}),Object.defineProperty(t.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(t.prototype,"averageKBps",{get:function(){var t=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/t/1024},enumerable:!1,configurable:!0}),t}(),o=e(206),a=e(420),s=e(289),g=(i=function(t,A){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var e in A)Object.prototype.hasOwnProperty.call(A,e)&&(t[e]=A[e])})(t,A)},function(t,A){function e(){this.constructor=t}if("function"!=typeof A&&null!==A)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");i(t,A),t.prototype=null===A?Object.create(A):(e.prototype=A.prototype,new e)}),M=function(t){function A(A,e){var i=t.call(this,"fetch-stream-loader")||this;return i.TAG="FetchStreamLoader",i._seekHandler=A,i._config=e,i._needStash=!0,i._requestAbort=!1,i._contentLength=null,i._receivedLength=0,i}return g(A,t),A.isSupported=function(){try{var t=a.Z.msedge&&a.Z.version.minor>=15048,A=!a.Z.msedge||t;return self.fetch&&self.ReadableStream&&A}catch(t){return!1}},A.prototype.destroy=function(){this.isWorking()&&this.abort(),t.prototype.destroy.call(this)},A.prototype.open=function(t,A){var e=this;this._dataSource=t,this._range=A;var i=t.url;this._config.reuseRedirectedURL&&null!=t.redirectedURL&&(i=t.redirectedURL);var n=this._seekHandler.getConfig(i,A),r=new self.Headers;if("object"==typeof n.headers){var a=n.headers;for(var g in a)a.hasOwnProperty(g)&&r.append(g,a[g])}var M={method:"GET",headers:r,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var g in this._config.headers)r.append(g,this._config.headers[g]);!1===t.cors&&(M.mode="same-origin"),t.withCredentials&&(M.credentials="include"),t.referrerPolicy&&(M.referrerPolicy=t.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,M.signal=this._abortController.signal),this._status=o.GM.kConnecting,self.fetch(n.url,M).then(function(t){if(e._requestAbort)return e._status=o.GM.kIdle,void t.body.cancel();if(t.ok&&t.status>=200&&t.status<=299){if(t.url!==n.url&&e._onURLRedirect){var A=e._seekHandler.removeURLParameters(t.url);e._onURLRedirect(A)}var i=t.headers.get("Content-Length");return null!=i&&(e._contentLength=parseInt(i),0!==e._contentLength&&e._onContentLengthKnown&&e._onContentLengthKnown(e._contentLength)),e._pump.call(e,t.body.getReader())}if(e._status=o.GM.kError,!e._onError)throw new s.OZ("FetchStreamLoader: Http code invalid, "+t.status+" "+t.statusText);e._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}).catch(function(t){if(!e._abortController||!e._abortController.signal.aborted){if(e._status=o.GM.kError,!e._onError)throw t;e._onError(o.nm.EXCEPTION,{code:-1,msg:t.message})}})},A.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.GM.kBuffering||!a.Z.chrome)&&this._abortController)try{this._abortController.abort()}catch(t){}},A.prototype._pump=function(t){var A=this;return t.read().then(function(e){if(e.done)if(null!==A._contentLength&&A._receivedLength299)){if(this._status=o.GM.kError,!this._onError)throw new s.OZ("MozChunkedLoader: Http code invalid, "+A.status+" "+A.statusText);this._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:A.status,msg:A.statusText})}else this._status=o.GM.kBuffering}},A.prototype._onProgress=function(t){if(this._status!==o.GM.kError){null===this._contentLength&&null!==t.total&&0!==t.total&&(this._contentLength=t.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var A=t.target.response,e=this._range.from+this._receivedLength;this._receivedLength+=A.byteLength,this._onDataArrival&&this._onDataArrival(A,e,this._receivedLength)}},A.prototype._onLoadEnd=function(t){!0!==this._requestAbort?this._status!==o.GM.kError&&(this._status=o.GM.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},A.prototype._onXhrError=function(t){this._status=o.GM.kError;var A=0,e=null;if(this._contentLength&&t.loaded=this._contentLength&&(e=this._range.from+this._contentLength-1),this._currentRequestRange={from:A,to:e},this._internalOpen(this._dataSource,this._currentRequestRange)},A.prototype._internalOpen=function(t,A){this._lastTimeLoaded=0;var e=t.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?e=this._currentRedirectedURL:null!=t.redirectedURL&&(e=t.redirectedURL));var i=this._seekHandler.getConfig(e,A);this._currentRequestURL=i.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",i.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),t.withCredentials&&(n.withCredentials=!0),"object"==typeof i.headers){var r=i.headers;for(var o in r)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o])}if("object"==typeof this._config.headers)for(var o in r=this._config.headers)r.hasOwnProperty(o)&&n.setRequestHeader(o,r[o]);n.send()},A.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.GM.kComplete},A.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)},A.prototype._onReadyStateChange=function(t){var A=t.target;if(2===A.readyState){if(null!=A.responseURL){var e=this._seekHandler.removeURLParameters(A.responseURL);A.responseURL!==this._currentRequestURL&&e!==this._currentRedirectedURL&&(this._currentRedirectedURL=e,this._onURLRedirect&&this._onURLRedirect(e))}if(A.status>=200&&A.status<=299){if(this._waitForTotalLength)return;this._status=o.GM.kBuffering}else{if(this._status=o.GM.kError,!this._onError)throw new s.OZ("RangeLoader: Http code invalid, "+A.status+" "+A.statusText);this._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:A.status,msg:A.statusText})}}},A.prototype._onProgress=function(t){if(this._status!==o.GM.kError){if(null===this._contentLength){var A=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,A=!0;var e=t.total;this._internalAbort(),null!=e&0!==e&&(this._totalLength=e)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,A)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var i=t.loaded-this._lastTimeLoaded;this._lastTimeLoaded=t.loaded,this._speedSampler.addBytes(i)}},A.prototype._normalizeSpeed=function(t){var A=this._chunkSizeKBList,e=A.length-1,i=0,n=0,r=e;if(t=A[i]&&t=3&&(A=this._speedSampler.currentKBps),0!==A){var e=this._normalizeSpeed(A);this._currentSpeedNormalized!==e&&(this._currentSpeedNormalized=e,this._currentChunkSizeKB=e)}var i=t.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=i.byteLength;var r=!1;null!=this._contentLength&&this._receivedLength0&&this._receivedLength0)for(var r=e.split("&"),o=0;o0;a[0]!==this._startName&&a[0]!==this._endName&&(s&&(n+="&"),n+=r[o])}return 0===n.length?A:A+"?"+n},t}(),T=function(){function t(t,A,e){this.TAG="IOController",this._config=A,this._extraData=e,this._stashInitialSize=393216,null!=A.stashInitialSize&&A.stashInitialSize>0&&(this._stashInitialSize=A.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===A.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=t,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(t.url),this._refTotalLength=t.filesize?t.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r,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 t.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},t.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},t.prototype.isPaused=function(){return this._paused},Object.defineProperty(t.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extraData",{get:function(){return this._extraData},set:function(t){this._extraData=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(t){this._onDataArrival=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(t){this._onSeeked=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onError",{get:function(){return this._onError},set:function(t){this._onError=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onComplete",{get:function(){return this._onComplete},set:function(t){this._onComplete=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(t){this._onRedirect=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(t){this._onRecoveredEarlyEof=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._loaderClass===E?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),t.prototype._selectSeekHandler=function(){var t=this._config;if("range"===t.seekType)this._seekHandler=new d(this._config.rangeLoadZeroStart);else if("param"===t.seekType){var A=t.seekParamStart||"bstart",e=t.seekParamEnd||"bend";this._seekHandler=new C(A,e)}else{if("custom"!==t.seekType)throw new s.OC("Invalid seekType in config: ".concat(t.seekType));if("function"!=typeof t.customSeekHandler)throw new s.OC("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new t.customSeekHandler}},t.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=l;else if(M.isSupported())this._loaderClass=M;else if(c.isSupported())this._loaderClass=c;else{if(!E.isSupported())throw new s.OZ("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=E}},t.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)},t.prototype.open=function(t){this._currentRange={from:0,to:-1},t&&(this._currentRange.from=t),this._speedSampler.reset(),t||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},t.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},t.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)},t.prototype.resume=function(){if(this._paused){this._paused=!1;var t=this._resumeFrom;this._resumeFrom=0,this._internalSeek(t,!0)}},t.prototype.seek=function(t){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(t,!0)},t.prototype._internalSeek=function(t,A){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(A),this._loader.destroy(),this._loader=null;var e={from:t,to:-1};this._currentRange={from:e.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,e),this._onSeeked&&this._onSeeked()},t.prototype.updateUrl=function(t){if(!t||"string"!=typeof t||0===t.length)throw new s.OC("Url must be a non-empty string!");this._dataSource.url=t},t.prototype._expandBuffer=function(t){for(var A=this._stashSize;A+10485760){var i=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(e,0,A).set(i,0)}this._stashBuffer=e,this._bufferSize=A}},t.prototype._normalizeSpeed=function(t){var A=this._speedNormalizeList,e=A.length-1,i=0,n=0,r=e;if(t=A[i]&&t=512&&t<=1024?Math.floor(1.5*t):2*t)>8192&&(A=8192);var e=1024*A+1048576;this._bufferSize0){var r=this._stashBuffer.slice(0,this._stashUsed);(g=this._dispatchChunks(r,this._stashByteStart))0&&(M=new Uint8Array(r,g),a.set(M,0),this._stashUsed=M.byteLength,this._stashByteStart+=g):(this._stashUsed=0,this._stashByteStart+=g),this._stashUsed+t.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+t.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(t),this._stashUsed),this._stashUsed+=t.byteLength}else(g=this._dispatchChunks(t,A))this._bufferSize&&(this._expandBuffer(o),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(t,g),0),this._stashUsed+=o,this._stashByteStart=A+g);else if(0===this._stashUsed){var o;(g=this._dispatchChunks(t,A))this._bufferSize&&this._expandBuffer(o),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(t,g),0),this._stashUsed+=o,this._stashByteStart=A+g)}else{var a,g;if(this._stashUsed+t.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+t.byteLength),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(t),this._stashUsed),this._stashUsed+=t.byteLength,(g=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))0){var M=new Uint8Array(this._stashBuffer,g);a.set(M,0)}this._stashUsed-=g,this._stashByteStart+=g}}},t.prototype._flushStashBuffer=function(t){if(this._stashUsed>0){var A=this._stashBuffer.slice(0,this._stashUsed),e=this._dispatchChunks(A,this._stashByteStart),i=A.byteLength-e;if(e0){var r=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(A,e);r.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=e}return 0}n.Z.w(this.TAG,"".concat(i," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,i}return 0},t.prototype._onLoaderComplete=function(t,A){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},t.prototype._onLoaderError=function(t,A){switch(n.Z.e(this.TAG,"Loader error, code = ".concat(A.code,", msg = ").concat(A.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,t=o.nm.UNRECOVERABLE_EARLY_EOF),t){case o.nm.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var e=this._currentRange.to+1;return void(e=0&&/(rv)(?::| )([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(t)||[],i=/(ipad)/.exec(t)||/(ipod)/.exec(t)||/(windows phone)/.exec(t)||/(iphone)/.exec(t)||/(kindle)/.exec(t)||/(android)/.exec(t)||/(windows)/.exec(t)||/(mac)/.exec(t)||/(linux)/.exec(t)||/(cros)/.exec(t)||[],n={browser:A[5]||A[3]||A[1]||"",version:A[2]||A[4]||"0",majorVersion:A[4]||A[2]||"0",platform:i[0]||""},r={};if(n.browser){r[n.browser]=!0;var o=n.majorVersion.split(".");r.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(r.version.minor=parseInt(o[1],10)),o.length>2&&(r.version.build=parseInt(o[2],10))}for(var a in n.platform&&(r[n.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),(r.rv||r.iemobile)&&(r.rv&&delete r.rv,n.browser="msie",r.msie=!0),r.edge&&(delete r.edge,n.browser="msedge",r.msedge=!0),r.opr&&(n.browser="opera",r.opera=!0),r.safari&&r.android&&(n.browser="android",r.android=!0),r.name=n.browser,r.platform=n.platform,e)e.hasOwnProperty(a)&&delete e[a];Object.assign(e,r)}(),A.Z=e},289:function(t,A,e){"use strict";e.d(A,{OZ:function(){return r},rT:function(){return o},OC:function(){return a},do:function(){return s}});var i,n=(i=function(t,A){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var e in A)Object.prototype.hasOwnProperty.call(A,e)&&(t[e]=A[e])})(t,A)},function(t,A){function e(){this.constructor=t}if("function"!=typeof A&&null!==A)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");i(t,A),t.prototype=null===A?Object.create(A):(e.prototype=A.prototype,new e)}),r=function(){function t(t){this._message=t}return Object.defineProperty(t.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.name+": "+this.message},t}(),o=function(t){function A(A){return t.call(this,A)||this}return n(A,t),Object.defineProperty(A.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),A}(r),a=function(t){function A(A){return t.call(this,A)||this}return n(A,t),Object.defineProperty(A.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),A}(r),s=function(t){function A(A){return t.call(this,A)||this}return n(A,t),Object.defineProperty(A.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),A}(r)},324:function(t,A,e){"use strict";var i=e(523),n=e.n(i),r=function(){function t(){}return t.e=function(A,e){A&&!t.FORCE_GLOBAL_TAG||(A=t.GLOBAL_TAG);var i="[".concat(A,"] > ").concat(e);t.ENABLE_CALLBACK&&t.emitter.emit("log","error",i),t.ENABLE_ERROR&&(console.error||(console.warn?console.warn(i):console.log(i)))},t.i=function(A,e){A&&!t.FORCE_GLOBAL_TAG||(A=t.GLOBAL_TAG);var i="[".concat(A,"] > ").concat(e);t.ENABLE_CALLBACK&&t.emitter.emit("log","info",i),t.ENABLE_INFO&&(console.info?console.info(i):console.log(i))},t.w=function(A,e){A&&!t.FORCE_GLOBAL_TAG||(A=t.GLOBAL_TAG);var i="[".concat(A,"] > ").concat(e);t.ENABLE_CALLBACK&&t.emitter.emit("log","warn",i),t.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))},t.d=function(A,e){A&&!t.FORCE_GLOBAL_TAG||(A=t.GLOBAL_TAG);var i="[".concat(A,"] > ").concat(e);t.ENABLE_CALLBACK&&t.emitter.emit("log","debug",i),t.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))},t.v=function(A,e){A&&!t.FORCE_GLOBAL_TAG||(A=t.GLOBAL_TAG);var i="[".concat(A,"] > ").concat(e);t.ENABLE_CALLBACK&&t.emitter.emit("log","verbose",i),t.ENABLE_VERBOSE&&console.log(i)},t}();r.GLOBAL_TAG="flv.js",r.FORCE_GLOBAL_TAG=!1,r.ENABLE_ERROR=!0,r.ENABLE_INFO=!0,r.ENABLE_WARN=!0,r.ENABLE_DEBUG=!0,r.ENABLE_VERBOSE=!0,r.ENABLE_CALLBACK=!1,r.emitter=new(n()),A.Z=r},879:function(t,A,e){"use strict";var i=e(523),n=e.n(i),r=e(324),o=function(){function t(){}return Object.defineProperty(t,"forceGlobalTag",{get:function(){return r.Z.FORCE_GLOBAL_TAG},set:function(A){r.Z.FORCE_GLOBAL_TAG=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"globalTag",{get:function(){return r.Z.GLOBAL_TAG},set:function(A){r.Z.GLOBAL_TAG=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableAll",{get:function(){return r.Z.ENABLE_VERBOSE&&r.Z.ENABLE_DEBUG&&r.Z.ENABLE_INFO&&r.Z.ENABLE_WARN&&r.Z.ENABLE_ERROR},set:function(A){r.Z.ENABLE_VERBOSE=A,r.Z.ENABLE_DEBUG=A,r.Z.ENABLE_INFO=A,r.Z.ENABLE_WARN=A,r.Z.ENABLE_ERROR=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableDebug",{get:function(){return r.Z.ENABLE_DEBUG},set:function(A){r.Z.ENABLE_DEBUG=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableVerbose",{get:function(){return r.Z.ENABLE_VERBOSE},set:function(A){r.Z.ENABLE_VERBOSE=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableInfo",{get:function(){return r.Z.ENABLE_INFO},set:function(A){r.Z.ENABLE_INFO=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableWarn",{get:function(){return r.Z.ENABLE_WARN},set:function(A){r.Z.ENABLE_WARN=A,t._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enableError",{get:function(){return r.Z.ENABLE_ERROR},set:function(A){r.Z.ENABLE_ERROR=A,t._notifyChange()},enumerable:!1,configurable:!0}),t.getConfig=function(){return{globalTag:r.Z.GLOBAL_TAG,forceGlobalTag:r.Z.FORCE_GLOBAL_TAG,enableVerbose:r.Z.ENABLE_VERBOSE,enableDebug:r.Z.ENABLE_DEBUG,enableInfo:r.Z.ENABLE_INFO,enableWarn:r.Z.ENABLE_WARN,enableError:r.Z.ENABLE_ERROR,enableCallback:r.Z.ENABLE_CALLBACK}},t.applyConfig=function(t){r.Z.GLOBAL_TAG=t.globalTag,r.Z.FORCE_GLOBAL_TAG=t.forceGlobalTag,r.Z.ENABLE_VERBOSE=t.enableVerbose,r.Z.ENABLE_DEBUG=t.enableDebug,r.Z.ENABLE_INFO=t.enableInfo,r.Z.ENABLE_WARN=t.enableWarn,r.Z.ENABLE_ERROR=t.enableError,r.Z.ENABLE_CALLBACK=t.enableCallback},t._notifyChange=function(){var A=t.emitter;if(A.listenerCount("change")>0){var e=t.getConfig();A.emit("change",e)}},t.registerListener=function(A){t.emitter.addListener("change",A)},t.removeListener=function(A){t.emitter.removeListener("change",A)},t.addLogListener=function(A){r.Z.emitter.addListener("log",A),r.Z.emitter.listenerCount("log")>0&&(r.Z.ENABLE_CALLBACK=!0,t._notifyChange())},t.removeLogListener=function(A){r.Z.emitter.removeListener("log",A),0===r.Z.emitter.listenerCount("log")&&(r.Z.ENABLE_CALLBACK=!1,t._notifyChange())},t}();o.emitter=new(n()),A.Z=o},195:function(t,A,e){"use strict";var i=function(){function t(){}return t.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(t,A){return t.__proto__=A,t},Object.assign=Object.assign||function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(t),e=1;ee.start(0)?A:e.start(0))=0?t:1/0},A.prototype.load=function(){this.el_.vjs_load()},A.prototype.poster=function(){this.el_.vjs_getProperty("poster")},A.prototype.setPoster=function(){},A.prototype.seekable=function(){var t=this.duration();return 0===t?g():g(0,t)},A.prototype.buffered=function(){var t=this.el_.vjs_getProperty("buffered");return 0===t.length?g():g(t[0][0],t[0][1])},A.prototype.supportsFullScreen=function(){return!1},A.prototype.enterFullScreen=function(){return!1},A.prototype.getVideoPlaybackQuality=function(){var t=this.el_.vjs_getProperty("getVideoPlaybackQuality");return i.performance&&"function"==typeof i.performance.now?t.creationTime=i.performance.now():i.performance&&i.performance.timing&&"number"==typeof i.performance.timing.navigationStart&&(t.creationTime=i.Date.now()-i.performance.timing.navigationStart),t},A}(o),u=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","stretch","fluent","loop","controls","volume","muted","defaultMuted"],E=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],h=c.prototype,l=0;l=10},o.withSourceHandlers(c),c.nativeSourceHandler={},c.nativeSourceHandler.canPlayType=function(t){return t in c.formats?"maybe":""},c.nativeSourceHandler.canHandleSource=function(t,A){var e;return e=t.type?t.type.replace(/;.*/,"").toLowerCase():function(t){var A=s.getFileExtension(t);return A?"video/"+A:""}(t.src),c.nativeSourceHandler.canPlayType(e)},c.nativeSourceHandler.handleSource=function(t,A,e){A.setSrc(t.src)},c.nativeSourceHandler.dispose=function(){},c.registerSourceHandler(c.nativeSourceHandler),c.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},c.onReady=function(t){var A=a.$("#"+t),e=A&&A.tech;e&&e.el()&&c.checkReady(e)},c.checkReady=function(t){t.el()&&(t.el().vjs_getProperty?t.triggerReady():this.setTimeout(function(){c.checkReady(t)},50))},c.onEvent=function(t,A){var e=a.$("#"+t).tech,i=Array.prototype.slice.call(arguments,2);e.setTimeout(function(){e.trigger(A,i)},1)},c.onError=function(t,A){var e=a.$("#"+t).tech;if("srcnotfound"===A)return e.error(4);"string"==typeof A?e.error("FLASH: "+A):(A.origin="flash",e.error(A))},c.version=function(){var t="0,0,0";try{t=new i.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(A){try{I.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(t=(I.plugins["Shockwave Flash 2.0"]||I.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(t){}}return t.split(",")},c.embed=function(t,A,e,i){var n=c.getEmbedCode(t,A,e,i);return a.createEl("div",{innerHTML:n}).childNodes[0]},c.getEmbedCode=function(t,A,e,i){var n="",r="",o="";return A&&Object.getOwnPropertyNames(A).forEach(function(t){n+=t+"="+A[t]+"&"}),e=M({movie:t,flashvars:n,allowScriptAccess:"always",allowNetworking:"all"},e),Object.getOwnPropertyNames(e).forEach(function(t){r+=''}),i=M({data:t,width:"100%",height:"100%"},i),Object.getOwnPropertyNames(i).forEach(function(t){o+=t+'="'+i[t]+'" '}),'"},function(t){t.streamingFormats={"rtmp/mp4":"MP4","rtmp/flv":"FLV"},t.streamFromParts=function(t,A){return t+"&"+A},t.streamToParts=function(t){var A={connection:"",stream:""};if(!t)return A;var e=t.search(/&(?![\w-]+=)/),i=void 0;return-1!==e?i=e+1:0===(e=i=t.lastIndexOf("/")+1)&&(e=i=t.length),A.connection=t.substring(0,e),A.stream=t.substring(i,t.length),A},t.isStreamingType=function(A){return A in t.streamingFormats},t.RTMP_RE=/^rtmp[set]?:\/\//i,t.isStreamingSrc=function(A){return t.RTMP_RE.test(A)},t.rtmpSourceHandler={},t.rtmpSourceHandler.canPlayType=function(A){return t.isStreamingType(A)?"maybe":""},t.rtmpSourceHandler.canHandleSource=function(A,e){return t.rtmpSourceHandler.canPlayType(A.type)||(t.isStreamingSrc(A.src)?"maybe":"")},t.rtmpSourceHandler.handleSource=function(A,e,i){var n=t.streamToParts(A.src);e.setRtmpConnection(n.connection),e.setRtmpStream(n.stream)},t.registerSourceHandler(t.rtmpSourceHandler)}(c),o.getTech("Flash")?(t.log.warn("Not using videojs-flash as it appears to already be registered"),t.log.warn("videojs-flash should only be used with video.js@6 and above")):t.registerTech("Flash",c),c.VERSION="2.1.2",c}),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsContribHls=t()}}(function(){return function t(A,e,i){function n(o,a){if(!e[o]){if(!A[o]){var s="function"==typeof require&&require;if(!a&&s)return s(o,!0);if(r)return r(o,!0);var g=new Error("Cannot find module '"+o+"'");throw g.code="MODULE_NOT_FOUND",g}var M=e[o]={exports:{}};A[o][0].call(M.exports,function(t){return n(A[o][1][t]||t)},M,M.exports,t,A,e,i)}return e[o].exports}for(var r="function"==typeof require&&require,o=0;o=n.adStartTime&&A<=n.adEndTime)return n}return null};e.default={updateAdCues:function(t,A){var e=arguments.length<=2||void 0===arguments[2]?0:arguments[2];if(t.segments)for(var o=e,a=void 0,s=0;s=32&&t<126?String.fromCharCode(t):"."},o={hexDump:function(t){for(var A=Array.prototype.slice.call(t),e="",i=0;i1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var t=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var A=t.selectPlaylist(),e=t.masterPlaylistLoader_.media(),i=t.tech_.buffered(),n=i.length?i.end(i.length-1)-t.tech_.currentTime():0,r=t.bufferLowWaterLine();(!e.endList||t.duration()=r)&&t.masterPlaylistLoader_.media(A),t.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){t.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){t.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){t.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){t.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){t.tech_.trigger("hls-reset")}),this.mainSegmentLoader_.on("segmenttimemapping",function(A){t.tech_.trigger({type:"hls-segment-time-mapping",mapping:A.mapping})}),this.audioSegmentLoader_.on("ended",function(){t.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"fastQualityChange_",value:function(){var t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetLoader())}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_()&&this.load();var t=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()t.end(0)||t.start(0)>A.end(0)?this.seekable_=t:this.seekable_=I.default.createTimeRanges([[A.start(0)>t.start(0)?A.start(0):t.start(0),A.end(0)0&&(e=Math.max(e,i.end(i.length-1))),A!==e&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",n):n())}},{key:"dispose",value:function(){var t=this;this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),["AUDIO","SUBTITLES"].forEach(function(A){var e=t.mediaTypes_[A].groups;for(var i in e)e[i].forEach(function(t){t.playlistLoader&&t.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var t=this.masterPlaylistLoader_.media(),A=void 0;if(t&&"open"===this.mediaSource.readyState){if((A=m(this.masterPlaylistLoader_.master,t)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri,this.mediaSource.endOfStream("decode");this.mainSegmentLoader_.mimeType(A[0]),A[1]&&this.audioSegmentLoader_.mimeType(A[1]),this.excludeIncompatibleVariants_(t)}}},{key:"excludeIncompatibleVariants_",value:function(t){var A=this.masterPlaylistLoader_.master,e=2,i=null,n=void 0;t.attributes.CODECS&&(n=(0,C.parseCodecs)(t.attributes.CODECS),i=n.videoCodec,e=n.codecCount),A.playlists.forEach(function(t){var A={codecCount:2,videoCodec:null};if(t.attributes.CODECS){var n=t.attributes.CODECS;A=(0,C.parseCodecs)(n),window.MediaSource&&window.MediaSource.isTypeSupported&&!window.MediaSource.isTypeSupported('video/mp4; codecs="'+Q(n)+'"')&&(t.excludeUntil=1/0)}A.codecCount!==e&&(t.excludeUntil=1/0),A.videoCodec!==i&&(t.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(t){var A=0,e=this.seekable();e.length&&(A=e.start(0)),c.default.updateAdCues(t,this.cueTagsTrack_,A)}},{key:"goalBufferLength",value:function(){var t=this.tech_.currentTime(),A=d.default.GOAL_BUFFER_LENGTH,e=d.default.GOAL_BUFFER_LENGTH_RATE,i=Math.max(A,d.default.MAX_GOAL_BUFFER_LENGTH);return Math.min(A+t*e,i)}},{key:"bufferLowWaterLine",value:function(){var t=this.tech_.currentTime(),A=d.default.BUFFER_LOW_WATER_LINE,e=d.default.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(A,d.default.MAX_BUFFER_LOW_WATER_LINE);return Math.min(A+t*e,i)}}]),A}();e.MasterPlaylistController=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ad-cue-tags":1,"./config":3,"./decrypter-worker":4,"./media-groups":6,"./playlist-loader":9,"./playlist.js":11,"./ranges":12,"./segment-loader":16,"./sync-controller":18,"./util/codecs.js":19,"./vtt-segment-loader":20,"videojs-contrib-media-sources/es5/codec-utils":65,webwackify:76}],6:[function(t,A,e){(function(A){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i("undefined"!=typeof window?window.videojs:void 0!==A?A.videojs:null),r=i(t("./playlist-loader")),o=function(){},a=function(t){var A=t.default?"main":"alternative";return t.characteristics&&t.characteristics.indexOf("public.accessibility.describes-video")>=0&&(A="main-desc"),A},s=function(t,A){t.abort(),t.pause(),A&&A.activePlaylistLoader&&(A.activePlaylistLoader.pause(),A.activePlaylistLoader=null)};e.stopLoaders=s;var g=function(t,A){A.activePlaylistLoader=t,t.load()};e.startLoaders=g;var M=function(t,A){return function(){var e=A.segmentLoaders,i=e[t],n=e.main,r=A.mediaTypes[t],o=r.activeTrack(),a=r.activeGroup(o),M=r.activePlaylistLoader;if(s(i,r),a){if(!a.playlistLoader)return void(M&&n.resetEverything());i.resyncLoader(),g(a.playlistLoader,r)}}};e.onGroupChanged=M;var I=function(t,A){return function(){var e=A.segmentLoaders,i=e[t],n=e.main,r=A.mediaTypes[t],o=r.activeTrack(),a=r.activeGroup(o),M=r.activePlaylistLoader;if(s(i,r),a){if(!a.playlistLoader)return void n.resetEverything();if(M===a.playlistLoader)return void g(a.playlistLoader,r);i.track&&i.track(o),i.resetEverything(),g(a.playlistLoader,r)}}};e.onTrackChanged=I;var c={AUDIO:function(t,A){return function(){var e=A.segmentLoaders[t],i=A.mediaTypes[t],r=A.blacklistCurrentPlaylist;s(e,i);var o=i.activeTrack(),a=i.activeGroup(),g=(a.filter(function(t){return t.default})[0]||a[0]).id,M=i.tracks[g];if(o!==M){for(var I in n.default.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[I].enabled=i.tracks[I]===M;i.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(t,A){return function(){var e=A.segmentLoaders[t],i=A.mediaTypes[t];n.default.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),s(e,i);var r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}}};e.onError=c;var u={AUDIO:function(t,A,e){if(A){var i=e.tech,n=e.requestOptions,r=e.segmentLoaders[t];A.on("loadedmetadata",function(){var t=A.media();r.playlist(t,n),(!i.paused()||t.endList&&"none"!==i.preload())&&r.load()}),A.on("loadedplaylist",function(){r.playlist(A.media(),n),i.paused()||r.load()}),A.on("error",c[t](t,e))}},SUBTITLES:function(t,A,e){var i=e.tech,n=e.requestOptions,r=e.segmentLoaders[t],o=e.mediaTypes[t];A.on("loadedmetadata",function(){var t=A.media();r.playlist(t,n),r.track(o.activeTrack()),(!i.paused()||t.endList&&"none"!==i.preload())&&r.load()}),A.on("loadedplaylist",function(){r.playlist(A.media(),n),i.paused()||r.load()}),A.on("error",c[t](t,e))}};e.setupListeners=u;var E={AUDIO:function(t,A){var e=A.mode,i=A.hls,o=A.segmentLoaders[t],s=A.requestOptions,g=A.master.mediaGroups,M=A.mediaTypes[t],I=M.groups,E=M.tracks;for(var h in g[t]&&0!==Object.keys(g[t]).length&&"html5"===e||(g[t]={main:{default:{default:!0}}}),g[t])for(var l in I[h]||(I[h]=[]),g[t][h]){var d,C=g[t][h][l];if(d=C.resolvedUri?new r.default(C.resolvedUri,i,s):null,C=n.default.mergeOptions({id:l,playlistLoader:d},C),u[t](t,C.playlistLoader,A),I[h].push(C),void 0===E[l]){var T=new n.default.AudioTrack({id:l,kind:a(C),enabled:!1,language:C.language,default:C.default,label:l});E[l]=T}}o.on("error",c[t](t,A))},SUBTITLES:function(t,A){var e=A.tech,i=A.hls,o=A.segmentLoaders[t],a=A.requestOptions,s=A.master.mediaGroups,g=A.mediaTypes[t],M=g.groups,I=g.tracks;for(var E in s[t])for(var h in M[E]||(M[E]=[]),s[t][E])if(!s[t][E][h].forced){var l=s[t][E][h];if(l=n.default.mergeOptions({id:h,playlistLoader:new r.default(l.resolvedUri,i,a)},l),u[t](t,l.playlistLoader,A),M[E].push(l),void 0===I[h]){var d=e.addRemoteTextTrack({id:h,kind:"subtitles",enabled:!1,language:l.language,label:h},!1).track;I[h]=d}}o.on("error",c[t](t,A))},"CLOSED-CAPTIONS":function(t,A){var e=A.tech,i=A.master.mediaGroups,r=A.mediaTypes[t],o=r.groups,a=r.tracks;for(var s in i[t])for(var g in o[s]||(o[s]=[]),i[t][s]){var M=i[t][s][g];if(M.instreamId.match(/CC\d/)&&(o[s].push(n.default.mergeOptions({id:g},M)),void 0===a[g])){var I=e.addRemoteTextTrack({id:M.instreamId,kind:"captions",enabled:!1,language:M.language,label:g},!1).track;a[g]=I}}}};e.initialize=E;var h=function(t,A){return function(e){var i=A.masterPlaylistLoader,n=A.mediaTypes[t].groups,r=i.media();if(!r)return null;var o=null;return r.attributes[t]&&(o=n[r.attributes[t]]),o=o||n.main,void 0===e?o:null===e?null:o.filter(function(t){return t.id===e.id})[0]||null}};e.activeGroup=h;var l={AUDIO:function(t,A){return function(){var e=A.mediaTypes[t].tracks;for(var i in e)if(e[i].enabled)return e[i];return null}},SUBTITLES:function(t,A){return function(){var e=A.mediaTypes[t].tracks;for(var i in e)if("showing"===e[i].mode)return e[i];return null}}};e.activeTrack=l;e.setupMediaGroups=function(t){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(A){E[A](A,t)});var A=t.mediaTypes,e=t.masterPlaylistLoader,i=t.tech,n=t.hls;["AUDIO","SUBTITLES"].forEach(function(e){A[e].activeGroup=h(e,t),A[e].activeTrack=l[e](e,t),A[e].onGroupChanged=M(e,t),A[e].onTrackChanged=I(e,t)});var r=A.AUDIO.activeGroup(),o=(r.filter(function(t){return t.default})[0]||r[0]).id;A.AUDIO.tracks[o].enabled=!0,A.AUDIO.onTrackChanged(),e.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(t){return A[t].onGroupChanged()})});var a=function(){A.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"hls-audio-change"})};for(var s in i.audioTracks().addEventListener("change",a),i.remoteTextTracks().addEventListener("change",A.SUBTITLES.onTrackChanged),n.on("dispose",function(){i.audioTracks().removeEventListener("change",a),i.remoteTextTracks().removeEventListener("change",A.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),A.AUDIO.tracks)i.audioTracks().addTrack(A.AUDIO.tracks[s])};e.createMediaTypes=function(){var t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(A){t[A]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:o,activeTrack:o,onGroupChanged:o,onTrackChanged:o}}),t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./playlist-loader":9}],7:[function(t,A,e){(function(A){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return t&&t.__esModule?t:{default:t}}("undefined"!=typeof window?window.videojs:void 0!==A?A.videojs:null),n=t("./bin-utils"),r={FAILURE:2,TIMEOUT:-101,ABORTED:-102};e.REQUEST_ERRORS=r;var o=function(t){var A={};return t.byterange&&(A.Range=function(t){var A;return A=t.offset+t.length-1,"bytes="+t.offset+"-"+A}(t.byterange)),A},a=function(t){t.forEach(function(t){t.abort()})},s=function(t,A){return A.timedout?{status:A.status,message:"HLS request timed-out at URL: "+A.uri,code:r.TIMEOUT,xhr:A}:A.aborted?{status:A.status,message:"HLS request aborted at URL: "+A.uri,code:r.ABORTED,xhr:A}:t?{status:A.status,message:"HLS request errored at URL: "+A.uri,code:r.FAILURE,xhr:A}:null},g=function(t,A){return function(e,i){var n=i.response,o=s(e,i);if(o)return A(o,t);if(16!==n.byteLength)return A({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:r.FAILURE,xhr:i},t);var a=new DataView(n);return t.key.bytes=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),A(null,t)}},M=function(t,A){return function(e,i){var n=i.response,o=s(e,i);return o?A(o,t):0===n.byteLength?A({status:i.status,message:"Empty HLS segment content at URL: "+i.uri,code:r.FAILURE,xhr:i},t):(t.map.bytes=new Uint8Array(i.response),A(null,t))}},I=function(t,A){return function(e,i){var n=i.response,o=s(e,i);return o?A(o,t):0===n.byteLength?A({status:i.status,message:"Empty HLS segment content at URL: "+i.uri,code:r.FAILURE,xhr:i},t):(t.stats=function(t){return{bandwidth:t.bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0}}(i),t.key?t.encryptedBytes=new Uint8Array(i.response):t.bytes=new Uint8Array(i.response),A(null,t))}},c=function(t,A,e){t.addEventListener("message",function i(n){if(n.data.source===A.requestId){t.removeEventListener("message",i);var r=n.data.decrypted;return A.bytes=new Uint8Array(r.bytes,r.byteOffset,r.byteLength),e(null,A)}}),t.postMessage((0,n.createTransferableMessage)({source:A.requestId,encrypted:A.encryptedBytes,key:A.key.bytes,iv:A.key.iv}),[A.encryptedBytes.buffer,A.key.bytes.buffer])},u=function(t,A,e){var i=[],n=0;return function(r,o){if(r&&(a(t),i.push(r)),(n+=1)===t.length){if(o.endOfAllRequests=Date.now(),i.length>0){var s=function(t){return t.reduce(function(t,A){return A.code>t.code?A:t})}(i);return e(s,o)}return o.encryptedBytes?c(A,o,e):e(null,o)}}},E=function(t,A){return function(e){return t.stats=i.default.mergeOptions(t.stats,function(t){var A=t.target,e={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-A.requestTime||0};return e.bytesReceived=t.loaded,e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3),e}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),A(e,t)}};e.mediaSegmentRequest=function(t,A,e,n,r,s){var c=[],h=u(c,e,s);if(n.key){var l=t(i.default.mergeOptions(A,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),g(n,h));c.push(l)}if(n.map&&!n.map.bytes){var d=t(i.default.mergeOptions(A,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:o(n.map)}),M(n,h));c.push(d)}var C=t(i.default.mergeOptions(A,{uri:n.resolvedUri,responseType:"arraybuffer",headers:o(n)}),I(n,h));return C.addEventListener("progress",E(n,r)),c.push(C),function(){return a(c)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2}],8:[function(t,A,e){(function(i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,A){for(var e=0;e")),this.logger_("initialize");var i=function(){return e.monitorCurrentTime_()},n=function(){return e.techWaiting_()},r=function(){return e.cancelTimer_()},a=function(){return e.fixesBadSeeks_()};this.tech_.on("seekablechanged",a),this.tech_.on("waiting",n),this.tech_.on(g,r),this.tech_.on("canplay",i),this.dispose=function(){e.logger_("dispose"),e.tech_.off("seekablechanged",a),e.tech_.off("waiting",n),e.tech_.off(g,r),e.tech_.off("canplay",i),e.checkCurrentTimeTimeout_&&o.default.clearTimeout(e.checkCurrentTimeTimeout_),e.cancelTimer_()}}return r(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&o.default.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=o.default.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value: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 t=this.tech_.currentTime(),A=this.tech_.buffered();if(this.lastRecordedTime===t&&(!A.length||t+a.default.SAFE_TIME_DELTA>=A.end(A.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&t===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):t===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=t)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var t=this.tech_.seeking(),A=this.seekable(),e=this.tech_.currentTime(),i=void 0;return t&&this.afterSeekableWindow_(A,e)&&(i=A.end(A.length-1)),t&&this.beforeSeekableWindow_(A,e)&&(i=A.start(0)+a.default.SAFE_TIME_DELTA),void 0!==i&&(this.logger_("Trying to seek outside of seekable at time "+e+" with seekable range "+a.default.printableRange(A)+". Seeking to "+i+"."),this.tech_.setCurrentTime(i),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var t=this.tech_.currentTime(),A=this.tech_.buffered(),e=a.default.findRange(A,t);return e.length&&t+3<=e.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(t),this.logger_("Stopped at "+t+" while inside a buffered region ["+e.start(0)+" -> "+e.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var t=this.seekable(),A=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(t,A)){var e=t.end(t.length-1);return this.logger_("Fell out of live window at time "+A+". Seeking to live point (seekable end) "+e),this.cancelTimer_(),this.tech_.setCurrentTime(e),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var i=this.tech_.buffered(),n=a.default.findNextRange(i,A);if(this.videoUnderflow_(n,i,A))return this.cancelTimer_(),this.tech_.setCurrentTime(A),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(n.length>0){var r=n.start(0)-A;return this.logger_("Stopped at "+A+", setting timer for "+r+", seeking to "+n.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*r,A),!0}return!1}},{key:"afterSeekableWindow_",value:function(t,A){return!!t.length&&A>t.end(t.length-1)+a.default.SAFE_TIME_DELTA}},{key:"beforeSeekableWindow_",value:function(t,A){return!!(t.length&&t.start(0)>0&&A2)return{start:n,end:r}}return null}},{key:"logger_",value:function(){}}]),t}();e.default=M,A.exports=e.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ranges":12,"global/window":32}],9:[function(t,A,e){(function(A){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,A){for(var e=0;e=500?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(t,A){var e=this;this.request=null,this.state="HAVE_METADATA";var i=new s.default.Parser;i.push(t.responseText),i.end(),i.manifest.uri=A,i.manifest.attributes=i.manifest.attributes||{};var n=c(this.master,i.manifest);this.targetDuration=i.manifest.targetDuration,n?(this.master=n,this.media_=this.master.playlists[i.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(g.default.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=g.default.setTimeout(function(){e.trigger("mediaupdatetimeout")},h(this.media(),!!n))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),g.default.clearTimeout(this.mediaUpdateTimeout)}},{key:"stopRequest",value:function(){if(this.request){var t=this.request;this.request=null,t.onreadystatechange=null,t.abort()}}},{key:"media",value:function(t){var A=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var e=this.state;if("string"==typeof t){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}var i=!this.media_||t.uri!==this.media_.uri;if(this.master.playlists[t.uri].endList)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=t,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));if(i){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},function(i,n){if(A.request){if(t.resolvedUri=A.resolveManifestRedirect(t.resolvedUri,n),i)return A.playlistRequestError(A.request,t.uri,e);A.haveMetadata(n,t.uri),"HAVE_MASTER"===e?A.trigger("loadedmetadata"):A.trigger("mediachange")}})}}},{key:"resolveManifestRedirect",value:function(t,A){return this.handleManifestRedirects&&A.responseURL&&t!==A.responseURL?A.responseURL:t}},{key:"pause",value:function(){this.stopRequest(),g.default.clearTimeout(this.mediaUpdateTimeout),"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")}},{key:"load",value:function(t){var A=this;g.default.clearTimeout(this.mediaUpdateTimeout);var e=this.media();if(t){var i=e?e.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=g.default.setTimeout(function(){return A.load()},i)}else this.started?e&&!e.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var t=this;this.started=!0,this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(A,e){if(t.request){if(t.request=null,A)return t.error={status:e.status,message:"HLS playlist request error at URL: "+t.srcUrl,responseText:e.responseText,code:2},"HAVE_NOTHING"===t.state&&(t.started=!1),t.trigger("error");var i=new s.default.Parser;return i.push(e.responseText),i.end(),t.state="HAVE_MASTER",t.srcUrl=t.resolveManifestRedirect(t.srcUrl,e),i.manifest.uri=t.srcUrl,i.manifest.playlists?(t.master=i.manifest,u(t.master),E(t.master),t.trigger("loadedplaylist"),void(t.request||t.media(i.manifest.playlists[0]))):(t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:g.default.location.href,playlists:[{uri:t.srcUrl,resolvedUri:t.srcUrl,attributes:{}}]},t.master.playlists[t.srcUrl]=t.master.playlists[0],t.haveMetadata(e,t.srcUrl),t.trigger("loadedmetadata"))}})}}]),A}();e.default=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./resolve-url":15,"global/window":32,"m3u8-parser":33}],10:[function(t,A,e){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(t("./config")),r=i(t("./playlist")),o=t("./util/codecs.js"),a=function(t,A){var e=void 0;return t?(e=window.getComputedStyle(t))?e[A]:"":""},s=function(t,A){var e=t.slice();t.sort(function(t,i){var n=A(t,i);return 0===n?e.indexOf(t)-e.indexOf(i):n})},g=function(t,A){var e=void 0,i=void 0;return t.attributes.BANDWIDTH&&(e=t.attributes.BANDWIDTH),e=e||window.Number.MAX_VALUE,A.attributes.BANDWIDTH&&(i=A.attributes.BANDWIDTH),e-(i=i||window.Number.MAX_VALUE)};e.comparePlaylistBandwidth=g;e.comparePlaylistResolution=function(t,A){var e=void 0,i=void 0;return t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(e=t.attributes.RESOLUTION.width),e=e||window.Number.MAX_VALUE,A.attributes.RESOLUTION&&A.attributes.RESOLUTION.width&&(i=A.attributes.RESOLUTION.width),e===(i=i||window.Number.MAX_VALUE)&&t.attributes.BANDWIDTH&&A.attributes.BANDWIDTH?t.attributes.BANDWIDTH-A.attributes.BANDWIDTH:e-i};var M=function(t,A,e,i){var o=t.playlists.map(function(t){var A,e;return A=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,e=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,{bandwidth:t.attributes.BANDWIDTH||window.Number.MAX_VALUE,width:A,height:e,playlist:t}});s(o,function(t,A){return t.bandwidth-A.bandwidth});var a=(o=o.filter(function(t){return!r.default.isIncompatible(t.playlist)})).filter(function(t){return r.default.isEnabled(t.playlist)});a.length||(a=o.filter(function(t){return!r.default.isDisabled(t.playlist)}));var g=a.filter(function(t){return t.bandwidth*n.default.BANDWIDTH_VARIANCEe||t.height>i})).filter(function(t){return t.width===h[0].width&&t.height===h[0].height}),M=l[l.length-1],d=l.filter(function(t){return t.bandwidth===M.bandwidth})[0]);var C=d||E||I||a[0]||o[0];return C?C.playlist:null};e.simpleSelector=M;e.lastBandwidthSelector=function(){return M(this.playlists.master,this.systemBandwidth,parseInt(a(this.tech_.el(),"width"),10),parseInt(a(this.tech_.el(),"height"),10))};e.movingAverageBandwidthSelector=function(t){var A=-1;if(t<0||t>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){return A<0&&(A=this.systemBandwidth),A=t*this.systemBandwidth+(1-t)*A,M(this.playlists.master,A,parseInt(a(this.tech_.el(),"width"),10),parseInt(a(this.tech_.el(),"height"),10))}};e.minRebufferMaxBandwidthSelector=function(t){var A=t.master,e=t.currentTime,i=t.bandwidth,n=t.duration,o=t.segmentDuration,a=t.timeUntilRebuffer,M=t.currentTimeline,I=t.syncController,c=A.playlists.filter(function(t){return!r.default.isIncompatible(t)}),u=c.filter(r.default.isEnabled);u.length||(u=c.filter(function(t){return!r.default.isDisabled(t)}));var E=u.filter(r.default.hasAttribute.bind(null,"BANDWIDTH")).map(function(t){var A=I.getSyncPoint(t,n,M,e)?1:2;return{playlist:t,rebufferingImpact:r.default.estimateSegmentRequestTime(o,i,t)*A-a}}),h=E.filter(function(t){return t.rebufferingImpact<=0});return s(h,function(t,A){return g(A.playlist,t.playlist)}),h.length?h[0]:(s(E,function(t,A){return t.rebufferingImpact-A.rebufferingImpact}),E[0]||null)};e.lowestBitrateCompatibleVariantSelector=function(){var t=this.playlists.master.playlists.filter(r.default.isEnabled);return s(t,function(t,A){return g(t,A)}),t.filter(function(t){return(0,o.parseCodecs)(t.attributes.CODECS).videoCodec})[0]||null}},{"./config":3,"./playlist":11,"./util/codecs.js":19}],11:[function(t,A,e){(function(A){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="undefined"!=typeof window?window.videojs:void 0!==A?A.videojs:null,n=function(t){return t&&t.__esModule?t:{default:t}}(t("global/window")),r=function(t,A,e){var i=void 0,n=void 0;return void 0===A&&(A=t.mediaSequence+t.segments.length),Ae){var n=[e,A];A=n[0],e=n[1]}if(A<0){for(var r=A;r=i););return Math.max(0,A)};e.safeLiveIndex=s;var g=function(t,A,e){if(!t||!t.segments)return null;if(t.endList)return o(t);if(null===A)return null;A=A||0;var i=e?s(t):t.segments.length;return r(t,t.mediaSequence+i,A)};e.playlistEnd=g;var M=function(t,A){var e=A||0,n=g(t,A,!0);return null===n?(0,i.createTimeRange)():(0,i.createTimeRange)(e,n)};e.seekable=M;var I=function(t){return t-Math.floor(t)==0},c=function(t,A){if(I(A))return A+.1*t;for(var e=A.toString().split(".")[1].length,i=1;i<=e;i++){var n=Math.pow(10,i),r=A*n;if(I(r)||i===e)return(r+t)/n}},u=c.bind(null,1),E=c.bind(null,-1),h=function(t,A,e,i){var n=void 0,r=void 0,o=t.segments.length,s=A-i;if(s<0){if(e>0)for(n=e-1;n>=0;n--)if(r=t.segments[n],(s+=E(r.duration))>0)return{mediaIndex:n,startTime:i-a(t,e,n)};return{mediaIndex:0,startTime:A}}if(e<0){for(n=e;n<0;n++)if((s-=t.targetDuration)<0)return{mediaIndex:0,startTime:A};e=0}for(n=e;nDate.now()};e.isBlacklisted=l;var d=function(t){return t.excludeUntil&&t.excludeUntil===1/0};e.isIncompatible=d;var C=function(t){var A=l(t);return!t.disabled&&!A};e.isEnabled=C;var T=function(t){return t.disabled};e.isDisabled=T;var N=function(t){for(var A=0;A=A})},findNextRange:function(t,A){return o(t,function(t){return t-1/30>=A})},findGaps:function(t){if(t.length<2)return n.default.createTimeRanges();for(var A=[],e=1;e=n};if(t)for(e=0;e "+t.end(e));return A.join(", ")},timeUntilRebuffer:function(t,A){var e=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return((t.length?t.end(t.length-1):0)-A)/e}},A.exports=e.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(t,A,e){(function(t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return t&&t.__esModule?t:{default:t}}("undefined"!=typeof window?window.videojs:void 0!==t?t.videojs:null),n={errorInterval:30,getSource:function(t){return t(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}};e.default=function(t){!function t(A,e){var r=0,o=0,a=i.default.mergeOptions(n,e);A.ready(function(){A.trigger({type:"usage",name:"hls-error-reload-initialized"})});var s=function(){o&&A.currentTime(o)},g=function(t){null!==t&&void 0!==t&&(o=A.duration()!==1/0&&A.currentTime()||0,A.one("loadedmetadata",s),A.src(t),A.trigger({type:"usage",name:"hls-error-reload"}),A.play())},M=function(){return Date.now()-r<1e3*a.errorInterval?void A.trigger({type:"usage",name:"hls-error-reload-canceled"}):a.getSource&&"function"==typeof a.getSource?(r=Date.now(),a.getSource.call(A,g)):void i.default.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},I=function t(){A.off("loadedmetadata",s),A.off("error",M),A.off("dispose",t)};A.on("error",M),A.on("dispose",I),A.reloadSourceOnError=function(e){I(),t(A,e)}}(this,t)},A.exports=e.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,A,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=t("./playlist.js"),n=function(t,A,e){return function(n){var r=t.master.playlists[A],o=(0,i.isIncompatible)(r),a=(0,i.isEnabled)(r);return void 0===n?a:(n?delete r.disabled:r.disabled=!0,n===a||o||(e(),n?t.trigger("renditionenabled"):t.trigger("renditiondisabled")),n)}},r=function t(A,e,i){!function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")}(this,t);var r=A.masterPlaylistController_.fastQualityChange_.bind(A.masterPlaylistController_);if(e.attributes.RESOLUTION){var o=e.attributes.RESOLUTION;this.width=o.width,this.height=o.height}this.bandwidth=e.attributes.BANDWIDTH,this.id=i,this.enabled=n(A.playlists,e.uri,r)};e.default=function(t){var A=t.playlists;t.representations=function(){return A.master.playlists.filter(function(t){return!(0,i.isIncompatible)(t)}).map(function(A,e){return new r(t,A,A.uri)})}},A.exports=e.default},{"./playlist.js":11}],15:[function(t,A,e){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(t("url-toolkit")),r=i(t("global/window"));e.default=function(t,A){return/^[a-z]+:/i.test(A)?A:(/\/\//i.test(t)||(t=n.default.buildAbsoluteURL(r.default.location.href,t)),n.default.buildAbsoluteURL(t,A))},A.exports=e.default},{"global/window":32,"url-toolkit":63}],16:[function(t,A,e){(function(A){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,A){for(var e=0;e0&&t.start(0)"))}return function(t,A){if("function"!=typeof A&&null!==A)throw new TypeError("Super expression must either be null or a function, not "+typeof A);t.prototype=Object.create(A&&A.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),A&&(Object.setPrototypeOf?Object.setPrototypeOf(t,A):t.__proto__=A)}(A,a.default.EventTarget),n(A,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(t){return void 0!==t&&(this.error_=t),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():a.default.createTimeRanges()}},{key:"initSegment",value:function(t){var A=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];if(!t)return null;var e=(0,c.initSegmentId)(t),i=this.initSegments_[e];return A&&!i&&t.bytes&&(this.initSegments_[e]=i={resolvedUri:t.resolvedUri,byterange:t.byterange,bytes:t.bytes}),i||t}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new s.default(this.mediaSource_,this.mimeType_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(t){var A=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(t){var e=this.playlist_,i=this.pendingSegment_;if(this.playlist_=t,this.xhrOptions_=A,this.hasPlayed_()||(t.syncInfo={mediaSequence:t.mediaSequence,time:0}),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!e||e.uri!==t.uri)return void(null!==this.mediaIndex&&this.resyncLoader());var n=t.mediaSequence-e.mediaSequence;this.logger_("mediaSequenceDiff",n),null!==this.mediaIndex&&(this.mediaIndex-=n),i&&(i.mediaIndex-=n,i.mediaIndex>=0&&(i.segment=t.segments[i.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(e,t)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(M.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(t){this.mimeType_||(this.mimeType_=t,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_()),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(t,A){this.sourceUpdater_&&this.sourceUpdater_.remove(t,A),(0,I.default)(t,A,this.segmentMetadataTrack_)}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&M.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=M.default.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&M.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=M.default.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var t=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(t){if(l(this.playlist_,this.mediaSource_,t.mediaIndex))return void this.endOfStream();(t.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((t.timeline!==this.currentTimeline_||null!==t.startOfSegment&&t.startOfSegment=this.goalBufferLength_())return null;if(!i&&M>=1)return null;if(this.logger_("checkBuffer_","mediaIndex:",e,"hasPlayed:",i,"currentTime:",n,"syncPoint:",r,"fetchAtBuffer:",this.fetchAtBuffer_,"bufferedTime:",M),null===r)return e=this.getSyncSegmentCandidate_(A),this.logger_("getSync","mediaIndex:",e),this.generateSegmentInfo_(A,e,null,!0);if(null!==e){this.logger_("walkForward","mediaIndex:",e+1);var I=A.segments[e];return s=I&&I.end?I.end:a,this.generateSegmentInfo_(A,e+1,s,!1)}this.fetchAtBuffer_?(e=(g=o.default.getMediaInfoForTime(A,a,r.segmentIndex,r.time)).mediaIndex,s=g.startTime):(e=(g=o.default.getMediaInfoForTime(A,n,r.segmentIndex,r.time)).mediaIndex,s=g.startTime);return this.logger_("getMediaIndexForTime","mediaIndex:",e,"startOfSegment:",s),this.generateSegmentInfo_(A,e,s,!1)}},{key:"getSyncSegmentCandidate_",value:function(t){var A=this;if(-1===this.currentTimeline_)return 0;var e=t.segments.map(function(t,A){return{timeline:t.timeline,segmentIndex:A}}).filter(function(t){return t.timeline===A.currentTimeline_});return e.length?e[Math.min(e.length-1,1)].segmentIndex:Math.max(t.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(t,A,e,i){if(A<0||A>=t.segments.length)return null;var n=t.segments[A];return{requestId:"segment-loader-"+Math.random(),uri:n.resolvedUri,mediaIndex:A,isSyncRequest:i,startOfSegment:e,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:n.timeline,duration:n.duration,segment:n}}},{key:"abortRequestEarly_",value:function(t){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(t.firstBytesReceivedAt||Date.now())<1e3)return!1;var A=this.currentTime_(),e=t.bandwidth,i=this.pendingSegment_.duration,n=o.default.estimateSegmentRequestTime(i,e,this.playlist_,t.bytesReceived),r=(0,E.timeUntilRebuffer)(this.buffered_(),A,this.hls_.tech_.playbackRate())-1;if(n<=r)return!1;var a=(0,h.minRebufferMaxBandwidthSelector)({master:this.hls_.playlists.master,currentTime:A,bandwidth:e,duration:this.duration_(),segmentDuration:i,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(a){var s=n-r-a.rebufferingImpact,M=.5;return r<=E.TIME_FUDGE_FACTOR&&(M=1),!(!a.playlist||a.playlist.uri===this.playlist_.uri||s0&&this.remove(0,A)}},{key:"createSimplifiedSegmentObj_",value:function(t){var A=t.segment,e={resolvedUri:A.resolvedUri,byterange:A.byterange,requestId:t.requestId};if(A.key){var i=A.key.iv||new Uint32Array([0,0,0,t.mediaIndex+t.playlist.mediaSequence]);e.key={resolvedUri:A.key.resolvedUri,iv:i}}return A.map&&(e.map=this.initSegment(A.map)),e}},{key:"segmentRequestFinished_",value:function(t,A){if(this.mediaRequests+=1,A.stats&&(this.mediaBytesTransferred+=A.stats.bytesReceived,this.mediaTransferDuration+=A.stats.roundTripTime),this.pendingSegment_){if(A.requestId===this.pendingSegment_.requestId){if(t)return this.pendingSegment_=null,this.state="READY",t.code===u.REQUEST_ERRORS.ABORTED?void(this.mediaRequestsAborted+=1):(this.pause(),t.code===u.REQUEST_ERRORS.TIMEOUT?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(t),void this.trigger("error")));this.bandwidth=A.stats.bandwidth,this.roundTrip=A.stats.roundTripTime,A.map&&(A.map=this.initSegment(A.map,!0)),this.processSegmentResponse_(A)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(t){var A=this.pendingSegment_;A.bytes=t.bytes,t.map&&(A.segment.map.bytes=t.map.bytes),A.endOfAllRequests=t.endOfAllRequests,this.handleSegment_()}},{key:"handleSegment_",value:function(){var t=this;if(this.pendingSegment_){var A=this.pendingSegment_,e=A.segment,i=this.syncController_.probeSegmentInfo(A);void 0===this.startingMedia_&&i&&(i.containsAudio||i.containsVideo)&&(this.startingMedia_={containsAudio:i.containsAudio,containsVideo:i.containsVideo});var n=C(this.loaderType_,this.startingMedia_,i);if(n)return this.error({message:n,blacklistDuration:1/0}),void this.trigger("error");if(A.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==A.timestampOffset&&A.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(A.timestampOffset),this.trigger("timestampoffset"));var r=this.syncController_.mappingForTimeline(A.timeline);null!==r&&this.trigger({type:"segmenttimemapping",mapping:r}),this.state="APPENDING",e.map&&function(){var A=(0,c.initSegmentId)(e.map);if(!t.activeInitSegmentId_||t.activeInitSegmentId_!==A){var i=t.initSegment(e.map);t.sourceUpdater_.appendBuffer(i.bytes,function(){t.activeInitSegmentId_=A})}}(),A.byteLength=A.bytes.byteLength,"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration,this.sourceUpdater_.appendBuffer(A.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(this.logger_("handleUpdateEnd_","segmentInfo:",this.pendingSegment_),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var t=this.pendingSegment_,A=t.segment,e=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(t),this.addSegmentMetadataCue_(t),this.state="READY",this.mediaIndex=t.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate"),A.end&&this.currentTime_()-A.end>3*t.playlist.targetDuration?this.resetEverything():(e&&this.trigger("bandwidthupdate"),this.trigger("progress"),l(t.playlist,this.mediaSource_,t.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(t){var A=this.throughput.rate,e=Date.now()-t.endOfAllRequests+1,i=Math.floor(t.byteLength/e*8*1e3);this.throughput.rate+=(i-A)/++this.throughput.count}},{key:"logger_",value:function(){}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var A=t.segment,e=A.start,i=A.end;if(d(e)&&d(i)){(0,I.default)(e,i,this.segmentMetadataTrack_);var n=M.default.WebKitDataCue||M.default.VTTCue,r={bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:e,end:i},o=new n(e,i,JSON.stringify(r));o.value=r,this.segmentMetadataTrack_.addCue(o)}}}}]),A}();e.default=N}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2,"./config":3,"./media-segment-request":7,"./playlist":11,"./playlist-selectors":10,"./ranges":12,"./source-updater":17,"global/window":32,"videojs-contrib-media-sources/es5/remove-cues-from-track.js":72}],17:[function(t,A,e){(function(t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,A){for(var e=0;e=M)&&(a=M,o={time:g.start,segmentIndex:s})}}return o}},{name:"Discontinuity",run:function(t,A,e,i,n){var r=null;if(n=n||0,A.discontinuityStarts&&A.discontinuityStarts.length)for(var o=null,a=0;a=I)&&(o=I,r={time:M.time,segmentIndex:s})}}return r}},{name:"Playlist",run:function(t,A,e,i,n){return A.syncInfo?{time:A.syncInfo.time,segmentIndex:A.syncInfo.mediaSequence-A.mediaSequence}:null}}];e.syncPointStrategies=M;var I=function(t){function A(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];(function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")})(this,A),r(Object.getPrototypeOf(A.prototype),"constructor",this).call(this),this.inspectCache_=void 0,this.timelines=[],this.discontinuities=[],this.datetimeToDisplayTime=null,t.debug&&(this.logger_=g.default.log.bind(g.default,"sync-controller ->"))}return function(t,A){if("function"!=typeof A&&null!==A)throw new TypeError("Super expression must either be null or a function, not "+typeof A);t.prototype=Object.create(A&&A.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),A&&(Object.setPrototypeOf?Object.setPrototypeOf(t,A):t.__proto__=A)}(A,g.default.EventTarget),n(A,[{key:"getSyncPoint",value:function(t,A,e,i){var n=this.runStrategies_(t,A,e,i);return n.length?this.selectSyncPoint_(n,{key:"time",value:i}):null}},{key:"getExpiredTime",value:function(t,A){if(!t||!t.segments)return null;var e=this.runStrategies_(t,A,t.discontinuitySequence,0);if(!e.length)return null;var i=this.selectSyncPoint_(e,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+(0,s.sumDurations)(t,i.segmentIndex,0))}},{key:"runStrategies_",value:function(t,A,e,i){for(var n=[],r=0;r:",a))}return n}},{key:"selectSyncPoint_",value:function(t,A){for(var e=t[0].syncPoint,i=Math.abs(t[0].syncPoint[A.key]-A.value),n=t[0].strategy,r=1;r chosen: ",e),e}},{key:"saveExpiredSegmentInfo",value:function(t,A){for(var e=A.mediaSequence-t.mediaSequence-1;e>=0;e--){var i=t.segments[e];if(i&&void 0!==i.start){A.syncInfo={mediaSequence:t.mediaSequence+e,time:i.start},this.logger_("playlist sync:",A.syncInfo),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(t){if(!this.datetimeToDisplayTime&&t.dateTimeObject){var A=t.dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-A}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(t){var A,e=t.segment,i=t.playlist;return(A=e.map?this.probeMp4Segment_(t):this.probeTsSegment_(t))&&this.calculateSegmentTimeMapping_(t,A)&&(this.saveDiscontinuitySyncInfo_(t),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+t.mediaIndex,time:e.start})),A}},{key:"probeMp4Segment_",value:function(t){var A=t.segment,e=o.default.timescale(A.map.bytes),i=o.default.startTime(e,t.bytes);return null!==t.timestampOffset&&(t.timestampOffset-=i),{start:i,end:i+A.duration}}},{key:"probeTsSegment_",value:function(t){var A=(0,a.inspect)(t.bytes,this.inspectCache_),e=void 0,i=void 0;return A?(A.video&&2===A.video.length?(this.inspectCache_=A.video[1].dts,e=A.video[0].dtsTime,i=A.video[1].dtsTime):A.audio&&2===A.audio.length&&(this.inspectCache_=A.audio[1].dts,e=A.audio[0].dtsTime,i=A.audio[1].dtsTime),{start:e,end:i,containsVideo:A.video&&2===A.video.length,containsAudio:A.audio&&2===A.audio.length}):null}},{key:"timestampOffsetForTimeline",value:function(t){return void 0===this.timelines[t]?null:this.timelines[t].time}},{key:"mappingForTimeline",value:function(t){return void 0===this.timelines[t]?null:this.timelines[t].mapping}},{key:"calculateSegmentTimeMapping_",value:function(t,A){var e=t.segment,i=this.timelines[t.timeline];if(null!==t.timestampOffset)this.logger_("tsO:",t.timestampOffset),i={time:t.startOfSegment,mapping:t.startOfSegment-A.start},this.timelines[t.timeline]=i,this.trigger("timestampoffset"),e.start=t.startOfSegment,e.end=A.end+i.mapping;else{if(!i)return!1;e.start=A.start+i.mapping,e.end=A.end+i.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(t){var A=t.playlist,e=t.segment;if(e.discontinuity)this.discontinuities[e.timeline]={time:e.start,accuracy:0};else if(A.discontinuityStarts.length)for(var i=0;ia){var g;g=o<0?e.start-(0,s.sumDurations)(A,t.mediaIndex,n):e.end+(0,s.sumDurations)(A,t.mediaIndex+1,n),this.discontinuities[r]={time:g,accuracy:a}}}}},{key:"logger_",value:function(){}}]),A}();e.default=I}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./playlist":11,"mux.js/lib/mp4/probe":57,"mux.js/lib/tools/ts-inspector.js":59}],19:[function(t,A,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.parseCodecs=function(){var t,A=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e={codecCount:0};return e.codecCount=A.split(",").length,e.codecCount=e.codecCount||2,(t=/(^|\s|,)+(avc1)([^ ,]*)/i.exec(A))&&(e.videoCodec=t[2],e.videoObjectTypeIndicator=t[3]),e.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(A),e.audioProfile=e.audioProfile&&e.audioProfile[2],e}},{}],20:[function(t,A,e){(function(i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,A){for(var e=0;e>7))^r]=r;for(o=a=0;!i[o];o^=M||1,a=g[a]||1)for(c=(c=a^a<<1^a<<2^a<<3^a<<4)>>8^255&c^99,i[o]=c,n[c]=o,E=16843009*s[I=s[M=s[o]]]^65537*I^257*M^16843008*o,u=257*s[c]^16843008*c,r=0;r<4;r++)A[r][o]=u=u<<24^u>>>8,e[r][c]=E=E<<24^E>>>8;for(r=0;r<5;r++)A[r]=A[r].slice(0),e[r]=e[r].slice(0);return t},r=null,o=function(){function t(A){(function(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")})(this,t),r||(r=n()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];var e=void 0,i=void 0,o=void 0,a=void 0,s=void 0,g=this._tables[0][4],M=this._tables[1],I=A.length,c=1;if(4!==I&&6!==I&&8!==I)throw new Error("Invalid aes key size");for(a=A.slice(0),s=[],this._key=[a,s],e=I;e<4*I+28;e++)o=a[e-1],(e%I==0||8===I&&e%I==4)&&(o=g[o>>>24]<<24^g[o>>16&255]<<16^g[o>>8&255]<<8^g[255&o],e%I==0&&(o=o<<8^o>>>24^c<<24,c=c<<1^283*(c>>7))),a[e]=a[e-I]^o;for(i=0;e;i++,e--)o=a[3&i?e:e-4],s[i]=e<=4||i<4?o:M[0][g[o>>>24]]^M[1][g[o>>16&255]]^M[2][g[o>>8&255]]^M[3][g[255&o]]}return i(t,[{key:"decrypt",value:function(t,A,e,i,n,r){var o=this._key[1],a=t^o[0],s=i^o[1],g=e^o[2],M=A^o[3],I=void 0,c=void 0,u=void 0,E=o.length/4-2,h=void 0,l=4,d=this._tables[1],C=d[0],T=d[1],N=d[2],D=d[3],y=d[4];for(h=0;h>>24]^T[s>>16&255]^N[g>>8&255]^D[255&M]^o[l],c=C[s>>>24]^T[g>>16&255]^N[M>>8&255]^D[255&a]^o[l+1],u=C[g>>>24]^T[M>>16&255]^N[a>>8&255]^D[255&s]^o[l+2],M=C[M>>>24]^T[a>>16&255]^N[s>>8&255]^D[255&g]^o[l+3],l+=4,a=I,s=c,g=u;for(h=0;h<4;h++)n[(3&-h)+r]=y[a>>>24]<<24^y[s>>16&255]<<16^y[g>>8&255]<<8^y[255&M]^o[l++],I=a,a=s,s=g,g=M,M=I}}]),t}();e.default=o,A.exports=e.default},{}],23:[function(t,A,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,A){for(var e=0;e>8|t>>>24},g=function(t,A,e){var i=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),n=new r.default(Array.prototype.slice.call(A)),o=new Uint8Array(t.byteLength),a=new Int32Array(o.buffer),g=void 0,M=void 0,I=void 0,c=void 0,u=void 0,E=void 0,h=void 0,l=void 0,d=void 0;for(g=e[0],M=e[1],I=e[2],c=e[3],d=0;d-1)}},{key:"trigger",value:function(t){var A=void 0,e=void 0,i=void 0,n=void 0;if(A=this.listeners[t])if(2===arguments.length)for(i=A.length,e=0;e-1;A=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,A)),this.buffer=this.buffer.substring(A+1)}}]),A}();e.default=r},{"./stream":37}],35:[function(t,A,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){return function(t,A){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,A){var e=[],i=!0,n=!1,r=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done)&&(e.push(o.value),!A||e.length!==A);i=!0);}catch(t){n=!0,r=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw r}}return e}(t,A);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=function(){function t(t,A){for(var e=0;e0&&(r.duration=t.duration),0===t.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key:function(){return t.attributes?"NONE"===t.attributes.METHOD?void(g=null):t.attributes.URI?(t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),g={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void(void 0!==t.attributes.IV&&(g.iv=t.attributes.IV))):void this.trigger("warn",{message:"ignoring key declaration without URI"}):void this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,I=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){o={},t.uri&&(o.uri=t.uri),t.byterange&&(o.byterange=t.byterange)},"stream-inf":function(){this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||M,t.attributes?(r.attributes||(r.attributes={}),n(r.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||M,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var e=this.manifest.mediaGroups[t.attributes.TYPE];e[t.attributes["GROUP-ID"]]=e[t.attributes["GROUP-ID"]]||{},A=e[t.attributes["GROUP-ID"]],(a={default:/yes/i.test(t.attributes.DEFAULT)}).default?a.autoselect=!0:a.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(a.language=t.attributes.LANGUAGE),t.attributes.URI&&(a.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(a.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(a.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(a.forced=/yes/i.test(t.attributes.FORCED)),A[t.attributes.NAME]=a}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){I+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time":function(){this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):this.manifest.targetDuration=t.duration},totalduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+t.duration}):this.manifest.totalDuration=t.duration},"cue-out":function(){r.cueOut=t.data},"cue-out-cont":function(){r.cueOutCont=t.data},"cue-in":function(){r.cueIn=t.data}})[t.tagType]||function(){}).call(e)},uri:function(){r.uri=t.uri,i.push(r),!this.manifest.targetDuration||"duration"in r||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),g&&(r.key=g),r.timeline=I,o&&(r.map=o),r={}},comment:function(){}})[t.type].call(e)}),t}return function(t,A){if("function"!=typeof A&&null!==A)throw new TypeError("Super expression must either be null or a function, not "+typeof A);t.prototype=Object.create(A&&A.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),A&&(Object.setPrototypeOf?Object.setPrototypeOf(t,A):t.__proto__=A)}(A,o.default),r(A,[{key:"push",value:function(t){this.lineStream.push(t)}},{key:"end",value:function(){this.lineStream.push("\n")}}]),A}();e.default=g},{"./line-stream":34,"./parse-stream":35,"./stream":37}],37:[function(t,A,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,A){for(var e=0;e-1}},{key:"trigger",value:function(t){var A=this.listeners[t],e=void 0,i=void 0,n=void 0;if(A)if(2===arguments.length)for(i=A.length,e=0;e>4?e+20:e+10},this.parseAdtsSize=function(t,A){var e=(224&t[A+5])>>5,i=t[A+4]<<3;return 6144&t[A+3]|i|e},this.push=function(e){var i,n,r,o,a=0,s=0;for(t.length?(o=t.length,(t=new Uint8Array(e.byteLength+o)).set(t.subarray(0,o)),t.set(e,o)):t=e;t.length-s>=3;)if(t[s]!=="I".charCodeAt(0)||t[s+1]!=="D".charCodeAt(0)||t[s+2]!=="3".charCodeAt(0))if(!0&t[s]&&240==(240&t[s+1])){if(t.length-s<7)break;if((a=this.parseAdtsSize(t,s))>t.length)break;r={type:"audio",data:t.subarray(s,s+a),pts:A,dts:A},this.trigger("data",r),s+=a}else s++;else{if(t.length-s<10)break;if((a=this.parseId3TagSize(t,s))>t.length)break;n={type:"timed-metadata",data:t.subarray(s,s+a)},this.trigger("data",n),s+=a}i=t.length-s,t=i>0?t.subarray(s):new Uint8Array}}).prototype=new n,A.exports=i},{"../utils/stream.js":62}],39:[function(t,A,e){"use strict";var i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=function(t){return t[0]<<21|t[1]<<14|t[2]<<7|t[3]},r=function(t,A,e){return unescape(function(t,A,e){var i,n="";for(i=A;i>4?e+20:e+10},parseAdtsSize:function(t,A){var e=(224&t[A+5])>>5,i=t[A+4]<<3;return 6144&t[A+3]|i|e},parseType:function(t,A){return t[A]==="I".charCodeAt(0)&&t[A+1]==="D".charCodeAt(0)&&t[A+2]==="3".charCodeAt(0)?"timed-metadata":!0&t[A]&&240==(240&t[A+1])?"audio":null},parseSampleRate:function(t){for(var A=0;A+5>>2];A++}return null},parseAacTimestamp:function(t){var A,e,i;A=10,64&t[5]&&(A+=4,A+=n(t.subarray(10,14)));do{if((e=n(t.subarray(A+4,A+8)))<1)return null;if("PRIV"===String.fromCharCode(t[A],t[A+1],t[A+2],t[A+3])){i=t.subarray(A+10,A+e+10);for(var o=0;o>>2;return(s*=4)+(3&a[7])}break}}A+=10,A+=e}while(A>5,s=9e4*(a=1024*(1+(3&t[g+6])))/r[(60&t[g+2])>>>2],n=g+e,t.byteLength>>6&3),channelcount:(1&t[g+2])<<2|(192&t[g+3])>>>6,samplerate:r[(60&t[g+2])>>>2],samplingfrequencyindex:(60&t[g+2])>>>2,samplesize:16,data:t.subarray(g+7+i,n)}),t.byteLength===n)return void(t=void 0);M++,t=t.subarray(n)}else g++},this.flush=function(){this.trigger("done")}}).prototype=new n,A.exports=i},{"../utils/stream.js":62}],41:[function(t,A,e){"use strict";var i,n,r,o=t("../utils/stream.js"),a=t("../utils/exp-golomb.js");(n=function(){var t,A,e=0;n.prototype.init.call(this),this.push=function(i){var n;for(A?((n=new Uint8Array(A.byteLength+i.data.byteLength)).set(A),n.set(i.data,A.byteLength),A=n):A=i.data;e3&&this.trigger("data",A.subarray(e+3)),A=null,e=0,this.trigger("done")}}).prototype=new o,r={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(i=function(){var t,A,e,o,s,g,M,I=new n;i.prototype.init.call(this),t=this,this.push=function(t){"video"===t.type&&(A=t.trackId,e=t.pts,o=t.dts,I.push(t))},I.on("data",function(i){var n={trackId:A,pts:e,dts:o,data:i};switch(31&i[0]){case 5:n.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:n.nalUnitType="sei_rbsp",n.escapedRBSP=s(i.subarray(1));break;case 7:n.nalUnitType="seq_parameter_set_rbsp",n.escapedRBSP=s(i.subarray(1)),n.config=g(n.escapedRBSP);break;case 8:n.nalUnitType="pic_parameter_set_rbsp";break;case 9:n.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",n)}),I.on("done",function(){t.trigger("done")}),this.flush=function(){I.flush()},M=function(t,A){var e,i=8,n=8;for(e=0;e