(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global.videojs=factory());}(this,(function(){var version="6.6.2";var commonjsGlobal=typeof window!=='undefined'?window:typeof global!=='undefined'?global:typeof self!=='undefined'?self:{};function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports;} var win;if(typeof window!=="undefined"){win=window;}else if(typeof commonjsGlobal!=="undefined"){win=commonjsGlobal;}else if(typeof self!=="undefined"){win=self;}else{win={};} var window_1=win;var empty={};var empty$1=(Object.freeze||Object)({'default':empty});var minDoc=(empty$1&&empty)||empty$1;var topLevel=typeof commonjsGlobal!=='undefined'?commonjsGlobal:typeof window!=='undefined'?window:{};var doccy;if(typeof document!=='undefined'){doccy=document;}else{doccy=topLevel['__GLOBAL_DOCUMENT_CACHE@4'];if(!doccy){doccy=topLevel['__GLOBAL_DOCUMENT_CACHE@4']=minDoc;}} var document_1=doccy;var USER_AGENT=window_1.navigator&&window_1.navigator.userAgent||'';var webkitVersionMap=/AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);var appleWebkitVersion=webkitVersionMap?parseFloat(webkitVersionMap.pop()):null;var IS_IPAD=/iPad/i.test(USER_AGENT);var IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD;var IS_IPOD=/iPod/i.test(USER_AGENT);var IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD;var IOS_VERSION=function(){var match=USER_AGENT.match(/OS (\d+)_/i);if(match&&match[1]){return match[1];} return null;}();var IS_ANDROID=/Android/i.test(USER_AGENT);var ANDROID_VERSION=function(){var match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match){return null;} var major=match[1]&&parseFloat(match[1]);var minor=match[2]&&parseFloat(match[2]);if(major&&minor){return parseFloat(match[1]+'.'+match[2]);}else if(major){return major;} return null;}();var IS_OLD_ANDROID=IS_ANDROID&&/webkit/i.test(USER_AGENT)&&ANDROID_VERSION<2.3;var IS_NATIVE_ANDROID=IS_ANDROID&&ANDROID_VERSION<5&&appleWebkitVersion<537;var IS_FIREFOX=/Firefox/i.test(USER_AGENT);var IS_EDGE=/Edge/i.test(USER_AGENT);var IS_CHROME=!IS_EDGE&&/Chrome/i.test(USER_AGENT);var CHROME_VERSION=function(){var match=USER_AGENT.match(/Chrome\/(\d+)/);if(match&&match[1]){return parseFloat(match[1]);} return null;}();var IS_IE8=/MSIE\s8\.0/.test(USER_AGENT);var IE_VERSION=function(){var result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT);var version=result&&parseFloat(result[1]);if(!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)){version=11.0;} return version;}();var IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE;var IS_ANY_SAFARI=IS_SAFARI||IS_IOS;var TOUCH_ENABLED=isReal()&&('ontouchstart'in window_1||window_1.DocumentTouch&&window_1.document instanceof window_1.DocumentTouch);var BACKGROUND_SIZE_SUPPORTED=isReal()&&'backgroundSize'in window_1.document.createElement('video').style;var browser=(Object.freeze||Object)({IS_IPAD:IS_IPAD,IS_IPHONE:IS_IPHONE,IS_IPOD:IS_IPOD,IS_IOS:IS_IOS,IOS_VERSION:IOS_VERSION,IS_ANDROID:IS_ANDROID,ANDROID_VERSION:ANDROID_VERSION,IS_OLD_ANDROID:IS_OLD_ANDROID,IS_NATIVE_ANDROID:IS_NATIVE_ANDROID,IS_FIREFOX:IS_FIREFOX,IS_EDGE:IS_EDGE,IS_CHROME:IS_CHROME,CHROME_VERSION:CHROME_VERSION,IS_IE8:IS_IE8,IE_VERSION:IE_VERSION,IS_SAFARI:IS_SAFARI,IS_ANY_SAFARI:IS_ANY_SAFARI,TOUCH_ENABLED:TOUCH_ENABLED,BACKGROUND_SIZE_SUPPORTED:BACKGROUND_SIZE_SUPPORTED});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};var classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}};var inherits=function(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);} subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;};var possibleConstructorReturn=function(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");} return call&&(typeof call==="object"||typeof call==="function")?call:self;};var taggedTemplateLiteralLoose=function(strings,raw){strings.raw=raw;return strings;};var toString=Object.prototype.toString;var keys=function keys(object){return isObject(object)?Object.keys(object):[];};function each(object,fn){keys(object).forEach(function(key){return fn(object[key],key);});} function reduce(object,fn){var initial=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;return keys(object).reduce(function(accum,key){return fn(accum,object[key],key);},initial);} function assign(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){sources[_key-1]=arguments[_key];} if(Object.assign){return Object.assign.apply(Object,[target].concat(sources));} sources.forEach(function(source){if(!source){return;} each(source,function(value,key){target[key]=value;});});return target;} function isObject(value){return!!value&&(typeof value==='undefined'?'undefined':_typeof(value))==='object';} function isPlain(value){return isObject(value)&&toString.call(value)==='[object Object]'&&value.constructor===Object;} var log=void 0;var level='info';var history=[];var logByType=function logByType(type,args){var stringify=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!!IE_VERSION&&IE_VERSION<11;var lvl=log.levels[level];var lvlRegExp=new RegExp('^('+lvl+')$');if(type!=='log'){args.unshift(type.toUpperCase()+':');} if(history){history.push([].concat(args));} args.unshift('VIDEOJS:');if(!window_1.console){return;} var fn=window_1.console[type];if(!fn&&type==='debug'){fn=window_1.console.info||window_1.console.log;} if(!fn||!lvl||!lvlRegExp.test(type)){return;} if(stringify){args=args.map(function(a){if(isObject(a)||Array.isArray(a)){try{return JSON.stringify(a);}catch(x){return String(a);}} return String(a);}).join(' ');} if(!fn.apply){fn(args);}else{fn[Array.isArray(args)?'apply':'call'](window_1.console,args);}};log=function log(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];} logByType('log',args);};log.levels={all:'debug|log|warn|error',off:'',debug:'debug|log|warn|error',info:'log|warn|error',warn:'warn|error',error:'error',DEFAULT:level};log.level=function(lvl){if(typeof lvl==='string'){if(!log.levels.hasOwnProperty(lvl)){throw new Error('"'+lvl+'" in not a valid log level');} level=lvl;} return level;};log.history=function(){return history?[].concat(history):[];};log.history.clear=function(){if(history){history.length=0;}};log.history.disable=function(){if(history!==null){history.length=0;history=null;}};log.history.enable=function(){if(history===null){history=[];}};log.error=function(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];} return logByType('error',args);};log.warn=function(){for(var _len3=arguments.length,args=Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];} return logByType('warn',args);};log.debug=function(){for(var _len4=arguments.length,args=Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];} return logByType('debug',args);};var log$1=log;function clean(s){return s.replace(/\n\r?\s*/g,'')} var tsml=function tsml(sa){var s='',i=0;for(;i0&&arguments[0]!==undefined?arguments[0]:'div';var properties=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var content=arguments[3];var el=document_1.createElement(tagName);Object.getOwnPropertyNames(properties).forEach(function(propName){var val=properties[propName];if(propName.indexOf('aria-')!==-1||propName==='role'||propName==='type'){log$1.warn(tsml(_templateObject,propName,val));el.setAttribute(propName,val);}else if(propName==='textContent'){textContent(el,val);}else{el[propName]=val;}});Object.getOwnPropertyNames(attributes).forEach(function(attrName){el.setAttribute(attrName,attributes[attrName]);});if(content){appendContent(el,content);} return el;} function textContent(el,text){if(typeof el.textContent==='undefined'){el.innerText=text;}else{el.textContent=text;} return el;} function prependTo(child,parent){if(parent.firstChild){parent.insertBefore(child,parent.firstChild);}else{parent.appendChild(child);}} function hasClass(element,classToCheck){throwIfWhitespace(classToCheck);if(element.classList){return element.classList.contains(classToCheck);} return classRegExp(classToCheck).test(element.className);} function addClass(element,classToAdd){if(element.classList){element.classList.add(classToAdd);}else if(!hasClass(element,classToAdd)){element.className=(element.className+' '+classToAdd).trim();} return element;} function removeClass(element,classToRemove){if(element.classList){element.classList.remove(classToRemove);}else{throwIfWhitespace(classToRemove);element.className=element.className.split(/\s+/).filter(function(c){return c!==classToRemove;}).join(' ');} return element;} function toggleClass(element,classToToggle,predicate){var has=hasClass(element,classToToggle);if(typeof predicate==='function'){predicate=predicate(element,classToToggle);} if(typeof predicate!=='boolean'){predicate=!has;} if(predicate===has){return;} if(predicate){addClass(element,classToToggle);}else{removeClass(element,classToToggle);} return element;} function setAttributes(el,attributes){Object.getOwnPropertyNames(attributes).forEach(function(attrName){var attrValue=attributes[attrName];if(attrValue===null||typeof attrValue==='undefined'||attrValue===false){el.removeAttribute(attrName);}else{el.setAttribute(attrName,attrValue===true?'':attrValue);}});} function getAttributes(tag){var obj={};var knownBooleans=','+'autoplay,controls,playsinline,loop,muted,default,defaultMuted'+',';if(tag&&tag.attributes&&tag.attributes.length>0){var attrs=tag.attributes;for(var i=attrs.length-1;i>=0;i--){var attrName=attrs[i].name;var attrVal=attrs[i].value;if(typeof tag[attrName]==='boolean'||knownBooleans.indexOf(','+attrName+',')!==-1){attrVal=attrVal!==null?true:false;} obj[attrName]=attrVal;}} return obj;} function getAttribute(el,attribute){return el.getAttribute(attribute);} function setAttribute(el,attribute,value){el.setAttribute(attribute,value);} function removeAttribute(el,attribute){el.removeAttribute(attribute);} function blockTextSelection(){document_1.body.focus();document_1.onselectstart=function(){return false;};} function unblockTextSelection(){document_1.onselectstart=function(){return true;};} function getBoundingClientRect(el){if(el&&el.getBoundingClientRect&&el.parentNode){var rect=el.getBoundingClientRect();var result={};['bottom','height','left','right','top','width'].forEach(function(k){if(rect[k]!==undefined){result[k]=rect[k];}});if(!result.height){result.height=parseFloat(computedStyle(el,'height'));} if(!result.width){result.width=parseFloat(computedStyle(el,'width'));} return result;}} function findPosition(el){var box=void 0;if(el.getBoundingClientRect&&el.parentNode){box=el.getBoundingClientRect();} if(!box){return{left:0,top:0};} var docEl=document_1.documentElement;var body=document_1.body;var clientLeft=docEl.clientLeft||body.clientLeft||0;var scrollLeft=window_1.pageXOffset||body.scrollLeft;var left=box.left+scrollLeft-clientLeft;var clientTop=docEl.clientTop||body.clientTop||0;var scrollTop=window_1.pageYOffset||body.scrollTop;var top=box.top+scrollTop-clientTop;return{left:Math.round(left),top:Math.round(top)};} function getPointerPosition(el,event){var position={};var box=findPosition(el);var boxW=el.offsetWidth;var boxH=el.offsetHeight;var boxY=box.top;var boxX=box.left;var pageY=event.pageY;var pageX=event.pageX;if(event.changedTouches){pageX=event.changedTouches[0].pageX;pageY=event.changedTouches[0].pageY;} position.y=Math.max(0,Math.min(1,(boxY-pageY+boxH)/boxH));position.x=Math.max(0,Math.min(1,(pageX-boxX)/boxW));return position;} function isTextNode(value){return isObject(value)&&value.nodeType===3;} function emptyEl(el){while(el.firstChild){el.removeChild(el.firstChild);} return el;} function normalizeContent(content){if(typeof content==='function'){content=content();} return(Array.isArray(content)?content:[content]).map(function(value){if(typeof value==='function'){value=value();} if(isEl(value)||isTextNode(value)){return value;} if(typeof value==='string'&&/\S/.test(value)){return document_1.createTextNode(value);}}).filter(function(value){return value;});} function appendContent(el,content){normalizeContent(content).forEach(function(node){return el.appendChild(node);});return el;} function insertContent(el,content){return appendContent(emptyEl(el),content);} function isSingleLeftClick(event){if(event.button===undefined&&event.buttons===undefined){return true;} if(event.button===0&&event.buttons===undefined){return true;} if(IE_VERSION===9){return true;} if(event.button!==0||event.buttons!==1){return false;} return true;} var $=createQuerier('querySelector');var $$=createQuerier('querySelectorAll');var Dom=(Object.freeze||Object)({isReal:isReal,isEl:isEl,isInFrame:isInFrame,createEl:createEl,textContent:textContent,prependTo:prependTo,hasClass:hasClass,addClass:addClass,removeClass:removeClass,toggleClass:toggleClass,setAttributes:setAttributes,getAttributes:getAttributes,getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,blockTextSelection:blockTextSelection,unblockTextSelection:unblockTextSelection,getBoundingClientRect:getBoundingClientRect,findPosition:findPosition,getPointerPosition:getPointerPosition,isTextNode:isTextNode,emptyEl:emptyEl,normalizeContent:normalizeContent,appendContent:appendContent,insertContent:insertContent,isSingleLeftClick:isSingleLeftClick,$:$,$$:$$});var _guid=1;function newGUID(){return _guid++;} var elData={};var elIdAttr='vdata'+new Date().getTime();function getData(el){var id=el[elIdAttr];if(!id){id=el[elIdAttr]=newGUID();} if(!elData[id]){elData[id]={};} return elData[id];} function hasData(el){var id=el[elIdAttr];if(!id){return false;} return!!Object.getOwnPropertyNames(elData[id]).length;} function removeData(el){var id=el[elIdAttr];if(!id){return;} delete elData[id];try{delete el[elIdAttr];}catch(e){if(el.removeAttribute){el.removeAttribute(elIdAttr);}else{el[elIdAttr]=null;}}} function _cleanUpEvents(elem,type){var data=getData(elem);if(data.handlers[type].length===0){delete data.handlers[type];if(elem.removeEventListener){elem.removeEventListener(type,data.dispatcher,false);}else if(elem.detachEvent){elem.detachEvent('on'+type,data.dispatcher);}} if(Object.getOwnPropertyNames(data.handlers).length<=0){delete data.handlers;delete data.dispatcher;delete data.disabled;} if(Object.getOwnPropertyNames(data).length===0){removeData(elem);}} function _handleMultipleEvents(fn,elem,types,callback){types.forEach(function(type){fn(elem,type,callback);});} function fixEvent(event){function returnTrue(){return true;} function returnFalse(){return false;} if(!event||!event.isPropagationStopped){var old=event||window_1.event;event={};for(var key in old){if(key!=='layerX'&&key!=='layerY'&&key!=='keyLocation'&&key!=='webkitMovementX'&&key!=='webkitMovementY'){if(!(key==='returnValue'&&old.preventDefault)){event[key]=old[key];}}} if(!event.target){event.target=event.srcElement||document_1;} if(!event.relatedTarget){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;} event.preventDefault=function(){if(old.preventDefault){old.preventDefault();} event.returnValue=false;old.returnValue=false;event.defaultPrevented=true;};event.defaultPrevented=false;event.stopPropagation=function(){if(old.stopPropagation){old.stopPropagation();} event.cancelBubble=true;old.cancelBubble=true;event.isPropagationStopped=returnTrue;};event.isPropagationStopped=returnFalse;event.stopImmediatePropagation=function(){if(old.stopImmediatePropagation){old.stopImmediatePropagation();} event.isImmediatePropagationStopped=returnTrue;event.stopPropagation();};event.isImmediatePropagationStopped=returnFalse;if(event.clientX!==null&&event.clientX!==undefined){var doc=document_1.documentElement;var body=document_1.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);} event.which=event.charCode||event.keyCode;if(event.button!==null&&event.button!==undefined){event.button=event.button&1?0:event.button&4?1:event.button&2?2:0;}} return event;} var _supportsPassive=false;(function(){try{var opts=Object.defineProperty({},'passive',{get:function get(){_supportsPassive=true;}});window_1.addEventListener('test',null,opts);window_1.removeEventListener('test',null,opts);}catch(e){}})();var passiveEvents=['touchstart','touchmove'];function on(elem,type,fn){if(Array.isArray(type)){return _handleMultipleEvents(on,elem,type,fn);} var data=getData(elem);if(!data.handlers){data.handlers={};} if(!data.handlers[type]){data.handlers[type]=[];} if(!fn.guid){fn.guid=newGUID();} data.handlers[type].push(fn);if(!data.dispatcher){data.disabled=false;data.dispatcher=function(event,hash){if(data.disabled){return;} event=fixEvent(event);var handlers=data.handlers[event.type];if(handlers){var handlersCopy=handlers.slice(0);for(var m=0,n=handlersCopy.length;m-1){options={passive:true};} elem.addEventListener(type,data.dispatcher,options);}else if(elem.attachEvent){elem.attachEvent('on'+type,data.dispatcher);}}} function off(elem,type,fn){if(!hasData(elem)){return;} var data=getData(elem);if(!data.handlers){return;} if(Array.isArray(type)){return _handleMultipleEvents(off,elem,type,fn);} var removeType=function removeType(el,t){data.handlers[t]=[];_cleanUpEvents(el,t);};if(type===undefined){for(var t in data.handlers){if(Object.prototype.hasOwnProperty.call(data.handlers||{},t)){removeType(elem,t);}} return;} var handlers=data.handlers[type];if(!handlers){return;} if(!fn){removeType(elem,type);return;} if(fn.guid){for(var n=0;n0){for(var i=0,e=vids.length;i0){for(var _i=0,_e=audios.length;_i<_e;_i++){mediaEls.push(audios[_i]);}} if(divs&&divs.length>0){for(var _i2=0,_e2=divs.length;_i2<_e2;_i2++){mediaEls.push(divs[_i2]);}} if(mediaEls&&mediaEls.length>0){for(var _i3=0,_e3=mediaEls.length;_i3<_e3;_i3++){var mediaEl=mediaEls[_i3];if(mediaEl&&mediaEl.getAttribute){if(mediaEl.player===undefined){var options=mediaEl.getAttribute('data-setup');if(options!==null){videojs$2(mediaEl);}}}else{autoSetupTimeout(1);break;}}}else if(!_windowLoaded){autoSetupTimeout(1);}};function autoSetupTimeout(wait,vjs){if(vjs){videojs$2=vjs;} window_1.setTimeout(autoSetup,wait);} if(isReal()&&document_1.readyState==='complete'){_windowLoaded=true;}else{one(window_1,'load',function(){_windowLoaded=true;});} var createStyleElement=function createStyleElement(className){var style=document_1.createElement('style');style.className=className;return style;};var setTextContent=function setTextContent(el,content){if(el.styleSheet){el.styleSheet.cssText=content;}else{el.textContent=content;}};var bind=function bind(context,fn,uid){if(!fn.guid){fn.guid=newGUID();} var bound=function bound(){return fn.apply(context,arguments);};bound.guid=uid?uid+'_'+fn.guid:fn.guid;return bound;};var throttle=function throttle(fn,wait){var last=Date.now();var throttled=function throttled(){var now=Date.now();if(now-last>=wait){fn.apply(undefined,arguments);last=now;}};return throttled;};var EventTarget=function EventTarget(){};EventTarget.prototype.allowedEvents_={};EventTarget.prototype.on=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){};on(this,type,fn);this.addEventListener=ael;};EventTarget.prototype.addEventListener=EventTarget.prototype.on;EventTarget.prototype.off=function(type,fn){off(this,type,fn);};EventTarget.prototype.removeEventListener=EventTarget.prototype.off;EventTarget.prototype.one=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){};one(this,type,fn);this.addEventListener=ael;};EventTarget.prototype.trigger=function(event){var type=event.type||event;if(typeof event==='string'){event={type:type};} event=fixEvent(event);if(this.allowedEvents_[type]&&this['on'+type]){this['on'+type](event);} trigger(this,event);};EventTarget.prototype.dispatchEvent=EventTarget.prototype.trigger;var isEvented=function isEvented(object){return object instanceof EventTarget||!!object.eventBusEl_&&['on','one','off','trigger'].every(function(k){return typeof object[k]==='function';});};var isValidEventType=function isValidEventType(type){return(typeof type==='string'&&/\S/.test(type)||Array.isArray(type)&&!!type.length);};var validateTarget=function validateTarget(target){if(!target.nodeName&&!isEvented(target)){throw new Error('Invalid target; must be a DOM node or evented object.');}};var validateEventType=function validateEventType(type){if(!isValidEventType(type)){throw new Error('Invalid event type; must be a non-empty string or array.');}};var validateListener=function validateListener(listener){if(typeof listener!=='function'){throw new Error('Invalid listener; must be a function.');}};var normalizeListenArgs=function normalizeListenArgs(self,args){var isTargetingSelf=args.length<3||args[0]===self||args[0]===self.eventBusEl_;var target=void 0;var type=void 0;var listener=void 0;if(isTargetingSelf){target=self.eventBusEl_;if(args.length>=3){args.shift();} type=args[0];listener=args[1];}else{target=args[0];type=args[1];listener=args[2];} validateTarget(target);validateEventType(type);validateListener(listener);listener=bind(self,listener);return{isTargetingSelf:isTargetingSelf,target:target,type:type,listener:listener};};var listen=function listen(target,method,type,listener){validateTarget(target);if(target.nodeName){Events[method](target,type,listener);}else{target[method](type,listener);}};var EventedMixin={on:function on$$1(){var _this=this;for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];} var _normalizeListenArgs=normalizeListenArgs(this,args),isTargetingSelf=_normalizeListenArgs.isTargetingSelf,target=_normalizeListenArgs.target,type=_normalizeListenArgs.type,listener=_normalizeListenArgs.listener;listen(target,'on',type,listener);if(!isTargetingSelf){var removeListenerOnDispose=function removeListenerOnDispose(){return _this.off(target,type,listener);};removeListenerOnDispose.guid=listener.guid;var removeRemoverOnTargetDispose=function removeRemoverOnTargetDispose(){return _this.off('dispose',removeListenerOnDispose);};removeRemoverOnTargetDispose.guid=listener.guid;listen(this,'on','dispose',removeListenerOnDispose);listen(target,'on','dispose',removeRemoverOnTargetDispose);}},one:function one$$1(){var _this2=this;for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];} var _normalizeListenArgs2=normalizeListenArgs(this,args),isTargetingSelf=_normalizeListenArgs2.isTargetingSelf,target=_normalizeListenArgs2.target,type=_normalizeListenArgs2.type,listener=_normalizeListenArgs2.listener;if(isTargetingSelf){listen(target,'one',type,listener);}else{var wrapper=function wrapper(){for(var _len3=arguments.length,largs=Array(_len3),_key3=0;_key3<_len3;_key3++){largs[_key3]=arguments[_key3];} _this2.off(target,type,wrapper);listener.apply(null,largs);};wrapper.guid=listener.guid;listen(target,'one',type,wrapper);}},off:function off$$1(targetOrType,typeOrListener,listener){if(!targetOrType||isValidEventType(targetOrType)){off(this.eventBusEl_,targetOrType,typeOrListener);}else{var target=targetOrType;var type=typeOrListener;validateTarget(target);validateEventType(type);validateListener(listener);listener=bind(this,listener);this.off('dispose',listener);if(target.nodeName){off(target,type,listener);off(target,'dispose',listener);}else if(isEvented(target)){target.off(type,listener);target.off('dispose',listener);}}},trigger:function trigger$$1(event,hash){return trigger(this.eventBusEl_,event,hash);}};function evented(target){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var eventBusKey=options.eventBusKey;if(eventBusKey){if(!target[eventBusKey].nodeName){throw new Error('The eventBusKey "'+eventBusKey+'" does not refer to an element.');} target.eventBusEl_=target[eventBusKey];}else{target.eventBusEl_=createEl('span',{className:'vjs-event-bus'});} assign(target,EventedMixin);target.on('dispose',function(){target.off();window_1.setTimeout(function(){target.eventBusEl_=null;},0);});return target;} var StatefulMixin={state:{},setState:function setState(stateUpdates){var _this=this;if(typeof stateUpdates==='function'){stateUpdates=stateUpdates();} var changes=void 0;each(stateUpdates,function(value,key){if(_this.state[key]!==value){changes=changes||{};changes[key]={from:_this.state[key],to:value};} _this.state[key]=value;});if(changes&&isEvented(this)){this.trigger({changes:changes,type:'statechanged'});} return changes;}};function stateful(target,defaultState){assign(target,StatefulMixin);target.state=assign({},target.state,defaultState);if(typeof target.handleStateChanged==='function'&&isEvented(target)){target.on('statechanged',target.handleStateChanged);} return target;} function toTitleCase(string){if(typeof string!=='string'){return string;} return string.charAt(0).toUpperCase()+string.slice(1);} function titleCaseEquals(str1,str2){return toTitleCase(str1)===toTitleCase(str2);} function mergeOptions(){var result={};for(var _len=arguments.length,sources=Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];} sources.forEach(function(source){if(!source){return;} each(source,function(value,key){if(!isPlain(value)){result[key]=value;return;} if(!isPlain(result[key])){result[key]={};} result[key]=mergeOptions(result[key],value);});});return result;} var Component=function(){function Component(player,options,ready){classCallCheck(this,Component);if(!player&&this.play){this.player_=player=this;}else{this.player_=player;} this.options_=mergeOptions({},this.options_);options=this.options_=mergeOptions(this.options_,options);this.id_=options.id||options.el&&options.el.id;if(!this.id_){var id=player&&player.id&&player.id()||'no_player';this.id_=id+'_component_'+newGUID();} this.name_=options.name||null;if(options.el){this.el_=options.el;}else if(options.createEl!==false){this.el_=this.createEl();} if(options.evented!==false){evented(this,{eventBusKey:this.el_?'el_':null});} stateful(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};if(options.initChildren!==false){this.initChildren();} this.ready(ready);if(options.reportTouchActivity!==false){this.enableTouchActivity();}} Component.prototype.dispose=function dispose(){this.trigger({type:'dispose',bubbles:false});if(this.children_){for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i].dispose){this.children_[i].dispose();}}} this.children_=null;this.childIndex_=null;this.childNameIndex_=null;if(this.el_){if(this.el_.parentNode){this.el_.parentNode.removeChild(this.el_);} removeData(this.el_);this.el_=null;} this.player_=null;};Component.prototype.player=function player(){return this.player_;};Component.prototype.options=function options(obj){log$1.warn('this.options() has been deprecated and will be moved to the constructor in 6.0');if(!obj){return this.options_;} this.options_=mergeOptions(this.options_,obj);return this.options_;};Component.prototype.el=function el(){return this.el_;};Component.prototype.createEl=function createEl$$1(tagName,properties,attributes){return createEl(tagName,properties,attributes);};Component.prototype.localize=function localize(string,tokens){var defaultValue=arguments.length>2&&arguments[2]!==undefined?arguments[2]:string;var code=this.player_.language&&this.player_.language();var languages=this.player_.languages&&this.player_.languages();var language=languages&&languages[code];var primaryCode=code&&code.split('-')[0];var primaryLang=languages&&languages[primaryCode];var localizedString=defaultValue;if(language&&language[string]){localizedString=language[string];}else if(primaryLang&&primaryLang[string]){localizedString=primaryLang[string];} if(tokens){localizedString=localizedString.replace(/\{(\d+)\}/g,function(match,index){var value=tokens[index-1];var ret=value;if(typeof value==='undefined'){ret=match;} return ret;});} return localizedString;};Component.prototype.contentEl=function contentEl(){return this.contentEl_||this.el_;};Component.prototype.id=function id(){return this.id_;};Component.prototype.name=function name(){return this.name_;};Component.prototype.children=function children(){return this.children_;};Component.prototype.getChildById=function getChildById(id){return this.childIndex_[id];};Component.prototype.getChild=function getChild(name){if(!name){return;} name=toTitleCase(name);return this.childNameIndex_[name];};Component.prototype.addChild=function addChild(child){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var index=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.children_.length;var component=void 0;var componentName=void 0;if(typeof child==='string'){componentName=toTitleCase(child);var componentClassName=options.componentClass||componentName;options.name=componentName;var ComponentClass=Component.getComponent(componentClassName);if(!ComponentClass){throw new Error('Component '+componentClassName+' does not exist');} if(typeof ComponentClass!=='function'){return null;} component=new ComponentClass(this.player_||this,options);}else{component=child;} this.children_.splice(index,0,component);if(typeof component.id==='function'){this.childIndex_[component.id()]=component;} componentName=componentName||component.name&&toTitleCase(component.name());if(componentName){this.childNameIndex_[componentName]=component;} if(typeof component.el==='function'&&component.el()){var childNodes=this.contentEl().children;var refNode=childNodes[index]||null;this.contentEl().insertBefore(component.el(),refNode);} return component;};Component.prototype.removeChild=function removeChild(component){if(typeof component==='string'){component=this.getChild(component);} if(!component||!this.children_){return;} var childFound=false;for(var i=this.children_.length-1;i>=0;i--){if(this.children_[i]===component){childFound=true;this.children_.splice(i,1);break;}} if(!childFound){return;} this.childIndex_[component.id()]=null;this.childNameIndex_[component.name()]=null;var compEl=component.el();if(compEl&&compEl.parentNode===this.contentEl()){this.contentEl().removeChild(component.el());}};Component.prototype.initChildren=function initChildren(){var _this=this;var children=this.options_.children;if(children){var parentOptions=this.options_;var handleAdd=function handleAdd(child){var name=child.name;var opts=child.opts;if(parentOptions[name]!==undefined){opts=parentOptions[name];} if(opts===false){return;} if(opts===true){opts={};} opts.playerOptions=_this.options_.playerOptions;var newChild=_this.addChild(name,opts);if(newChild){_this[name]=newChild;}};var workingChildren=void 0;var Tech=Component.getComponent('Tech');if(Array.isArray(children)){workingChildren=children;}else{workingChildren=Object.keys(children);} workingChildren.concat(Object.keys(this.options_).filter(function(child){return!workingChildren.some(function(wchild){if(typeof wchild==='string'){return child===wchild;} return child===wchild.name;});})).map(function(child){var name=void 0;var opts=void 0;if(typeof child==='string'){name=child;opts=children[name]||_this.options_[name]||{};}else{name=child.name;opts=child;} return{name:name,opts:opts};}).filter(function(child){var c=Component.getComponent(child.opts.componentClass||toTitleCase(child.name));return c&&!Tech.isTech(c);}).forEach(handleAdd);}};Component.prototype.buildCSSClass=function buildCSSClass(){return '';};Component.prototype.ready=function ready(fn){var sync=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!fn){return;} if(!this.isReady_){this.readyQueue_=this.readyQueue_||[];this.readyQueue_.push(fn);return;} if(sync){fn.call(this);}else{this.setTimeout(fn,1);}};Component.prototype.triggerReady=function triggerReady(){this.isReady_=true;this.setTimeout(function(){var readyQueue=this.readyQueue_;this.readyQueue_=[];if(readyQueue&&readyQueue.length>0){readyQueue.forEach(function(fn){fn.call(this);},this);} this.trigger('ready');},1);};Component.prototype.$=function $$$1(selector,context){return $(selector,context||this.contentEl());};Component.prototype.$$=function $$$$1(selector,context){return $$(selector,context||this.contentEl());};Component.prototype.hasClass=function hasClass$$1(classToCheck){return hasClass(this.el_,classToCheck);};Component.prototype.addClass=function addClass$$1(classToAdd){addClass(this.el_,classToAdd);};Component.prototype.removeClass=function removeClass$$1(classToRemove){removeClass(this.el_,classToRemove);};Component.prototype.toggleClass=function toggleClass$$1(classToToggle,predicate){toggleClass(this.el_,classToToggle,predicate);};Component.prototype.show=function show(){this.removeClass('vjs-hidden');};Component.prototype.hide=function hide(){this.addClass('vjs-hidden');};Component.prototype.lockShowing=function lockShowing(){this.addClass('vjs-lock-showing');};Component.prototype.unlockShowing=function unlockShowing(){this.removeClass('vjs-lock-showing');};Component.prototype.getAttribute=function getAttribute$$1(attribute){return getAttribute(this.el_,attribute);};Component.prototype.setAttribute=function setAttribute$$1(attribute,value){setAttribute(this.el_,attribute,value);};Component.prototype.removeAttribute=function removeAttribute$$1(attribute){removeAttribute(this.el_,attribute);};Component.prototype.width=function width(num,skipListeners){return this.dimension('width',num,skipListeners);};Component.prototype.height=function height(num,skipListeners){return this.dimension('height',num,skipListeners);};Component.prototype.dimensions=function dimensions(width,height){this.width(width,true);this.height(height);};Component.prototype.dimension=function dimension(widthOrHeight,num,skipListeners){if(num!==undefined){if(num===null||num!==num){num=0;} if((''+num).indexOf('%')!==-1||(''+num).indexOf('px')!==-1){this.el_.style[widthOrHeight]=num;}else if(num==='auto'){this.el_.style[widthOrHeight]='';}else{this.el_.style[widthOrHeight]=num+'px';} if(!skipListeners){this.trigger('componentresize');} return;} if(!this.el_){return 0;} var val=this.el_.style[widthOrHeight];var pxIndex=val.indexOf('px');if(pxIndex!==-1){return parseInt(val.slice(0,pxIndex),10);} return parseInt(this.el_['offset'+toTitleCase(widthOrHeight)],10);};Component.prototype.currentDimension=function currentDimension(widthOrHeight){var computedWidthOrHeight=0;if(widthOrHeight!=='width'&&widthOrHeight!=='height'){throw new Error('currentDimension only accepts width or height value');} if(typeof window_1.getComputedStyle==='function'){var computedStyle=window_1.getComputedStyle(this.el_);computedWidthOrHeight=computedStyle.getPropertyValue(widthOrHeight)||computedStyle[widthOrHeight];} computedWidthOrHeight=parseFloat(computedWidthOrHeight);if(computedWidthOrHeight===0){var rule='offset'+toTitleCase(widthOrHeight);computedWidthOrHeight=this.el_[rule];} return computedWidthOrHeight;};Component.prototype.currentDimensions=function currentDimensions(){return{width:this.currentDimension('width'),height:this.currentDimension('height')};};Component.prototype.currentWidth=function currentWidth(){return this.currentDimension('width');};Component.prototype.currentHeight=function currentHeight(){return this.currentDimension('height');};Component.prototype.focus=function focus(){this.el_.focus();};Component.prototype.blur=function blur(){this.el_.blur();};Component.prototype.emitTapEvents=function emitTapEvents(){var touchStart=0;var firstTouch=null;var tapMovementThreshold=10;var touchTimeThreshold=200;var couldBeTap=void 0;this.on('touchstart',function(event){if(event.touches.length===1){firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY};touchStart=new Date().getTime();couldBeTap=true;}});this.on('touchmove',function(event){if(event.touches.length>1){couldBeTap=false;}else if(firstTouch){var xdiff=event.touches[0].pageX-firstTouch.pageX;var ydiff=event.touches[0].pageY-firstTouch.pageY;var touchDistance=Math.sqrt(xdiff*xdiff+ydiff*ydiff);if(touchDistance>tapMovementThreshold){couldBeTap=false;}}});var noTap=function noTap(){couldBeTap=false;};this.on('touchleave',noTap);this.on('touchcancel',noTap);this.on('touchend',function(event){firstTouch=null;if(couldBeTap===true){var touchTime=new Date().getTime()-touchStart;if(touchTime0&&playerNames.map(function(pname){return players[pname];}).every(Boolean)){throw new Error('Can not register Player component after player has been created.');}} Component.components_[name]=ComponentToRegister;return ComponentToRegister;};Component.getComponent=function getComponent(name){if(!name){return;} name=toTitleCase(name);if(Component.components_&&Component.components_[name]){return Component.components_[name];}};return Component;}();Component.prototype.supportsRaf_=typeof window_1.requestAnimationFrame==='function'&&typeof window_1.cancelAnimationFrame==='function';Component.registerComponent('Component',Component);function rangeCheck(fnName,index,maxIndex){if(typeof index!=='number'||index<0||index>maxIndex){throw new Error('Failed to execute \''+fnName+'\' on \'TimeRanges\': The index provided ('+index+') is non-numeric or out of bounds (0-'+maxIndex+').');}} function getRange(fnName,valueIndex,ranges,rangeIndex){rangeCheck(fnName,rangeIndex,ranges.length-1);return ranges[rangeIndex][valueIndex];} function createTimeRangesObj(ranges){if(ranges===undefined||ranges.length===0){return{length:0,start:function start(){throw new Error('This TimeRanges object is empty');},end:function end(){throw new Error('This TimeRanges object is empty');}};} return{length:ranges.length,start:getRange.bind(null,'start',0,ranges),end:getRange.bind(null,'end',1,ranges)};} function createTimeRanges(start,end){if(Array.isArray(start)){return createTimeRangesObj(start);}else if(start===undefined||end===undefined){return createTimeRangesObj();} return createTimeRangesObj([[start,end]]);} function bufferedPercent(buffered,duration){var bufferedDuration=0;var start=void 0;var end=void 0;if(!duration){return 0;} if(!buffered||!buffered.length){buffered=createTimeRanges(0,0);} for(var i=0;iduration){end=duration;} bufferedDuration+=end-start;} return bufferedDuration/duration;} var FullscreenApi={};var apiMap=[['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']];var specApi=apiMap[0];var browserApi=void 0;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:[];var _ret;var list=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;classCallCheck(this,TrackList);var _this=possibleConstructorReturn(this,_EventTarget.call(this));if(!list){list=_this;if(IS_IE8){list=document_1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}}}} list.tracks_=[];Object.defineProperty(list,'length',{get:function get$$1(){return this.tracks_.length;}});for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,AudioTrackList);var list=void 0;for(var i=tracks.length-1;i>=0;i--){if(tracks[i].enabled){disableOthers(tracks,tracks[i]);break;}} if(IS_IE8){list=document_1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}} for(var _prop in AudioTrackList.prototype){if(_prop!=='constructor'){list[_prop]=AudioTrackList.prototype[_prop];}}} list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);list.changing_=false;return _ret=list,possibleConstructorReturn(_this,_ret);} AudioTrackList.prototype.addTrack=function addTrack(track){var _this2=this;if(track.enabled){disableOthers(this,track);} _TrackList.prototype.addTrack.call(this,track);if(!track.addEventListener){return;} track.addEventListener('enabledchange',function(){if(_this2.changing_){return;} _this2.changing_=true;disableOthers(_this2,track);_this2.changing_=false;_this2.trigger('change');});};return AudioTrackList;}(TrackList);var disableOthers$1=function disableOthers(list,track){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,VideoTrackList);var list=void 0;for(var i=tracks.length-1;i>=0;i--){if(tracks[i].selected){disableOthers$1(tracks,tracks[i]);break;}} if(IS_IE8){list=document_1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}} for(var _prop in VideoTrackList.prototype){if(_prop!=='constructor'){list[_prop]=VideoTrackList.prototype[_prop];}}} list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);list.changing_=false;Object.defineProperty(list,'selectedIndex',{get:function get$$1(){for(var _i=0;_i0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,TextTrackList);var list=void 0;if(IS_IE8){list=document_1.createElement('custom');for(var prop in TrackList.prototype){if(prop!=='constructor'){list[prop]=TrackList.prototype[prop];}} for(var _prop in TextTrackList.prototype){if(_prop!=='constructor'){list[_prop]=TextTrackList.prototype[_prop];}}} list=(_this=possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_this);return _ret=list,possibleConstructorReturn(_this,_ret);} TextTrackList.prototype.addTrack=function addTrack(track){_TrackList.prototype.addTrack.call(this,track);track.addEventListener('modechange',bind(this,function(){this.trigger('change');}));var nonLanguageTextTrackKind=['metadata','chapters'];if(nonLanguageTextTrackKind.indexOf(track.kind)===-1){track.addEventListener('modechange',bind(this,function(){this.trigger('selectedlanguagechange');}));}};return TextTrackList;}(TrackList);var HtmlTrackElementList=function(){function HtmlTrackElementList(){var trackElements=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];classCallCheck(this,HtmlTrackElementList);var list=this;if(IS_IE8){list=document_1.createElement('custom');for(var prop in HtmlTrackElementList.prototype){if(prop!=='constructor'){list[prop]=HtmlTrackElementList.prototype[prop];}}} list.trackElements_=[];Object.defineProperty(list,'length',{get:function get$$1(){return this.trackElements_.length;}});for(var i=0,length=trackElements.length;i0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,Track);var _this=possibleConstructorReturn(this,_EventTarget.call(this));var track=_this;if(IS_IE8){track=document_1.createElement('custom');for(var prop in Track.prototype){if(prop!=='constructor'){track[prop]=Track.prototype[prop];}}} var trackProps={id:options.id||'vjs_track_'+newGUID(),kind:options.kind||'',label:options.label||'',language:options.language||''};var _loop=function _loop(key){Object.defineProperty(track,key,{get:function get$$1(){return trackProps[key];},set:function set$$1(){}});};for(var key in trackProps){_loop(key);} return _ret=track,possibleConstructorReturn(_this,_ret);} return Track;}(EventTarget);var parseUrl=function parseUrl(url){var props=['protocol','hostname','port','pathname','search','hash','host'];var a=document_1.createElement('a');a.href=url;var addToBody=a.host===''&&a.protocol!=='file:';var div=void 0;if(addToBody){div=document_1.createElement('div');div.innerHTML='';a=div.firstChild;div.setAttribute('style','display:none; position:absolute;');document_1.body.appendChild(div);} var details={};for(var i=0;ix';url=div.firstChild.href;} return url;};var getFileExtension=function getFileExtension(path){if(typeof path==='string'){var splitPathRe=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i;var pathParts=splitPathRe.exec(path);if(pathParts){return pathParts.pop().toLowerCase();}} return '';};var isCrossOrigin=function isCrossOrigin(url){var winLoc=window_1.location;var urlInfo=parseUrl(url);var srcProtocol=urlInfo.protocol===':'?winLoc.protocol:urlInfo.protocol;var crossOrigin=srcProtocol+urlInfo.host!==winLoc.protocol+winLoc.host;return crossOrigin;};var Url=(Object.freeze||Object)({parseUrl:parseUrl,getAbsoluteURL:getAbsoluteURL,getFileExtension:getFileExtension,isCrossOrigin:isCrossOrigin});var isFunction_1=isFunction;var toString$1=Object.prototype.toString;function isFunction(fn){var string=toString$1.call(fn);return string==='[object Function]'||(typeof fn==='function'&&string!=='[object RegExp]')||(typeof window!=='undefined'&&(fn===window.setTimeout||fn===window.alert||fn===window.confirm||fn===window.prompt))} var trim_1=createCommonjsModule(function(module,exports){exports=module.exports=trim;function trim(str){return str.replace(/^\s*|\s*$/g,'');} exports.left=function(str){return str.replace(/^\s*/,'');};exports.right=function(str){return str.replace(/\s*$/,'');};});var forEach_1=forEach;var toString$2=Object.prototype.toString;var hasOwnProperty=Object.prototype.hasOwnProperty;function forEach(list,iterator,context){if(!isFunction_1(iterator)){throw new TypeError('iterator must be a function')} if(arguments.length<3){context=this;} if(toString$2.call(list)==='[object Array]') forEachArray$1(list,iterator,context);else if(typeof list==='string') forEachString(list,iterator,context);else forEachObject(list,iterator,context);} function forEachArray$1(array,iterator,context){for(var i=0,len=array.length;i0){timeoutTimer=setTimeout(function(){if(aborted)return aborted=true;xhr.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT";errorFunc(e);},options.timeout);} if(xhr.setRequestHeader){for(key in headers){if(headers.hasOwnProperty(key)){xhr.setRequestHeader(key,headers[key]);}}}else if(options.headers&&!isEmpty(options.headers)){throw new Error("Headers cannot be set on an XDomainRequest object")} if("responseType"in options){xhr.responseType=options.responseType;} if("beforeSend"in options&&typeof options.beforeSend==="function"){options.beforeSend(xhr);} xhr.send(body||null);return xhr} function getXml(xhr){if(xhr.responseType==="document"){return xhr.responseXML} var firefoxBugTakenEffect=xhr.responseXML&&xhr.responseXML.documentElement.nodeName==="parsererror";if(xhr.responseType===""&&!firefoxBugTakenEffect){return xhr.responseXML} return null} function noop(){} var parseCues=function parseCues(srcContent,track){var parser=new window_1.WebVTT.Parser(window_1,window_1.vttjs,window_1.WebVTT.StringDecoder());var errors=[];parser.oncue=function(cue){track.addCue(cue);};parser.onparsingerror=function(error){errors.push(error);};parser.onflush=function(){track.trigger({type:'loadeddata',target:track});};parser.parse(srcContent);if(errors.length>0){if(window_1.console&&window_1.console.groupCollapsed){window_1.console.groupCollapsed('Text Track parsing errors for '+track.src);} errors.forEach(function(error){return log$1.error(error);});if(window_1.console&&window_1.console.groupEnd){window_1.console.groupEnd();}} parser.flush();};var loadTrack=function loadTrack(src,track){var opts={uri:src};var crossOrigin=isCrossOrigin(src);if(crossOrigin){opts.cors=crossOrigin;} xhr(opts,bind(this,function(err,response,responseBody){if(err){return log$1.error(err,response);} track.loaded_=true;if(typeof window_1.WebVTT!=='function'){if(track.tech_){var loadHandler=function loadHandler(){return parseCues(responseBody,track);};track.tech_.on('vttjsloaded',loadHandler);track.tech_.on('vttjserror',function(){log$1.error('vttjs failed to load, stopping trying to process '+track.src);track.tech_.off('vttjsloaded',loadHandler);});}}else{parseCues(responseBody,track);}}));};var TextTrack=function(_Track){inherits(TextTrack,_Track);function TextTrack(){var _this,_ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,TextTrack);if(!options.tech){throw new Error('A tech was not provided.');} var settings=mergeOptions(options,{kind:TextTrackKind[options.kind]||'subtitles',language:options.language||options.srclang||''});var mode=TextTrackMode[settings.mode]||'disabled';var default_=settings['default'];if(settings.kind==='metadata'||settings.kind==='chapters'){mode='hidden';} var tt=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);tt.tech_=settings.tech;if(IS_IE8){for(var prop in TextTrack.prototype){if(prop!=='constructor'){tt[prop]=TextTrack.prototype[prop];}}} tt.cues_=[];tt.activeCues_=[];var cues=new TextTrackCueList(tt.cues_);var activeCues=new TextTrackCueList(tt.activeCues_);var changed=false;var timeupdateHandler=bind(tt,function(){this.activeCues;if(changed){this.trigger('cuechange');changed=false;}});if(mode!=='disabled'){tt.tech_.ready(function(){tt.tech_.on('timeupdate',timeupdateHandler);},true);} Object.defineProperty(tt,'default',{get:function get$$1(){return default_;},set:function set$$1(){}});Object.defineProperty(tt,'mode',{get:function get$$1(){return mode;},set:function set$$1(newMode){var _this2=this;if(!TextTrackMode[newMode]){return;} mode=newMode;if(mode==='showing'){this.tech_.ready(function(){_this2.tech_.on('timeupdate',timeupdateHandler);},true);} this.trigger('modechange');}});Object.defineProperty(tt,'cues',{get:function get$$1(){if(!this.loaded_){return null;} return cues;},set:function set$$1(){}});Object.defineProperty(tt,'activeCues',{get:function get$$1(){if(!this.loaded_){return null;} if(this.cues.length===0){return activeCues;} var ct=this.tech_.currentTime();var active=[];for(var i=0,l=this.cues.length;i=ct){active.push(cue);}else if(cue.startTime===cue.endTime&&cue.startTime<=ct&&cue.startTime+0.5>=ct){active.push(cue);}} changed=false;if(active.length!==this.activeCues_.length){changed=true;}else{for(var _i=0;_i0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,AudioTrack);var settings=mergeOptions(options,{kind:AudioTrackKind[options.kind]||''});var track=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);var enabled=false;if(IS_IE8){for(var prop in AudioTrack.prototype){if(prop!=='constructor'){track[prop]=AudioTrack.prototype[prop];}}} Object.defineProperty(track,'enabled',{get:function get$$1(){return enabled;},set:function set$$1(newEnabled){if(typeof newEnabled!=='boolean'||newEnabled===enabled){return;} enabled=newEnabled;this.trigger('enabledchange');}});if(settings.enabled){track.enabled=settings.enabled;} track.loaded_=true;return _ret=track,possibleConstructorReturn(_this,_ret);} return AudioTrack;}(Track);var VideoTrack=function(_Track){inherits(VideoTrack,_Track);function VideoTrack(){var _this,_ret;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,VideoTrack);var settings=mergeOptions(options,{kind:VideoTrackKind[options.kind]||''});var track=(_this=possibleConstructorReturn(this,_Track.call(this,settings)),_this);var selected=false;if(IS_IE8){for(var prop in VideoTrack.prototype){if(prop!=='constructor'){track[prop]=VideoTrack.prototype[prop];}}} Object.defineProperty(track,'selected',{get:function get$$1(){return selected;},set:function set$$1(newSelected){if(typeof newSelected!=='boolean'||newSelected===selected){return;} selected=newSelected;this.trigger('selectedchange');}});if(settings.selected){track.selected=settings.selected;} return _ret=track,possibleConstructorReturn(_this,_ret);} return VideoTrack;}(Track);var NONE=0;var LOADING=1;var LOADED=2;var ERROR=3;var HTMLTrackElement=function(_EventTarget){inherits(HTMLTrackElement,_EventTarget);function HTMLTrackElement(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};classCallCheck(this,HTMLTrackElement);var _this=possibleConstructorReturn(this,_EventTarget.call(this));var readyState=void 0;var trackElement=_this;if(IS_IE8){trackElement=document_1.createElement('custom');for(var prop in HTMLTrackElement.prototype){if(prop!=='constructor'){trackElement[prop]=HTMLTrackElement.prototype[prop];}}} var track=new TextTrack(options);trackElement.kind=track.kind;trackElement.src=track.src;trackElement.srclang=track.language;trackElement.label=track.label;trackElement['default']=track['default'];Object.defineProperty(trackElement,'readyState',{get:function get$$1(){return readyState;}});Object.defineProperty(trackElement,'track',{get:function get$$1(){return track;}});readyState=NONE;track.addEventListener('loadeddata',function(){readyState=LOADED;trackElement.trigger({type:'load',target:trackElement});});if(IS_IE8){var _ret;return _ret=trackElement,possibleConstructorReturn(_this,_ret);} return _this;} return HTMLTrackElement;}(EventTarget);HTMLTrackElement.prototype.allowedEvents_={load:'load'};HTMLTrackElement.NONE=NONE;HTMLTrackElement.LOADING=LOADING;HTMLTrackElement.LOADED=LOADED;HTMLTrackElement.ERROR=ERROR;var NORMAL={audio:{ListClass:AudioTrackList,TrackClass:AudioTrack,capitalName:'Audio'},video:{ListClass:VideoTrackList,TrackClass:VideoTrack,capitalName:'Video'},text:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:'Text'}};Object.keys(NORMAL).forEach(function(type){NORMAL[type].getterName=type+'Tracks';NORMAL[type].privateName=type+'Tracks_';});var REMOTE={remoteText:{ListClass:TextTrackList,TrackClass:TextTrack,capitalName:'RemoteText',getterName:'remoteTextTracks',privateName:'remoteTextTracks_'},remoteTextEl:{ListClass:HtmlTrackElementList,TrackClass:HTMLTrackElement,capitalName:'RemoteTextTrackEls',getterName:'remoteTextTrackEls',privateName:'remoteTextTrackEls_'}};var ALL=mergeOptions(NORMAL,REMOTE);REMOTE.names=Object.keys(REMOTE);NORMAL.names=Object.keys(NORMAL);ALL.names=[].concat(REMOTE.names).concat(NORMAL.names);var _objCreate=Object.create||(function(){function F(){} return function(o){if(arguments.length!==1){throw new Error('Object.create shim only accepts one parameter.');} F.prototype=o;return new F();};})();function ParsingError(errorData,message){this.name="ParsingError";this.code=errorData.code;this.message=message||errorData.message;} ParsingError.prototype=_objCreate(Error.prototype);ParsingError.prototype.constructor=ParsingError;ParsingError.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function parseTimeStamp(input){function computeSeconds(h,m,s,f){return(h|0)*3600+(m|0)*60+(s|0)+(f|0)/1000;} var m=input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);if(!m){return null;} if(m[3]){return computeSeconds(m[1],m[2],m[3].replace(":",""),m[4]);}else if(m[1]>59){return computeSeconds(m[1],m[2],0,m[4]);}else{return computeSeconds(0,m[1],m[2],m[4]);}} function Settings(){this.values=_objCreate(null);} Settings.prototype={set:function(k,v){if(!this.get(k)&&v!==""){this.values[k]=v;}},get:function(k,dflt,defaultKey){if(defaultKey){return this.has(k)?this.values[k]:dflt[defaultKey];} return this.has(k)?this.values[k]:dflt;},has:function(k){return k in this.values;},alt:function(k,v,a){for(var n=0;n=0&&v<=100){this.set(k,v);return true;}} return false;}};function parseOptions(input,callback,keyValueDelim,groupDelim){var groups=groupDelim?input.split(groupDelim):[input];for(var i in groups){if(typeof groups[i]!=="string"){continue;} var kv=groups[i].split(keyValueDelim);if(kv.length!==2){continue;} var k=kv[0];var v=kv[1];callback(k,v);}} function parseCue(input,cue,regionList){var oInput=input;function consumeTimeStamp(){var ts=parseTimeStamp(input);if(ts===null){throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed timestamp: "+oInput);} input=input.replace(/^[^\sa-zA-Z-]+/,"");return ts;} function consumeCueSettings(input,cue){var settings=new Settings();parseOptions(input,function(k,v){switch(k){case "region":for(var i=regionList.length-1;i>=0;i--){if(regionList[i].id===v){settings.set(k,regionList[i].region);break;}} break;case "vertical":settings.alt(k,v,["rl","lr"]);break;case "line":var vals=v.split(","),vals0=vals[0];settings.integer(k,vals0);settings.percent(k,vals0)?settings.set("snapToLines",false):null;settings.alt(k,vals0,["auto"]);if(vals.length===2){settings.alt("lineAlign",vals[1],["start","middle","end"]);} break;case "position":vals=v.split(",");settings.percent(k,vals[0]);if(vals.length===2){settings.alt("positionAlign",vals[1],["start","middle","end"]);} break;case "size":settings.percent(k,v);break;case "align":settings.alt(k,v,["start","middle","end","left","right"]);break;}},/:/,/\s/);cue.region=settings.get("region",null);cue.vertical=settings.get("vertical","");cue.line=settings.get("line","auto");cue.lineAlign=settings.get("lineAlign","start");cue.snapToLines=settings.get("snapToLines",true);cue.size=settings.get("size",100);cue.align=settings.get("align","middle");cue.position=settings.get("position",{start:0,left:0,middle:50,end:100,right:100},cue.align);cue.positionAlign=settings.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},cue.align);} function skipWhitespace(){input=input.replace(/^\s+/,"");} skipWhitespace();cue.startTime=consumeTimeStamp();skipWhitespace();if(input.substr(0,3)!=="-->"){throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+ oInput);} input=input.substr(3);skipWhitespace();cue.endTime=consumeTimeStamp();skipWhitespace();consumeCueSettings(input,cue);} var ESCAPE={"&":"&","<":"<",">":">","‎":"\u200e","‏":"\u200f"," ":"\u00a0"};var TAG_NAME={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"};var TAG_ANNOTATION={v:"title",lang:"lang"};var NEEDS_PARENT={rt:"ruby"};function parseContent(window,input){function nextToken(){if(!input){return null;} function consume(result){input=input.substr(result.length);return result;} var m=input.match(/^([^<]*)(<[^>]+>?)?/);return consume(m[1]?m[1]:m[2]);} function unescape1(e){return ESCAPE[e];} function unescape(s){while((m=s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/))){s=s.replace(m[0],unescape1);} return s;} function shouldAdd(current,element){return!NEEDS_PARENT[element.localName]||NEEDS_PARENT[element.localName]===current.localName;} function createElement(type,annotation){var tagName=TAG_NAME[type];if(!tagName){return null;} var element=window.document.createElement(tagName);element.localName=tagName;var name=TAG_ANNOTATION[type];if(name&&annotation){element[name]=annotation.trim();} return element;} var rootDiv=window.document.createElement("div"),current=rootDiv,t,tagStack=[];while((t=nextToken())!==null){if(t[0]==='<'){if(t[1]==="/"){if(tagStack.length&&tagStack[tagStack.length-1]===t.substr(2).replace(">","")){tagStack.pop();current=current.parentNode;} continue;} var ts=parseTimeStamp(t.substr(1,t.length-2));var node;if(ts){node=window.document.createProcessingInstruction("timestamp",ts);current.appendChild(node);continue;} var m=t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!m){continue;} node=createElement(m[1],m[3]);if(!node){continue;} if(!shouldAdd(current,node)){continue;} if(m[2]){node.className=m[2].substr(1).replace('.',' ');} tagStack.push(m[1]);current.appendChild(node);current=node;continue;} current.appendChild(window.document.createTextNode(unescape(t)));} return rootDiv;} var strongRTLRanges=[[0x5be,0x5be],[0x5c0,0x5c0],[0x5c3,0x5c3],[0x5c6,0x5c6],[0x5d0,0x5ea],[0x5f0,0x5f4],[0x608,0x608],[0x60b,0x60b],[0x60d,0x60d],[0x61b,0x61b],[0x61e,0x64a],[0x66d,0x66f],[0x671,0x6d5],[0x6e5,0x6e6],[0x6ee,0x6ef],[0x6fa,0x70d],[0x70f,0x710],[0x712,0x72f],[0x74d,0x7a5],[0x7b1,0x7b1],[0x7c0,0x7ea],[0x7f4,0x7f5],[0x7fa,0x7fa],[0x800,0x815],[0x81a,0x81a],[0x824,0x824],[0x828,0x828],[0x830,0x83e],[0x840,0x858],[0x85e,0x85e],[0x8a0,0x8a0],[0x8a2,0x8ac],[0x200f,0x200f],[0xfb1d,0xfb1d],[0xfb1f,0xfb28],[0xfb2a,0xfb36],[0xfb38,0xfb3c],[0xfb3e,0xfb3e],[0xfb40,0xfb41],[0xfb43,0xfb44],[0xfb46,0xfbc1],[0xfbd3,0xfd3d],[0xfd50,0xfd8f],[0xfd92,0xfdc7],[0xfdf0,0xfdfc],[0xfe70,0xfe74],[0xfe76,0xfefc],[0x10800,0x10805],[0x10808,0x10808],[0x1080a,0x10835],[0x10837,0x10838],[0x1083c,0x1083c],[0x1083f,0x10855],[0x10857,0x1085f],[0x10900,0x1091b],[0x10920,0x10939],[0x1093f,0x1093f],[0x10980,0x109b7],[0x109be,0x109bf],[0x10a00,0x10a00],[0x10a10,0x10a13],[0x10a15,0x10a17],[0x10a19,0x10a33],[0x10a40,0x10a47],[0x10a50,0x10a58],[0x10a60,0x10a7f],[0x10b00,0x10b35],[0x10b40,0x10b55],[0x10b58,0x10b72],[0x10b78,0x10b7f],[0x10c00,0x10c48],[0x1ee00,0x1ee03],[0x1ee05,0x1ee1f],[0x1ee21,0x1ee22],[0x1ee24,0x1ee24],[0x1ee27,0x1ee27],[0x1ee29,0x1ee32],[0x1ee34,0x1ee37],[0x1ee39,0x1ee39],[0x1ee3b,0x1ee3b],[0x1ee42,0x1ee42],[0x1ee47,0x1ee47],[0x1ee49,0x1ee49],[0x1ee4b,0x1ee4b],[0x1ee4d,0x1ee4f],[0x1ee51,0x1ee52],[0x1ee54,0x1ee54],[0x1ee57,0x1ee57],[0x1ee59,0x1ee59],[0x1ee5b,0x1ee5b],[0x1ee5d,0x1ee5d],[0x1ee5f,0x1ee5f],[0x1ee61,0x1ee62],[0x1ee64,0x1ee64],[0x1ee67,0x1ee6a],[0x1ee6c,0x1ee72],[0x1ee74,0x1ee77],[0x1ee79,0x1ee7c],[0x1ee7e,0x1ee7e],[0x1ee80,0x1ee89],[0x1ee8b,0x1ee9b],[0x1eea1,0x1eea3],[0x1eea5,0x1eea9],[0x1eeab,0x1eebb],[0x10fffd,0x10fffd]];function isStrongRTLChar(charCode){for(var i=0;i=currentRange[0]&&charCode<=currentRange[1]){return true;}} return false;} function determineBidi(cueDiv){var nodeStack=[],text="",charCode;if(!cueDiv||!cueDiv.childNodes){return "ltr";} function pushNodes(nodeStack,node){for(var i=node.childNodes.length-1;i>=0;i--){nodeStack.push(node.childNodes[i]);}} function nextTextNode(nodeStack){if(!nodeStack||!nodeStack.length){return null;} var node=nodeStack.pop(),text=node.textContent||node.innerText;if(text){var m=text.match(/^.*(\n|\r)/);if(m){nodeStack.length=0;return m[0];} return text;} if(node.tagName==="ruby"){return nextTextNode(nodeStack);} if(node.childNodes){pushNodes(nodeStack,node);return nextTextNode(nodeStack);}} pushNodes(nodeStack,cueDiv);while((text=nextTextNode(nodeStack))){for(var i=0;i=0&&cue.line<=100))){return cue.line;} if(!cue.track||!cue.track.textTrackList||!cue.track.textTrackList.mediaElement){return-1;} var track=cue.track,trackList=track.textTrackList,count=0;for(var i=0;ib2.left&&this.topb2.top;};BoxPosition.prototype.overlapsAny=function(boxes){for(var i=0;i=container.top&&this.bottom<=container.bottom&&this.left>=container.left&&this.right<=container.right;};BoxPosition.prototype.overlapsOppositeAxis=function(container,axis){switch(axis){case "+x":return this.leftcontainer.right;case "+y":return this.topcontainer.bottom;}};BoxPosition.prototype.intersectPercentage=function(b2){var x=Math.max(0,Math.min(this.right,b2.right)-Math.max(this.left,b2.left)),y=Math.max(0,Math.min(this.bottom,b2.bottom)-Math.max(this.top,b2.top)),intersectArea=x*y;return intersectArea/(this.height*this.width);};BoxPosition.prototype.toCSSCompatValues=function(reference){return{top:this.top-reference.top,bottom:reference.bottom-this.bottom,left:this.left-reference.left,right:reference.right-this.right,height:this.height,width:this.width};};BoxPosition.getSimpleBoxPosition=function(obj){var height=obj.div?obj.div.offsetHeight:obj.tagName?obj.offsetHeight:0;var width=obj.div?obj.div.offsetWidth:obj.tagName?obj.offsetWidth:0;var top=obj.div?obj.div.offsetTop:obj.tagName?obj.offsetTop:0;obj=obj.div?obj.div.getBoundingClientRect():obj.tagName?obj.getBoundingClientRect():obj;var ret={left:obj.left,right:obj.right,top:obj.top||top,height:obj.height||height,bottom:obj.bottom||(top+(obj.height||height)),width:obj.width||width};return ret;};function moveBoxToLinePosition(window,styleBox,containerBox,boxPositions){function findBestPosition(b,axis){var bestPosition,specifiedPosition=new BoxPosition(b),percentage=1;for(var i=0;ip){bestPosition=new BoxPosition(b);percentage=p;} b=new BoxPosition(specifiedPosition);} return bestPosition||specifiedPosition;} var boxPosition=new BoxPosition(styleBox),cue=styleBox.cue,linePos=computeLinePos(cue),axis=[];if(cue.snapToLines){var size;switch(cue.vertical){case "":axis=["+y","-y"];size="height";break;case "rl":axis=["+x","-x"];size="width";break;case "lr":axis=["-x","+x"];size="width";break;} var step=boxPosition.lineHeight,position=step*Math.round(linePos),maxPosition=containerBox[size]+step,initialAxis=axis[0];if(Math.abs(position)>maxPosition){position=position<0?-1:1;position*=Math.ceil(maxPosition/step)*step;} if(linePos<0){position+=cue.vertical===""?containerBox.height:containerBox.width;axis=axis.reverse();} boxPosition.move(initialAxis,position);}else{var calculatedPercentage=(boxPosition.lineHeight/containerBox.height)*100;switch(cue.lineAlign){case "middle":linePos-=(calculatedPercentage/2);break;case "end":linePos-=calculatedPercentage;break;} switch(cue.vertical){case "":styleBox.applyStyles({top:styleBox.formatStyle(linePos,"%")});break;case "rl":styleBox.applyStyles({left:styleBox.formatStyle(linePos,"%")});break;case "lr":styleBox.applyStyles({right:styleBox.formatStyle(linePos,"%")});break;} axis=["+y","-x","+x","-y"];boxPosition=new BoxPosition(styleBox);} var bestPosition=findBestPosition(boxPosition,axis);styleBox.move(bestPosition.toCSSCompatValues(containerBox));} function WebVTT$1(){} WebVTT$1.StringDecoder=function(){return{decode:function(data){if(!data){return "";} if(typeof data!=="string"){throw new Error("Error - expected string data.");} return decodeURIComponent(encodeURIComponent(data));}};};WebVTT$1.convertCueToDOMTree=function(window,cuetext){if(!window||!cuetext){return null;} return parseContent(window,cuetext);};var FONT_SIZE_PERCENT=0.05;var FONT_STYLE="sans-serif";var CUE_BACKGROUND_PADDING="1.5%";WebVTT$1.processCues=function(window,cues,overlay){if(!window||!cues||!overlay){return null;} while(overlay.firstChild){overlay.removeChild(overlay.firstChild);} var paddedOverlay=window.document.createElement("div");paddedOverlay.style.position="absolute";paddedOverlay.style.left="0";paddedOverlay.style.right="0";paddedOverlay.style.top="0";paddedOverlay.style.bottom="0";paddedOverlay.style.margin=CUE_BACKGROUND_PADDING;overlay.appendChild(paddedOverlay);function shouldCompute(cues){for(var i=0;i")===-1){self.cue.id=line;continue;} case "CUE":try{parseCue(line,self.cue,self.regionList);}catch(e){self.reportOrThrowError(e);self.cue=null;self.state="BADCUE";continue;} self.state="CUETEXT";continue;case "CUETEXT":var hasSubstring=line.indexOf("-->")!==-1;if(!line||hasSubstring&&(alreadyCollectedLine=true)){self.oncue&&self.oncue(self.cue);self.cue=null;self.state="ID";continue;} if(self.cue.text){self.cue.text+="\n";} self.cue.text+=line;continue;case "BADCUE":if(!line){self.state="ID";} continue;}}}catch(e){self.reportOrThrowError(e);if(self.state==="CUETEXT"&&self.cue&&self.oncue){self.oncue(self.cue);} self.cue=null;self.state=self.state==="INITIAL"?"BADWEBVTT":"BADCUE";} return this;},flush:function(){var self=this;try{self.buffer+=self.decoder.decode();if(self.cue||self.state==="HEADER"){self.buffer+="\n\n";self.parse();} if(self.state==="INITIAL"){throw new ParsingError(ParsingError.Errors.BadSignature);}}catch(e){self.reportOrThrowError(e);} self.onflush&&self.onflush();return this;}};var vtt$1=WebVTT$1;var autoKeyword="auto";var directionSetting={"":true,"lr":true,"rl":true};var alignSetting={"start":true,"middle":true,"end":true,"left":true,"right":true};function findDirectionSetting(value){if(typeof value!=="string"){return false;} var dir=directionSetting[value.toLowerCase()];return dir?value.toLowerCase():false;} function findAlignSetting(value){if(typeof value!=="string"){return false;} var align=alignSetting[value.toLowerCase()];return align?value.toLowerCase():false;} function extend$1(obj){var i=1;for(;i100){throw new Error("Position must be between 0 and 100.");} _position=value;this.hasBeenReset=true;}}));Object.defineProperty(cue,"positionAlign",extend$1({},baseObj,{get:function(){return _positionAlign;},set:function(value){var setting=findAlignSetting(value);if(!setting){throw new SyntaxError("An invalid or illegal string was specified.");} _positionAlign=setting;this.hasBeenReset=true;}}));Object.defineProperty(cue,"size",extend$1({},baseObj,{get:function(){return _size;},set:function(value){if(value<0||value>100){throw new Error("Size must be between 0 and 100.");} _size=value;this.hasBeenReset=true;}}));Object.defineProperty(cue,"align",extend$1({},baseObj,{get:function(){return _align;},set:function(value){var setting=findAlignSetting(value);if(!setting){throw new SyntaxError("An invalid or illegal string was specified.");} _align=setting;this.hasBeenReset=true;}}));cue.displayState=undefined;if(isIE8){return cue;}} VTTCue.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text);};var vttcue=VTTCue;var scrollSetting={"":true,"up":true};function findScrollSetting(value){if(typeof value!=="string"){return false;} var scroll=scrollSetting[value.toLowerCase()];return scroll?value.toLowerCase():false;} function isValidPercentValue(value){return typeof value==="number"&&(value>=0&&value<=100);} function VTTRegion(){var _width=100;var _lines=3;var _regionAnchorX=0;var _regionAnchorY=100;var _viewportAnchorX=0;var _viewportAnchorY=100;var _scroll="";Object.defineProperties(this,{"width":{enumerable:true,get:function(){return _width;},set:function(value){if(!isValidPercentValue(value)){throw new Error("Width must be between 0 and 100.");} _width=value;}},"lines":{enumerable:true,get:function(){return _lines;},set:function(value){if(typeof value!=="number"){throw new TypeError("Lines must be set to a number.");} _lines=value;}},"regionAnchorY":{enumerable:true,get:function(){return _regionAnchorY;},set:function(value){if(!isValidPercentValue(value)){throw new Error("RegionAnchorX must be between 0 and 100.");} _regionAnchorY=value;}},"regionAnchorX":{enumerable:true,get:function(){return _regionAnchorX;},set:function(value){if(!isValidPercentValue(value)){throw new Error("RegionAnchorY must be between 0 and 100.");} _regionAnchorX=value;}},"viewportAnchorY":{enumerable:true,get:function(){return _viewportAnchorY;},set:function(value){if(!isValidPercentValue(value)){throw new Error("ViewportAnchorY must be between 0 and 100.");} _viewportAnchorY=value;}},"viewportAnchorX":{enumerable:true,get:function(){return _viewportAnchorX;},set:function(value){if(!isValidPercentValue(value)){throw new Error("ViewportAnchorX must be between 0 and 100.");} _viewportAnchorX=value;}},"scroll":{enumerable:true,get:function(){return _scroll;},set:function(value){var setting=findScrollSetting(value);if(setting===false){throw new SyntaxError("An invalid or illegal string was specified.");} _scroll=setting;}}});} var vttregion=VTTRegion;var browserIndex=createCommonjsModule(function(module){var vttjs=module.exports={WebVTT:vtt$1,VTTCue:vttcue,VTTRegion:vttregion};window_1.vttjs=vttjs;window_1.WebVTT=vttjs.WebVTT;var cueShim=vttjs.VTTCue;var regionShim=vttjs.VTTRegion;var nativeVTTCue=window_1.VTTCue;var nativeVTTRegion=window_1.VTTRegion;vttjs.shim=function(){window_1.VTTCue=cueShim;window_1.VTTRegion=regionShim;};vttjs.restore=function(){window_1.VTTCue=nativeVTTCue;window_1.VTTRegion=nativeVTTRegion;};if(!window_1.VTTCue){vttjs.shim();}});function createTrackHelper(self,kind,label,language){var options=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{};var tracks=self.textTracks();options.kind=kind;if(label){options.label=label;} if(language){options.language=language;} options.tech=self;var track=new ALL.text.TrackClass(options);tracks.addTrack(track);return track;} var Tech=function(_Component){inherits(Tech,_Component);function Tech(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var ready=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(){};classCallCheck(this,Tech);options.reportTouchActivity=false;var _this=possibleConstructorReturn(this,_Component.call(this,null,options,ready));_this.hasStarted_=false;_this.on('playing',function(){this.hasStarted_=true;});_this.on('loadstart',function(){this.hasStarted_=false;});ALL.names.forEach(function(name){var props=ALL[name];if(options&&options[props.getterName]){_this[props.privateName]=options[props.getterName];}});if(!_this.featuresProgressEvents){_this.manualProgressOn();} if(!_this.featuresTimeupdateEvents){_this.manualTimeUpdatesOn();} ['Text','Audio','Video'].forEach(function(track){if(options['native'+track+'Tracks']===false){_this['featuresNative'+track+'Tracks']=false;}});if(options.nativeCaptions===false||options.nativeTextTracks===false){_this.featuresNativeTextTracks=false;}else if(options.nativeCaptions===true||options.nativeTextTracks===true){_this.featuresNativeTextTracks=true;} if(!_this.featuresNativeTextTracks){_this.emulateTextTracks();} _this.autoRemoteTextTracks_=new ALL.text.ListClass();_this.initTrackListeners();if(!options.nativeControlsForTouch){_this.emitTapEvents();} if(_this.constructor){_this.name_=_this.constructor.name||'Unknown Tech';} return _this;} Tech.prototype.manualProgressOn=function manualProgressOn(){this.on('durationchange',this.onDurationChange);this.manualProgress=true;this.one('ready',this.trackProgress);};Tech.prototype.manualProgressOff=function manualProgressOff(){this.manualProgress=false;this.stopTrackingProgress();this.off('durationchange',this.onDurationChange);};Tech.prototype.trackProgress=function trackProgress(event){this.stopTrackingProgress();this.progressInterval=this.setInterval(bind(this,function(){var numBufferedPercent=this.bufferedPercent();if(this.bufferedPercent_!==numBufferedPercent){this.trigger('progress');} this.bufferedPercent_=numBufferedPercent;if(numBufferedPercent===1){this.stopTrackingProgress();}}),500);};Tech.prototype.onDurationChange=function onDurationChange(event){this.duration_=this.duration();};Tech.prototype.buffered=function buffered(){return createTimeRanges(0,0);};Tech.prototype.bufferedPercent=function bufferedPercent$$1(){return bufferedPercent(this.buffered(),this.duration_);};Tech.prototype.stopTrackingProgress=function stopTrackingProgress(){this.clearInterval(this.progressInterval);};Tech.prototype.manualTimeUpdatesOn=function manualTimeUpdatesOn(){this.manualTimeUpdates=true;this.on('play',this.trackCurrentTime);this.on('pause',this.stopTrackingCurrentTime);};Tech.prototype.manualTimeUpdatesOff=function manualTimeUpdatesOff(){this.manualTimeUpdates=false;this.stopTrackingCurrentTime();this.off('play',this.trackCurrentTime);this.off('pause',this.stopTrackingCurrentTime);};Tech.prototype.trackCurrentTime=function trackCurrentTime(){if(this.currentTimeInterval){this.stopTrackingCurrentTime();} this.currentTimeInterval=this.setInterval(function(){this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});},250);};Tech.prototype.stopTrackingCurrentTime=function stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval);this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});};Tech.prototype.dispose=function dispose(){this.clearTracks(NORMAL.names);if(this.manualProgress){this.manualProgressOff();} if(this.manualTimeUpdates){this.manualTimeUpdatesOff();} _Component.prototype.dispose.call(this);};Tech.prototype.clearTracks=function clearTracks(types){var _this2=this;types=[].concat(types);types.forEach(function(type){var list=_this2[type+'Tracks']()||[];var i=list.length;while(i--){var track=list[i];if(type==='text'){_this2.removeRemoteTextTrack(track);} list.removeTrack(track);}});};Tech.prototype.cleanupAutoTextTracks=function cleanupAutoTextTracks(){var list=this.autoRemoteTextTracks_||[];var i=list.length;while(i--){var track=list[i];this.removeRemoteTextTrack(track);}};Tech.prototype.reset=function reset(){};Tech.prototype.error=function error(err){if(err!==undefined){this.error_=new MediaError(err);this.trigger('error');} return this.error_;};Tech.prototype.played=function played(){if(this.hasStarted_){return createTimeRanges(0,0);} return createTimeRanges();};Tech.prototype.setCurrentTime=function setCurrentTime(){if(this.manualTimeUpdates){this.trigger({type:'timeupdate',target:this,manuallyTriggered:true});}};Tech.prototype.initTrackListeners=function initTrackListeners(){var _this3=this;NORMAL.names.forEach(function(name){var props=NORMAL[name];var trackListChanges=function trackListChanges(){_this3.trigger(name+'trackchange');};var tracks=_this3[props.getterName]();tracks.addEventListener('removetrack',trackListChanges);tracks.addEventListener('addtrack',trackListChanges);_this3.on('dispose',function(){tracks.removeEventListener('removetrack',trackListChanges);tracks.removeEventListener('addtrack',trackListChanges);});});};Tech.prototype.addWebVttScript_=function addWebVttScript_(){var _this4=this;if(window_1.WebVTT){return;} if(document_1.body.contains(this.el())){if(!this.options_['vtt.js']&&isPlain(browserIndex)&&Object.keys(browserIndex).length>0){this.trigger('vttjsloaded');return;} var script=document_1.createElement('script');script.src=this.options_['vtt.js']||'https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js';script.onload=function(){_this4.trigger('vttjsloaded');};script.onerror=function(){_this4.trigger('vttjserror');};this.on('dispose',function(){script.onload=null;script.onerror=null;});window_1.WebVTT=true;this.el().parentNode.appendChild(script);}else{this.ready(this.addWebVttScript_);}};Tech.prototype.emulateTextTracks=function emulateTextTracks(){var _this5=this;var tracks=this.textTracks();var remoteTracks=this.remoteTextTracks();var handleAddTrack=function handleAddTrack(e){return tracks.addTrack(e.track);};var handleRemoveTrack=function handleRemoveTrack(e){return tracks.removeTrack(e.track);};remoteTracks.on('addtrack',handleAddTrack);remoteTracks.on('removetrack',handleRemoveTrack);this.addWebVttScript_();var updateDisplay=function updateDisplay(){return _this5.trigger('texttrackchange');};var textTracksChanges=function textTracksChanges(){updateDisplay();for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{};var manualCleanup=arguments[1];var htmlTrackElement=this.createRemoteTextTrack(options);if(manualCleanup!==true&&manualCleanup!==false){log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js');manualCleanup=true;} this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);this.remoteTextTracks().addTrack(htmlTrackElement.track);if(manualCleanup!==true){this.ready(function(){return _this6.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);});} return htmlTrackElement;};Tech.prototype.removeRemoteTextTrack=function removeRemoteTextTrack(track){var trackElement=this.remoteTextTrackEls().getTrackElementByTrack_(track);this.remoteTextTrackEls().removeTrackElement_(trackElement);this.remoteTextTracks().removeTrack(track);this.autoRemoteTextTracks_.removeTrack(track);};Tech.prototype.getVideoPlaybackQuality=function getVideoPlaybackQuality(){return{};};Tech.prototype.setPoster=function setPoster(){};Tech.prototype.playsinline=function playsinline(){};Tech.prototype.setPlaysinline=function setPlaysinline(){};Tech.prototype.canPlayType=function canPlayType(){return '';};Tech.canPlayType=function canPlayType(){return '';};Tech.canPlaySource=function canPlaySource(srcObj,options){return Tech.canPlayType(srcObj.type);};Tech.isTech=function isTech(component){return component.prototype instanceof Tech||component instanceof Tech||component===Tech;};Tech.registerTech=function registerTech(name,tech){if(!Tech.techs_){Tech.techs_={};} if(!Tech.isTech(tech)){throw new Error('Tech '+name+' must be a Tech');} if(!Tech.canPlayType){throw new Error('Techs must have a static canPlayType method on them');} if(!Tech.canPlaySource){throw new Error('Techs must have a static canPlaySource method on them');} name=toTitleCase(name);Tech.techs_[name]=tech;if(name!=='Tech'){Tech.defaultTechOrder_.push(name);} return tech;};Tech.getTech=function getTech(name){if(!name){return;} name=toTitleCase(name);if(Tech.techs_&&Tech.techs_[name]){return Tech.techs_[name];} if(window_1&&window_1.videojs&&window_1.videojs[name]){log$1.warn('The '+name+' tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)');return window_1.videojs[name];}};return Tech;}(Component);ALL.names.forEach(function(name){var props=ALL[name];Tech.prototype[props.getterName]=function(){this[props.privateName]=this[props.privateName]||new props.ListClass();return this[props.privateName];};});Tech.prototype.featuresVolumeControl=true;Tech.prototype.featuresFullscreenResize=false;Tech.prototype.featuresPlaybackRate=false;Tech.prototype.featuresProgressEvents=false;Tech.prototype.featuresTimeupdateEvents=false;Tech.prototype.featuresNativeTextTracks=false;Tech.withSourceHandlers=function(_Tech){_Tech.registerSourceHandler=function(handler,index){var handlers=_Tech.sourceHandlers;if(!handlers){handlers=_Tech.sourceHandlers=[];} if(index===undefined){index=handlers.length;} handlers.splice(index,0,handler);};_Tech.canPlayType=function(type){var handlers=_Tech.sourceHandlers||[];var can=void 0;for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{};var middleware=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var next=arguments[2];var player=arguments[3];var acc=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[];var lastRun=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;var mwFactory=middleware[0],mwrest=middleware.slice(1);if(typeof mwFactory==='string'){setSourceHelper(src,middlewares[mwFactory],next,player,acc,lastRun);}else if(mwFactory){var mw=mwFactory(player);mw.setSource(assign({},src),function(err,_src){if(err){return setSourceHelper(src,mwrest,next,player,acc,lastRun);} acc.push(mw);setSourceHelper(_src,src.type===_src.type?mwrest:middlewares[_src.type],next,player,acc,lastRun);});}else if(mwrest.length){setSourceHelper(src,mwrest,next,player,acc,lastRun);}else if(lastRun){next(src,acc);}else{setSourceHelper(src,middlewares['*'],next,player,acc,true);}} var filterSource=function filterSource(src){if(Array.isArray(src)){var newsrc=[];src.forEach(function(srcobj){srcobj=filterSource(srcobj);if(Array.isArray(srcobj)){newsrc=newsrc.concat(srcobj);}else if(isObject(srcobj)){newsrc.push(srcobj);}});src=newsrc;}else if(typeof src==='string'&&src.trim()){src=[{src:src}];}else if(isObject(src)&&typeof src.src==='string'&&src.src&&src.src.trim()){src=[src];}else{src=[];} return src;};var MediaLoader=function(_Component){inherits(MediaLoader,_Component);function MediaLoader(player,options,ready){classCallCheck(this,MediaLoader);var options_=mergeOptions({createEl:false},options);var _this=possibleConstructorReturn(this,_Component.call(this,player,options_,ready));if(!options.playerOptions.sources||options.playerOptions.sources.length===0){for(var i=0,j=options.playerOptions.techOrder;i0&&arguments[0]!==undefined?arguments[0]:'div';var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};props=assign({innerHTML:'',className:this.buildCSSClass(),tabIndex:0},props);if(tag==='button'){log$1.error('Creating a ClickableComponent with an HTML element of '+tag+' is not supported; use a Button instead.');} attributes=assign({'role':'button','aria-live':'polite'},attributes);this.tabIndex_=props.tabIndex;var el=_Component.prototype.createEl.call(this,tag,props,attributes);this.createControlTextEl(el);return el;};ClickableComponent.prototype.dispose=function dispose(){this.controlTextEl_=null;_Component.prototype.dispose.call(this);};ClickableComponent.prototype.createControlTextEl=function createControlTextEl(el){this.controlTextEl_=createEl('span',{className:'vjs-control-text'});if(el){el.appendChild(this.controlTextEl_);} this.controlText(this.controlText_,el);return this.controlTextEl_;};ClickableComponent.prototype.controlText=function controlText(text){var el=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.el();if(text===undefined){return this.controlText_||'Need Text';} var localizedText=this.localize(text);this.controlText_=text;textContent(this.controlTextEl_,localizedText);if(!this.nonIconControl){el.setAttribute('title',localizedText);}};ClickableComponent.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-control vjs-button '+_Component.prototype.buildCSSClass.call(this);};ClickableComponent.prototype.enable=function enable(){if(!this.enabled_){this.enabled_=true;this.removeClass('vjs-disabled');this.el_.setAttribute('aria-disabled','false');if(typeof this.tabIndex_!=='undefined'){this.el_.setAttribute('tabIndex',this.tabIndex_);} this.on(['tap','click'],this.handleClick);this.on('focus',this.handleFocus);this.on('blur',this.handleBlur);}};ClickableComponent.prototype.disable=function disable(){this.enabled_=false;this.addClass('vjs-disabled');this.el_.setAttribute('aria-disabled','true');if(typeof this.tabIndex_!=='undefined'){this.el_.removeAttribute('tabIndex');} this.off(['tap','click'],this.handleClick);this.off('focus',this.handleFocus);this.off('blur',this.handleBlur);};ClickableComponent.prototype.handleClick=function handleClick(event){};ClickableComponent.prototype.handleFocus=function handleFocus(event){on(document_1,'keydown',bind(this,this.handleKeyPress));};ClickableComponent.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===32||event.which===13){event.preventDefault();this.trigger('click');}else if(_Component.prototype.handleKeyPress){_Component.prototype.handleKeyPress.call(this,event);}};ClickableComponent.prototype.handleBlur=function handleBlur(event){off(document_1,'keydown',bind(this,this.handleKeyPress));};return ClickableComponent;}(Component);Component.registerComponent('ClickableComponent',ClickableComponent);var PosterImage=function(_ClickableComponent){inherits(PosterImage,_ClickableComponent);function PosterImage(player,options){classCallCheck(this,PosterImage);var _this=possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));_this.update();player.on('posterchange',bind(_this,_this.update));return _this;} PosterImage.prototype.dispose=function dispose(){this.player().off('posterchange',this.update);_ClickableComponent.prototype.dispose.call(this);};PosterImage.prototype.createEl=function createEl$$1(){var el=createEl('div',{className:'vjs-poster',tabIndex:-1});if(!BACKGROUND_SIZE_SUPPORTED){this.fallbackImg_=createEl('img');el.appendChild(this.fallbackImg_);} return el;};PosterImage.prototype.update=function update(event){var url=this.player().poster();this.setSrc(url);if(url){this.show();}else{this.hide();}};PosterImage.prototype.setSrc=function setSrc(url){if(this.fallbackImg_){this.fallbackImg_.src=url;}else{var backgroundImage='';if(url){backgroundImage='url("'+url+'")';} this.el_.style.backgroundImage=backgroundImage;}};PosterImage.prototype.handleClick=function handleClick(event){if(!this.player_.controls()){return;} if(this.player_.paused()){this.player_.play();}else{this.player_.pause();}};return PosterImage;}(ClickableComponent);Component.registerComponent('PosterImage',PosterImage);var darkGray='#222';var lightGray='#ccc';var fontMap={monospace:'monospace',sansSerif:'sans-serif',serif:'serif',monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:'sans-serif',proportionalSerif:'serif',casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function constructColor(color,opacity){return 'rgba('+ parseInt(color[1]+color[1],16)+','+parseInt(color[2]+color[2],16)+','+parseInt(color[3]+color[3],16)+','+opacity+')';} function tryUpdateStyle(el,style,rule){try{el.style[style]=rule;}catch(e){return;}} var TextTrackDisplay=function(_Component){inherits(TextTrackDisplay,_Component);function TextTrackDisplay(player,options,ready){classCallCheck(this,TextTrackDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options,ready));player.on('loadstart',bind(_this,_this.toggleDisplay));player.on('texttrackchange',bind(_this,_this.updateDisplay));player.on('loadstart',bind(_this,_this.preselectTrack));player.ready(bind(_this,function(){if(player.tech_&&player.tech_.featuresNativeTextTracks){this.hide();return;} player.on('fullscreenchange',bind(this,this.updateDisplay));var tracks=this.options_.playerOptions.tracks||[];for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};tag='button';props=assign({innerHTML:'',className:this.buildCSSClass()},props);attributes=assign({'type':'button','aria-live':'polite'},attributes);var el=Component.prototype.createEl.call(this,tag,props,attributes);this.createControlTextEl(el);return el;};Button.prototype.addChild=function addChild(child){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var className=this.constructor.name;log$1.warn('Adding an actionable (user controllable) child to a Button ('+className+') is not supported; use a ClickableComponent instead.');return Component.prototype.addChild.call(this,child,options);};Button.prototype.enable=function enable(){_ClickableComponent.prototype.enable.call(this);this.el_.removeAttribute('disabled');};Button.prototype.disable=function disable(){_ClickableComponent.prototype.disable.call(this);this.el_.setAttribute('disabled','disabled');};Button.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===32||event.which===13){return;} _ClickableComponent.prototype.handleKeyPress.call(this,event);};return Button;}(ClickableComponent);Component.registerComponent('Button',Button);var BigPlayButton=function(_Button){inherits(BigPlayButton,_Button);function BigPlayButton(player,options){classCallCheck(this,BigPlayButton);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.mouseused_=false;_this.on('mousedown',_this.handleMouseDown);return _this;} BigPlayButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-big-play-button';};BigPlayButton.prototype.handleClick=function handleClick(event){var playPromise=this.player_.play();if(this.mouseused_&&event.clientX&&event.clientY){return;} var cb=this.player_.getChild('controlBar');var playToggle=cb&&cb.getChild('playToggle');if(!playToggle){this.player_.focus();return;} var playFocus=function playFocus(){return playToggle.focus();};if(isPromise(playPromise)){playPromise.then(playFocus,function(){});}else{this.setTimeout(playFocus,1);}};BigPlayButton.prototype.handleKeyPress=function handleKeyPress(event){this.mouseused_=false;_Button.prototype.handleKeyPress.call(this,event);};BigPlayButton.prototype.handleMouseDown=function handleMouseDown(event){this.mouseused_=true;};return BigPlayButton;}(Button);BigPlayButton.prototype.controlText_='Play Video';Component.registerComponent('BigPlayButton',BigPlayButton);var CloseButton=function(_Button){inherits(CloseButton,_Button);function CloseButton(player,options){classCallCheck(this,CloseButton);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.controlText(options&&options.controlText||_this.localize('Close'));return _this;} CloseButton.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-close-button '+_Button.prototype.buildCSSClass.call(this);};CloseButton.prototype.handleClick=function handleClick(event){this.trigger({type:'close',bubbles:false});};return CloseButton;}(Button);Component.registerComponent('CloseButton',CloseButton);var PlayToggle=function(_Button){inherits(PlayToggle,_Button);function PlayToggle(player,options){classCallCheck(this,PlayToggle);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.on(player,'play',_this.handlePlay);_this.on(player,'pause',_this.handlePause);_this.on(player,'ended',_this.handleEnded);return _this;} PlayToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-play-control '+_Button.prototype.buildCSSClass.call(this);};PlayToggle.prototype.handleClick=function handleClick(event){if(this.player_.paused()){this.player_.play();}else{this.player_.pause();}};PlayToggle.prototype.handleSeeked=function handleSeeked(event){this.removeClass('vjs-ended');if(this.player_.paused()){this.handlePause(event);}else{this.handlePlay(event);}};PlayToggle.prototype.handlePlay=function handlePlay(event){this.removeClass('vjs-ended');this.removeClass('vjs-paused');this.addClass('vjs-playing');this.controlText('Pause');};PlayToggle.prototype.handlePause=function handlePause(event){this.removeClass('vjs-playing');this.addClass('vjs-paused');this.controlText('Play');};PlayToggle.prototype.handleEnded=function handleEnded(event){this.removeClass('vjs-playing');this.addClass('vjs-ended');this.controlText('Replay');this.one(this.player_,'seeked',this.handleSeeked);};return PlayToggle;}(Button);PlayToggle.prototype.controlText_='Play';Component.registerComponent('PlayToggle',PlayToggle);function formatTime(seconds){var guide=arguments.length>1&&arguments[1]!==undefined?arguments[1]:seconds;seconds=seconds<0?0:seconds;var s=Math.floor(seconds%60);var m=Math.floor(seconds/60%60);var h=Math.floor(seconds/3600);var gm=Math.floor(guide/60%60);var gh=Math.floor(guide/3600);if(isNaN(seconds)||seconds===Infinity){h=m=s='-';} h=h>0||gh>0?h+':':'';m=((h||gm>=10)&&m<10?'0'+m:m)+':';s=s<10?'0'+s:s;return h+m+s;} var TimeDisplay=function(_Component){inherits(TimeDisplay,_Component);function TimeDisplay(player,options){classCallCheck(this,TimeDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.throttledUpdateContent=throttle(bind(_this,_this.updateContent),25);_this.on(player,'timeupdate',_this.throttledUpdateContent);return _this;} TimeDisplay.prototype.createEl=function createEl$$1(plainName){var className=this.buildCSSClass();var el=_Component.prototype.createEl.call(this,'div',{className:className+' vjs-time-control vjs-control'});this.contentEl_=createEl('div',{className:className+'-display'},{'aria-live':'off'},createEl('span',{className:'vjs-control-text',textContent:this.localize(this.controlText_)}));this.updateTextNode_();el.appendChild(this.contentEl_);return el;};TimeDisplay.prototype.dispose=function dispose(){this.contentEl_=null;this.textNode_=null;_Component.prototype.dispose.call(this);};TimeDisplay.prototype.updateTextNode_=function updateTextNode_(){if(!this.contentEl_){return;} while(this.contentEl_.firstChild){this.contentEl_.removeChild(this.contentEl_.firstChild);} this.textNode_=document_1.createTextNode(this.formattedTime_||'0:00');this.contentEl_.appendChild(this.textNode_);};TimeDisplay.prototype.formatTime_=function formatTime_(time){return formatTime(time);};TimeDisplay.prototype.updateFormattedTime_=function updateFormattedTime_(time){var formattedTime=this.formatTime_(time);if(formattedTime===this.formattedTime_){return;} this.formattedTime_=formattedTime;this.requestAnimationFrame(this.updateTextNode_);};TimeDisplay.prototype.updateContent=function updateContent(event){};return TimeDisplay;}(Component);TimeDisplay.prototype.controlText_='Time';Component.registerComponent('TimeDisplay',TimeDisplay);var CurrentTimeDisplay=function(_TimeDisplay){inherits(CurrentTimeDisplay,_TimeDisplay);function CurrentTimeDisplay(player,options){classCallCheck(this,CurrentTimeDisplay);var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'ended',_this.handleEnded);return _this;} CurrentTimeDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-current-time';};CurrentTimeDisplay.prototype.updateContent=function updateContent(event){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateFormattedTime_(time);};CurrentTimeDisplay.prototype.handleEnded=function handleEnded(event){if(!this.player_.duration()){return;} this.updateFormattedTime_(this.player_.duration());};return CurrentTimeDisplay;}(TimeDisplay);CurrentTimeDisplay.prototype.controlText_='Current Time';Component.registerComponent('CurrentTimeDisplay',CurrentTimeDisplay);var DurationDisplay=function(_TimeDisplay){inherits(DurationDisplay,_TimeDisplay);function DurationDisplay(player,options){classCallCheck(this,DurationDisplay);var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'durationchange',_this.updateContent);_this.on(player,'loadedmetadata',_this.throttledUpdateContent);return _this;} DurationDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-duration';};DurationDisplay.prototype.updateContent=function updateContent(event){var duration=this.player_.duration();if(duration&&this.duration_!==duration){this.duration_=duration;this.updateFormattedTime_(duration);}};return DurationDisplay;}(TimeDisplay);DurationDisplay.prototype.controlText_='Duration Time';Component.registerComponent('DurationDisplay',DurationDisplay);var TimeDivider=function(_Component){inherits(TimeDivider,_Component);function TimeDivider(){classCallCheck(this,TimeDivider);return possibleConstructorReturn(this,_Component.apply(this,arguments));} TimeDivider.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-time-control vjs-time-divider',innerHTML:'
/
'});};return TimeDivider;}(Component);Component.registerComponent('TimeDivider',TimeDivider);var RemainingTimeDisplay=function(_TimeDisplay){inherits(RemainingTimeDisplay,_TimeDisplay);function RemainingTimeDisplay(player,options){classCallCheck(this,RemainingTimeDisplay);var _this=possibleConstructorReturn(this,_TimeDisplay.call(this,player,options));_this.on(player,'durationchange',_this.throttledUpdateContent);_this.on(player,'ended',_this.handleEnded);return _this;} RemainingTimeDisplay.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-remaining-time';};RemainingTimeDisplay.prototype.formatTime_=function formatTime_(time){return '-'+_TimeDisplay.prototype.formatTime_.call(this,time);};RemainingTimeDisplay.prototype.updateContent=function updateContent(event){if(!this.player_.duration()){return;} if(this.player_.remainingTimeDisplay){this.updateFormattedTime_(this.player_.remainingTimeDisplay());}else{this.updateFormattedTime_(this.player_.remainingTime());}};RemainingTimeDisplay.prototype.handleEnded=function handleEnded(event){if(!this.player_.duration()){return;} this.updateFormattedTime_(0);};return RemainingTimeDisplay;}(TimeDisplay);RemainingTimeDisplay.prototype.controlText_='Remaining Time';Component.registerComponent('RemainingTimeDisplay',RemainingTimeDisplay);var LiveDisplay=function(_Component){inherits(LiveDisplay,_Component);function LiveDisplay(player,options){classCallCheck(this,LiveDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.updateShowing();_this.on(_this.player(),'durationchange',_this.updateShowing);return _this;} LiveDisplay.prototype.createEl=function createEl$$1(){var el=_Component.prototype.createEl.call(this,'div',{className:'vjs-live-control vjs-control'});this.contentEl_=createEl('div',{className:'vjs-live-display',innerHTML:''+this.localize('Stream Type')+''+this.localize('LIVE')},{'aria-live':'off'});el.appendChild(this.contentEl_);return el;};LiveDisplay.prototype.dispose=function dispose(){this.contentEl_=null;_Component.prototype.dispose.call(this);};LiveDisplay.prototype.updateShowing=function updateShowing(event){if(this.player().duration()===Infinity){this.show();}else{this.hide();}};return LiveDisplay;}(Component);Component.registerComponent('LiveDisplay',LiveDisplay);var Slider=function(_Component){inherits(Slider,_Component);function Slider(player,options){classCallCheck(this,Slider);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.bar=_this.getChild(_this.options_.barName);_this.vertical(!!_this.options_.vertical);_this.enable();return _this;} Slider.prototype.enabled=function enabled(){return this.enabled_;};Slider.prototype.enable=function enable(){if(this.enabled()){return;} 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);if(this.playerEvent){this.on(this.player_,this.playerEvent,this.update);} this.removeClass('disabled');this.setAttribute('tabindex',0);this.enabled_=true;};Slider.prototype.disable=function disable(){if(!this.enabled()){return;} var doc=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(doc,'mousemove',this.handleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchmove',this.handleMouseMove);this.off(doc,'touchend',this.handleMouseUp);this.removeAttribute('tabindex');this.addClass('disabled');if(this.playerEvent){this.off(this.player_,this.playerEvent,this.update);} this.enabled_=false;};Slider.prototype.createEl=function createEl$$1(type){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var attributes=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};props.className=props.className+' vjs-slider';props=assign({tabIndex:0},props);attributes=assign({'role':'slider','aria-valuenow':0,'aria-valuemin':0,'aria-valuemax':100,'tabIndex':0},attributes);return _Component.prototype.createEl.call(this,type,props,attributes);};Slider.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.bar.el_.ownerDocument;event.preventDefault();blockTextSelection();this.addClass('vjs-sliding');this.trigger('slideractive');this.on(doc,'mousemove',this.handleMouseMove);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchmove',this.handleMouseMove);this.on(doc,'touchend',this.handleMouseUp);this.handleMouseMove(event);};Slider.prototype.handleMouseMove=function handleMouseMove(event){};Slider.prototype.handleMouseUp=function handleMouseUp(){var doc=this.bar.el_.ownerDocument;unblockTextSelection();this.removeClass('vjs-sliding');this.trigger('sliderinactive');this.off(doc,'mousemove',this.handleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchmove',this.handleMouseMove);this.off(doc,'touchend',this.handleMouseUp);this.update();};Slider.prototype.update=function update(){if(!this.el_){return;} var progress=this.getPercent();var bar=this.bar;if(!bar){return;} if(typeof progress!=='number'||progress!==progress||progress<0||progress===Infinity){progress=0;} var percentage=(progress*100).toFixed(2)+'%';var style=bar.el().style;if(this.vertical()){style.height=percentage;}else{style.width=percentage;} return progress;};Slider.prototype.calculateDistance=function calculateDistance(event){var position=getPointerPosition(this.el_,event);if(this.vertical()){return position.y;} return position.x;};Slider.prototype.handleFocus=function handleFocus(){this.on(this.bar.el_.ownerDocument,'keydown',this.handleKeyPress);};Slider.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===37||event.which===40){event.preventDefault();this.stepBack();}else if(event.which===38||event.which===39){event.preventDefault();this.stepForward();}};Slider.prototype.handleBlur=function handleBlur(){this.off(this.bar.el_.ownerDocument,'keydown',this.handleKeyPress);};Slider.prototype.handleClick=function handleClick(event){event.stopImmediatePropagation();event.preventDefault();};Slider.prototype.vertical=function vertical(bool){if(bool===undefined){return this.vertical_||false;} this.vertical_=!!bool;if(this.vertical_){this.addClass('vjs-slider-vertical');}else{this.addClass('vjs-slider-horizontal');}};return Slider;}(Component);Component.registerComponent('Slider',Slider);var LoadProgressBar=function(_Component){inherits(LoadProgressBar,_Component);function LoadProgressBar(player,options){classCallCheck(this,LoadProgressBar);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.partEls_=[];_this.on(player,'progress',_this.update);return _this;} LoadProgressBar.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-load-progress',innerHTML:''+this.localize('Loaded')+': 0%'});};LoadProgressBar.prototype.dispose=function dispose(){this.partEls_=null;_Component.prototype.dispose.call(this);};LoadProgressBar.prototype.update=function update(event){var buffered=this.player_.buffered();var duration=this.player_.duration();var bufferedEnd=this.player_.bufferedEnd();var children=this.partEls_;var percentify=function percentify(time,end){var percent=time/end||0;return(percent>=1?1:percent)*100+'%';};this.el_.style.width=percentify(bufferedEnd,duration);for(var i=0;ibuffered.length;_i--){this.el_.removeChild(children[_i-1]);} children.length=buffered.length;};return LoadProgressBar;}(Component);Component.registerComponent('LoadProgressBar',LoadProgressBar);var TimeTooltip=function(_Component){inherits(TimeTooltip,_Component);function TimeTooltip(){classCallCheck(this,TimeTooltip);return possibleConstructorReturn(this,_Component.apply(this,arguments));} TimeTooltip.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-time-tooltip'});};TimeTooltip.prototype.update=function update(seekBarRect,seekBarPoint,content){var tooltipRect=getBoundingClientRect(this.el_);var playerRect=getBoundingClientRect(this.player_.el());var seekBarPointPx=seekBarRect.width*seekBarPoint;if(!playerRect||!tooltipRect){return;} var spaceLeftOfPoint=seekBarRect.left-playerRect.left+seekBarPointPx;var spaceRightOfPoint=seekBarRect.width-seekBarPointPx+(playerRect.right-seekBarRect.right);var pullTooltipBy=tooltipRect.width/2;if(spaceLeftOfPointtooltipRect.width){pullTooltipBy=tooltipRect.width;} this.el_.style.right='-'+pullTooltipBy+'px';textContent(this.el_,content);};return TimeTooltip;}(Component);Component.registerComponent('TimeTooltip',TimeTooltip);var PlayProgressBar=function(_Component){inherits(PlayProgressBar,_Component);function PlayProgressBar(){classCallCheck(this,PlayProgressBar);return possibleConstructorReturn(this,_Component.apply(this,arguments));} PlayProgressBar.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-play-progress vjs-slider-bar',innerHTML:''+this.localize('Progress')+': 0%'});};PlayProgressBar.prototype.update=function update(seekBarRect,seekBarPoint){var _this2=this;if(this.rafId_){this.cancelAnimationFrame(this.rafId_);} this.rafId_=this.requestAnimationFrame(function(){var time=_this2.player_.scrubbing()?_this2.player_.getCache().currentTime:_this2.player_.currentTime();var content=formatTime(time,_this2.player_.duration());var timeTooltip=_this2.getChild('timeTooltip');if(timeTooltip){timeTooltip.update(seekBarRect,seekBarPoint,content);}});};return PlayProgressBar;}(Component);PlayProgressBar.prototype.options_={children:[]};if((!IE_VERSION||IE_VERSION>8)&&!IS_IOS&&!IS_ANDROID){PlayProgressBar.prototype.options_.children.push('timeTooltip');} Component.registerComponent('PlayProgressBar',PlayProgressBar);var MouseTimeDisplay=function(_Component){inherits(MouseTimeDisplay,_Component);function MouseTimeDisplay(player,options){classCallCheck(this,MouseTimeDisplay);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.update=throttle(bind(_this,_this.update),25);return _this;} MouseTimeDisplay.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-mouse-display'});};MouseTimeDisplay.prototype.update=function update(seekBarRect,seekBarPoint){var _this2=this;if(this.rafId_){this.cancelAnimationFrame(this.rafId_);} this.rafId_=this.requestAnimationFrame(function(){var duration=_this2.player_.duration();var content=formatTime(seekBarPoint*duration,duration);_this2.el_.style.left=seekBarRect.width*seekBarPoint+'px';_this2.getChild('timeTooltip').update(seekBarRect,seekBarPoint,content);});};return MouseTimeDisplay;}(Component);MouseTimeDisplay.prototype.options_={children:['timeTooltip']};Component.registerComponent('MouseTimeDisplay',MouseTimeDisplay);var STEP_SECONDS=5;var UPDATE_REFRESH_INTERVAL=30;var SeekBar=function(_Slider){inherits(SeekBar,_Slider);function SeekBar(player,options){classCallCheck(this,SeekBar);var _this=possibleConstructorReturn(this,_Slider.call(this,player,options));_this.update=throttle(bind(_this,_this.update),UPDATE_REFRESH_INTERVAL);_this.on(player,'timeupdate',_this.update);_this.on(player,'ended',_this.handleEnded);_this.updateInterval=null;_this.on(player,['playing'],function(){_this.clearInterval(_this.updateInterval);_this.updateInterval=_this.setInterval(function(){_this.requestAnimationFrame(function(){_this.update();});},UPDATE_REFRESH_INTERVAL);});_this.on(player,['ended','pause','waiting'],function(){_this.clearInterval(_this.updateInterval);});_this.on(player,['timeupdate','ended'],_this.update);return _this;} SeekBar.prototype.createEl=function createEl$$1(){return _Slider.prototype.createEl.call(this,'div',{className:'vjs-progress-holder'},{'aria-label':this.localize('Progress Bar')});};SeekBar.prototype.update_=function update_(currentTime,percent){var duration=this.player_.duration();this.el_.setAttribute('aria-valuenow',(percent*100).toFixed(2));this.el_.setAttribute('aria-valuetext',this.localize('progress bar timing: currentTime={1} duration={2}',[formatTime(currentTime,duration),formatTime(duration,duration)],'{1} of {2}'));this.bar.update(getBoundingClientRect(this.el_),percent);};SeekBar.prototype.update=function update(event){var percent=_Slider.prototype.update.call(this);this.update_(this.getCurrentTime_(),percent);return percent;};SeekBar.prototype.getCurrentTime_=function getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();};SeekBar.prototype.handleEnded=function handleEnded(event){this.update_(this.player_.duration(),1);};SeekBar.prototype.getPercent=function getPercent(){var percent=this.getCurrentTime_()/this.player_.duration();return percent>=1?1:percent;};SeekBar.prototype.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return;} this.player_.scrubbing(true);this.videoWasPlaying=!this.player_.paused();this.player_.pause();_Slider.prototype.handleMouseDown.call(this,event);};SeekBar.prototype.handleMouseMove=function handleMouseMove(event){if(!isSingleLeftClick(event)){return;} var newTime=this.calculateDistance(event)*this.player_.duration();if(newTime===this.player_.duration()){newTime=newTime-0.1;} this.player_.currentTime(newTime);};SeekBar.prototype.enable=function enable(){_Slider.prototype.enable.call(this);var mouseTimeDisplay=this.getChild('mouseTimeDisplay');if(!mouseTimeDisplay){return;} mouseTimeDisplay.show();};SeekBar.prototype.disable=function disable(){_Slider.prototype.disable.call(this);var mouseTimeDisplay=this.getChild('mouseTimeDisplay');if(!mouseTimeDisplay){return;} mouseTimeDisplay.hide();};SeekBar.prototype.handleMouseUp=function handleMouseUp(event){_Slider.prototype.handleMouseUp.call(this,event);this.player_.scrubbing(false);this.player_.trigger({type:'timeupdate',target:this,manuallyTriggered:true});if(this.videoWasPlaying){silencePromise(this.player_.play());}};SeekBar.prototype.stepForward=function stepForward(){this.player_.currentTime(this.player_.currentTime()+STEP_SECONDS);};SeekBar.prototype.stepBack=function stepBack(){this.player_.currentTime(this.player_.currentTime()-STEP_SECONDS);};SeekBar.prototype.handleAction=function handleAction(event){if(this.player_.paused()){this.player_.play();}else{this.player_.pause();}};SeekBar.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===32||event.which===13){event.preventDefault();this.handleAction(event);}else if(_Slider.prototype.handleKeyPress){_Slider.prototype.handleKeyPress.call(this,event);}};return SeekBar;}(Slider);SeekBar.prototype.options_={children:['loadProgressBar','playProgressBar'],barName:'playProgressBar'};if((!IE_VERSION||IE_VERSION>8)&&!IS_IOS&&!IS_ANDROID){SeekBar.prototype.options_.children.splice(1,0,'mouseTimeDisplay');} SeekBar.prototype.playerEvent='timeupdate';Component.registerComponent('SeekBar',SeekBar);var ProgressControl=function(_Component){inherits(ProgressControl,_Component);function ProgressControl(player,options){classCallCheck(this,ProgressControl);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.handleMouseMove=throttle(bind(_this,_this.handleMouseMove),25);_this.throttledHandleMouseSeek=throttle(bind(_this,_this.handleMouseSeek),25);_this.enable();return _this;} ProgressControl.prototype.createEl=function createEl$$1(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-progress-control vjs-control'});};ProgressControl.prototype.handleMouseMove=function handleMouseMove(event){var seekBar=this.getChild('seekBar');var mouseTimeDisplay=seekBar.getChild('mouseTimeDisplay');var seekBarEl=seekBar.el();var seekBarRect=getBoundingClientRect(seekBarEl);var seekBarPoint=getPointerPosition(seekBarEl,event).x;if(seekBarPoint>1){seekBarPoint=1;}else if(seekBarPoint<0){seekBarPoint=0;} if(mouseTimeDisplay){mouseTimeDisplay.update(seekBarRect,seekBarPoint);}};ProgressControl.prototype.handleMouseSeek=function handleMouseSeek(event){var seekBar=this.getChild('seekBar');seekBar.handleMouseMove(event);};ProgressControl.prototype.enabled=function enabled(){return this.enabled_;};ProgressControl.prototype.disable=function disable(){this.children().forEach(function(child){return child.disable&&child.disable();});if(!this.enabled()){return;} this.off(['mousedown','touchstart'],this.handleMouseDown);this.off(this.el_,'mousemove',this.handleMouseMove);this.handleMouseUp();this.addClass('disabled');this.enabled_=false;};ProgressControl.prototype.enable=function enable(){this.children().forEach(function(child){return child.enable&&child.enable();});if(this.enabled()){return;} this.on(['mousedown','touchstart'],this.handleMouseDown);this.on(this.el_,'mousemove',this.handleMouseMove);this.removeClass('disabled');this.enabled_=true;};ProgressControl.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;this.on(doc,'mousemove',this.throttledHandleMouseSeek);this.on(doc,'touchmove',this.throttledHandleMouseSeek);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchend',this.handleMouseUp);};ProgressControl.prototype.handleMouseUp=function handleMouseUp(event){var doc=this.el_.ownerDocument;this.off(doc,'mousemove',this.throttledHandleMouseSeek);this.off(doc,'touchmove',this.throttledHandleMouseSeek);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchend',this.handleMouseUp);};return ProgressControl;}(Component);ProgressControl.prototype.options_={children:['seekBar']};Component.registerComponent('ProgressControl',ProgressControl);var FullscreenToggle=function(_Button){inherits(FullscreenToggle,_Button);function FullscreenToggle(player,options){classCallCheck(this,FullscreenToggle);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));_this.on(player,'fullscreenchange',_this.handleFullscreenChange);return _this;} FullscreenToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-fullscreen-control '+_Button.prototype.buildCSSClass.call(this);};FullscreenToggle.prototype.handleFullscreenChange=function handleFullscreenChange(event){if(this.player_.isFullscreen()){this.controlText('Non-Fullscreen');}else{this.controlText('Fullscreen');}};FullscreenToggle.prototype.handleClick=function handleClick(event){if(!this.player_.isFullscreen()){this.player_.requestFullscreen();}else{this.player_.exitFullscreen();}};return FullscreenToggle;}(Button);FullscreenToggle.prototype.controlText_='Fullscreen';Component.registerComponent('FullscreenToggle',FullscreenToggle);var checkVolumeSupport=function checkVolumeSupport(self,player){if(player.tech_&&!player.tech_.featuresVolumeControl){self.addClass('vjs-hidden');} self.on(player,'loadstart',function(){if(!player.tech_.featuresVolumeControl){self.addClass('vjs-hidden');}else{self.removeClass('vjs-hidden');}});};var VolumeLevel=function(_Component){inherits(VolumeLevel,_Component);function VolumeLevel(){classCallCheck(this,VolumeLevel);return possibleConstructorReturn(this,_Component.apply(this,arguments));} VolumeLevel.prototype.createEl=function createEl(){return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-level',innerHTML:''});};return VolumeLevel;}(Component);Component.registerComponent('VolumeLevel',VolumeLevel);var VolumeBar=function(_Slider){inherits(VolumeBar,_Slider);function VolumeBar(player,options){classCallCheck(this,VolumeBar);var _this=possibleConstructorReturn(this,_Slider.call(this,player,options));_this.on('slideractive',_this.updateLastVolume_);_this.on(player,'volumechange',_this.updateARIAAttributes);player.ready(function(){return _this.updateARIAAttributes();});return _this;} VolumeBar.prototype.createEl=function createEl$$1(){return _Slider.prototype.createEl.call(this,'div',{className:'vjs-volume-bar vjs-slider-bar'},{'aria-label':this.localize('Volume Level'),'aria-live':'polite'});};VolumeBar.prototype.handleMouseDown=function handleMouseDown(event){if(!isSingleLeftClick(event)){return;} _Slider.prototype.handleMouseDown.call(this,event);};VolumeBar.prototype.handleMouseMove=function handleMouseMove(event){if(!isSingleLeftClick(event)){return;} this.checkMuted();this.player_.volume(this.calculateDistance(event));};VolumeBar.prototype.checkMuted=function checkMuted(){if(this.player_.muted()){this.player_.muted(false);}};VolumeBar.prototype.getPercent=function getPercent(){if(this.player_.muted()){return 0;} return this.player_.volume();};VolumeBar.prototype.stepForward=function stepForward(){this.checkMuted();this.player_.volume(this.player_.volume()+0.1);};VolumeBar.prototype.stepBack=function stepBack(){this.checkMuted();this.player_.volume(this.player_.volume()-0.1);};VolumeBar.prototype.updateARIAAttributes=function updateARIAAttributes(event){var ariaValue=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute('aria-valuenow',ariaValue);this.el_.setAttribute('aria-valuetext',ariaValue+'%');};VolumeBar.prototype.volumeAsPercentage_=function volumeAsPercentage_(){return Math.round(this.player_.volume()*100);};VolumeBar.prototype.updateLastVolume_=function updateLastVolume_(){var _this2=this;var volumeBeforeDrag=this.player_.volume();this.one('sliderinactive',function(){if(_this2.player_.volume()===0){_this2.player_.lastVolume_(volumeBeforeDrag);}});};return VolumeBar;}(Slider);VolumeBar.prototype.options_={children:['volumeLevel'],barName:'volumeLevel'};VolumeBar.prototype.playerEvent='volumechange';Component.registerComponent('VolumeBar',VolumeBar);var VolumeControl=function(_Component){inherits(VolumeControl,_Component);function VolumeControl(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,VolumeControl);options.vertical=options.vertical||false;if(typeof options.volumeBar==='undefined'||isPlain(options.volumeBar)){options.volumeBar=options.volumeBar||{};options.volumeBar.vertical=options.vertical;} var _this=possibleConstructorReturn(this,_Component.call(this,player,options));checkVolumeSupport(_this,player);_this.throttledHandleMouseMove=throttle(bind(_this,_this.handleMouseMove),25);_this.on('mousedown',_this.handleMouseDown);_this.on('touchstart',_this.handleMouseDown);_this.on(_this.volumeBar,['focus','slideractive'],function(){_this.volumeBar.addClass('vjs-slider-active');_this.addClass('vjs-slider-active');_this.trigger('slideractive');});_this.on(_this.volumeBar,['blur','sliderinactive'],function(){_this.volumeBar.removeClass('vjs-slider-active');_this.removeClass('vjs-slider-active');_this.trigger('sliderinactive');});return _this;} VolumeControl.prototype.createEl=function createEl(){var orientationClass='vjs-volume-horizontal';if(this.options_.vertical){orientationClass='vjs-volume-vertical';} return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-control vjs-control '+orientationClass});};VolumeControl.prototype.handleMouseDown=function handleMouseDown(event){var doc=this.el_.ownerDocument;this.on(doc,'mousemove',this.throttledHandleMouseMove);this.on(doc,'touchmove',this.throttledHandleMouseMove);this.on(doc,'mouseup',this.handleMouseUp);this.on(doc,'touchend',this.handleMouseUp);};VolumeControl.prototype.handleMouseUp=function handleMouseUp(event){var doc=this.el_.ownerDocument;this.off(doc,'mousemove',this.throttledHandleMouseMove);this.off(doc,'touchmove',this.throttledHandleMouseMove);this.off(doc,'mouseup',this.handleMouseUp);this.off(doc,'touchend',this.handleMouseUp);};VolumeControl.prototype.handleMouseMove=function handleMouseMove(event){this.volumeBar.handleMouseMove(event);};return VolumeControl;}(Component);VolumeControl.prototype.options_={children:['volumeBar']};Component.registerComponent('VolumeControl',VolumeControl);var MuteToggle=function(_Button){inherits(MuteToggle,_Button);function MuteToggle(player,options){classCallCheck(this,MuteToggle);var _this=possibleConstructorReturn(this,_Button.call(this,player,options));checkVolumeSupport(_this,player);_this.on(player,['loadstart','volumechange'],_this.update);return _this;} MuteToggle.prototype.buildCSSClass=function buildCSSClass(){return 'vjs-mute-control '+_Button.prototype.buildCSSClass.call(this);};MuteToggle.prototype.handleClick=function handleClick(event){var vol=this.player_.volume();var lastVolume=this.player_.lastVolume_();if(vol===0){var volumeToSet=lastVolume<0.1?0.1:lastVolume;this.player_.volume(volumeToSet);this.player_.muted(false);}else{this.player_.muted(this.player_.muted()?false:true);}};MuteToggle.prototype.update=function update(event){this.updateIcon_();this.updateControlText_();};MuteToggle.prototype.updateIcon_=function updateIcon_(){var vol=this.player_.volume();var level=3;if(vol===0||this.player_.muted()){level=0;}else if(vol<0.33){level=1;}else if(vol<0.67){level=2;} for(var i=0;i<4;i++){removeClass(this.el_,'vjs-vol-'+i);} addClass(this.el_,'vjs-vol-'+level);};MuteToggle.prototype.updateControlText_=function updateControlText_(){var soundOff=this.player_.muted()||this.player_.volume()===0;var text=soundOff?'Unmute':'Mute';if(this.controlText()!==text){this.controlText(text);}};return MuteToggle;}(Button);MuteToggle.prototype.controlText_='Mute';Component.registerComponent('MuteToggle',MuteToggle);var VolumePanel=function(_Component){inherits(VolumePanel,_Component);function VolumePanel(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,VolumePanel);if(typeof options.inline!=='undefined'){options.inline=options.inline;}else{options.inline=true;} if(typeof options.volumeControl==='undefined'||isPlain(options.volumeControl)){options.volumeControl=options.volumeControl||{};options.volumeControl.vertical=!options.inline;} var _this=possibleConstructorReturn(this,_Component.call(this,player,options));checkVolumeSupport(_this,player);_this.on(_this.volumeControl,['slideractive'],_this.sliderActive_);_this.on(_this.muteToggle,'focus',_this.sliderActive_);_this.on(_this.volumeControl,['sliderinactive'],_this.sliderInactive_);_this.on(_this.muteToggle,'blur',_this.sliderInactive_);return _this;} VolumePanel.prototype.sliderActive_=function sliderActive_(){this.addClass('vjs-slider-active');};VolumePanel.prototype.sliderInactive_=function sliderInactive_(){this.removeClass('vjs-slider-active');};VolumePanel.prototype.createEl=function createEl(){var orientationClass='vjs-volume-panel-horizontal';if(!this.options_.inline){orientationClass='vjs-volume-panel-vertical';} return _Component.prototype.createEl.call(this,'div',{className:'vjs-volume-panel vjs-control '+orientationClass});};return VolumePanel;}(Component);VolumePanel.prototype.options_={children:['muteToggle','volumeControl']};Component.registerComponent('VolumePanel',VolumePanel);var Menu=function(_Component){inherits(Menu,_Component);function Menu(player,options){classCallCheck(this,Menu);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));if(options){_this.menuButton_=options.menuButton;} _this.focusedChild_=-1;_this.on('keydown',_this.handleKeyPress);return _this;} Menu.prototype.addItem=function addItem(component){this.addChild(component);component.on('click',bind(this,function(event){if(this.menuButton_){this.menuButton_.unpressButton();if(component.name()!=='CaptionSettingsMenuItem'){this.menuButton_.focus();}}}));};Menu.prototype.createEl=function createEl$$1(){var contentElType=this.options_.contentElType||'ul';this.contentEl_=createEl(contentElType,{className:'vjs-menu-content'});this.contentEl_.setAttribute('role','menu');var el=_Component.prototype.createEl.call(this,'div',{append:this.contentEl_,className:'vjs-menu'});el.appendChild(this.contentEl_);on(el,'click',function(event){event.preventDefault();event.stopImmediatePropagation();});return el;};Menu.prototype.dispose=function dispose(){this.contentEl_=null;_Component.prototype.dispose.call(this);};Menu.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===37||event.which===40){event.preventDefault();this.stepForward();}else if(event.which===38||event.which===39){event.preventDefault();this.stepBack();}};Menu.prototype.stepForward=function stepForward(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_+1;} this.focus(stepChild);};Menu.prototype.stepBack=function stepBack(){var stepChild=0;if(this.focusedChild_!==undefined){stepChild=this.focusedChild_-1;} this.focus(stepChild);};Menu.prototype.focus=function focus(){var item=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var children=this.children().slice();var haveTitle=children.length&&children[0].className&&/vjs-menu-title/.test(children[0].className);if(haveTitle){children.shift();} if(children.length>0){if(item<0){item=0;}else if(item>=children.length){item=children.length-1;} this.focusedChild_=item;children[item].el_.focus();}};return Menu;}(Component);Component.registerComponent('Menu',Menu);var MenuButton=function(_Component){inherits(MenuButton,_Component);function MenuButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,MenuButton);var _this=possibleConstructorReturn(this,_Component.call(this,player,options));_this.menuButton_=new Button(player,options);_this.menuButton_.controlText(_this.controlText_);_this.menuButton_.el_.setAttribute('aria-haspopup','true');var buttonClass=Button.prototype.buildCSSClass();_this.menuButton_.el_.className=_this.buildCSSClass()+' '+buttonClass;_this.menuButton_.removeClass('vjs-control');_this.addChild(_this.menuButton_);_this.update();_this.enabled_=true;_this.on(_this.menuButton_,'tap',_this.handleClick);_this.on(_this.menuButton_,'click',_this.handleClick);_this.on(_this.menuButton_,'focus',_this.handleFocus);_this.on(_this.menuButton_,'blur',_this.handleBlur);_this.on('keydown',_this.handleSubmenuKeyPress);return _this;} MenuButton.prototype.update=function update(){var menu=this.createMenu();if(this.menu){this.menu.dispose();this.removeChild(this.menu);} this.menu=menu;this.addChild(menu);this.buttonPressed_=false;this.menuButton_.el_.setAttribute('aria-expanded','false');if(this.items&&this.items.length<=this.hideThreshold_){this.hide();}else{this.show();}};MenuButton.prototype.createMenu=function createMenu(){var menu=new Menu(this.player_,{menuButton:this});this.hideThreshold_=0;if(this.options_.title){var title=createEl('li',{className:'vjs-menu-title',innerHTML:toTitleCase(this.options_.title),tabIndex:-1});this.hideThreshold_+=1;menu.children_.unshift(title);prependTo(title,menu.contentEl());} this.items=this.createItems();if(this.items){for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(text,el);};MenuButton.prototype.handleClick=function handleClick(event){this.one(this.menu.contentEl(),'mouseleave',bind(this,function(e){this.unpressButton();this.el_.blur();}));if(this.buttonPressed_){this.unpressButton();}else{this.pressButton();}};MenuButton.prototype.focus=function focus(){this.menuButton_.focus();};MenuButton.prototype.blur=function blur(){this.menuButton_.blur();};MenuButton.prototype.handleFocus=function handleFocus(){on(document_1,'keydown',bind(this,this.handleKeyPress));};MenuButton.prototype.handleBlur=function handleBlur(){off(document_1,'keydown',bind(this,this.handleKeyPress));};MenuButton.prototype.handleKeyPress=function handleKeyPress(event){if(event.which===27||event.which===9){if(this.buttonPressed_){this.unpressButton();} if(event.which!==9){event.preventDefault();this.menuButton_.el_.focus();}}else if(event.which===38||event.which===40){if(!this.buttonPressed_){this.pressButton();event.preventDefault();}}};MenuButton.prototype.handleSubmenuKeyPress=function handleSubmenuKeyPress(event){if(event.which===27||event.which===9){if(this.buttonPressed_){this.unpressButton();} if(event.which!==9){event.preventDefault();this.menuButton_.el_.focus();}}};MenuButton.prototype.pressButton=function pressButton(){if(this.enabled_){this.buttonPressed_=true;this.menu.lockShowing();this.menuButton_.el_.setAttribute('aria-expanded','true');if(IS_IOS&&isInFrame()){return;} this.menu.focus();}};MenuButton.prototype.unpressButton=function unpressButton(){if(this.enabled_){this.buttonPressed_=false;this.menu.unlockShowing();this.menuButton_.el_.setAttribute('aria-expanded','false');}};MenuButton.prototype.disable=function disable(){this.unpressButton();this.enabled_=false;this.addClass('vjs-disabled');this.menuButton_.disable();};MenuButton.prototype.enable=function enable(){this.enabled_=true;this.removeClass('vjs-disabled');this.menuButton_.enable();};return MenuButton;}(Component);Component.registerComponent('MenuButton',MenuButton);var TrackButton=function(_MenuButton){inherits(TrackButton,_MenuButton);function TrackButton(player,options){classCallCheck(this,TrackButton);var tracks=options.tracks;var _this=possibleConstructorReturn(this,_MenuButton.call(this,player,options));if(_this.items.length<=1){_this.hide();} if(!tracks){return possibleConstructorReturn(_this);} var updateHandler=bind(_this,_this.update);tracks.addEventListener('removetrack',updateHandler);tracks.addEventListener('addtrack',updateHandler);_this.player_.on('ready',updateHandler);_this.player_.on('dispose',function(){tracks.removeEventListener('removetrack',updateHandler);tracks.removeEventListener('addtrack',updateHandler);});return _this;} return TrackButton;}(MenuButton);Component.registerComponent('TrackButton',TrackButton);var MenuItem=function(_ClickableComponent){inherits(MenuItem,_ClickableComponent);function MenuItem(player,options){classCallCheck(this,MenuItem);var _this=possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));_this.selectable=options.selectable;_this.selected(options.selected);if(_this.selectable){_this.el_.setAttribute('role','menuitemcheckbox');}else{_this.el_.setAttribute('role','menuitem');} return _this;} MenuItem.prototype.createEl=function createEl(type,props,attrs){this.nonIconControl=true;return _ClickableComponent.prototype.createEl.call(this,'li',assign({className:'vjs-menu-item',innerHTML:''+this.localize(this.options_.label)+'',tabIndex:-1},props),attrs);};MenuItem.prototype.handleClick=function handleClick(event){this.selected(true);};MenuItem.prototype.selected=function selected(_selected){if(this.selectable){if(_selected){this.addClass('vjs-selected');this.el_.setAttribute('aria-checked','true');this.controlText(', selected');}else{this.removeClass('vjs-selected');this.el_.setAttribute('aria-checked','false');this.controlText('');}}};return MenuItem;}(ClickableComponent);Component.registerComponent('MenuItem',MenuItem);var TextTrackMenuItem=function(_MenuItem){inherits(TextTrackMenuItem,_MenuItem);function TextTrackMenuItem(player,options){classCallCheck(this,TextTrackMenuItem);var track=options.track;var tracks=player.textTracks();options.label=track.label||track.language||'Unknown';options.selected=track.mode==='showing';var _this=possibleConstructorReturn(this,_MenuItem.call(this,player,options));_this.track=track;var changeHandler=function changeHandler(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];} _this.handleTracksChange.apply(_this,args);};var selectedLanguageChangeHandler=function selectedLanguageChangeHandler(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];} _this.handleSelectedLanguageChange.apply(_this,args);};player.on(['loadstart','texttrackchange'],changeHandler);tracks.addEventListener('change',changeHandler);tracks.addEventListener('selectedlanguagechange',selectedLanguageChangeHandler);_this.on('dispose',function(){player.off(['loadstart','texttrackchange'],changeHandler);tracks.removeEventListener('change',changeHandler);tracks.removeEventListener('selectedlanguagechange',selectedLanguageChangeHandler);});if(tracks.onchange===undefined){var event=void 0;_this.on(['tap','click'],function(){if(_typeof(window_1.Event)!=='object'){try{event=new window_1.Event('change');}catch(err){}} if(!event){event=document_1.createEvent('Event');event.initEvent('change',true,true);} tracks.dispatchEvent(event);});} _this.handleTracksChange();return _this;} TextTrackMenuItem.prototype.handleClick=function handleClick(event){var kind=this.track.kind;var kinds=this.track.kinds;var tracks=this.player_.textTracks();if(!kinds){kinds=[kind];} _MenuItem.prototype.handleClick.call(this,event);if(!tracks){return;} for(var i=0;i-1){if(track.mode!=='showing'){track.mode='showing';}}else if(track.mode!=='disabled'){track.mode='disabled';}}};TextTrackMenuItem.prototype.handleTracksChange=function handleTracksChange(event){this.selected(this.track.mode==='showing');};TextTrackMenuItem.prototype.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){if(this.track.mode==='showing'){var selectedLanguage=this.player_.cache_.selectedLanguage;if(selectedLanguage&&selectedLanguage.enabled&&selectedLanguage.language===this.track.language&&selectedLanguage.kind!==this.track.kind){return;} this.player_.cache_.selectedLanguage={enabled:true,language:this.track.language,kind:this.track.kind};}};TextTrackMenuItem.prototype.dispose=function dispose(){this.track=null;_MenuItem.prototype.dispose.call(this);};return TextTrackMenuItem;}(MenuItem);Component.registerComponent('TextTrackMenuItem',TextTrackMenuItem);var OffTextTrackMenuItem=function(_TextTrackMenuItem){inherits(OffTextTrackMenuItem,_TextTrackMenuItem);function OffTextTrackMenuItem(player,options){classCallCheck(this,OffTextTrackMenuItem);options.track={player:player,kind:options.kind,kinds:options.kinds,'default':false,mode:'disabled'};if(!options.kinds){options.kinds=[options.kind];} if(options.label){options.track.label=options.label;}else{options.track.label=options.kinds.join(' and ')+' off';} options.selectable=true;return possibleConstructorReturn(this,_TextTrackMenuItem.call(this,player,options));} OffTextTrackMenuItem.prototype.handleTracksChange=function handleTracksChange(event){var tracks=this.player().textTracks();var selected=true;for(var i=0,l=tracks.length;i-1&&track.mode==='showing'){selected=false;break;}} this.selected(selected);};OffTextTrackMenuItem.prototype.handleSelectedLanguageChange=function handleSelectedLanguageChange(event){var tracks=this.player().textTracks();var allHidden=true;for(var i=0,l=tracks.length;i-1&&track.mode==='showing'){allHidden=false;break;}} if(allHidden){this.player_.cache_.selectedLanguage={enabled:false};}};return OffTextTrackMenuItem;}(TextTrackMenuItem);Component.registerComponent('OffTextTrackMenuItem',OffTextTrackMenuItem);var TextTrackButton=function(_TrackButton){inherits(TextTrackButton,_TrackButton);function TextTrackButton(player){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};classCallCheck(this,TextTrackButton);options.tracks=player.textTracks();return possibleConstructorReturn(this,_TrackButton.call(this,player,options));} TextTrackButton.prototype.createItems=function createItems(){var items=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var TrackMenuItem=arguments.length>1&&arguments[1]!==undefined?arguments[1]:TextTrackMenuItem;var label=void 0;if(this.label_){label=this.label_+' off';} items.push(new OffTextTrackMenuItem(this.player_,{kinds:this.kinds_,kind:this.kind_,label:label}));this.hideThreshold_+=1;var tracks=this.player_.textTracks();if(!Array.isArray(this.kinds_)){this.kinds_=[this.kind_];} for(var i=0;i-1){var item=new TrackMenuItem(this.player_,{track:track,selectable:true});item.addClass('vjs-'+track.kind+'-menu-item');items.push(item);}} return items;};return TextTrackButton;}(TrackButton);Component.registerComponent('TextTrackButton',TextTrackButton);var ChaptersTrackMenuItem=function(_MenuItem){inherits(ChaptersTrackMenuItem,_MenuItem);function ChaptersTrackMenuItem(player,options){classCallCheck(this,ChaptersTrackMenuItem);var track=options.track;var cue=options.cue;var currentTime=player.currentTime();options.selectable=true;options.label=cue.text;options.selected=cue.startTime<=currentTime&¤tTime=0;i--){var track=tracks[i];if(track.kind===this.kind_){return track;}}};ChaptersButton.prototype.getMenuCaption=function getMenuCaption(){if(this.track_&&this.track_.label){return this.track_.label;} return this.localize(toTitleCase(this.kind_));};ChaptersButton.prototype.createMenu=function createMenu(){this.options_.title=this.getMenuCaption();return _TextTrackButton.prototype.createMenu.call(this);};ChaptersButton.prototype.createItems=function createItems(){var items=[];if(!this.track_){return items;} var cues=this.track_.cues;if(!cues){return items;} for(var i=0,l=cues.length;i