forked from Dash-Industry-Forum/dash.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dash.min.js
6 lines (6 loc) · 177 KB
/
dash.min.js
1
2
3
4
5
6
function X2JS(a,b,c){function d(a){var b=a.localName;return null==b&&(b=a.baseName),(null==b||""==b)&&(b=a.nodeName),b}function e(a){return a.prefix}function f(a){return"string"==typeof a?a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"):a}function g(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/")}function h(f){if(f.nodeType==u.DOCUMENT_NODE){var i,j,k,l=f.firstChild;for(j=0,k=f.childNodes.length;k>j;j+=1)if(f.childNodes[j].nodeType!==u.COMMENT_NODE){l=f.childNodes[j];break}if(c)i=h(l);else{i={};var m=d(l);i[m]=h(l)}return i}if(f.nodeType==u.ELEMENT_NODE){var i=new Object;i.__cnt=0;for(var n=f.childNodes,o=0;o<n.length;o++){var l=n.item(o),m=d(l);if(i.__cnt++,null==i[m])i[m]=h(l),i[m+"_asArray"]=new Array(1),i[m+"_asArray"][0]=i[m];else{if(null!=i[m]&&!(i[m]instanceof Array)){var p=i[m];i[m]=new Array,i[m][0]=p,i[m+"_asArray"]=i[m]}for(var q=0;null!=i[m][q];)q++;i[m][q]=h(l)}}for(var r=0;r<f.attributes.length;r++){var s=f.attributes.item(r);i.__cnt++;for(var v=s.value,w=0,x=a.length;x>w;w++){var y=a[w];y.test.call(this,s.value)&&(v=y.converter.call(this,s.value))}i[b+s.name]=v}var z=e(f);return null!=z&&""!=z&&(i.__cnt++,i.__prefix=z),1==i.__cnt&&null!=i["#text"]&&(i=i["#text"]),null!=i["#text"]&&(i.__text=i["#text"],t&&(i.__text=g(i.__text)),delete i["#text"],delete i["#text_asArray"]),null!=i["#cdata-section"]&&(i.__cdata=i["#cdata-section"],delete i["#cdata-section"],delete i["#cdata-section_asArray"]),(null!=i.__text||null!=i.__cdata)&&(i.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),i}return f.nodeType==u.TEXT_NODE||f.nodeType==u.CDATA_SECTION_NODE?f.nodeValue:f.nodeType==u.COMMENT_NODE?null:void 0}function i(a,b,c,d){var e="<"+(null!=a&&null!=a.__prefix?a.__prefix+":":"")+b;if(null!=c)for(var f=0;f<c.length;f++){var g=c[f],h=a[g];e+=" "+g.substr(1)+"='"+h+"'"}return e+=d?"/>":">"}function j(a,b){return"</"+(null!=a.__prefix?a.__prefix+":":"")+b+">"}function k(a,b){return-1!==a.indexOf(b,a.length-b.length)}function l(a,b){return k(b.toString(),"_asArray")||0==b.toString().indexOf("_")||a[b]instanceof Function?!0:!1}function m(a){var b=0;if(a instanceof Object)for(var c in a)l(a,c)||b++;return b}function n(a){var b=[];if(a instanceof Object)for(var c in a)-1==c.toString().indexOf("__")&&0==c.toString().indexOf("_")&&b.push(c);return b}function o(a){var b="";return null!=a.__cdata&&(b+="<![CDATA["+a.__cdata+"]]>"),null!=a.__text&&(b+=t?f(a.__text):a.__text),b}function p(a){var b="";return a instanceof Object?b+=o(a):null!=a&&(b+=t?f(a):a),b}function q(a,b,c){var d="";if(0==a.length)d+=i(a,b,c,!0);else for(var e=0;e<a.length;e++)d+=i(a[e],b,n(a[e]),!1),d+=r(a[e]),d+=j(a[e],b);return d}function r(a){var b="",c=m(a);if(c>0)for(var d in a)if(!l(a,d)){var e=a[d],f=n(e);if(null==e||void 0==e)b+=i(e,d,f,!0);else if(e instanceof Object)if(e instanceof Array)b+=q(e,d,f);else{var g=m(e);g>0||null!=e.__text||null!=e.__cdata?(b+=i(e,d,f,!1),b+=r(e),b+=j(e,d)):b+=i(e,d,f,!0)}else b+=i(e,d,f,!1),b+=p(e),b+=j(e,d)}return b+=p(a)}(null===b||void 0===b)&&(b="_"),(null===c||void 0===c)&&(c=!1);var s="1.0.11",t=!1,u={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};this.parseXmlString=function(a){var b;if(window.DOMParser){var c=new window.DOMParser;b=c.parseFromString(a,"text/xml")}else 0==a.indexOf("<?")&&(a=a.substr(a.indexOf("?>")+2)),b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);return b},this.xml2json=function(a){return h(a)},this.xml_str2json=function(a){var b=this.parseXmlString(a);return this.xml2json(b)},this.json2xml_str=function(a){return r(a)},this.json2xml=function(a){var b=this.json2xml_str(a);return this.parseXmlString(b)},this.getVersion=function(){return s},this.escapeMode=function(a){t=a}}function ObjectIron(a){var b;for(b=[],i=0,len=a.length;len>i;i+=1)b.push(a[i].isRoot?"root":a[i].name);var c=function(a,b){var c;if(null!==a&&null!==b)for(c in a)a.hasOwnProperty(c)&&(b.hasOwnProperty(c)||(b[c]=a[c]))},d=function(a,b,d){var e,f,g,h,i;if(null!==a&&0!==a.length)for(e=0,f=a.length;f>e;e+=1)g=a[e],b.hasOwnProperty(g.name)&&(d.hasOwnProperty(g.name)?g.merge&&(h=b[g.name],i=d[g.name],"object"==typeof h&&"object"==typeof i?c(h,i):d[g.name]=null!=g.mergeFunction?g.mergeFunction(h,i):h+i):d[g.name]=b[g.name])},e=function(a,b){var c,f,g,h,i,j,k,l=a;if(null!==l.children&&0!==l.children.length)for(c=0,f=l.children.length;f>c;c+=1)if(j=l.children[c],b.hasOwnProperty(j.name))if(j.isArray)for(i=b[j.name+"_asArray"],g=0,h=i.length;h>g;g+=1)k=i[g],d(l.properties,b,k),e(j,k);else k=b[j.name],d(l.properties,b,k),e(j,k)},f=function(c){var d,g,h,i,j,k,l;if(null===c)return c;if("object"!=typeof c)return c;for(d=0,g=b.length;g>d;d+=1)"root"===b[d]&&(j=a[d],k=c,e(j,k));for(i in c)if(c.hasOwnProperty(i)){if(h=b.indexOf(i),-1!==h)if(j=a[h],j.isArray)for(l=c[i+"_asArray"],d=0,g=l.length;g>d;d+=1)k=l[d],e(j,k);else k=c[i],e(j,k);f(c[i])}return c};return{run:f}}MediaPlayer=function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l,m="1.3.0 (refactor)",n=a,o=!1,p=!1,q=!0,r=!1,s=MediaPlayer.dependencies.BufferController.BUFFER_SIZE_REQUIRED,t=function(){return!!e&&!!f},u=function(){if(!o)throw"MediaPlayer not initialized!";if(!this.capabilities.supportsMediaSource())return void this.errHandler.capabilityError("mediasource");if(!e||!f)throw"Missing view or source.";p=!0,g=b.getObject("streamController"),g.subscribe(g.eventList.ENAME_STREAMS_COMPOSED,i),c.subscribe(c.eventList.ENAME_MANIFEST_LOADED,g),c.subscribe(c.eventList.ENAME_MANIFEST_LOADED,i),g.setVideoModel(l),g.setAutoPlay(q),g.load(f),b.mapValue("scheduleWhilePaused",r),b.mapOutlet("scheduleWhilePaused","stream"),b.mapOutlet("scheduleWhilePaused","scheduleController"),b.mapValue("bufferMax",s),b.mapOutlet("bufferMax","bufferController"),h.initialize()},v=function(){t()&&u.call(this)},w=function(){var a=k.getReadOnlyMetricsFor("video")||k.getReadOnlyMetricsFor("audio");return j.getCurrentDVRInfo(a)},x=function(){return w.call(this).manifestInfo.DVRWindowSize},y=function(a){var b=w.call(this),c=b.range.start+a;return c>b.range.end&&(c=b.range.end),c},z=function(a){l.getElement().currentTime=this.getDVRSeekOffset(a)},A=function(){var a=w.call(this);return null===a?0:this.duration()-(a.range.end-a.time)},B=function(){var a,b=w.call(this);return null===b?0:(a=b.range.end-b.range.start,a<b.manifestInfo.DVRWindowSize?a:b.manifestInfo.DVRWindowSize)},C=function(){var a,b,c=w.call(this);return null===c?0:(a=c.manifestInfo.availableFrom.getTime()/1e3,b=this.time()+(a+c.range.start))},D=function(){var a,b,c=w.call(this);return null===c?0:(a=c.manifestInfo.availableFrom.getTime()/1e3,b=a+c.range.start+this.duration())},E=function(a,b,c){var d=new Date(1e3*a),e=d.toLocaleDateString(b),f=d.toLocaleTimeString(b,{hour12:c});return f+" "+e},F=function(a){a=Math.max(a,0);var b=Math.floor(a/3600),c=Math.floor(a%3600/60),d=Math.floor(a%3600%60);return(0===b?"":10>b?"0"+b.toString()+":":b.toString()+":")+(10>c?"0"+c.toString():c.toString())+":"+(10>d?"0"+d.toString():d.toString())},G=function(a,b,c){b&&void 0!==a&&null!==a&&(c?h.setRules(a,b):h.addRules(a,b))},H=function(){p&&g&&(g.unsubscribe(g.eventList.ENAME_STREAMS_COMPOSED,i),c.unsubscribe(c.eventList.ENAME_MANIFEST_LOADED,g),c.unsubscribe(c.eventList.ENAME_MANIFEST_LOADED,i),g.reset(),d.reset(),h.reset(),g=null,p=!1)};return b=new dijon.System,b.mapValue("system",b),b.mapOutlet("system"),b.injectInto(n),{notifier:void 0,debug:void 0,eventBus:void 0,capabilities:void 0,adapter:void 0,errHandler:void 0,tokenAuthentication:void 0,uriQueryFragModel:void 0,videoElementExt:void 0,setup:function(){j=b.getObject("metricsExt"),c=b.getObject("manifestLoader"),i=b.getObject("manifestUpdater"),d=b.getObject("abrController"),h=b.getObject("rulesController"),k=b.getObject("metricsModel")},addEventListener:function(a,b,c){this.eventBus.addEventListener(a,b,c)},removeEventListener:function(a,b,c){this.eventBus.removeEventListener(a,b,c)},getVersion:function(){return m},startup:function(){o||(b.injectInto(this),o=!0)},getDebug:function(){return this.debug},getVideoModel:function(){return l},setAutoPlay:function(a){q=a},getAutoPlay:function(){return q},setScheduleWhilePaused:function(a){r=a},getScheduleWhilePaused:function(){return r},setTokenAuthentication:function(a,b){this.tokenAuthentication.setTokenAuthentication({name:a,type:b})},setBufferMax:function(a){s=a},getBufferMax:function(){return s},getMetricsExt:function(){return j},getMetricsFor:function(a){var b=k.getReadOnlyMetricsFor(a);return b},getQualityFor:function(a){return d.getQualityFor(a)},setQualityFor:function(a,b){d.setPlaybackQuality(a,b)},getAutoSwitchQuality:function(){return d.getAutoSwitchBitrate()},setAutoSwitchQuality:function(a){d.setAutoSwitchBitrate(a)},setSchedulingRules:function(a){G.call(this,h.SCHEDULING_RULE,a,!0)},addSchedulingRules:function(a){G.call(this,h.SCHEDULING_RULE,a,!1)},setABRRules:function(a){G.call(this,h.ABR_RULE,a,!0)},addABRRules:function(a){G.call(this,h.ABR_RULE,a,!1)},attachView:function(a){if(!o)throw"MediaPlayer not initialized!";e=a,l=null,e&&(l=b.getObject("videoModel"),l.setElement(e)),H.call(this),t.call(this)&&v.call(this)},attachSource:function(a){if(!o)throw"MediaPlayer not initialized!";this.uriQueryFragModel.reset(),f=this.uriQueryFragModel.parseURI(a),H.call(this),t.call(this)&&v.call(this)},reset:function(){this.attachSource(null),this.attachView(null)},play:u,isReady:t,seek:z,time:A,duration:B,timeAsUTC:C,durationAsUTC:D,getDVRWindowSize:x,getDVRSeekOffset:y,formatUTC:E,convertToTimeCode:F}},MediaPlayer.prototype={constructor:MediaPlayer},MediaPlayer.dependencies={},MediaPlayer.utils={},MediaPlayer.models={},MediaPlayer.vo={},MediaPlayer.vo.metrics={},MediaPlayer.rules={},MediaPlayer.di={},MediaPlayer.di.Context=function(){"use strict";return{system:void 0,setup:function(){this.system.autoMapOutlets=!0,this.system.mapSingleton("debug",MediaPlayer.utils.Debug),this.system.mapSingleton("tokenAuthentication",MediaPlayer.utils.TokenAuthentication),this.system.mapSingleton("eventBus",MediaPlayer.utils.EventBus),this.system.mapSingleton("capabilities",MediaPlayer.utils.Capabilities),this.system.mapSingleton("textTrackExtensions",MediaPlayer.utils.TextTrackExtensions),this.system.mapSingleton("vttParser",MediaPlayer.utils.VTTParser),this.system.mapSingleton("ttmlParser",MediaPlayer.utils.TTMLParser),this.system.mapClass("videoModel",MediaPlayer.models.VideoModel),this.system.mapSingleton("manifestModel",MediaPlayer.models.ManifestModel),this.system.mapSingleton("metricsModel",MediaPlayer.models.MetricsModel),this.system.mapSingleton("uriQueryFragModel",MediaPlayer.models.URIQueryAndFragmentModel),this.system.mapClass("protectionModel",MediaPlayer.models.ProtectionModel),this.system.mapSingleton("textSourceBuffer",MediaPlayer.dependencies.TextSourceBuffer),this.system.mapSingleton("mediaSourceExt",MediaPlayer.dependencies.MediaSourceExtensions),this.system.mapSingleton("sourceBufferExt",MediaPlayer.dependencies.SourceBufferExtensions),this.system.mapSingleton("abrController",MediaPlayer.dependencies.AbrController),this.system.mapSingleton("errHandler",MediaPlayer.dependencies.ErrorHandler),this.system.mapSingleton("protectionExt",MediaPlayer.dependencies.ProtectionExtensions),this.system.mapSingleton("videoExt",MediaPlayer.dependencies.VideoModelExtensions),this.system.mapClass("protectionController",MediaPlayer.dependencies.ProtectionController),this.system.mapClass("playbackController",MediaPlayer.dependencies.PlaybackController),this.system.mapSingleton("liveEdgeFinder",MediaPlayer.dependencies.LiveEdgeFinder),this.system.mapClass("metrics",MediaPlayer.models.MetricsList),this.system.mapClass("downloadRatioRule",MediaPlayer.rules.DownloadRatioRule),this.system.mapClass("insufficientBufferRule",MediaPlayer.rules.InsufficientBufferRule),this.system.mapClass("limitSwitchesRule",MediaPlayer.rules.LimitSwitchesRule),this.system.mapSingleton("abrRulesCollection",MediaPlayer.rules.ABRRulesCollection),this.system.mapSingleton("rulesController",MediaPlayer.rules.RulesController),this.system.mapClass("liveEdgeBinarySearchRule",MediaPlayer.rules.LiveEdgeBinarySearchRule),this.system.mapClass("bufferLevelRule",MediaPlayer.rules.BufferLevelRule),this.system.mapClass("pendingRequestsRule",MediaPlayer.rules.PendingRequestsRule),this.system.mapClass("playbackTimeRule",MediaPlayer.rules.PlaybackTimeRule),this.system.mapClass("sameTimeRequestRule",MediaPlayer.rules.SameTimeRequestRule),this.system.mapSingleton("scheduleRulesCollection",MediaPlayer.rules.ScheduleRulesCollection),this.system.mapClass("streamProcessor",MediaPlayer.dependencies.StreamProcessor),this.system.mapClass("eventController",MediaPlayer.dependencies.EventController),this.system.mapClass("textController",MediaPlayer.dependencies.TextController),this.system.mapClass("bufferController",MediaPlayer.dependencies.BufferController),this.system.mapSingleton("manifestLoader",MediaPlayer.dependencies.ManifestLoader),this.system.mapSingleton("manifestUpdater",MediaPlayer.dependencies.ManifestUpdater),this.system.mapClass("fragmentController",MediaPlayer.dependencies.FragmentController),this.system.mapClass("fragmentLoader",MediaPlayer.dependencies.FragmentLoader),this.system.mapClass("fragmentModel",MediaPlayer.dependencies.FragmentModel),this.system.mapSingleton("streamController",MediaPlayer.dependencies.StreamController),this.system.mapClass("stream",MediaPlayer.dependencies.Stream),this.system.mapClass("scheduleController",MediaPlayer.dependencies.ScheduleController),this.system.mapSingleton("notifier",MediaPlayer.dependencies.Notifier)}}},Dash=function(){"use strict";return{modules:{},dependencies:{},vo:{},di:{}}}(),Dash.di.DashContext=function(){"use strict";return{system:void 0,setup:function(){Dash.di.DashContext.prototype.setup.call(this),this.system.mapClass("parser",Dash.dependencies.DashParser),this.system.mapClass("indexHandler",Dash.dependencies.DashHandler),this.system.mapSingleton("baseURLExt",Dash.dependencies.BaseURLExtensions),this.system.mapClass("fragmentExt",Dash.dependencies.FragmentExtensions),this.system.mapClass("trackController",Dash.dependencies.RepresentationController),this.system.mapSingleton("manifestExt",Dash.dependencies.DashManifestExtensions),this.system.mapSingleton("metricsExt",Dash.dependencies.DashMetricsExtensions),this.system.mapSingleton("timelineConverter",Dash.dependencies.TimelineConverter),this.system.mapSingleton("adapter",Dash.dependencies.DashAdapter)}}},Dash.di.DashContext.prototype=new MediaPlayer.di.Context,Dash.di.DashContext.prototype.constructor=Dash.di.DashContext,function(a){"use strict";var b={VERSION:"0.5.3"};b.System=function(){this._mappings={},this._outlets={},this._handlers={},this.strictInjections=!0,this.autoMapOutlets=!1,this.postInjectionHook="setup"},b.System.prototype={_createAndSetupInstance:function(a,b){var c=new b;return this.injectInto(c,a),c},_retrieveFromCacheOrCreate:function(a,b){"undefined"==typeof b&&(b=!1);var c;if(!this._mappings.hasOwnProperty(a))throw new Error(1e3);var d=this._mappings[a];return!b&&d.isSingleton?(null==d.object&&(d.object=this._createAndSetupInstance(a,d.clazz)),c=d.object):c=d.clazz?this._createAndSetupInstance(a,d.clazz):d.object,c},mapOutlet:function(a,b,c){if("undefined"==typeof a)throw new Error(1010);return b=b||"global",c=c||a,this._outlets.hasOwnProperty(b)||(this._outlets[b]={}),this._outlets[b][c]=a,this},getObject:function(a){if("undefined"==typeof a)throw new Error(1020);return this._retrieveFromCacheOrCreate(a)},mapValue:function(a,b){if("undefined"==typeof a)throw new Error(1030);return this._mappings[a]={clazz:null,object:b,isSingleton:!0},this.autoMapOutlets&&this.mapOutlet(a),this.hasMapping(a)&&this.injectInto(b,a),this},hasMapping:function(a){if("undefined"==typeof a)throw new Error(1040);return this._mappings.hasOwnProperty(a)},mapClass:function(a,b){if("undefined"==typeof a)throw new Error(1050);if("undefined"==typeof b)throw new Error(1051);return this._mappings[a]={clazz:b,object:null,isSingleton:!1},this.autoMapOutlets&&this.mapOutlet(a),this},mapSingleton:function(a,b){if("undefined"==typeof a)throw new Error(1060);if("undefined"==typeof b)throw new Error(1061);return this._mappings[a]={clazz:b,object:null,isSingleton:!0},this.autoMapOutlets&&this.mapOutlet(a),this},instantiate:function(a){if("undefined"==typeof a)throw new Error(1070);return this._retrieveFromCacheOrCreate(a,!0)},injectInto:function(a,b){if("undefined"==typeof a)throw new Error(1080);if("object"==typeof a){var c=[];this._outlets.hasOwnProperty("global")&&c.push(this._outlets.global),"undefined"!=typeof b&&this._outlets.hasOwnProperty(b)&&c.push(this._outlets[b]);for(var d in c){var e=c[d];for(var f in e){var g=e[f];(!this.strictInjections||f in a)&&(a[f]=this.getObject(g))}}"setup"in a&&a.setup.call(a)}return this},unmap:function(a){if("undefined"==typeof a)throw new Error(1090);return delete this._mappings[a],this},unmapOutlet:function(a,b){if("undefined"==typeof a)throw new Error(1100);if("undefined"==typeof b)throw new Error(1101);return delete this._outlets[a][b],this},mapHandler:function(a,b,c,d,e){if("undefined"==typeof a)throw new Error(1110);return b=b||"global",c=c||a,"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1),this._handlers.hasOwnProperty(a)||(this._handlers[a]={}),this._handlers[a].hasOwnProperty(b)||(this._handlers[a][b]=[]),this._handlers[a][b].push({handler:c,oneShot:d,passEvent:e}),this},unmapHandler:function(a,b,c){if("undefined"==typeof a)throw new Error(1120);if(b=b||"global",c=c||a,this._handlers.hasOwnProperty(a)&&this._handlers[a].hasOwnProperty(b)){var d=this._handlers[a][b];for(var e in d){var f=d[e];if(f.handler===c){d.splice(e,1);break}}}return this},notify:function(a){if("undefined"==typeof a)throw new Error(1130);var b=Array.prototype.slice.call(arguments),c=b.slice(1);if(this._handlers.hasOwnProperty(a)){var d=this._handlers[a];for(var e in d){var f,g=d[e];"global"!==e&&(f=this.getObject(e));var h,i,j=[];for(h=0,i=g.length;i>h;h++){var k,l=g[h];k=f&&"string"==typeof l.handler?f[l.handler]:l.handler,l.oneShot&&j.unshift(h),l.passEvent?k.apply(f,b):k.apply(f,c)}for(h=0,i=j.length;i>h;h++)g.splice(j[h],1)}}return this}},a.dijon=b}(this),Dash.dependencies.BaseURLExtensions=function(){"use strict";var a=function(a,b){for(var c,d,e,f,g,h,i,j,k,l,m=new DataView(a),n={},o=0;"sidx"!==j&&o<m.byteLength;){for(k=m.getUint32(o),o+=4,j="",f=0;4>f;f+=1)l=m.getInt8(o),j+=String.fromCharCode(l),o+=1;"moof"!==j&&"traf"!==j&&"sidx"!==j?o+=k-8:"sidx"===j&&(o-=8)}if(e=m.getUint32(o,!1)+o,e>a.byteLength)throw"sidx terminates after array buffer";for(n.version=m.getUint8(o+8),o+=12,n.timescale=m.getUint32(o+4,!1),o+=8,0===n.version?(n.earliest_presentation_time=m.getUint32(o,!1),n.first_offset=m.getUint32(o+4,!1),o+=8):(n.earliest_presentation_time=utils.Math.to64BitNumber(m.getUint32(o+4,!1),m.getUint32(o,!1)),n.first_offset=(m.getUint32(o+8,!1)<<32)+m.getUint32(o+12,!1),o+=16),n.first_offset+=e+(b||0),n.reference_count=m.getUint16(o+2,!1),o+=4,n.references=[],c=n.first_offset,d=n.earliest_presentation_time,f=0;f<n.reference_count;f+=1)h=m.getUint32(o,!1),g=h>>>31,h=2147483647&h,i=m.getUint32(o+4,!1),o+=12,n.references.push({size:h,type:g,offset:c,duration:i,time:d,timescale:n.timescale}),c+=h,d+=i;if(o!==e)throw"Error: final pos "+o+" differs from SIDX end "+e;return n},b=function(b,c,d){var e,f,g,h,i,j,k,l;for(e=a.call(this,b,d),f=e.references,g=[],i=0,j=f.length;j>i;i+=1)h=new Dash.vo.Segment,h.duration=f[i].duration,h.media=c,h.startTime=f[i].time,h.timescale=f[i].timescale,k=f[i].offset,l=f[i].offset+f[i].size-1,h.mediaRange=k+"-"+l,g.push(h);return this.debug.log("Parsed SIDX box: "+g.length+" segments."),g},c=function(a,b,d){var e,f,g,h,i,j,k,l,m,n=new DataView(a),o=0,p="",q=0,r=!1,s=this;for(s.debug.log("Searching for initialization.");"moov"!==p&&o<n.byteLength;){for(q=n.getUint32(o),o+=4,p="",j=0;4>j;j+=1)k=n.getInt8(o),p+=String.fromCharCode(k),o+=1;"ftyp"===p&&(e=o-8),"moov"===p&&(f=o-8),"moov"!==p&&(o+=q-8)}i=n.byteLength-o,"moov"!==p?(s.debug.log("Loading more bytes to find initialization."),b.range.start=0,b.range.end=b.bytesLoaded+b.bytesToLoad,l=new XMLHttpRequest,l.onloadend=function(){r||d.call(s,null,new Error("Error loading initialization."))},l.onload=function(){r=!0,b.bytesLoaded=b.range.end,c.call(s,l.response,function(a){d.call(s,a)})},l.onerror=function(){d.call(s,null,new Error("Error loading initialization."))},l.open("GET",s.tokenAuthentication.addTokenAsQueryArg(b.url)),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes="+b.range.start+"-"+b.range.end),l=s.tokenAuthentication.setTokenInRequestHeader(l),l.send(null)):(g=void 0===e?f:e,h=f+q-1,m=g+"-"+h,s.debug.log("Found the initialization. Range: "+m),d.call(s,m))},d=function(a){var b=new XMLHttpRequest,d=!0,e=this,f=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].BaseURL,g={url:f,range:{},searching:!1,bytesLoaded:0,bytesToLoad:1500,request:b};e.debug.log("Start searching for initialization."),g.range.start=0,g.range.end=g.bytesToLoad,b.onload=function(){b.status<200||b.status>299||(d=!1,g.bytesLoaded=g.range.end,c.call(e,b.response,g,function(b){a.range=b,a.initialization=f,e.notify(e.eventList.ENAME_INITIALIZATION_LOADED,a)}))},b.onloadend=b.onerror=function(){d&&(d=!1,e.errHandler.downloadError("initialization",g.url,b),e.notify(e.eventList.ENAME_INITIALIZATION_LOADED,a))},b.open("GET",e.tokenAuthentication.addTokenAsQueryArg(g.url)),b.responseType="arraybuffer",b.setRequestHeader("Range","bytes="+g.range.start+"-"+g.range.end),b=e.tokenAuthentication.setTokenInRequestHeader(b),b.send(null),e.debug.log("Perform init search: "+g.url)},e=function(a,c,d,g){var h,i,j,k,l,m,n,o,p,q=new DataView(a),r=new XMLHttpRequest,s=0,t="",u=0,v=!0,w=!1,x=this;for(x.debug.log("Searching for SIDX box."),x.debug.log(c.bytesLoaded+" bytes loaded.");"sidx"!==t&&s<q.byteLength;){for(u=q.getUint32(s),s+=4,t="",m=0;4>m;m+=1)n=q.getInt8(s),t+=String.fromCharCode(n),s+=1;"sidx"!==t&&(s+=u-8)}if(i=q.byteLength-s,"sidx"!==t)g.call(x);else if(u-8>i)x.debug.log("Found SIDX but we don't have all of it."),c.range.start=0,c.range.end=c.bytesLoaded+(u-i),r.onload=function(){r.status<200||r.status>299||(v=!1,c.bytesLoaded=c.range.end,e.call(x,r.response,c,d,g))},r.onloadend=r.onerror=function(){v&&(v=!1,x.errHandler.downloadError("SIDX",c.url,r),g.call(x))},r.open("GET",x.tokenAuthentication.addTokenAsQueryArg(c.url)),r.responseType="arraybuffer",r.setRequestHeader("Range","bytes="+c.range.start+"-"+c.range.end),r=x.tokenAuthentication.setTokenInRequestHeader(r),r.send(null);else if(c.range.start=s-8,c.range.end=c.range.start+u,x.debug.log("Found the SIDX box. Start: "+c.range.start+" | End: "+c.range.end),j=new ArrayBuffer(c.range.end-c.range.start),l=new Uint8Array(j),k=new Uint8Array(a,c.range.start,c.range.end-c.range.start),l.set(k),o=this.parseSIDX.call(this,j,c.range.start),p=o.references,null!==p&&void 0!==p&&p.length>0&&(w=1===p[0].type),w){x.debug.log("Initiate multiple SIDX load.");var y,z,A,B,C,D=[],E=0,F=function(a){a?(D=D.concat(a),E+=1,E>=z&&g.call(x,D)):g.call(x)};for(y=0,z=p.length;z>y;y+=1)A=p[y].offset,B=p[y].offset+p[y].size-1,C=A+"-"+B,f.call(x,d,null,C,F)}else x.debug.log("Parsing segments from SIDX."),h=b.call(x,j,c.url,c.range.start),g.call(x,h)},f=function(a,c,d,f){var g,h,i=new XMLHttpRequest,j=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].BaseURL,k=!0,l=this,m={url:j,range:{},searching:!1,bytesLoaded:0,bytesToLoad:1500,request:i};null===d?(l.debug.log("No known range for SIDX request."),m.searching=!0,m.range.start=0,m.range.end=m.bytesToLoad):(h=d.split("-"),m.range.start=parseFloat(h[0]),m.range.end=parseFloat(h[1])),i.onload=function(){i.status<200||i.status>299||(k=!1,m.searching?(m.bytesLoaded=m.range.end,e.call(l,i.response,m,a,function(b){b&&f.call(l,b,a,c)})):(g=b.call(l,i.response,m.url,m.range.start),f.call(l,g,a,c)))},i.onloadend=i.onerror=function(){k&&(k=!1,l.errHandler.downloadError("SIDX",m.url,i),f.call(l,null,a,c))},i.open("GET",l.tokenAuthentication.addTokenAsQueryArg(m.url)),i.responseType="arraybuffer",i.setRequestHeader("Range","bytes="+m.range.start+"-"+m.range.end),i=l.tokenAuthentication.setTokenInRequestHeader(i),i.send(null),l.debug.log("Perform SIDX load: "+m.url)},g=function(a,b,c){var d=this;a?d.notify(d.eventList.ENAME_SEGMENTS_LOADED,a,b,c):d.notify(d.eventList.ENAME_SEGMENTS_LOADED,null,b,c,new Error("error loading segments"))};return{debug:void 0,errHandler:void 0,tokenAuthentication:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_INITIALIZATION_LOADED:"initializationLoaded",ENAME_SEGMENTS_LOADED:"segmentsLoaded"},loadSegments:function(a,b,c){f.call(this,a,b,c,g.bind(this))},loadInitialization:d,parseSegments:b,parseSIDX:a,findSIDX:e}},Dash.dependencies.BaseURLExtensions.prototype={constructor:Dash.dependencies.BaseURLExtensions},Dash.dependencies.DashAdapter=function(){"use strict";var a=[],b={},c=function(a,b){return b.getRepresentationForQuality(a.quality)},d=function(a){return b[a.streamInfo.id][a.index]},e=function(b){var c,d=a.length,e=0;for(e;d>e;e+=1)if(c=a[e],b.id===c.id)return c;return null},f=function(a){var b=new MediaPlayer.vo.TrackInfo,c=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index],d=this.manifestExt.getRepresentationFor(a.index,c);return b.id=a.id,b.quality=a.index,b.bandwidth=this.manifestExt.getBandwidth(d),b.DVRWindow=a.segmentAvailabilityRange,b.fragmentDuration=a.segmentDuration||(a.segments&&a.segments.length>0?a.segments[0].duration:0/0),b.MSETimeOffset=a.MSETimeOffset,b.useCalculatedLiveEdgeTime=a.useCalculatedLiveEdgeTime,b.mediaInfo=g.call(this,a.adaptation),b},g=function(a){var b=new MediaPlayer.vo.MediaInfo,c=this,d=a.period.mpd.manifest.Period_asArray[a.period.index].AdaptationSet_asArray[a.index];return b.id=a.id,b.index=a.index,b.type=a.type,b.streamInfo=h.call(this,a.period),b.trackCount=this.manifestExt.getRepresentationCount(d),b.lang=this.manifestExt.getLanguageForAdaptation(d),b.codec=this.manifestExt.getCodec(d),b.mimeType=this.manifestExt.getMimeType(d),b.contentProtection=this.manifestExt.getContentProtectionData(d),b.contentProtection&&b.contentProtection.forEach(function(a){a.KID=c.manifestExt.getKID(a)}),b.isText=this.manifestExt.getIsTextTrack(b.mimeType),b},h=function(a){var b=new MediaPlayer.vo.StreamInfo;return b.id=a.id,b.index=a.index,b.start=a.start,b.duration=a.duration,b.manifestInfo=i.call(this,a.mpd),b},i=function(a){var b=new MediaPlayer.vo.ManifestInfo,c=this.manifestModel.getValue();return b.DVRWindowSize=a.timeShiftBufferDepth,b.loadedTime=a.manifest.loadedTime,b.availableFrom=a.availabilityStartTime,b.minBufferTime=a.manifest.minBufferTime,b.maxFragmentDuration=a.maxSegmentDuration,b.duration=this.manifestExt.getDuration(c),b.isDynamic=this.manifestExt.getIsDynamic(c),b},j=function(a,c,d){var f,h=e(c),i=h.id,j=this.manifestExt.getAdaptationForType(a,c.index,d);return j?(f=this.manifestExt.getIndexForAdaptation(j,a,c.index),b[i]=b[i]||this.manifestExt.getAdaptationsForPeriod(a,h),g.call(this,b[i][f])):null},k=function(c){var d,e,f,g=[];if(!c)return null;for(d=this.manifestExt.getMpd(c),a=this.manifestExt.getRegularPeriods(c,d),b={},e=a.length,f=0;e>f;f+=1)g.push(h.call(this,a[f]));return g},l=function(a){var b=this.manifestExt.getMpd(a);return i.call(this,b)},m=function(a,b){var c=a.trackController.getRepresentationForQuality(b);return a.indexHandler.getInitRequest(c)},n=function(a,b){var d=c(b,a.trackController);return a.indexHandler.getNextSegmentRequest(d)},o=function(a,b,d,e){var f=c(b,a.trackController);return a.indexHandler.getSegmentRequestForTime(f,d,e)},p=function(a,b,d){var e=c(b,a.trackController),f=a.indexHandler.generateSegmentRequestForTime(e,d);return f},q=function(a){return a.indexHandler.getCurrentTime()},r=function(a,b){return a.indexHandler.setCurrentTime(b)},s=function(a){var b,c,f=e(a.getStreamInfo()),g=a.getMediaInfo(),h=d(g),i=this.manifestModel.getValue(),j=a.getType();b=g.id,c=b?this.manifestExt.getAdaptationForId(b,i,f.index):this.manifestExt.getAdaptationForIndex(g.index,i,f.index),a.setMediaInfo(g),a.trackController.updateData(c,h,j)},t=function(a,b){var c=a.getRepresentationForQuality(b);return c?f.call(this,c):null},u=function(a){var b=a.getCurrentRepresentation();return b?f.call(this,b):null},v=function(a,b,c){var d=new Dash.vo.Event,e=a[0],f=a[1],g=a[2],h=a[3],i=a[4],j=a[5],k=a[6],l=c*g+h;return b[e]?(d.eventStream=b[e],d.eventStream.value=f,d.eventStream.timescale=g,d.duration=i,d.id=j,d.presentationTime=l,d.messageData=k,d.presentationTimeDelta=h,d):null},w=function(a,b){var f=this.manifestModel.getValue(),g=[];return a instanceof MediaPlayer.vo.StreamInfo?g=this.manifestExt.getEventsForPeriod(f,e(a)):a instanceof MediaPlayer.vo.MediaInfo?g=this.manifestExt.getEventStreamForAdaptationSet(f,d(a)):a instanceof MediaPlayer.vo.TrackInfo&&(g=this.manifestExt.getEventStreamForRepresentation(f,c(a,b.trackController))),g};return{system:void 0,manifestExt:void 0,manifestModel:void 0,timelineConverter:void 0,metricsList:{TCP_CONNECTION:"TcpConnection",HTTP_REQUEST:"HttpRequest",HTTP_REQUEST_TRACE:"HttpRequestTrace",TRACK_SWITCH:"RepresentationSwitch",BUFFER_LEVEL:"BufferLevel",DVR_INFO:"DVRInfo",DROPPED_FRAMES:"DroppedFrames",SCHEDULING_INFO:"SchedulingInfo",MANIFEST_UPDATE:"ManifestUpdate",MANIFEST_UPDATE_STREAM_INFO:"ManifestUpdatePeriodInfo",MANIFEST_UPDATE_TRACK_INFO:"ManifestUpdateRepresentationInfo",PLAY_LIST:"PlayList",PLAY_LIST_TRACE:"PlayListTrace"},convertDataToTrack:f,convertDataToMedia:g,convertDataToStream:h,getDataForTrack:c,getDataForMedia:d,getDataForStream:e,getStreamsInfo:k,getManifestInfo:l,getMediaInfoForType:j,getCurrentTrackInfo:u,getTrackInfoForQuality:t,updateData:s,getInitRequest:m,getNextFragmentRequest:n,getFragmentRequestForTime:o,generateFragmentRequestForTime:p,getIndexHandlerTime:q,setIndexHandlerTime:r,getEventsFor:w,getEvent:v,reset:function(){a=[],b={}}}},Dash.dependencies.DashAdapter.prototype={constructor:Dash.dependencies.DashAdapter},Dash.dependencies.DashHandler=function(){"use strict";var a,b,c,d=-1,e=0,f=function(a,b){for(;a.length<b;)a="0"+a;return a},g=function(a,b,c){for(var d,e,g,h,i=0,j=0,k=b.length,l="%0",m=l.length;;){if(i=a.indexOf("$"+b),0>i)return a;if(j=a.indexOf("$",i+k),0>j)return a;if(d=a.indexOf(l,i+k),d>i&&j>d)switch(e=a.charAt(j-1),g=parseInt(a.substring(d+m,j-1),10),e){case"d":case"i":case"u":h=f(c.toString(),g);break;case"x":h=f(c.toString(16),g);break;case"X":h=f(c.toString(16),g).toUpperCase();break;case"o":h=f(c.toString(8),g);break;default:return this.debug.log("Unsupported/invalid IEEE 1003.1 format identifier string in URL"),a}else h=c;a=a.substring(0,i)+h+a.substring(j+1)}},h=function(a){return a.split("$$").join("$")},i=function(a,b){if(null===b||-1===a.indexOf("$RepresentationID$"))return a;var c=b.toString();return a.split("$RepresentationID$").join(c)},j=function(a,b){return a.representation.startNumber+b},k=function(a,b){var c,d=b.adaptation.period.mpd.manifest.Period_asArray[b.adaptation.period.index].AdaptationSet_asArray[b.adaptation.index].Representation_asArray[b.index].BaseURL;return c=a===d?a:-1!==a.indexOf("http://")?a:d+a},l=function(a,c){var d,e,f=this,g=new MediaPlayer.vo.FragmentRequest;return d=a.adaptation.period,g.mediaType=c,g.type="Initialization Segment",g.url=k(a.initialization,a),g.range=a.range,e=d.start,g.availabilityStartTime=f.timelineConverter.calcAvailabilityStartTimeFromPresentationTime(e,a.adaptation.period.mpd,b),g.availabilityEndTime=f.timelineConverter.calcAvailabilityEndTimeFromPresentationTime(e+d.duration,d.mpd,b),g.quality=a.index,g
},m=function(a){var b,d=this;return a?b=l.call(d,a,c):null},n=function(a){var c,e,f,g=a.adaptation.period,h=!1;return b?h=!1:0>d?h=!1:d<a.availableSegmentsNumber?(e=A(d,a),e&&(f=e.presentationStartTime-g.start,c=a.adaptation.period.duration,this.debug.log(a.segmentInfoType+": "+f+" / "+c),h=f>=c)):h=!0,h},o=function(a,c){var d,e,f,g,h=this;return e=a.segmentDuration,f=a.adaptation.period.start+c*e,g=f+e,d=new Dash.vo.Segment,d.representation=a,d.duration=e,d.presentationStartTime=f,d.mediaStartTime=h.timelineConverter.calcMediaTimeFromPresentationTime(d.presentationStartTime,a),d.availabilityStartTime=h.timelineConverter.calcAvailabilityStartTimeFromPresentationTime(d.presentationStartTime,a.adaptation.period.mpd,b),d.availabilityEndTime=h.timelineConverter.calcAvailabilityEndTimeFromPresentationTime(g,a.adaptation.period.mpd,b),d.wallStartTime=h.timelineConverter.calcWallTimeForSegment(d,b),d.replacementNumber=j(d,c),d.availabilityIdx=c,d},p=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q=this,r=b.adaptation.period.mpd.manifest.Period_asArray[b.adaptation.period.index].AdaptationSet_asArray[b.adaptation.index].Representation_asArray[b.index].SegmentTemplate,u=r.SegmentTimeline,v=b.availableSegmentsNumber>0,w=10,x=[],y=0,z=0,A=-1,B=function(a){return t.call(q,b,y,a.d,p,r.media,a.mediaRange,A)};for(p=b.timescale,c=u.S_asArray,k=s.call(q,b),k?(n=k.start,o=k.end):m=q.timelineConverter.calcMediaTimeFromPresentationTime(a||0,b),e=0,f=c.length;f>e;e+=1)if(d=c[e],h=0,d.hasOwnProperty("r")&&(h=d.r),d.hasOwnProperty("t")&&(y=d.t,z=y/p),0>h&&(j=c[e+1],j&&j.hasOwnProperty("t")?i=j.t/p:(i=q.timelineConverter.calcMediaTimeFromPresentationTime(b.segmentAvailabilityRange.end,b),b.segmentDuration=d.d/p),h=Math.ceil((i-z)/(d.d/p))-1),l){if(v)break;A+=h+1}else for(g=0;h>=g;g+=1){if(A+=1,k){if(A>o){if(l=!0,v)break;continue}A>=n&&x.push(B.call(q,d))}else{if(x.length>w){if(l=!0,v)break;continue}z>=m-d.d/p&&x.push(B.call(q,d))}y+=d.d,z=y/p}if(!v){var C,D,E=c[0];C=void 0===E.t?0:q.timelineConverter.calcPresentationTimeFromMediaTime(E.t/p,b),D=q.timelineConverter.calcPresentationTimeFromMediaTime((y-d.d)/p,b),b.segmentAvailabilityRange={start:C,end:D},b.availableSegmentsNumber=A+1}return x},q=function(a){var b,c,d,e,f,h=[],i=this,j=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentTemplate,k=a.segmentDuration,l=a.segmentAvailabilityRange,m=null,n=null;for(f=a.startNumber,b=r.call(i,a),d=b.start,e=b.end,c=d;e>=c;c+=1)m=o.call(i,a,c),m.replacementTime=(f+c-1)*a.segmentDuration,n=j.media,n=g(n,"Number",m.replacementNumber),n=g(n,"Time",m.replacementTime),m.media=n,h.push(m),m=null;return a.availableSegmentsNumber=Math.ceil((l.end-l.start)/k),h},r=function(c){var e,f,g,h=this,i=c.segmentDuration,j=c.adaptation.period.mpd.manifest.minBufferTime,k=c.segmentAvailabilityRange,l={start:h.timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(c,k.start),end:h.timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(c,k.end)},m=0/0,n=null,o=c.segments,p=2*i,q=Math.max(2*j,10*i);return l||(l=h.timelineConverter.calcSegmentAvailabilityRange(c,b)),b&&!h.timelineConverter.isTimeSyncCompleted()?(e=Math.floor(l.start/i),f=Math.floor(l.end/i),g={start:e,end:f}):(o?(n=A(d,c),m=n?h.timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(c,n.presentationStartTime):d>0?d*i:h.timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(c,a||o[0].presentationStartTime)):m=d>0?d*i:b?l.end:l.start,e=Math.floor(Math.max(m-p,l.start)/i),f=Math.floor(Math.min(e+q/i,l.end/i)),g={start:e,end:f})},s=function(){var c,e,f,g=2,h=10,i=0,j=Number.POSITIVE_INFINITY;return b&&!this.timelineConverter.isTimeSyncCompleted()?f={start:i,end:j}:!b&&a||0>d?null:(c=Math.max(d-g,i),e=Math.min(d+h,j),f={start:c,end:e})},t=function(a,c,d,e,f,h,i){var k,l,m,n=this,o=c/e,p=Math.min(d/e,a.adaptation.period.mpd.maxSegmentDuration);return k=n.timelineConverter.calcPresentationTimeFromMediaTime(o,a),l=k+p,m=new Dash.vo.Segment,m.representation=a,m.duration=p,m.mediaStartTime=o,m.presentationStartTime=k,m.availabilityStartTime=a.adaptation.period.mpd.manifest.loadedTime,m.availabilityEndTime=n.timelineConverter.calcAvailabilityEndTimeFromPresentationTime(l,a.adaptation.period.mpd,b),m.wallStartTime=n.timelineConverter.calcWallTimeForSegment(m,b),m.replacementTime=c,m.replacementNumber=j(m,i),f=g(f,"Number",m.replacementNumber),f=g(f,"Time",m.replacementTime),m.media=f,m.mediaRange=h,m.availabilityIdx=i,m},u=function(a){var b,c,d,e,f,g,h,i=this,j=[],k=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].SegmentList,l=k.SegmentURL_asArray.length;for(h=a.startNumber,e=r.call(i,a),f=Math.max(e.start,0),g=Math.min(e.end,k.SegmentURL_asArray.length-1),b=f;g>=b;b+=1)d=k.SegmentURL_asArray[b],c=o.call(i,a,b),c.replacementTime=(h+b-1)*a.segmentDuration,c.media=d.media,c.mediaRange=d.mediaRange,c.index=d.index,c.indexRange=d.indexRange,j.push(c),c=null;return a.availableSegmentsNumber=l,j},v=function(a){var b,c=this,d=a.segmentInfoType;return"SegmentBase"!==d&&"BaseURL"!==d&&B.call(c,a)?("SegmentTimeline"===d?b=p.call(c,a):"SegmentTemplate"===d?b=q.call(c,a):"SegmentList"===d&&(b=u.call(c,a)),w.call(c,a,b)):b=a.segments,b},w=function(a,c){var d;if(a.segments=c,d=c.length-1,b&&isNaN(this.timelineConverter.getExpectedLiveEdge())){var e=c[d].presentationStartTime,f=this.metricsModel.getMetricsFor("stream");this.timelineConverter.setExpectedLiveEdge(e),this.metricsModel.updateManifestUpdateInfo(this.metricsExt.getCurrentManifestUpdate(f),{presentationStartTime:e})}},x=function(a){var b=this;if(!a)throw new Error("no representation");return a.segments=null,v.call(b,a),a},y=function(a,e){var f=this,g=a.initialization,h="BaseURL"!==a.segmentInfoType&&"SegmentBase"!==a.segmentInfoType;a.segmentAvailabilityRange=f.timelineConverter.calcSegmentAvailabilityRange(a,b),e||(d=-1),x.call(f,a),g||f.baseURLExt.loadInitialization(a),h||f.baseURLExt.loadSegments(a,c,a.indexRange),g&&h&&f.notify(f.eventList.ENAME_REPRESENTATION_UPDATED,a)},z=function(a,b){var c,d,e,f,g=b.segments,h=g?g.length:null,i=-1;if(g&&h>0)for(f=0;h>f;f+=1)if(c=g[f],d=c.presentationStartTime,e=c.duration,a+e/2>=d&&d+e>a-e/2){i=c.availabilityIdx;break}return i},A=function(a,b){if(!b||!b.segments)return null;var c,d,e=b.segments.length;for(d=0;e>d;d+=1)if(c=b.segments[d],c.availabilityIdx===a)return c;return null},B=function(a){var b,c,e=!1,f=a.segments;return f&&0!==f.length?(c=f[0].availabilityIdx,b=f[f.length-1].availabilityIdx,e=c>d||d>b):e=!0,e},C=function(a){if(null===a||void 0===a)return null;var b,d=new MediaPlayer.vo.FragmentRequest,e=a.representation,f=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].bandwidth;return b=k(a.media,e),b=g(b,"Number",a.replacementNumber),b=g(b,"Time",a.replacementTime),b=g(b,"Bandwidth",f),b=i(b,e.id),b=h(b),d.mediaType=c,d.type="Media Segment",d.url=b,d.range=a.mediaRange,d.startTime=a.presentationStartTime,d.duration=a.duration,d.timescale=e.timescale,d.availabilityStartTime=a.availabilityStartTime,d.availabilityEndTime=a.availabilityEndTime,d.wallStartTime=a.wallStartTime,d.quality=e.index,d.index=a.availabilityIdx,d},D=function(b,e,f){var g,h,i,j=d,k=this;return b?(a=e,k.debug.log("Getting the request for time: "+e),d=z.call(k,e,b),v.call(k,b),0>d&&(d=z.call(k,e,b)),k.debug.log("Index for time "+e+" is "+d),i=n.call(k,b),i?(g=new MediaPlayer.vo.FragmentRequest,g.action=g.ACTION_COMPLETE,g.index=d,g.mediaType=c,k.debug.log("Signal complete."),k.debug.log(g)):(h=A(d,b),g=C.call(k,h)),f&&(d=j),g):null},E=function(a,b){var c=(a.segmentAvailabilityRange.end-a.segmentAvailabilityRange.start)/2;return a.segments=null,a.segmentAvailabilityRange={start:b-c,end:b+c},D.call(this,a,b,!1)},F=function(b){var e,f,g,h,i=this;if(!b)return null;if(-1===d)throw"You must call getSegmentRequestForTime first.";return a=null,d+=1,h=d,g=n.call(i,b),g?(e=new MediaPlayer.vo.FragmentRequest,e.action=e.ACTION_COMPLETE,e.index=h,e.mediaType=c,i.debug.log("Signal complete.")):(v.call(i,b),f=A(h,b),e=C.call(i,f)),e},G=function(a,b){b.segments&&this.notify(this.eventList.ENAME_REPRESENTATION_UPDATED,b)},H=function(a,b,d,e,f){if(!f&&c===e){var g,h,i,j,k=this,l=[],m=0;for(g=0,h=b.length;h>g;g+=1)i=b[g],j=t.call(k,d,i.startTime,i.duration,i.timescale,i.media,i.mediaRange,m),l.push(j),j=null,m+=1;d.segmentAvailabilityRange={start:l[0].presentationStartTime,end:l[h-1].presentationStartTime},d.availableSegmentsNumber=h,w.call(k,d,l),d.initialization&&this.notify(this.eventList.ENAME_REPRESENTATION_UPDATED,d)}};return{debug:void 0,baseURLExt:void 0,timelineConverter:void 0,metricsModel:void 0,metricsExt:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_REPRESENTATION_UPDATED:"representationUpdated"},setup:function(){this.initializationLoaded=G,this.segmentsLoaded=H},initialize:function(a){this.subscribe(this.eventList.ENAME_REPRESENTATION_UPDATED,a.trackController),c=a.getType(),b=a.isDynamic(),this.streamProcessor=a},getType:function(){return c},setType:function(a){c=a},getIsDynamic:function(){return b},setIsDynamic:function(a){b=a},setCurrentTime:function(a){e=a},getCurrentTime:function(){return e},reset:function(){e=0,a=void 0,d=-1,this.unsubscribe(this.eventList.ENAME_REPRESENTATION_UPDATED,this.streamProcessor.trackController)},getInitRequest:m,getSegmentRequestForTime:D,getNextSegmentRequest:F,generateSegmentRequestForTime:E,updateRepresentation:y}},Dash.dependencies.DashHandler.prototype={constructor:Dash.dependencies.DashHandler},Dash.dependencies.DashManifestExtensions=function(){"use strict";this.timelineConverter=void 0},Dash.dependencies.DashManifestExtensions.prototype={constructor:Dash.dependencies.DashManifestExtensions,getIsTypeOf:function(a,b){"use strict";var c,d,e,f=a.ContentComponent_asArray,g=new RegExp("text"!==b?b:"(vtt|ttml)"),h=!1,i=!1;if(f)for(c=0,d=f.length;d>c;c+=1)f[c].contentType===b&&(h=!0,i=!0);if(a.hasOwnProperty("mimeType")&&(h=g.test(a.mimeType),i=!0),!i)for(c=0,d=a.Representation_asArray.length;!i&&d>c;)e=a.Representation_asArray[c],e.hasOwnProperty("mimeType")&&(h=g.test(e.mimeType),i=!0),c+=1;return h},getIsAudio:function(a){"use strict";return this.getIsTypeOf(a,"audio")},getIsVideo:function(a){"use strict";return this.getIsTypeOf(a,"video")},getIsText:function(a){"use strict";return this.getIsTypeOf(a,"text")},getIsTextTrack:function(a){return"text/vtt"===a||"application/ttml+xml"===a},getLanguageForAdaptation:function(a){var b="";return a.hasOwnProperty("lang")&&(b=a.lang),b},getIsMain:function(){"use strict";return!1},processAdaptation:function(a){"use strict";return void 0!==a.Representation_asArray&&null!==a.Representation_asArray&&a.Representation_asArray.sort(function(a,b){return a.bandwidth-b.bandwidth}),a},getAdaptationForId:function(a,b,c){"use strict";var d,e,f=b.Period_asArray[c].AdaptationSet_asArray;for(d=0,e=f.length;e>d;d+=1)if(f[d].hasOwnProperty("id")&&f[d].id===a)return f[d];return null},getAdaptationForIndex:function(a,b,c){"use strict";var d=b.Period_asArray[c].AdaptationSet_asArray;return d[a]},getIndexForAdaptation:function(a,b,c){"use strict";var d,e,f=b.Period_asArray[c].AdaptationSet_asArray;for(d=0,e=f.length;e>d;d+=1)if(f[d]===a)return d;return-1},getAdaptationsForType:function(a,b,c){"use strict";var d,e,f=this,g=a.Period_asArray[b].AdaptationSet_asArray,h=[];for(d=0,e=g.length;e>d;d+=1)this.getIsTypeOf(g[d],c)&&h.push(f.processAdaptation(g[d]));return h},getAdaptationForType:function(a,b,c){"use strict";var d,e,f,g=this;if(f=this.getAdaptationsForType(a,b,c),!f||0===f.length)return null;for(d=0,e=f.length;e>d;d+=1)if(g.getIsMain(f[d]))return f[d];return f[0]},getCodec:function(a){"use strict";var b=a.Representation_asArray[0],c=b.mimeType+';codecs="'+b.codecs+'"';return c},getMimeType:function(a){"use strict";return a.Representation_asArray[0].mimeType},getKID:function(a){"use strict";return a&&a.hasOwnProperty("cenc:default_KID")?a["cenc:default_KID"]:null},getContentProtectionData:function(a){"use strict";return a&&a.hasOwnProperty("ContentProtection_asArray")&&0!==a.ContentProtection_asArray.length?a.ContentProtection_asArray:null},getIsDynamic:function(a){"use strict";var b=!1,c="dynamic";return a.hasOwnProperty("type")&&(b=a.type===c),b},getIsDVR:function(a){"use strict";var b,c,d=this.getIsDynamic(a);return b=!isNaN(a.timeShiftBufferDepth),c=d&&b},getIsOnDemand:function(a){"use strict";var b=!1;return a.profiles&&a.profiles.length>0&&(b=-1!==a.profiles.indexOf("urn:mpeg:dash:profile:isoff-on-demand:2011")),b},getDuration:function(a){var b;return b=a.hasOwnProperty("mediaPresentationDuration")?a.mediaPresentationDuration:Number.POSITIVE_INFINITY},getBandwidth:function(a){"use strict";return a.bandwidth},getRefreshDelay:function(a){"use strict";var b=0/0,c=2;return a.hasOwnProperty("minimumUpdatePeriod")&&(b=Math.max(parseFloat(a.minimumUpdatePeriod),c)),b},getRepresentationCount:function(a){"use strict";return a.Representation_asArray.length},getRepresentationFor:function(a,b){"use strict";return b.Representation_asArray[a]},getRepresentationsForAdaptation:function(a,b){for(var c,d,e,f,g,h=this,i=h.processAdaptation(a.Period_asArray[b.period.index].AdaptationSet_asArray[b.index]),j=[],k=0;k<i.Representation_asArray.length;k+=1)f=i.Representation_asArray[k],c=new Dash.vo.Representation,c.index=k,c.adaptation=b,f.hasOwnProperty("id")&&(c.id=f.id),f.hasOwnProperty("SegmentBase")?(e=f.SegmentBase,c.segmentInfoType="SegmentBase"):f.hasOwnProperty("SegmentList")?(e=f.SegmentList,c.segmentInfoType="SegmentList",c.useCalculatedLiveEdgeTime=!0):f.hasOwnProperty("SegmentTemplate")?(e=f.SegmentTemplate,e.hasOwnProperty("SegmentTimeline")?(c.segmentInfoType="SegmentTimeline",g=e.SegmentTimeline.S_asArray[e.SegmentTimeline.S_asArray.length-1],(!g.hasOwnProperty("r")||g.r>=0)&&(c.useCalculatedLiveEdgeTime=!0)):c.segmentInfoType="SegmentTemplate",e.hasOwnProperty("initialization")&&(c.initialization=e.initialization.split("$Bandwidth$").join(f.bandwidth).split("$RepresentationID$").join(f.id))):(e=f.BaseURL,c.segmentInfoType="BaseURL"),e.hasOwnProperty("Initialization")?(d=e.Initialization,d.hasOwnProperty("sourceURL")?c.initialization=d.sourceURL:d.hasOwnProperty("range")&&(c.initialization=f.BaseURL,c.range=d.range)):f.hasOwnProperty("mimeType")&&h.getIsTextTrack(f.mimeType)&&(c.initialization=f.BaseURL,c.range=0),e.hasOwnProperty("timescale")&&(c.timescale=e.timescale),e.hasOwnProperty("duration")&&(c.segmentDuration=e.duration/c.timescale),e.hasOwnProperty("startNumber")&&(c.startNumber=e.startNumber),e.hasOwnProperty("indexRange")&&(c.indexRange=e.indexRange),e.hasOwnProperty("presentationTimeOffset")&&(c.presentationTimeOffset=e.presentationTimeOffset/c.timescale),c.MSETimeOffset=h.timelineConverter.calcMSETimeOffset(c),j.push(c);return j},getAdaptationsForPeriod:function(a,b){for(var c,d,e=a.Period_asArray[b.index],f=[],g=0;g<e.AdaptationSet_asArray.length;g+=1)d=e.AdaptationSet_asArray[g],c=new Dash.vo.AdaptationSet,d.hasOwnProperty("id")&&(c.id=d.id),c.index=g,c.period=b,c.type=this.getIsAudio(d)?"audio":this.getIsVideo(d)?"video":"text",f.push(c);return f},getRegularPeriods:function(a,b){var c,d,e=this,f=[],g=e.getIsDynamic(a),h=null,i=null,j=null,k=null;for(c=0,d=a.Period_asArray.length;d>c;c+=1)i=a.Period_asArray[c],i.hasOwnProperty("start")?(k=new Dash.vo.Period,k.start=i.start):null!==h&&i.hasOwnProperty("duration")?(k=new Dash.vo.Period,k.start=j.start+j.duration,k.duration=i.duration):0!==c||g||(k=new Dash.vo.Period,k.start=0),null!==j&&isNaN(j.duration)&&(j.duration=k.start-j.start),null!==k&&i.hasOwnProperty("id")&&(k.id=i.id),null!==k&&i.hasOwnProperty("duration")&&(k.duration=i.duration),null!==k&&(k.index=c,k.mpd=b,f.push(k)),h=i,i=null,j=k,k=null;return 0===f.length?f:(b.checkTime=e.getCheckTime(a,f[0]),null!==j&&isNaN(j.duration)&&(j.duration=e.getEndTimeForLastPeriod(b)-j.start),f)},getMpd:function(a){var b=new Dash.vo.Mpd;return b.manifest=a,b.availabilityStartTime=new Date(a.hasOwnProperty("availabilityStartTime")?a.availabilityStartTime.getTime():a.loadedTime.getTime()),a.hasOwnProperty("availabilityEndTime")&&(b.availabilityEndTime=new Date(a.availabilityEndTime.getTime())),a.hasOwnProperty("suggestedPresentationDelay")&&(b.suggestedPresentationDelay=a.suggestedPresentationDelay),a.hasOwnProperty("timeShiftBufferDepth")&&(b.timeShiftBufferDepth=a.timeShiftBufferDepth),a.hasOwnProperty("maxSegmentDuration")&&(b.maxSegmentDuration=a.maxSegmentDuration),b},getFetchTime:function(a,b){var c=this.timelineConverter.calcPresentationTimeFromWallTime(a.loadedTime,b);return c},getCheckTime:function(a,b){var c,d=this,e=0/0;return a.hasOwnProperty("minimumUpdatePeriod")&&(c=d.getFetchTime(a,b),e=c+a.minimumUpdatePeriod),e},getEndTimeForLastPeriod:function(a){var b;if(a.manifest.mediaPresentationDuration)b=a.manifest.mediaPresentationDuration;else{if(isNaN(a.checkTime))throw new Error("Must have @mediaPresentationDuration or @minimumUpdatePeriod on MPD or an explicit @duration on the last period.");b=a.checkTime}return b},getEventsForPeriod:function(a,b){var c=a.Period_asArray,d=c[b.index].EventStream_asArray,e=[];if(d)for(var f=0;f<d.length;f+=1){var g=new Dash.vo.EventStream;if(g.period=b,g.timescale=1,!d[f].hasOwnProperty("schemeIdUri"))throw"Invalid EventStream. SchemeIdUri has to be set";g.schemeIdUri=d[f].schemeIdUri,d[f].hasOwnProperty("timescale")&&(g.timescale=d[f].timescale),d[f].hasOwnProperty("value")&&(g.value=d[f].value);for(var h=0;h<d[f].Event_asArray.length;h+=1){var i=new Dash.vo.Event;i.presentationTime=0,i.eventStream=g,d[f].Event_asArray[h].hasOwnProperty("presentationTime")&&(i.presentationTime=d[f].Event_asArray[h].presentationTime),d[f].Event_asArray[h].hasOwnProperty("duration")&&(i.duration=d[f].Event_asArray[h].duration),d[f].Event_asArray[h].hasOwnProperty("id")&&(i.id=d[f].Event_asArray[h].id),e.push(i)}}return e},getEventStreamForAdaptationSet:function(a,b){var c=[],d=a.Period_asArray[b.period.index].AdaptationSet_asArray[b.index].InbandEventStream_asArray;if(d)for(var e=0;e<d.length;e+=1){var f=new Dash.vo.EventStream;if(f.timescale=1,!d[e].hasOwnProperty("schemeIdUri"))throw"Invalid EventStream. SchemeIdUri has to be set";f.schemeIdUri=d[e].schemeIdUri,d[e].hasOwnProperty("timescale")&&(f.timescale=d[e].timescale),d[e].hasOwnProperty("value")&&(f.value=d[e].value),c.push(f)}return c},getEventStreamForRepresentation:function(a,b){var c=[],d=a.Period_asArray[b.adaptation.period.index].AdaptationSet_asArray[b.adaptation.index].Representation_asArray[b.index].InbandEventStream_asArray;if(d)for(var e=0;e<d.length;e++){var f=new Dash.vo.EventStream;if(f.timescale=1,f.representation=b,!d[e].hasOwnProperty("schemeIdUri"))throw"Invalid EventStream. SchemeIdUri has to be set";f.schemeIdUri=d[e].schemeIdUri,d[e].hasOwnProperty("timescale")&&(f.timescale=d[e].timescale),d[e].hasOwnProperty("value")&&(f.value=d[e].value),c.push(f)}return c}},Dash.dependencies.DashMetricsExtensions=function(){"use strict";var a=function(a,b){var c,d,e,f,g,h,i,j;for(h=0;h<a.length;h+=1)for(c=a[h],e=c.AdaptationSet_asArray,i=0;i<e.length;i+=1)for(d=e[i],g=d.Representation_asArray,j=0;j<g.length;j+=1)if(f=g[j],b===f.id)return j;return-1},b=function(a,b){var c,d,e,f,g,h,i,j;for(h=0;h<a.length;h+=1)for(c=a[h],e=c.AdaptationSet_asArray,i=0;i<e.length;i+=1)for(d=e[i],g=d.Representation_asArray,j=0;j<g.length;j+=1)if(f=g[j],b===f.id)return f;return null},c=function(a,b){return this.manifestExt.getIsTypeOf(a,b)},d=function(a,b){var d,e,f,g,h,i;for(h=0;h<a.length;h+=1)for(d=a[h],f=d.AdaptationSet_asArray,i=0;i<f.length;i+=1)if(e=f[i],g=e.Representation_asArray,c.call(this,e,b))return g.length;return-1},e=function(a){var c,d=this,e=d.manifestModel.getValue(),f=e.Period_asArray;return c=b.call(d,f,a),null===c?null:c.bandwidth},f=function(b){var c,d=this,e=d.manifestModel.getValue(),f=e.Period_asArray;return c=a.call(d,f,b)},g=function(a){var b,c=this,e=c.manifestModel.getValue(),f=e.Period_asArray;return b=d.call(this,f,a)},h=function(a){if(null===a)return null;var b,c,d,e=a.RepSwitchList;return null===e||e.length<=0?null:(b=e.length,c=b-1,d=e[c])},i=function(a){if(null===a)return null;var b,c,d,e=a.BufferLevel;return null===e||e.length<=0?null:(b=e.length,c=b-1,d=e[c])},j=function(a){if(null===a)return null;var b,c,d=a.PlayList;return null===d||d.length<=0?null:(b=d[d.length-1].trace,null===b||b.length<=0?null:c=b[b.length-1].playbackspeed)},k=function(a){if(null===a)return null;var b,c,d=a.HttpList,e=null;if(null===d||d.length<=0)return null;for(b=d.length,c=b-1;c>0;){if(d[c].responsecode){e=d[c];break}c-=1}return e},l=function(a){return null===a?[]:a.HttpList?a.HttpList:[]},m=function(a){if(null===a)return null;var b,c,d,e=a.DroppedFrames;return null===e||e.length<=0?null:(b=e.length,c=b-1,d=e[c])},n=function(a){if(null===a)return null;var b,c,d,e=a.SchedulingInfo;return null===e||e.length<=0?null:(b=e.length,c=b-1,d=e[c])},o=function(a){if(null===a)return null;var b,c,d,e=a.ManifestUpdate;return null===e||e.length<=0?null:(b=e.length,c=b-1,d=e[c])},p=function(a){if(null===a)return null;var b,c=a.DVRInfo,d=null;return null===c||c.length<=0?null:(b=c.length-1,d=c[b])};return{manifestModel:void 0,manifestExt:void 0,getBandwidthForRepresentation:e,getIndexForRepresentation:f,getMaxIndexForBufferType:g,getCurrentRepresentationSwitch:h,getCurrentBufferLevel:i,getCurrentPlaybackRate:j,getCurrentHttpRequest:k,getHttpRequests:l,getCurrentDroppedFrames:m,getCurrentSchedulingInfo:n,getCurrentDVRInfo:p,getCurrentManifestUpdate:o}},Dash.dependencies.DashMetricsExtensions.prototype={constructor:Dash.dependencies.DashMetricsExtensions},Dash.dependencies.DashParser=function(){"use strict";var a=31536e3,b=2592e3,c=86400,d=3600,e=60,f=60,g=1e3,h=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,i=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})([0-9]{2}))?/,j=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,k=[{type:"duration",test:function(a){return h.test(a)},converter:function(f){var g=h.exec(f);return parseFloat(g[2]||0)*a+parseFloat(g[4]||0)*b+parseFloat(g[6]||0)*c+parseFloat(g[8]||0)*d+parseFloat(g[10]||0)*e+parseFloat(g[12]||0)}},{type:"datetime",test:function(a){return i.test(a)},converter:function(a){var b,c=i.exec(a);if(b=Date.UTC(parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10),parseInt(c[4],10),parseInt(c[5],10),c[6]&&parseInt(c[6],10)||0,c[7]&&parseFloat(c[7])*g||0),c[9]&&c[10]){var d=parseInt(c[9],10)*f+parseInt(c[10],10);b+=("+"===c[8]?-1:1)*d*e*g}return new Date(b)}},{type:"numeric",test:function(a){return j.test(a)},converter:function(a){return parseFloat(a)}}],l=function(){var a,b,c,d;return d=[{name:"profiles",merge:!1},{name:"width",merge:!1},{name:"height",merge:!1},{name:"sar",merge:!1},{name:"frameRate",merge:!1},{name:"audioSamplingRate",merge:!1},{name:"mimeType",merge:!1},{name:"segmentProfiles",merge:!1},{name:"codecs",merge:!1},{name:"maximumSAPPeriod",merge:!1},{name:"startsWithSap",merge:!1},{name:"maxPlayoutRate",merge:!1},{name:"codingDependency",merge:!1},{name:"scanType",merge:!1},{name:"FramePacking",merge:!0},{name:"AudioChannelConfiguration",merge:!0},{name:"ContentProtection",merge:!0}],a={},a.name="AdaptationSet",a.isRoot=!1,a.isArray=!0,a.parent=null,a.children=[],a.properties=d,b={},b.name="Representation",b.isRoot=!1,b.isArray=!0,b.parent=a,b.children=[],b.properties=d,a.children.push(b),c={},c.name="SubRepresentation",c.isRoot=!1,c.isArray=!0,c.parent=b,c.children=[],c.properties=d,b.children.push(c),a},m=function(){var a,b,c,d;return d=[{name:"SegmentBase",merge:!0},{name:"SegmentTemplate",merge:!0},{name:"SegmentList",merge:!0}],a={},a.name="Period",a.isRoot=!1,a.isArray=!0,a.parent=null,a.children=[],a.properties=d,b={},b.name="AdaptationSet",b.isRoot=!1,b.isArray=!0,b.parent=a,b.children=[],b.properties=d,a.children.push(b),c={},c.name="Representation",c.isRoot=!1,c.isArray=!0,c.parent=b,c.children=[],c.properties=d,b.children.push(c),a},n=function(){var a,b,c,d,e;return e=[{name:"BaseURL",merge:!0,mergeFunction:function(a,b){var c;return c=0===b.indexOf("http://")?b:a+b}}],a={},a.name="mpd",a.isRoot=!0,a.isArray=!0,a.parent=null,a.children=[],a.properties=e,b={},b.name="Period",b.isRoot=!1,b.isArray=!0,b.parent=null,b.children=[],b.properties=e,a.children.push(b),c={},c.name="AdaptationSet",c.isRoot=!1,c.isArray=!0,c.parent=b,c.children=[],c.properties=e,b.children.push(c),d={},d.name="Representation",d.isRoot=!1,d.isArray=!0,d.parent=c,d.children=[],d.properties=e,c.children.push(d),a},o=function(){var a=[];return a.push(l()),a.push(m()),a.push(n()),a},p=function(a,b){var c,d=new X2JS(k,"",!0),e=new ObjectIron(o()),f=new Date,g=null,h=null;try{c=d.xml_str2json(a),g=new Date,c.hasOwnProperty("BaseURL")?(c.BaseURL=c.BaseURL_asArray[0],0!==c.BaseURL.toString().indexOf("http")&&(c.BaseURL=b+c.BaseURL)):c.BaseURL=b,e.run(c),h=new Date,this.debug.log("Parsing complete: ( xml2json: "+(g.getTime()-f.getTime())+"ms, objectiron: "+(h.getTime()-g.getTime())+"ms, total: "+(h.getTime()-f.getTime())/1e3+"s)")}catch(i){return this.errHandler.manifestError("parsing the manifest failed","parse",a),null}return c};return{debug:void 0,errHandler:void 0,parse:p}},Dash.dependencies.DashParser.prototype={constructor:Dash.dependencies.DashParser},Dash.dependencies.FragmentExtensions=function(){"use strict";var a=function(a){for(var b,c,d,e,f,g,h=new DataView(a),i=0;"tfdt"!==e&&i<h.byteLength;){for(d=h.getUint32(i),i+=4,e="",f=0;4>f;f+=1)g=h.getInt8(i),e+=String.fromCharCode(g),i+=1;"moof"!==e&&"traf"!==e&&"tfdt"!==e&&(i+=d-8)}if(i===h.byteLength)throw"Error finding live offset.";return c=h.getUint8(i),this.debug.log("position: "+i),0===c?(i+=4,b=h.getUint32(i,!1)):(i+=d-16,b=utils.Math.to64BitNumber(h.getUint32(i+4,!1),h.getUint32(i,!1))),{version:c,base_media_decode_time:b}},b=function(a){for(var b,c,d,e,f,g,h,i=new DataView(a),j=0;"sidx"!==f&&j<i.byteLength;){for(g=i.getUint32(j),j+=4,f="",e=0;4>e;e+=1)h=i.getInt8(j),f+=String.fromCharCode(h),j+=1;"moof"!==f&&"traf"!==f&&"sidx"!==f?j+=g-8:"sidx"===f&&(j-=8)}return b=i.getUint8(j+8),j+=12,c=i.getUint32(j+4,!1),j+=8,d=0===b?i.getUint32(j,!1):utils.Math.to64BitNumber(i.getUint32(j+4,!1),i.getUint32(j,!1)),{earliestPresentationTime:d,timescale:c}},c=function(b){var c,d,e,f=this,g=new XMLHttpRequest,h=!1;c=b,g.onloadend=function(){h||(d="Error loading fragment: "+c,f.notify(f.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,null,new Error(d)))},g.onload=function(){h=!0,e=a(g.response),f.notify(f.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,e)},g.onerror=function(){d="Error loading fragment: "+c,f.notify(f.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,null,new Error(d))},g.responseType="arraybuffer",g.open("GET",c),g.send(null)};return{debug:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_FRAGMENT_LOADING_COMPLETED:"fragmentLoadingCompleted"},loadFragment:c,parseTFDT:a,parseSIDX:b}},Dash.dependencies.FragmentExtensions.prototype={constructor:Dash.dependencies.FragmentExtensions},Dash.dependencies.RepresentationController=function(){"use strict";var a,b=null,c=-1,d=!0,e=[],f=function(c,f,i){var k=this;if(d=!0,k.notify(k.eventList.ENAME_DATA_UPDATE_STARTED),e=j.call(k,f),a=h.call(k,k.abrController.getQualityFor(i)),b=c,"video"!==i&&"audio"!==i)return k.notify(k.eventList.ENAME_DATA_UPDATE_COMPLETED,b,a),void g.call(k);for(var l=0;l<e.length;l+=1)k.indexHandler.updateRepresentation(e[l],!0)},g=function(){var a=new Date,b=this.getCurrentRepresentation(),c=this.streamProcessor.playbackController.getTime();this.metricsModel.addTrackSwitch(b.adaptation.type,a,c,b.id)},h=function(a){return e[a]},i=function(){for(var a=0,b=e.length;b>a;a+=1)if(null===e[a].segmentAvailabilityRange||null===e[a].initialization)return!1;return!0},j=function(a){var d,e=this,f=e.manifestModel.getValue();return c=e.manifestExt.getIndexForAdaptation(b,f,a.period.index),d=e.manifestExt.getRepresentationsForAdaptation(f,a)},k=function(a){for(var b,c=this,d=0,f=e.length;f>d;d+=1)b=e[d],b.segmentAvailabilityRange=c.timelineConverter.calcSegmentAvailabilityRange(b,a)},l=function(c,e){for(var f,h=this,j=e,k=h.metricsModel.getMetricsFor("stream"),l=h.metricsExt.getCurrentManifestUpdate(k),m=!1,n=0;n<l.trackInfo.length;n+=1)if(f=l.trackInfo[n],f.index===j.index&&f.mediaType===h.streamProcessor.getType()){m=!0;break}m||h.metricsModel.addManifestUpdateTrackInfo(l,j.id,j.index,j.adaptation.period.index,h.streamProcessor.getType(),j.presentationTimeOffset,j.startNumber,j.segmentInfoType),i()&&(d=!1,h.metricsModel.updateManifestUpdateInfo(l,{latency:a.segmentAvailabilityRange.end-h.streamProcessor.playbackController.getTime()}),this.notify(this.eventList.ENAME_DATA_UPDATE_COMPLETED,b,a),g.call(h))},m=function(a,b){k.call(this,b)},n=function(){k.call(this,!0),this.indexHandler.updateRepresentation(a,!1)},o=function(b){var c=b.streamProcessor,d=this,e=d.timelineConverter.calcSegmentAvailabilityRange(a,c.isDynamic());d.metricsModel.addDVRInfo(c.getType(),c.playbackController.getTime(),c.getStreamInfo().manifestInfo,e)},p=function(b,c,d,e){var f=this;c===f.streamProcessor.getType()&&(a=f.getRepresentationForQuality(e),g.call(f))};return{system:void 0,debug:void 0,manifestExt:void 0,manifestModel:void 0,metricsModel:void 0,metricsExt:void 0,abrController:void 0,timelineConverter:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_DATA_UPDATE_COMPLETED:"dataUpdateCompleted",ENAME_DATA_UPDATE_STARTED:"dataUpdateStarted"},setup:function(){this.qualityChanged=p,this.representationUpdated=l,this.wallclockTimeUpdated=m,this.liveEdgeFound=n,this.bufferLevelUpdated=o},initialize:function(a){this.streamProcessor=a,this.indexHandler=a.indexHandler},getData:function(){return b},getDataIndex:function(){return c},isUpdating:function(){return d},updateData:f,getRepresentationForQuality:h,getCurrentRepresentation:function(){return a}}},Dash.dependencies.RepresentationController.prototype={constructor:Dash.dependencies.RepresentationController},Dash.dependencies.TimelineConverter=function(){"use strict";var a=0,b=!1,c=0/0,d=function(b,c,d,e){var f=0/0;return f=e?d&&c.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(c.availabilityStartTime.getTime()+1e3*(b+c.timeShiftBufferDepth)):c.availabilityEndTime:d?new Date(c.availabilityStartTime.getTime()+1e3*(b-a)):c.availabilityStartTime},e=function(a,b,c){return d.call(this,a,b,c)},f=function(a,b,c){return d.call(this,a,b,c,!0)},g=function(b,c){return(b.getTime()-c.mpd.availabilityStartTime.getTime()+1e3*a)/1e3},h=function(a,b){var c=b.adaptation.period.start,d=b.presentationTimeOffset;return a+(c-d)},i=function(a,b){var c=b.adaptation.period.start,d=b.presentationTimeOffset;return a-c+d},j=function(a,b){var c,d,e;return b&&(c=a.representation.adaptation.period.mpd.suggestedPresentationDelay,d=a.presentationStartTime+c,e=new Date(a.availabilityStartTime.getTime()+1e3*d)),e},k=function(a,c){var d,e,f=a.segmentDuration,h=a.adaptation.period.start,i=h+a.adaptation.period.duration,j={start:h,end:i};return c?b&&!isNaN(f)||!a.segmentAvailabilityRange?(d=a.adaptation.period.mpd.checkTime,e=g(new Date((new Date).getTime()),a.adaptation.period),h=Math.max(e-a.adaptation.period.mpd.timeShiftBufferDepth,0),i=isNaN(d)?e:Math.min(d,e),j={start:h,end:i}):a.segmentAvailabilityRange:j},l=function(a,b){var c=a.adaptation.period.start;return b-c},m=function(a,b){var c=a.adaptation.period.start;return b+c},n=function(d,e,f){b||(a=e-(c+f),b=!0)},o=function(a){var b=a.presentationTimeOffset,c=a.adaptation.period.start;return c-b},p=function(){a=0,b=!1,c=0/0};return{notifier:void 0,uriQueryFragModel:void 0,setup:function(){this.liveEdgeFound=n},calcAvailabilityStartTimeFromPresentationTime:e,calcAvailabilityEndTimeFromPresentationTime:f,calcPresentationTimeFromWallTime:g,calcPresentationTimeFromMediaTime:h,calcPeriodRelativeTimeFromMpdRelativeTime:l,calcMpdRelativeTimeFromPeriodRelativeTime:m,calcMediaTimeFromPresentationTime:i,calcSegmentAvailabilityRange:k,calcWallTimeForSegment:j,calcMSETimeOffset:o,reset:p,isTimeSyncCompleted:function(){return b
},getClientTimeOffset:function(){return a},getExpectedLiveEdge:function(){return c},setExpectedLiveEdge:function(a){c=a}}},Dash.dependencies.TimelineConverter.prototype={constructor:Dash.dependencies.TimelineConverter},Dash.vo.AdaptationSet=function(){"use strict";this.period=null,this.index=-1,this.type=null},Dash.vo.AdaptationSet.prototype={constructor:Dash.vo.AdaptationSet},Dash.vo.Event=function(){"use strict";this.duration=0/0,this.presentationTime=0/0,this.id=0/0,this.messageData="",this.eventStream=null,this.presentationTimeDelta=0/0},Dash.vo.Event.prototype={constructor:Dash.vo.Event},Dash.vo.EventStream=function(){"use strict";this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri=""},Dash.vo.EventStream.prototype={constructor:Dash.vo.EventStream},Dash.vo.Mpd=function(){"use strict";this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.checkTime=0/0,this.clientServerTimeShift=0,this.isClientServerTimeSyncCompleted=!1},Dash.vo.Mpd.prototype={constructor:Dash.vo.Mpd},Dash.vo.Period=function(){"use strict";this.id=null,this.index=-1,this.duration=0/0,this.start=0/0,this.mpd=null},Dash.vo.Period.prototype={constructor:Dash.vo.Period},Dash.vo.Representation=function(){"use strict";this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.segmentDuration=0/0,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=0/0,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0},Dash.vo.Representation.prototype={constructor:Dash.vo.Representation},Dash.vo.Segment=function(){"use strict";this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=0/0,this.replacementTime=null,this.replacementNumber=0/0,this.mediaStartTime=0/0,this.presentationStartTime=0/0,this.availabilityStartTime=0/0,this.availabilityEndTime=0/0,this.availabilityIdx=0/0,this.wallStartTime=0/0,this.representation=null},Dash.vo.Segment.prototype={constructor:Dash.vo.Segment},MediaPlayer.dependencies.AbrController=function(){"use strict";var a=!0,b={},c={},d={},e=function(a){var b;return c.hasOwnProperty(a)||(c[a]=0),b=c[a]},f=function(a,b){c[a]=b},g=function(a){var b;return d.hasOwnProperty(a)||(d[a]=0),b=d[a]},h=function(a,b){d[a]=b},i=function(a,c){b[a]=c},j=function(a){var c;return b.hasOwnProperty(a)||(b[a]=0),c=b[a]},k=function(a,b,c){var d,e=this,f=this.adapter.convertDataToTrack(c).mediaInfo,g=f.type;d=f.trackCount-1,j(g)!==d&&(i(g,d),e.notify(e.eventList.ENAME_TOP_QUALITY_INDEX_CHANGED,g,d))};return{debug:void 0,adapter:void 0,abrRulesCollection:void 0,rulesController:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_QUALITY_CHANGED:"qualityChanged",ENAME_TOP_QUALITY_INDEX_CHANGED:"topQualityIndexChanged"},setup:function(){this.dataUpdateCompleted=k},getAutoSwitchBitrate:function(){return a},setAutoSwitchBitrate:function(b){a=b},getPlaybackQuality:function(b){var c,d,i,k,l=this,m=b.getType(),n=function(a){var b=j(m);c=a.value,k=a.confidence,0>c&&(c=0),c>b&&(c=b),d=e(m),c!==d&&(f(m,c),h(m,k),l.notify(l.eventList.ENAME_QUALITY_CHANGED,m,d,c))};c=e(m),k=g(m),a&&(l.abrRulesCollection.downloadRatioRule&&l.abrRulesCollection.downloadRatioRule.setStreamProcessor(b),i=l.abrRulesCollection.getRules(MediaPlayer.rules.ABRRulesCollection.prototype.QUALITY_SWITCH_RULES),l.rulesController.applyRules(i,b,n.bind(l),c,function(a,b){return Math.min(a,b)}))},setPlaybackQuality:function(a,c){var d=e(a),g=null!==c&&!isNaN(c)&&c%1===0;if(!g)throw"argument is not an integer";c!==d&&c>=0&&b.hasOwnProperty(a)&&c<=b[a]&&(f(a,c),this.notify(this.eventList.ENAME_QUALITY_CHANGED,a,d,c))},getQualityFor:function(a){return e(a)},getConfidenceFor:function(a){return g(a)},isPlayingAtTopQuality:function(){var a,b=this,c=b.getQualityFor("audio"),d=b.getQualityFor("video");return a=c===j("audio")&&d===j("video")},reset:function(){var e,f=this.abrRulesCollection.getRules(MediaPlayer.rules.ABRRulesCollection.prototype.QUALITY_SWITCH_RULES),g=f.length,h=0;for(h;g>h;h+=1)e=f[h],"function"==typeof e.reset&&e.reset();a=!0,b={},c={},d={}}}},MediaPlayer.dependencies.AbrController.prototype={constructor:MediaPlayer.dependencies.AbrController},MediaPlayer.dependencies.BufferController=function(){"use strict";var a,b,c,d,e=.5,f=22,g=[],h=0,i=-1,j=!1,k=0,l=Number.POSITIVE_INFINITY,m=-1,n=-1,o=null,p=null,q=!1,r=!1,s=[],t=!1,u=function(){var a=this.streamProcessor.getFragmentModel().getLoadingRequests();return i>h&&(v(s,i)||v(a,i))?!1:i!==h},v=function(a,b){var c=0,d=a.length;for(c;d>c;c+=1)if(a[c].quality===b)return!0;return!1},w=function(a,b){var c=function(a,c){return a[b]<c[b]?-1:a[b]>c[b]?1:0};a.sort(c)},x=function(a,c,d,e){var f=this;c===f.streamProcessor.getFragmentModel()&&(f.debug.log("Initialization finished loading: "+b),g[e]=d,e===h&&u.call(f)&&Y.call(f))},y=function(a,b,c,d,e){if(b===this.streamProcessor.getFragmentModel()){var f,g=this.streamProcessor.getFragmentModel().getExecutedRequestForQualityAndIndex(d,e),h=this.streamProcessor.getTrackForQuality(d),i=this.adapter.getEventsFor(h.mediaInfo,this.streamProcessor),j=this.adapter.getEventsFor(h,this.streamProcessor);(i.length>0||j.length>0)&&(f=C.call(this,c,g,i,j),this.streamProcessor.getEventController().addInbandEvents(f)),c=D.call(this,c),s.push({bytes:c,quality:d,index:e}),w(s,"index"),P.call(this)}},z=function(a,b,c){r=!0,d={quality:b,index:c};var e=this,f=isNaN(c);return b!==h&&f||b!==i&&!f?void R.call(e,b,c):void e.sourceBufferExt.append(o,a)},A=function(c,e,g,h){if(o===e){this.isBufferingCompleted()&&this.mediaSourceExt.signalEndOfStream(a);var i,j=this;if(h)return h.code===f&&(s.unshift({bytes:g,quality:d.quality,index:d.index}),l=.8*J.call(j),j.notify(j.eventList.ENAME_QUOTA_EXCEEDED,l),H.call(j)),void(r=!1);if(B.call(j),G.call(j)||(j.notify(j.eventList.ENAME_QUOTA_EXCEEDED,l),H.call(j)),i=j.sourceBufferExt.getAllRanges(o),i&&i.length>0){var k,m;for(k=0,m=i.length;m>k;k+=1)j.debug.log("Buffered "+b+" Range: "+i.start(k)+" - "+i.end(k))}Q.call(j,d.quality,d.index),j.notify(j.eventList.ENAME_BYTES_APPENDED,d.quality,d.index)}},B=function(){var a=this,b=a.playbackController.getTime();return k=a.sourceBufferExt.getBufferLength(o,b),a.notify(a.eventList.ENAME_BUFFER_LEVEL_UPDATED,k),E.call(a),L.call(a),e>k&&M.call(a,!1),!0},C=function(a,b,c,d){var e,f,g,h,i=[],j=0,k=Math.pow(256,2),l=Math.pow(256,3),m=Math.max(isNaN(b.startTime)?0:b.startTime,0),n=[];t=!1,h=c.concat(d);for(var o=0;o<h.length;o++)n[h[o].schemeIdUri]=h[o];for(;j<a.length&&(e=String.fromCharCode(a[j+4],a[j+5],a[j+6],a[j+7]),f=a[j]*l+a[j+1]*k+256*a[j+2]+1*a[j+3],"moov"!=e&&"moof"!=e);){if("emsg"==e){t=!0;for(var p=["","",0,0,0,0,""],q=0,r=j+12;f+j>r;)0===q||1==q||6==q?(0!==a[r]?p[q]+=String.fromCharCode(a[r]):q+=1,r+=1):(p[q]=a[r]*l+a[r+1]*k+256*a[r+2]+1*a[r+3],r+=4,q+=1);g=this.adapter.getEvent(p,n,m),g&&i.push(g)}j+=f}return i},D=function(a){if(!t)return a;for(var b,c,d=a.length,e=0,f=0,g=Math.pow(256,2),h=Math.pow(256,3),i=new Uint8Array(a.length);d>e;){if(b=String.fromCharCode(a[e+4],a[e+5],a[e+6],a[e+7]),c=a[e]*h+a[e+1]*g+256*a[e+2]+1*a[e+3],"emsg"!=b)for(var j=e;e+c>j;j++)i[f]=a[j],f+=1;e+=c}return i.subarray(0,f)},E=function(){var a=F.call(this),b=2*c,d=k-a;d>=b&&!q?(q=!0,this.notify(this.eventList.ENAME_BUFFER_LEVEL_OUTRUN)):b/2>d&&q&&(this.notify(this.eventList.ENAME_BUFFER_LEVEL_BALANCED),q=!1,P.call(this))},F=function(){var a=this.metricsModel.getReadOnlyMetricsFor("video"),b=this.metricsExt.getCurrentBufferLevel(a),c=this.metricsModel.getReadOnlyMetricsFor("audio"),d=this.metricsExt.getCurrentBufferLevel(c),e=null;return e=null===b||null===d?null!==d?d.level:null!==b?b.level:null:Math.min(d.level,b.level)},G=function(){var a=this,b=J.call(a);return l>b},H=function(){var b,c,d,e,f=this,g=f.playbackController.getTime();o&&(e=f.fragmentController.getExecutedRequestForTime(f.streamProcessor.getFragmentModel(),g),c=e&&!isNaN(e.startTime)?e.startTime:Math.floor(g),d=f.sourceBufferExt.getBufferRange(o,g),null===d&&o.buffered.length>0&&(c=o.buffered.end(o.buffered.length-1)),b=o.buffered.start(0),f.sourceBufferExt.remove(o,b,c,a))},I=function(a,b,d,e){o===b&&(B.call(this),this.notify(this.eventList.ENAME_BUFFER_CLEARED,d,e,G.call(this)),G.call(this)||setTimeout(H.bind(this),1e3*c))},J=function(){var a,b,c=this,d=c.sourceBufferExt.getAllRanges(o),e=0;if(!d)return e;for(b=0,a=d.length;a>b;b+=1)e+=d.end(b)-d.start(b);return e},K=function(){var a=m===n-1;a&&!j&&(j=!0,this.notify(this.eventList.ENAME_BUFFERING_COMPLETED))},L=function(){var a=this.playbackController.getTimeToStreamEnd(),b=this.streamProcessor.isDynamic()?c/2:c;b>k&&(a>c||c>=a&&!j)?M.call(this,!1):M.call(this,!0)},M=function(a){p!==a&&(p=a,this.debug.log(p?"Got enough "+b+" buffer to start.":"Waiting for more "+b+" buffer before starting playback."),this.eventBus.dispatchEvent({type:p?"bufferLoaded":"bufferStalled",data:{bufferType:b}}),this.notify(this.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,a))},N=function(a){o.timestampOffset!==a&&(o.timestampOffset=a)},O=function(){var a=this;B.call(a),P.call(a)},P=function(){u.call(this)?Y.call(this):U.call(this)},Q=function(a,b){r=!1,isNaN(b)?S.call(this,a):T.call(this,b),P.call(this)},R=function(a,b){r=!1,this.notify(this.eventList.ENAME_BYTES_REJECTED,a,b),P.call(this)},S=function(a){i=a},T=function(a){m=Math.max(a,m),K.call(this)},U=function(){var a;0===s.length||q||r||u.call(this)||!G.call(this)||(a=s.shift(),z.call(this,a.bytes,a.quality,a.index))},V=function(a,b,d){var e,f=this;N.call(f,d.MSETimeOffset),e=f.streamProcessor.getStreamInfo().manifestInfo.minBufferTime,c!==e&&(f.setMinBufferTime(e),f.notify(f.eventList.ENAME_MIN_BUFFER_TIME_UPDATED,e))},W=function(a,b,c){var d=this;b===d.streamProcessor.getFragmentModel()&&(n=c.index,K.call(d))},X=function(a,c,d,e){if(b===c){var f=this;h!==e&&(N.call(f,f.streamProcessor.getTrackForQuality(e).MSETimeOffset),h=e,u.call(f)&&Y.call(f))}},Y=function(){var a=this;if(g[h]){if(r)return;z.call(a,g[h],h)}else a.notify(a.eventList.ENAME_INIT_REQUESTED,h)},Z=function(){P.call(this)},$=function(){L.call(this)};return{manifestModel:void 0,sourceBufferExt:void 0,eventBus:void 0,bufferMax:void 0,mediaSourceExt:void 0,metricsModel:void 0,metricsExt:void 0,adapter:void 0,debug:void 0,system:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_CLOSED_CAPTIONING_REQUESTED:"closedCaptioningRequested",ENAME_BUFFER_LEVEL_STATE_CHANGED:"bufferLevelStateChanged",ENAME_BUFFER_LEVEL_UPDATED:"bufferLevelUpdated",ENAME_QUOTA_EXCEEDED:"quotaExceeded",ENAME_BYTES_APPENDED:"bytesAppended",ENAME_BYTES_REJECTED:"bytesRejected",ENAME_BUFFERING_COMPLETED:"bufferingCompleted",ENAME_BUFFER_CLEARED:"bufferCleared",ENAME_INIT_REQUESTED:"initRequested",ENAME_BUFFER_LEVEL_OUTRUN:"bufferLevelOutrun",ENAME_BUFFER_LEVEL_BALANCED:"bufferLevelBalanced",ENAME_MIN_BUFFER_TIME_UPDATED:"minBufferTimeUpdated"},setup:function(){this.dataUpdateCompleted=V,this.initFragmentLoaded=x,this.mediaFragmentLoaded=y,this.streamCompleted=W,this.qualityChanged=X,this.playbackProgress=O,this.playbackSeeking=O,this.playbackTimeUpdated=O,this.playbackRateChanged=$,this.wallclockTimeUpdated=Z,A=A.bind(this),I=I.bind(this),this.sourceBufferExt.subscribe(this.sourceBufferExt.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,this,A),this.sourceBufferExt.subscribe(this.sourceBufferExt.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,this,I)},initialize:function(a,c,d,e){var f=this;b=a,f.setMediaSource(d),f.setBuffer(c),f.streamProcessor=e,f.fragmentController=e.fragmentController,f.scheduleController=e.scheduleController,f.playbackController=e.playbackController},getStreamProcessor:function(){return this.streamProcessor},setStreamProcessor:function(a){this.streamProcessor=a},getBuffer:function(){return o},setBuffer:function(a){o=a},getBufferLevel:function(){return k},getMinBufferTime:function(){return c},setMinBufferTime:function(a){c=a},getCriticalBufferLevel:function(){return l},setMediaSource:function(b){a=b},isBufferingCompleted:function(){return j},reset:function(b){var e=this;g=[],l=Number.POSITIVE_INFINITY,p=null,c=null,i=-1,h=0,e.sourceBufferExt.unsubscribe(e.sourceBufferExt.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,e,A),e.sourceBufferExt.unsubscribe(e.sourceBufferExt.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,e,I),d=null,q=!1,r=!1,s=[],b||(e.sourceBufferExt.abort(a,o),e.sourceBufferExt.removeSourceBuffer(a,o)),o=null}}},MediaPlayer.dependencies.BufferController.BUFFER_SIZE_REQUIRED="required",MediaPlayer.dependencies.BufferController.BUFFER_SIZE_MIN="min",MediaPlayer.dependencies.BufferController.BUFFER_SIZE_INFINITY="infinity",MediaPlayer.dependencies.BufferController.DEFAULT_MIN_BUFFER_TIME=8,MediaPlayer.dependencies.BufferController.BUFFER_TIME_AT_TOP_QUALITY=30,MediaPlayer.dependencies.BufferController.BUFFER_TIME_AT_TOP_QUALITY_LONG_FORM=300,MediaPlayer.dependencies.BufferController.LONG_FORM_CONTENT_DURATION_THRESHOLD=600,MediaPlayer.dependencies.BufferController.prototype={constructor:MediaPlayer.dependencies.BufferController},MediaPlayer.utils.Capabilities=function(){"use strict"},MediaPlayer.utils.Capabilities.prototype={constructor:MediaPlayer.utils.Capabilities,supportsMediaSource:function(){"use strict";var a="WebKitMediaSource"in window,b="MediaSource"in window;return a||b},supportsMediaKeys:function(){"use strict";var a="WebKitMediaKeys"in window,b="MSMediaKeys"in window,c="MediaKeys"in window;return a||b||c},supportsCodec:function(a,b){"use strict";if(!(a instanceof HTMLMediaElement))throw"element must be of type HTMLMediaElement.";var c=a.canPlayType(b);return"probably"===c||"maybe"===c}},MediaPlayer.utils.Debug=function(){"use strict";var a=!0;return{eventBus:void 0,setLogToBrowserConsole:function(b){a=b},getLogToBrowserConsole:function(){return a},log:function(b){a&&console.log(b),this.eventBus.dispatchEvent({type:"log",message:b})}}},MediaPlayer.dependencies.ErrorHandler=function(){"use strict";return{eventBus:void 0,capabilityError:function(a){this.eventBus.dispatchEvent({type:"error",error:"capability",event:a})},downloadError:function(a,b,c){this.eventBus.dispatchEvent({type:"error",error:"download",event:{id:a,url:b,request:c}})},manifestError:function(a,b,c){this.eventBus.dispatchEvent({type:"error",error:"manifestError",event:{message:a,id:b,manifest:c}})},closedCaptionsError:function(a,b,c){this.eventBus.dispatchEvent({type:"error",error:"cc",event:{message:a,id:b,cc:c}})},mediaSourceError:function(a){this.eventBus.dispatchEvent({type:"error",error:"mediasource",event:a})},mediaKeySessionError:function(a){this.eventBus.dispatchEvent({type:"error",error:"key_session",event:a})},mediaKeyMessageError:function(a){this.eventBus.dispatchEvent({type:"error",error:"key_message",event:a})},mediaKeySystemSelectionError:function(a){this.eventBus.dispatchEvent({type:"error",error:"key_system_selection",event:a})}}},MediaPlayer.dependencies.ErrorHandler.prototype={constructor:MediaPlayer.dependencies.ErrorHandler},MediaPlayer.utils.EventBus=function(){"use strict";var a,b=function(b,c){var d=(c?"1":"0")+b;return d in a||(a[d]=[]),a[d]},c=function(){a={}};return c(),{addEventListener:function(a,c,d){var e=b(a,d),f=e.indexOf(c);-1===f&&e.push(c)},removeEventListener:function(a,c,d){var e=b(a,d),f=e.indexOf(c);-1!==f&&e.splice(f,1)},dispatchEvent:function(a){for(var c=b(a.type,!1).slice(),d=0;d<c.length;d++)c[d].call(this,a);return!a.defaultPrevented}}},MediaPlayer.dependencies.EventController=function(){"use strict";var a=[],b=[],c=[],d=null,e=100,f=e/1e3,g="urn:mpeg:dash:event:2012",h=1,i=function(){null!==d&&(clearInterval(d),d=null),a=null,b=null,c=null},j=function(){null!==d&&(clearInterval(d),d=null)},k=function(){var a=this;a.debug.log("Start Event Controller"),isNaN(e)||(d=setInterval(n.bind(this),e))},l=function(b){var c=this;a=[],b&&b.length>0&&(a=b),c.debug.log("Added "+b.length+" inline events")},m=function(a){for(var c=this,d=0;d<a.length;d++){var e=a[d];b[e.id]=e,c.debug.log("Add inband event with id "+e.id)}},n=function(){o.call(this,b),o.call(this,a),p.call(this)},o=function(a){var b,d=this,e=this.videoModel.getCurrentTime();if(a)for(var i=0;i<a.length;i++){var j=a[i];void 0!==j&&(b=j.presentationTime/j.eventStream.timescale,(0===b||e>=b&&b+f>e)&&(d.debug.log("Start Event at "+e),j.duration>0&&c.push(j),j.eventStream.schemeIdUri==g&&j.eventStream.value==h&&q.call(this),a.splice(i,1)))}},p=function(){var a=this;if(c)for(var b=this.videoModel.getCurrentTime(),d=0;d<c.length;d++){var e=c[d];null!==e&&(e.duration+e.presentationTime)/e.eventStream.timescale<b&&(a.debug.log("Remove Event at time "+b),e=null,c.splice(d,1))}},q=function(){var a=this,b=a.manifestModel.getValue(),c=b.url;b.hasOwnProperty("Location")&&(c=b.Location),a.debug.log("Refresh manifest @ "+c),a.manifestLoader.load(c)};return{manifestModel:void 0,manifestLoader:void 0,debug:void 0,system:void 0,errHandler:void 0,videoModel:void 0,addInlineEvents:l,addInbandEvents:m,reset:i,clear:j,start:k,getVideoModel:function(){return this.videoModel},setVideoModel:function(a){this.videoModel=a},initialize:function(a){this.setVideoModel(a)}}},MediaPlayer.dependencies.EventController.prototype={constructor:MediaPlayer.dependencies.EventController},MediaPlayer.dependencies.FragmentController=function(){"use strict";var a=[],b=!1,c=function(b){for(var c=a.length,d=0;c>d;d++)if(a[d].getContext()==b)return a[d];return null},d=function(b,c){var d=this,e=a[0].getContext().streamProcessor,f=e.getStreamInfo().id,g=d.scheduleRulesCollection.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_EXECUTE_RULES);-1!==g.indexOf(this.scheduleRulesCollection.sameTimeRequestRule)&&this.scheduleRulesCollection.sameTimeRequestRule.setFragmentModels(a,f),d.rulesController.applyRules(g,e,c,b,function(a,b){return b})},e=function(a,b){var c=this;c.isInitializationRequest(b)?c.notify(c.eventList.ENAME_INIT_FRAGMENT_LOADING_START,a,b):c.notify(c.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,a,b)},f=function(a,b,c){var d=this,e=d.process(c);return null===e?void d.debug.log("No "+b.mediaType+" bytes to push."):(d.isInitializationRequest(b)?d.notify(d.eventList.ENAME_INIT_FRAGMENT_LOADED,a,e,b.quality):d.notify(d.eventList.ENAME_MEDIA_FRAGMENT_LOADED,a,e,b.quality,b.index),void j.call(this))},g=function(a,b){this.notify(this.eventList.ENAME_STREAM_COMPLETED,a,b)},h=function(){j.call(this)},i=function(c){var d,e,f,g,h,i=c.value;for(g=0;g<i.length;g+=1)if(e=i[g])for(h=0;h<a.length;h+=1)f=a[h],d=f.getContext().streamProcessor.getType(),e.mediaType===d&&(e instanceof MediaPlayer.vo.FragmentRequest||(e=f.getPendingRequestForTime(e.startTime)),f.executeRequest(e));b=!1},j=function(a){b||(b=!0,d.call(this,a,i.bind(this)))};return{system:void 0,debug:void 0,scheduleRulesCollection:void 0,rulesController:void 0,fragmentLoader:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_STREAM_COMPLETED:"streamCompleted",ENAME_INIT_FRAGMENT_LOADING_START:"initFragmentLoadingStart",ENAME_MEDIA_FRAGMENT_LOADING_START:"mediaFragmentLoadingStart",ENAME_INIT_FRAGMENT_LOADED:"initFragmentLoaded",ENAME_MEDIA_FRAGMENT_LOADED:"mediaFragmentLoaded"},setup:function(){this.fragmentLoadingStarted=e,this.fragmentLoadingCompleted=f,this.streamCompleted=g,this.bufferLevelBalanced=h},process:function(a){var b=null;return null!==a&&void 0!==a&&a.byteLength>0&&(b=new Uint8Array(a)),b},getModel:function(b){if(!b)return null;var d=c(b);return d||(d=this.system.getObject("fragmentModel"),d.setContext(b),a.push(d)),d},detachModel:function(b){var c=a.indexOf(b);c>-1&&a.splice(c,1)},isFragmentLoadedOrPending:function(a,b){var d,e=c(a);return e?d=e.isFragmentLoadedOrPending(b):!1},getPendingRequests:function(a){var b=c(a);return b?b.getPendingRequests():null},getLoadingRequests:function(a){var b=c(a);return b?b.getLoadingRequests():null},isInitializationRequest:function(a){return a&&a.type&&-1!==a.type.toLowerCase().indexOf("initialization")},getLoadingTime:function(a){var b=c(a);return b?b.getLoadingTime():null},getExecutedRequestForTime:function(a,b){return a?a.getExecutedRequestForTime(b):null},removeExecutedRequest:function(a,b){a&&a.removeExecutedRequest(b)},removeExecutedRequestsBeforeTime:function(a,b){a&&a.removeExecutedRequestsBeforeTime(b)},cancelPendingRequestsForModel:function(a){a&&a.cancelPendingRequests()},abortRequestsForModel:function(a){a&&a.abortRequests(),j.call(this)},prepareFragmentForLoading:function(a,b){var d=c(a);d&&b&&d.addRequest(b)&&j.call(this,b)},executePendingRequests:function(){j.call(this)},resetModel:function(a){this.abortRequestsForModel(a),this.cancelPendingRequestsForModel(a)}}},MediaPlayer.dependencies.FragmentController.prototype={constructor:MediaPlayer.dependencies.FragmentController},MediaPlayer.dependencies.FragmentLoader=function(){"use strict";var a=3,b=500,c=[],d=function(a,e){var f=new XMLHttpRequest,g=null,h=!0,i=!0,j=null,k=this;c.push(f),a.requestStartDate=new Date,g=k.metricsModel.addHttpRequest(a.mediaType,null,a.type,a.url,null,a.range,a.requestStartDate,null,null,null,null,a.duration),k.metricsModel.appendHttpTrace(g,a.requestStartDate,a.requestStartDate.getTime()-a.requestStartDate.getTime(),[0]),j=a.requestStartDate,f.open("GET",k.tokenAuthentication.addTokenAsQueryArg(a.url),!0),f.responseType="arraybuffer",f=k.tokenAuthentication.setTokenInRequestHeader(f),a.range&&f.setRequestHeader("Range","bytes="+a.range),f.onprogress=function(b){var c=new Date;h&&(h=!1,(!b.lengthComputable||b.lengthComputable&&b.total!=b.loaded)&&(a.firstByteDate=c,g.tresponse=c)),k.metricsModel.appendHttpTrace(g,c,c.getTime()-j.getTime(),[f.response?f.response.byteLength:0]),j=c},f.onload=function(){if(!(f.status<200||f.status>299)){i=!1;var b,c,d=new Date,e=f.response;a.firstByteDate||(a.firstByteDate=a.requestStartDate),a.requestEndDate=d,b=a.firstByteDate.getTime()-a.requestStartDate.getTime(),c=a.requestEndDate.getTime()-a.firstByteDate.getTime(),k.debug.log("loaded "+a.mediaType+":"+a.type+":"+a.startTime+" ("+f.status+", "+b+"ms, "+c+"ms)"),g.tresponse=a.firstByteDate,g.tfinish=a.requestEndDate,g.responsecode=f.status,k.metricsModel.appendHttpTrace(g,d,d.getTime()-j.getTime(),[e?e.byteLength:0]),j=d,k.notify(k.eventList.ENAME_LOADING_COMPLETED,a,e)}},f.onloadend=f.onerror=function(){if(-1!==c.indexOf(f)&&(c.splice(c.indexOf(f),1),i)){i=!1;var h,l,m=new Date,n=f.response;a.firstByteDate||(a.firstByteDate=a.requestStartDate),a.requestEndDate=m,h=a.firstByteDate.getTime()-a.requestStartDate.getTime(),l=a.requestEndDate.getTime()-a.firstByteDate.getTime(),k.debug.log("failed "+a.mediaType+":"+a.type+":"+a.startTime+" ("+f.status+", "+h+"ms, "+l+"ms)"),g.tresponse=a.firstByteDate,g.tfinish=a.requestEndDate,g.responsecode=f.status,k.metricsModel.appendHttpTrace(g,m,m.getTime()-j.getTime(),[n?n.byteLength:0]),j=m,e>0?(k.debug.log("Failed loading fragment: "+a.mediaType+":"+a.type+":"+a.startTime+", retry in "+b+"ms attempts: "+e),e--,setTimeout(function(){d.call(k,a,e)},b)):(k.debug.log("Failed loading fragment: "+a.mediaType+":"+a.type+":"+a.startTime+" no retry attempts left"),k.errHandler.downloadError("content",a.url,f),k.notify(k.eventList.ENAME_LOADING_COMPLETED,a,null,new Error("failed loading fragment")))}},f.send()},e=function(a){var b=this,c=new XMLHttpRequest,d=!1;c.open("HEAD",a.url,!0),c.onload=function(){c.status<200||c.status>299||(d=!0,b.notify(b.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,!0,a))},c.onloadend=c.onerror=function(){d||b.notify(b.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,!1,a)},c.send()};return{metricsModel:void 0,errHandler:void 0,debug:void 0,tokenAuthentication:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_LOADING_COMPLETED:"loadingCompleted",ENAME_CHECK_FOR_EXISTENCE_COMPLETED:"checkForExistenceCompleted"},load:function(b){b?d.call(this,b,a):this.notify(this.eventList.ENAME_LOADING_COMPLETED,b,null,new Error("request is null"))},checkForExistence:function(a){return a?void e.call(this,a):void this.notify(this.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,!1,a)},abort:function(){var a,b,d=c.length;for(a=0;d>a;a+=1)b=c[a],c[a]=null,b.abort(),b=null;c=[]}}},MediaPlayer.dependencies.FragmentLoader.prototype={constructor:MediaPlayer.dependencies.FragmentLoader},MediaPlayer.dependencies.FragmentModel=function(){"use strict";var a,b=[],c=[],d=[],e=[],f=!1,g=function(a){var b=this;b.notify(b.eventList.ENAME_FRAGMENT_LOADING_STARTED,a),b.fragmentLoader.load(a)},h=function(a){var c=b.indexOf(a);-1!==c&&b.splice(c,1)},i=function(a,b){var c,d=a.length-1,e=0/0,f=0/0,g=null;for(c=d;c>=0;c-=1)if(g=a[c],e=g.startTime,f=e+g.duration,!isNaN(e)&&!isNaN(f)&&b>=e&&f>b||isNaN(e)&&isNaN(b))return g;return null},j=function(a,b){if(a){var c=a.mediaType,d=new Date,e=a.type,f=a.startTime,g=a.availabilityStartTime,h=a.duration,i=a.quality,j=a.range;this.metricsModel.addSchedulingInfo(c,d,e,f,g,h,i,j,b)}},k=function(a,c,e,f){d.splice(d.indexOf(c),1),e&&!f?(b.push(c),j.call(this,c,MediaPlayer.vo.metrics.SchedulingInfo.EXECUTED_STATE),this.notify(this.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,c,e)):(j.call(this,c,MediaPlayer.vo.metrics.SchedulingInfo.FAILED_STATE),this.notify(this.eventList.ENAME_FRAGMENT_LOADING_FAILED,c))},l=function(a,b,c){var d=this.getExecutedRequestForQualityAndIndex(b,c);d&&(this.removeExecutedRequest(d),isNaN(c)||(e.push(d),j.call(this,d,MediaPlayer.vo.metrics.SchedulingInfo.REJECTED_STATE)))},m=function(){f=!0},n=function(){f=!1};return{system:void 0,debug:void 0,metricsModel:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_STREAM_COMPLETED:"streamCompleted",ENAME_FRAGMENT_LOADING_STARTED:"fragmentLoadingStarted",ENAME_FRAGMENT_LOADING_COMPLETED:"fragmentLoadingCompleted",ENAME_FRAGMENT_LOADING_FAILED:"fragmentLoadingFailed"},setup:function(){this.bufferLevelOutrun=m,this.bufferLevelBalanced=n,this.bytesRejected=l,this.loadingCompleted=k},setLoader:function(a){this.fragmentLoader=a},setContext:function(b){a=b},getContext:function(){return a},getIsPostponed:function(){return f},addRequest:function(a){return!a||this.isFragmentLoadedOrPending(a)?!1:(c.push(a),j.call(this,a,MediaPlayer.vo.metrics.SchedulingInfo.PENDING_STATE),!0)},isFragmentLoadedOrPending:function(a){var e=function(a,b){return"complete"===a.action&&a.action===b.action},f=function(a,b){return a.url===b.url&&a.startTime===b.startTime},g=function(a,b){return isNaN(a.index)&&isNaN(b.index)&&a.quality===b.quality},h=function(b){var c,d,h=!1,i=b.length;for(d=0;i>d;d+=1)if(c=b[d],f(a,c)||g(a,c)||e(a,c)){h=!0;break}return h};return h(c)||h(d)||h(b)},getPendingRequests:function(){return c},getLoadingRequests:function(){return d},getExecutedRequests:function(){return b},getRejectedRequests:function(){return e},getLoadingTime:function(){var a,c,d=0;for(c=b.length-1;c>=0;c-=1)if(a=b[c],a.requestEndDate instanceof Date&&a.firstByteDate instanceof Date){d=a.requestEndDate.getTime()-a.firstByteDate.getTime();break}return d},getExecutedRequestForTime:function(a){return i(b,a)},getPendingRequestForTime:function(a){return i(c,a)},getLoadingRequestForTime:function(a){return i(d,a)},getExecutedRequestForQualityAndIndex:function(a,c){var d,e=b.length-1,f=null;for(d=e;d>=0;d-=1)if(f=b[d],f.quality===a&&f.index===c)return f;return null},removeExecutedRequest:function(a){h.call(this,a)},removeExecutedRequestsBeforeTime:function(a){var c,d=b.length-1,e=0/0,f=null;for(c=d;c>=0;c-=1)f=b[c],e=f.startTime,!isNaN(e)&&a>e&&h.call(this,f)},cancelPendingRequests:function(a){var b=this,d=c,e=d;return c=[],void 0!==a&&(c=d.filter(function(b){return b.quality===a?!1:(e.splice(e.indexOf(b),1),!0)})),e.forEach(function(a){j.call(b,a,MediaPlayer.vo.metrics.SchedulingInfo.CANCELED_STATE)}),e},abortRequests:function(){this.fragmentLoader.abort();for(var a=0,b=d.length;b>a;a+=1)this.removeExecutedRequest(d[a]);d=[]},executeRequest:function(a){var e=this,f=c.indexOf(a);if(a&&-1!==f)switch(c.splice(f,1),a.action){case"complete":b.push(a),j.call(e,a,MediaPlayer.vo.metrics.SchedulingInfo.EXECUTED_STATE),e.notify(e.eventList.ENAME_STREAM_COMPLETED,a);break;case"download":d.push(a),j.call(e,a,MediaPlayer.vo.metrics.SchedulingInfo.LOADING_STATE),g.call(e,a);break;default:this.debug.log("Unknown request action.")}}}},MediaPlayer.dependencies.FragmentModel.prototype={constructor:MediaPlayer.dependencies.FragmentModel},MediaPlayer.dependencies.LiveEdgeFinder=function(){"use strict";var a,b=!1,c=function(a){var b=a.value,c=((new Date).getTime()-this.streamProcessor.getStreamInfo().manifestInfo.loadedTime.getTime())/1e3;null!==b?this.notify(this.eventList.ENAME_LIVE_EDGE_FOUND,b,c):this.notify(this.eventList.ENAME_LIVE_EDGE_SEARCH_ERROR,c)},d=function(){if(this.streamProcessor.isDynamic()&&!b){var d=this;a=d.scheduleRulesCollection.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.LIVE_EDGE_RULES),b=!0,this.rulesController.applyRules(a,d.streamProcessor,c.bind(d),null,function(a,b){return b})}};return{system:void 0,scheduleRulesCollection:void 0,rulesController:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_LIVE_EDGE_FOUND:"liveEdgeFound",ENAME_LIVE_EDGE_SEARCH_ERROR:"liveEdgeSearchError"},setup:function(){this.streamUpdated=d},initialize:function(a){this.streamProcessor=a,this.fragmentLoader=a.fragmentLoader,this.scheduleRulesCollection.liveEdgeBinarySearchRule&&this.scheduleRulesCollection.liveEdgeBinarySearchRule.setFinder(this)},abortSearch:function(){if(b=!1,a)for(var c=0,d=a.length;d>c;c+=1)a[c].reset()}}},MediaPlayer.dependencies.LiveEdgeFinder.prototype={constructor:MediaPlayer.dependencies.LiveEdgeFinder},MediaPlayer.dependencies.ManifestLoader=function(){"use strict";var a=3,b=500,c=function(a){var b=null;return-1!==a.indexOf("/")&&(-1!==a.indexOf("?")&&(a=a.substring(0,a.indexOf("?"))),b=a.substring(0,a.lastIndexOf("/")+1)),b},d=function(a,e){var f,g=c(a),h=new XMLHttpRequest,i=new Date,j=null,k=!0,l=null,m=null,n=this;l=function(){h.status<200||h.status>299||(k=!1,j=new Date,n.tokenAuthentication.checkRequestHeaderForToken(h),n.metricsModel.addHttpRequest("stream",null,"MPD",a,null,null,i,j,h.status,null,null),f=n.parser.parse(h.responseText,g),f?(f.url=a,f.loadedTime=j,n.metricsModel.addManifestUpdate("stream",f.type,i,j,f.availabilityStartTime),n.notify(n.eventList.ENAME_MANIFEST_LOADED,f)):n.notify(n.eventList.ENAME_MANIFEST_LOADED,null,new Error("Failed loading manifest: "+a)))},m=function(){k&&(k=!1,n.metricsModel.addHttpRequest("stream",null,"MPD",a,null,null,i,new Date,h.status,null,null),e>0?(n.debug.log("Failed loading manifest: "+a+", retry in "+b+"ms attempts: "+e),e--,setTimeout(function(){d.call(n,a,e)},b)):(n.debug.log("Failed loading manifest: "+a+" no retry attempts left"),n.errHandler.downloadError("manifest",a,h),n.notify(n.eventList.ENAME_MANIFEST_LOADED,null,new Error("Failed loading manifest: "+a+" no retry attempts left"))))};try{h.onload=l,h.onloadend=m,h.onerror=m,h.open("GET",a,!0),h.send()}catch(o){h.onerror()}};return{debug:void 0,parser:void 0,errHandler:void 0,metricsModel:void 0,tokenAuthentication:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_MANIFEST_LOADED:"manifestLoaded"},load:function(b){d.call(this,b,a)}}},MediaPlayer.dependencies.ManifestLoader.prototype={constructor:MediaPlayer.dependencies.ManifestLoader},MediaPlayer.models.ManifestModel=function(){"use strict";var a;return{system:void 0,eventBus:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_MANIFEST_UPDATED:"manifestUpdated"},getValue:function(){return a},setValue:function(b){a=b,this.eventBus.dispatchEvent({type:"manifestLoaded",data:b}),this.notify(this.eventList.ENAME_MANIFEST_UPDATED,b)}}},MediaPlayer.models.ManifestModel.prototype={constructor:MediaPlayer.models.ManifestModel},MediaPlayer.dependencies.ManifestUpdater=function(){"use strict";
var a=0/0,b=null,c=!1,d=!1,e=function(){null!==b&&(clearInterval(b),b=null)},f=function(){e.call(this),isNaN(a)||(this.debug.log("Refresh manifest in "+a+" seconds."),b=setTimeout(h.bind(this),Math.min(1e3*a,Math.pow(2,31)-1),this))},g=function(){var b,c,d=this,e=d.manifestModel.getValue();void 0!==e&&null!==e&&(b=d.manifestExt.getRefreshDelay(e),c=((new Date).getTime()-e.loadedTime.getTime())/1e3,a=Math.max(b-c,0),f.call(d))},h=function(){var a,b,c=this;d||(d=!0,a=c.manifestModel.getValue(),b=a.url,a.hasOwnProperty("Location")&&(b=a.Location),c.manifestLoader.load(b))},i=function(a,b,d){d||(this.manifestModel.setValue(b),this.debug.log("Manifest has been refreshed."),c||g.call(this))},j=function(){this.start()},k=function(){this.stop()},l=function(){d=!1};return{debug:void 0,system:void 0,manifestModel:void 0,manifestExt:void 0,manifestLoader:void 0,setup:function(){g.call(this),this.streamsComposed=l,this.manifestLoaded=i,this.playbackStarted=j,this.playbackPaused=k},start:function(){c=!1,g.call(this)},stop:function(){c=!0,e.call(this)}}},MediaPlayer.dependencies.ManifestUpdater.prototype={constructor:MediaPlayer.dependencies.ManifestUpdater},MediaPlayer.dependencies.MediaSourceExtensions=function(){"use strict"},MediaPlayer.dependencies.MediaSourceExtensions.prototype={constructor:MediaPlayer.dependencies.MediaSourceExtensions,createMediaSource:function(){"use strict";var a="WebKitMediaSource"in window,b="MediaSource"in window;return b?new MediaSource:a?new WebKitMediaSource:null},attachMediaSource:function(a,b){"use strict";b.setSource(window.URL.createObjectURL(a))},detachMediaSource:function(a){"use strict";a.setSource("")},setDuration:function(a,b){"use strict";return a.duration=b,a.duration},signalEndOfStream:function(a){"use strict";"open"===a.readyState&&a.endOfStream()}},MediaPlayer.models.MetricsModel=function(){"use strict";return{system:void 0,eventBus:void 0,adapter:void 0,streamMetrics:{},metricsChanged:function(){this.eventBus.dispatchEvent({type:"metricsChanged",data:{}})},metricChanged:function(a){this.eventBus.dispatchEvent({type:"metricChanged",data:{stream:a}}),this.metricsChanged()},metricUpdated:function(a,b,c){this.eventBus.dispatchEvent({type:"metricUpdated",data:{stream:a,metric:b,value:c}}),this.metricChanged(a)},metricAdded:function(a,b,c){this.eventBus.dispatchEvent({type:"metricAdded",data:{stream:a,metric:b,value:c}}),this.metricChanged(a)},clearCurrentMetricsForType:function(a){delete this.streamMetrics[a],this.metricChanged(a)},clearAllCurrentMetrics:function(){var a=this;this.streamMetrics={},this.metricsChanged.call(a)},getReadOnlyMetricsFor:function(a){return this.streamMetrics.hasOwnProperty(a)?this.streamMetrics[a]:null},getMetricsFor:function(a){var b;return this.streamMetrics.hasOwnProperty(a)?b=this.streamMetrics[a]:(b=this.system.getObject("metrics"),this.streamMetrics[a]=b),b},addTcpConnection:function(a,b,c,d,e,f){var g=new MediaPlayer.vo.metrics.TCPConnection;return g.tcpid=b,g.dest=c,g.topen=d,g.tclose=e,g.tconnect=f,this.getMetricsFor(a).TcpList.push(g),this.metricAdded(a,this.adapter.metricsList.TCP_CONNECTION,g),g},addHttpRequest:function(a,b,c,d,e,f,g,h,i,j,k,l){var m=new MediaPlayer.vo.metrics.HTTPRequest;return m.stream=a,m.tcpid=b,m.type=c,m.url=d,m.actualurl=e,m.range=f,m.trequest=g,m.tresponse=h,m.tfinish=i,m.responsecode=j,m.interval=k,m.mediaduration=l,this.getMetricsFor(a).HttpList.push(m),this.metricAdded(a,this.adapter.metricsList.HTTP_REQUEST,m),m},appendHttpTrace:function(a,b,c,d){var e=new MediaPlayer.vo.metrics.HTTPRequest.Trace;return e.s=b,e.d=c,e.b=d,a.trace.push(e),this.metricUpdated(a.stream,this.adapter.metricsList.HTTP_REQUEST_TRACE,a),e},addTrackSwitch:function(a,b,c,d,e){var f=new MediaPlayer.vo.metrics.TrackSwitch;return f.t=b,f.mt=c,f.to=d,f.lto=e,this.getMetricsFor(a).RepSwitchList.push(f),this.metricAdded(a,this.adapter.metricsList.TRACK_SWITCH,f),f},addBufferLevel:function(a,b,c){var d=new MediaPlayer.vo.metrics.BufferLevel;return d.t=b,d.level=c,this.getMetricsFor(a).BufferLevel.push(d),this.metricAdded(a,this.adapter.metricsList.BUFFER_LEVEL,d),d},addDVRInfo:function(a,b,c,d){var e=new MediaPlayer.vo.metrics.DVRInfo;return e.time=b,e.range=d,e.manifestInfo=c,this.getMetricsFor(a).DVRInfo.push(e),this.metricAdded(a,this.adapter.metricsList.DVR_INFO,e),e},addDroppedFrames:function(a,b){var c=new MediaPlayer.vo.metrics.DroppedFrames,d=this.getMetricsFor(a).DroppedFrames;return c.time=b.creationTime,c.droppedFrames=b.droppedVideoFrames,d.length>0&&d[d.length-1]==c?d[d.length-1]:(d.push(c),this.metricAdded(a,this.adapter.metricsList.DROPPED_FRAMES,c),c)},addSchedulingInfo:function(a,b,c,d,e,f,g,h,i){var j=new MediaPlayer.vo.metrics.SchedulingInfo;return j.mediaType=a,j.t=b,j.type=c,j.startTime=d,j.availabilityStartTime=e,j.duration=f,j.quality=g,j.range=h,j.state=i,this.getMetricsFor(a).SchedulingInfo.push(j),this.metricAdded(a,this.adapter.metricsList.SCHEDULING_INFO,j),j},addManifestUpdate:function(a,b,c,d,e,f,g,h,i,j){var k=new MediaPlayer.vo.metrics.ManifestUpdate,l=this.getMetricsFor("stream");return k.mediaType=a,k.type=b,k.requestTime=c,k.fetchTime=d,k.availabilityStartTime=e,k.presentationStartTime=f,k.clientTimeOffset=g,k.currentTime=h,k.buffered=i,k.latency=j,l.ManifestUpdate.push(k),this.metricAdded(a,this.adapter.metricsList.MANIFEST_UPDATE,k),k},updateManifestUpdateInfo:function(a,b){for(var c in b)a[c]=b[c];this.metricUpdated(a.mediaType,this.adapter.metricsList.MANIFEST_UPDATE,a)},addManifestUpdateStreamInfo:function(a,b,c,d,e){var f=new MediaPlayer.vo.metrics.ManifestUpdate.StreamInfo;return f.id=b,f.index=c,f.start=d,f.duration=e,a.streamInfo.push(f),this.metricUpdated(a.mediaType,this.adapter.metricsList.MANIFEST_UPDATE_STREAM_INFO,a),f},addManifestUpdateTrackInfo:function(a,b,c,d,e,f,g,h){var i=new MediaPlayer.vo.metrics.ManifestUpdate.TrackInfo;return i.id=b,i.index=c,i.streamIndex=d,i.mediaType=e,i.startNumber=g,i.fragmentInfoType=h,i.presentationTimeOffset=f,a.trackInfo.push(i),this.metricUpdated(a.mediaType,this.adapter.metricsList.MANIFEST_UPDATE_TRACK_INFO,a),i},addPlayList:function(a,b,c,d){var e=new MediaPlayer.vo.metrics.PlayList;return e.stream=a,e.start=b,e.mstart=c,e.starttype=d,this.getMetricsFor(a).PlayList.push(e),this.metricAdded(a,this.adapter.metricsList.PLAY_LIST,e),e},appendPlayListTrace:function(a,b,c,d,e,f,g,h){var i=new MediaPlayer.vo.metrics.PlayList.Trace;return i.representationid=b,i.subreplevel=c,i.start=d,i.mstart=e,i.duration=f,i.playbackspeed=g,i.stopreason=h,a.trace.push(i),this.metricUpdated(a.stream,this.adapter.metricsList.PLAY_LIST_TRACE,a),i}}},MediaPlayer.models.MetricsModel.prototype={constructor:MediaPlayer.models.MetricsModel},MediaPlayer.dependencies.Notifier=function(){"use strict";var a,b=0,c=function(){return this.id||(b+=1,this.id="_id_"+b),this.id},d=function(a){var b,c=this.eventList;for(b in c)if(c[b]===a)return!0;return!1};return{system:void 0,setup:function(){a=this.system,a.mapValue("notify",this.notify),a.mapValue("subscribe",this.subscribe),a.mapValue("unsubscribe",this.unsubscribe)},notify:function(){var b=[].slice.call(arguments);b.splice(1,0,this),b[0]+=c.call(this),a.notify.apply(a,b)},subscribe:function(b,e,f,g){if(!f&&e[b]&&(f=e[b]=e[b].bind(e)),!d.call(this,b))throw"object does not support given event "+b;if(!e)throw"observer object cannot be null or undefined";if(!f)throw"event handler cannot be null or undefined";b+=c.call(this),a.mapHandler(b,void 0,f,g)},unsubscribe:function(b,d,e){e=e||d[b],b+=c.call(this),a.unmapHandler(b,void 0,e)}}},MediaPlayer.dependencies.Notifier.prototype={constructor:MediaPlayer.dependencies.Notifier},MediaPlayer.dependencies.PlaybackController=function(){"use strict";var a,b,c,d,e,f=1e3,g=0,h=0/0,i=function(a){var b,c=parseInt(this.uriQueryFragModel.getURIFragmentData.s);return e?(!isNaN(c)&&c>1262304e3&&(b=c-a.manifestInfo.availableFrom.getTime()/1e3,(b>h||b<h-a.manifestInfo.DVRWindowSize)&&(b=null)),b=b||h):b=!isNaN(c)&&c<a.duration&&c>=0?c:a.start,b},j=function(){var a,c=this,e=c.getTime(),f=c.metricsModel.getMetricsFor(d.mediaInfo.type),g=c.metricsExt.getCurrentDVRInfo(f),h=g?g.range:null;return h?e>=h.start&&e<=h.end?e:a=Math.max(h.end-2*b.manifestInfo.minBufferTime,h.start):0/0},k=function(){var b=this,c=function(){A.call(b)};null!==a&&l.call(this),a=setInterval(c,f)},l=function(){clearInterval(a),a=null},m=function(){var a=i.call(this,b);this.debug.log("Starting playback at offset: "+a),this.seek(a)},n=function(){if(!this.isPaused()&&e){var a=this.getTime(),b=j.call(this),c=!isNaN(b)&&b!==a;c&&this.seek(b)}},o=function(a,c,f){d=this.adapter.convertDataToTrack(f),b=d.mediaInfo.streamInfo,e=a.streamProcessor.isDynamic(),n.call(this)},p=function(){0!==c.getElement().readyState&&m.call(this)},q=function(){c&&(c.unlisten("play",r),c.unlisten("pause",s),c.unlisten("error",z),c.unlisten("seeking",t),c.unlisten("seeked",u),c.unlisten("timeupdate",v),c.unlisten("progress",w),c.unlisten("ratechange",x),c.unlisten("loadedmetadata",y))},r=function(){n.call(this),this.notify(this.eventList.ENAME_PLAYBACK_STARTED,this.getTime())},s=function(){this.notify(this.eventList.ENAME_PLAYBACK_PAUSED)},t=function(){this.notify(this.eventList.ENAME_PLAYBACK_SEEKING,this.getTime(),!1)},u=function(){this.notify(this.eventList.ENAME_PLAYBACK_SEEKED)},v=function(){var a=this.getTime();a!==g&&(g=a,this.notify(this.eventList.ENAME_PLAYBACK_TIME_UPDATED,this.getTimeToStreamEnd()))},w=function(){var a,d,e,f=c.getElement().buffered;f.length&&(a=f.length-1,d=f.end(a),e=i.call(this,b)+b.duration-d),this.notify(this.eventList.ENAME_PLAYBACK_PROGRESS,c.getElement().buffered,e)},x=function(){this.notify(this.eventList.ENAME_PLAYBACK_RATE_CHANGED)},y=function(){this.debug.log("Got loadmetadata event."),(!e||this.timelineConverter.isTimeSyncCompleted())&&m.call(this),this.notify(this.eventList.ENAME_PLAYBACK_METADATA_LOADED),k.call(this)},z=function(a){this.notify(this.eventList.ENAME_PLAYBACK_ERROR,a.srcElement.error)},A=function(){this.notify(this.eventList.ENAME_WALLCLOCK_TIME_UPDATED,e,new Date)},B=function(a){c=a,c.listen("play",r),c.listen("pause",s),c.listen("error",z),c.listen("seeking",t),c.listen("seeked",u),c.listen("timeupdate",v),c.listen("progress",w),c.listen("ratechange",x),c.listen("loadedmetadata",y)};return{debug:void 0,timelineConverter:void 0,uriQueryFragModel:void 0,metricsModel:void 0,metricsExt:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,adapter:void 0,eventList:{ENAME_PLAYBACK_STARTED:"playbackStarted",ENAME_PLAYBACK_STOPPED:"playbackStopped",ENAME_PLAYBACK_PAUSED:"playbackPaused",ENAME_PLAYBACK_SEEKING:"playbackSeeking",ENAME_PLAYBACK_SEEKED:"playbackSeeked",ENAME_PLAYBACK_TIME_UPDATED:"playbackTimeUpdated",ENAME_PLAYBACK_PROGRESS:"playbackProgress",ENAME_PLAYBACK_RATE_CHANGED:"playbackRateChanged",ENAME_PLAYBACK_METADATA_LOADED:"playbackMetaDataLoaded",ENAME_PLAYBACK_ERROR:"playbackError",ENAME_WALLCLOCK_TIME_UPDATED:"wallclockTimeUpdated"},setup:function(){this.dataUpdateCompleted=o,this.liveEdgeFound=p,r=r.bind(this),s=s.bind(this),z=z.bind(this),t=t.bind(this),u=u.bind(this),v=v.bind(this),w=w.bind(this),x=x.bind(this),y=y.bind(this)},initialize:function(a,d){b=a,c!==d&&(q.call(this),B.call(this,d))},getTimeToStreamEnd:function(){var a=c.getCurrentTime();return i.call(this,b)+b.duration-a},getStreamId:function(){return b.id},getStreamDuration:function(){return b.duration},getTime:function(){return c.getCurrentTime()},getPlaybackRate:function(){return c.getPlaybackRate()},setLiveStartTime:function(a){h=a},start:function(){c.play()},isPaused:function(){return c.isPaused()},pause:function(){c&&c.pause()},isSeeking:function(){return c.getElement().seeking},seek:function(a){a!==this.getTime()&&(c.setCurrentTime(a),this.notify(this.eventList.ENAME_PLAYBACK_SEEKING,a,!0))},reset:function(){l.call(this),q.call(this),c=null,b=null,g=0,h=0/0}}},MediaPlayer.dependencies.PlaybackController.prototype={constructor:MediaPlayer.dependencies.PlaybackController},MediaPlayer.dependencies.ProtectionController=function(){"use strict";var a=null,b=null,c=function(a){var b=this;b.protectionModel.removeKeySystem(a)},d=function(a){for(var c=this,d=a.codec,e=a.contentProtection,f=0;f<b.length;++f)for(var g=0;g<e.length;++g)if(b[f].isSupported(e[g])&&c.protectionExt.supportsCodec(b[f].keysTypeString,d)){var h=e[g].KID;return h||(h="unknown"),c.protectionModel.addKeySystem(h,e[g],b[f]),c.debug.log("DRM: Selected Key System: "+b[f].keysTypeString+" For KID: "+h),h}throw new Error("DRM: The protection system for this content is not supported.")},e=function(a,b,c){var d=this,e=null,f=null;d.protectionModel.needToAddKeySession(a)&&(f=d.protectionModel.getInitData(a),!f&&c?(f=c,d.debug.log("DRM: Using initdata from needskey event. length: "+f.length)):f&&d.debug.log("DRM: Using initdata from prheader in mpd. length: "+f.length),f?(e=d.protectionModel.addKeySession(a,b,f),d.debug.log("DRM: Added Key Session ["+e.sessionId+"] for KID: "+a+" type: "+b+" initData length: "+f.length)):d.debug.log("DRM: initdata is null."))},f=function(a,b,c,d){this.protectionModel.updateFromMessage(a,b,c,d)};return{system:void 0,debug:void 0,capabilities:void 0,protectionModel:void 0,protectionExt:void 0,setup:function(){b=this.protectionExt.getKeySystems()},init:function(b,c){this.videoModel=b,this.protectionModel=c,a=this.videoModel.getElement()},selectKeySystem:d,ensureKeySession:e,updateFromMessage:f,teardownKeySystem:c}},MediaPlayer.dependencies.ProtectionController.prototype={constructor:MediaPlayer.dependencies.ProtectionController},MediaPlayer.dependencies.ProtectionExtensions=function(){"use strict"},MediaPlayer.dependencies.ProtectionExtensions.prototype={constructor:MediaPlayer.dependencies.ProtectionExtensions,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_KEY_SYSTEM_UPDATE_COMPLETED:"keySystemUpdateCompleted"},supportsCodec:function(a,b){"use strict";var c="WebKitMediaKeys"in window,d="MSMediaKeys"in window,e="MediaKeys"in window;return e?MediaKeys.isTypeSupported(a,b):c?WebKitMediaKeys.isTypeSupported(a,b):d?MSMediaKeys.isTypeSupported(a,b):!1},createMediaKeys:function(a){"use strict";var b="WebKitMediaKeys"in window,c="MSMediaKeys"in window,d="MediaKeys"in window;return d?new MediaKeys(a):b?new WebKitMediaKeys(a):c?new MSMediaKeys(a):null},setMediaKey:function(a,b){var c="WebKitSetMediaKeys"in a,d="msSetMediaKeys"in a,e="SetMediaKeys"in a;return e?a.SetMediaKeys(b):c?a.WebKitSetMediaKeys(b):d?a.msSetMediaKeys(b):void this.debug.log("no setmediakeys function in element")},createSession:function(a,b,c){return a.createSession(b,c)},getKeySystems:function(){var a=this,b=function(b,c){var d=null,e=[],f=new DOMParser,g=f.parseFromString(b,"application/xml");if(g.getElementsByTagName("Challenge")[0]){var h=g.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;h&&(d=BASE64.decode(h))}else a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,null,new Error("DRM: playready update, can not find Challenge in keyMessage"));var i=g.getElementsByTagName("name"),j=g.getElementsByTagName("value");i.length!=j.length&&a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,null,new Error("DRM: playready update, invalid header name/value pair in keyMessage"));for(var k=0;k<i.length;k++)e[k]={name:i[k].childNodes[0].nodeValue,value:j[k].childNodes[0].nodeValue};var l=new XMLHttpRequest;l.onload=function(){200==l.status?a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,new Uint8Array(l.response)):a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,null,new Error('DRM: playready update, XHR status is "'+l.statusText+'" ('+l.status+"), expected to be 200. readyState is "+l.readyState))},l.onabort=function(){a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,null,new Error('DRM: playready update, XHR aborted. status is "'+l.statusText+'" ('+l.status+"), readyState is "+l.readyState))},l.onerror=function(){a.notify(a.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,null,new Error('DRM: playready update, XHR error. status is "'+l.statusText+'" ('+l.status+"), readyState is "+l.readyState))},l.open("POST",c),l.responseType="arraybuffer",e&&e.forEach(function(a){l.setRequestHeader(a.name,a.value)}),l.send(d)},c=function(a,b){return null===a&&0===b.length},d=function(a){var b=0,c=0,d=0,e=new Uint8Array([112,115,115,104,0,0,0,0]),f=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),g=null,h=null,i=null,j=null;if("pro"in a)g=BASE64.decodeArray(a.pro.__text);else{if(!("prheader"in a))return null;g=BASE64.decodeArray(a.prheader.__text)}return c=g.length,d=4+e.length+f.length+4+c,h=new ArrayBuffer(d),i=new Uint8Array(h),j=new DataView(h),j.setUint32(b,d),b+=4,i.set(e,b),b+=e.length,i.set(f,b),b+=f.length,j.setUint32(b,c),b+=4,i.set(g,b),b+=c,i};return[{schemeIdUri:"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",keysTypeString:"com.microsoft.playready",isSupported:function(a){return this.schemeIdUri===a.schemeIdUri.toLowerCase()},needToAddKeySession:c,getInitData:d,getUpdate:b},{schemeIdUri:"urn:mpeg:dash:mp4protection:2011",keysTypeString:"com.microsoft.playready",isSupported:function(a){return this.schemeIdUri===a.schemeIdUri.toLowerCase()&&"cenc"===a.value.toLowerCase()},needToAddKeySession:c,getInitData:function(){return null},getUpdate:b},{schemeIdUri:"urn:uuid:00000000-0000-0000-0000-000000000000",keysTypeString:"webkit-org.w3.clearkey",isSupported:function(a){return this.schemeIdUri===a.schemeIdUri.toLowerCase()},needToAddKeySession:function(){return!0},getInitData:function(){return null},getUpdate:function(a){return a}}]},addKey:function(a,b,c,d,e){a.webkitAddKey(b,c,d,e)},generateKeyRequest:function(a,b,c){a.webkitGenerateKeyRequest(b,c)},listenToNeedKey:function(a,b){a.listen("webkitneedkey",b),a.listen("msneedkey",b),a.listen("needKey",b)},listenToKeyError:function(a,b){a.addEventListener("webkitkeyerror",b,!1),a.addEventListener("mskeyerror",b,!1),a.addEventListener("keyerror",b,!1)},listenToKeyMessage:function(a,b){a.addEventListener("webkitkeymessage",b,!1),a.addEventListener("mskeymessage",b,!1),a.addEventListener("keymessage",b,!1)},listenToKeyAdded:function(a,b){a.addEventListener("webkitkeyadded",b,!1),a.addEventListener("mskeyadded",b,!1),a.addEventListener("keyadded",b,!1)},unlistenToKeyError:function(a,b){a.removeEventListener("webkitkeyerror",b),a.removeEventListener("mskeyerror",b),a.removeEventListener("keyerror",b)},unlistenToKeyMessage:function(a,b){a.removeEventListener("webkitkeymessage",b),a.removeEventListener("mskeymessage",b),a.removeEventListener("keymessage",b)},unlistenToKeyAdded:function(a,b){a.removeEventListener("webkitkeyadded",b),a.removeEventListener("mskeyadded",b),a.removeEventListener("keyadded",b)}},MediaPlayer.models.ProtectionModel=function(){"use strict";var a,b=null,c=null,d=null,e=null,f=[],g=function(b,c,d){d||a.update(c)};return{system:void 0,protectionExt:void 0,setup:function(){this.keySystemUpdateCompleted=g},init:function(a){this.videoModel=a,b=this.videoModel.getElement()},addKeySession:function(a,b,g){var h=null;return h=this.protectionExt.createSession(f[a].keys,b,g),this.protectionExt.listenToKeyAdded(h,c),this.protectionExt.listenToKeyError(h,d),this.protectionExt.listenToKeyMessage(h,e),f[a].initData=g,f[a].keySessions.push(h),h},addKeySystem:function(a,c,d){var e=null;e=this.protectionExt.createMediaKeys(d.keysTypeString),this.protectionExt.setMediaKey(b,e),f[a]={kID:a,contentProtection:c,keySystem:d,keys:e,initData:null,keySessions:[]}},removeKeySystem:function(a){if(null!==a&&void 0!==f[a]&&0!==f[a].keySessions.length){for(var b=f[a].keySessions,g=0;g<b.length;++g)this.protectionExt.unlistenToKeyError(b[g],d),this.protectionExt.unlistenToKeyAdded(b[g],c),this.protectionExt.unlistenToKeyMessage(b[g],e),b[g].close();f[a]=void 0}},needToAddKeySession:function(a){var b=null;return b=f[a],b.keySystem.needToAddKeySession(b.initData,b.keySessions)},getInitData:function(a){var b=null;return b=f[a],b.keySystem.getInitData(b.contentProtection)},updateFromMessage:function(b,c,d,e){a=c,f[b].keySystem.getUpdate(d,e)},listenToNeedKey:function(a){this.protectionExt.listenToNeedKey(this.videoModel,a)},listenToKeyError:function(a){d=a;for(var b=0;b<f.length;++b)for(var c=f[b].keySessions,e=0;e<c.length;++e)this.protectionExt.listenToKeyError(c[e],a)},listenToKeyMessage:function(a){e=a;for(var b=0;b<f.length;++b)for(var c=f[b].keySessions,d=0;d<c.length;++d)this.protectionExt.listenToKeyMessage(c[d],a)},listenToKeyAdded:function(a){c=a;for(var b=0;b<f.length;++b)for(var d=f[b].keySessions,e=0;e<d.length;++e)this.protectionExt.listenToKeyAdded(d[e],a)}}},MediaPlayer.models.ProtectionModel.prototype={constructor:MediaPlayer.models.ProtectionModel},MediaPlayer.dependencies.ScheduleController=function(){"use strict";var a,b,c,d,e,f=0,g=!0,h=null,i=!1,j=null,k=null,l=!0,m=function(a,b){var c=0,d=null;l===!1&&(d=k.start,c=a.getTime()-d.getTime(),k.duration=c,k.stopreason=b,l=!0)},n=function(){if(b){i=!1;var c=new Date;m(c,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON),j=this.metricsModel.addPlayList(a,c,0,MediaPlayer.vo.metrics.PlayList.INITIAL_PLAY_START_REASON),g&&(g=!1),this.debug.log("ScheduleController "+a+" start."),w.call(this)}},o=function(){g&&r.call(this,e.quality),n.call(this)},p=function(b){i||(i=!0,this.debug.log("ScheduleController "+a+" stop."),b&&this.fragmentController.cancelPendingRequestsForModel(c),m(new Date,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON))},q=function(a){var b=this,c=b.scheduleRulesCollection.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.NEXT_FRAGMENT_RULES);b.rulesController.applyRules(c,b.streamProcessor,a,null,function(a,b){return b})},r=function(a){var b,c=this;return b=c.adapter.getInitRequest(c.streamProcessor,a),null!==b&&c.fragmentController.prepareFragmentForLoading(c,b),b},s=function(a){var b=this,c=b.scheduleRulesCollection.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_SCHEDULE_RULES);b.rulesController.applyRules(c,b.streamProcessor,a,f,function(a,b){return Math.min(a,b)})},t=function(a){var b,c,d,f=a.length;for(d=0;f>d;d+=1)b=a[d],c=b.startTime+b.duration/2,b=this.adapter.getFragmentRequestForTime(this.streamProcessor,e,c,!1),this.fragmentController.prepareFragmentForLoading(this,b)},u=function(a){var b=this;return f=a.value,0>=f?void b.fragmentController.executePendingRequests():(b.abrController.getPlaybackQuality(b.streamProcessor),void q.call(b,v.bind(b)))},v=function(a){var b=a.value;null===b||b instanceof MediaPlayer.vo.FragmentRequest||(b=this.adapter.getFragmentRequestForTime(this.streamProcessor,e,b.startTime)),b&&(f--,this.fragmentController.prepareFragmentForLoading(this,b))},w=function(){var a=(new Date).getTime(),b=h?a-h>this.fragmentController.getLoadingTime(this):!0;!b||i||this.playbackController.isPaused()&&(!this.scheduleWhilePaused||d)||(h=a,s.call(this,u.bind(this)))},x=function(){var b=this;null!==a&&""!==a&&b.metricsModel.clearCurrentMetricsForType(a)},y=function(a,c,f){e=this.adapter.convertDataToTrack(f),d||(b=!0),b&&o.call(this)},z=function(b,c){c===this.streamProcessor.getFragmentModel()&&(this.debug.log(a+" Stream is complete."),m(new Date,MediaPlayer.vo.metrics.PlayList.Trace.END_OF_CONTENT_STOP_REASON))},A=function(a,b){var c=this;b===c.streamProcessor.getFragmentModel()&&w.call(c)},B=function(){p.call(this)},C=function(){K.call(this)},D=function(){p.call(this,!1)},E=function(a,b){r.call(this,b)},F=function(a,b,d,e){this.fragmentController.removeExecutedRequestsBeforeTime(c,d),e&&n.call(this)},G=function(b,c){var d=this;c||d.playbackController.isSeeking()||(d.debug.log("Stalling "+a+" Buffer: "+a),m(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON))},H=function(b,c){var d=this;d.metricsModel.addBufferLevel(a,new Date,c),w.call(this)},I=function(){p.call(this,!1)},J=function(b,d,f,g){if(a===d){var h,i=this;if(h=c.cancelPendingRequests(f),e=i.streamProcessor.getTrackForQuality(g),null===e||void 0===e)throw"Unexpected error!";t.call(i,h),m(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REPRESENTATION_SWITCH_STOP_REASON)}},K=function(){var a=this,b=a.playbackController.getTime(),c=a.playbackController.getPlaybackRate(),d=new Date;l===!0&&e&&j&&(l=!1,k=a.metricsModel.appendPlayListTrace(j,e.id,null,d,b,null,c,null))},L=function(a,b){var d=this,e=r.call(d,b);c.executeRequest(e)},M=function(){n.call(this)},N=function(b,d){g||this.fragmentController.cancelPendingRequestsForModel(c);var f,h=this.metricsModel.getMetricsFor("stream"),i=this.metricsExt.getCurrentManifestUpdate(h);this.debug.log("ScheduleController "+a+" seek: "+d),f=new Date,m(f,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON),j=this.metricsModel.addPlayList(a,f,d,MediaPlayer.vo.metrics.PlayList.SEEK_START_REASON),n.call(this),this.metricsModel.updateManifestUpdateInfo(i,{latency:e.DVRWindow.end-this.playbackController.getTime()})},O=function(){K.call(this)},P=function(){w.call(this)},Q=function(a,c){var d,f,g=this,h=e.mediaInfo.streamInfo.manifestInfo,i=c-Math.min(2*h.minBufferTime,h.DVRWindowSize/2),j=g.metricsModel.getMetricsFor("stream"),k=g.metricsExt.getCurrentManifestUpdate(j);d=g.adapter.getFragmentRequestForTime(g.streamProcessor,e,i),f=d.startTime+d.duration/2,g.playbackController.setLiveStartTime(f),g.metricsModel.updateManifestUpdateInfo(k,{currentTime:f,presentationStartTime:c,latency:c-f,clientTimeOffset:g.timelineConverter.getClientTimeOffset()}),b=!0,o.call(g)};return{debug:void 0,system:void 0,metricsModel:void 0,metricsExt:void 0,scheduleWhilePaused:void 0,timelineConverter:void 0,abrController:void 0,adapter:void 0,scheduleRulesCollection:void 0,rulesController:void 0,eventList:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this.liveEdgeFound=Q,this.qualityChanged=J,this.dataUpdateStarted=D,this.dataUpdateCompleted=y,this.mediaFragmentLoadingStart=A,this.fragmentLoadingFailed=B,this.streamCompleted=z,this.bufferCleared=F,this.bytesAppended=C,this.bufferLevelStateChanged=G,this.bufferLevelUpdated=H,this.initRequested=E,this.quotaExceeded=I,this.closedCaptioningRequested=L,this.playbackStarted=M,this.playbackSeeking=N,this.playbackRateChanged=O,this.wallclockTimeUpdated=P},initialize:function(b,e){var f=this;a=b,f.streamProcessor=e,f.playbackController=e.playbackController,f.fragmentController=e.fragmentController,f.liveEdgeFinder=e.liveEdgeFinder,f.bufferController=e.bufferController,d=e.isDynamic(),c=this.fragmentController.getModel(this),f.scheduleRulesCollection.bufferLevelRule&&f.scheduleRulesCollection.bufferLevelRule.setScheduleController(f),f.scheduleRulesCollection.pendingRequestsRule&&f.scheduleRulesCollection.pendingRequestsRule.setScheduleController(f),f.scheduleRulesCollection.playbackTimeRule&&f.scheduleRulesCollection.playbackTimeRule.setScheduleController(f)},getFragmentModel:function(){return c},reset:function(){var a=this;p.call(a,!0),a.bufferController.unsubscribe(a.bufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,a.scheduleRulesCollection.bufferLevelRule),a.bufferController.unsubscribe(a.bufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,a.scheduleRulesCollection.bufferLevelRule),a.fragmentController.abortRequestsForModel(c),a.fragmentController.detachModel(c),x.call(a),f=0},start:n,stop:p}},MediaPlayer.dependencies.ScheduleController.prototype={constructor:MediaPlayer.dependencies.ScheduleController},MediaPlayer.dependencies.SourceBufferExtensions=function(){"use strict";this.system=void 0,this.errHandler=void 0,this.notify=void 0,this.subscribe=void 0,this.unsubscribe=void 0,this.eventList={ENAME_SOURCEBUFFER_REMOVE_COMPLETED:"sourceBufferRemoveCompleted",ENAME_SOURCEBUFFER_APPEND_COMPLETED:"sourceBufferAppendCompleted"}},MediaPlayer.dependencies.SourceBufferExtensions.prototype={constructor:MediaPlayer.dependencies.SourceBufferExtensions,createSourceBuffer:function(a,b){"use strict";var c=this,d=b.codec,e=null;try{e=a.addSourceBuffer(d)}catch(f){if(!b.isText)throw f;e=c.system.getObject("textSourceBuffer")}return e},removeSourceBuffer:function(a,b){"use strict";try{a.removeSourceBuffer(b)}catch(c){}},getBufferRange:function(a,b,c){"use strict";var d,e,f=null,g=0,h=0,i=null,j=null,k=0,l=c||.15;try{f=a.buffered}catch(m){return null}if(null!==f){for(e=0,d=f.length;d>e;e+=1)if(g=f.start(e),h=f.end(e),null===i)k=Math.abs(g-b),b>=g&&h>b?(i=g,j=h):l>=k&&(i=g,j=h);else{if(k=g-j,!(l>=k))break;j=h}if(null!==i)return{start:i,end:j}}return null},getAllRanges:function(a){var b=null;try{return b=a.buffered}catch(c){return null}},getBufferLength:function(a,b,c){"use strict";var d,e,f=this;return d=f.getBufferRange(a,b,c),e=null===d?0:d.end-b},waitForUpdateEnd:function(a,b){"use strict";var c,d=50,e=function(){a.updating||(clearInterval(c),b(!0))},f=function(){a.updating||(a.removeEventListener("updateend",f,!1),b(!0))};if(!a.updating)return void b(!0);if("function"==typeof a.addEventListener)try{a.addEventListener("updateend",f,!1)}catch(g){c=setInterval(e,d)}else c=setInterval(e,d)},append:function(a,b){var c=this,d="append"in a?"append":"appendBuffer"in a?"appendBuffer":null;if(d)try{c.waitForUpdateEnd(a,function(){a[d](b),c.waitForUpdateEnd(a,function(){c.notify(c.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,a,b)})})}catch(e){c.notify(c.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,a,b,e)}},remove:function(a,b,c,d){var e=this;try{b>=0&&c>b&&"ended"!==d.readyState&&a.remove(b,c),this.waitForUpdateEnd(a,function(){e.notify(e.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,a,b,c)})}catch(f){e.notify(e.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,a,b,c,f)}},abort:function(a,b){"use strict";try{"open"===a.readyState&&b.abort()}catch(c){}}},MediaPlayer.dependencies.Stream=function(){"use strict";var a,b,c,d,e,f,g={},h=[],i=!0,j=!1,k=!1,l=!1,m=null,n=[],o=!0,p=null,q=null,r=function(){j&&this.playbackController.start()},s=function(){this.playbackController.pause()},t=function(a){j&&(this.debug.log("Do seek: "+a),this.playbackController.seek(a))},u=function(a){var b,c=this,d=g.video,e=g?g.video.codec:null;if(b="msneedkey"!==a.type?a.type:e,n.push({type:b,initData:a.initData}),this.debug.log("DRM: Key required for - "+b),d&&e&&!m)try{m=c.protectionController.selectKeySystem(d)}catch(f){s.call(c),c.debug.log(f),c.errHandler.mediaKeySystemSelectionError(f)}m&&c.protectionController.ensureKeySession(m,b,a.initData)},v=function(a){var b=this,c=null,d=null,e=null,f=null;this.debug.log("DRM: Got a key message..."),c=a.target,d=new Uint16Array(a.message.buffer),e=String.fromCharCode.apply(null,d),f=a.destinationURL,b.protectionController.updateFromMessage(m,c,e,f)},w=function(){this.debug.log("DRM: Key added.")},x=function(){var a,b=event.target;switch(a="DRM: MediaKeyError - sessionId: "+b.sessionId+" errorCode: "+b.error.code+" systemErrorCode: "+b.error.systemCode+" [",b.error.code){case 1:a+="MEDIA_KEYERR_UNKNOWN - An unspecified error occurred. This value is used for errors that don't match any of the other codes.";break;case 2:a+="MEDIA_KEYERR_CLIENT - The Key System could not be installed or updated.";break;case 3:a+="MEDIA_KEYERR_SERVICE - The message passed into update indicated an error from the license service.";break;case 4:a+="MEDIA_KEYERR_OUTPUT - There is no available output device with the required characteristics for the content protection system.";break;case 5:a+="MEDIA_KEYERR_HARDWARECHANGE - A hardware configuration change caused a content protection error.";break;case 6:a+="MEDIA_KEYERR_DOMAIN - An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain."}a+="]",this.debug.log(a),this.errHandler.mediaKeySessionError(a)},y=function(a,b){var c=this,d=function(e){c.debug.log("MediaSource is open!"),c.debug.log(e),a.removeEventListener("sourceopen",d),a.removeEventListener("webkitsourceopen",d),b(a)};a.addEventListener("sourceopen",d,!1),a.addEventListener("webkitsourceopen",d,!1),c.mediaSourceExt.attachMediaSource(a,c.videoModel)},z=function(){var c,d=this,e=h.length,f=0;for(f;e>f;f+=1)c=h[f],c.reset(l),c=null;
q&&q.reset(),h=[],b&&d.mediaSourceExt.detachMediaSource(d.videoModel),j=!1,m=null,n=[],g={},b=null,a=null},A=function(a,c){var d,e,f,i=this,j=function(a){return a.codec},k=i.adapter.getMediaInfoForType(c,p,a);if("text"===a&&(j=function(a){return d=a.mimeType}),null!==k){var l,m=j.call(i,k),n=null;if(m===d)try{n=i.sourceBufferExt.createSourceBuffer(b,k)}catch(o){i.errHandler.mediaSourceError("Error creating "+a+" source buffer.")}else if(e=m,i.debug.log(a+" codec: "+e),g[a]=k,l=k.contentProtection,l&&!i.capabilities.supportsMediaKeys())i.errHandler.capabilityError("mediakeys");else if(i.capabilities.supportsCodec(i.videoModel.getElement(),e))try{n=i.sourceBufferExt.createSourceBuffer(b,k)}catch(o){i.errHandler.mediaSourceError("Error creating "+a+" source buffer.")}else{var r=a+"Codec ("+e+") is not supported.";i.errHandler.manifestError(r,"codec",c),i.debug.log(r)}null===n?i.debug.log("No buffer was created, skipping "+a+" data."):(f=i.system.getObject("streamProcessor"),h.push(f),f.initialize(d||a,n,i.videoModel,i.fragmentController,i.playbackController,b,i,q),f.setMediaInfo(k),i.adapter.updateData(f))}else i.debug.log("No "+a+" data.")},B=function(){var b,c=this;q=c.system.getObject("eventController"),q.initialize(c.videoModel),b=c.adapter.getEventsFor(p),q.addInlineEvents(b),A.call(c,"video",a),A.call(c,"audio",a),A.call(c,"text",a)},C=function(){var a,c,d=this;a=p.manifestInfo.duration,c=d.mediaSourceExt.setDuration(b,a),d.debug.log("Duration successfully set to: "+c),j=!0,F.call(d)},D=function(){this.debug.log("element loaded!"),k=!0,E.call(this)},E=function(){j&&k&&0===p.index&&(q.start(),i&&r.call(this))},F=function(){var a=this,b=h.length,c=0;if(j){for(c;b>c;c+=1)if(h[c].isUpdating())return;o=!1,a.notify(a.eventList.ENAME_STREAM_UPDATED)}},G=function(a,b){var c=b.code,d="";if(-1!==c){switch(c){case 1:d="MEDIA_ERR_ABORTED";break;case 2:d="MEDIA_ERR_NETWORK";break;case 3:d="MEDIA_ERR_DECODE";break;case 4:d="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:d="MEDIA_ERR_ENCRYPTED"}l=!0,this.debug.log("Video Element Error: "+d),this.debug.log(b),this.errHandler.mediaSourceError(d),this.reset()}},H=function(c){var d,e=this,f=function(c){if(b=c,B.call(e),0===h.length){var d="No streams to play.";e.errHandler.manifestError(d,"nostreams",a),e.debug.log(d)}else e.liveEdgeFinder.initialize(h[0]),e.liveEdgeFinder.subscribe(e.liveEdgeFinder.eventList.ENAME_LIVE_EDGE_FOUND,e.playbackController),C.call(e),E.call(e)};a=c,d=e.mediaSourceExt.createMediaSource(),y.call(e,d,f)},I=function(){var a=L(),c=a.length,d=0;for(d;c>d;d+=1)if(!a[d].isBufferingCompleted())return;b&&this.mediaSourceExt.signalEndOfStream(b)},J=function(){F.call(this)},K=function(a,b,c){c&&(s.call(this),this.debug.log(c),this.errHandler.mediaKeyMessageError(c))},L=function(){var a,b,c=[],d=0,e=h.length;for(d;e>d;d+=1)b=h[d],a=b.getType(),("audio"===a||"video"===a)&&c.push(b);return c},M=function(b){var c,d,e,f=this,g=h.length,i=0;for(o=!0,a=f.manifestModel.getValue(),p=b,f.debug.log("Manifest updated... set new data on buffers."),q&&(d=f.adapter.getEventsFor(p),q.addInlineEvents(d)),i;g>i;i+=1)e=h[i],c=f.adapter.getMediaInfoForType(a,p,e.getType()),e.setMediaInfo(c),this.adapter.updateData(e)};return{system:void 0,manifestModel:void 0,mediaSourceExt:void 0,sourceBufferExt:void 0,adapter:void 0,fragmentController:void 0,playbackController:void 0,protectionModel:void 0,protectionController:void 0,protectionExt:void 0,capabilities:void 0,debug:void 0,errHandler:void 0,liveEdgeFinder:void 0,abrController:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_STREAM_UPDATED:"streamUpdated"},setup:function(){this.bufferingCompleted=I,this.dataUpdateCompleted=J,this.playbackError=G,this.playbackMetaDataLoaded=D,this.keySystemUpdateCompleted=K},load:function(a){H.call(this,a)},setVideoModel:function(a){this.videoModel=a},initProtection:function(){c=u.bind(this),d=v.bind(this),e=w.bind(this),f=x.bind(this),this.protectionModel=this.system.getObject("protectionModel"),this.protectionModel.init(this.getVideoModel()),this.protectionController=this.system.getObject("protectionController"),this.protectionController.init(this.videoModel,this.protectionModel),this.protectionModel.listenToNeedKey(c),this.protectionModel.listenToKeyMessage(d),this.protectionModel.listenToKeyError(f),this.protectionModel.listenToKeyAdded(e),this.protectionExt.subscribe(this.protectionExt.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,this.protectionModel),this.protectionExt.subscribe(this.protectionExt.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,this)},getVideoModel:function(){return this.videoModel},setAutoPlay:function(a){i=a},getAutoPlay:function(){return i},reset:function(){s.call(this),z.call(this),this.protectionController&&this.protectionController.teardownKeySystem(m),this.protectionModel&&this.protectionExt.unsubscribe(this.protectionExt.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,this.protectionModel),this.protectionExt.unsubscribe(this.protectionExt.eventList.ENAME_KEY_SYSTEM_UPDATE_COMPLETED,this),this.protectionController=void 0,this.protectionModel=void 0,this.fragmentController=void 0,this.playbackController.unsubscribe(this.playbackController.eventList.ENAME_PLAYBACK_ERROR,this),this.playbackController.unsubscribe(this.playbackController.eventList.ENAME_PLAYBACK_METADATA_LOADED,this),this.playbackController.reset(),this.liveEdgeFinder.abortSearch(),this.liveEdgeFinder.unsubscribe(this.liveEdgeFinder.eventList.ENAME_LIVE_EDGE_FOUND,this.playbackController),k=!1},getDuration:function(){return p.duration},getStartTime:function(){return p.start},getStreamIndex:function(){return p.index},getId:function(){return p.id},setStreamInfo:function(a){p=a},getStreamInfo:function(){return p},startEventController:function(){q.start()},resetEventController:function(){q.reset()},setPlaybackController:function(a){this.playbackController=a,a.initialize(p,this.videoModel)},getPlaybackController:function(){return this.playbackController},isUpdating:function(){return o},updateData:M,play:r,seek:t,pause:s}},MediaPlayer.dependencies.Stream.prototype={constructor:MediaPlayer.dependencies.Stream},MediaPlayer.dependencies.StreamController=function(){"use strict";var a,b=[],c=6,d=.2,e=!0,f=!1,g=function(){a.play()},h=function(){a.pause()},i=function(b){a.seek(b)},j=function(a,b){var c=a.getVideoModel().getElement(),d=b.getVideoModel().getElement();d.parentNode||c.parentNode.insertBefore(d,c),c.style.width="0px",d.style.width="100%",m(c,d),l.call(this,a),k.call(this,b)},k=function(a){var b=a.getPlaybackController();b.subscribe(b.eventList.ENAME_PLAYBACK_STARTED,this.manifestUpdater),b.subscribe(b.eventList.ENAME_PLAYBACK_PAUSED,this.manifestUpdater),b.subscribe(b.eventList.ENAME_PLAYBACK_SEEKING,this),b.subscribe(b.eventList.ENAME_PLAYBACK_TIME_UPDATED,this),b.subscribe(b.eventList.ENAME_PLAYBACK_PROGRESS,this)},l=function(a){var b=this,c=a.getPlaybackController();setTimeout(function(){c.unsubscribe(c.eventList.ENAME_PLAYBACK_STARTED,b.manifestUpdater),c.unsubscribe(c.eventList.ENAME_PLAYBACK_PAUSED,b.manifestUpdater),c.unsubscribe(c.eventList.ENAME_PLAYBACK_SEEKING,b),c.unsubscribe(c.eventList.ENAME_PLAYBACK_TIME_UPDATED,b),c.unsubscribe(c.eventList.ENAME_PLAYBACK_PROGRESS,b)},1)},m=function(a,b){["controls","loop","muted","volume"].forEach(function(c){b[c]=a[c]})},n=function(a,b,d){!d||d>=c||q()},o=function(b,c){var e=this;e.metricsModel.addDroppedFrames("video",e.videoExt.getPlaybackQuality(a.getVideoModel().getElement())),r()&&(a.getVideoModel().getElement().seeking||d>c&&v.call(this,a,r()))},p=function(b,c){var d=s(c);d&&d!==a&&v.call(this,a,d,c)},q=function(){var a=r();a&&a.seek(a.getStartTime())},r=function(){var c=a.getStreamIndex()+1;return c<b.length?b[c]:null},s=function(a){var c=0,d=null,e=b.length;e>0&&(c+=b[0].getStartTime());for(var f=0;e>f;f++)if(d=b[f],c+=d.getDuration(),c>a)return d;return null},t=function(){var a=this.system.getObject("videoModel"),b=document.createElement("video");return a.setElement(b),a},u=function(a){a.parentNode&&a.parentNode.removeChild(a)},v=function(b,c,d){!f&&b&&c&&b!==c&&(f=!0,b.pause(),a=c,j.call(this,b,c),i(d?b.getPlaybackController().getTime():c.getStartTime()),g(),b.resetEventController(),a.startEventController(),f=!1)},w=function(){var c,d,f,g,h,i,j,l,m=this,n=m.manifestModel.getValue(),o=m.metricsModel.getMetricsFor("stream"),p=m.metricsExt.getCurrentManifestUpdate(o);if(n){j=m.adapter.getStreamsInfo(n);try{if(0===j.length)throw new Error("There are no streams");for(m.metricsModel.updateManifestUpdateInfo(p,{currentTime:m.videoModel.getCurrentTime(),buffered:m.videoModel.getElement().buffered,presentationStartTime:j[0].start,clientTimeOffset:m.timelineConverter.getClientTimeOffset()}),h=0,f=j.length;f>h;h+=1){for(d=j[h],i=0,g=b.length;g>i;i+=1)b[i].getId()===d.id&&(l=b[i],l.updateData(d));l||(l=m.system.getObject("stream"),c=m.system.getObject("playbackController"),l.setStreamInfo(d),l.setVideoModel(0===h?m.videoModel:t.call(m)),l.setPlaybackController(c),c.subscribe(c.eventList.ENAME_PLAYBACK_ERROR,l),c.subscribe(c.eventList.ENAME_PLAYBACK_METADATA_LOADED,l),l.initProtection(),l.setAutoPlay(e),l.load(n),l.subscribe(l.eventList.ENAME_STREAM_UPDATED,m),b.push(l)),m.metricsModel.addManifestUpdateStreamInfo(p,d.id,d.index,d.start,d.duration),l=null}a||(a=b[0],k.call(m,a),a.subscribe(a.eventList.ENAME_STREAM_UPDATED,this.liveEdgeFinder))}catch(q){m.errHandler.manifestError(q.message,"nostreamscomposed",m.manifestModel.getValue()),m.reset()}}},x=function(){var a=this,c=b.length,d=0;for(d;c>d;d+=1)if(b[d].isUpdating())return;a.notify(a.eventList.ENAME_STREAMS_COMPOSED)},y=function(a,b,c){c?this.reset():(this.manifestModel.setValue(b),this.debug.log("Manifest has loaded."),w.call(this))};return{system:void 0,videoModel:void 0,manifestLoader:void 0,manifestUpdater:void 0,manifestModel:void 0,adapter:void 0,debug:void 0,metricsModel:void 0,metricsExt:void 0,videoExt:void 0,liveEdgeFinder:void 0,timelineConverter:void 0,errHandler:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_STREAMS_COMPOSED:"streamsComposed"},setup:function(){this.manifestLoaded=y,this.streamUpdated=x,this.playbackSeeking=p,this.playbackProgress=n,this.playbackTimeUpdated=o},setAutoPlay:function(a){e=a},getAutoPlay:function(){return e},getVideoModel:function(){return this.videoModel},setVideoModel:function(a){this.videoModel=a},load:function(a){this.manifestLoader.load(a)},reset:function(){a&&l.call(this,a);for(var c=0,d=b.length;d>c;c++){var e=b[c];e.unsubscribe(e.eventList.ENAME_STREAM_UPDATED,this),e.reset(),e!==a&&u(e.getVideoModel().getElement())}b=[],this.manifestUpdater.stop(),this.metricsModel.clearAllCurrentMetrics(),this.manifestModel.setValue(null),this.timelineConverter.reset(),this.adapter.reset(),f=!1,a=null},play:g,seek:i,pause:h}},MediaPlayer.dependencies.StreamController.prototype={constructor:MediaPlayer.dependencies.StreamController},MediaPlayer.dependencies.StreamProcessor=function(){"use strict";var a,b,c,d,e,f=function(a){var b=this,c="video"===a||"audio"===a?"bufferController":"textController";return b.system.getObject(c)};return{system:void 0,indexHandler:void 0,liveEdgeFinder:void 0,timelineConverter:void 0,eventList:void 0,abrController:void 0,baseURLExt:void 0,adapter:void 0,initialize:function(c,g,h,i,j,k,l,m){var n,o=this,p=o.system.getObject("trackController"),q=o.system.getObject("scheduleController"),r=o.liveEdgeFinder,s=o.abrController,t=o.indexHandler,u=o.baseURLExt,v=this.system.getObject("fragmentLoader"),w=f.call(o,c);b=l,d=c,e=m,a=b.getStreamInfo().manifestInfo.isDynamic,o.bufferController=w,o.playbackController=j,o.scheduleController=q,o.trackController=p,o.videoModel=h,o.fragmentController=i,o.fragmentLoader=v,p.subscribe(p.eventList.ENAME_DATA_UPDATE_COMPLETED,w),i.subscribe(i.eventList.ENAME_INIT_FRAGMENT_LOADED,w),w.subscribe(w.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,q),("video"===d||"audio"===d)&&(s.subscribe(s.eventList.ENAME_QUALITY_CHANGED,w),s.subscribe(s.eventList.ENAME_QUALITY_CHANGED,p),s.subscribe(s.eventList.ENAME_QUALITY_CHANGED,q),r.subscribe(r.eventList.ENAME_LIVE_EDGE_FOUND,this.timelineConverter),r.subscribe(r.eventList.ENAME_LIVE_EDGE_FOUND,p),r.subscribe(r.eventList.ENAME_LIVE_EDGE_FOUND,q),p.subscribe(p.eventList.ENAME_DATA_UPDATE_STARTED,q),p.subscribe(p.eventList.ENAME_DATA_UPDATE_COMPLETED,q),p.subscribe(p.eventList.ENAME_DATA_UPDATE_COMPLETED,s),p.subscribe(p.eventList.ENAME_DATA_UPDATE_COMPLETED,b),j.streamProcessor||(j.streamProcessor=o,p.subscribe(p.eventList.ENAME_DATA_UPDATE_COMPLETED,j)),i.subscribe(i.eventList.ENAME_MEDIA_FRAGMENT_LOADED,w),i.subscribe(i.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,q),i.subscribe(i.eventList.ENAME_STREAM_COMPLETED,q),i.subscribe(i.eventList.ENAME_STREAM_COMPLETED,w),i.subscribe(i.eventList.ENAME_STREAM_COMPLETED,q.scheduleRulesCollection.bufferLevelRule),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,h),w.subscribe(w.eventList.ENAME_BUFFER_CLEARED,q),w.subscribe(w.eventList.ENAME_BYTES_APPENDED,q),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_UPDATED,q),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_UPDATED,p),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,q),w.subscribe(w.eventList.ENAME_INIT_REQUESTED,q),w.subscribe(w.eventList.ENAME_BUFFERING_COMPLETED,b),w.subscribe(w.eventList.ENAME_QUOTA_EXCEEDED,q),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_OUTRUN,q.scheduleRulesCollection.bufferLevelRule),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_BALANCED,q.scheduleRulesCollection.bufferLevelRule),j.subscribe(j.eventList.ENAME_PLAYBACK_PROGRESS,w),j.subscribe(j.eventList.ENAME_PLAYBACK_TIME_UPDATED,w),j.subscribe(j.eventList.ENAME_PLAYBACK_RATE_CHANGED,w),j.subscribe(j.eventList.ENAME_PLAYBACK_RATE_CHANGED,q),j.subscribe(j.eventList.ENAME_PLAYBACK_SEEKING,w),j.subscribe(j.eventList.ENAME_PLAYBACK_SEEKING,q),j.subscribe(j.eventList.ENAME_PLAYBACK_STARTED,q),j.subscribe(j.eventList.ENAME_PLAYBACK_SEEKING,q.scheduleRulesCollection.playbackTimeRule),a&&j.subscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,p),j.subscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,w),j.subscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,q),u.subscribe(u.eventList.ENAME_INITIALIZATION_LOADED,t),u.subscribe(u.eventList.ENAME_SEGMENTS_LOADED,t)),t.initialize(this),w.initialize(d,g,k,o),q.initialize(d,this),n=this.getFragmentModel(),n.setLoader(v),n.subscribe(n.eventList.ENAME_FRAGMENT_LOADING_STARTED,i),n.subscribe(n.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,i),n.subscribe(n.eventList.ENAME_STREAM_COMPLETED,i),n.subscribe(n.eventList.ENAME_FRAGMENT_LOADING_FAILED,q),v.subscribe(v.eventList.ENAME_LOADING_COMPLETED,n),("video"===d||"audio"===d)&&(w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_OUTRUN,n),w.subscribe(w.eventList.ENAME_BUFFER_LEVEL_BALANCED,n),w.subscribe(w.eventList.ENAME_BYTES_REJECTED,n)),p.initialize(this)},isUpdating:function(){return this.trackController.isUpdating()},getType:function(){return d},getFragmentModel:function(){return this.scheduleController.getFragmentModel()},getStreamInfo:function(){return b.getStreamInfo()},setMediaInfo:function(a){c=a},getMediaInfo:function(){return c},getEventController:function(){return e},start:function(){this.scheduleController.start()},stop:function(){this.scheduleController.stop()},getCurrentTrack:function(){return this.adapter.getCurrentTrackInfo(this.trackController)},getTrackForQuality:function(a){return this.adapter.getTrackInfoForQuality(this.trackController,a)},isBufferingCompleted:function(){return this.bufferController.isBufferingCompleted()},isDynamic:function(){return a},reset:function(a){var c=this,d=c.bufferController,e=c.trackController,f=c.scheduleController,g=c.liveEdgeFinder,h=c.fragmentController,i=c.abrController,j=c.playbackController,k=this.indexHandler,l=this.baseURLExt,m=this.getFragmentModel(),n=this.fragmentLoader,o=c.videoModel;i.unsubscribe(i.eventList.ENAME_QUALITY_CHANGED,d),i.unsubscribe(i.eventList.ENAME_QUALITY_CHANGED,e),i.unsubscribe(i.eventList.ENAME_QUALITY_CHANGED,f),g.unsubscribe(g.eventList.ENAME_LIVE_EDGE_FOUND,this.timelineConverter),g.unsubscribe(g.eventList.ENAME_LIVE_EDGE_FOUND,f),g.unsubscribe(g.eventList.ENAME_LIVE_EDGE_FOUND,e),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_STARTED,f),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_COMPLETED,d),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_COMPLETED,f),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_COMPLETED,i),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_COMPLETED,b),e.unsubscribe(e.eventList.ENAME_DATA_UPDATE_COMPLETED,j),h.unsubscribe(h.eventList.ENAME_INIT_FRAGMENT_LOADED,d),h.unsubscribe(h.eventList.ENAME_MEDIA_FRAGMENT_LOADED,d),h.unsubscribe(h.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,f),h.unsubscribe(h.eventList.ENAME_STREAM_COMPLETED,f),h.unsubscribe(h.eventList.ENAME_STREAM_COMPLETED,d),h.unsubscribe(h.eventList.ENAME_STREAM_COMPLETED,f.scheduleRulesCollection.bufferLevelRule),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,o),d.unsubscribe(d.eventList.ENAME_BUFFER_CLEARED,f),d.unsubscribe(d.eventList.ENAME_BYTES_APPENDED,f),d.unsubscribe(d.eventList.ENAME_BYTES_REJECTED,f),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_UPDATED,f),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_UPDATED,e),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,f),d.unsubscribe(d.eventList.ENAME_INIT_REQUESTED,f),d.unsubscribe(d.eventList.ENAME_BUFFERING_COMPLETED,b),d.unsubscribe(d.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,f),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_OUTRUN,f.scheduleRulesCollection.bufferLevelRule),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_BALANCED,f.scheduleRulesCollection.bufferLevelRule),j.unsubscribe(j.eventList.ENAME_PLAYBACK_PROGRESS,d),j.unsubscribe(j.eventList.ENAME_PLAYBACK_TIME_UPDATED,d),j.unsubscribe(j.eventList.ENAME_PLAYBACK_RATE_CHANGED,d),j.unsubscribe(j.eventList.ENAME_PLAYBACK_RATE_CHANGED,f),j.unsubscribe(j.eventList.ENAME_PLAYBACK_SEEKING,d),j.unsubscribe(j.eventList.ENAME_PLAYBACK_SEEKING,f),j.unsubscribe(j.eventList.ENAME_PLAYBACK_STARTED,f),j.unsubscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,e),j.unsubscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,d),j.unsubscribe(j.eventList.ENAME_WALLCLOCK_TIME_UPDATED,f),j.unsubscribe(j.eventList.ENAME_PLAYBACK_SEEKING,f.scheduleRulesCollection.playbackTimeRule),l.unsubscribe(l.eventList.ENAME_INITIALIZATION_LOADED,k),l.unsubscribe(l.eventList.ENAME_SEGMENTS_LOADED,k),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_OUTRUN,m),d.unsubscribe(d.eventList.ENAME_BUFFER_LEVEL_BALANCED,m),d.unsubscribe(d.eventList.ENAME_BYTES_REJECTED,m),m.unsubscribe(m.eventList.ENAME_FRAGMENT_LOADING_STARTED,h),m.unsubscribe(m.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,h),m.unsubscribe(m.eventList.ENAME_STREAM_COMPLETED,h),m.unsubscribe(m.eventList.ENAME_FRAGMENT_LOADING_FAILED,f),n.unsubscribe(n.eventList.ENAME_LOADING_COMPLETED,m),h.resetModel(m),k.reset(),this.bufferController.reset(a),this.scheduleController.reset(),this.bufferController=null,this.scheduleController=null,this.trackController=null,this.videoModel=null,this.fragmentController=null}}},MediaPlayer.dependencies.StreamProcessor.prototype={constructor:MediaPlayer.dependencies.StreamProcessor},MediaPlayer.utils.TokenAuthentication=function(){"use strict";var a={type:MediaPlayer.utils.TokenAuthentication.TYPE_QUERY};return{debug:void 0,getTokenAuthentication:function(){return a},setTokenAuthentication:function(b){a=b},checkRequestHeaderForToken:function(b){void 0!==a.name&&null!==b.getResponseHeader(a.name)&&(a.token=b.getResponseHeader(a.name),this.debug.log(a.name+" received: "+a.token))},addTokenAsQueryArg:function(b){if(void 0!==a.name&&void 0!==a.token&&a.type===MediaPlayer.utils.TokenAuthentication.TYPE_QUERY){var c=-1===b.indexOf("?")?"?":"&";b+=c+a.name+"="+a.token,this.debug.log(a.name+" is being appended on the request url with a value of : "+a.token)}return b},setTokenInRequestHeader:function(b){return a.type===MediaPlayer.utils.TokenAuthentication.TYPE_HEADER&&(b.setRequestHeader(a.name,a.token),this.debug.log(a.name+" is being set in the request header with a value of : "+a.token)),b}}},MediaPlayer.utils.TokenAuthentication.TYPE_QUERY="query",MediaPlayer.utils.TokenAuthentication.TYPE_HEADER="header",MediaPlayer.models.URIQueryAndFragmentModel=function(){"use strict";var a=new MediaPlayer.vo.URIFragmentData,b=[],c=function(c){function d(a,b,c,d){var e=d[0].split(/[=]/);return d.push({key:e[0],value:e[1]}),d.shift(),d}function e(a,c,d){return c>0&&(j&&0===b.length?b=d[c].split(/[&]/):k&&(g=d[c].split(/[&]/))),d}if(!c)return null;var f,g=[],h=new RegExp(/[?]/),i=new RegExp(/[#]/),j=h.test(c),k=i.test(c);return f=c.split(/[?#]/).map(e),b.length>0&&(b=b.reduce(d,null)),g.length>0&&(g=g.reduce(d,null),g.forEach(function(b){a[b.key]=b.value})),c};return{parseURI:c,getURIFragmentData:a,getURIQueryData:b,reset:function(){a=new MediaPlayer.vo.URIFragmentData,b=[]}}},MediaPlayer.models.URIQueryAndFragmentModel.prototype={constructor:MediaPlayer.models.URIQueryAndFragmentModel},MediaPlayer.models.VideoModel=function(){"use strict";var a,b=[],c=function(){return b.length>0},d=function(c){null!==c&&(a.playbackRate=0,b[c]!==!0&&(b.push(c),b[c]=!0))},e=function(d){if(null!==d){b[d]=!1;var e=b.indexOf(d);-1!==e&&b.splice(e,1),c()===!1&&(a.playbackRate=1)}},f=function(a,b){b?d(a):e(a)},g=function(a,b){var c=a.streamProcessor.getType();f.call(this,c,!b)};return{system:void 0,setup:function(){this.bufferLevelStateChanged=g},play:function(){a.play()},pause:function(){a.pause()},isPaused:function(){return a.paused},getPlaybackRate:function(){return a.playbackRate},setPlaybackRate:function(b){a.playbackRate=b},getCurrentTime:function(){return a.currentTime},setCurrentTime:function(b){a.currentTime!=b&&(a.currentTime=b)},listen:function(b,c){a.addEventListener(b,c,!1)},unlisten:function(b,c){a.removeEventListener(b,c,!1)},getElement:function(){return a},setElement:function(b){a=b},setSource:function(b){a.src=b}}},MediaPlayer.models.VideoModel.prototype={constructor:MediaPlayer.models.VideoModel},MediaPlayer.dependencies.VideoModelExtensions=function(){"use strict";return{getPlaybackQuality:function(a){var b="webkitDroppedFrameCount"in a,c="getVideoPlaybackQuality"in a,d=null;return c?d=a.getVideoPlaybackQuality():b&&(d={droppedVideoFrames:a.webkitDroppedFrameCount,creationTime:new Date}),d}}},MediaPlayer.dependencies.VideoModelExtensions.prototype={constructor:MediaPlayer.dependencies.VideoModelExtensions},MediaPlayer.utils.TTMLParser=function(){"use strict";var a,b=3600,c=60,d=/^(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])((\.[0-9][0-9][0-9])|(:[0-9][0-9]))$/,e=function(e){var f,g,h,i=d.test(e);if(!i)return 0/0;if(f=e.split(":"),g=parseFloat(f[0])*b+parseFloat(f[1])*c+parseFloat(f[2]),f[3]){if(h=a.tt.frameRate,!h||isNaN(h))return 0/0;g+=parseFloat(f[3])/h}return g},f=function(){var b=!1,c=a.hasOwnProperty("tt"),d=c?a.tt.hasOwnProperty("head"):!1,e=d?a.tt.head.hasOwnProperty("layout"):!1,f=d?a.tt.head.hasOwnProperty("styling"):!1,g=c?a.tt.hasOwnProperty("body"):!1,h=d?a.tt.head.hasOwnProperty("profile"):!1;return c&&d&&e&&f&&g&&(b=!0),b&&(b=h&&"http://www.w3.org/ns/ttml/profile/sdp-us"===a.tt.head.profile.use),b},g=function(a,b){var c=Object.keys(a).filter(function(c){return"xmlns"===c.split(":")[0]&&a[c]===b}).map(function(a){return a.split(":")[1]});return 1!=c.length?null:c[0]},h=function(b){var c,d,h,i,j,k,l,m=[],n=new X2JS([],"",!1);if(a=n.xml_str2json(b),!f())throw c="TTML document has incorrect structure";if(k=g(a.tt,"http://www.w3.org/ns/ttml#parameter"),a.tt.hasOwnProperty(k+":frameRate")&&(a.tt.frameRate=parseInt(a.tt[k+":frameRate"],10)),d=a.tt.body.div_asArray[0].p_asArray,!d||0===d.length)throw c="TTML document does not contain any cues";for(l=0;l<d.length;l+=1){if(h=d[l],i=e(h.begin),j=e(h.end),isNaN(i)||isNaN(j))throw c="TTML document has incorrect timing value";m.push({start:i,end:j,data:h.__text})}return m};return{parse:h}},MediaPlayer.dependencies.TextController=function(){var a,b,c,d=!1,e=function(){d||(b.hasOwnProperty("initialize")&&b.initialize(c,this),d=!0),this.notify(this.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,0)},f=function(a,c,d){var e=this;c===e.streamProcessor.getFragmentModel()&&null!==d&&e.sourceBufferExt.append(b,d,e.videoModel)};return{sourceBufferExt:void 0,debug:void 0,system:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,eventList:{ENAME_CLOSED_CAPTIONING_REQUESTED:"closedCaptioningRequested"},setup:function(){this.dataUpdateCompleted=e,this.initFragmentLoaded=f},initialize:function(a,b,d,e){var f=this;c=a,f.setBuffer(b),f.setMediaSource(d),f.videoModel=e.videoModel,f.trackController=e.trackController,f.streamProcessor=e},getBuffer:function(){return b},setBuffer:function(a){b=a},setMediaSource:function(b){a=b},reset:function(c){c||(this.sourceBufferExt.abort(a,b),this.sourceBufferExt.removeSourceBuffer(a,b))}}},MediaPlayer.dependencies.TextController.prototype={constructor:MediaPlayer.dependencies.TextController},MediaPlayer.dependencies.TextSourceBuffer=function(){var a,b;return{system:void 0,eventBus:void 0,errHandler:void 0,initialize:function(c,d){b=c,this.videoModel=d.videoModel,a=d.streamProcessor.getCurrentTrack().mediaInfo},append:function(b){var c,d,e,f=this,g=String.fromCharCode.apply(null,new Uint16Array(b));try{c=f.getParser().parse(g),d=a.id,e=a.lang,f.getTextTrackExtensions().addTextTrack(f.videoModel.getElement(),c,d,e,!0),f.eventBus.dispatchEvent({type:"updateend"})}catch(h){f.errHandler.closedCaptionsError(h,"parse",g)}},abort:function(){this.getTextTrackExtensions().deleteCues(this.videoModel.getElement())},getParser:function(){var a;return"text/vtt"===b?a=this.system.getObject("vttParser"):"application/ttml+xml"===b&&(a=this.system.getObject("ttmlParser")),a},getTextTrackExtensions:function(){return this.system.getObject("textTrackExtensions")},addEventListener:function(a,b,c){this.eventBus.addEventListener(a,b,c)},removeEventListener:function(a,b,c){this.eventBus.removeEventListener(a,b,c)}}},MediaPlayer.dependencies.TextSourceBuffer.prototype={constructor:MediaPlayer.dependencies.TextSourceBuffer},MediaPlayer.utils.TextTrackExtensions=function(){"use strict";var a;return{setup:function(){a=window.VTTCue||window.TextTrackCue},addTextTrack:function(b,c,d,e,f){var g=b.addTextTrack("captions",d,e);g.default=f,g.mode="showing";for(var h in c){var i=c[h];g.addCue(new a(i.start,i.end,i.data))}return g},deleteCues:function(a){for(var b=0,c=!1;!c;){if(null!==a.textTracks[b].cues){c=!0;break}b++}var d=a.textTracks[b],e=d.cues,f=e.length-1;for(b=f;b>=0;b--)d.removeCue(e[b]);d.mode="disabled",d.default=!1}}},MediaPlayer.utils.VTTParser=function(){"use strict";var a=function(a){var b=a.split(":"),c=b.length-1;return a=60*parseInt(b[c-1],10)+parseFloat(b[c],10),2===c&&(a+=3600*parseInt(b[0],10)),a};return{parse:function(b){var c,d=/(?:\r\n|\r|\n)/gm,e=/-->/,f=/(^[\s]+|[\s]+$)/g,g=[];b=b.split(d),c=b.length;for(var h=0;c>h;h++){var i=b[h];if(i.length>0&&"WEBVTT"!==i&&i.match(e)){var j=i.split(e),k=b[h+1];g.push({start:a(j[0].replace(f,"")),end:a(j[1].replace(f,"")),data:k})}}return g}}},MediaPlayer.rules.ABRRulesCollection=function(){"use strict";var a=[];return{downloadRatioRule:void 0,insufficientBufferRule:void 0,limitSwitchesRule:void 0,getRules:function(b){switch(b){case MediaPlayer.rules.ABRRulesCollection.prototype.QUALITY_SWITCH_RULES:return a;default:return null}},setup:function(){a.push(this.downloadRatioRule),a.push(this.insufficientBufferRule),a.push(this.limitSwitchesRule)}}},MediaPlayer.rules.ABRRulesCollection.prototype={constructor:MediaPlayer.rules.ABRRulesCollection,QUALITY_SWITCH_RULES:"qualitySwitchRules"},MediaPlayer.rules.DownloadRatioRule=function(){"use strict";var a={},b=function(a,b,c){var d=a.getTrackForQuality(b).bandwidth;return d/c};return{debug:void 0,metricsExt:void 0,metricsModel:void 0,setStreamProcessor:function(b){var c=b.getType(),d=b.getStreamInfo().id;a[d]=a[d]||{},a[d][c]=b},execute:function(c,d){var e,f,g,h,i,j,k,l,m,n,o,p=this,q=c.getStreamInfo().id,r=c.getMediaInfo(),s=r.type,t=c.getCurrentValue(),u=a[q][s],v=p.metricsModel.getReadOnlyMetricsFor(s),w=p.metricsExt.getCurrentHttpRequest(v),x=.75;if(!v)return void d(new MediaPlayer.rules.SwitchRequest);if(null===w)return void d(new MediaPlayer.rules.SwitchRequest);if(f=(w.tfinish.getTime()-w.trequest.getTime())/1e3,e=(w.tfinish.getTime()-w.tresponse.getTime())/1e3,0>=f)return void d(new MediaPlayer.rules.SwitchRequest);if(null===w.mediaduration||void 0===w.mediaduration||w.mediaduration<=0||isNaN(w.mediaduration))return void d(new MediaPlayer.rules.SwitchRequest);if(h=w.mediaduration/f,g=w.mediaduration/e*x,isNaN(g)||isNaN(h))return p.debug.log("The ratios are NaN, bailing."),void d(new MediaPlayer.rules.SwitchRequest);if(isNaN(g))o=new MediaPlayer.rules.SwitchRequest;else if(4>g)t>0?(p.debug.log("We are not at the lowest bitrate, so switch down."),j=u.getTrackForQuality(t-1).bandwidth,l=u.getTrackForQuality(t).bandwidth,i=j/l,i>g?(p.debug.log("Things must be going pretty bad, switch all the way down."),o=new MediaPlayer.rules.SwitchRequest(0)):(p.debug.log("Things could be better, so just switch down one index."),o=new MediaPlayer.rules.SwitchRequest(t-1))):o=new MediaPlayer.rules.SwitchRequest(t);else if(n=r.trackCount-1,n>t)if(k=u.getTrackForQuality(t+1).bandwidth,l=u.getTrackForQuality(t).bandwidth,i=k/l,g>=i)if(g>100)p.debug.log("Tons of bandwidth available, go all the way up."),o=new MediaPlayer.rules.SwitchRequest(n-1);else if(g>10)p.debug.log("Just enough bandwidth available, switch up one."),o=new MediaPlayer.rules.SwitchRequest(t+1);else{for(m=-1;(m+=1)<n&&!(g<b.call(p,u,m,l)););p.debug.log("Calculated ideal new quality index is: "+m),o=new MediaPlayer.rules.SwitchRequest(m)}else o=new MediaPlayer.rules.SwitchRequest;else o=new MediaPlayer.rules.SwitchRequest(n);d(o)},reset:function(){a={}}}},MediaPlayer.rules.DownloadRatioRule.prototype={constructor:MediaPlayer.rules.DownloadRatioRule},MediaPlayer.rules.InsufficientBufferRule=function(){"use strict";var a=0,b=3;return{debug:void 0,metricsModel:void 0,execute:function(c,d){var e,f,g=this,h=c.getMediaInfo().type,i=c.getCurrentValue(),j=g.metricsModel.getReadOnlyMetricsFor(h),k=!1,l=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT;return null===j.PlayList||void 0===j.PlayList||0===j.PlayList.length?void d(new MediaPlayer.rules.SwitchRequest):(e=j.PlayList[j.PlayList.length-1],null===e||void 0===e||0===e.trace.length?void d(new MediaPlayer.rules.SwitchRequest):(f=e.trace[e.trace.length-2],null===f||void 0===f||null===f.stopreason||void 0===f.stopreason?void d(new MediaPlayer.rules.SwitchRequest):(f.stopreason===MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON&&(k=!0,a+=1,g.debug.log("Number of times the buffer has run dry: "+a)),a>b&&(l=MediaPlayer.rules.SwitchRequest.prototype.STRONG,g.debug.log("Apply STRONG to buffer rule.")),void(k?(g.debug.log("The buffer ran dry recently, switch down."),d(new MediaPlayer.rules.SwitchRequest(i-1,l))):a>b?(g.debug.log("Too many dry buffer hits, quit switching bitrates."),d(new MediaPlayer.rules.SwitchRequest(i,l))):d(new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,l))))))}}},MediaPlayer.rules.InsufficientBufferRule.prototype={constructor:MediaPlayer.rules.InsufficientBufferRule},MediaPlayer.rules.LimitSwitchesRule=function(){"use strict";var a=0,b=2e3;return{debug:void 0,metricsModel:void 0,execute:function(c,d){var e,f=this,g=c.getMediaInfo().type,h=c.getCurrentValue(),i=this.metricsModel.getReadOnlyMetricsFor(g),j=c.getManifestInfo(),k=i.RepSwitchList.length-1,l=i.RepSwitchList[k],m=(new Date).getTime();return b=1e3*Math.min(j.minBufferTime,j.maxFragmentDuration),e=m-a,b>e&&m-l.t.getTime()<b?(f.debug.log("Wait some time before allowing another switch."),void d(new MediaPlayer.rules.SwitchRequest(h,MediaPlayer.rules.SwitchRequest.prototype.STRONG))):(a=m,void d(new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.STRONG)))
}}},MediaPlayer.rules.LimitSwitchesRule.prototype={constructor:MediaPlayer.rules.LimitSwitchesRule},MediaPlayer.rules.RulesContext=function(a,b){"use strict";var c=a.getCurrentTrack();return{getStreamInfo:function(){return c.mediaInfo.streamInfo},getMediaInfo:function(){return c.mediaInfo},getTrackInfo:function(){return c},getCurrentValue:function(){return b},getManifestInfo:function(){return c.mediaInfo.streamInfo.manifestInfo}}},MediaPlayer.rules.RulesContext.prototype={constructor:MediaPlayer.rules.RulesContext},MediaPlayer.rules.BufferLevelRule=function(){"use strict";var a={},b={},c={},d=function(a){var b=this.metricsExt.getCurrentHttpRequest(a);return null!==b?(b.tresponse.getTime()-b.trequest.getTime())/1e3:0},e=function(a,b){var c;return c=isNaN(b)||MediaPlayer.dependencies.BufferController.DEFAULT_MIN_BUFFER_TIME<b&&b>a?Math.max(MediaPlayer.dependencies.BufferController.DEFAULT_MIN_BUFFER_TIME,a):a>=b?Math.min(b,MediaPlayer.dependencies.BufferController.DEFAULT_MIN_BUFFER_TIME):Math.min(b,a)},f=function(a,b,c){var f=this,g=c.bufferController.getCriticalBufferLevel(),h=e.call(this,c.bufferController.getMinBufferTime(),b),i=h,j=c.bufferController.bufferMax,k=f.metricsModel.getReadOnlyMetricsFor("video"),l=f.metricsModel.getReadOnlyMetricsFor("audio"),m=b>=MediaPlayer.dependencies.BufferController.LONG_FORM_CONTENT_DURATION_THRESHOLD,n=0;return j===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_MIN?n=h:j===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_INFINITY?n=b:j===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_REQUIRED&&(!a&&f.abrController.isPlayingAtTopQuality()&&(i=m?MediaPlayer.dependencies.BufferController.BUFFER_TIME_AT_TOP_QUALITY_LONG_FORM:MediaPlayer.dependencies.BufferController.BUFFER_TIME_AT_TOP_QUALITY),n=i+Math.max(d.call(f,k),d.call(f,l))),n=Math.min(n,g)},g=function(a,c){return b[a]&&b[a][c]},h=function(b,c){return a[b]&&a[b][c]},i=function(a,c,d){var e=c.getContext().streamProcessor.getStreamInfo().id;b[e]=b[e]||{},b[e][d.mediaType]=!0},j=function(b){var c=b.streamProcessor.getStreamInfo().id;a[c]=a[c]||{},a[c][b.streamProcessor.getType()]=!0},k=function(b){var c=b.streamProcessor.getStreamInfo().id;a[c]=a[c]||{},a[c][b.streamProcessor.getType()]=!1};return{metricsExt:void 0,metricsModel:void 0,abrController:void 0,setup:function(){this.bufferLevelOutrun=j,this.bufferLevelBalanced=k,this.streamCompleted=i},setScheduleController:function(a){var b=a.streamProcessor.getStreamInfo().id;c[b]=c[b]||{},c[b][a.streamProcessor.getType()]=a},execute:function(a,b){var d=a.getStreamInfo(),e=d.id,i=a.getMediaInfo().type;if(h(e,i))return void b(new MediaPlayer.rules.SwitchRequest(0,MediaPlayer.rules.SwitchRequest.prototype.STRONG));var j,k=this.metricsModel.getReadOnlyMetricsFor(i),l=this.metricsExt.getCurrentBufferLevel(k)?this.metricsExt.getCurrentBufferLevel(k).level:0,m=c[e][i],n=m.streamProcessor.getCurrentTrack(),o=m.streamProcessor.isDynamic(),p=this.metricsExt.getCurrentPlaybackRate(k),q=d.duration,r=l/Math.max(p,1),s=n.fragmentDuration,t=m.playbackController.getTime(),u=o?Number.POSITIVE_INFINITY:q-t,v=Math.min(f.call(this,o,q,m),u),w=Math.max(v-r,0);j=Math.ceil(w/s),r>=u&&!g(e,i)&&(j=j||1),b(new MediaPlayer.rules.SwitchRequest(j,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT))},reset:function(){a={},b={},c={}}}},MediaPlayer.rules.BufferLevelRule.prototype={constructor:MediaPlayer.rules.BufferLevelRule},MediaPlayer.rules.LiveEdgeBinarySearchRule=function(){"use strict";var a,b,c=43200,d=0/0,e=null,f=0/0,g=null,h=!1,i=0/0,j=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,k=function(b,c,d,e){var f,h=this;if(null===e)f=h.adapter.generateFragmentRequestForTime(a.streamProcessor,g,b),k.call(h,b,c,d,f);else{var i=function(e,f,g){a.fragmentLoader.unsubscribe(a.fragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,h,i),f?c.call(h,g,b):d.call(h,g,b)};a.fragmentLoader.subscribe(a.fragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,h,i),a.fragmentLoader.checkForExistence(e)}},l=function(c,i){var o,p,q;return h?void n.call(this,!1,i):(q=i-d,o=q>0?d-q:d+Math.abs(q)+f,void(o<e.start&&o>e.end?b(new MediaPlayer.rules.SwitchRequest(null,j)):(p=this.adapter.getFragmentRequestForTime(a.streamProcessor,g,o),k.call(this,o,m,l,p))))},m=function(c,l){var m,o,p=c.startTime,q=this;if(!h){if(!g.fragmentDuration)return void b(new MediaPlayer.rules.SwitchRequest(p,j));if(h=!0,e.end=p+2*f,l===d)return o=l+i,m=q.adapter.getFragmentRequestForTime(a.streamProcessor,g,o),void k.call(q,o,function(){n.call(q,!0,o)},function(){b(new MediaPlayer.rules.SwitchRequest(o,j))},m)}n.call(this,!0,l)},n=function(c,d){var f,h,n;c?e.start=d:e.end=d,f=Math.floor(e.end-e.start)<=i,f?b(new MediaPlayer.rules.SwitchRequest(c?d:d-i,j)):(n=(e.start+e.end)/2,h=this.adapter.getFragmentRequestForTime(a.streamProcessor,g,n),k.call(this,n,m,l,h))};return{metricsExt:void 0,adapter:void 0,setFinder:function(b){a=b},execute:function(h,n){var o,p,q=this;return b=n,g=a.streamProcessor.getCurrentTrack(),i=g.fragmentDuration,p=g.DVRWindow,d=p.end,g.useCalculatedLiveEdgeTime?void b(new MediaPlayer.rules.SwitchRequest(d,j)):(e={start:Math.max(0,d-c),end:d+c},f=Math.floor((p.end-p.start)/2),o=q.adapter.getFragmentRequestForTime(a.streamProcessor,g,d),void k.call(q,d,m,l,o))},reset:function(){d=0/0,e=null,f=0/0,g=null,h=!1,i=0/0,a=null}}},MediaPlayer.rules.LiveEdgeBinarySearchRule.prototype={constructor:MediaPlayer.rules.LiveEdgeBinarySearchRule},MediaPlayer.rules.PendingRequestsRule=function(){"use strict";var a=3,b={};return{metricsExt:void 0,setScheduleController:function(a){var c=a.streamProcessor.getStreamInfo().id;b[c]=b[c]||{},b[c][a.streamProcessor.getType()]=a},execute:function(c,d){var e=c.getMediaInfo().type,f=c.getStreamInfo().id,g=c.getCurrentValue(),h=b[f][e],i=h.getFragmentModel(),j=i.getPendingRequests(),k=i.getLoadingRequests(),l=i.getRejectedRequests(),m=l.length,n=j.length+k.length,o=Math.max(g-n,0);return m>0?void d(new MediaPlayer.rules.SwitchRequest(m,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT)):n>a?void d(new MediaPlayer.rules.SwitchRequest(0,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT)):0===g?void d(new MediaPlayer.rules.SwitchRequest(o,MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE)):void d(new MediaPlayer.rules.SwitchRequest(o,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT))},reset:function(){b={}}}},MediaPlayer.rules.PendingRequestsRule.prototype={constructor:MediaPlayer.rules.PendingRequestsRule},MediaPlayer.rules.PlaybackTimeRule=function(){"use strict";var a={},b={},c=function(b,c){var d=b.getStreamId();a[d]=a[d]||{},a[d].audio=c,a[d].video=c};return{adapter:void 0,sourceBufferExt:void 0,setup:function(){this.playbackSeeking=c},setScheduleController:function(a){var c=a.streamProcessor.getStreamInfo().id;b[c]=b[c]||{},b[c][a.streamProcessor.getType()]=a},execute:function(c,d){var e,f,g,h=c.getMediaInfo().type,i=c.getStreamInfo().id,j=b[i][h],k=b[i][h].streamProcessor,l=k.getCurrentTrack(),m=a[i]?a[i][h]:null,n=m?MediaPlayer.rules.SwitchRequest.prototype.STRONG:MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,o=j.getFragmentModel().getRejectedRequests().shift(),p=!!o&&!m,q=this.adapter.getIndexHandlerTime(k),r=k.playbackController.getTime(),s=o?o.startTime+o.duration:null,t=o&&(s>r&&o.startTime<=q||isNaN(q));if(f=m||(t?o.startTime:q),isNaN(f))return void d(new MediaPlayer.rules.SwitchRequest(null,n));for(a[i]&&(a[i][h]=null),e=this.sourceBufferExt.getBufferRange(k.bufferController.getBuffer(),f),null!==e&&(f=e.end),g=this.adapter.getFragmentRequestForTime(k,l,f,p),t&&g&&g.index!==o.index&&(g=this.adapter.getFragmentRequestForTime(k,l,o.startTime+o.duration/2,p));g&&k.fragmentController.isFragmentLoadedOrPending(j,g);){if("complete"===g.action){g=null,this.adapter.setIndexHandlerTime(k,0/0);break}g=this.adapter.getNextFragmentRequest(k,l)}g&&!t&&this.adapter.setIndexHandlerTime(k,g.startTime+g.duration),d(new MediaPlayer.rules.SwitchRequest(g,n))},reset:function(){a={},b={}}}},MediaPlayer.rules.PlaybackTimeRule.prototype={constructor:MediaPlayer.rules.PlaybackTimeRule},MediaPlayer.rules.RulesController=function(){"use strict";var a={},b=["execute"],c=function(a){return a===this.SCHEDULING_RULE||a===this.ABR_RULE},d=function(a){var c=b.length,d=0;for(d;c>d;d+=1)if(!a.hasOwnProperty(b[d]))return!1;return!0},e=function(a,b){return new MediaPlayer.rules.RulesContext(a,b)},f=function(a){var b=a.execute.bind(a);return a.execute=function(c,d){var e=function(b){d.call(a,new MediaPlayer.rules.SwitchRequest(b.value,b.priority))};b(c,e)},"function"!=typeof a.reset&&(a.reset=function(){}),a},g=function(a,b,c){var e,g,h,i,j,k;for(g in b)if(i=b[g],j=i.length)for(k=0;j>k;k+=1)e=i[k],d.call(this,e)&&(e=f.call(this,e),h=a.getRules(g),c&&(h.length=0),h.push(e))};return{system:void 0,debug:void 0,SCHEDULING_RULE:0,ABR_RULE:1,initialize:function(){a[this.ABR_RULE]=this.system.getObject("abrRulesCollection"),a[this.SCHEDULING_RULE]=this.system.getObject("scheduleRulesCollection")},setRules:function(b,d){c.call(this,b)&&d&&g.call(this,a[b],d,!0)},addRules:function(b,d){c.call(this,b)&&d&&g.call(this,a[b],d,!1)},applyRules:function(a,b,c,f,g){var h,i,j=a.length,k=j,l={},m=e.call(this,b,f),n=function(a){var b,d;a.value!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(l[a.priority]=g(l[a.priority],a.value)),--j||(l[MediaPlayer.rules.SwitchRequest.prototype.WEAK]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(d=MediaPlayer.rules.SwitchRequest.prototype.WEAK,b=l[MediaPlayer.rules.SwitchRequest.prototype.WEAK]),l[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(d=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,b=l[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]),l[MediaPlayer.rules.SwitchRequest.prototype.STRONG]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(d=MediaPlayer.rules.SwitchRequest.prototype.STRONG,b=l[MediaPlayer.rules.SwitchRequest.prototype.STRONG]),d!=MediaPlayer.rules.SwitchRequest.prototype.STRONG&&d!=MediaPlayer.rules.SwitchRequest.prototype.WEAK&&(d=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT),c({value:b||f,confidence:d}))};for(l[MediaPlayer.rules.SwitchRequest.prototype.STRONG]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,l[MediaPlayer.rules.SwitchRequest.prototype.WEAK]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,l[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,i=0;k>i;i+=1)h=a[i],d.call(this,h)?h.execute(m,n):j--},reset:function(){a={}}}},MediaPlayer.rules.RulesController.prototype={constructor:MediaPlayer.rules.RulesController},MediaPlayer.rules.SameTimeRequestRule=function(){"use strict";var a=4,b=function(a,b){var c,e,f,g,h,i=0,j=a.length;for(i;j>i;i+=1)for(f=a[i].getPendingRequests(),d.call(this,f,"index"),g=0,h=f.length;h>g;g++){if(c=f[g],isNaN(c.startTime)&&"complete"!==c.action){e=c;break}c.startTime>b&&(!e||c.startTime<e.startTime)&&(e=c)}return e||c},c=function(a,b){var c,d,e=a.length,f=null;for(d=0;e>d;d+=1)c=a[d].getPendingRequestForTime(b),c&&(!f||c.startTime>f.startTime)&&(f=c);return f},d=function(a,b){var c=function(a,c){return a[b]<c[b]||isNaN(a[b])&&"complete"!==a.action?-1:a[b]>c[b]?1:0};a.sort(c)};return{setFragmentModels:function(a,b){this.fragmentModels=this.fragmentModels||{},this.fragmentModels[b]=a},execute:function(d,e){var f,g,h,i,j,k,l,m,n,o=d.getStreamInfo().id,p=d.getCurrentValue(),q=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,r=this.fragmentModels[o],s=new Date,t=null,u=r?r.length:null,v=!1,w=[];if(!r||!u)return void e(new MediaPlayer.rules.SwitchRequest([],q));if(k=Math.round(100*r[0].getContext().playbackController.getTime())/100,l=c(r,k),j=l||b(r,k)||p,!j)return void e(new MediaPlayer.rules.SwitchRequest([],q));for(i=0;u>i;i+=1)if(g=r[i],f=g.getContext().streamProcessor.getType(),("video"===f||"audio"===f)&&(m=g.getPendingRequests(),n=g.getLoadingRequests().length,!g.getIsPostponed()||isNaN(j.startTime))){if(n>a)return void e(new MediaPlayer.rules.SwitchRequest([],q));if(t=t||(j===l?k:j.startTime),-1===m.indexOf(j)){if(h=g.getPendingRequestForTime(t))w.push(h);else if(h=g.getLoadingRequestForTime(t)||g.getExecutedRequestForTime(t),!h){v=!0;break}}else w.push(j)}return w=w.filter(function(a){return"complete"===a.action||s.getTime()>=a.availabilityStartTime.getTime()}),v?void e(new MediaPlayer.rules.SwitchRequest([],q)):void e(new MediaPlayer.rules.SwitchRequest(w,q))}}},MediaPlayer.rules.SameTimeRequestRule.prototype={constructor:MediaPlayer.rules.SameTimeRequestRule},MediaPlayer.rules.ScheduleRulesCollection=function(){"use strict";var a=[],b=[],c=[],d=[];return{bufferLevelRule:void 0,pendingRequestsRule:void 0,playbackTimeRule:void 0,sameTimeRequestRule:void 0,liveEdgeBinarySearchRule:void 0,getRules:function(e){switch(e){case MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_SCHEDULE_RULES:return a;case MediaPlayer.rules.ScheduleRulesCollection.prototype.NEXT_FRAGMENT_RULES:return d;case MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_EXECUTE_RULES:return b;case MediaPlayer.rules.ScheduleRulesCollection.prototype.LIVE_EDGE_RULES:return c;default:return null}},setup:function(){a.push(this.bufferLevelRule),a.push(this.pendingRequestsRule),d.push(this.playbackTimeRule),b.push(this.sameTimeRequestRule),c.push(this.liveEdgeBinarySearchRule)}}},MediaPlayer.rules.ScheduleRulesCollection.prototype={constructor:MediaPlayer.rules.ScheduleRulesCollection,FRAGMENTS_TO_SCHEDULE_RULES:"fragmentsToScheduleRules",NEXT_FRAGMENT_RULES:"nextFragmentRules",FRAGMENTS_TO_EXECUTE_RULES:"fragmentsToExecuteRules",LIVE_EDGE_RULES:"liveEdgeRules"},MediaPlayer.rules.SwitchRequest=function(a,b){"use strict";this.value=a,this.priority=b,void 0===this.value&&(this.value=999),void 0===this.priority&&(this.priority=.5)},MediaPlayer.rules.SwitchRequest.prototype={constructor:MediaPlayer.rules.SwitchRequest,NO_CHANGE:999,DEFAULT:.5,STRONG:1,WEAK:0},MediaPlayer.vo.FragmentRequest=function(){"use strict";this.action="download",this.startTime=0/0,this.mediaType=null,this.type=null,this.duration=0/0,this.timescale=0/0,this.range=null,this.url=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=0/0,this.index=0/0,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null},MediaPlayer.vo.FragmentRequest.prototype={constructor:MediaPlayer.vo.FragmentRequest,ACTION_DOWNLOAD:"download",ACTION_COMPLETE:"complete"},MediaPlayer.vo.ManifestInfo=function(){"use strict";this.DVRWindowSize=0/0,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=0/0,this.duration=0/0,this.isDynamic=!1,this.maxFragmentDuration=null},MediaPlayer.vo.ManifestInfo.prototype={constructor:MediaPlayer.vo.ManifestInfo},MediaPlayer.vo.MediaInfo=function(){"use strict";this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.trackCount=0,this.lang=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null},MediaPlayer.vo.MediaInfo.prototype={constructor:MediaPlayer.vo.MediaInfo},MediaPlayer.models.MetricsList=function(){"use strict";return{TcpList:[],HttpList:[],RepSwitchList:[],BufferLevel:[],PlayList:[],DroppedFrames:[],SchedulingInfo:[],DVRInfo:[],ManifestUpdate:[]}},MediaPlayer.models.MetricsList.prototype={constructor:MediaPlayer.models.MetricsList},MediaPlayer.vo.StreamInfo=function(){"use strict";this.id=null,this.index=null,this.start=0/0,this.duration=0/0,this.manifestInfo=null},MediaPlayer.vo.StreamInfo.prototype={constructor:MediaPlayer.vo.StreamInfo},MediaPlayer.vo.TrackInfo=function(){"use strict";this.id=null,this.quality=null,this.DVRWindow=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null},MediaPlayer.vo.TrackInfo.prototype={constructor:MediaPlayer.vo.TrackInfo},MediaPlayer.vo.URIFragmentData=function(){"use strict";this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null},MediaPlayer.vo.URIFragmentData.prototype={constructor:MediaPlayer.vo.URIFragmentData},MediaPlayer.vo.metrics.BufferLevel=function(){"use strict";this.t=null,this.level=null},MediaPlayer.vo.metrics.BufferLevel.prototype={constructor:MediaPlayer.vo.metrics.BufferLevel},MediaPlayer.vo.metrics.DVRInfo=function(){"use strict";this.time=null,this.range=null,this.manifestInfo=null},MediaPlayer.vo.metrics.DVRInfo.prototype={constructor:MediaPlayer.vo.metrics.DVRInfo},MediaPlayer.vo.metrics.DroppedFrames=function(){"use strict";this.time=null,this.droppedFrames=null},MediaPlayer.vo.metrics.DroppedFrames.prototype={constructor:MediaPlayer.vo.metrics.DroppedFrames},MediaPlayer.vo.metrics.HTTPRequest=function(){"use strict";this.stream=null,this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.tfinish=null,this.responsecode=null,this.interval=null,this.mediaduration=null,this.trace=[]},MediaPlayer.vo.metrics.HTTPRequest.prototype={constructor:MediaPlayer.vo.metrics.HTTPRequest},MediaPlayer.vo.metrics.HTTPRequest.Trace=function(){"use strict";this.s=null,this.d=null,this.b=[]},MediaPlayer.vo.metrics.HTTPRequest.Trace.prototype={constructor:MediaPlayer.vo.metrics.HTTPRequest.Trace},MediaPlayer.vo.metrics.ManifestUpdate=function(){"use strict";this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.trackInfo=[]},MediaPlayer.vo.metrics.ManifestUpdate.StreamInfo=function(){"use strict";this.id=null,this.index=null,this.start=null,this.duration=null},MediaPlayer.vo.metrics.ManifestUpdate.TrackInfo=function(){"use strict";this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null},MediaPlayer.vo.metrics.ManifestUpdate.prototype={constructor:MediaPlayer.vo.metrics.ManifestUpdate},MediaPlayer.vo.metrics.ManifestUpdate.StreamInfo.prototype={constructor:MediaPlayer.vo.metrics.ManifestUpdate.StreamInfo},MediaPlayer.vo.metrics.ManifestUpdate.TrackInfo.prototype={constructor:MediaPlayer.vo.metrics.ManifestUpdate.TrackInfo},MediaPlayer.vo.metrics.PlayList=function(){"use strict";this.stream=null,this.start=null,this.mstart=null,this.starttype=null,this.trace=[]},MediaPlayer.vo.metrics.PlayList.Trace=function(){"use strict";this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null},MediaPlayer.vo.metrics.PlayList.prototype={constructor:MediaPlayer.vo.metrics.PlayList},MediaPlayer.vo.metrics.PlayList.INITIAL_PLAY_START_REASON="initial_start",MediaPlayer.vo.metrics.PlayList.SEEK_START_REASON="seek",MediaPlayer.vo.metrics.PlayList.Trace.prototype={constructor:MediaPlayer.vo.metrics.PlayList.Trace()},MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON="user_request",MediaPlayer.vo.metrics.PlayList.Trace.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",MediaPlayer.vo.metrics.PlayList.Trace.END_OF_CONTENT_STOP_REASON="end_of_content",MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON="rebuffering",MediaPlayer.vo.metrics.TrackSwitch=function(){"use strict";this.t=null,this.mt=null,this.to=null,this.lto=null},MediaPlayer.vo.metrics.TrackSwitch.prototype={constructor:MediaPlayer.vo.metrics.TrackSwitch},MediaPlayer.vo.metrics.SchedulingInfo=function(){"use strict";this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null},MediaPlayer.vo.metrics.SchedulingInfo.prototype={constructor:MediaPlayer.vo.metrics.SchedulingInfo},MediaPlayer.vo.metrics.SchedulingInfo.PENDING_STATE="pending",MediaPlayer.vo.metrics.SchedulingInfo.LOADING_STATE="loading",MediaPlayer.vo.metrics.SchedulingInfo.EXECUTED_STATE="executed",MediaPlayer.vo.metrics.SchedulingInfo.REJECTED_STATE="rejected",MediaPlayer.vo.metrics.SchedulingInfo.CANCELED_STATE="canceled",MediaPlayer.vo.metrics.SchedulingInfo.FAILED_STATE="failed",MediaPlayer.vo.metrics.TCPConnection=function(){"use strict";this.tcpid=null,this.dest=null,this.topen=null,this.tclose=null,this.tconnect=null},MediaPlayer.vo.metrics.TCPConnection.prototype={constructor:MediaPlayer.vo.metrics.TCPConnection};