function EbmlParser(a){"use strict";this.d=new DataView(a),this.pos=0}function ObjectIron(a){var b;for(b=[],i=0,len=a.length;i<len;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}}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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):a}function g(a){return a.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/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)&&(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}}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=null,p=!1,q=!1,r=!0,s=!1,t=MediaPlayer.dependencies.BufferController.BUFFER_SIZE_REQUIRED,u=function(){return!!e&&!!f},v=function(){if(!p)throw"MediaPlayer not initialized!";if(!this.capabilities.supportsMediaSource())return void this.errHandler.capabilityError("mediasource");if(!e||!f)throw"Missing view or source.";q=!0,g=b.getObject("streamController"),g.subscribe(MediaPlayer.dependencies.StreamController.eventList.ENAME_STREAMS_COMPOSED,i),c.subscribe(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,g),c.subscribe(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,i),g.initialize(),g.setVideoModel(l),g.setAutoPlay(r),g.setProtectionData(o),g.load(f),b.mapValue("scheduleWhilePaused",s),b.mapOutlet("scheduleWhilePaused","stream"),b.mapOutlet("scheduleWhilePaused","scheduleController"),b.mapValue("bufferMax",t),b.mapOutlet("bufferMax","bufferController"),h.initialize()},w=function(){u()&&v.call(this)},x=function(){var a=k.getReadOnlyMetricsFor("video")||k.getReadOnlyMetricsFor("audio");return j.getCurrentDVRInfo(a)},y=function(){return x.call(this).manifestInfo.DVRWindowSize},z=function(a){var b=x.call(this),c=b.range.start+a;return c>b.range.end&&(c=b.range.end),c},A=function(a){l.getElement().currentTime=this.getDVRSeekOffset(a)},B=function(){var a=x.call(this);return null===a?0:this.duration()-(a.range.end-a.time)},C=function(){var a,b=x.call(this);return null===b?0:(a=b.range.end-b.range.start,a<b.manifestInfo.DVRWindowSize?a:b.manifestInfo.DVRWindowSize)},D=function(){var a,b,c=x.call(this);return null===c?0:(a=c.manifestInfo.availableFrom.getTime()/1e3,b=this.time()+(a+c.range.start))},E=function(){var a,b,c=x.call(this);return null===c?0:(a=c.manifestInfo.availableFrom.getTime()/1e3,b=a+c.range.start+this.duration())},F=function(a,b,c){var d=new Date(1e3*a),e=d.toLocaleDateString(b),f=d.toLocaleTimeString(b,{hour12:c});return f+" "+e},G=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())},H=function(a,b,c){b&&void 0!==a&&null!==a&&(c?h.setRules(a,b):h.addRules(a,b))},I=function(){q&&g&&(g.unsubscribe(MediaPlayer.dependencies.StreamController.eventList.ENAME_STREAMS_COMPOSED,i),c.unsubscribe(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,g),c.unsubscribe(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,i),g.reset(),d.reset(),h.reset(),g=null,q=!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,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(){p||(b.injectInto(this),p=!0)},getDebug:function(){return this.debug},getVideoModel:function(){return l},setAutoPlay:function(a){r=a},getAutoPlay:function(){return r},setScheduleWhilePaused:function(a){s=a},getScheduleWhilePaused:function(){return s},setBufferMax:function(a){t=a},getBufferMax:function(){return t},getMetricsExt:function(){return j},getMetricsFor:function(a){var b=k.getReadOnlyMetricsFor(a);return b},getQualityFor:function(a){return d.getQualityFor(a,g.getActiveStreamInfo())},setQualityFor:function(a,b){d.setPlaybackQuality(a,g.getActiveStreamInfo(),b)},getAutoSwitchQuality:function(){return d.getAutoSwitchBitrate()},setAutoSwitchQuality:function(a){d.setAutoSwitchBitrate(a)},setSchedulingRules:function(a){H.call(this,h.SCHEDULING_RULE,a,!0)},addSchedulingRules:function(a){H.call(this,h.SCHEDULING_RULE,a,!1)},setABRRules:function(a){H.call(this,h.ABR_RULE,a,!0)},addABRRules:function(a){H.call(this,h.ABR_RULE,a,!1)},attachView:function(a){if(!p)throw"MediaPlayer not initialized!";e=a,l=null,e&&(l=b.getObject("videoModel"),l.setElement(e)),I.call(this),u.call(this)&&w.call(this)},attachSource:function(a){if(!p)throw"MediaPlayer not initialized!";this.uriQueryFragModel.reset(),f=this.uriQueryFragModel.parseURI(a),I.call(this),u.call(this)&&w.call(this)},attachProtectionData:function(a){o=a},reset:function(){this.attachSource(null),this.attachView(null)},play:v,isReady:u,seek:A,time:B,duration:C,timeAsUTC:D,durationAsUTC:E,getDVRWindowSize:y,getDVRSeekOffset:z,formatUTC:F,convertToTimeCode:G}},MediaPlayer.prototype={constructor:MediaPlayer},MediaPlayer.dependencies={},MediaPlayer.dependencies.protection={},MediaPlayer.utils={},MediaPlayer.models={},MediaPlayer.vo={},MediaPlayer.vo.metrics={},MediaPlayer.vo.protection={},MediaPlayer.rules={},MediaPlayer.di={},MediaPlayer.di.Context=function(){"use strict";var a=function(){var a=document.createElement("video");if(MediaPlayer.models.ProtectionModel_3Feb2014.detect(a))this.system.mapClass("protectionModel",MediaPlayer.models.ProtectionModel_3Feb2014);else if(MediaPlayer.models.ProtectionModel_01b.detect(a))this.system.mapClass("protectionModel",MediaPlayer.models.ProtectionModel_01b);else{var b=this.system.getObject("debug");b.log("No supported version of EME detected on this user agent!"),b.log("Attempts to play encrypted content will fail!")}};return{system:void 0,setup:function(){this.system.autoMapOutlets=!0,this.system.mapSingleton("debug",MediaPlayer.utils.Debug),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.mapSingleton("ksPlayReady",MediaPlayer.dependencies.protection.KeySystem_PlayReady),this.system.mapSingleton("ksWidevine",MediaPlayer.dependencies.protection.KeySystem_Widevine),this.system.mapSingleton("ksClearKey",MediaPlayer.dependencies.protection.KeySystem_ClearKey),this.system.mapSingleton("requestModifierExt",MediaPlayer.dependencies.RequestModifierExtensions),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("videoExt",MediaPlayer.dependencies.VideoModelExtensions),this.system.mapSingleton("protectionExt",MediaPlayer.dependencies.ProtectionExtensions),this.system.mapClass("protectionController",MediaPlayer.dependencies.ProtectionController),this.system.mapClass("playbackController",MediaPlayer.dependencies.PlaybackController),a.call(this),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.mapClass("bufferOccupancyRule",MediaPlayer.rules.BufferOccupancyRule),this.system.mapClass("throughputRule",MediaPlayer.rules.ThroughputRule),this.system.mapSingleton("abrRulesCollection",MediaPlayer.rules.ABRRulesCollection),this.system.mapSingleton("rulesController",MediaPlayer.rules.RulesController),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("liveEdgeBinarySearchRule",MediaPlayer.rules.LiveEdgeBinarySearchRule),this.system.mapClass("liveEdgeWithTimeSynchronizationRule",MediaPlayer.rules.LiveEdgeWithTimeSynchronizationRule),this.system.mapSingleton("synchronizationRulesCollection",MediaPlayer.rules.SynchronizationRulesCollection),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("timeSyncController",MediaPlayer.dependencies.TimeSyncController),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,Webm=function(){"use strict";return{modules:{},dependencies:{},vo:{},di:{}}}(),Webm.di.WebmContext=function(){"use strict";return{system:void 0,setup:function(){Webm.di.WebmContext.prototype.setup.call(this),this.system.mapClass("parser",Dash.dependencies.DashParser),this.system.mapClass("indexHandler",Dash.dependencies.DashHandler),this.system.mapSingleton("baseURLExt",Webm.dependencies.WebmURLExtensions),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)}}},Webm.di.WebmContext.prototype=new MediaPlayer.di.Context,Webm.di.WebmContext.prototype.constructor=Webm.di.WebmContext;var WebM={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"},CueBlockNumber:{tag:21368}}}}},Void:{tag:236,required:!0}};if(EbmlParser.prototype.consumeTag=function(a,b){"use strict";var c,d,e=!0,f=0;if(void 0===b&&(b=!1),a.tag>16777215?(this.d.getUint32(this.pos)!==a.tag&&(e=!1),f=4):a.tag>65535?(c=this.d.getUint16(this.pos),d=this.d.getUint8(this.pos+2),256*c+d!==a.tag&&(e=!1),f=3):a.tag>255?(this.d.getUint16(this.pos)!==a.tag&&(e=!1),f=2):(this.d.getUint8(this.pos)!==a.tag&&(e=!1),f=1),!e&&a.required&&!b)throw"required tag not found";return e&&(this.pos+=f),e},EbmlParser.prototype.consumeTagAndSize=function(a,b){"use strict";var c=this.consumeTag(a,b);return c&&this.getMatroskaCodedNum(),c},EbmlParser.prototype.parseTag=function(a){"use strict";var b;return this.consumeTag(a),b=this.getMatroskaCodedNum(),this[a.parse](b)},EbmlParser.prototype.skipOverElement=function(a,b){"use strict";var c,d=this.consumeTag(a,b);return d&&(c=this.getMatroskaCodedNum(),this.pos+=c),d},EbmlParser.prototype.getMatroskaCodedNum=function(a){"use strict";var b,c=1,d=128,e=8,f=-1,g=0,h=this.d.getUint8(this.pos);for(b=0;e>b;b+=1){if((h&d)===d){g=void 0===a?h&~d:h,f=b;break}d>>=1}for(b=0;f>b;b+=1,c+=1)g=g<<8|255&this.d.getUint8(this.pos+c);return this.pos+=c,g},EbmlParser.prototype.getMatroskaFloat=function(a){"use strict";var b;switch(a){case 4:b=this.d.getFloat32(this.pos),this.pos+=4;break;case 8:b=this.d.getFloat64(this.pos),this.pos+=8}return b},EbmlParser.prototype.getMatroskaUint=function(a){"use strict";var b,c=0;for(b=0;a>b;b+=1)c<<=8,c|=255&this.d.getUint8(this.pos+b);return this.pos+=a,c},EbmlParser.prototype.moreData=function(){"use strict";return this.pos<this.d.byteLength},Webm.dependencies.WebmURLExtensions=function(){"use strict";var a=function(a){var b,c,d,e,f=[],g=new EbmlParser(a);for(g.consumeTag(WebM.Segment.Cues),c=g.getMatroskaCodedNum();g.moreData()&&g.consumeTagAndSize(WebM.Segment.Cues.CuePoint,!0);){for(b={},b.CueTime=g.parseTag(WebM.Segment.Cues.CuePoint.CueTime),b.CueTracks=[];g.moreData()&&g.consumeTagAndSize(WebM.Segment.Cues.CuePoint.CueTrackPositions,!0);){if(d={},d.Track=g.parseTag(WebM.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===d.Track)throw"Cue track cannot be 0";d.ClusterPosition=g.parseTag(WebM.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),g.pos+4>c||!g.consumeTag(WebM.Segment.Cues.CuePoint.CueTrackPositions.CueBlockNumber,!0)?b.CueTracks.push(d):(e=g.getMatroskaCodedNum(),d.BlockNumber=g.getMatroskaUint(e),b.CueTracks.push(d))}if(0===b.CueTracks.length)throw"Mandatory cuetrack not found";f.push(b)}if(0===f.length)throw"mandatory cuepoint not found";return f},b=function(b,c,d,e,f){var g,h,i,j,k,l,m,n;for(h=a.call(this,b),i=[],k=0,l=h.length;l>k;k+=1)j=new Dash.vo.Segment,g=0,g=k<h.length-1?h[k+1].CueTime-h[k].CueTime:f-h[k].CueTime,j.duration=g,j.media=c,j.startTime=h[k].CueTime,j.timescale=1e3,m=h[k].CueTracks[0].ClusterPosition+d,n=k<h.length-1?h[k+1].CueTracks[0].ClusterPosition+d-1:e-1,j.mediaRange=m+"-"+n,i.push(j);return this.debug.log("Parsed cues: "+i.length+" cues."),i},c=function(a,c,d,e){var f,g,h,i,j=new EbmlParser(a),k=d.split("-"),l=new XMLHttpRequest,m=this,n=!0,o={url:c,range:{start:parseFloat(k[0]),end:parseFloat(k[1])},request:l};for(j.skipOverElement(WebM.EBML),j.consumeTag(WebM.Segment),h=j.getMatroskaCodedNum(),h+=j.pos,i=j.pos;j.moreData()&&!j.consumeTagAndSize(WebM.Segment.Info,!0);)if(!(j.skipOverElement(WebM.Segment.SeekHead,!0)||j.skipOverElement(WebM.Segment.Tracks,!0)||j.skipOverElement(WebM.Segment.Cues,!0)||j.skipOverElement(WebM.Void,!0)))throw"no valid top level element found";for(;void 0===f;){var p=j.getMatroskaCodedNum(!0),q=j.getMatroskaCodedNum();switch(p){case WebM.Segment.Info.Duration.tag:f=j[WebM.Segment.Info.Duration.parse](q);break;default:j.pos+=q}}l.onload=function(){l.status<200||l.status>299||(n=!1,g=b.call(m,l.response,o.url,i,h,f),e.call(m,g))},l.onloadend=l.onerror=function(){n&&(n=!1,m.errHandler.downloadError("Cues ",o.url,l),e.call(m,null))},l.open("GET",o.url),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes="+o.range.start+"-"+o.range.end),l.send(null),m.debug.log("Perform cues load: "+o.url+" bytes="+o.range.start+"-"+o.range.end)},d=function(a,b,d,e){var f=new XMLHttpRequest,g=this,h=!0,i=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].BaseURL,j=8192,k={bytesLoaded:0,bytesToLoad:j,range:{start:0,end:j},request:f,url:i};g.debug.log("Parsing ebml header"),f.onload=function(){f.status<200||f.status>299||(h=!1,c.call(g,f.response,i,d,function(c){e.call(g,c,a,b)}))},f.onloadend=f.onerror=function(){h&&(h=!1,g.errHandler.downloadError("EBML Header",k.url,f),e.call(g,null,a,b))},f.open("GET",k.url),f.responseType="arraybuffer",f.setRequestHeader("Range","bytes="+k.range.start+"-"+k.range.end),f.send(null),g.debug.log("Parse EBML header: "+k.url)},e=function(a,b,c){var d=this;a?d.notify(Webm.dependencies.WebmURLExtensions.eventList.ENAME_SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):d.notify(Webm.dependencies.WebmURLExtensions.eventList.ENAME_SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c},new MediaPlayer.vo.Error(null,"error loading segments",null))};return{debug:void 0,errHandler:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,loadSegments:function(a,b,c){d.call(this,a,b,c,e.bind(this))},parseEbmlHeader:c,parseSegments:b,parseSIDX:a}},Webm.dependencies.WebmURLExtensions.prototype={constructor:Webm.dependencies.WebmURLExtensions},Webm.dependencies.WebmURLExtensions.eventList={ENAME_INITIALIZATION_LOADED:"initializationLoaded",ENAME_SEGMENTS_LOADED:"segmentsLoaded"},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,c=1;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.isLast=Math.abs(b.start+b.duration-b.manifestInfo.duration)<c,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",BUFFER_STATE:"BufferState",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.create=function(a,b,c){if(void 0!==typeof a&&"VIDEO"==a.nodeName){var d,e=a.id||a.name||"video element";return c=c||new Dash.di.DashContext,b=b||[].slice.call(a.querySelectorAll("source")).filter(function(a){return a.type==Dash.supportedManifestMimeTypes.mimeType})[0],d=new MediaPlayer(c),d.startup(),d.attachView(a),d.setAutoPlay(a.autoplay),d.attachSource(b.src),d.getDebug().log("Converted "+e+" to dash.js player and added content: "+b.src),d}},Dash.createAll=function(a,b,c){var d=[];a=a||".dashjs-player",b=b||document,c=c||new Dash.di.DashContext;for(var e=b.querySelectorAll(a),f=0;f<e.length;f++){var g=Dash.create(e[f],void 0,c);d.push(g)}return d},Dash.supportedManifestMimeTypes={mimeType:"application/dash+xml"},Dash.dependencies.DashHandler=function(){"use strict";var a,b,c,d=-1,e=0,f=new RegExp("^(?:(?:[a-z]+:)?/)?/","i"),g=function(a,b){for(;a.length<b;)a="0"+a;return a},h=function(a,b,c){for(var d,e,f,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),f=parseInt(a.substring(d+m,j-1),10),e){case"d":case"i":case"u":h=g(c.toString(),f);break;case"x":h=g(c.toString(16),f);break;case"X":h=g(c.toString(16),f).toUpperCase();break;case"o":h=g(c.toString(8),f);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)}},i=function(a){return a.split("$$").join("$")},j=function(a,b){if(null===b||-1===a.indexOf("$RepresentationID$"))return a;var c=b.toString();return a.split("$RepresentationID$").join(c)},k=function(a,b){return a.representation.startNumber+b},l=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:f.test(a)?a:d+a},m=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=l(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},n=function(a){var b,d=this;return a?b=m.call(d,a,c):null},o=function(a){var c,e,f,g=a.adaptation.period,h=!1;return b?h=!1:0>d?h=!1:d<a.availableSegmentsNumber?(e=B(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},p=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=k(d,c),d.availabilityIdx=c,d
},q=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,s=r.SegmentTimeline,v=b.availableSegmentsNumber>0,w=10,x=[],y=0,z=0,A=-1,B=function(a){return u.call(q,b,y,a.d,p,r.media,a.mediaRange,A)};for(p=b.timescale,c=s.S_asArray,k=t.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}return v||(b.availableSegmentsNumber=A+1),x},r=function(a){var b,c,d,e,f,g=[],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=s.call(i,a),d=b.start,e=b.end,c=d;e>=c;c+=1)m=p.call(i,a,c),m.replacementTime=(f+c-1)*a.segmentDuration,n=j.media,n=h(n,"Number",m.replacementNumber),n=h(n,"Time",m.replacementTime),m.media=n,g.push(m),m=null;return a.availableSegmentsNumber=Math.ceil((l.end-l.start)/k),g},s=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=B(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})},t=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})},u=function(a,c,d,e,f,g,i){var j,l,m,n=this,o=c/e,p=Math.min(d/e,a.adaptation.period.mpd.maxSegmentDuration);return j=n.timelineConverter.calcPresentationTimeFromMediaTime(o,a),l=j+p,m=new Dash.vo.Segment,m.representation=a,m.duration=p,m.mediaStartTime=o,m.presentationStartTime=j,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=k(m,i),f=h(f,"Number",m.replacementNumber),f=h(f,"Time",m.replacementTime),m.media=f,m.mediaRange=g,m.availabilityIdx=i,m},v=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=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].BaseURL,m=k.SegmentURL_asArray.length;for(h=a.startNumber,e=s.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=p.call(i,a,b),c.replacementTime=(h+b-1)*a.segmentDuration,c.media=d.media?d.media:l,c.mediaRange=d.mediaRange,c.index=d.index,c.indexRange=d.indexRange,j.push(c),c=null;return a.availableSegmentsNumber=m,j},w=function(a){var b,c=this,d=a.segmentInfoType;return"SegmentBase"!==d&&"BaseURL"!==d&&C.call(c,a)?("SegmentTimeline"===d?b=q.call(c,a):"SegmentTemplate"===d?b=r.call(c,a):"SegmentList"===d&&(b=v.call(c,a)),x.call(c,a,b)):b=a.segments,b},x=function(a,c){var d,e,f,g;a.segments=c,d=c.length-1,b&&isNaN(this.timelineConverter.getExpectedLiveEdge())&&(g=c[d],e=g.presentationStartTime+g.duration,f=this.metricsModel.getMetricsFor("stream"),this.timelineConverter.setExpectedLiveEdge(e),this.metricsModel.updateManifestUpdateInfo(this.metricsExt.getCurrentManifestUpdate(f),{presentationStartTime:e}))},y=function(a){var b=this;if(!a)throw new Error("no representation");return a.segments=null,w.call(b,a),a},z=function(a,e){var f,g=this,h=a.initialization,i="BaseURL"!==a.segmentInfoType&&"SegmentBase"!==a.segmentInfoType;return a.segmentAvailabilityRange=null,a.segmentAvailabilityRange=g.timelineConverter.calcSegmentAvailabilityRange(a,b),a.segmentAvailabilityRange.end<a.segmentAvailabilityRange.start&&!a.useCalculatedLiveEdgeTime?(f=new MediaPlayer.vo.Error(Dash.dependencies.DashHandler.SEGMENTS_UNAVAILABLE_ERROR_CODE,"no segments are available yet",{availabilityDelay:Math.abs(a.segmentAvailabilityRange.end)}),void g.notify(Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED,{representation:a},f)):(e||(d=-1),y.call(g,a),h||g.baseURLExt.loadInitialization(a),i||g.baseURLExt.loadSegments(a,c,a.indexRange),void(h&&i&&g.notify(Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED,{representation:a})))},A=function(a,b,c){var d,e,f,g,h,i=b.segments,j=i?i.length:null,k=-1;if(i&&j>0)for(h=0;j>h;h+=1)if(e=i[h],f=e.presentationStartTime,g=e.duration,d=void 0===c||null===c?g/2:c,a+d>=f&&f+g>a-d){k=e.availabilityIdx;break}return k},B=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},C=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},D=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=l(a.media,e),b=h(b,"Number",a.replacementNumber),b=h(b,"Time",a.replacementTime),b=h(b,"Bandwidth",f),b=j(b,e.id),b=i(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},E=function(b,e,f){var g,h,i,j=d,k=f?f.keepIdx:!1,l=f?f.timeThreshold:null,m=this;return b?(a=e,m.debug.log("Getting the request for time: "+e),d=A.call(m,e,b,l),w.call(m,b),0>d&&(d=A.call(m,e,b,l)),m.debug.log("Index for time "+e+" is "+d),i=o.call(m,b),i?(g=new MediaPlayer.vo.FragmentRequest,g.action=g.ACTION_COMPLETE,g.index=d,g.mediaType=c,m.debug.log("Signal complete."),m.debug.log(g)):(h=B(d,b),g=D.call(m,h)),k&&(d=j),g):null},F=function(a,b){var c=(a.segmentAvailabilityRange.end-a.segmentAvailabilityRange.start)/2;return a.segments=null,a.segmentAvailabilityRange={start:b-c,end:b+c},E.call(this,a,b,{keepIdx:!1})},G=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=o.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.")):(w.call(i,b),f=B(h,b),e=D.call(i,f)),e},H=function(a){var b=a.data.representation;b.segments&&this.notify(Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED,{representation:b})},I=function(a){if(!a.error&&c===a.data.mediaType){var b,d,e,f,g=this,h=a.data.segments,i=a.data.representation,j=[],k=0;for(b=0,d=h.length;d>b;b+=1)e=h[b],f=u.call(g,i,e.startTime,e.duration,e.timescale,e.media,e.mediaRange,k),j.push(f),f=null,k+=1;i.segmentAvailabilityRange={start:j[0].presentationStartTime,end:j[d-1].presentationStartTime},i.availableSegmentsNumber=d,x.call(g,i,j),i.initialization&&this.notify(Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED,{representation:i})}};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,setup:function(){this[Dash.dependencies.BaseURLExtensions.eventList.ENAME_INITIALIZATION_LOADED]=H,this[Dash.dependencies.BaseURLExtensions.eventList.ENAME_SEGMENTS_LOADED]=I},initialize:function(a){this.subscribe(Dash.dependencies.DashHandler.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(Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED,this.streamProcessor.trackController)},getInitRequest:n,getSegmentRequestForTime:E,getNextSegmentRequest:G,generateSegmentRequestForTime:F,updateRepresentation:z}},Dash.dependencies.DashHandler.prototype={constructor:Dash.dependencies.DashHandler},Dash.dependencies.DashHandler.SEGMENTS_UNAVAILABLE_ERROR_CODE=1,Dash.dependencies.DashHandler.eventList={ENAME_REPRESENTATION_UPDATED:"representationUpdated"},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){for(var b=["minBufferTime","mediaPresentationDuration","minimumUpdatePeriod","timeShiftBufferDepth","maxSegmentDuration","maxSubsegmentDuration","suggestedPresentationDelay","start","starttime","duration"],c=b.length,d=0;c>d;d++)if(a.nodeName===b[d])return h.test(a.value);return!1},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.value)},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.value)},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,c.hasOwnProperty("Location")&&(c.Location=c.Location_asArray[0]),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.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.adaptation.period.start,h=f+a.adaptation.period.duration,i={start:f,end:h};return c?!b&&a.segmentAvailabilityRange?a.segmentAvailabilityRange:(d=a.adaptation.period.mpd.checkTime,e=g(new Date((new Date).getTime()),a.adaptation.period),f=Math.max(e-a.adaptation.period.mpd.timeShiftBufferDepth,0),h=isNaN(d)?e:Math.min(d,e),i={start:f,end:h}):i},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){b||d.error||(a=d.data.liveEdge-(c+d.data.searchTime),b=!0)},o=function(c){b||c.error||(a=c.data.offset/1e3,b=!0)},p=function(a){var b=a.presentationTimeOffset,c=a.adaptation.period.start;return c-b},q=function(){a=0,b=!1,c=0/0};return{notifier:void 0,uriQueryFragModel:void 0,setup:function(){this[MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED]=n,this[MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED]=o},calcAvailabilityStartTimeFromPresentationTime:e,calcAvailabilityEndTimeFromPresentationTime:f,calcPresentationTimeFromWallTime:g,calcPresentationTimeFromMediaTime:h,calcPeriodRelativeTimeFromMpdRelativeTime:l,calcMpdRelativeTimeFromPeriodRelativeTime:m,calcMediaTimeFromPresentationTime:i,calcSegmentAvailabilityRange:k,calcWallTimeForSegment:j,calcMSETimeOffset:p,reset:q,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.dependencies.RepresentationController=function(){"use strict";var a,b=null,c=-1,d=!0,e=[],f=function(c,f,h){var j=this;if(d=!0,j.notify(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_STARTED),e=k.call(j,f),a=i.call(j,j.abrController.getQualityFor(h,j.streamProcessor.getStreamInfo())),b=c,"video"!==h&&"audio"!==h)return j.notify(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,{data:b,currentRepresentation:a}),void g.call(j);for(var l=0;l<e.length;l+=1)j.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(){var b=this.streamProcessor,c=this.timelineConverter.calcSegmentAvailabilityRange(a,b.isDynamic());this.metricsModel.addDVRInfo(b.getType(),b.playbackController.getTime(),b.getStreamInfo().manifestInfo,c)},i=function(a){return e[a]},j=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},k=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)},l=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)},m=function(b){var c=this,f=1e3*(b+3*a.segmentDuration),g=function(){if(!this.isUpdating()){d=!0,c.notify(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_STARTED);for(var a=0;a<e.length;a+=1)c.indexHandler.updateRepresentation(e[a],!0)}};d=!1,setTimeout(g.bind(this),f)},n=function(c){if(this.isUpdating()){var e,f,i=this,k=c.data.representation,l=i.metricsModel.getMetricsFor("stream"),n=i.metricsExt.getCurrentManifestUpdate(l),o=!1;if(c.error&&c.error.code===Dash.dependencies.DashHandler.SEGMENTS_UNAVAILABLE_ERROR_CODE)return h.call(this),m.call(this,c.error.data.availabilityDelay),f=new MediaPlayer.vo.Error(Dash.dependencies.RepresentationController.SEGMENTS_UPDATE_FAILED_ERROR_CODE,"Segments update failed",null),void this.notify(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,{data:b,currentRepresentation:a},f);for(var p=0;p<n.trackInfo.length;p+=1)if(e=n.trackInfo[p],e.index===k.index&&e.mediaType===i.streamProcessor.getType()){o=!0;break}o||i.metricsModel.addManifestUpdateTrackInfo(n,k.id,k.index,k.adaptation.period.index,i.streamProcessor.getType(),k.presentationTimeOffset,k.startNumber,k.segmentInfoType),j()&&(d=!1,i.metricsModel.updateManifestUpdateInfo(n,{latency:a.segmentAvailabilityRange.end-i.streamProcessor.playbackController.getTime()}),this.notify(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,{data:b,currentRepresentation:a}),g.call(i))}},o=function(a){l.call(this,a.data.isDynamic)},p=function(b){if(!b.error){l.call(this,!0),this.indexHandler.updateRepresentation(a,!1);var c=this.manifestModel.getValue();a.adaptation.period.mpd.checkTime=this.manifestExt.getCheckTime(c,a.adaptation.period)}},q=function(){h.call(this)},r=function(b){var c=this;b.data.mediaType===c.streamProcessor.getType()&&c.streamProcessor.getStreamInfo().id===b.data.streamInfo.id&&(a=c.getRepresentationForQuality(b.data.newQuality),g.call(c))};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,setup:function(){this[MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED]=r,this[Dash.dependencies.DashHandler.eventList.ENAME_REPRESENTATION_UPDATED]=n,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED]=o,this[MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED]=p,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED]=q},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:i,getCurrentRepresentation:function(){return a}}},Dash.dependencies.RepresentationController.prototype={constructor:Dash.dependencies.RepresentationController},Dash.dependencies.RepresentationController.SEGMENTS_UPDATE_FAILED_ERROR_CODE=1,Dash.dependencies.RepresentationController.eventList={ENAME_DATA_UPDATE_COMPLETED:"dataUpdateCompleted",ENAME_DATA_UPDATE_STARTED:"dataUpdateStarted"},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.requestModifierExt.modifyRequestURL(b.url)),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes="+b.range.start+"-"+b.range.end),l=s.requestModifierExt.modifyRequestHeader(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(Dash.dependencies.BaseURLExtensions.eventList.ENAME_INITIALIZATION_LOADED,{representation:a})}))},b.onloadend=b.onerror=function(){d&&(d=!1,e.errHandler.downloadError("initialization",g.url,b),e.notify(Dash.dependencies.BaseURLExtensions.eventList.ENAME_INITIALIZATION_LOADED,{representation:a}))},b.open("GET",e.requestModifierExt.modifyRequestURL(g.url)),b.responseType="arraybuffer",b.setRequestHeader("Range","bytes="+g.range.start+"-"+g.range.end),b=e.requestModifierExt.modifyRequestHeader(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.requestModifierExt.modifyRequestURL(c.url)),r.responseType="arraybuffer",r.setRequestHeader("Range","bytes="+c.range.start+"-"+c.range.end),r=x.requestModifierExt.modifyRequestHeader(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.requestModifierExt.modifyRequestURL(m.url)),i.responseType="arraybuffer",i.setRequestHeader("Range","bytes="+m.range.start+"-"+m.range.end),i=l.requestModifierExt.modifyRequestHeader(i),i.send(null),l.debug.log("Perform SIDX load: "+m.url)},g=function(a,b,c){var d=this;a?d.notify(Dash.dependencies.BaseURLExtensions.eventList.ENAME_SEGMENTS_LOADED,{segments:a,representation:b,mediaType:c}):d.notify(Dash.dependencies.BaseURLExtensions.eventList.ENAME_SEGMENTS_LOADED,{segments:null,representation:b,mediaType:c},new MediaPlayer.vo.Error(null,"error loading segments",null))};return{debug:void 0,errHandler:void 0,requestModifierExt:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,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.BaseURLExtensions.eventList={ENAME_INITIALIZATION_LOADED:"initializationLoaded",ENAME_SEGMENTS_LOADED:"segmentsLoaded"},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")&&null!==j?(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,j=k),i=null,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},getUTCTimingSources:function(a){"use strict";var b=this,c=b.getIsDynamic(a),d=a.hasOwnProperty("availabilityStartTime"),e=a.UTCTiming_asArray,f=[];return(c||d)&&e&&e.forEach(function(a){var b=new Dash.vo.UTCTiming;a.hasOwnProperty("schemeIdUri")&&(b.schemeIdUri=a.schemeIdUri,a.hasOwnProperty("value")&&(b.value=a.value.toString(),f.push(b)))}),f}},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])},q=function(a,b){if(null===a)return null;var c,d=l(a),e=d[d.length-1];return"MPD"===e.type&&(c=s(e.responseHeaders,b)),void 0===c[b]?null:c[b]},r=function(a,b){if(null===a)return null;var c,d=k(a);return null===d||null===d.responseHeaders?null:(c=s(d.responseHeaders,b),void 0===c[b]?null:c[b])},s=function(a){var b={};if(!a)return b;for(var c=a.split("\r\n"),d=0,e=c.length;e>d;d++){var f=c[d],g=f.indexOf(": ");g>0&&(b[f.substring(0,g)]=f.substring(g+2))}return 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,getLatestFragmentRequestHeaderValueByID:r,getLatestMPDRequestHeaderValueByID:q}},Dash.dependencies.DashMetricsExtensions.prototype={constructor:Dash.dependencies.DashMetricsExtensions},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=this,e=new XMLHttpRequest,f=b,g=!1,h="Error loading fragment: "+f,i=new MediaPlayer.vo.Error(null,h,null);e.onloadend=function(){g||(h="Error loading fragment: "+f,d.notify(Dash.dependencies.FragmentExtensions.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,{fragment:null},i))},e.onload=function(){g=!0,c=a(e.response),d.notify(Dash.dependencies.FragmentExtensions.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,{fragment:c})},e.onerror=function(){h="Error loading fragment: "+f,d.notify(Dash.dependencies.FragmentExtensions.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,{fragment:null},i)},e.responseType="arraybuffer",e.open("GET",f),e.send(null)};return{debug:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,loadFragment:c,parseTFDT:a,parseSIDX:b}},Dash.dependencies.FragmentExtensions.prototype={constructor:Dash.dependencies.FragmentExtensions},Dash.dependencies.FragmentExtensions.eventList={ENAME_FRAGMENT_LOADING_COMPLETED:"fragmentLoadingCompleted"},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},Dash.vo.UTCTiming=function(){"use strict";this.schemeIdUri="",this.value=""},Dash.vo.UTCTiming.prototype={constructor:Dash.vo.UTCTiming},"undefined"==typeof utils)var utils={};"undefined"==typeof utils.Math&&(utils.Math={}),utils.Math.to64BitNumber=function(a,b){var c,d,e;return c=new goog.math.Long(0,b),d=new goog.math.Long(a,0),e=c.add(d),e.toNumber()};var UTF8={};UTF8.encode=function(a){for(var b=[],c=0;c<a.length;++c){var d=a.charCodeAt(c);128>d?b.push(d):2048>d?(b.push(192|d>>6),b.push(128|63&d)):65536>d?(b.push(224|d>>12),b.push(128|63&d>>6),b.push(128|63&d)):(b.push(240|d>>18),b.push(128|63&d>>12),b.push(128|63&d>>6),b.push(128|63&d))}return b},UTF8.decode=function(a){for(var b=[],c=0;c<a.length;){var d=a[c++];128>d||(224>d?(d=(31&d)<<6,d|=63&a[c++]):240>d?(d=(15&d)<<12,d|=(63&a[c++])<<6,d|=63&a[c++]):(d=(7&d)<<18,d|=(63&a[c++])<<12,d|=(63&a[c++])<<6,d|=63&a[c++])),b.push(String.fromCharCode(d))}return b.join("")};var BASE64={};if(function(b){var c=function(a){for(var c=0,d=[],e=0|a.length/3;0<e--;){var f=(a[c]<<16)+(a[c+1]<<8)+a[c+2];c+=3,d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push(b.charAt(63&f))}if(2==a.length-c){var f=(a[c]<<16)+(a[c+1]<<8);d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push(b.charAt(63&f>>6)),d.push("=")}else if(1==a.length-c){var f=a[c]<<16;d.push(b.charAt(63&f>>18)),d.push(b.charAt(63&f>>12)),d.push("==")}return d.join("")},d=function(){for(var a=[],c=0;c<b.length;++c)a[b.charCodeAt(c)]=c;return a["=".charCodeAt(0)]=0,a}(),e=function(a){for(var b=0,c=[],e=0|a.length/4;0<e--;){var f=(d[a.charCodeAt(b)]<<18)+(d[a.charCodeAt(b+1)]<<12)+(d[a.charCodeAt(b+2)]<<6)+d[a.charCodeAt(b+3)];c.push(255&f>>16),c.push(255&f>>8),c.push(255&f),b+=4}return c&&("="==a.charAt(b-2)?(c.pop(),c.pop()):"="==a.charAt(b-1)&&c.pop()),c},f={};f.encode=function(a){for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b},f.decode=function(){for(var b=0;b<s.length;++b)a[b]=String.fromCharCode(a[b]);return a.join("")},BASE64.decodeArray=function(a){var b=e(a);return new Uint8Array(b)},BASE64.encodeASCII=function(a){var b=f.encode(a);return c(b)},BASE64.decodeASCII=function(a){var b=e(a);return f.decode(b)},BASE64.encode=function(a){var b=UTF8.encode(a);return c(b)},BASE64.decode=function(a){var b=e(a);return UTF8.decode(b)}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),void 0===btoa)var btoa=BASE64.encode;if(void 0===atob)var atob=BASE64.decode;!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),goog={},goog.math={},goog.math.Long=function(a,b){this.low_=0|a,this.high_=0|b},goog.math.Long.IntCache_={},goog.math.Long.fromInt=function(a){if(a>=-128&&128>a){var b=goog.math.Long.IntCache_[a];if(b)return b}var c=new goog.math.Long(0|a,0>a?-1:0);return a>=-128&&128>a&&(goog.math.Long.IntCache_[a]=c),c},goog.math.Long.fromNumber=function(a){return isNaN(a)||!isFinite(a)?goog.math.Long.ZERO:a<=-goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MIN_VALUE:a+1>=goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MAX_VALUE:0>a?goog.math.Long.fromNumber(-a).negate():new goog.math.Long(a%goog.math.Long.TWO_PWR_32_DBL_|0,a/goog.math.Long.TWO_PWR_32_DBL_|0)},goog.math.Long.fromBits=function(a,b){return new goog.math.Long(a,b)},goog.math.Long.fromString=function(a,b){if(0==a.length)throw Error("number format error: empty string");var c=b||10;if(2>c||c>36)throw Error("radix out of range: "+c);if("-"==a.charAt(0))return goog.math.Long.fromString(a.substring(1),c).negate();if(a.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+a);for(var d=goog.math.Long.fromNumber(Math.pow(c,8)),e=goog.math.Long.ZERO,f=0;f<a.length;f+=8){var g=Math.min(8,a.length-f),h=parseInt(a.substring(f,f+g),c);if(8>g){var i=goog.math.Long.fromNumber(Math.pow(c,g));e=e.multiply(i).add(goog.math.Long.fromNumber(h))}else e=e.multiply(d),e=e.add(goog.math.Long.fromNumber(h))}return e},goog.math.Long.TWO_PWR_16_DBL_=65536,goog.math.Long.TWO_PWR_24_DBL_=1<<24,goog.math.Long.TWO_PWR_32_DBL_=goog.math.Long.TWO_PWR_16_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_31_DBL_=goog.math.Long.TWO_PWR_32_DBL_/2,goog.math.Long.TWO_PWR_48_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_64_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_32_DBL_,goog.math.Long.TWO_PWR_63_DBL_=goog.math.Long.TWO_PWR_64_DBL_/2,goog.math.Long.ZERO=goog.math.Long.fromInt(0),goog.math.Long.ONE=goog.math.Long.fromInt(1),goog.math.Long.NEG_ONE=goog.math.Long.fromInt(-1),goog.math.Long.MAX_VALUE=goog.math.Long.fromBits(-1,2147483647),goog.math.Long.MIN_VALUE=goog.math.Long.fromBits(0,-2147483648),goog.math.Long.TWO_PWR_24_=goog.math.Long.fromInt(1<<24),goog.math.Long.prototype.toInt=function(){return this.low_},goog.math.Long.prototype.toNumber=function(){return this.high_*goog.math.Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},goog.math.Long.prototype.toString=function(a){var b=a||10;if(2>b||b>36)throw Error("radix out of range: "+b);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){var c=goog.math.Long.fromNumber(b),d=this.div(c),e=d.multiply(c).subtract(this);return d.toString(b)+e.toInt().toString(b)}return"-"+this.negate().toString(b)}for(var f=goog.math.Long.fromNumber(Math.pow(b,6)),e=this,g="";;){var h=e.div(f),i=e.subtract(h.multiply(f)).toInt(),j=i.toString(b);if(e=h,e.isZero())return j+g;for(;j.length<6;)j="0"+j;g=""+j+g}},goog.math.Long.prototype.getHighBits=function(){return this.high_},goog.math.Long.prototype.getLowBits=function(){return this.low_},goog.math.Long.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:goog.math.Long.TWO_PWR_32_DBL_+this.low_},goog.math.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(goog.math.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var a=0!=this.high_?this.high_:this.low_,b=31;b>0&&0==(a&1<<b);b--);return 0!=this.high_?b+33:b+1},goog.math.Long.prototype.isZero=function(){return 0==this.high_&&0==this.low_},goog.math.Long.prototype.isNegative=function(){return this.high_<0},goog.math.Long.prototype.isOdd=function(){return 1==(1&this.low_)},goog.math.Long.prototype.equals=function(a){return this.high_==a.high_&&this.low_==a.low_},goog.math.Long.prototype.notEquals=function(a){return this.high_!=a.high_||this.low_!=a.low_},goog.math.Long.prototype.lessThan=function(a){return this.compare(a)<0},goog.math.Long.prototype.lessThanOrEqual=function(a){return this.compare(a)<=0},goog.math.Long.prototype.greaterThan=function(a){return this.compare(a)>0},goog.math.Long.prototype.greaterThanOrEqual=function(a){return this.compare(a)>=0},goog.math.Long.prototype.compare=function(a){if(this.equals(a))return 0;var b=this.isNegative(),c=a.isNegative();return b&&!c?-1:!b&&c?1:this.subtract(a).isNegative()?-1:1},goog.math.Long.prototype.negate=function(){return this.equals(goog.math.Long.MIN_VALUE)?goog.math.Long.MIN_VALUE:this.not().add(goog.math.Long.ONE)},goog.math.Long.prototype.add=function(a){var b=this.high_>>>16,c=65535&this.high_,d=this.low_>>>16,e=65535&this.low_,f=a.high_>>>16,g=65535&a.high_,h=a.low_>>>16,i=65535&a.low_,j=0,k=0,l=0,m=0;return m+=e+i,l+=m>>>16,m&=65535,l+=d+h,k+=l>>>16,l&=65535,k+=c+g,j+=k>>>16,k&=65535,j+=b+f,j&=65535,goog.math.Long.fromBits(l<<16|m,j<<16|k)},goog.math.Long.prototype.subtract=function(a){return this.add(a.negate())},goog.math.Long.prototype.multiply=function(a){if(this.isZero())return goog.math.Long.ZERO;if(a.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE))return a.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(a.equals(goog.math.Long.MIN_VALUE))return this.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(this.isNegative())return a.isNegative()?this.negate().multiply(a.negate()):this.negate().multiply(a).negate();if(a.isNegative())return this.multiply(a.negate()).negate();if(this.lessThan(goog.math.Long.TWO_PWR_24_)&&a.lessThan(goog.math.Long.TWO_PWR_24_))return goog.math.Long.fromNumber(this.toNumber()*a.toNumber());var b=this.high_>>>16,c=65535&this.high_,d=this.low_>>>16,e=65535&this.low_,f=a.high_>>>16,g=65535&a.high_,h=a.low_>>>16,i=65535&a.low_,j=0,k=0,l=0,m=0;return m+=e*i,l+=m>>>16,m&=65535,l+=d*i,k+=l>>>16,l&=65535,l+=e*h,k+=l>>>16,l&=65535,k+=c*i,j+=k>>>16,k&=65535,k+=d*h,j+=k>>>16,k&=65535,k+=e*g,j+=k>>>16,k&=65535,j+=b*i+c*h+d*g+e*f,j&=65535,goog.math.Long.fromBits(l<<16|m,j<<16|k)},goog.math.Long.prototype.div=function(a){if(a.isZero())throw Error("division by zero");if(this.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE)){if(a.equals(goog.math.Long.ONE)||a.equals(goog.math.Long.NEG_ONE))return goog.math.Long.MIN_VALUE;if(a.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ONE;var b=this.shiftRight(1),c=b.div(a).shiftLeft(1);if(c.equals(goog.math.Long.ZERO))return a.isNegative()?goog.math.Long.ONE:goog.math.Long.NEG_ONE;var d=this.subtract(a.multiply(c)),e=c.add(d.div(a));return e}if(a.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ZERO;if(this.isNegative())return a.isNegative()?this.negate().div(a.negate()):this.negate().div(a).negate();if(a.isNegative())return this.div(a.negate()).negate();for(var f=goog.math.Long.ZERO,d=this;d.greaterThanOrEqual(a);){for(var c=Math.max(1,Math.floor(d.toNumber()/a.toNumber())),g=Math.ceil(Math.log(c)/Math.LN2),h=48>=g?1:Math.pow(2,g-48),i=goog.math.Long.fromNumber(c),j=i.multiply(a);j.isNegative()||j.greaterThan(d);)c-=h,i=goog.math.Long.fromNumber(c),j=i.multiply(a);i.isZero()&&(i=goog.math.Long.ONE),f=f.add(i),d=d.subtract(j)}return f},goog.math.Long.prototype.modulo=function(a){return this.subtract(this.div(a).multiply(a))},goog.math.Long.prototype.not=function(){return goog.math.Long.fromBits(~this.low_,~this.high_)},goog.math.Long.prototype.and=function(a){return goog.math.Long.fromBits(this.low_&a.low_,this.high_&a.high_)},goog.math.Long.prototype.or=function(a){return goog.math.Long.fromBits(this.low_|a.low_,this.high_|a.high_)},goog.math.Long.prototype.xor=function(a){return goog.math.Long.fromBits(this.low_^a.low_,this.high_^a.high_)},goog.math.Long.prototype.shiftLeft=function(a){if(a&=63,0==a)return this;var b=this.low_;if(32>a){var c=this.high_;return goog.math.Long.fromBits(b<<a,c<<a|b>>>32-a)}return goog.math.Long.fromBits(0,b<<a-32)},goog.math.Long.prototype.shiftRight=function(a){if(a&=63,0==a)return this;var b=this.high_;if(32>a){var c=this.low_;return goog.math.Long.fromBits(c>>>a|b<<32-a,b>>a)}return goog.math.Long.fromBits(b>>a-32,b>=0?0:-1)},goog.math.Long.prototype.shiftRightUnsigned=function(a){if(a&=63,0==a)return this;var b=this.high_;if(32>a){var c=this.low_;return goog.math.Long.fromBits(c>>>a|b<<32-a,b>>>a)}return 32==a?goog.math.Long.fromBits(b,0):goog.math.Long.fromBits(b>>>a-32,0)},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.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,null),k.metricsModel.appendHttpTrace(g,a.requestStartDate,a.requestStartDate.getTime()-a.requestStartDate.getTime(),[0]),j=a.requestStartDate,f.open("GET",k.requestModifierExt.modifyRequestURL(a.url),!0),f.responseType="arraybuffer",f=k.requestModifierExt.modifyRequestHeader(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,g.responseHeaders=f.getAllResponseHeaders(),k.metricsModel.appendHttpTrace(g,d,d.getTime()-j.getTime(),[e?e.byteLength:0]),j=d,k.notify(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_LOADING_COMPLETED,{request:a,response: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(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_LOADING_COMPLETED,{request:a,bytes:null},new MediaPlayer.vo.Error(null,"failed loading fragment",null)))}},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(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,{request:a,exists:!0}))},c.onloadend=c.onerror=function(){d||b.notify(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,{request:a,exists:!1})},c.send()};return{metricsModel:void 0,errHandler:void 0,debug:void 0,requestModifierExt:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,load:function(b){b?d.call(this,b,a):this.notify(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_LOADING_COMPLETED,{request:b,bytes:null},new MediaPlayer.vo.Error(null,"request is null",null))},checkForExistence:function(a){return a?void e.call(this,a):void this.notify(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,{request:a,exists:!1})},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.FragmentLoader.eventList={ENAME_LOADING_COMPLETED:"loadingCompleted",ENAME_CHECK_FOR_EXISTENCE_COMPLETED:"checkForExistenceCompleted"},MediaPlayer.dependencies.LiveEdgeFinder=function(){"use strict";var a,b=!1,c=0/0,d=MediaPlayer.rules.SynchronizationRulesCollection.prototype.BEST_GUESS_RULES,e=function(a){var b=a.value,d=((new Date).getTime()-c)/1e3;this.notify(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,{liveEdge:b,searchTime:d},null===b?new MediaPlayer.vo.Error(MediaPlayer.dependencies.LiveEdgeFinder.LIVE_EDGE_NOT_FOUND_ERROR_CODE,"live edge has not been found",null):null)},f=function(f){var g=this;!g.streamProcessor.isDynamic()||b||f.error||(a=g.synchronizationRulesCollection.getRules(d),b=!0,c=(new Date).getTime(),g.rulesController.applyRules(a,g.streamProcessor,e.bind(g),null,function(a,b){return b}))},g=function(a){d=a.error?MediaPlayer.rules.SynchronizationRulesCollection.prototype.BEST_GUESS_RULES:MediaPlayer.rules.SynchronizationRulesCollection.prototype.TIME_SYNCHRONIZED_RULES
};return{system:void 0,synchronizationRulesCollection:void 0,rulesController:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this[MediaPlayer.dependencies.Stream.eventList.ENAME_STREAM_UPDATED]=f,this[MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED]=g},initialize:function(a){this.streamProcessor=a,this.fragmentLoader=a.fragmentLoader},abortSearch:function(){b=!1,c=0/0}}},MediaPlayer.dependencies.LiveEdgeFinder.prototype={constructor:MediaPlayer.dependencies.LiveEdgeFinder},MediaPlayer.dependencies.LiveEdgeFinder.eventList={ENAME_LIVE_EDGE_SEARCH_COMPLETED:"liveEdgeFound"},MediaPlayer.dependencies.LiveEdgeFinder.LIVE_EDGE_NOT_FOUND_ERROR_CODE=1,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.metricsModel.addHttpRequest("stream",null,"MPD",a,null,null,i,j,null,h.status,null,null,h.getAllResponseHeaders()),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(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,{manifest:f})):n.notify(MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED,{manifest:null},new MediaPlayer.vo.Error(null,"Failed loading manifest: "+a,null)))},m=function(){k&&(k=!1,n.metricsModel.addHttpRequest("stream",null,"MPD",a,null,null,i,new Date,h.status,null,null,h.getAllResponseHeaders()),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(MediaPlayer.dependencies.ManifestLoader.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",n.requestModifierExt.modifyRequestURL(a),!0),h.send()}catch(o){h.onerror()}};return{debug:void 0,parser:void 0,errHandler:void 0,metricsModel:void 0,requestModifierExt:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,load:function(b){d.call(this,b,a)}}},MediaPlayer.dependencies.ManifestLoader.prototype={constructor:MediaPlayer.dependencies.ManifestLoader},MediaPlayer.dependencies.ManifestLoader.eventList={ENAME_MANIFEST_LOADED:"manifestLoaded"},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){a.error||(this.manifestModel.setValue(a.data.manifest),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(){this[MediaPlayer.dependencies.StreamController.eventList.ENAME_STREAMS_COMPOSED]=l,this[MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED]=i,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED]=j,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PAUSED]=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.Notifier=function(){"use strict";var a,b=0,c=function(){return this.id||(b+=1,this.id="_id_"+b),this.id};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=arguments[0]+c.call(this),d=new MediaPlayer.vo.Event;d.sender=this,d.type=arguments[0],d.data=arguments[1],d.error=arguments[2],d.timestamp=(new Date).getTime(),a.notify.call(a,b,d)},subscribe:function(b,d,e,f){if(!e&&d[b]&&(e=d[b]=d[b].bind(d)),!d)throw"observer object cannot be null or undefined";if(!e)throw"event handler cannot be null or undefined";b+=c.call(this),a.mapHandler(b,void 0,e,f)},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.Stream=function(){"use strict";var a,b,c={},d=[],e=!0,f=!1,g=!1,h=!1,i=null,j=[],k=!0,l=null,m={},n=null,o=function(){f&&this.playbackController.start()},p=function(){this.playbackController.pause()},q=function(a){f&&(this.debug.log("Do seek: "+a),this.playbackController.seek(a))},r=function(a){try{var b=c.video,d=this.protectionExt.autoSelectKeySystem(this.protectionModel,b,a.data.initData);if(this.keySystem&&this.keySystem!==this.protectionModel.keySystem)throw new Error("DRM:  Changing key systems within a single Period is not allowed!");this.keySystem||(this.keySystem=this.protectionModel.keySystem,this.protectionModel.keySystem.subscribe(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,this)),this.debug.log("DRM: Key required for - "+b.codec),this.protectionController.createKeySession(d,b.codec)}catch(e){this.errHandler.mediaKeySessionError(e.message),this.debug.log(e.message),this.reset()}},s=function(){this.debug.log("DRM: Key added.")},t=function(a){a.error?(p.call(this),this.debug.log(a.error),this.errHandler.mediaKeyMessageError(a.error)):(this.debug.log("DRM: License request successful.  Session ID = "+a.data.requestData.sessionID),this.protectionController.updateKeySession(a.data.requestData,a.data.message))},u=function(a){var b,c=a.data.sessionToken,d=c.sessionID?c.sessionID:"NONE";b="DRM: MediaKeyError - sessionId: "+d+".  "+a.data.error,this.debug.log(b),this.errHandler.mediaKeySessionError(b)},v=function(a){this.debug.log("DRM: Session created.  SessionID = "+a.data.sessionID)},w=function(a){this.debug.log("DRM: Session loaded.  SessionID = "+a.data.sessionID)},x=function(a){this.debug.log("DRM: Session unloaded.  SessionID = "+a.data.sessionID)},y=function(a){this.debug.log("DRM: Session closed.  SessionID = "+a.data.sessionID)},z=function(a,b){var c,d=this,e=function(f){d.debug.log("MediaSource is open!"),d.debug.log(f),window.URL.revokeObjectURL(c),a.removeEventListener("sourceopen",e),a.removeEventListener("webkitsourceopen",e),b(a)};a.addEventListener("sourceopen",e,!1),a.addEventListener("webkitsourceopen",e,!1),c=d.mediaSourceExt.attachMediaSource(a,d.videoModel)},A=function(){var e,g=this,k=d.length,l=0;for(l;k>l;l+=1)e=d[l],e.reset(h),e=null;n&&n.reset(),d=[],b&&g.mediaSourceExt.detachMediaSource(g.videoModel),f=!1,i=null,j=[],c={},b=null,a=null},B=function(a,e){var f,g,h,i=this,j=function(a){return a.codec},k=i.adapter.getMediaInfoForType(e,l,a);if("text"===a&&(j=function(a){return f=a.mimeType}),null!==k){var m,o=j.call(i,k),p=null;if(o===f)try{p=i.sourceBufferExt.createSourceBuffer(b,k)}catch(q){i.errHandler.mediaSourceError("Error creating "+a+" source buffer.")}else if(g=o,i.debug.log(a+" codec: "+g),c[a]=k,m=k.contentProtection,m&&!i.capabilities.supportsEncryptedMedia())i.errHandler.capabilityError("encryptedmedia");else if(i.capabilities.supportsCodec(i.videoModel.getElement(),g))try{p=i.sourceBufferExt.createSourceBuffer(b,k)}catch(q){i.errHandler.mediaSourceError("Error creating "+a+" source buffer.")}else{var r=a+"Codec ("+g+") is not supported.";i.errHandler.manifestError(r,"codec",e),i.debug.log(r)}null===p?i.debug.log("No buffer was created, skipping "+a+" data."):(h=i.system.getObject("streamProcessor"),d.push(h),h.initialize(f||a,p,i.videoModel,i.fragmentController,i.playbackController,b,i,n),h.setMediaInfo(k),i.adapter.updateData(h))}else i.debug.log("No "+a+" data.")},C=function(){var b,c=this;n=c.system.getObject("eventController"),n.initialize(c.videoModel),b=c.adapter.getEventsFor(l),n.addInlineEvents(b),B.call(c,"video",a),B.call(c,"audio",a),B.call(c,"text",a)},D=function(){var a,c,d=this;a=l.manifestInfo.duration,c=d.mediaSourceExt.setDuration(b,a),d.debug.log("Duration successfully set to: "+c),f=!0,G.call(d)},E=function(){this.debug.log("element loaded!"),g=!0,F.call(this)},F=function(){f&&g&&0===l.index&&(n.start(),e&&o.call(this))},G=function(){var a=this,b=d.length,c=!!m.audio||!!m.video,e=c?new MediaPlayer.vo.Error(MediaPlayer.dependencies.Stream.DATA_UPDATE_FAILED_ERROR_CODE,"Data update failed",null):null,g=0;if(f){for(g;b>g;g+=1)if(d[g].isUpdating())return;k=!1,a.notify(MediaPlayer.dependencies.Stream.eventList.ENAME_STREAM_UPDATED,null,e)}},H=function(a){var b=a.data.error.code,c="";if(-1!==b){switch(b){case 1:c="MEDIA_ERR_ABORTED";break;case 2:c="MEDIA_ERR_NETWORK";break;case 3:c="MEDIA_ERR_DECODE";break;case 4:c="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:c="MEDIA_ERR_ENCRYPTED"}h=!0,this.debug.log("Video Element Error: "+c),this.debug.log(a.error),this.errHandler.mediaSourceError(c),this.reset()}},I=function(c){var e,f=this,g=function(c){if(b=c,C.call(f),0===d.length){var e="No streams to play.";f.errHandler.manifestError(e,"nostreams",a),f.debug.log(e)}else f.liveEdgeFinder.initialize(d[0]),f.liveEdgeFinder.subscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,f.playbackController),D.call(f),F.call(f)};a=c,e=f.mediaSourceExt.createMediaSource(),z.call(f,e,g)},J=function(){var a=L(),c=a.length,d=0;for(d;c>d;d+=1)if(!a[d].isBufferingCompleted())return;b&&l.isLast&&this.mediaSourceExt.signalEndOfStream(b)},K=function(a){var b=a.sender.streamProcessor.getType();m[b]=a.error,G.call(this)},L=function(){var a,b,c=[],e=0,f=d.length;for(e;f>e;e+=1)b=d[e],a=b.getType(),("audio"===a||"video"===a)&&c.push(b);return c},M=function(b){var c,e,f,g=this,h=d.length,i=0;for(k=!0,a=g.manifestModel.getValue(),l=b,g.debug.log("Manifest updated... set new data on buffers."),n&&(e=g.adapter.getEventsFor(l),n.addInlineEvents(e)),i;h>i;i+=1)f=d[i],c=g.adapter.getMediaInfoForType(a,l,f.getType()),f.setMediaInfo(c),this.adapter.updateData(f)};return{system:void 0,manifestModel:void 0,mediaSourceExt:void 0,sourceBufferExt:void 0,adapter:void 0,fragmentController:void 0,playbackController: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[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFERING_COMPLETED]=J,this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=K,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_ERROR]=H,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_METADATA_LOADED]=E,this[MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE]=t.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY]=r.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ADDED]=s.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ERROR]=u.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CREATED]=v.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_LOADED]=w.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_UNLOADED]=x.bind(this),this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CLOSED]=y.bind(this)},load:function(a){I.call(this,a)},setVideoModel:function(a){this.videoModel=a},initProtection:function(){this.capabilities.supportsEncryptedMedia()&&(this.protectionModel=this.system.getObject("protectionModel"),this.protectionModel.init(this.getVideoModel()),this.protectionModel.setMediaElement(this.videoModel.getElement()),this.protectionController=this.system.getObject("protectionController"),this.protectionController.init(this.protectionModel),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ADDED,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ERROR,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CREATED,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_LOADED,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_UNLOADED,this),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CLOSED,this))},getVideoModel:function(){return this.videoModel},setAutoPlay:function(a){e=a},getAutoPlay:function(){return e},reset:function(){p.call(this),this.protectionModel&&(this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ADDED,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ERROR,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CREATED,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_LOADED,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_UNLOADED,this),this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CLOSED,this),this.keySystem&&(this.keySystem.unsubscribe(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,this),this.keySystem=void 0),this.protectionController.teardown(),this.protectionModel.teardown(),this.protectionController=void 0,this.protectionModel=void 0),A.call(this),this.fragmentController=void 0,this.playbackController.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_ERROR,this),this.playbackController.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_METADATA_LOADED,this),this.playbackController.reset(),this.liveEdgeFinder.abortSearch(),this.liveEdgeFinder.unsubscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,this.playbackController),g=!1,m={}},getDuration:function(){return l.duration},getStartTime:function(){return l.start},getStreamIndex:function(){return l.index},getId:function(){return l.id},setStreamInfo:function(a){l=a},getStreamInfo:function(){return l},startEventController:function(){n.start()},resetEventController:function(){n.reset()},setPlaybackController:function(a){this.playbackController=a,a.initialize(l,this.videoModel)},getPlaybackController:function(){return this.playbackController},isUpdating:function(){return k},updateData:M,play:o,seek:q,pause:p}},MediaPlayer.dependencies.Stream.prototype={constructor:MediaPlayer.dependencies.Stream},MediaPlayer.dependencies.Stream.DATA_UPDATE_FAILED_ERROR_CODE=1,MediaPlayer.dependencies.Stream.eventList={ENAME_STREAM_UPDATED:"streamUpdated"},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(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,w),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADED,w),"video"===d||"audio"===d?(s.subscribe(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,w),s.subscribe(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,p),s.subscribe(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,q),r.subscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,this.timelineConverter),r.subscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,p),r.subscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,q),p.subscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_STARTED,q),p.subscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,q),p.subscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,s),p.subscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,b),j.streamProcessor||(j.streamProcessor=o,p.subscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,j)),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADED,w),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,q),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,q),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,w),i.subscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,q.scheduleRulesCollection.bufferLevelRule),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,h),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_CLEARED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED,p),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_INIT_REQUESTED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFERING_COMPLETED,b),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_QUOTA_EXCEEDED,q),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,q.scheduleRulesCollection.bufferLevelRule),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,q.scheduleRulesCollection.bufferLevelRule),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED,j),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS,w),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED,w),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED,w),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED,q),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,w),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,q),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED,q),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,q.scheduleRulesCollection.playbackTimeRule),a&&j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,p),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,w),j.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,q),u.subscribe(Dash.dependencies.BaseURLExtensions.eventList.ENAME_INITIALIZATION_LOADED,t),u.subscribe(Dash.dependencies.BaseURLExtensions.eventList.ENAME_SEGMENTS_LOADED,t)):w.subscribe(MediaPlayer.dependencies.TextController.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,q),t.initialize(this),w.initialize(d,g,k,o),q.initialize(d,this),n=this.getFragmentModel(),n.setLoader(v),n.subscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_STARTED,i),n.subscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,i),n.subscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_STREAM_COMPLETED,i),n.subscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,q),v.subscribe(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_LOADING_COMPLETED,n),("video"===d||"audio"===d)&&(w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,n),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,n),w.subscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_REJECTED,n)),p.initialize(this)},isUpdating:function(){return this.trackController.isUpdating()},getType:function(){return d},getFragmentLoader:function(){return this.fragmentLoader},getFragmentModel:function(){return this.scheduleController.getFragmentModel()},getPlaybackController:function(){return this.playbackController},getStreamInfo:function(){return b.getStreamInfo()},setMediaInfo:function(a){c=a},getMediaInfo:function(){return c},getScheduleController:function(){return this.scheduleController},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(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,d),i.unsubscribe(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,e),i.unsubscribe(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,f),g.unsubscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,this.timelineConverter),g.unsubscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,f),g.unsubscribe(MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED,e),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_STARTED,f),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,d),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,f),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,i),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,b),e.unsubscribe(Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED,j),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADED,d),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADED,d),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,f),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,f),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,d),h.unsubscribe(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,f.scheduleRulesCollection.bufferLevelRule),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,o),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_CLEARED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED,e),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_INIT_REQUESTED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFERING_COMPLETED,b),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,f),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,f.scheduleRulesCollection.bufferLevelRule),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,f.scheduleRulesCollection.bufferLevelRule),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED,j),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS,d),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED,d),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED,d),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED,f),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,d),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,f),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED,f),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,e),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,d),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,f),j.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,f.scheduleRulesCollection.playbackTimeRule),l.unsubscribe(Dash.dependencies.BaseURLExtensions.eventList.ENAME_INITIALIZATION_LOADED,k),l.unsubscribe(Dash.dependencies.BaseURLExtensions.eventList.ENAME_SEGMENTS_LOADED,k),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,m),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,m),d.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_REJECTED,m),m.unsubscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_STARTED,h),m.unsubscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,h),m.unsubscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_STREAM_COMPLETED,h),m.unsubscribe(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,f),n.unsubscribe(MediaPlayer.dependencies.FragmentLoader.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.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.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.dependencies.TimeSyncController=function(){"use strict";var a=5e3,b=0,c=!1,d=!1,e=function(a){c=a},f=function(){return c},g=function(a){d=a},h=function(a){b=a},i=function(){return b},j=function(a){var b,c,d=60,e=60,f=1e3,g=/^([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}))?/,h=g.exec(a);return b=Date.UTC(parseInt(h[1],10),parseInt(h[2],10)-1,parseInt(h[3],10),parseInt(h[4],10),parseInt(h[5],10),h[6]&&(parseInt(h[6],10)||0),h[7]&&parseFloat(h[7])*f||0),h[9]&&h[10]&&(c=parseInt(h[9],10)*e+parseInt(h[10],10),b+=("+"===h[8]?-1:1)*c*d*f),new Date(b).getTime()},k=function(a){var b=Date.parse(a);return isNaN(b)&&(b=j(a)),b},l=function(a){return Date.parse(a)},m=function(a){return Date.parse(a)},n=function(a,b,c){c()},o=function(a,b,c){var d=k(a);return isNaN(d)?void c():void b(d)},p=function(b,c,d,e,f){var g,h,i=!1,j=new XMLHttpRequest,k=f?"HEAD":"GET",l=c.match(/\S+/g);
c=l.shift(),g=function(){i||(i=!0,l.length?p(b,l.join(" "),d,e,f):e())},h=function(){var a,c;200===j.status&&(a=f?j.getResponseHeader("Date"):j.response,c=b(a),isNaN(c)||(d(c),i=!0))},j.open(k,c),j.timeout=a||0,j.onload=h,j.onloadend=g,j.send()},q=function(a,b,c){p.call(this,m,a,b,c,!0)},r={"urn:mpeg:dash:utc:http-head:2014":q,"urn:mpeg:dash:utc:http-xsdate:2014":p.bind(null,k),"urn:mpeg:dash:utc:http-iso:2014":p.bind(null,l),"urn:mpeg:dash:utc:direct:2014":o,"urn:mpeg:dash:utc:http-head:2012":q,"urn:mpeg:dash:utc:http-xsdate:2012":p.bind(null,k),"urn:mpeg:dash:utc:http-iso:2012":p.bind(null,l),"urn:mpeg:dash:utc:direct:2012":o,"urn:mpeg:dash:utc:http-ntp:2014":n,"urn:mpeg:dash:utc:ntp:2014":n,"urn:mpeg:dash:utc:sntp:2014":n},s=function(a,b){var c=this,d=b||0,f=a[d],g=function(a,b){var d=!a||!b;e(!1),c.notify(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,{time:a,offset:b},d?new MediaPlayer.vo.Error(MediaPlayer.dependencies.TimeSyncController.TIME_SYNC_FAILED_ERROR_CODE):null)};e(!0),f?r.hasOwnProperty(f.schemeIdUri)?r[f.schemeIdUri](f.value,function(a){var b=(new Date).getTime(),d=a-b;h(d),c.debug.log("Local time:      "+new Date(b)),c.debug.log("Server time:     "+new Date(a)),c.debug.log("Difference (ms): "+d),g.call(c,a,d)},function(){s.call(c,a,d+1)}):s.call(c,a,d+1):(h(0),g.call(c))};return{debug:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,getOffsetToDeviceTimeMs:function(){return i()},initialize:function(a){f()||(s.call(this,a),g(!0))},reset:function(){g(!1),e(!1)}}},MediaPlayer.dependencies.TimeSyncController.prototype={constructor:MediaPlayer.dependencies.TimeSyncController},MediaPlayer.dependencies.TimeSyncController.eventList={ENAME_TIME_SYNCHRONIZATION_COMPLETED:"timeSynchronizationComplete"},MediaPlayer.dependencies.TimeSyncController.TIME_SYNC_FAILED_ERROR_CODE=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.dependencies.AbrController=function(){"use strict";var a=!0,b={},c={},d={},e=function(a,b){var d;return c[b]=c[b]||{},c[b].hasOwnProperty(a)||(c[b][a]=0),d=c[b][a]},f=function(a,b,d){c[b]=c[b]||{},c[b][a]=d},g=function(a,b){var c;return d[b]=d[b]||{},d[b].hasOwnProperty(a)||(d[b][a]=0),c=d[b][a]},h=function(a,b,c){d[b]=d[b]||{},d[b][a]=c},i=function(a,c,d){b[c]=b[c]||{},b[c][a]=d},j=function(a,c){var d;return b[c]=b[c]||{},b[c].hasOwnProperty(a)||(b[c][a]=0),d=b[c][a]},k=function(a){if(!a.error){var b,c=this,d=this.adapter.convertDataToTrack(a.data.currentRepresentation).mediaInfo,e=d.type,f=d.streamInfo.id;b=d.trackCount-1,j(e,f)!==b&&(i(e,f,b),c.notify(MediaPlayer.dependencies.AbrController.eventList.ENAME_TOP_QUALITY_INDEX_CHANGED,{mediaType:e,streamInfo:d.streamInfo,maxIndex:b}))}};return{debug:void 0,adapter:void 0,abrRulesCollection:void 0,rulesController:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=k},getAutoSwitchBitrate:function(){return a},setAutoSwitchBitrate:function(b){a=b},getPlaybackQuality:function(b){var c,d,i,k,l=this,m=b.getType(),n=b.getStreamInfo().id,o=function(a){var g=j(m,n);c=a.value,k=a.confidence,0>c&&(c=0),c>g&&(c=g),d=e(m,n),c!==d&&(f(m,n,c),h(m,n,k),l.notify(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,{mediaType:m,streamInfo:b.getStreamInfo(),oldQuality:d,newQuality:c}))};c=e(m,n),k=g(m,n),a&&(i=l.abrRulesCollection.getRules(MediaPlayer.rules.ABRRulesCollection.prototype.QUALITY_SWITCH_RULES),l.rulesController.applyRules(i,b,o.bind(l),c,function(a,b){return a=a===MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE?0:a,Math.max(a,b)}))},setPlaybackQuality:function(a,c,d){var g=c.id,h=e(a,g),i=null!==d&&!isNaN(d)&&d%1===0;if(!i)throw"argument is not an integer";d!==h&&d>=0&&b[g].hasOwnProperty(a)&&d<=b[g][a]&&(f(a,c.id,d),this.notify(MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED,{mediaType:a,streamInfo:c,oldQuality:h,newQuality:d}))},getQualityFor:function(a,b){return e(a,b.id)},getConfidenceFor:function(a,b){return g(a,b.id)},isPlayingAtTopQuality:function(a){var b,c=this,d=a.id,e=c.getQualityFor("audio",a),f=c.getQualityFor("video",a);return b=e===j("audio",d)&&f===j("video",d)},reset:function(){a=!0,b={},c={},d={}}}},MediaPlayer.dependencies.AbrController.prototype={constructor:MediaPlayer.dependencies.AbrController},MediaPlayer.dependencies.AbrController.eventList={ENAME_QUALITY_CHANGED:"qualityChanged",ENAME_TOP_QUALITY_INDEX_CHANGED:"topQualityIndexChanged"},MediaPlayer.dependencies.BufferController=function(){"use strict";var a,b,c,d,e=.5,f=[],g=0,h=-1,i=!1,j=0,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 h>g&&(v(s,h)||v(a,h))?!1:h!==g},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){var c=this;a.data.fragmentModel===c.streamProcessor.getFragmentModel()&&(c.debug.log("Initialization finished loading: "+b),f[a.data.quality]=a.data.bytes,a.data.quality===g&&u.call(c)&&Z.call(c))},y=function(a){if(a.data.fragmentModel===this.streamProcessor.getFragmentModel()){var b,c=a.data.bytes,d=a.data.quality,e=a.data.index,f=this.streamProcessor.getFragmentModel().getExecutedRequestForQualityAndIndex(d,e),g=this.streamProcessor.getTrackForQuality(d),h=this.adapter.getEventsFor(g.mediaInfo,this.streamProcessor),i=this.adapter.getEventsFor(g,this.streamProcessor);(h.length>0||i.length>0)&&(b=C.call(this,c,f,h,i),this.streamProcessor.getEventController().addInbandEvents(b)),c=D.call(this,c),s.push({bytes:c,quality:d,index:e}),w(s,"index"),Q.call(this)}},z=function(a,b,c){r=!0,d={quality:b,index:c};var e=this,f=isNaN(c);return b!==g&&f||b!==h&&!f?void S.call(e,b,c):void e.sourceBufferExt.append(o,a)},A=function(c){if(o===c.data.buffer){this.isBufferingCompleted()&&this.streamProcessor.getStreamInfo().isLast&&this.mediaSourceExt.signalEndOfStream(a);var e,f=this;if(c.error)return c.error.code===MediaPlayer.dependencies.SourceBufferExtensions.QUOTA_EXCEEDED_ERROR_CODE&&(s.unshift({bytes:c.data.bytes,quality:d.quality,index:d.index}),l=.8*J.call(f),f.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_QUOTA_EXCEEDED,{criticalBufferLevel:l}),H.call(f)),void(r=!1);if(B.call(f),G.call(f)||(f.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_QUOTA_EXCEEDED,{criticalBufferLevel:l}),H.call(f)),e=f.sourceBufferExt.getAllRanges(o),e&&e.length>0){var g,h;for(g=0,h=e.length;h>g;g+=1)f.debug.log("Buffered "+b+" Range: "+e.start(g)+" - "+e.end(g))}R.call(f,d.quality,d.index),f.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED,{quality:d.quality,index:d.index,bufferedRanges:e})}},B=function(){var a=this,b=a.playbackController.getTime();return j=a.sourceBufferExt.getBufferLength(o,b),a.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED,{bufferLevel:j}),E.call(a),L.call(a),e>j&&N.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=j-a;d>=b&&!q?(q=!0,this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN)):b/2>d&&q&&(this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED),q=!1,Q.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,g=this;o&&(b=g.playbackController.getTime(),f=g.fragmentController.getExecutedRequestForTime(g.streamProcessor.getFragmentModel(),b),d=f&&!isNaN(f.startTime)?f.startTime:Math.floor(b),e=g.sourceBufferExt.getBufferRange(o,b),null===e&&o.buffered.length>0&&(d=o.buffered.end(o.buffered.length-1)),c=o.buffered.start(0),g.sourceBufferExt.remove(o,c,d,a))},I=function(a){o===a.data.buffer&&(B.call(this),this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_CLEARED,{from:a.data.from,to:a.data.to,hasEnoughSpaceToAppend: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&&!i&&(i=!0,this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFERING_COMPLETED))},L=function(){var a=this.playbackController.getTimeToStreamEnd();e>j&&a>c||c>=a&&!i?N.call(this,!1):N.call(this,!0)},M=function(){return p?MediaPlayer.dependencies.BufferController.BUFFER_LOADED:MediaPlayer.dependencies.BufferController.BUFFER_EMPTY},N=function(a){if(p!==a){p=a;var c=M();this.metricsModel.addBufferState(b,c,k),this.eventBus.dispatchEvent({type:c,data:{bufferType:b}}),this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED,{hasSufficientBuffer:a}),this.debug.log(p?"Got enough "+b+" buffer to start.":"Waiting for more "+b+" buffer before starting playback.")}},O=function(a){o.timestampOffset!==a&&(o.timestampOffset=a)},P=function(){var a=this,c=this.streamProcessor.getScheduleController().getFragmentToLoadCount(),d=this.streamProcessor.getCurrentTrack().fragmentDuration;B.call(a),k=c>0?c*d+j:k,this.metricsModel.addBufferState(b,M(),k),Q.call(a)},Q=function(){u.call(this)?Z.call(this):V.call(this)},R=function(a,b){r=!1,isNaN(b)?T.call(this,a):U.call(this,b),Q.call(this)},S=function(a,b){r=!1,this.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_REJECTED,{quality:a,index:b}),Q.call(this)},T=function(a){h=a},U=function(a){m=Math.max(a,m),K.call(this)},V=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))},W=function(a){if(!a.error){var b,d=this;O.call(d,a.data.currentRepresentation.MSETimeOffset),b=d.streamProcessor.getStreamInfo().manifestInfo.minBufferTime,c!==b&&(d.setMinBufferTime(b),d.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_MIN_BUFFER_TIME_UPDATED,{minBufferTime:b}))}},X=function(a){var b=this;a.data.fragmentModel===b.streamProcessor.getFragmentModel()&&(n=a.data.request.index,K.call(b))},Y=function(a){if(b===a.data.mediaType&&this.streamProcessor.getStreamInfo().id===a.data.streamInfo.id){var c=this,d=a.data.newQuality;g!==d&&(O.call(c,c.streamProcessor.getTrackForQuality(d).MSETimeOffset),g=d,u.call(c)&&Z.call(c))}},Z=function(){var a=this;if(f[g]){if(r)return;z.call(a,f[g],g)}else a.notify(MediaPlayer.dependencies.BufferController.eventList.ENAME_INIT_REQUESTED,{requiredQuality:g})},$=function(){Q.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,scheduleRulesCollection:void 0,debug:void 0,system:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=W,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADED]=x,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADED]=y,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED]=X,this[MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED]=Y,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS]=P,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING]=P,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED]=P,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED]=_,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED]=$,A=A.bind(this),I=I.bind(this),this.sourceBufferExt.subscribe(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,this,A),this.sourceBufferExt.subscribe(MediaPlayer.dependencies.SourceBufferExtensions.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 j},getMinBufferTime:function(){return c},setMinBufferTime:function(a){c=a},getCriticalBufferLevel:function(){return l},setMediaSource:function(b){a=b},isBufferingCompleted:function(){return i},reset:function(b){var e=this;f=[],l=Number.POSITIVE_INFINITY,p=null,c=null,h=-1,g=0,e.sourceBufferExt.unsubscribe(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,e,A),e.sourceBufferExt.unsubscribe(MediaPlayer.dependencies.SourceBufferExtensions.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=12,MediaPlayer.dependencies.BufferController.LOW_BUFFER_THRESHOLD=4,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.RICH_BUFFER_THRESHOLD=20,MediaPlayer.dependencies.BufferController.BUFFER_LOADED="bufferLoaded",MediaPlayer.dependencies.BufferController.BUFFER_EMPTY="bufferStalled",MediaPlayer.dependencies.BufferController.prototype={constructor:MediaPlayer.dependencies.BufferController},MediaPlayer.dependencies.BufferController.eventList={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"},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){var b=this,c=a.data.request;b.isInitializationRequest(c)?b.notify(MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADING_START,{request:c,fragmentModel:a.sender}):b.notify(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START,{request:c,fragmentModel:a.sender})},f=function(a){var b=this,c=a.data.request,d=b.process(a.data.response);return null===d?void b.debug.log("No "+c.mediaType+" bytes to push."):(b.isInitializationRequest(c)?b.notify(MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADED,{bytes:d,quality:c.quality,fragmentModel:a.sender}):b.notify(MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADED,{bytes:d,quality:c.quality,index:c.index,fragmentModel:a.sender}),void j.call(this))},g=function(a){this.notify(MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED,{request:a.data.request,fragmentModel:a.sender})},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,setup:function(){this[MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_STARTED]=e,this[MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED]=f,this[MediaPlayer.dependencies.FragmentModel.eventList.ENAME_STREAM_COMPLETED]=g,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED]=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.FragmentController.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"},MediaPlayer.dependencies.PlaybackController=function(){"use strict";var a,b,c,d,e=1e3,f=0,g=0/0,h=null,i=null,j=function(a){var b,c=parseInt(this.uriQueryFragModel.getURIFragmentData.s);return d?(!isNaN(c)&&c>1262304e3&&(b=c-a.manifestInfo.availableFrom.getTime()/1e3,(b>g||b<g-a.manifestInfo.DVRWindowSize)&&(b=null)),b=b||g):b=!isNaN(c)&&c<a.duration&&c>=0?c:a.start,b},k=function(b){var d,e=this,f=e.metricsModel.getMetricsFor(c.mediaInfo.type),g=e.metricsExt.getCurrentDVRInfo(f),h=g?g.range:null;return h?b>=h.start&&b<=h.end?b:d=Math.max(h.end-2*a.manifestInfo.minBufferTime,h.start):0/0},l=function(){if(null===h){var a=this,b=function(){C.call(a)};h=setInterval(b,e)}},m=function(){clearInterval(h),h=null},n=function(){var b=j.call(this,a);this.debug.log("Starting playback at offset: "+b),this.seek(b)},o=function(){if(!this.isPaused()&&d){var a=this.getTime(),b=k.call(this,a),c=!isNaN(b)&&b!==a;c&&this.seek(b)}},p=function(b){b.error||(c=this.adapter.convertDataToTrack(b.data.currentRepresentation),a=c.mediaInfo.streamInfo,d=b.sender.streamProcessor.isDynamic(),o.call(this))},q=function(a){a.error||0===b.getElement().readyState||n.call(this)},r=function(){b&&(b.unlisten("play",s),b.unlisten("pause",t),b.unlisten("error",B),b.unlisten("seeking",u),b.unlisten("seeked",v),b.unlisten("timeupdate",w),b.unlisten("progress",x),b.unlisten("ratechange",y),b.unlisten("loadedmetadata",z),b.unlisten("ended",A))},s=function(){o.call(this),l.call(this),this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED,{startTime:this.getTime()})},t=function(){this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PAUSED)},u=function(){l.call(this),this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,{seekTime:this.getTime()})},v=function(){this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKED)},w=function(){var a=this.getTime();a!==f&&(f=a,this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED,{timeToEnd:this.getTimeToStreamEnd()}))},x=function(){var c,d,e,f=b.getElement().buffered;f.length&&(c=f.length-1,d=f.end(c),e=j.call(this,a)+a.duration-d),this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS,{bufferedRanges:b.getElement().buffered,remainingUnbufferedDuration:e})},y=function(){this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED)},z=function(){this.debug.log("Got loadmetadata event."),(!d||this.timelineConverter.isTimeSyncCompleted())&&n.call(this),this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_METADATA_LOADED),l.call(this)},A=function(){this.debug.log("Got ended event."),m.call(this)},B=function(a){this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_ERROR,{error:a.srcElement.error})},C=function(){this.notify(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED,{isDynamic:d,time:new Date})},D=function(b){var d,e,f=b.data.bufferedRanges,g=i,h=j.call(this,a);f&&f.length&&(d=f.start(0),i=null===i?d:Math.max(i,d),g!==i&&(e=this.adapter.getFragmentRequestForTime(b.sender.streamProcessor,c,h,{keepIdx:!1}),e&&e.index===b.data.index&&this.seek(i)))},E=function(a){b=a,b.listen("play",s),b.listen("pause",t),b.listen("error",B),b.listen("seeking",u),b.listen("seeked",v),b.listen("timeupdate",w),b.listen("progress",x),b.listen("ratechange",y),b.listen("loadedmetadata",z),b.listen("ended",A)};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,setup:function(){this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=p,this[MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED]=q,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED]=D,s=s.bind(this),t=t.bind(this),B=B.bind(this),u=u.bind(this),v=v.bind(this),w=w.bind(this),x=x.bind(this),y=y.bind(this),z=z.bind(this),A=A.bind(this)},initialize:function(c,d){a=c,b!==d&&(r.call(this),E.call(this,d))},getTimeToStreamEnd:function(){var c=b.getCurrentTime();return j.call(this,a)+a.duration-c},getStreamId:function(){return a.id},getStreamDuration:function(){return a.duration},getTime:function(){return b.getCurrentTime()},getPlaybackRate:function(){return b.getPlaybackRate()},setLiveStartTime:function(a){g=a},getLiveStartTime:function(){return g},start:function(){b.play()},isPaused:function(){return b.isPaused()},pause:function(){b&&b.pause()},isSeeking:function(){return b.getElement().seeking},seek:function(a){a!==this.getTime()&&b.setCurrentTime(a)},reset:function(){m.call(this),r.call(this),b=null,a=null,f=0,g=0/0,i=null}}},MediaPlayer.dependencies.PlaybackController.prototype={constructor:MediaPlayer.dependencies.PlaybackController},MediaPlayer.dependencies.PlaybackController.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"},MediaPlayer.dependencies.ProtectionController=function(){"use strict";var a=null,b=function(a){if(a.error)this.debug.log(a.error);else{var b=a.data;this.protectionModel.keySystem.doLicenseRequest(b.message,b.defaultURL,b.sessionToken)}};return{system:void 0,debug:void 0,protectionExt:void 0,setup:function(){this[MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_MESSAGE]=b.bind(this)},init:function(b){this.protectionModel=b,a=this.protectionExt.getKeySystems(),this.protectionModel.subscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_MESSAGE,this)},teardown:function(){this.protectionModel.unsubscribe(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_MESSAGE,this)},selectKeySystem:function(a,b){this.protectionExt.autoSelectKeySystem(a,b)},createKeySession:function(a,b){this.protectionModel.createKeySession(a,b,"cenc")},updateKeySession:function(a,b){this.protectionModel.updateKeySession(a,b)}}},MediaPlayer.dependencies.ProtectionController.prototype={constructor:MediaPlayer.dependencies.ProtectionController},MediaPlayer.dependencies.ScheduleController=function(){"use strict";var a,b,c,d,e,f=0,g=!0,h=null,i=0,j=!1,k=null,l=null,m=!0,n=function(a,b){var c=0,d=null;m===!1&&(d=l.start,c=a.getTime()-d.getTime(),l.duration=c,l.stopreason=b,m=!0)},o=function(){b&&(j=!1,g&&(g=!1),this.debug.log("ScheduleController "+a+" start."),x.call(this))},p=function(){g&&(s.call(this,e.quality),L.call(this,MediaPlayer.vo.metrics.PlayList.INITIAL_PLAY_START_REASON)),o.call(this)},q=function(b){j||(j=!0,this.debug.log("ScheduleController "+a+" stop."),b&&this.fragmentController.cancelPendingRequestsForModel(c),n(new Date,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON))},r=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})},s=function(a){var b,c=this;return b=c.adapter.getInitRequest(c.streamProcessor,a),null!==b&&c.fragmentController.prepareFragmentForLoading(c,b),b},t=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 a=a===MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE?0:a,Math.max(a,b)})},u=function(a){var b,c,d,f=a.length,g=.1;for(d=0;f>d;d+=1)b=a[d],c=b.startTime+b.duration/2+g,b=this.adapter.getFragmentRequestForTime(this.streamProcessor,e,c,{timeThreshold:0}),this.fragmentController.prepareFragmentForLoading(this,b)},v=function(a){var b=this;return f=a.value,0>=f?void b.fragmentController.executePendingRequests():void r.call(b,w.bind(b))},w=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)):this.fragmentController.executePendingRequests()},x=function(){var a=(new Date).getTime(),b=h?a-h>this.fragmentController.getLoadingTime(this):!0,c=1e3;a-i>c&&(i=a,this.abrController.getPlaybackQuality(this.streamProcessor)),!b||j||this.playbackController.isPaused()&&(!this.scheduleWhilePaused||d)||(h=a,t.call(this,v.bind(this)))},y=function(){var b=this;null!==a&&""!==a&&b.metricsModel.clearCurrentMetricsForType(a)},z=function(a){a.error||(e=this.adapter.convertDataToTrack(a.data.currentRepresentation),d||(b=!0),b&&p.call(this))},A=function(b){b.data.fragmentModel===this.streamProcessor.getFragmentModel()&&(this.debug.log(a+" Stream is complete."),n(new Date,MediaPlayer.vo.metrics.PlayList.Trace.END_OF_CONTENT_STOP_REASON))},B=function(a){var b=this;a.data.fragmentModel===b.streamProcessor.getFragmentModel()&&x.call(b)},C=function(a){a.error&&q.call(this)},D=function(){M.call(this)},E=function(){q.call(this,!1)},F=function(a){s.call(this,a.data.requiredQuality)},G=function(a){this.fragmentController.removeExecutedRequestsBeforeTime(c,a.data.to),a.data.hasEnoughSpaceToAppend&&o.call(this)},H=function(b){var c=this;b.data.hasSufficientBuffer||c.playbackController.isSeeking()||(c.debug.log("Stalling "+a+" Buffer: "+a),n(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON))},I=function(b){var c=this;
c.metricsModel.addBufferLevel(a,new Date,b.data.bufferLevel),x.call(this)},J=function(){q.call(this,!1)},K=function(b){if(a===b.data.mediaType&&this.streamProcessor.getStreamInfo().id===b.data.streamInfo.id){var d,f=this;if(d=c.cancelPendingRequests(b.data.oldQuality),e=f.streamProcessor.getTrackForQuality(b.data.newQuality),null===e||void 0===e)throw"Unexpected error!";u.call(f,d),n(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REPRESENTATION_SWITCH_STOP_REASON)}},L=function(b){var c=new Date,d=this.playbackController.getTime();n(c,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON),k=this.metricsModel.addPlayList(a,c,d,b)},M=function(){var a=this,b=a.playbackController.getTime(),c=a.playbackController.getPlaybackRate(),d=new Date;m===!0&&e&&k&&(m=!1,l=a.metricsModel.appendPlayListTrace(k,e.id,null,d,b,null,c,null))},N=function(a){var b=this,d=s.call(b,a.data.CCIndex);c.executeRequest(d)},O=function(){o.call(this)},P=function(b){g||this.fragmentController.cancelPendingRequestsForModel(c);var d=this.metricsModel.getMetricsFor("stream"),f=this.metricsExt.getCurrentManifestUpdate(d);this.debug.log("ScheduleController "+a+" seek: "+b.data.seekTime),L.call(this,MediaPlayer.vo.metrics.PlayList.SEEK_START_REASON),this.metricsModel.updateManifestUpdateInfo(f,{latency:e.DVRWindow.end-this.playbackController.getTime()})},Q=function(){M.call(this)},R=function(){x.call(this)},S=function(a){if(!a.error){var c,d,f=this,g=a.data.liveEdge,h=e.mediaInfo.streamInfo.manifestInfo,i=g-Math.min(2*h.minBufferTime,h.DVRWindowSize/2),j=f.metricsModel.getMetricsFor("stream"),k=f.metricsExt.getCurrentManifestUpdate(j),l=f.playbackController.getLiveStartTime();c=f.adapter.getFragmentRequestForTime(f.streamProcessor,e,i),d=c.startTime,(isNaN(l)||d>l)&&f.playbackController.setLiveStartTime(d),f.metricsModel.updateManifestUpdateInfo(k,{currentTime:d,presentationStartTime:g,latency:g-d,clientTimeOffset:f.timelineConverter.getClientTimeOffset()}),b=!0,p.call(f)}};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,setup:function(){this[MediaPlayer.dependencies.LiveEdgeFinder.eventList.ENAME_LIVE_EDGE_SEARCH_COMPLETED]=S,this[MediaPlayer.dependencies.AbrController.eventList.ENAME_QUALITY_CHANGED]=K,this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_STARTED]=E,this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=z,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_MEDIA_FRAGMENT_LOADING_START]=B,this[MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED]=C,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED]=A,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_CLEARED]=G,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_APPENDED]=D,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_STATE_CHANGED]=H,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_UPDATED]=I,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_INIT_REQUESTED]=F,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_QUOTA_EXCEEDED]=J,this[MediaPlayer.dependencies.TextController.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED]=N,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED]=O,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING]=P,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_RATE_CHANGED]=Q,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_WALLCLOCK_TIME_UPDATED]=R},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},getFragmentToLoadCount:function(){return f},reset:function(){var a=this;q.call(a,!0),a.bufferController.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN,a.scheduleRulesCollection.bufferLevelRule),a.bufferController.unsubscribe(MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED,a.scheduleRulesCollection.bufferLevelRule),a.fragmentController.abortRequestsForModel(c),a.fragmentController.detachModel(c),y.call(a),f=0},start:o,stop:q}},MediaPlayer.dependencies.ScheduleController.prototype={constructor:MediaPlayer.dependencies.ScheduleController},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.getElement(),d=b.getElement();d.parentNode||c.parentNode.insertBefore(d,c),c.style.width="0px",d.style.width="100%",m(c,d)},k=function(a){var b=a.getPlaybackController();b.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED,this.manifestUpdater),b.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PAUSED,this.manifestUpdater),b.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,this),b.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED,this),b.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS,this)},l=function(a){var b=this,c=a.getPlaybackController();setTimeout(function(){c.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_STARTED,b.manifestUpdater),c.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PAUSED,b.manifestUpdater),c.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING,b),c.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED,b),c.unsubscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS,b)},1)},m=function(a,b){["controls","loop","muted","volume"].forEach(function(c){b[c]=a[c]})},n=function(a){!a.data.remainingUnbufferedDuration||a.data.remainingUnbufferedDuration>=c||q()},o=function(b){var c=this,e=c.videoExt.getPlaybackQuality(a.getVideoModel().getElement());e&&c.metricsModel.addDroppedFrames("video",e),r()&&(a.getVideoModel().getElement().seeking||b.data.timeToEnd<d&&v.call(this,a,r()))},p=function(b){var c=s(b.data.seekTime);c&&c!==a&&v.call(this,a,c,b.data.seekTime)},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.getVideoModel(),c.getVideoModel()),l.call(this,b),k.call(this,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),q=a?a.getVideoModel():m.getVideoModel();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:q.getCurrentTime(),buffered:q.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(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_ERROR,l),c.subscribe(MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_METADATA_LOADED,l),l.initProtection(),l.setAutoPlay(e),l.load(n),l.subscribe(MediaPlayer.dependencies.Stream.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(MediaPlayer.dependencies.Stream.eventList.ENAME_STREAM_UPDATED,this.liveEdgeFinder))}catch(r){m.errHandler.manifestError(r.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(MediaPlayer.dependencies.StreamController.eventList.ENAME_STREAMS_COMPOSED)},y=function(){w.call(this)},z=function(a){a.error?this.reset():(this.manifestModel.setValue(a.data.manifest),this.debug.log("Manifest has loaded."),this.timeSyncController.initialize(this.manifestExt.getUTCTimingSources(a.data.manifest)))};return{system:void 0,videoModel:void 0,manifestLoader:void 0,manifestUpdater:void 0,manifestModel:void 0,manifestExt:void 0,adapter:void 0,debug:void 0,metricsModel:void 0,metricsExt:void 0,videoExt:void 0,liveEdgeFinder:void 0,timelineConverter:void 0,protectionExt:void 0,timeSyncController:void 0,errHandler:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this[MediaPlayer.dependencies.ManifestLoader.eventList.ENAME_MANIFEST_LOADED]=z,this[MediaPlayer.dependencies.Stream.eventList.ENAME_STREAM_UPDATED]=x,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING]=p,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_PROGRESS]=n,this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_TIME_UPDATED]=o,this[MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED]=y},setAutoPlay:function(a){e=a},getAutoPlay:function(){return e},setProtectionData:function(a){this.protectionExt.init(a)},getVideoModel:function(){return this.videoModel},setVideoModel:function(a){this.videoModel=a},getActiveStreamInfo:function(){return a?a.getStreamInfo():null},initialize:function(){this.timeSyncController.subscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this.timelineConverter),this.timeSyncController.subscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this.liveEdgeFinder),this.timeSyncController.subscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this)},load:function(a){this.manifestLoader.load(a)},reset:function(){a&&(l.call(this,a),a.getVideoModel()!==this.getVideoModel()&&j.call(this,a.getVideoModel(),this.getVideoModel())),this.timeSyncController.unsubscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this.timelineConverter),this.timeSyncController.unsubscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this.liveEdgeFinder),this.timeSyncController.unsubscribe(MediaPlayer.dependencies.TimeSyncController.eventList.ENAME_TIME_SYNCHRONIZATION_COMPLETED,this),this.timeSyncController.reset();for(var c=0,d=b.length;d>c;c++){var e=b[c];e.unsubscribe(MediaPlayer.dependencies.Stream.eventList.ENAME_STREAM_UPDATED,this),e.reset(),e.getVideoModel()!==this.getVideoModel()&&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.StreamController.eventList={ENAME_STREAMS_COMPOSED:"streamsComposed"},MediaPlayer.dependencies.TextController=function(){var a,b,c,d=!1,e=function(){d||(b.hasOwnProperty("initialize")&&b.initialize(c,this),d=!0),this.notify(MediaPlayer.dependencies.TextController.eventList.ENAME_CLOSED_CAPTIONING_REQUESTED,{CCIndex:0})},f=function(a){var c=this;a.data.fragmentModel===c.streamProcessor.getFragmentModel()&&null!==a.data.bytes&&c.sourceBufferExt.append(b,a.data.bytes,c.videoModel)};return{sourceBufferExt:void 0,debug:void 0,system:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,setup:function(){this[Dash.dependencies.RepresentationController.eventList.ENAME_DATA_UPDATE_COMPLETED]=e,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_INIT_FRAGMENT_LOADED]=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.TextController.eventList={ENAME_CLOSED_CAPTIONING_REQUESTED:"closedCaptioningRequested"},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";var c=window.URL.createObjectURL(a);return b.setSource(c),c},detachMediaSource:function(a){"use strict";a.setSource("")},setDuration:function(a,b){"use strict";return a.duration=b,a.duration},signalEndOfStream:function(a){"use strict";var b=a.sourceBuffers,c=b.length,d=0;if("open"===a.readyState){for(d;c>d;d+=1)if(b[d].updating)return;a.endOfStream()}}},MediaPlayer.dependencies.ProtectionExtensions=function(){"use strict";var a,b=[];return{system:void 0,debug:void 0,setup:function(){var c;c=this.system.getObject("ksPlayReady"),b.push(c),c=this.system.getObject("ksWidevine"),b.push(c),c=this.system.getObject("ksClearKey"),b.push(c),a=c},init:function(a){for(var c=(function(b){var c=null;return a&&(c=b in a?a[b]:null),c}),d=0;d<b.length;d++){var e=b[d];e.init(c(e.systemString))}},getKeySystems:function(){return b},isClearKey:function(b){return b===a},autoSelectKeySystem:function(a,c,d){var e,f,g,h,i=null;for(e=0;e<b.length;++e)for(f=0;f<c.contentProtection.length;++f)if(g=c.contentProtection[f],a.isSupported(b[e],c.codec)&&g.schemeIdUri.toLowerCase()===b[e].schemeIdURI){if(h=b[e].getInitData(g),!h)continue;i=b[e],a.selectKeySystem(i);break}if(!i&&(g=MediaPlayer.dependencies.protection.CommonEncryption.findCencContentProtection(c.contentProtection))){this.debug.log("CommonEncryption detected in MPD.  Searching initData for supported key systems...");var j=MediaPlayer.dependencies.protection.CommonEncryption.parsePSSHList(d);for(e=0;e<b.length;++e)if(b[e].uuid in j&&a.isSupported(b[e],c.codec)){i=b[e],h=j[b[e].uuid],a.selectKeySystem(i);break}}if(!i)throw new Error("DRM: The protection system for this content is not supported.");return this.debug.log("Selected key system -- "+i.systemString),h}}},MediaPlayer.dependencies.ProtectionExtensions.prototype={constructor:MediaPlayer.dependencies.ProtectionExtensions},MediaPlayer.dependencies.RequestModifierExtensions=function(){"use strict";return{modifyRequestURL:function(a){return a},modifyRequestHeader:function(a){return a}}},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},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(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,{buffer:a,bytes:b})})})}catch(e){c.notify(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_APPEND_COMPLETED,{buffer:a,bytes:b},new MediaPlayer.vo.Error(e.code,e.message,null))}},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(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,{buffer:a,from:b,to:c})})}catch(f){e.notify(MediaPlayer.dependencies.SourceBufferExtensions.eventList.ENAME_SOURCEBUFFER_REMOVE_COMPLETED,{buffer:a,from:b,to:c},new MediaPlayer.vo.Error(f.code,f.message,null))}},abort:function(a,b){"use strict";try{"open"===a.readyState&&b.abort()}catch(c){}}},MediaPlayer.dependencies.SourceBufferExtensions.QUOTA_EXCEEDED_ERROR_CODE=22,MediaPlayer.dependencies.SourceBufferExtensions.eventList={ENAME_SOURCEBUFFER_REMOVE_COMPLETED:"sourceBufferRemoveCompleted",ENAME_SOURCEBUFFER_APPEND_COMPLETED:"sourceBufferAppendCompleted"},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.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.dependencies.FragmentModel=function(){"use strict";var a,b=[],c=[],d=[],e=[],f=!1,g=function(a){var b=this;b.notify(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_STARTED,{request: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=.001,f=0/0,g=0/0,h=null;for(c=d;c>=0;c-=1)if(h=a[c],f=h.startTime,g=f+h.duration,!isNaN(f)&&!isNaN(g)&&b+e>=f&&g>b||isNaN(f)&&isNaN(b))return h;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){var c=a.data.request,e=a.data.response,f=a.error;d.splice(d.indexOf(c),1),e&&!f&&b.push(c),j.call(this,c,f?MediaPlayer.vo.metrics.SchedulingInfo.FAILED_STATE:MediaPlayer.vo.metrics.SchedulingInfo.EXECUTED_STATE),this.notify(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_FRAGMENT_LOADING_COMPLETED,{request:c,response:e},f)},l=function(a){var b=this.getExecutedRequestForQualityAndIndex(a.data.quality,a.data.index);b&&(this.removeExecutedRequest(b),isNaN(a.data.index)||(e.push(b),j.call(this,b,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,setup:function(){this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN]=m,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED]=n,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BYTES_REJECTED]=l,this[MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_LOADING_COMPLETED]=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(MediaPlayer.dependencies.FragmentModel.eventList.ENAME_STREAM_COMPLETED,{request: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.FragmentModel.eventList={ENAME_STREAM_COMPLETED:"streamCompleted",ENAME_FRAGMENT_LOADING_STARTED:"fragmentLoadingStarted",ENAME_FRAGMENT_LOADING_COMPLETED:"fragmentLoadingCompleted"},MediaPlayer.models.ManifestModel=function(){"use strict";var a;return{system:void 0,eventBus:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,getValue:function(){return a},setValue:function(b){a=b,this.eventBus.dispatchEvent({type:"manifestLoaded",data:b}),this.notify(MediaPlayer.models.ManifestModel.eventList.ENAME_MANIFEST_UPDATED,{manifest:b})}}},MediaPlayer.models.ManifestModel.prototype={constructor:MediaPlayer.models.ManifestModel},MediaPlayer.models.ManifestModel.eventList={ENAME_MANIFEST_UPDATED:"manifestUpdated"},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,m){var n=new MediaPlayer.vo.metrics.HTTPRequest;return n.stream=a,n.tcpid=b,n.type=c,n.url=d,n.actualurl=e,n.range=f,n.trequest=g,n.tresponse=h,n.tfinish=i,n.responsecode=j,n.interval=k,n.mediaduration=l,n.responseHeaders=m,this.getMetricsFor(a).HttpList.push(n),this.metricAdded(a,this.adapter.metricsList.HTTP_REQUEST,n),n},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},addBufferState:function(a,b,c){var d=new MediaPlayer.vo.metrics.BufferState;return d.target=c,d.state=b,this.getMetricsFor(a).BufferState.push(d),this.metricAdded(a,this.adapter.metricsList.BUFFER_STATE,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.models.ProtectionModel={},MediaPlayer.models.ProtectionModel.eventList={ENAME_NEED_KEY:"needkey",ENAME_KEY_MESSAGE:"keyMessage",ENAME_KEY_ADDED:"keyAdded",ENAME_KEY_ERROR:"keyError",ENAME_KEY_SESSION_CREATED:"keySessionCreated",ENAME_KEY_SESSION_LOADED:"keySessionLoaded",ENAME_KEY_SESSION_UNLOADED:"keySessionUnloaded",ENAME_KEY_SESSION_CLOSED:"keySessionClosed"},MediaPlayer.models.ProtectionModel_01b=function(){var a,b=null,c=null,d=[],e=[],f=function(){var b=this;return{handleEvent:function(f){var g=null;switch(f.type){case c.needkey:b.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY,new MediaPlayer.vo.protection.NeedKey(f.initData));break;case c.keyerror:if(g=h(e,f.sessionId),g||(g=h(d,f.sessionId)),g){var i="";switch(f.errorCode.code){case 1:i+="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:i+="MEDIA_KEYERR_CLIENT - The Key System could not be installed or updated.";break;case 3:i+="MEDIA_KEYERR_SERVICE - The message passed into update indicated an error from the license service.";break;case 4:i+="MEDIA_KEYERR_OUTPUT - There is no available output device with the required characteristics for the content protection system.";break;case 5:i+="MEDIA_KEYERR_HARDWARECHANGE - A hardware configuration change caused a content protection error.";break;case 6:i+="MEDIA_KEYERR_DOMAIN - An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain."}i+="  System Code = "+f.systemCode,b.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ERROR,new MediaPlayer.vo.protection.KeyError(g,i))}else b.debug.log("No session token found for key error");break;case c.keyadded:g=h(e,f.sessionId),g||(g=h(d,f.sessionId)),g?b.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ADDED,g):b.debug.log("No session token found for key added");break;case c.keymessage:a=null!==f.sessionId&&void 0!==f.sessionId,a?(g=h(e,f.sessionId),g||(g=d.shift(),e.push(g),g.sessionID=f.sessionId)):(g=d.shift(),e.push(g),0!==d.length&&b.errHandler.mediaKeyMessageError("Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!")),g?(g.keyMessage=f.message,b.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_MESSAGE,new MediaPlayer.vo.protection.KeyMessage(g,f.message,f.defaultURL))):b.debug.log("No session token found for key message")
}}}},g=null,h=function(a,b){if(b&&a){for(var c=a.length,d=0;c>d;d++)if(a[d].sessionID==b)return a[d];return null}return null},i=function(){b.removeEventListener(c.keyerror,g),b.removeEventListener(c.needkey,g),b.removeEventListener(c.keymessage,g),b.removeEventListener(c.keyadded,g)};return{system:void 0,debug:void 0,errHandler:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,protectionExt:void 0,keySystem:null,setup:function(){g=f.call(this)},init:function(){var a=document.createElement("video");c=MediaPlayer.models.ProtectionModel_01b.detect(a)},teardown:function(){b&&i();for(var a=0;a<e.length;a++)this.closeKeySession(e[a])},isSupported:function(a,c){return""!==b.canPlayType(c,a.systemString)},selectKeySystem:function(a){this.keySystem=a},setMediaElement:function(a){b&&i(),b=a,b.addEventListener(c.keyerror,g),b.addEventListener(c.needkey,g),b.addEventListener(c.keymessage,g),b.addEventListener(c.keyadded,g)},createKeySession:function(f){if(!this.keySystem)throw new Error("Can not create sessions until you have selected a key system");if(a||0===e.length){var g={prototype:(new MediaPlayer.models.SessionToken).prototype,sessionID:null,initData:f};return d.push(g),b[c.generateKeyRequest](this.keySystem.systemString,f),g}throw new Error("Multiple sessions not allowed!")},updateKeySession:function(a,d){var e=a.sessionID;if(this.protectionExt.isClearKey(this.keySystem))for(var f=0;f<d.keyPairs.length;f++)b[c.addKey](this.keySystem.systemString,d.keyPairs[f].key,d.keyPairs[f].keyID,e);else b[c.addKey](this.keySystem.systemString,d,a.initData,e)},closeKeySession:function(a){b[c.cancelKeyRequest](this.keySystem.systemString,a.sessionID)},setServerCertificate:function(){}}},MediaPlayer.models.ProtectionModel_01b.prototype={constructor:MediaPlayer.models.ProtectionModel_01b},MediaPlayer.models.ProtectionModel_01b.APIs=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],MediaPlayer.models.ProtectionModel_01b.detect=function(a){for(var b=MediaPlayer.models.ProtectionModel_01b.APIs,c=0;c<b.length;c++){var d=b[c];if("function"==typeof a[d.generateKeyRequest]&&"function"==typeof a[d.addKey]&&"function"==typeof a[d.cancelKeyRequest])return d}return null},MediaPlayer.models.ProtectionModel_3Feb2014=function(){var a=null,b=null,c=null,d=[],e=function(){var a=this;return{handleEvent:function(b){switch(b.type){case c.needkey:a.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY,new MediaPlayer.vo.protection.NeedKey(b.initData))}}}},f=null,g=function(a,b){var d=this;return{prototype:(new MediaPlayer.models.SessionToken).prototype,session:a,sessionID:a.sessionId,initData:b,handleEvent:function(a){switch(a.type){case c.error:var b="KeyError";d.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ERROR,new MediaPlayer.vo.protection.KeyError(this,b));break;case c.message:d.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_MESSAGE,new MediaPlayer.vo.protection.KeyMessage(this,a.message,a.destinationURL));break;case c.ready:d.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_ADDED,this);break;case c.close:d.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_KEY_SESSION_CLOSED,this)}}}};return{system:void 0,notify:void 0,subscribe:void 0,unsubscribe:void 0,protectionExt:void 0,keySystem:null,setup:function(){f=e.call(this)},init:function(){var a=document.createElement("video");c=MediaPlayer.models.ProtectionModel_3Feb2014.detect(a)},teardown:function(){a&&a.removeEventListener(c.needkey,f);for(var b=0;b<d.length;b++)this.closeKeySession(d[b])},isSupported:function(a,b){return window[c.MediaKeys].isTypeSupported(a.systemString,b)},selectKeySystem:function(d){this.keySystem=d,b=new window[c.MediaKeys](this.keySystem.systemString),a&&a[c.setMediaKeys](b)},setMediaElement:function(d){a&&a.removeEventListener(c.needkey,f().bind(this)),a=d,a.addEventListener(c.needkey,f),b&&a[c.setMediaKeys](b)},createKeySession:function(a,e){if(!this.keySystem||!b)throw new Error("Can not create sessions until you have selected a key system");var f=b.createSession(e,a),h=g.call(this,f,a);return f.addEventListener(c.error,h),f.addEventListener(c.message,h),f.addEventListener(c.ready,h),f.addEventListener(c.close,h),d.push(h),h},updateKeySession:function(a,b){var c=a.session;c.update(this.protectionExt.isClearKey(this.keySystem)?b.toJWKString():b)},closeKeySession:function(a){var b=a.session;b.removeEventListener(c.error,a),b.removeEventListener(c.message,a),b.removeEventListener(c.ready,a),b.removeEventListener(c.close,a);for(var e=0;e<d.length;e++)if(d[e]===a){d.splice(e,1);break}b[c.release]()}}},MediaPlayer.models.ProtectionModel_3Feb2014.APIs=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}],MediaPlayer.models.ProtectionModel_3Feb2014.detect=function(a){for(var b=MediaPlayer.models.ProtectionModel_3Feb2014.APIs,c=0;c<b.length;c++){var d=b[c];if("function"==typeof a[d.setMediaKeys]&&"function"==typeof window[d.MediaKeys])return d}return null},MediaPlayer.models.ProtectionModel_3Feb2014.prototype={constructor:MediaPlayer.models.ProtectionModel_3Feb2014},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:function(){return a},getURIQueryData:function(){return 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){var b=a.sender.streamProcessor.getType();f.call(this,b,!a.data.hasSufficientBuffer)};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.protection.CommonEncryption={findCencContentProtection:function(a){for(var b=null,c=0;c<a.length;++c){var d=a[c];"urn:mpeg:dash:mp4protection:2011"===d.schemeIdUri.toLowerCase()&&"cenc"===d.value.toLowerCase()&&(b=d)}return b},getPSSHData:function(a){return new Uint8Array(a.buffer.slice(32))},parsePSSHList:function(a){if(null===a)return[];for(var b=new DataView(a.buffer),c=!1,d={},e=0;!c;){var f,g,h,i,j,k=e;if(e>=b.buffer.byteLength)break;if(f=b.getUint32(e),g=e+f,e+=4,1886614376===b.getUint32(e))if(e+=4,h=b.getUint8(e),0===h){e+=1,e+=3,i="";var l,m;for(l=0;4>l;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=4,i+="-",l=0;2>l;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;2>l;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;2>l;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;for(e+=2,i+="-",l=0;6>l;l++)m=b.getUint8(e+l).toString(16),i+=1===m.length?"0"+m:m;e+=6,i=i.toLowerCase(),j=b.getUint32(e),e+=4,d[i]=new Uint8Array(b.buffer.slice(k,g)),e=g}else e=g;else e=g}return d}},MediaPlayer.dependencies.protection.KeySystem={eventList:{ENAME_LICENSE_REQUEST_COMPLETE:"licenseRequestComplete"}},MediaPlayer.dependencies.protection.KeySystem_Access=function(){"use strict"},MediaPlayer.dependencies.protection.KeySystem_Access.prototype={constructor:MediaPlayer.dependencies.protection.KeySystem_Access},MediaPlayer.dependencies.protection.KeySystem_ClearKey=function(){"use strict";var a,b="webkit-org.w3.clearkey",c="10000000-0000-0000-0000-000000000000",d=function(a,b){var c,d,e=MediaPlayer.dependencies.protection.CommonEncryption.getPSSHData(a),f=new DataView(e.buffer),g=0,h=[];if(d=f.getUint8(g),g+=1,0===d){var i="",j="",k=f.getUint16(g);for(g+=2,c=0;k>c;c++)j+=String.fromCharCode(f.getUint8(g+c));i=atob(j),i=i.replace(/&amp;/,"&");var l=new XMLHttpRequest;l.onload=function(){if(200==l.status){for(l.response.hasOwnProperty("keys")||this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error("DRM: ClearKey Remote update, Illegal response JSON")),c=0;c<l.reponse.keys.length;c++){var a=l.response.keys[c],d=atob(a.kid),e=atob(a.k);h.push(new MediaPlayer.vo.protection.KeyPair(d,e))}var f=new MediaPlayer.vo.protection.LicenseRequestComplete(new MediaPlayer.vo.protection.ClearKeyKeySet(h),b);this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,f)}else this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: ClearKey Remote update, XHR aborted. status is "'+l.statusText+'" ('+l.status+"), readyState is "+l.readyState))},l.onabort=function(){this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: ClearKey update, XHR aborted. status is "'+l.statusText+'" ('+l.status+"), readyState is "+l.readyState))},l.onerror=function(){this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: ClearKey update, XHR error. status is "'+l.statusText+'" ('+l.status+"), readyState is "+l.readyState))},l.open("GET",i),l.responseType="json",l.send()}else if(1===d){var m=f.getUint8(g);for(g+=1,c=0;m>c;c++){var n,o;n=new Uint8Array(e.buffer.slice(g,g+16)),g+=16,o=new Uint8Array(e.buffer.slice(g,g+16)),g+=16,h.push(new MediaPlayer.vo.protection.KeyPair(n,o))}var p=new MediaPlayer.vo.protection.LicenseRequestComplete(new MediaPlayer.vo.protection.ClearKeyKeySet(h),b);this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,p)}else this.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error("DRM: Illegal ClearKey type: "+d))};return{schemeIdURI:void 0,systemString:b,uuid:c,notify:void 0,subscribe:void 0,unsubscribe:void 0,init:function(b){this.schemeIdURI="urn:uuid:"+c,a=b},doLicenseRequest:function(a,b,c){d.call(this,a,c)},getInitData:function(){return null},initDataEquals:function(a,b){return a.length===b.length&&btoa(a.buffer)===btoa(b.buffer)?!0:!1}}},MediaPlayer.dependencies.protection.KeySystem_ClearKey.prototype={constructor:MediaPlayer.dependencies.protection.KeySystem_ClearKey},MediaPlayer.dependencies.protection.KeySystem_PlayReady=function(){"use strict";var a,b="com.microsoft.playready",c="9a04f079-9840-4286-ab92-e65be0885f95",d=function(b,c,d){var e,f,g,h,i,j,k=null,l={},m=new DOMParser,n=this;if(j=new Uint16Array(b.buffer),i=String.fromCharCode.apply(null,j),h=m.parseFromString(i,"application/xml"),h.getElementsByTagName("Challenge")[0]){var o=h.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;o&&(k=BASE64.decode(o))}else n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new MediaPlayer.vo.Error(null,"DRM: playready update, can not find Challenge in keyMessage",null));var p=h.getElementsByTagName("name"),q=h.getElementsByTagName("value");p.length!=q.length&&n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new MediaPlayer.vo.Error(null,"DRM: playready update, invalid header name/value pair in keyMessage",null));for(var r=0;r<p.length;r++)l[p[r].childNodes[0].nodeValue]=q[r].childNodes[0].nodeValue;a&&a.bearerToken&&l.push({name:"Authorization",value:a.bearerToken});var s=new XMLHttpRequest;if(s.onload=function(){if(200==s.status){var a=new MediaPlayer.vo.protection.LicenseRequestComplete(new Uint8Array(s.response),d);n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,a)}else n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new MediaPlayer.vo.Error(null,'DRM: playready update, XHR status is "'+s.statusText+'" ('+s.status+"), expected to be 200. readyState is "+s.readyState,null))},s.onabort=function(){n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new MediaPlayer.vo.Error(null,'DRM: playready update, XHR aborted. status is "'+s.statusText+'" ('+s.status+"), readyState is "+s.readyState,null))},s.onerror=function(){n.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new MediaPlayer.vo.Error(null,'DRM: playready update, XHR error. status is "'+s.statusText+'" ('+s.status+"), readyState is "+s.readyState,null))},s.open("POST",a&&a.laURL&&""!==a.laURL?a.laURL:c),s.responseType="arraybuffer",g=a?a.httpRequestHeaders:null)for(f in g)l[f]=g[f];for(e in l)"authorization"===e.toLowerCase()&&(s.withCredentials=!0),s.setRequestHeader(e,l[e]);s.send(k)},e=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},f=function(){return!1};return{schemeIdURI:"urn:uuid:"+c,systemString:b,uuid:c,notify:void 0,subscribe:void 0,unsubscribe:void 0,init:function(b){a=b},doLicenseRequest:d,getInitData:e,initDataEquals:f}},MediaPlayer.dependencies.protection.KeySystem_PlayReady.prototype={constructor:MediaPlayer.dependencies.protection.KeySystem_PlayReady},MediaPlayer.dependencies.protection.KeySystem_Widevine=function(){"use strict";var a,b="com.widevine.alpha",c="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",d=function(b,c,d){var e,f,g,h,i=new XMLHttpRequest,j={},k=this;if(h=a&&a.laURL&&""!==a.laURL?a.laURL:c){if(i.open("POST",h,!0),i.responseType="arraybuffer",i.onload=function(){if(200==this.status){var a=new MediaPlayer.vo.protection.LicenseRequestComplete(new Uint8Array(this.response),d);k.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,a)}else k.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: widevine update, XHR status is "'+i.statusText+'" ('+i.status+"), expected to be 200. readyState is "+i.readyState)+".  Response is "+(this.response?String.fromCharCode.apply(null,new Uint8Array(this.response)):"NONE"))},i.onabort=function(){k.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: widevine update, XHR aborted. status is "'+i.statusText+'" ('+i.status+"), readyState is "+i.readyState))},i.onerror=function(){k.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error('DRM: widevine update, XHR error. status is "'+i.statusText+'" ('+i.status+"), readyState is "+i.readyState))},f=a?a.httpRequestHeaders:null)for(e in f)j[e]=f[e];for(g in j)"authorization"===g.toLowerCase()&&(i.withCredentials=!0),i.setRequestHeader(g,j[g]);i.send(b)}else k.notify(MediaPlayer.dependencies.protection.KeySystem.eventList.ENAME_LICENSE_REQUEST_COMPLETE,null,new Error("DRM: No valid Widevine Proxy Server URL specified!"))},e=function(){return null},f=function(){return!1};return{schemeIdURI:"urn:uuid:"+c,systemString:b,uuid:c,notify:void 0,subscribe:void 0,unsubscribe:void 0,init:function(b){a=b},doLicenseRequest:d,getInitData:e,initDataEquals:f}},MediaPlayer.dependencies.protection.KeySystem_Widevine.prototype={constructor:MediaPlayer.dependencies.protection.KeySystem_Widevine},MediaPlayer.rules.ABRRulesCollection=function(){"use strict";var a=[];return{downloadRatioRule:void 0,insufficientBufferRule:void 0,limitSwitchesRule:void 0,bufferOccupancyRule:void 0,throughputRule: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.insufficientBufferRule),a.push(this.throughputRule),a.push(this.bufferOccupancyRule),a.push(this.limitSwitchesRule)}}},MediaPlayer.rules.ABRRulesCollection.prototype={constructor:MediaPlayer.rules.ABRRulesCollection,QUALITY_SWITCH_RULES:"qualitySwitchRules"},MediaPlayer.rules.BufferOccupancyRule=function(){"use strict";return{debug:void 0,metricsModel:void 0,execute:function(a,b){var c=this,d=a.getMediaInfo(),e=d.type,f=this.metricsModel.getReadOnlyMetricsFor(e),g=f.BufferLevel.length>0?f.BufferLevel[f.BufferLevel.length-1]:null,h=f.BufferState.length>0?f.BufferState[f.BufferState.length-1]:null,i=!1,j=d.trackCount-1,k=new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.WEAK);null!==g&&null!==h&&g.level>h.target&&(i=g.level-h.target>MediaPlayer.dependencies.BufferController.RICH_BUFFER_THRESHOLD,i&&d.trackCount>1&&(k=new MediaPlayer.rules.SwitchRequest(j,MediaPlayer.rules.SwitchRequest.prototype.STRONG))),k.value!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&c.debug.log("BufferOccupancyRule requesting switch to index: ",k.value,"type: ",e," Priority: ",k.priority===MediaPlayer.rules.SwitchRequest.prototype.DEFAULT?"Default":k.priority===MediaPlayer.rules.SwitchRequest.prototype.STRONG?"Strong":"Weak"),b(k)}}},MediaPlayer.rules.BufferOccupancyRule.prototype={constructor:MediaPlayer.rules.BufferOccupancyRule},MediaPlayer.rules.DownloadRatioRule=function(){"use strict";var a=1,b=[],c=20,d=3,e=1.4,f=function(a,b,c){return a.getTrackForQuality(b).bandwidth/a.getTrackForQuality(c).bandwidth},g=function(a){var d=0,e=b.length;if(a=a>e?e:a,e>0){for(var f=e-a,g=0,h=f;e>h;h++)g+=b[h];d=g/a}return b.length>c&&b.shift(),d};return{debug:void 0,metricsExt:void 0,metricsModel:void 0,execute:function(a,c){var h,i,j,k,l,m,n,o=this,p=a.getMediaInfo(),q=p.type,r=a.getCurrentValue(),s=a.getStreamProcessor(),t=s.isDynamic(),u=o.metricsModel.getReadOnlyMetricsFor(q),v=o.metricsExt.getCurrentHttpRequest(u),w=u.BufferLevel[u.BufferLevel.length-1]||null,x=null;if(!u||null===v||null===v.mediaduration||void 0===v.mediaduration||v.mediaduration<=0||isNaN(v.mediaduration))return void c(new MediaPlayer.rules.SwitchRequest);if(i=(v.tfinish.getTime()-v.trequest.getTime())/1e3,h=(v.tfinish.getTime()-v.tresponse.getTime())/1e3,0>=i)return void c(new MediaPlayer.rules.SwitchRequest);if(l=v.mediaduration/i,k=v.mediaduration/h,1/0!==k&&b.push(k),j=g(d),isNaN(j)||isNaN(k)||isNaN(l))return void c(new MediaPlayer.rules.SwitchRequest);if(1>j){if(r>0)for(n=r-1;n>0;n--)if(m=f.call(o,s,n,r),j>m*e){x=new MediaPlayer.rules.SwitchRequest(n,MediaPlayer.rules.SwitchRequest.prototype.STRONG);break}}else if(null!==w&&w.level>=w.target||t&&null!==w&&w.level>=MediaPlayer.dependencies.BufferController.DEFAULT_STARTUP_BUFFER_TIME){var y=p.trackCount-1;if(y>r)for(n=y;n>0;n--)if(m=f.call(o,s,n,r),j>m){r!==n&&(x=new MediaPlayer.rules.SwitchRequest(n,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT));break}}null===x&&(x=new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT)),x.value!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&o.debug.log("DownloadRatioRule requesting switch to index: ",x.value,"type: ",q," priority: ",x.priority===MediaPlayer.rules.SwitchRequest.prototype.DEFAULT?"default":x.priority===MediaPlayer.rules.SwitchRequest.prototype.STRONG?"strong":"weak"),c(x)},reset:function(){a=1,b=[]}}},MediaPlayer.rules.DownloadRatioRule.prototype={constructor:MediaPlayer.rules.DownloadRatioRule},MediaPlayer.rules.InsufficientBufferRule=function(){"use strict";var a={},b=function(b,c){a[b]=a[b]||{},a[b].state=c,c===MediaPlayer.dependencies.BufferController.BUFFER_LOADED&&(a[b].stepDownFactor=1,a[b].lastDryBufferHitRecorded=!1)};return{debug:void 0,metricsModel:void 0,execute:function(c,d){var e,f,g=this,h=c.getMediaInfo().type,i=c.getCurrentValue(),j=c.getMediaInfo(),k=g.metricsModel.getReadOnlyMetricsFor(h),l=c.getStreamInfo(),m=l.duration,n=c.getStreamProcessor().getPlaybackController().getTime(),o=c.getStreamProcessor(),p=o.isDynamic(),q=new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.WEAK),r=k.BufferLevel.length>0?k.BufferLevel[k.BufferLevel.length-1]:null,s=k.BufferState.length>0?k.BufferState[k.BufferState.length-1]:null;return 1===j.trackCount||null===k.PlayList||void 0===k.PlayList||0===k.PlayList.length||null===s?void d(q):(e=k.PlayList[k.PlayList.length-1],null===e||void 0===e||0===e.trace.length?void d(q):(f=e.trace[Math.max(e.trace.length-2,0)],null===f||void 0===f?void d(q):(b(h,s.state),null===f.stopreason||f.stopreason!==MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON||a[h].lastDryBufferHitRecorded?!p&&a[h].state===MediaPlayer.dependencies.BufferController.BUFFER_LOADED&&f.stopreason!==MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON&&null!==r&&r.level<2*MediaPlayer.dependencies.BufferController.LOW_BUFFER_THRESHOLD&&r.level>MediaPlayer.dependencies.BufferController.LOW_BUFFER_THRESHOLD&&n<m-2*MediaPlayer.dependencies.BufferController.LOW_BUFFER_THRESHOLD&&(q=new MediaPlayer.rules.SwitchRequest(Math.max(i-a[h].stepDownFactor,0),MediaPlayer.rules.SwitchRequest.prototype.STRONG),a[h].stepDownFactor++):(a[h].lastDryBufferHitRecorded=!0,q=new MediaPlayer.rules.SwitchRequest(0,MediaPlayer.rules.SwitchRequest.prototype.STRONG)),q.value!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&g.debug.log("InsufficientBufferRule requesting switch to index: ",q.value,"type: ",h," Priority: ",q.priority===MediaPlayer.rules.SwitchRequest.prototype.DEFAULT?"Default":q.priority===MediaPlayer.rules.SwitchRequest.prototype.STRONG?"Strong":"Weak"),void d(q))))},reset:function(){a={}}}},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=c.getCurrentValue(),g=(new Date).getTime();return e=g-a,b>e?void d(new MediaPlayer.rules.SwitchRequest(f,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT)):(a=g,void d(new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.WEAK)))}}},MediaPlayer.rules.LimitSwitchesRule.prototype={constructor:MediaPlayer.rules.LimitSwitchesRule},MediaPlayer.rules.ThroughputRule=function(){"use strict";var a=[],b=2,c=3,d=function(b,c){a[b]=a[b]||[],1/0!==c&&c!==a[b][a[b].length-1]&&a[b].push(c)},e=function(d,e){var f=0,g=e?b:c,h=a[d],i=h.length;if(g=g>i?i:g,i>0){for(var j=i-g,k=0,l=j;i>l;l++)k+=h[l];f=k/g}return h.length>g&&h.shift(),f};return{debug:void 0,metricsExt:void 0,metricsModel:void 0,manifestExt:void 0,manifestModel:void 0,execute:function(a,b){var c,f,g,h=this,i=a.getMediaInfo(),j=i.type,k=this.manifestModel.getValue(),l=h.metricsModel.getReadOnlyMetricsFor(j),m=a.getStreamProcessor().isDynamic(),n=h.metricsExt.getCurrentHttpRequest(l),o=l.BufferState.length>0?l.BufferState[l.BufferState.length-1]:null,p=l.BufferLevel.length>0?l.BufferLevel[l.BufferLevel.length-1]:null,q=new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.WEAK);if(!l||null===n||n.type!==MediaPlayer.vo.metrics.HTTPRequest.MEDIA_SEGMENT_TYPE||null===o||null===p)return void b(new MediaPlayer.rules.SwitchRequest);c=(n.tfinish.getTime()-n.tresponse.getTime())/1e3,g=Math.round(8*n.trace[n.trace.length-1].b/c),d(j,g),f=Math.round(e(j,m));var r=this.manifestExt.getAdaptationForType(k,0,j),s=i.trackCount-1;if(o.state===MediaPlayer.dependencies.BufferController.BUFFER_LOADED&&(p.level>=2*MediaPlayer.dependencies.BufferController.LOW_BUFFER_THRESHOLD||m))for(var t=s;t>0;t--){var u=this.manifestExt.getRepresentationFor(t,r).bandwidth;if(f>=u){var v=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT;q=new MediaPlayer.rules.SwitchRequest(t,v);break}}q.value!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&h.debug.log("ThroughputRule requesting switch to index: ",q.value,"type: ",j," Priority: ",q.priority===MediaPlayer.rules.SwitchRequest.prototype.DEFAULT?"Default":q.priority===MediaPlayer.rules.SwitchRequest.prototype.STRONG?"Strong":"Weak","Average throughput",Math.round(f/1024),"kbps"),b(q)},reset:function(){a=[]}}},MediaPlayer.rules.ThroughputRule.prototype={constructor:MediaPlayer.rules.ThroughputRule},MediaPlayer.rules.RulesContext=function(a,b){"use strict";var c=a.getCurrentTrack(),d=a;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},getStreamProcessor:function(){return d}}},MediaPlayer.rules.RulesContext.prototype={constructor:MediaPlayer.rules.RulesContext},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&&(c=!1,h.length=0),this.system.injectInto(e),h.push(e))};return{system:void 0,debug:void 0,SCHEDULING_RULE:0,ABR_RULE:1,SYNC_RULE:2,initialize:function(){a[this.ABR_RULE]=this.system.getObject("abrRulesCollection"),a[this.SCHEDULING_RULE]=this.system.getObject("scheduleRulesCollection"),a[this.SYNC_RULE]=this.system.getObject("synchronizationRulesCollection")},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:void 0!==b?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(){var b,c,d=a[this.ABR_RULE],e=a[this.SCHEDULING_RULE],f=a[this.SYNC_RULE],g=(d.getRules(MediaPlayer.rules.ABRRulesCollection.prototype.QUALITY_SWITCH_RULES)||[]).concat(e.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.NEXT_FRAGMENT_RULES)||[]).concat(e.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_SCHEDULE_RULES)||[]).concat(e.getRules(MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_EXECUTE_RULES)||[]).concat(f.getRules(MediaPlayer.rules.SynchronizationRulesCollection.prototype.TIME_SYNCHRONIZED_RULES)||[]).concat(f.getRules(MediaPlayer.rules.SynchronizationRulesCollection.prototype.BEST_GUESS_RULES)||[]),h=g.length;for(c=0;h>c;c+=1)b=g[c],"function"==typeof b.reset&&b.reset();a={}}}},MediaPlayer.rules.RulesController.prototype={constructor:MediaPlayer.rules.RulesController},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=f.metricsModel.getReadOnlyMetricsFor("video"),i=f.metricsModel.getReadOnlyMetricsFor("audio"),j=e.call(this,c.bufferController.getMinBufferTime(),b),k=j,l=c.bufferController.bufferMax,m=0;return l===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_MIN?m=j:l===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_INFINITY?m=b:l===MediaPlayer.dependencies.BufferController.BUFFER_SIZE_REQUIRED&&(!a&&f.abrController.isPlayingAtTopQuality(c.streamProcessor.getStreamInfo())&&(k=MediaPlayer.dependencies.BufferController.BUFFER_TIME_AT_TOP_QUALITY),m=k+Math.max(d.call(f,h),d.call(f,i))),m=Math.min(m,g)},g=function(a,c){return b[a]&&b[a][c]},h=function(b,c){return a[b]&&a[b][c]},i=function(a){var c=a.data.fragmentModel.getContext().streamProcessor.getStreamInfo().id;b[c]=b[c]||{},b[c][a.data.request.mediaType]=!0},j=function(b){var c=b.sender.streamProcessor.getStreamInfo().id;a[c]=a[c]||{},a[c][b.sender.streamProcessor.getType()]=!0},k=function(b){var c=b.sender.streamProcessor.getStreamInfo().id;a[c]=a[c]||{},a[c][b.sender.streamProcessor.getType()]=!1};return{metricsExt:void 0,metricsModel:void 0,abrController:void 0,setup:function(){this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_OUTRUN]=j,this[MediaPlayer.dependencies.BufferController.eventList.ENAME_BUFFER_LEVEL_BALANCED]=k,this[MediaPlayer.dependencies.FragmentController.eventList.ENAME_STREAM_COMPLETED]=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.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){var c=b.sender.getStreamId(),d=b.data.seekTime;a[c]=a[c]||{},a[c].audio=d,a[c].video=d};return{adapter:void 0,sourceBufferExt:void 0,setup:function(){this[MediaPlayer.dependencies.PlaybackController.eventList.ENAME_PLAYBACK_SEEKING]=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=.1,l=b[i][h].streamProcessor,m=l.getCurrentTrack(),n=a[i]?a[i][h]:null,o=void 0!==n&&null!==n,p=o?MediaPlayer.rules.SwitchRequest.prototype.STRONG:MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,q=j.getFragmentModel().getRejectedRequests().shift(),r=!!q&&!o,s=this.adapter.getIndexHandlerTime(l),t=l.playbackController.getTime(),u=q?q.startTime+q.duration:null,v=!o&&q&&(u>t&&q.startTime<=s||isNaN(s));if(f=o?n:v?q.startTime:s,isNaN(f))return void d(new MediaPlayer.rules.SwitchRequest(null,p));for(a[i]&&(a[i][h]=null),e=this.sourceBufferExt.getBufferRange(l.bufferController.getBuffer(),f),null!==e&&(f=e.end),g=this.adapter.getFragmentRequestForTime(l,m,f,{keepIdx:r}),v&&g&&g.index!==q.index&&(g=this.adapter.getFragmentRequestForTime(l,m,q.startTime+q.duration/2+k,{keepIdx:r}));g&&l.fragmentController.isFragmentLoadedOrPending(j,g);){if("complete"===g.action){g=null,this.adapter.setIndexHandlerTime(l,0/0);break}g=this.adapter.getNextFragmentRequest(l,m)}g&&!v&&this.adapter.setIndexHandlerTime(l,g.startTime+g.duration),d(new MediaPlayer.rules.SwitchRequest(g,p))},reset:function(){a={},b={}}}},MediaPlayer.rules.PlaybackTimeRule.prototype={constructor:MediaPlayer.rules.PlaybackTimeRule},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=r[0].getContext().playbackController.getTime(),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),h||0!==j.index||(h=m.filter(function(a){return a.index===j.index})[0]),h)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=[];return{bufferLevelRule:void 0,pendingRequestsRule:void 0,playbackTimeRule:void 0,sameTimeRequestRule:void 0,getRules:function(d){switch(d){case MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_SCHEDULE_RULES:return a;case MediaPlayer.rules.ScheduleRulesCollection.prototype.NEXT_FRAGMENT_RULES:return c;case MediaPlayer.rules.ScheduleRulesCollection.prototype.FRAGMENTS_TO_EXECUTE_RULES:return b;default:return null}},setup:function(){a.push(this.bufferLevelRule),a.push(this.pendingRequestsRule),c.push(this.playbackTimeRule),b.push(this.sameTimeRequestRule)}}},MediaPlayer.rules.ScheduleRulesCollection.prototype={constructor:MediaPlayer.rules.ScheduleRulesCollection,FRAGMENTS_TO_SCHEDULE_RULES:"fragmentsToScheduleRules",NEXT_FRAGMENT_RULES:"nextFragmentRules",FRAGMENTS_TO_EXECUTE_RULES:"fragmentsToExecuteRules"},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.rules.LiveEdgeBinarySearchRule=function(){"use strict";var a,b,c,d=43200,e=0/0,f=null,g=0/0,h=null,i=!1,j=0/0,k=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,l=function(a,d,e,f){var g,i=this;if(null===f)g=i.adapter.generateFragmentRequestForTime(c,h,a),l.call(i,a,d,e,g);else{var j=function(c){b.unsubscribe(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,i,j),c.data.exists?d.call(i,c.data.request,a):e.call(i,c.data.request,a)};b.subscribe(MediaPlayer.dependencies.FragmentLoader.eventList.ENAME_CHECK_FOR_EXISTENCE_COMPLETED,i,j),b.checkForExistence(f)}},m=function(b,d){var j,p,q;return i?void o.call(this,!1,d):(q=d-e,j=q>0?e-q:e+Math.abs(q)+g,void(j<f.start&&j>f.end?a(new MediaPlayer.rules.SwitchRequest(null,k)):(p=this.adapter.getFragmentRequestForTime(c,h,j),l.call(this,j,n,m,p))))},n=function(b,d){var m,n,p=b.startTime,q=this;if(!i){if(!h.fragmentDuration)return void a(new MediaPlayer.rules.SwitchRequest(p,k));if(i=!0,f.end=p+2*g,d===e)return n=d+j,m=q.adapter.getFragmentRequestForTime(c,h,n),void l.call(q,n,function(){o.call(q,!0,n)},function(){a(new MediaPlayer.rules.SwitchRequest(n,k))},m)}o.call(this,!0,d)},o=function(b,d){var e,g,i;b?f.start=d:f.end=d,e=Math.floor(f.end-f.start)<=j,e?a(new MediaPlayer.rules.SwitchRequest(b?d:d-j,k)):(i=(f.start+f.end)/2,g=this.adapter.getFragmentRequestForTime(c,h,i),l.call(this,i,n,m,g))};return{metricsExt:void 0,adapter:void 0,timelineConverter:void 0,execute:function(i,o){var p,q,r=this;if(a=o,c=i.getStreamProcessor(),b=c.getFragmentLoader(),h=i.getTrackInfo(),j=h.fragmentDuration,q=h.DVRWindow,e=q.end,h.useCalculatedLiveEdgeTime){var s=r.timelineConverter.getExpectedLiveEdge();return r.timelineConverter.setExpectedLiveEdge(e),void a(new MediaPlayer.rules.SwitchRequest(s,k))}f={start:Math.max(0,e-d),end:e+d},g=Math.floor((q.end-q.start)/2),p=r.adapter.getFragmentRequestForTime(c,h,e),l.call(r,e,n,m,p)},reset:function(){e=0/0,f=null,g=0/0,h=null,i=!1,j=0/0,c=null,b=null}}},MediaPlayer.rules.LiveEdgeBinarySearchRule.prototype={constructor:MediaPlayer.rules.LiveEdgeBinarySearchRule},MediaPlayer.rules.LiveEdgeWithTimeSynchronizationRule=function(){"use strict";return{execute:function(a,b){b(new MediaPlayer.rules.SwitchRequest(a.getTrackInfo().DVRWindow.end,MediaPlayer.rules.SwitchRequest.prototype.DEFAULT))}}},MediaPlayer.rules.LiveEdgeWithTimeSynchronizationRule.prototype={constructor:MediaPlayer.rules.LiveEdgeWithTimeSynchronizationRule},MediaPlayer.rules.SynchronizationRulesCollection=function(){"use strict";var a=[],b=[];return{liveEdgeBinarySearchRule:void 0,liveEdgeWithTimeSynchronizationRule:void 0,getRules:function(c){switch(c){case MediaPlayer.rules.SynchronizationRulesCollection.prototype.TIME_SYNCHRONIZED_RULES:return a;case MediaPlayer.rules.SynchronizationRulesCollection.prototype.BEST_GUESS_RULES:return b;default:return null}},setup:function(){a.push(this.liveEdgeWithTimeSynchronizationRule),b.push(this.liveEdgeBinarySearchRule)}}},MediaPlayer.rules.SynchronizationRulesCollection.prototype={constructor:MediaPlayer.rules.SynchronizationRulesCollection,TIME_SYNCHRONIZED_RULES:"withAccurateTimeSourceRules",BEST_GUESS_RULES:"bestGuestRules"},MediaPlayer.utils.Capabilities=function(){"use strict"},MediaPlayer.utils.Capabilities.prototype={constructor:MediaPlayer.utils.Capabilities,system:void 0,debug:void 0,supportsMediaSource:function(){"use strict";var a="WebKitMediaSource"in window,b="MediaSource"in window;return a||b},supportsEncryptedMedia:function(){return this.system.hasMapping("protectionModel")},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,b=!1,c=(new Date).getTime();return{eventBus:void 0,setLogTimestampVisible:function(a){b=a},setLogToBrowserConsole:function(b){a=b},getLogToBrowserConsole:function(){return a},log:function(){var d=null,e=null;b&&(d=(new Date).getTime(),e="["+(d-c)+"] ");var f=arguments[0];arguments.length>1&&(f="",Array.apply(null,arguments).forEach(function(a){f+=" "+a})),a&&console.log((b?e:"")+f),this.eventBus.dispatchEvent({type:"log",message:f})}}},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.vo.Error=function(a,b,c){"use strict";this.code=a||null,this.message=b||null,this.data=c||null},MediaPlayer.vo.Error.prototype={constructor:MediaPlayer.vo.Error},MediaPlayer.vo.Event=function(){"use strict";this.type=null,this.sender=null,this.data=null,this.error=null,this.timestamp=0/0},MediaPlayer.vo.Event.prototype={constructor:MediaPlayer.vo.Event},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:[],BufferState:[],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,this.isLast=!0},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.BufferState=function(){"use strict";this.target=null,this.state=MediaPlayer.dependencies.BufferController.BUFFER_EMPTY},MediaPlayer.vo.metrics.BufferState.prototype={constructor:MediaPlayer.vo.metrics.BufferState},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.responseHeaders=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.HTTPRequest.MEDIA_SEGMENT_TYPE="Media Segment",MediaPlayer.vo.metrics.HTTPRequest.MPD_TYPE="MPD",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},MediaPlayer.vo.protection.ClearKeyKeySet=function(a,b){if(b&&"persistent"!==b&&"temporary"!==b)throw new Error("Invalid ClearKey key set type!  Must be one of 'persistent' or 'temporary'");this.keyPairs=a,this.type=b,this.toJWKString=function(){var a,b=this.keyPairs.length,c={};for(c.keys=[],a=0;b>a;a++){var d={kty:"oct",alg:"A128KW"};d.k=btoa(String.fromCharCode.apply(null,this.keyPairs[a].key)).replace(/=/g,""),d.kid=btoa(String.fromCharCode.apply(null,this.keyPairs[a].keyID)).replace(/=/g,""),c.keys.push(d)}return this.type&&(c.type=this.type),JSON.stringify(c)}},MediaPlayer.vo.protection.ClearKeyKeySet.prototype={constructor:MediaPlayer.vo.protection.ClearKeyKeySet},MediaPlayer.vo.protection.KeyError=function(a,b){"use strict";this.sessionToken=a,this.error=b},MediaPlayer.vo.protection.KeyError.prototype={constructor:MediaPlayer.vo.protection.KeyError},MediaPlayer.vo.protection.KeyMessage=function(a,b,c){"use strict";this.sessionToken=a,this.message=b,this.defaultURL=c},MediaPlayer.vo.protection.KeyMessage.prototype={constructor:MediaPlayer.vo.protection.KeyMessage},MediaPlayer.vo.protection.KeyPair=function(a,b){"use strict";if(!a||16!==a.length)throw new Error("Illegal key ID length! Must be 16 bytes (128 bits)");if(!b||16!==b.length)throw new Error("Illegal key length! Must be 16 bytes (128 bits)");this.keyID=a,this.key=b},MediaPlayer.vo.protection.KeyPair.prototype={constructor:MediaPlayer.vo.protection.KeyPair},MediaPlayer.vo.protection.LicenseRequestComplete=function(a,b){"use strict";this.message=a,this.requestData=b},MediaPlayer.vo.protection.LicenseRequestComplete.prototype={constructor:MediaPlayer.vo.protection.LicenseRequestComplete},MediaPlayer.vo.protection.NeedKey=function(a,b){this.initData=a,this.initDataType=b},MediaPlayer.vo.protection.NeedKey.prototype={constructor:MediaPlayer.vo.protection.NeedKey},MediaPlayer.vo.protection.ProtectionData=function(a,b,c){this.laURL=a,this.httpRequestHeaders=b,this.bearerToken=c},MediaPlayer.vo.protection.ProtectionData.prototype={constructor:MediaPlayer.vo.protection.ProtectionData},MediaPlayer.models.SessionToken=function(){"use strict"},MediaPlayer.models.SessionToken.prototype={sessionID:null,initData:null};