UNPKG

video.js

Version:

An HTML5 and Flash video player with a common API and skin for both.

19 lines 221 kB
/** * @license * Video.js 7.8.4 <http://videojs.com/> * Copyright Brightcove, Inc. <https://www.brightcove.com/> * Available under Apache License Version 2.0 * <https://github.com/videojs/video.js/blob/master/LICENSE> * * Includes vtt.js <https://github.com/mozilla/vtt.js> * Available under Apache License Version 2.0 * <https://github.com/mozilla/vtt.js/blob/master/LICENSE> */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,function(h,d){"use strict";h=h&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h,d=d&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d;var p="7.8.4",c=[],e=function(a,l){return function(e,t,n){var i=l.levels[t],r=new RegExp("^("+i+")$");if("log"!==e&&n.unshift(e.toUpperCase()+":"),n.unshift(a+":"),c){c.push([].concat(n));var s=c.length-1e3;c.splice(0,0<s?s:0)}if(h.console){var o=h.console[e];o||"debug"!==e||(o=h.console.info||h.console.log),o&&i&&r.test(e)&&o[Array.isArray(n)?"apply":"call"](h.console,n)}}};var f=function t(n){function i(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r("log",s,t)}var r,s="info";return r=e(n,i),i.createLogger=function(e){return t(n+": "+e)},i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},i.level=function(e){if("string"==typeof e){if(!i.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');s=e}return s},(i.history=function(){return c?[].concat(c):[]}).filter=function(t){return(c||[]).filter(function(e){return new RegExp(".*"+t+".*").test(e[0])})},i.history.clear=function(){c&&(c.length=0)},i.history.disable=function(){null!==c&&(c.length=0,c=null)},i.history.enable=function(){null===c&&(c=[])},i.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r("error",s,t)},i.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r("warn",s,t)},i.debug=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r("debug",s,t)},i}("VIDEOJS"),v=f.createLogger;function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},t.apply(this,arguments)}e.exports=t}),n=Object.prototype.toString,s=function(e){return a(e)?Object.keys(e):[]};function o(t,n){s(t).forEach(function(e){return n(t[e],e)})}function g(n){for(var e=arguments.length,t=new Array(1<e?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Object.assign?r.apply(void 0,[n].concat(t)):(t.forEach(function(e){e&&o(e,function(e,t){n[t]=e})}),n)}function a(e){return!!e&&"object"==typeof e}function l(e){return a(e)&&"[object Object]"===n.call(e)&&e.constructor===Object}function i(e,t){if(!e||!t)return"";if("function"!=typeof h.getComputedStyle)return"";var n=h.getComputedStyle(e);return n?n.getPropertyValue(t)||n[t]:""}function u(e){return"string"==typeof e&&Boolean(e.trim())}function y(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function m(){return d===h.document}function _(e){return a(e)&&1===e.nodeType}function b(){try{return h.parent!==h.self}catch(e){return!0}}function T(i){return function(e,t){if(!u(e))return d[i](null);u(t)&&(t=d.querySelector(t));var n=_(t)?t:d;return n[i]&&n[i](e)}}function k(e,n,t,i){void 0===e&&(e="div"),void 0===n&&(n={}),void 0===t&&(t={});var r=d.createElement(e);return Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(f.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),r.setAttribute(e,t)):"textContent"===e?C(r,t):r[e]!==t&&(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),i&&W(r,i),r}function C(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function E(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function w(e,t){return y(t),e.classList?e.classList.contains(t):function(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}(t).test(e.className)}function S(e,t){return e.classList?e.classList.add(t):w(e,t)||(e.className=(e.className+" "+t).trim()),e}function x(e,t){return e.classList?e.classList.remove(t):(y(t),e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")),e}function P(e,t,n){var i=w(e,t);if("function"==typeof n&&(n=n(e,t)),"boolean"!=typeof n&&(n=!i),n!==i)return n?S(e,t):x(e,t),e}function j(n,i){Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];null===t||"undefined"==typeof t||!1===t?n.removeAttribute(e):n.setAttribute(e,!0===t?"":t)})}function A(e){var t={},n=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&0<e.attributes.length)for(var i=e.attributes,r=i.length-1;0<=r;r--){var s=i[r].name,o=i[r].value;"boolean"!=typeof e[s]&&-1===n.indexOf(","+s+",")||(o=null!==o),t[s]=o}return t}function I(e,t){return e.getAttribute(t)}function M(e,t,n){e.setAttribute(t,n)}function O(e,t){e.removeAttribute(t)}function L(){d.body.focus(),d.onselectstart=function(){return!1}}function N(){d.onselectstart=function(){return!0}}function D(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),n={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n.height||(n.height=parseFloat(i(e,"height"))),n.width||(n.width=parseFloat(i(e,"width"))),n}}function R(e){var t;if(e.getBoundingClientRect&&e.parentNode&&(t=e.getBoundingClientRect()),!t)return{left:0,top:0};var n=d.documentElement,i=d.body,r=n.clientLeft||i.clientLeft||0,s=h.pageXOffset||i.scrollLeft,o=t.left+s-r,a=n.clientTop||i.clientTop||0,l=h.pageYOffset||i.scrollTop,c=t.top+l-a;return{left:Math.round(o),top:Math.round(c)}}function B(e,t){var n={},i=R(e),r=e.offsetWidth,s=e.offsetHeight,o=i.top,a=i.left,l=t.pageY,c=t.pageX;return t.changedTouches&&(c=t.changedTouches[0].pageX,l=t.changedTouches[0].pageY),n.y=Math.max(0,Math.min(1,(o-l+s)/s)),n.x=Math.max(0,Math.min(1,(c-a)/r)),n}function F(e){return a(e)&&3===e.nodeType}function H(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function V(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),_(e)||F(e)?e:"string"==typeof e&&/\S/.test(e)?d.createTextNode(e):void 0}).filter(function(e){return e})}function W(t,e){return V(e).forEach(function(e){return t.appendChild(e)}),t}function z(e,t){return W(H(e),t)}function K(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var U,q=T("querySelector"),X=T("querySelectorAll"),$=Object.freeze({__proto__:null,isReal:m,isEl:_,isInFrame:b,createEl:k,textContent:C,prependTo:E,hasClass:w,addClass:S,removeClass:x,toggleClass:P,setAttributes:j,getAttributes:A,getAttribute:I,setAttribute:M,removeAttribute:O,blockTextSelection:L,unblockTextSelection:N,getBoundingClientRect:D,findPosition:R,getPointerPosition:B,isTextNode:F,emptyEl:H,normalizeContent:V,appendContent:W,insertContent:z,isSingleLeftClick:K,$:q,$$:X}),Y=!1,G=function(){if(m()&&!1!==U.options.autoSetup){var e=Array.prototype.slice.call(d.getElementsByTagName("video")),t=Array.prototype.slice.call(d.getElementsByTagName("audio")),n=Array.prototype.slice.call(d.getElementsByTagName("video-js")),i=e.concat(t,n);if(i&&0<i.length)for(var r=0,s=i.length;r<s;r++){var o=i[r];if(!o||!o.getAttribute){Q(1);break}void 0===o.player&&null!==o.getAttribute("data-setup")&&U(o)}else Y||Q(1)}};function Q(e,t){t&&(U=t),h.setTimeout(G,e)}function J(){Y=!0,h.removeEventListener("load",J)}m()&&("complete"===d.readyState?J():h.addEventListener("load",J));function Z(e){var t=d.createElement("style");return t.className=e,t}function ee(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}var te,ne=3;function ie(){return ne++}h.WeakMap||(te=function(){function e(){this.vdata="vdata"+Math.floor(h.performance&&h.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var n=e[this.vdata]||ie();return e[this.vdata]||(e[this.vdata]=n),this.data[n]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];f("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var re,se=h.WeakMap?new WeakMap:new te;function oe(e,t){if(se.has(e)){var n=se.get(e);0===n.handlers[t].length&&(delete n.handlers[t],e.removeEventListener?e.removeEventListener(t,n.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&se.delete(e)}}function ae(t,n,e,i){e.forEach(function(e){t(n,e,i)})}function le(e){if(e.fixed_)return e;function t(){return!0}function n(){return!1}if(!e||!e.isPropagationStopped){var i=e||h.event;for(var r in e={},i)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&("returnValue"===r&&i.preventDefault||(e[r]=i[r]));if(e.target||(e.target=e.srcElement||d),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){i.preventDefault&&i.preventDefault(),e.returnValue=!1,i.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),e.cancelBubble=!0,i.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=n,e.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=n,null!==e.clientX&&void 0!==e.clientX){var s=d.documentElement,o=d.body;e.pageX=e.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=e.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var ce=function(){if("boolean"!=typeof re){re=!1;try{var e=Object.defineProperty({},"passive",{get:function(){re=!0}});h.addEventListener("test",null,e),h.removeEventListener("test",null,e)}catch(e){}}return re},ue=["touchstart","touchmove"];function he(o,e,t){if(Array.isArray(e))return ae(he,o,e,t);se.has(o)||se.set(o,{});var a=se.get(o);if(a.handlers||(a.handlers={}),a.handlers[e]||(a.handlers[e]=[]),t.guid||(t.guid=ie()),a.handlers[e].push(t),a.dispatcher||(a.disabled=!1,a.dispatcher=function(e,t){if(!a.disabled){e=le(e);var n=a.handlers[e.type];if(n)for(var i=n.slice(0),r=0,s=i.length;r<s&&!e.isImmediatePropagationStopped();r++)try{i[r].call(o,e,t)}catch(e){f.error(e)}}}),1===a.handlers[e].length)if(o.addEventListener){var n=!1;ce()&&-1<ue.indexOf(e)&&(n={passive:!0}),o.addEventListener(e,a.dispatcher,n)}else o.attachEvent&&o.attachEvent("on"+e,a.dispatcher)}function de(e,t,n){if(se.has(e)){var i=se.get(e);if(i.handlers){if(Array.isArray(t))return ae(de,e,t,n);var r=function(e,t){i.handlers[t]=[],oe(e,t)};if(void 0!==t){var s=i.handlers[t];if(s)if(n){if(n.guid)for(var o=0;o<s.length;o++)s[o].guid===n.guid&&s.splice(o--,1);oe(e,t)}else r(e,t)}else for(var a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&r(e,a)}}}function pe(e,t,n){var i=se.has(e)?se.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=le(t),i.dispatcher&&i.dispatcher.call(e,t,n),r&&!t.isPropagationStopped()&&!0===t.bubbles)pe.call(null,r,t,n);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){se.has(t.target)||se.set(t.target,{});var s=se.get(t.target);t.target[t.type]&&(s.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),s.disabled=!1)}return!t.defaultPrevented}function fe(e,t,n){if(Array.isArray(t))return ae(fe,e,t,n);function i(){de(e,t,i),n.apply(this,arguments)}i.guid=n.guid=n.guid||ie(),he(e,t,i)}function ve(e,t,n){function i(){de(e,t,i),n.apply(this,arguments)}i.guid=n.guid=n.guid||ie(),he(e,t,i)}function ge(e,t,n){t.guid||(t.guid=ie());var i=t.bind(e);return i.guid=n?n+"_"+t.guid:t.guid,i}function ye(t,n){var i=h.performance.now();return function(){var e=h.performance.now();n<=e-i&&(t.apply(void 0,arguments),i=e)}}function me(){}var _e,be=Object.freeze({__proto__:null,fixEvent:le,on:he,off:de,trigger:pe,one:fe,any:ve});me.prototype.allowedEvents_={},me.prototype.addEventListener=me.prototype.on=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},he(this,e,t),this.addEventListener=n},me.prototype.removeEventListener=me.prototype.off=function(e,t){de(this,e,t)},me.prototype.one=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},fe(this,e,t),this.addEventListener=n},me.prototype.any=function(e,t){var n=this.addEventListener;this.addEventListener=function(){},ve(this,e,t),this.addEventListener=n},me.prototype.dispatchEvent=me.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=le(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),pe(this,e)},me.prototype.queueTrigger=function(e){var t=this;_e=_e||new Map;var n=e.type||e,i=_e.get(this);i||(i=new Map,_e.set(this,i));var r=i.get(n);i.delete(n),h.clearTimeout(r);var s=h.setTimeout(function(){0===i.size&&(i=null,_e.delete(t)),t.trigger(e)},0);i.set(n,s)};function Te(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length}function ke(e){if(!e.nodeName&&!xe(e))throw new Error("Invalid target; must be a DOM node or evented object.")}function Ce(e){if(!Te(e))throw new Error("Invalid event type; must be a non-empty string or array.")}function Ee(e){if("function"!=typeof e)throw new Error("Invalid listener; must be a function.")}function we(e,t){var n,i,r,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return r=s?(n=e.eventBusEl_,3<=t.length&&t.shift(),i=t[0],t[1]):(n=t[0],i=t[1],t[2]),ke(n),Ce(i),Ee(r),{isTargetingSelf:s,target:n,type:i,listener:r=ge(e,r)}}function Se(e,t,n,i){ke(e),e.nodeName?be[t](e,n,i):e[t](n,i)}var xe=function(t){return t instanceof me||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},Pe={on:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=we(this,n),s=r.isTargetingSelf,o=r.target,a=r.type,l=r.listener;if(Se(o,"on",a,l),!s){var c=function(){return e.off(o,a,l)};c.guid=l.guid;var u=function(){return e.off("dispose",c)};u.guid=l.guid,Se(this,"on","dispose",c),Se(o,"on","dispose",u)}},one:function(){for(var r=this,e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=we(this,t),s=i.isTargetingSelf,o=i.target,a=i.type,l=i.listener;if(s)Se(o,"one",a,l);else{var c=function e(){r.off(o,a,e);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];l.apply(null,n)};c.guid=l.guid,Se(o,"one",a,c)}},any:function(){for(var r=this,e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=we(this,t),s=i.isTargetingSelf,o=i.target,a=i.type,l=i.listener;if(s)Se(o,"any",a,l);else{var c=function e(){r.off(o,a,e);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];l.apply(null,n)};c.guid=l.guid,Se(o,"any",a,c)}},off:function(e,t,n){if(!e||Te(e))de(this.eventBusEl_,e,t);else{var i=e,r=t;ke(i),Ce(r),Ee(n),n=ge(this,n),this.off("dispose",n),i.nodeName?(de(i,r,n),de(i,"dispose",n)):xe(i)&&(i.off(r,n),i.off("dispose",n))}},trigger:function(e,t){return pe(this.eventBusEl_,e,t)}};function je(e,t){void 0===t&&(t={});var n=t.eventBusKey;if(n){if(!e[n].nodeName)throw new Error('The eventBusKey "'+n+'" does not refer to an element.');e.eventBusEl_=e[n]}else e.eventBusEl_=k("span",{className:"vjs-event-bus"});return g(e,Pe),e.eventedCallbacks&&e.eventedCallbacks.forEach(function(e){e()}),e.on("dispose",function(){e.off(),h.setTimeout(function(){e.eventBusEl_=null},0)}),e}var Ae={state:{},setState:function(e){var n,i=this;return"function"==typeof e&&(e=e()),o(e,function(e,t){i.state[t]!==e&&((n=n||{})[t]={from:i.state[t],to:e}),i.state[t]=e}),n&&xe(this)&&this.trigger({changes:n,type:"statechanged"}),n}};function Ie(e,t){return g(e,Ae),e.state=g({},e.state,t),"function"==typeof e.handleStateChanged&&xe(e)&&e.on("statechanged",e.handleStateChanged),e}function Me(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})}function Oe(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})}function Le(){for(var n={},e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return t.forEach(function(e){e&&o(e,function(e,t){l(e)?(l(n[t])||(n[t]={}),n[t]=Le(n[t],e)):n[t]=e})}),n}var Ne=function(){function c(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Le({},this.options_),t=this.options_=Le(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var i=e&&e.id&&e.id()||"no_player";this.id_=i+"_component_"+ie()}var r;this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),!1!==t.evented&&je(this,{eventBusKey:this.el_?"el_":null}),Ie(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},h.Set||(r=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var n in this.set_)e.call(t,n,n,this)},e}()),this.setTimeoutIds_=h.Set?new Set:new r,this.setIntervalIds_=h.Set?new Set:new r,this.rafIds_=h.Set?new Set:new r,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(n),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var e=c.prototype;return e.dispose=function(){if(!this.isDisposed_){if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),se.has(this.el_)&&se.delete(this.el_),this.el_=null),this.player_=null}},e.isDisposed=function(){return Boolean(this.isDisposed_)},e.player=function(){return this.player_},e.options=function(e){return e&&(this.options_=Le(this.options_,e)),this.options_},e.el=function(){return this.el_},e.createEl=function(e,t,n){return k(e,t,n)},e.localize=function(e,r,t){void 0===t&&(t=e);var n=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),s=i&&i[n],o=n&&n.split("-")[0],a=i&&i[o],l=t;return s&&s[e]?l=s[e]:a&&a[e]&&(l=a[e]),r&&(l=l.replace(/\{(\d+)\}/g,function(e,t){var n=r[t-1],i=n;return"undefined"==typeof n&&(i=e),i})),l},e.contentEl=function(){return this.contentEl_||this.el_},e.id=function(){return this.id_},e.name=function(){return this.name_},e.children=function(){return this.children_},e.getChildById=function(e){return this.childIndex_[e]},e.getChild=function(e){if(e)return this.childNameIndex_[e]},e.getDescendant=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.reduce(function(e,t){return e.concat(t)},[]);for(var i=this,r=0;r<t.length;r++)if(!(i=i.getChild(t[r]))||!i.getChild)return;return i},e.addChild=function(e,t,n){var i,r;if(void 0===t&&(t={}),void 0===n&&(n=this.children_.length),"string"==typeof e){r=Oe(e);var s=t.componentClass||r;t.name=r;var o=c.getComponent(s);if(!o)throw new Error("Component "+s+" does not exist");if("function"!=typeof o)return null;i=new o(this.player_||this,t)}else i=e;if(i.parentComponent_&&i.parentComponent_.removeChild(i),this.children_.splice(n,0,i),i.parentComponent_=this,"function"==typeof i.id&&(this.childIndex_[i.id()]=i),(r=r||i.name&&Oe(i.name()))&&(this.childNameIndex_[r]=i,this.childNameIndex_[Me(r)]=i),"function"==typeof i.el&&i.el()){var a=null;this.children_[n+1]&&(this.children_[n+1].el_?a=this.children_[n+1].el_:_(this.children_[n+1])&&(a=this.children_[n+1])),this.contentEl().insertBefore(i.el(),a)}return i},e.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;0<=n;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Oe(e.name())]=null,this.childNameIndex_[Me(e.name())]=null;var i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},e.initChildren=function(){var r=this,i=this.options_.children;if(i){var e,s=this.options_,n=c.getComponent("Tech");(e=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter(function(t){return!e.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(e){var t,n;return n="string"==typeof e?i[t=e]||r.options_[t]||{}:(t=e.name,e),{name:t,opts:n}}).filter(function(e){var t=c.getComponent(e.opts.componentClass||Oe(e.name));return t&&!n.isTech(t)}).forEach(function(e){var t=e.name,n=e.opts;if(void 0!==s[t]&&(n=s[t]),!1!==n){!0===n&&(n={}),n.playerOptions=r.options_.playerOptions;var i=r.addChild(t,n);i&&(r[t]=i)}})}},e.buildCSSClass=function(){return""},e.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},e.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)},e.$=function(e,t){return q(e,t||this.contentEl())},e.$$=function(e,t){return X(e,t||this.contentEl())},e.hasClass=function(e){return w(this.el_,e)},e.addClass=function(e){S(this.el_,e)},e.removeClass=function(e){x(this.el_,e)},e.toggleClass=function(e,t){P(this.el_,e,t)},e.show=function(){this.removeClass("vjs-hidden")},e.hide=function(){this.addClass("vjs-hidden")},e.lockShowing=function(){this.addClass("vjs-lock-showing")},e.unlockShowing=function(){this.removeClass("vjs-lock-showing")},e.getAttribute=function(e){return I(this.el_,e)},e.setAttribute=function(e,t){M(this.el_,e,t)},e.removeAttribute=function(e){O(this.el_,e)},e.width=function(e,t){return this.dimension("width",e,t)},e.height=function(e,t){return this.dimension("height",e,t)},e.dimensions=function(e,t){this.width(e,!0),this.height(t)},e.dimension=function(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var i=this.el_.style[e],r=i.indexOf("px");return-1!==r?parseInt(i.slice(0,r),10):parseInt(this.el_["offset"+Oe(e)],10)},e.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=i(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var n="offset"+Oe(e);t=this.el_[n]}return t},e.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},e.currentWidth=function(){return this.currentDimension("width")},e.currentHeight=function(){return this.currentDimension("height")},e.focus=function(){this.el_.focus()},e.blur=function(){this.el_.blur()},e.handleKeyDown=function(e){this.player_&&(e.stopPropagation(),this.player_.handleKeyDown(e))},e.handleKeyPress=function(e){this.handleKeyDown(e)},e.emitTapEvents=function(){var i,t=0,r=null;this.on("touchstart",function(e){1===e.touches.length&&(r={pageX:e.touches[0].pageX,pageY:e.touches[0].pageY},t=h.performance.now(),i=!0)}),this.on("touchmove",function(e){if(1<e.touches.length)i=!1;else if(r){var t=e.touches[0].pageX-r.pageX,n=e.touches[0].pageY-r.pageY;10<Math.sqrt(t*t+n*n)&&(i=!1)}});function e(){i=!1}this.on("touchleave",e),this.on("touchcancel",e),this.on("touchend",function(e){!(r=null)===i&&h.performance.now()-t<200&&(e.preventDefault(),this.trigger("tap"))})},e.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var t,n=ge(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){n(),this.clearInterval(t),t=this.setInterval(n,250)});var e=function(e){n(),this.clearInterval(t)};this.on("touchmove",n),this.on("touchend",e),this.on("touchcancel",e)}},e.setTimeout=function(e,t){var n,i=this;return e=ge(this,e),this.clearTimersOnDispose_(),n=h.setTimeout(function(){i.setTimeoutIds_.has(n)&&i.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n},e.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),h.clearTimeout(e)),e},e.setInterval=function(e,t){e=ge(this,e),this.clearTimersOnDispose_();var n=h.setInterval(e,t);return this.setIntervalIds_.add(n),n},e.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),h.clearInterval(e)),e},e.requestAnimationFrame=function(e){var t,n=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=ge(this,e),t=h.requestAnimationFrame(function(){n.rafIds_.has(t)&&n.rafIds_.delete(t),e()}),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},e.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),h.cancelAnimationFrame(e)),e):this.clearTimeout(e)},e.clearTimersOnDispose_=function(){var i=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(e){var t=e[0],n=e[1];i[t].forEach(i[n],i)}),i.clearingTimersOnDispose_=!1}))},c.registerComponent=function(e,t){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var n,i=c.getComponent("Tech"),r=i&&i.isTech(t),s=c===t||c.prototype.isPrototypeOf(t.prototype);if(r||!s)throw n=r?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+e+'"; '+n+".");e=Oe(e),c.components_||(c.components_={});var o=c.getComponent("Player");if("Player"===e&&o&&o.players){var a=o.players,l=Object.keys(a);if(a&&0<l.length&&l.map(function(e){return a[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return c.components_[e]=t,c.components_[Me(e)]=t},c.getComponent=function(e){if(e&&c.components_)return c.components_[e]},c}();Ne.prototype.supportsRaf_="function"==typeof h.requestAnimationFrame&&"function"==typeof h.cancelAnimationFrame,Ne.registerComponent("Component",Ne);var De=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};t(function(t){function n(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=n=function(e){return typeof e}:t.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.exports=n}),t(function(t){function n(e){return t.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}t.exports=n});var Re,Be,Fe,He,Ve=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t},We=h.navigator&&h.navigator.userAgent||"",ze=/AppleWebKit\/([\d.]+)/i.exec(We),Ke=ze?parseFloat(ze.pop()):null,Ue=/iPod/i.test(We),qe=(Re=We.match(/OS (\d+)_/i))&&Re[1]?Re[1]:null,Xe=/Android/i.test(We),$e=function(){var e=We.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Ye=Xe&&$e<5&&Ke<537,Ge=/Firefox/i.test(We),Qe=/Edg/i.test(We),Je=!Qe&&(/Chrome/i.test(We)||/CriOS/i.test(We)),Ze=(Be=We.match(/(Chrome|CriOS)\/(\d+)/))&&Be[2]?parseFloat(Be[2]):null,et=(Fe=/MSIE\s(\d+)\.\d/.exec(We),!(He=Fe&&parseFloat(Fe[1]))&&/Trident\/7.0/i.test(We)&&/rv:11.0/.test(We)&&(He=11),He),tt=/Safari/i.test(We)&&!Je&&!Xe&&!Qe,nt=/Windows/i.test(We),it=m()&&("ontouchstart"in h||h.navigator.maxTouchPoints||h.DocumentTouch&&h.document instanceof h.DocumentTouch),rt=/iPad/i.test(We)||tt&&it&&!/iPhone/i.test(We),st=/iPhone/i.test(We)&&!rt,ot=st||rt||Ue,at=(tt||ot)&&!Je,lt=Object.freeze({__proto__:null,IS_IPOD:Ue,IOS_VERSION:qe,IS_ANDROID:Xe,ANDROID_VERSION:$e,IS_NATIVE_ANDROID:Ye,IS_FIREFOX:Ge,IS_EDGE:Qe,IS_CHROME:Je,CHROME_VERSION:Ze,IE_VERSION:et,IS_SAFARI:tt,IS_WINDOWS:nt,TOUCH_ENABLED:it,IS_IPAD:rt,IS_IPHONE:st,IS_IOS:ot,IS_ANY_SAFARI:at});function ct(e,t,n,i){return function(e,t,n){if("number"!=typeof t||t<0||n<t)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+n+").")}(e,i,n.length-1),n[i][t]}function ut(e){return void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:ct.bind(null,"start",0,e),end:ct.bind(null,"end",1,e)}}function ht(e,t){return Array.isArray(e)?ut(e):void 0===e||void 0===t?ut():ut([[e,t]])}function dt(e,t){var n,i,r=0;if(!t)return 0;e&&e.length||(e=ht(0,0));for(var s=0;s<e.length;s++)n=e.start(s),t<(i=e.end(s))&&(i=t),r+=i-n;return r/t}for(var pt,ft={prefixed:!0},vt=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],gt=vt[0],yt=0;yt<vt.length;yt++)if(vt[yt][1]in d){pt=vt[yt];break}if(pt){for(var mt=0;mt<pt.length;mt++)ft[gt[mt]]=pt[mt];ft.prefixed=pt[0]!==gt[0]}function _t(e){if(e instanceof _t)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:a(e)&&("number"==typeof e.code&&(this.code=e.code),g(this,e)),this.message||(this.message=_t.defaultMessages[this.code]||"")}_t.prototype.code=0,_t.prototype.message="",_t.prototype.status=null,_t.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],_t.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var bt=0;bt<_t.errorTypes.length;bt++)_t[_t.errorTypes[bt]]=bt,_t.prototype[_t.errorTypes[bt]]=bt;var Tt=function(e,t){var n,i=null;try{n=JSON.parse(e,t)}catch(e){i=e}return[i,n]};function kt(e){return null!=e&&"function"==typeof e.then}function Ct(e){kt(e)&&e.then(null,function(e){})}function Et(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(e,t,n){return i[t]&&(e[t]=i[t]),e},{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var wt=function(e){var t=e.$$("track"),n=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=Et(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===n.indexOf(e)}).map(Et))},St=function(e,n){return e.forEach(function(e){var t=n.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return t.addCue(e)})}),n.textTracks()},xt=t(function(e,t){function n(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return o[e];var n,i=String(e);return(n=r[i.toLowerCase()])?n:(n=s[i.toLowerCase()])||(1===i.length?i.charCodeAt(0):void 0)}n.isEventKey=function(e,t){if(e&&"object"==typeof e){var n=e.which||e.keyCode||e.charCode;if(null==n)return!1;if("string"==typeof t){var i;if(i=r[t.toLowerCase()])return i===n;if(i=s[t.toLowerCase()])return i===n}else if("number"==typeof t)return t===n;return!1}};var r=(t=e.exports=n).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},s=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(i=97;i<123;i++)r[String.fromCharCode(i)]=i-32;for(var i=48;i<58;i++)r[i-48]=i;for(i=1;i<13;i++)r["f"+i]=i+111;for(i=0;i<10;i++)r["numpad "+i]=i+96;var o=t.names=t.title={};for(i in r)o[r[i]]=i;for(var a in s)r[a]=s[a]}),Pt=(xt.code,xt.codes,xt.aliases,xt.names,xt.title,"vjs-modal-dialog"),jt=function(i){function e(e,t){var n;return(n=i.call(this,e,t)||this).opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=k("div",{className:Pt+"-content"},{role:"document"}),n.descEl_=k("p",{className:Pt+"-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),C(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}Ve(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},t.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,i.prototype.dispose.call(this)},t.buildCSSClass=function(){return Pt+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},t.label=function(){return this.localize(this.options_.label||"Modal Window")},t.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},t.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},t.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},t.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},t.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,n=this.getChild("closeButton");if(t&&!n){var i=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(n,"close",this.close)}!t&&n&&(this.off(n,"close",this.close),this.removeChild(n),n.dispose())}return this.closeable_},t.fill=function(){this.fillWith(this.content())},t.fillWith=function(e){var t=this.contentEl(),n=t.parentNode,i=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),z(t,e),this.trigger("modalfill"),i?n.insertBefore(t,i):n.appendChild(t);var r=this.getChild("closeButton");r&&n.appendChild(r.el_)},t.empty=function(){this.trigger("beforemodalempty"),H(this.contentEl()),this.trigger("modalempty")},t.content=function(e){return"undefined"!=typeof e&&(this.content_=e),this.content_},t.conditionalFocus_=function(){var e=d.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())},t.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},t.handleKeyDown=function(e){if(e.stopPropagation(),xt.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(xt.isEventKey(e,"Tab")){for(var t,n=this.focusableEls_(),i=this.el_.querySelector(":focus"),r=0;r<n.length;r++)if(i===n[r]){t=r;break}d.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||t!==n.length-1||(n[0].focus(),e.preventDefault())}},t.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,function(e){return(e instanceof h.HTMLAnchorElement||e instanceof h.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof h.HTMLInputElement||e instanceof h.HTMLSelectElement||e instanceof h.HTMLTextAreaElement||e instanceof h.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof h.HTMLIFrameElement||e instanceof h.HTMLObjectElement||e instanceof h.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")})},e}(Ne);jt.prototype.options_={pauseOnOpen:!0,temporary:!0},Ne.registerComponent("ModalDialog",jt);var At=function(i){function e(e){var t;void 0===e&&(e=[]),(t=i.call(this)||this).tracks_=[],Object.defineProperty(De(t),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<e.length;n++)t.addTrack(e[n]);return t}Ve(e,i);var t=e.prototype;return t.addTrack=function(e){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this}))},t.removeTrack=function(e){for(var t,n=0,i=this.length;n<i;n++)if(this[n]===e){(t=this[n]).off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},t.getTrackById=function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t},e}(me);for(var It in At.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"},At.prototype.allowedEvents_)At.prototype["on"+It]=null;function Mt(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].enabled=!1)}function Ot(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].selected=!1)}function Lt(e){var t=["protocol","hostname","port","pathname","search","hash","host"],n=d.createElement("a");n.href=e;var i,r=""===n.host&&"file:"!==n.protocol;r&&((i=d.createElement("div")).innerHTML='<a href="'+e+'"></a>',n=i.firstChild,i.setAttribute("style","display:none; position:absolute;"),d.body.appendChild(i));for(var s={},o=0;o<t.length;o++)s[t[o]]=n[t[o]];return"http:"===s.protocol&&(s.host=s.host.replace(/:80$/,"")),"https:"===s.protocol&&(s.host=s.host.replace(/:443$/,"")),s.protocol||(s.protocol=h.location.protocol),r&&d.body.removeChild(i),s}function Nt(e){if(!e.match(/^https?:\/\//)){var t=d.createElement("div");t.innerHTML='<a href="'+e+'">x</a>',e=t.firstChild.href}return e}function Dt(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""}function Rt(e,t){void 0===t&&(t=h.location);var n=Lt(e);return(":"===n.protocol?t.protocol:n.protocol)+n.host!==t.protocol+t.host}var Bt=function(i){function e(e){var t;void 0===e&&(e=[]);for(var n=e.length-1;0<=n;n--)if(e[n].enabled){Mt(e,e[n]);break}return(t=i.call(this,e)||this).changing_=!1,t}Ve(e,i);var t=e.prototype;return t.addTrack=function(e){var t=this;e.enabled&&Mt(this,e),i.prototype.addTrack.call(this,e),e.addEventListener&&(e.enabledChange_=function(){t.changing_||(t.changing_=!0,Mt(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))},t.removeTrack=function(e){i.prototype.removeTrack.call(this,e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)},e}(At),Ft=function(i){function e(e){var t;void 0===e&&(e=[]);for(var n=e.length-1;0<=n;n--)if(e[n].selected){Ot(e,e[n]);break}return(t=i.call(this,e)||this).changing_=!1,Object.defineProperty(De(t),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),t}Ve(e,i);var t=e.prototype;return t.addTrack=function(e){var t=this;e.selected&&Ot(this,e),i.prototype.addTrack.call(this,e),e.addEventListener&&(e.selectedChange_=function(){t.changing_||(t.changing_=!0,Ot(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))},t.removeTrack=function(e){i.prototype.removeTrack.call(this,e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)},e}(At),Ht=function(n){function e(){return n.apply(this,arguments)||this}Ve(e,n);var t=e.prototype;return t.addTrack=function(e){var t=this;n.prototype.addTrack.call(this,e),this.queueChange_||(this.queueChange_=function(){return t.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return t.trigger("selectedlanguagechange")}),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)},t.removeTrack=function(e){n.prototype.removeTrack.call(this,e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},e}(At),Vt=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,n=e.length;t<n;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t},t.removeTrackElement_=function(e){for(var t=0,n=this.trackElements_.length;t<n;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Wt=function(){function t(e){t.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var e=t.prototype;return e.setCues_=function(e){var t=this.length||0,n=0,i=e.length;this.cues_=e,this.length_=e.length;function r(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})}if(t<i)for(n=t;n<i;n++)r.call(this,n)},e.getCueById=function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t},t}(),zt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Kt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Ut={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},qt={disabled:"disabled",hidden:"hidden",showing:"showing"},Xt=function(s){function e(e){var t;void 0===e&&(e={}),t=s.call(this)||this;function n(e){Object.defineProperty(De(t),e,{get:function(){return i[e]},set:function(){}})}var i={id:e.id||"vjs_track_"+ie(),kind:e.kind||"",label:e.label||"",language:e.language||""};for(var r in i)n(r);return t}return Ve(e,s),e}(me),$t=Object.freeze({__proto__:null,parseUrl:Lt,getAbsoluteURL:Nt,getFileExtension:Dt,isCrossOrigin:Rt}),Yt=function(e){var t=Gt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)} /** * @license * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/> * Copyright (c) 2014 David Björklund * Available under the MIT license * <https://github.com/kesla/parse-headers/blob/master/LICENCE> */,Gt=Object.prototype.toString;var Qt=function(e){var r={};return e&&e.trim().split("\n").forEach(function(e){var t=e.indexOf(":"),n=e.slice(0,t).trim().toLowerCase(),i=e.slice(t+1).trim();"undefined"==typeof r[n]?r[n]=i:Array.isArray(r[n])?r[n].push(i):r[n]=[r[n],i]}),r},Jt=tn,Zt=tn;function en(e,t,n){var i=e;return Yt(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=r({},t,{uri:e}),i.callback=n,i}function tn(e,t,n){return nn(t=en(e,t,n))}function nn(i){if("undefined"==typeof i.callback)throw new Error("callback argument missing");var r=!1,s=function(e,t,n){r||(r=!0,i.callback(e,t,n))};function t(e){return clearTimeout(a),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,s(e,v)}function e(){if(!o){var e;clearTimeout(a),e=i.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var t=v,n=null;return 0!==e?(t={body:function(){var e=void 0;if(e=l.response?l.response:l.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(l),f)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:e,method:u,headers:{},url:c,rawRequest:l},l.getAllResponseHeaders&&(t.headers=Qt(l.getAllResponseHeaders()))):n=new Error("Internal XMLHttpRequest Error"),s(n,t,t.body)}}var n,o,a,l=i.xhr||null,c=(l=l||(i.cors||i.useXDR?new tn.XDomainRequest:new tn.XMLHttpRequest)).url=i.uri||i.url,u=l.method=i.method||"GET",h=i.body||i.data,d=l.headers=i.headers||{},p=!!i.sync,f=!1,v={body:void 0,headers:{},statusCode:0,method:u,url:c,rawRequest:l};if("json"in i&&!1!==i.json&&(f=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==u&&"HEAD"!==u&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===i.json?h:i.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(e,0)},l.onload=e,l.onerror=t,l.onprogress=function(){},l.onabort=function(){o=!0},l.ontimeout=t,l.open(u,c,!p,i.username,i.password),p||(l.withCredentials=!!i.withCredentials),!p&&0<i.timeout&&(a=setTimeout(function(){if(!o){o=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",t(e)}},i.timeout)),l.setRequestHeader)for(n in d)d.hasOwnProperty(n)&&l.setRequestHeader(n,d[n]);else if(i.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(l.responseType=i.responseType),"beforeSend"in i&&"function"==typeof i.beforeSend&&i.beforeSend(l),l.send(h||null),l}tn.XMLHttpRequest=h.XMLHttpRequest||function(){},tn.XDomainRequest="withCredentials"in new tn.XMLHttpRequest?tn.XMLHttpRequest:h.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(i){tn["delete"===i?"del":i]=function(e,t,n){return(t=en(e,t,n)).method=i.toUpperCase(),nn(t)}}),Jt.default=Zt;function rn(e,t){var n=new h.WebVTT.Parser(h,h.vttjs,h.WebVTT.StringDecoder()),i=[];n.oncue=function(e){t.addCue(e)},n.onparsingerror=function(e){i.push(e)},n.onflush=function(){t.trigger({type:"loadeddata",target:t})},n.parse(e),0<i.length&&(h.console&&h.console.groupCollapsed&&h.console.groupCollapsed("Text Track parsing errors for "+t.src),i.forEach(function(e){return f.error(e)}),h.console&&h.console.groupEnd&&h.console.groupEnd()),n.flush()}function sn(e,i){var t={uri:e},n=Rt(e);n&&(t.cors=n),Jt(t,ge(this,function(e,t,n){if(e)return f.error(e,t);i.loaded_=!0,"function"!=typeof h.WebVTT?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return rn(n,i);f.error("vttjs failed to load, stopping trying to process "+i.src)}):rn(n,i)}))}var on=function(c){function e(e){var t;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var n=Le(e,{kind:Ut[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=qt[n.mode]||"disabled