xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.Bootstrapper=function(){this._boot_state=0;this._callbackObj=null;};xmp.baseplayer.Bootstrapper.prototype.init=function(){this._addSystemLoggerListeners();};xmp.baseplayer.Bootstrapper.prototype.isNew=function(){return(this._boot_state===0);};xmp.baseplayer.Bootstrapper.prototype.isOk=function(){return(this._boot_state===1);};xmp.baseplayer.Bootstrapper.prototype.bootStrap=function(aa){this._boot_state=-1;this._callbackObj=aa;var cb=new xmp.util.Callback('Bootstrapper_bootStrap',this._onBootStrap,this);xmp.net.AjaxRequestManager.getInstance().init(cb);};xmp.baseplayer.Bootstrapper.prototype._onBootStrap=function(ba,ca){if(ca==='Ready'){this._boot_state=1;this._callbackObj.handleBootstrappedInternal(null);}
else{this._boot_state=-1;this._callbackObj.handleBootstrappedInternal(ca);}};xmp.baseplayer.Bootstrapper.prototype._addSystemLoggerListeners=function(){var da=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var ea=da.getNodeForPath('Instrumentation');var fa=ea.getBoolean('enabled',false);if(fa===true){var ga=ea.getString('thresholdLevel','critical');var ha=xmp.util.LogLevels.fromString(ga);var ia=new xmp.baseplayer.InstrumentationLoggerListener(ha);xmp.util.Logger.getInstance().addListener(ia);}};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.AbstractNodeListener=function(id,ja){xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.OBJECT_TYPE],"AbstractNodeListener.ctor");if(id===null||id.length===0||ja===null){throw new xmp.util.internals.InvalidArgsError("The 'id' argument must be non-empty, "+"and the 'player' argument must be non-null.");}
this._id=id;this._player=ja;};xmp.baseplayer.listeners.AbstractNodeListener.prototype.getId=function(){return this._id;};xmp.baseplayer.listeners.AbstractNodeListener.prototype.getPlayer=function(){return this._player;};xmp.baseplayer.listeners.AbstractNodeListener.prototype.canUserControl=function(ka){return true;};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleInitialize=function(la){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleDynamicRules=function(ma){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleComplete=function(na){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.canCompleteNow=function(oa){return true;};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleCompleteAsynch=function(pa,qa){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleRender=function(ra){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleOpen=function(sa){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleConnecting=function(ta){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleConnected=function(ua){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handlePlay=function(va){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleFirstFrameRendered=function(wa){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handlePause=function(xa){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleStop=function(ya){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleRewind=function(za){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleFastForward=function(Aa){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleSeekable=function(Ba){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleEnded=function(Ca){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleBuffering=function(Da,Ea){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleTimelineChange=function(Fa,Ga,Ha){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleError=function(Ia,e){};xmp.baseplayer.listeners.AbstractNodeListener.prototype.handleOverrideAdResources=function(Ja,Ka){};xmp.baseplayer.listeners.AbstractNodeListener.prototype._createTriggerContext=function(La){var Ma=new xmp.baseplayer.TriggerContext();Ma.setPlayableNode(La);Ma.setMetadata('nodeListener',this);return Ma;};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.TriggerNodeListener=function(id,Na){xmp.baseplayer.listeners.TriggerNodeListener.ctor.call(this,id,Na);this.tracked_midpoint=false;this.live=false;};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AbstractNodeListener,xmp.baseplayer.listeners.TriggerNodeListener);xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleRender=function(Oa){this.tracked_midpoint=false;this.live=(Oa.getStreamingMode()==='live');if(false===this.live){this.handleTrackRequest(Oa);}
xmp.baseplayer.listeners.TriggerNodeListener.base.handleRender.call(this,Oa);};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleOpen=function(Pa){this.tracked_midpoint=false;this.live=(Pa.getStreamingMode()==='live');if(false===this.live){this.handleTrackStart(Pa);}
xmp.baseplayer.listeners.TriggerNodeListener.base.handleOpen.call(this,Pa);};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleEnded=function(Qa){if(false===this.live){this.handleTrackEnd(Qa);}
xmp.baseplayer.listeners.TriggerNodeListener.base.handleEnded.call(this,Qa);};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleTimelineChange=function(Ra,Sa,Ta){xmp.baseplayer.listeners.TriggerNodeListener.base.handleTimelineChange.call(this,Ra,Sa,Ta);if(false===this.live&&false===this.tracked_midpoint){var Ua=(((Ra.getTimeLimitInSeconds()!=xmp.NO_TIME_LIMIT)?Ra.getTimeLimitInSeconds():Ta)/2);if(Sa>=Ua){this.handleTrackMidpoint(Ra);this.tracked_midpoint=true;}}};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleTrackRequest=function(Va){xmp.baseplayer.internals.Trigger.getTrigger(Va,'request').doCommands(this._createTriggerContext(Va));};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleTrackStart=function(Wa){xmp.baseplayer.internals.Trigger.getTrigger(Wa,'start').doCommands(this._createTriggerContext(Wa));};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleTrackMidpoint=function(Xa){xmp.baseplayer.internals.Trigger.getTrigger(Xa,'mid').doCommands(this._createTriggerContext(Xa));};xmp.baseplayer.listeners.TriggerNodeListener.prototype.handleTrackEnd=function(Ya){xmp.baseplayer.internals.Trigger.getTrigger(Ya,'end').doCommands(this._createTriggerContext(Ya));};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.AdResNodeListener=function(id,Za){xmp.baseplayer.listeners.AdResNodeListener.ctor.call(this,id,Za);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AbstractNodeListener,xmp.baseplayer.listeners.AdResNodeListener);xmp.baseplayer.listeners.AdResNodeListener.prototype.canCompleteNow=function($a){var rb=$a.getMetaResourceBundle();if(rb.isError()||rb.isLoaded()){this._handleResBundleLoaded($a,rb);}
if(rb.isError()){return true;}
return rb.isLoaded();};xmp.baseplayer.listeners.AdResNodeListener.prototype.handleCompleteAsynch=function(ab,bb){var db=xmp.baseplayer.MetaFileLoaderFactory.getInstance().create('videoAdMeta');var eb=new xmp.util.Callback('gotAdCallback',this._gotAdCallback,this);eb.setMetadata('RelayCallback',bb);eb.setMetadata('theNode',ab);db.setResBundle(ab.getMetaResourceBundle(),eb);db.load();};xmp.baseplayer.listeners.AdResNodeListener.prototype._gotAdCallback=function(fb,gb){var hb=fb.getMetadata('RelayCallback',{});var ib=fb.getMetadata('theNode',{});this._handleResBundleLoaded(ib,gb);hb.call(ib);};xmp.baseplayer.listeners.AdResNodeListener.prototype._handleResBundleLoaded=function(jb,kb){};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.BasePlayer=function(id,lb,mb){if(xmp.baseplayer.BasePlayer._singleInstance!==null){throw new Error('Only one instance of BasePlayer allowed per browser session.');}
this._nextPlayListContextKey=1;this._playListContextCollection={};this._currentPlayListContext=null;this._logger=new xmp.util.internals.CategoryLogger('BasePlayer');this._id=id;xmp.baseplayer.BasePlayer._playerMap[this.getId()]=this;this._metadataMap=new xmp.util.internals.MetadataMap(true);this._metadataMap._reInitialize(lb);this._parameters=mb;this._mediaPlayer=null;this._nlMap=new xmp.baseplayer._NLMap(this);this._bootStrapper=xmp.baseplayer.BasePlayer._bootStrapper;this._bootStrapper.init();this._options=lb;xmp.baseplayer.BasePlayer._singleInstance=this;};xmp.baseplayer.BasePlayer._playerMap={};xmp.baseplayer.BasePlayer._singleInstance=null;xmp.baseplayer.BasePlayer._bootStrapper=new xmp.baseplayer.Bootstrapper();xmp.baseplayer.BasePlayer._fatalException=xmp.FatalException.createFatalException(xmp.XmpErrorCodes.FATAL_UNSPECIFIED_ERROR,'BasePlayer','not boostrapped yet');xmp.baseplayer.BasePlayer.prototype.getAbsoluteURI=function(nb,ob){if(nb.length>0&&nb.charAt(0)==='/'){var pb="http://"+window.location.host;var qb=pb;if(typeof ob!=='undefined'&&ob!=='defaultRoot'){var sb=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var tb=sb.getNodeForPath('rootUrlMap/'+ob);qb=tb.getString('rootUrl',pb);}
nb=qb+nb;}
return nb;};xmp.baseplayer.BasePlayer.findPlayer=function(id){var ub=xmp.baseplayer.BasePlayer._playerMap[id];return(!ub)?null:ub;};xmp.baseplayer.BasePlayer.prototype.bootStrap=function(){try{if(!this._bootStrapper.isNew()){throw new Error('Already tried to bootstrap.');}
var vb=xmp.baseplayer.BasePlayer._fatalException;xmp.PlayerPolicy.validateBootstrap(this);if(vb===xmp.baseplayer.BasePlayer._fatalException){this._bootStrapper.bootStrap(this);}
else{this.handleBootstrapped(false);}}
catch(e){this.handleBootstrappedInternal(e);}};xmp.baseplayer.BasePlayer.prototype.fini=function(){if(this._mediaPlayer!==null){this._mediaPlayer.fini();this._mediaPlayer=null;}
xmp.ServiceRegistry.fini();};xmp.baseplayer.BasePlayer.prototype.getId=function(){return this._id;};xmp.baseplayer.BasePlayer.prototype.getMediaPlayer=function(){return this._mediaPlayer;};xmp.baseplayer.BasePlayer.prototype.getLookAheadNodeArray=function(){return this._getCurCtx('getLookAheadNodeArray').getLookAheadNodeArray();};xmp.baseplayer.BasePlayer.prototype.getLookBehindNodeArray=function(){return this._getCurCtx('getLookBehindNodeArray').getLookBehindNodeArray();};xmp.baseplayer.BasePlayer.prototype.getMetadata=function(wb,xb){return this._metadataMap._get(wb,xb);};xmp.baseplayer.BasePlayer.prototype.setPlayerContext=function(yb){xmp.util.PlayerStats.getInstance().setValue('playerContext',yb);xmp.util.SettingsManager.getInstance().setContext(yb);};xmp.baseplayer.BasePlayer.prototype.createPlayListContext=function(zb){this._checkXmpState();this._faultMediaPlayer();var Ab=this._getAdPatternRelPath(zb);var Bb=this._getContextParameters();Bb=Bb.concat(this._parameters);var Cb=this._createPlayListContext(Ab,Bb);this._setCurrentPlayListContext(Cb);var Db=Cb.getKey();if(this._logger.isDebugEnabled()){this._logger.debug("Created new playlist, key = "+Db);Cb.debugPrint("Initial State");}
return Db;};xmp.baseplayer.BasePlayer.prototype.loadContent=function(Eb,Fb){this._checkXmpState();return this._getCurCtx('loadContent').loadContent(Eb,(Fb?Fb:''));};xmp.baseplayer.BasePlayer.prototype.load=function(Gb,Hb,Ib){this._logger.warn('Method "BasePlayer.load" is deprecated, please change code to no longer use this method.');var Jb=this.createPlayListContext(Ib);this.loadContent(Gb,Hb);return Jb;};xmp.baseplayer.BasePlayer.prototype.loadItem=function(Kb,Lb,Mb){this._faultMediaPlayer();var Nb=this._createPlayableNode(Kb,Lb,Mb);var Ob=this._getNodeListener(Nb);Ob.handleInitialize(Nb);Ob.handleComplete(Nb);Ob.handleRender(Nb);};xmp.baseplayer.BasePlayer.prototype._createPlayableNode=function(Pb,Qb,Rb){var Sb=new xmp.util.PlayableNode();Sb._setNodeType(new xmp.playlistapi.internals.RuleSetPlayableNodeType(null,Pb,Pb,[],{}));if(Qb){if(Qb.url){Sb.setURI(Qb.url);}
Sb._setData(((Qb.metadata)?Qb.metadata:new xmp.util.PlayableData('DEFAULT')));}
if(Rb){var Tb=Rb.length;for(var i=0;i<Tb;i++){Sb.setMetadata(Rb[i].name,Rb[i].value);}}
return Sb;};xmp.baseplayer.BasePlayer.prototype._getAdPatternRelPath=function(Ub){var Vb='';var Wb=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('BasePlayer/ad patterns');if(typeof(Ub)==='undefined'){var Xb=Wb.retrieveKeys();if(Xb.length>0){Vb=Wb.getString(Xb[0],'');}}
else{if(!xmp.isNonEmptyString(Ub)){throw new xmp.util.internals.InvalidArgsError('The adPatternKey parameter must be a non-empty string');}
Vb=Wb.getString(Ub,'');}
if(!xmp.isNonEmptyString(Vb)){throw new xmp.util.internals.InvalidArgsError('Failed to find ad pattern relative URL.');}
return Vb;};xmp.baseplayer.BasePlayer.prototype._createPlayListContext=function(Yb,Zb){var $b=this._nextPlayListContextKey++;var ac=new xmp.baseplayer._PLCtx($b,this,Yb,Zb);this._playListContextCollection[$b]=ac;return ac;};xmp.baseplayer.BasePlayer.prototype.switchPlayList=function(bc){var cc=this._playListContextCollection[bc];if(!cc){throw new xmp.util.internals.InvalidArgsError(""+bc+" is not a valid playlist context key");}
else{if(this._logger.isDebugEnabled()){this._logger.debug("Switching playlist context:");this._currentPlayListContext.debugPrint("old context");this._setCurrentPlayListContext(cc);this._currentPlayListContext.debugPrint("new context");}
this._tryRender();}};xmp.baseplayer.BasePlayer.prototype.hasPlayListContext=function(){return this._currentPlayListContext!==null;};xmp.baseplayer.BasePlayer.prototype._setCurrentPlayListContext=function(dc){if(this._currentPlayListContext){this._currentPlayListContext.setStateListener(null);}
this._currentPlayListContext=dc;this._currentPlayListContext.setStateListener(this);};xmp.baseplayer.BasePlayer.prototype._getCurCtx=function(ec){if(!this._currentPlayListContext){throw new Error('BasePlayer.'+ec+": Cannot perform operation because playlist context has not been set. Call load() first.");}
return this._currentPlayListContext;};xmp.baseplayer.BasePlayer.prototype.appendToPlayList=function(fc,gc){this._checkXmpState();return this._getCurCtx('appendToPlayList').appendToPlayList(fc,((gc)?gc:false));};xmp.baseplayer.BasePlayer.prototype.removeFromPlayList=function(hc){this._checkXmpState();return this._getCurCtx('removeFromPlayList').removeFromPlayList(hc);};xmp.baseplayer.BasePlayer.prototype.insertInPlayList=function(ic,jc,kc){this._checkXmpState();return this._getCurCtx('insertInPlayList').insertInPlayList(ic,jc((kc)?kc:false));};xmp.baseplayer.BasePlayer.prototype.moveWithinPlayList=function(lc,mc,nc){this._checkXmpState();return this._getCurCtx('moveWithinPlayList').moveWithinPlayList(lc,mc((nc)?nc:false));};xmp.baseplayer.BasePlayer.prototype.setCurrentPlayListPosition=function(oc){this._checkXmpState();return this._getCurCtx('setCurrentPlayListPosition').setCurrentPlayListItem(oc);};xmp.baseplayer.BasePlayer.prototype.getCurrentPlayListItem=function(){return this._getCurCtx('getCurrentPlayListItem').getCurrentPlayListItem();};xmp.baseplayer.BasePlayer.prototype.getPlayListItemCount=function(){return this._getCurCtx('getPlayListItemCount').getPlayListItemCount();};xmp.baseplayer.BasePlayer.prototype.getPlayListItem=function(pc){return this._getCurCtx('getPlayListItem').getPlayListItem(pc);};xmp.baseplayer.BasePlayer.prototype.findPlayListItem=function(qc){return this._getCurCtx('findPlayListItem').findPlayListItem(qc);};xmp.baseplayer.BasePlayer.prototype.findPlayListItemIndex=function(rc){return this._getCurCtx('findPlayListItemIndex').findPlayListItemIndex(rc);};xmp.baseplayer.BasePlayer.prototype.advance=function(){this._checkXmpState();this._getCurCtx('advance').advance();};xmp.baseplayer.BasePlayer.prototype.onAdvance=function(){this._tryRender();};xmp.baseplayer.BasePlayer.prototype._tryRender=function(){if(this._isReady()){var sc=this._currentPlayListContext.getCurrentNode();if(sc){this._renderNode(sc,true);}}};xmp.baseplayer.BasePlayer.prototype.registerNodeListener=function(tc,uc){this._nlMap._registerNodeListener(tc,uc);};xmp.baseplayer.BasePlayer.prototype._initServices=function(vc){if(vc.services){xmp.ServiceRegistry.init(this,vc.services);}};xmp.baseplayer.BasePlayer.prototype.handlePlayListStarted=function(){this._logger.info('PlayList started, override "handlePlayListStarted" to do specific handling.');};xmp.baseplayer.BasePlayer.prototype.handlePlayListEnded=function(){this._logger.info('PlayList ended, override "handlePlayListEnded" to do specific handling.');};xmp.baseplayer.BasePlayer.prototype.handlePlayListModified=function(wc){this._logger.info('PlayList modified, override "handlePlayListModified" to do specific handling.');};xmp.baseplayer.BasePlayer.prototype.handleMediaPlayerReady=function(){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.handleCreateViewport=function(xc,yc,zc,Ac){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.handleDestroyViewport=function(Bc,Cc){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.handleFatalException=function(e){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.handleBootstrapped=function(Dc){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.handleRegisterNodeListeners=function(){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.onControlStreamError=function(e){this.handleControlStreamError(e);};xmp.baseplayer.BasePlayer.prototype.handleControlStreamError=function(e){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.onControlStreamTriggerInit=function(Ec,Fc){this.handleControlStreamTriggerInit(Ec,Fc);};xmp.baseplayer.BasePlayer.prototype.handleControlStreamTriggerInit=function(Gc,Hc){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.onControlStreamTrigger=function(Ic,Jc){this.handleControlStreamTrigger(Ic,Jc);};xmp.baseplayer.BasePlayer.prototype.handleControlStreamTrigger=function(Kc,Lc){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.onRetrieveImage=function(Mc,Nc){this.handleRetrieveImage(Mc,Nc);};xmp.baseplayer.BasePlayer.prototype.handleRetrieveImage=function(Oc,Pc){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype.onImageRetrieverError=function(e){this.handleImageRetrieverError(e);};xmp.baseplayer.BasePlayer.prototype.handleImageRetrieverError=function(e){this._throwMustOverrideError();};xmp.baseplayer.BasePlayer.prototype._throwMustOverrideError=function(){throw new xmp.playlistapi.internals.PlayListError('Not implemented, must override.');};xmp.baseplayer.BasePlayer.prototype._getNodeListener=function(Qc){return this._nlMap._getNodeListener(Qc);};xmp.baseplayer.BasePlayer.prototype._faultMediaPlayer=function(){if(this._mediaPlayer===null){this._createMediaPlayer();}};xmp.baseplayer.BasePlayer.prototype._createMediaPlayer=function(){this._mediaPlayer=xmp.MediaPlayerFactory.createPlayer(this.getId(),this);this._mediaPlayer.init();};xmp.baseplayer.BasePlayer.prototype.onInitialized=function(){this.handleMediaPlayerReady();this.handleRegisterNodeListeners();};xmp.baseplayer.BasePlayer.prototype.onTimelineChange=function(Rc,Sc,Tc){this._getNodeListener(Rc).handleTimelineChange(Rc,Sc,Tc);};xmp.baseplayer.BasePlayer.prototype.onStateChange=function(Uc,Vc,Wc){switch(Vc){case xmp.OPEN:this._getNodeListener(Uc).handleOpen(Uc);break;case xmp.CONNECTING:this._getNodeListener(Uc).handleConnecting(Uc);break;case xmp.CONNECTED:this._getNodeListener(Uc).handleConnected(Uc);break;case xmp.PLAY:this._getNodeListener(Uc).handlePlay(Uc);break;case xmp.PAUSE:this._getNodeListener(Uc).handlePause(Uc);break;case xmp.STOP:this._getNodeListener(Uc).handleStop(Uc);break;case xmp.REWIND:this._getNodeListener(Uc).handleRewind(Uc);break;case xmp.FAST_FORWARD:this._getNodeListener(Uc).handleFastForward(Uc);break;case xmp.SEEKABLE:this._getNodeListener(Uc).handleSeekable(Uc);break;case xmp.ENDED:this._getNodeListener(Uc).handleEnded(Uc);break;case xmp.FIRST_FRAME_RENDERED:this._getNodeListener(Uc).handleFirstFrameRendered(Uc);break;case xmp.BUFFERING:this._getNodeListener(Uc).handleBuffering(Uc,Wc);break;default:this._logger.warn('Unrecognized media player state: '+Vc);break;}};xmp.baseplayer.BasePlayer.prototype.onError=function(Xc,e){this._getNodeListener(Xc).handleError(Xc,e);};xmp.baseplayer.BasePlayer.prototype.onCreateViewport=function(Yc,Zc,$c,ad){return this.handleCreateViewport(Yc,Zc,$c,ad);};xmp.baseplayer.BasePlayer.prototype.onDestroyViewport=function(bd,cd){this.handleDestroyViewport(bd,cd);};xmp.baseplayer.BasePlayer.prototype.onPlugInError=function(e){this._raiseFatalException(e);};xmp.baseplayer.BasePlayer.prototype.onUnsupportedPlatformError=function(e){this._raiseFatalException(e);};xmp.baseplayer.BasePlayer.prototype._getContextParameters=function(){var dd=[];var ed=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('pattern parameters');var fd=ed.retrieveKeys();for(var i=0;i<fd.length;i++){var gd=fd[i];dd.push({name:gd,value:ed.getString(gd,'')});}
return dd;};xmp.baseplayer.BasePlayer.prototype._isReady=function(){return(this._currentPlayListContext!==null);};xmp.baseplayer.BasePlayer.prototype.handleInitializePlayableNode=function(hd){this._getNodeListener(hd).handleInitialize(hd);this._getNodeListener(hd).handleDynamicRules(hd);};xmp.baseplayer.BasePlayer.prototype._isStillCurrentNode=function(jd){var kd=this._currentPlayListContext.getCurrentNode();return(jd===kd);};xmp.baseplayer.BasePlayer.prototype._gotAsynchCompleteCallback=function(ld,md){if(this._isStillCurrentNode(md)){this._renderNode(md,false);}};xmp.baseplayer.BasePlayer.prototype._renderNode=function(nd,od){var pd=null;try{pd=this._getNodeListener(nd);if(od){this._overrideAdRes(pd,nd);}
if(!this._isStillCurrentNode(nd)){return;}
if(pd.canCompleteNow(nd)){if(nd.getPlayableData().isError()){pd.handleError(nd,nd.getPlayableData().getError());return;}
pd.handleComplete(nd);if(!this._isStillCurrentNode(nd)){return;}
nd.getPlayableData().setRuntimeMetadata('history_played',true);pd.handleRender(nd);}
else{if(!od){throw new Error('_renderNode: prevent infinite loop');}
var qd=new xmp.util.Callback('gotAsynchCompleteCallback',this._gotAsynchCompleteCallback,this);pd.handleCompleteAsynch(nd,qd);}}
catch(e){this._logger.warn("Error rendering node: "+nd.getBestId(),e);try{pd.handleError(nd,e);}
catch(e2){this._logger.warn("Error calling handleError for node: "+nd.getBestId(),e2);}}};xmp.baseplayer.BasePlayer.prototype._overrideAdRes=function(rd,sd){var pm=sd.getMetadata('__DIRECTIVE_PARAMETER_MAP__',xmp.util.internals.MetadataMap.defaultObj);if(pm===xmp.util.internals.MetadataMap.defaultObj){pm=this._getCurCtx('_overrideAdRes')._xmpPlayList._getParameterMapInternal().clone();pm.addContextObject('node',sd.getNodeType().getDataObject());}
var td=new xmp.playlistapi.AdResourceOverrideContext(sd,pm);rd.handleOverrideAdResources(sd,td);};xmp.baseplayer.BasePlayer.prototype.registerRuleClass=function(ud,vd){this._getCurCtx('registerRuleClass').registerRuleClass(ud,vd);};xmp.baseplayer.BasePlayer.prototype._checkXmpState=function(){if(xmp.baseplayer.BasePlayer._fatalException!==null){throw new Error('XMP in bad state: '+xmp.extractErrorMessage(xmp.baseplayer.BasePlayer._fatalException));}};xmp.baseplayer.BasePlayer.prototype._raiseFatalException=function(e){try{var wd=null;if(e instanceof xmp.FatalException){wd=e;}
else{wd=xmp.FatalException.createFatalException(xmp.XmpErrorCodes.FATAL_UNSPECIFIED_ERROR,'BasePlayer',xmp.extractErrorMessage(e));}
xmp.baseplayer.BasePlayer._fatalException=wd;this._logger.fatal('fatal exception',wd);this.handleFatalException(wd);}
catch(secondE){xmp.showFatalErrorMessage('Second chance exception while raising fatal exception: '+xmp.extractErrorMessage(secondE));}};xmp.baseplayer.BasePlayer._staticHandleFatalEx=function(e){if(xmp.baseplayer.BasePlayer._singleInstance!==null){xmp.baseplayer.BasePlayer._singleInstance._raiseFatalException(e);}
else{xmp.showFatalErrorMessage(xmp.extractErrorMessage(e));}};xmp.fatalErrorCallback=new xmp.util.Callback('BasePlayer_fatalErrorCallback',xmp.baseplayer.BasePlayer._staticHandleFatalEx,null);xmp.baseplayer.BasePlayer.prototype.handleBootstrappedInternal=function(ex){xmp.baseplayer.BasePlayer._fatalException=null;if(ex===null){try{this._doAfterBootstrap();}
catch(afterEx){this._raiseFatalException(afterEx);ex=afterEx;}}
else{this._raiseFatalException(ex);}
this.handleBootstrapped((ex===null)?true:false);};xmp.baseplayer.BasePlayer.prototype._doAfterBootstrap=function(){this._initServices(this._options);};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.InstrumentationLoggerListener=function(xd){var yd=Math.min(xmp.util.LogLevels.CRITICAL,xd);xmp.baseplayer.InstrumentationLoggerListener.ctor.call(this,yd);this._handler=new xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler();};xmp.DERIVE_CLASS(xmp.util.AbstractLoggerListener,xmp.baseplayer.InstrumentationLoggerListener);xmp.baseplayer.InstrumentationLoggerListener.prototype.handleLog=function(zd,Bd,Cd,Dd){if(zd<=this.getLogLevel()){this.handleLogError(zd,Bd,Dd);}};xmp.baseplayer.InstrumentationLoggerListener.prototype.handleLogMessage=function(Ed,Fd,Gd){};xmp.baseplayer.InstrumentationLoggerListener.prototype.handleLogError=function(Hd,Id,Jd){this._handler.log(xmp.util.PlayerStats.getInstance(),Jd);};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler=function(){var Kd=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var Ld=Kd.getNodeForPath('Instrumentation');this._maxPostsPerSession=Ld.getInt('maxPostsPerSession',1);this._numPosts=0;this._postUrl=Ld.getString('postUrl','');this._reportingDiv=null;};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler.prototype.createHiddenForm=function(Md,Nd){if(this._postUrl.length>0){var Od=this.assembleReport(Md,Nd);var Pd=window.top.document.createElement('div');Pd.style.display='none';window.top.document.body.insertBefore(Pd,null);var Qd='post';var Rd="<form name='xmp_fatalErrorReportingForm' id='xmp_fatalErrorReportingForm' target='xmp_fatalErrorReportingFormIFrame' ";Rd+=("action='"+this._postUrl+"' ");Rd+=("method='"+Qd+"' ");Rd+=(">");for(name in Od){var Sd=Od[name];Rd+=("<input type='hidden' id='"+name+"' name='"+name+"' value='"+Sd+"'/>");}
Rd+=("</form><iframe id='xmp_fatalErrorReportingFormIFrame' name='xmp_fatalErrorReportingFormIFrame'/>");Pd.innerHTML=Rd;this._reportingDiv=Pd;}};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler.prototype.populateHiddenForm=function(Td,Ud){var Vd=window.document.xmp_fatalErrorReportingForm;var Wd=this.assembleReport(Td,Ud);for(name in Wd){var Xd=Wd[name];Vd[name].value=Xd;}};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler.prototype.log=function(Yd,Zd){if(this._numPosts>=this._maxPostsPerSession){return;}
this._numPosts++;if(this._reportingDiv===null){this.createHiddenForm(Yd,Zd);}
else{this.populateHiddenForm(Yd,Zd);}
if(this._reportingDiv){var $d=window.document.xmp_fatalErrorReportingForm;$d.submit();}};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler.prototype.assembleReport=function(ae,be){var ce={};ce["timestamp"]=((new Date()).getTime()).toString();ce["reason"]=this._extractErrorCode(be).toString();ce["detail"]=be.message;var de=ae.getKeys();for(var i=0;i<de.length;++i){var ee=de[i];var fe=ae.getValue(ee);ce[ee.toLowerCase()]=fe;}
return ce;};xmp.baseplayer.InstrumentationLoggerListener._HttpPostHandler.prototype._extractErrorCode=function(ge){if(ge instanceof xmp.FatalException){return ge.getFatalErrorCode();}
if(ge instanceof xmp.CriticalException){return ge.getCriticalErrorCode();}
return xmp.XmpErrorCodes.NONE;};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.MetaFileLoaderFactory=function(){this._loaderIdCount=0;this._map={};this._loaderCtorMap={};this._addLoaderCtors();};xmp.baseplayer.MetaFileLoaderFactory._singeltonInstance=null;xmp.baseplayer.MetaFileLoaderFactory.getInstance=function(){if(xmp.baseplayer.MetaFileLoaderFactory._singeltonInstance===null){xmp.baseplayer.MetaFileLoaderFactory._singeltonInstance=new xmp.baseplayer.MetaFileLoaderFactory();}
return xmp.baseplayer.MetaFileLoaderFactory._singeltonInstance;};xmp.baseplayer.MetaFileLoaderFactory.prototype.create=function(he){var ie=this._createInternal(he);this._map[ie.getLoaderId()]=ie;return ie;};xmp.baseplayer.MetaFileLoaderFactory.prototype._createInternal=function(je){this._loaderIdCount++;var id=this._loaderIdCount.toString();var ke=this._loaderCtorMap[je];if(!ke){throw new Error('Unrecognized serializer type: '+je);}
var le=xmp.getNamespacedMethod(ke);var me=new le(this,id);return me;};xmp.baseplayer.MetaFileLoaderFactory.prototype._release=function(ne){if(typeof this._map[ne.getLoaderId()]!=='undefined'){delete this._map[ne.getLoaderId()];}};xmp.baseplayer.MetaFileLoaderFactory.prototype._addLoaderCtors=function(){var oe=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath('loaders');var pe=oe.retrieveChildrenNames();for(var i=0;i<pe.length;i++){var qe=pe[i];var re=oe.getNodeForPath(qe);var se=re.getString('JSClass','');this._loaderCtorMap[qe]=se;}};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.PlayListMod=function(te,id){this._id=id;this._action=te;xmp.baseplayer.PlayListMod._staticCounter++;this._modNum=xmp.baseplayer.PlayListMod._staticCounter;};xmp.baseplayer.PlayListMod._staticCounter=0;xmp.baseplayer.PlayListMod.prototype.getModNum=function(){return this._modNum;};xmp.baseplayer.PlayListMod.prototype.getId=function(){return this._id;};xmp.baseplayer.PlayListMod.prototype.getAction=function(){return this._action;};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer.TriggerContext=function(){this._triggerType='';this._commandData='';this._metadataMap=new xmp.util.internals.MetadataMap(false);this._node=null;};xmp.baseplayer.TriggerContext.prototype.getTriggerType=function(){return this._triggerType;};xmp.baseplayer.TriggerContext.prototype.setTriggerType=function(ue){this._triggerType=(ue)?ue:'';};xmp.baseplayer.TriggerContext.prototype.getCommandData=function(){return this._commandData;};xmp.baseplayer.TriggerContext.prototype.setCommandData=function(ve){this._commandData=(ve)?ve:'';};xmp.baseplayer.TriggerContext.prototype.getPlayableNode=function(){return this._node;};xmp.baseplayer.TriggerContext.prototype.setPlayableNode=function(we){this._node=(we)?we:null;};xmp.baseplayer.TriggerContext.prototype.getMetadata=function(xe,ye){return this._metadataMap._get(xe,ye);};xmp.baseplayer.TriggerContext.prototype.setMetadata=function(ze,Ae){this._metadataMap._set(ze,Ae);};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer._NLMap=function(Be){this._player=Be;this._nodeListernerMap={};this._composite_node_listeners_create_data={"Ad":{loader:'AdLoader',tracking:false,metering:true,firstFrameCheck:true},"Promo":{loader:'PromoLoader',tracking:false,metering:false,firstFrameCheck:true},"Content":{loader:'NonAdLoader',tracking:true,metering:false,firstFrameCheck:true},"DEFAULT":{loader:'NonAdLoader',tracking:false,metering:false,firstFrameCheck:false}};};xmp.baseplayer._NLMap.prototype._getNodeListener=function(Ce){var De=this._nodeListernerMap[Ce.getNodeTypeName()];if(!De){throw new xmp.playlistapi.internals.PlayListError('No NodeListener registered for node type: '+Ce.getNodeTypeName());}
return De;};xmp.baseplayer._NLMap.prototype._registerNodeListener=function(Ee,Fe){xmp.validateArguments(arguments,[xmp.OBJECT_TYPE,xmp.OBJECT_TYPE],"_NLMap.registerNodeListener");if(!Ee||!Fe||(Fe.length===0)){throw new xmp.util.internals.InvalidArgsError("The 'listener' argument must be non-null, and the 'nodeTypeArray' argument must be non-null and non-empty.");}
for(var i=0;i<Fe.length;i++){var Ge=Fe[i];if(!(typeof Ge==='string'&&Ge.length>0)){throw new xmp.util.internals.InvalidArgsError("The 'nodeTypeArray' argument must be an array of non-empty strings.");}
var He=this._getBaseNodeType(Ge);var Ie;if(He.length===0){Ie=Ee;}
else{Ie=this._createCompositeNodeListener(this._composite_node_listeners_create_data[He]);Ie.addChild(Ee);}
this._nodeListernerMap[Ge]=Ie;}};xmp.baseplayer._NLMap.prototype._getBaseNodeType=function(Je){var Ke=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var Le=Ke.getNodeForPath('nodeTypeMap/'+Je);var Me=Le.getString('baseType','DEFAULT');return Me;};xmp.baseplayer._NLMap.prototype._createCompositeNodeListener=function(Ne){var Oe=new xmp.baseplayer.listeners.CompositeNodeListener(this._player);if(Ne.loader.length!==0){switch(Ne.loader){case'AdLoader':Oe.addChild(new xmp.baseplayer.listeners.AdLoaderNodeListener(this._player));break;case'NonAdLoader':Oe.addChild(new xmp.baseplayer.listeners.NonAdLoaderNodeListener(this._player));break;case'PromoLoader':Oe.addChild(new xmp.baseplayer.listeners.PromoLoaderNodeListener(this._player));break;default:break;}}
if(true===Ne.tracking){Oe.addChild(new xmp.baseplayer.listeners.TrackingNodeListener(this._player));}
if(true===Ne.metering){Oe.addChild(new xmp.baseplayer.listeners.MeteringNodeListener(this._player));}
if(true===Ne.firstFrameCheck){Oe.addChild(new xmp.baseplayer.listeners.FirstFrameNodeListener(this._player));}
return Oe;};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer._PDMapArray=function(){this._array=[];this._map={};};xmp.baseplayer._PDMapArray.prototype.insert=function(Pe,Qe){if(Pe>=this.getCount()){this._array.push(Qe);}
else{this._array.splice(Pe,0,Qe);}
this._map[Qe.getMetaResourceId()]=Qe;};xmp.baseplayer._PDMapArray.prototype.removeAll=function(){this._array=[];this._map={};};xmp.baseplayer._PDMapArray.prototype.remove=function(Re){var Se=this._array.splice(Re,1)[0];delete this._map[Se.getMetaResourceId()];return Se;};xmp.baseplayer._PDMapArray.prototype.move=function(Te,Ue){var Ve=this.remove(Te);this.insert(Ue,Ve);};xmp.baseplayer._PDMapArray.prototype.getCount=function(){return this._array.length;};xmp.baseplayer._PDMapArray.prototype.getAtIndex=function(We){return this._array[We];};xmp.baseplayer._PDMapArray.prototype.findItem=function(id){var Xe=this._map[id];return(!Xe)?null:Xe;};xmp.baseplayer._PDMapArray.prototype.findItemIndex=function(id){var Ye=this.getCount();for(var i=0;i<Ye;i++){if(this.getAtIndex(i).getMetaResourceId()===id){return i;}}
return-1;};xmp.baseplayer._PDMapArray.prototype.extractIdArray=function(Ze){var $e=[];for(var i=Ze;i<this._array.length;i++){var af=this._array[i];$e.push(af.getMetaResourceId());}
return $e;};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer._PLCtx=function(bf,cf,df,ef){this._AD_PATTERN_CALL_BACK='adPatternCB';this._key=bf;this._owner=cf;this._logger=this._owner._logger;this._latch=null;this._advanceToId="";this._pdMapArray=new xmp.baseplayer._PDMapArray();this._xmpPlayList=null;this._ruleMap=null;this._currentNode=null;this._currentContentNode=null;this._previousNode=null;this._stateListener=null;this._initPlayListData={p:ef,ira:[]};this._modArray=[];this.init(df);};xmp.baseplayer._PLCtx._staticCbCounter=0;xmp.baseplayer._PLCtx.prototype.debugPrint=function(ff){var gf=ff+": ";gf+="key = "+this._key+"; ";gf+="owner = "+this._owner.getId()+"; ";gf+="advanceToId = "+this._advanceToId+"; ";gf+="currently rendering node = "+xmp.util.PlayableNode.safeGetBestId(this._currentNode)+"; ";gf+="current content node = "+xmp.util.PlayableNode.safeGetBestId(this._currentContentNode)+"; ";gf+="current playing index = "+this._getCurrentlyPlayingItemIndex()+"; ";this._logger.debug(gf);};xmp.baseplayer._PLCtx.prototype.getLookAheadNodeArray=function(){return this._xmpPlayList.getLookAheadNodeArray();};xmp.baseplayer._PLCtx.prototype.getLookBehindNodeArray=function(){return this._xmpPlayList.getLookBehindNodeArray();};xmp.baseplayer._PLCtx.prototype.init=function(hf){xmp.validateArguments(arguments,[xmp.STRING_TYPE],"_PLCtx.init");try{var jf=new xmp.util.Callback('masterCB',this._latchComplete,this);this._latch=new xmp.util.Latch([],jf);this._ruleMap=new xmp.baseplayer._RuleMap(this._latch,this);this._initPlayListData.ira=this._ruleMap._loadInvariantRules();this._loadAdPattern(hf);this._ruleMap._loadRuleImplementations();}
catch(e){this._logger.warn('Error in init',e);throw e;}};xmp.baseplayer._PLCtx.prototype.loadContent=function(kf,lf){xmp.validateArguments(arguments,[xmp.OBJECT_TYPE,xmp.STRING_TYPE],"_PLCtx.loadContent");try{var mf=[];var nf={};for(var i=0;i<kf.length;i++){var of=kf[i];if(!xmp.isNonEmptyString(of)){throw new xmp.util.internals.InvalidArgsError("The 'mridArray' argument must contain only non-empty strings.");}
if(typeof(nf[of])!=='undefined'){this._logger.info('Dropping duplicate content ID: '+of);continue;}
nf[of]=of;mf.push(of);}
kf=mf;if(kf.length===0){throw new xmp.util.internals.InvalidArgsError("The 'mridArray' argument must contain at least one unique id.");}
if(lf.length===0){lf=kf[0];}
if(typeof(nf[lf])==='undefined'){throw new xmp.util.internals.InvalidArgsError("The 'startResourceId' argument must be empty or refer to an id in 'mridArray'.");}
this._advanceToId=lf;this._pdMapArray.removeAll();return this.handleLoadContent('loadContent','Batch',kf,0);}
catch(e){this._logger.warn('Error in loadContent',e);throw e;}};xmp.baseplayer._PLCtx.prototype.handleLoadContent=function(pf,id,qf,rf){var cb=this._createPLModCbObj(pf,id);this._latch.addCbName(cb.getId());var sf=xmp.baseplayer.MetaFileLoaderFactory.getInstance().create('videoContentMeta');var tf=sf.setIds(qf,null);sf.setAllLoadedCallback(cb);for(var i=0;i<tf.length;i++){var uf=tf[i];uf.reInitRuntimeMetadata();this._pdMapArray.insert(rf+i,uf);}
sf.load();return cb.getMetadata('_modNum',0);};xmp.baseplayer._PLCtx.prototype.getKey=function(){return this._key;};xmp.baseplayer._PLCtx.prototype.setStateListener=function(vf){this._stateListener=vf;};xmp.baseplayer._PLCtx.prototype.appendToPlayList=function(wf,xf){var yf=null;var zf=this.getPlayListItemCount();if(zf>0){yf=this.getPlayListItem(zf-1).getMetaResourceId();}
return this.insertInPlayListEx('append',wf,yf,xf);};xmp.baseplayer._PLCtx.prototype.removeFromPlayList=function(Af){var Bf=this.findPlayListItemIndex(Af);if(Bf<0){return-1;}
this._pdMapArray.remove(Bf);return this._doLatchAsynch('remove',Af);};xmp.baseplayer._PLCtx.prototype.insertInPlayList=function(Cf,Df,Ef){return this.insertInPlayListEx('insert',Cf,Df,Ef);};xmp.baseplayer._PLCtx.prototype.insertInPlayListEx=function(Ff,Gf,Hf,If){var Jf=this._validateInsertAndMoveArgs(Gf,Hf,If,false);if(If||!this._isRunning()){this._advanceToId=Gf;}
return this.handleLoadContent(Ff,Gf,[Gf],Jf.a+1);};xmp.baseplayer._PLCtx.prototype.moveWithinPlayList=function(Kf,Lf,Mf){var Nf=this._validateInsertAndMoveArgs(Kf,Lf,Mf,true);var Of=Nf.a;if(Nf.a<Nf.i){Of++;}
this._pdMapArray.move(Nf.i,Of);if(Mf){this._advanceToId=Kf;}
return this._doLatchAsynch('move',Kf);};xmp.baseplayer._PLCtx.prototype.setCurrentPlayListItem=function(Pf){var Qf=this.findPlayListItemIndex(Pf);if(Qf<0){throw new xmp.util.internals.InvalidArgsError("The 'mrid' argument must refer to an exising playlist item.");}
this._advanceToId=Pf;return this._doLatchAsynch('setCur',Pf);};xmp.baseplayer._PLCtx.prototype.getCurrentPlayListItem=function(){var Rf=this._currentNode;if(this._isValidNode(Rf)){if(Rf.isContentType()){return Rf.getPlayableData().getMetaResourceId();}
else{var a=this.getLookAheadNodeArray();for(var i=0;i<a.length;i++){var Sf=a[i];if(Sf.isContentType()){return Sf.getPlayableData().getMetaResourceId();}}}}
return'';};xmp.baseplayer._PLCtx.prototype.getPlayListItemCount=function(){return this._pdMapArray.getCount();};xmp.baseplayer._PLCtx.prototype.getPlayListItem=function(Tf){return this._pdMapArray.getAtIndex(Tf);};xmp.baseplayer._PLCtx.prototype.findPlayListItem=function(Uf){return this._pdMapArray.findItem(Uf);};xmp.baseplayer._PLCtx.prototype.findPlayListItemIndex=function(Vf){return this._pdMapArray.findItemIndex(Vf);};xmp.baseplayer._PLCtx.prototype.registerRuleClass=function(Wf,Xf){this._ruleMap.registerRuleClass(Wf,Xf);this._xmpPlayList.addRuleFactory(Wf,this._ruleMap);};xmp.baseplayer._PLCtx.prototype._loadAdPattern=function(Yf){var cb=new xmp.util.Callback(this._AD_PATTERN_CALL_BACK,this._adPatternCb,this);this._latch.addCbName(cb.getId());xmp.net.AjaxRequestManager.getInstance().request(Yf,cb,'adPolicy',Yf,xmp.net.ContentTypes.JSON,null);};xmp.baseplayer._PLCtx.prototype._adPatternCb=function(cb,Zf){var $f=null;if(Zf.isError()){$f={e:Zf.getErrorObject(),j:null};}
else{$f={e:null,j:Zf.getJsonObject()};}
this._latch.called(cb.getId(),$f);if(this._logger.isDebugEnabled()){this._logger.debug("_PLCtx._adPatternCb");}};xmp.baseplayer._PLCtx.prototype._PLModCb=function(cb){this._latch.called(cb.getId(),null);if(this._logger.isDebugEnabled()){this._logger.debug("_PLCtx._PLModCb: "+cb.getId());}};xmp.baseplayer._PLCtx.prototype._latchComplete=function(cb){if(!this._xmpPlayList){var ag=cb.getMetadata(this._AD_PATTERN_CALL_BACK,{});this._initXmpPlayList(ag);}
var bg=this._isRunning();var cg=this._getCurrentlyPlayingItemIndex();if(this._logger.isDebugEnabled()){var dg='Latch Complete, run state = '+this._calcRunState()+', count = '+this.getPlayListItemCount()+', current index = '+cg+', _advanceToId = '+this._advanceToId;this._logger.debug(dg);}
var eg=this._calcAdvanceToIndex();var fg=-1;if(eg>=0){fg=eg;}
else{if(cg<0&&bg){cg=-1;}
fg=(cg+1);}
if(fg<0){this._logger.warn('Invalid refreshFromIndex, correcting to 0: '+fg);fg=0;}
this._xmpPlayList.setContentMetaResourceIds(this._pdMapArray.extractIdArray(fg));this._xmpPlayList.getIterator().first();if(eg>=0&&this._canAdvance()){this.advance();}
this._notifyPLMods();};xmp.baseplayer._PLCtx.prototype._initXmpPlayList=function(gg){try{if(gg.e!==null){throw gg.e;}
this._xmpPlayList=new xmp.playlistapi.AdPatternPlayList(this,gg.j,this._initPlayListData.ira,this._initPlayListData.p);var hg=this._xmpPlayList.getRuleIdArray();this._ruleMap._registerRules(hg);this._xmpPlayList.loadRuleFactoryArray([this._ruleMap]);}
catch(e){this._logger.warn('Error initializing playlist',e);}};xmp.baseplayer._PLCtx.prototype.getCurrentNode=function(){return this._currentNode;};xmp.baseplayer._PLCtx.prototype.advance=function(){if(this._xmpPlayList.getIterator().hasNext()){var ig=this._xmpPlayList.getIterator().next();this._previousNode=this._currentNode;if(this._currentNode===null){this._notifyPLStarted();}
this._currentNode=ig;if(ig.isContentType()){this._currentContentNode=ig;}
if(this._stateListener){this._stateListener.onAdvance();}}
else{this._currentNode=null;this._currentContentNode=null;this._notifyPLEnded();}};xmp.baseplayer._PLCtx.prototype._calcAdvanceToIndex=function(){var jg=-1;if(this._advanceToId.length>0){jg=this.findPlayListItemIndex(this._advanceToId);if((jg<0)&&this._logger.isDebugEnabled()){this._logger.debug("_PLCtx._calcAdvanceToIndex: "+this._advanceToId+" is not a valid play list item id; cannot advance to it.");}}
this._advanceToId='';return jg;};xmp.baseplayer._PLCtx.prototype._canAdvance=function(){var kg=this._isRunning();var lg=this._currentNode;return(!kg||(kg&&this._owner._getNodeListener(lg).canUserControl(lg)));};xmp.baseplayer._PLCtx.prototype._isRunning=function(){return this._isValidNode(this._currentNode);};xmp.baseplayer._PLCtx.prototype._isValidNode=function(mg){return(mg&&mg.isValid()&&mg.getPlayableData());};xmp.baseplayer._PLCtx.prototype.handleInitializePlayableNode=function(ng){this._owner.handleInitializePlayableNode(ng);};xmp.baseplayer._PLCtx.prototype._createPLModCbObj=function(og,id){xmp.baseplayer._PLCtx._staticCbCounter++;var c=xmp.baseplayer._PLCtx._staticCbCounter.toString();var pg='PLModCb_'+c+'_'+og+':'+id;var cb=new xmp.util.Callback(pg,this._PLModCb,this);var qg=new xmp.baseplayer.PlayListMod(og,id);cb.setMetadata('_modNum',qg.getModNum());this._modArray.push(qg);return cb;};xmp.baseplayer._PLCtx.prototype._doLatchAsynch=function(rg,id){var cb=this._createPLModCbObj(rg,id);this._latch.addCbName(cb.getId());xmp.util.Timer.doSimpleCallback(cb);return cb.getMetadata('_modNum',0);};xmp.baseplayer._PLCtx.prototype._getCurrentlyPlayingItemIndex=function(){var sg=this._currentContentNode;if(this._isValidNode(sg)){return this.findPlayListItemIndex(sg.getPlayableData().getMetaResourceId());}
return-1;};xmp.baseplayer._PLCtx.prototype._getPlayableData=function(tg){return this.findPlayListItem(tg);};xmp.baseplayer._PLCtx.prototype._validateInsertAndMoveArgs=function(ug,vg,wg,xg){var yg={a:-1,i:-1};if(!(xmp.isNonEmptyString(ug)&&(vg===null||xmp.isNonEmptyString(vg)))){throw new xmp.util.internals.InvalidArgsError("The 'mrid' argument must be a non-null, non-empty string, "+"and the 'afterMrid' must EITHER be null OR a a non-null, non-empty string");}
if(ug===vg){throw new xmp.util.internals.InvalidArgsError("The 'mrid' argument must NOT be the same value as the 'afterMrid' value.");}
if(typeof(wg)!=='boolean'){throw new xmp.util.internals.InvalidArgsError("The 'setPos' argument must be of boolean type.");}
if(vg!==null){yg.a=this.findPlayListItemIndex(vg);if(yg.a<0){throw new xmp.util.internals.InvalidArgsError("The 'afterMrid' argument must be set to null, or must refer to an exising playlist item.");}}
yg.i=this.findPlayListItemIndex(ug);if(xg){if(yg.i<0){throw new xmp.util.internals.InvalidArgsError("The 'mrid' argument must refer to an exising playlist item when moving.");}}
else{if(yg.i>-1){throw new xmp.util.internals.InvalidArgsError("The 'mrid' argument must NOT refer to an exising playlist item when inserting/appending.");}}
return yg;};xmp.baseplayer._PLCtx.prototype._calcRunState=function(){if(this._isRunning()){return'running';}
else{return this._isValidNode(this._previousNode)?'stopped':'never started';}};xmp.baseplayer._PLCtx.prototype._notifyPLStarted=function(){try{this._owner.handlePlayListStarted();}
catch(e){this._logger.warn('Error calling handlePlayListStarted',e);}};xmp.baseplayer._PLCtx.prototype._notifyPLEnded=function(){try{this._owner.handlePlayListEnded();}
catch(e){this._logger.warn('Error calling handlePlayListEnded',e);}};xmp.baseplayer._PLCtx.prototype._notifyPLMods=function(){var zg=[];zg=zg.concat(this._modArray);this._modArray=[];try{this._owner.handlePlayListModified(zg);}
catch(e){this._logger.warn('Error calling handlePlayListModified',e);}};xmp.createNamespace("xmp.baseplayer");xmp.baseplayer._RuleMap=function(Ag,Bg){this._logger=new xmp.util.internals.CategoryLogger('_RuleMap');this._ruleIdArray=[];this._ruleIdToConstructorMap={};this._latch=Ag;this._player=Bg;};xmp.baseplayer._RuleMap.prototype.registerRuleClass=function(Cg,Dg){if(!(xmp.isNonEmptyString(Cg)&&xmp.isNonEmptyString(Dg))){throw new xmp.util.internals.InvalidArgsError("The 'ruleId' and 'ruleFullyQualifiedConstructor' arguments must be non-null, non-empty strings.");}
if(typeof(this._ruleIdToConstructorMap[Cg])==='undefined'){this._ruleIdArray.push(Cg);this._ruleIdToConstructorMap[Cg]=Dg;}};xmp.baseplayer._RuleMap.prototype._loadInvariantRules=function(){var Eg=xmp.util.SettingsManager.getInstance().getContextNode();if(!Eg.nodeExists('invariantRules')){return[];}
var Fg=Eg.getNodeForPath('invariantRules');var Gg=Fg.retrieveKeys();var Hg="[";for(var i=0;i<Gg.length;i++){var Ig=Gg[i];Hg+=Fg.getString(Ig,'');if(i!=(Gg.length-1)){Hg+=",";}}
Hg+="]";try{return xmp.net.AjaxRequestManager.getInstance()._parseJson(Hg);}
catch(e){this._logger.warn('Error loading invariant rule ids.',e);throw e;}};xmp.baseplayer._RuleMap.prototype._registerRules=function(Jg){var Kg=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('BasePlayer').getString('rule classes namespace','');for(var i=0;i<Jg.length;i++){var Lg=Jg[i];var Mg=Lg;if(Kg.length>0){Mg=(Kg+'.'+Mg);}
this.registerRuleClass(Lg,Mg);}};xmp.baseplayer._RuleMap.prototype._loadRuleImplementations=function(){var Ng=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('BasePlayer').getString('rule classes relative URL','');var cb=new xmp.util.Callback('getRulesCB',this._ruleImplementationsCb,this);this._latch.addCbName(cb.getId());xmp.net.AjaxRequestManager.getInstance().request(Ng,cb,'ruleClasses',Ng,xmp.net.ContentTypes.TEXT,null);};xmp.baseplayer._RuleMap.prototype._ruleImplementationsCb=function(cb,Og){if(Og.isError()){this._latch.called(cb.getId(),{e:Og.getErrorObject()});}
else{try{xmp.net.AjaxRequestManager.getInstance()._parseJavaScript(Og.getText());this._latch.called(cb.getId(),{e:null});}
catch(e){var Pg=(e instanceof Error)?e:new Error('UKNOWN ERROR');this._latch.called(cb.getId(),{e:Pg});}}};xmp.baseplayer._RuleMap.prototype.getCreatableRuleIds=function(){return this._ruleIdArray;};xmp.baseplayer._RuleMap.prototype.createRule=function(Qg){var Rg=this._ruleIdToConstructorMap[Qg];if(!Rg){return null;}
var Sg=xmp.getNamespacedMethod(Rg);var Tg=new Sg(this._player);return Tg;};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.Ad=function(){};xmp.baseplayer.internals.Ad.prototype.buildRelativeURL=function(Ug,Vg,Wg,Xg){var Yg=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('BasePlayer/Additional segvars').getString(Ug,'');var Zg='';if(Vg>0){Zg=this._makeQueryPair('tile',Vg);}
Zg=this._appendToQuery(Zg,Wg);Zg=this._appendToQuery(Zg,Yg);Zg=this._appendToQuery(Zg,Xg);return Zg;};xmp.baseplayer.internals.Ad.getAdServerRoot=function(){var $g=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var ah=$g.getNodeForPath('rootUrlMap/adServer');var bh=ah.getString('rootUrl','');return bh;};xmp.baseplayer.internals.Ad.prototype._appendToQuery=function(ch,dh){var eh=ch;if(dh&&dh.length!==0){if(eh.length>0){eh+='&';}
eh+=dh;}
return eh;};xmp.baseplayer.internals.Ad.prototype.setPingImage=function(fh){return xmp.baseplayer.internals.AdMeteringImagePool.getInstance().setPingImage(fh);};xmp.baseplayer.internals.Ad.createCompanionAdId=function(){return Math.floor((new Date()).getTime()/1000);};xmp.baseplayer.internals.Ad.prototype._makeQueryPair=function(gh,hh){if(!hh){hh='';}
return gh+'='+escape(hh.toString());};xmp.baseplayer.internals.Ad._singeltonInstance=null;xmp.baseplayer.internals.Ad.getInstance=function(){if(xmp.baseplayer.internals.Ad._singeltonInstance===null){xmp.baseplayer.internals.Ad._singeltonInstance=new xmp.baseplayer.internals.Ad();}
return xmp.baseplayer.internals.Ad._singeltonInstance;};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.AdMeteringImagePool=function(){this._initializedState=-1;this._adMeteringImage='';this._POOL_SIZE=10;this._BASE_IMG_NAME='AdMeteringImg_';};xmp.baseplayer.internals.AdMeteringImagePool._imgPingCounter=-1;xmp.baseplayer.internals.AdMeteringImagePool._singeltonInstance=null;xmp.baseplayer.internals.AdMeteringImagePool.getInstance=function(){if(xmp.baseplayer.internals.AdMeteringImagePool._singeltonInstance===null){xmp.baseplayer.internals.AdMeteringImagePool._singeltonInstance=new xmp.baseplayer.internals.AdMeteringImagePool();}
return xmp.baseplayer.internals.AdMeteringImagePool._singeltonInstance;};xmp.baseplayer.internals.AdMeteringImagePool.prototype.setPingImage=function(ih){this._init();if(this._initializedState!==1){return'';}
xmp.baseplayer.internals.AdMeteringImagePool._imgPingCounter++;var jh=xmp.baseplayer.internals.AdMeteringImagePool._imgPingCounter%this._POOL_SIZE;var kh=this._BASE_IMG_NAME+jh.toString();var lh=window.top.document.images[kh];if(!lh){throw new Error('Unexpectded did not find DOM image'+kh);}
lh.src=ih;return kh;};xmp.baseplayer.internals.AdMeteringImagePool.prototype._init=function(){if(this._initializedState===-1){try{var mh=xmp.util.SettingsManager.getInstance().getContextNode();var nh=mh.getNodeForPath('BasePlayer');this._adMeteringImage=xmp.trimString(nh.getString('Ad metering image URL',''));if(this._adMeteringImage.length===0){var oh='Ad metering image URL not specified in primary configuration';throw new Error(oh);}
var ph=window.top.document.createElement('div');ph.style.display='none';window.top.document.body.insertBefore(ph,null);for(var i=0;i<this._POOL_SIZE;i++){var qh=window.top.document.createElement('img');qh.src=this._adMeteringImage;qh.id=this._BASE_IMG_NAME+i.toString();qh.name=qh.id;qh.alt='';qh.align='right';qh.width=qh.height=qh.border=qh.vspace=qh.hspace=0;ph.insertBefore(qh,null);}}
catch(e){xmp.handleFatalError(e);this._initializedState=0;throw e;}
this._initializedState=1;}};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.FileRequestHandle=function(rh,id){this._id=id;this._type=rh;this._dataObject=null;this._loadState=xmp.baseplayer.internals.FileRequestHandle.STATE_CREATED;this._listenerArray=[];this._errorMessage=null;this._maxCacheTime=-1;this._createdTime=this._getCurrentTimeInSeconds();};xmp.baseplayer.internals.FileRequestHandle.STATE_CREATED=0;xmp.baseplayer.internals.FileRequestHandle.STATE_LOADING=1;xmp.baseplayer.internals.FileRequestHandle.STATE_LOADED=2;xmp.baseplayer.internals.FileRequestHandle.prototype.getId=function(){return this._id;};xmp.baseplayer.internals.FileRequestHandle.prototype.getType=function(){return this._type;};xmp.baseplayer.internals.FileRequestHandle.prototype.isNew=function(){return(this._loadState===xmp.baseplayer.internals.FileRequestHandle.STATE_CREATED);};xmp.baseplayer.internals.FileRequestHandle.prototype.isLoading=function(){return(this._loadState===xmp.baseplayer.internals.FileRequestHandle.STATE_LOADING);};xmp.baseplayer.internals.FileRequestHandle.prototype.isLoaded=function(){return(this._loadState===xmp.baseplayer.internals.FileRequestHandle.STATE_LOADED);};xmp.baseplayer.internals.FileRequestHandle.prototype.getDataObject=function(){return this._dataObject;};xmp.baseplayer.internals.FileRequestHandle.prototype._setDataObject=function(sh){this._dataObject=sh;};xmp.baseplayer.internals.FileRequestHandle.prototype._setAsLoading=function(){this._loadState=xmp.baseplayer.internals.FileRequestHandle.STATE_LOADING;};xmp.baseplayer.internals.FileRequestHandle.prototype._setAsLoaded=function(){this._loadState=xmp.baseplayer.internals.FileRequestHandle.STATE_LOADED;this._notifyListeners();};xmp.baseplayer.internals.FileRequestHandle.prototype._notifyListener=function(th){var uh=new xmp.util.Callback('onExecuteCB',this._onExecuteTimer,this);uh.setMetadata('listener',th);var vh=new xmp.util.Timer(this.getId(),xmp.DEFAULT_TIMER_INTERVAL,1,uh);vh.start();};xmp.baseplayer.internals.FileRequestHandle.prototype._onExecuteTimer=function(wh,xh){var yh=wh.getMetadata('listener',{});yh._notifyFileRequestLoaded(this);};xmp.baseplayer.internals.FileRequestHandle.prototype._notifyListeners=function(){for(var i=0;i<this._listenerArray.length;i++){var zh=this._listenerArray[i];this._notifyListener(zh);}
this._listenerArray=[];};xmp.baseplayer.internals.FileRequestHandle.prototype._addListener=function(Ah){this._listenerArray.push(Ah);};xmp.baseplayer.internals.FileRequestHandle.prototype._setErrorMessage=function(Bh){this._errorMessage=Bh;};xmp.baseplayer.internals.FileRequestHandle.prototype._isError=function(){return(this._errorMessage!==null);};xmp.baseplayer.internals.FileRequestHandle.prototype._getErrorMessage=function(){return this._errorMessage;};xmp.baseplayer.internals.FileRequestHandle.prototype._getCurrentTimeInSeconds=function(){return Math.floor((new Date()).getTime()/1000);};xmp.baseplayer.internals.FileRequestHandle.prototype._getAgeInSeconds=function(){return(this._getCurrentTimeInSeconds()-this._createdTime);};xmp.baseplayer.internals.FileRequestHandle.prototype._isExpiredFromCache=function(){if(this._maxCacheTime<=-1){return false;}
if(this._maxCacheTime===0){return true;}
if(this._maxCacheTime<=this._getAgeInSeconds()){return true;}
return false;};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.MetaFileCache=function(){this._map={};this._logger=new xmp.util.internals.CategoryLogger('FileRequestHandle');};xmp.baseplayer.internals.MetaFileCache._singeltonInstance=null;xmp.baseplayer.internals.MetaFileCache.getInstance=function(){if(xmp.baseplayer.internals.MetaFileCache._singeltonInstance===null){xmp.baseplayer.internals.MetaFileCache._singeltonInstance=new xmp.baseplayer.internals.MetaFileCache();}
return xmp.baseplayer.internals.MetaFileCache._singeltonInstance;};xmp.baseplayer.internals.MetaFileCache.prototype.add=function(Ch){this._map[this._makeKeyH(Ch)]=Ch;};xmp.baseplayer.internals.MetaFileCache.prototype.find=function(Dh,id){var Eh=this._map[this._makeKey(Dh,id)];return(!Eh)?null:Eh;};xmp.baseplayer.internals.MetaFileCache.prototype.findOrCreate=function(Fh,id,Gh){this._checkForExpiredHandles();var Hh=this.find(Fh,id);if(Hh===null){Hh=new xmp.baseplayer.internals.FileRequestHandle(Fh,id);this.add(Hh);Hh._addListener(Gh);if(this._logger.isDebugEnabled()){this._logger.debug('Request handle NOT in cache, loading now: '+this._makeKeyH(Hh));}
try{var Ih=Gh._loadFileRequest(Hh);switch(Ih){case xmp.baseplayer.internals.FileRequestHandle.STATE_LOADING:Hh._setAsLoading();break;case xmp.baseplayer.internals.FileRequestHandle.STATE_LOADED:Hh._setAsLoaded();break;default:throw new Error('Unexpected load state.');}}
catch(e){Hh._setErrorMessage(xmp.extractErrorMessage(e));Hh._setAsLoaded();}}
else{if(Hh.isLoading()){if(this._logger.isDebugEnabled()){this._logger.debug('Request handle FOUND in cache, ANOTHER LOADER is loading, will wait: '+this._makeKeyH(Hh));}
Hh._addListener(Gh);}
else if(Hh.isLoaded()){if(this._logger.isDebugEnabled()){this._logger.debug('Request handle FOUND in cache, already loaded: '+this._makeKeyH(Hh));}
Hh._notifyListener(Gh);}}
return Hh;};xmp.baseplayer.internals.MetaFileCache.prototype._makeKey=function(Jh,id){return(Jh+'|'+id);};xmp.baseplayer.internals.MetaFileCache.prototype._makeKeyH=function(Kh){return this._makeKey(Kh.getType(),Kh.getId());};xmp.baseplayer.internals.MetaFileCache.prototype._checkForExpiredHandles=function(){var Lh=[];var Mh='';var Nh=null;for(Mh in this._map){Nh=this._map[Mh];if(this._isHandleExpired(Nh,Mh)){Lh.push(Nh);}}
for(var i=0;i<Lh.length;i++){Nh=Lh[i];try{Mh=this._makeKeyH(Nh);delete this._map[Mh];}
catch(e){this._logger.debug('Error removing request handle from cache.',e);}}};xmp.baseplayer.internals.MetaFileCache.prototype._isHandleExpired=function(Oh,Ph){try{if(Oh._isExpiredFromCache()){this._logger.debug('Request handle expired, will remove from cache.');return true;}
return false;}
catch(e){this._logger.warn('Error checking for expiration: '+Ph,e);}
return false;};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.NullTrigger=function(Qh){this._logger=new xmp.util.internals.CategoryLogger('NullTrigger');this._type=Qh;};xmp.baseplayer.internals.NullTrigger.prototype.getType=function(){return this._type;};xmp.baseplayer.internals.NullTrigger.prototype.doCommands=function(Rh){if(this._logger.isDebugEnabled()){this._logger.debug('Trigger type: '+this.getType()+', Null Trigger, no commands to do.');}};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.Trigger=function(Sh,Th){this._logger=new xmp.util.internals.CategoryLogger('Trigger');this._type=Sh;this._triggerCommandArray=Th;};xmp.baseplayer.internals.Trigger.getTrigger=function(Uh,Vh){var Wh=[];if(Uh.getPlayableData().isLoaded()){var Xh=Uh.getPlayableData().getDataObject().triggers;if(typeof Xh==='object'){for(var i=0;i<Xh.length;i++){var Yh=Xh[i];if(typeof Yh==='object'&&Yh.trigger===Vh&&typeof Yh.commands==='object'&&Yh.commands.length>0){Wh=xmp.baseplayer.internals.Trigger._cloneTriggerCommands(Yh.commands);break;}}}
var Zh=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('NodeTriggers/'+Uh.getNodeTypeName()).getString(Vh,'');if(Zh.length>0){var $h=null;try{$h=xmp.net.AjaxRequestManager.prototype._parseJson(Zh);}
catch(e){$h=null;this._logger.warn('Error getting global trigger for type: '+Uh.getNodeTypeName(),e);}
if($h!==null){Wh=$h.concat(Wh);}}}
if(Wh.length>0){return new xmp.baseplayer.internals.Trigger(Vh,Wh);}
else{return new xmp.baseplayer.internals.NullTrigger(Vh);}};xmp.baseplayer.internals.Trigger._cloneTriggerCommands=function(ai){var bi=[];for(var i=0;i<ai.length;i++){var ci=ai[i];bi.push({type:ci.type,data:ci.data});}
return bi;};xmp.baseplayer.internals.Trigger.prototype.getType=function(){return this._type;};xmp.baseplayer.internals.Trigger.prototype.doCommands=function(di){for(var i=0;i<this._triggerCommandArray.length;i++){var ei=null;try{ei=this._triggerCommandArray[i];var fi=xmp.baseplayer.internals.TriggerCommandFactory.getInstance().create(ei.type);di.setCommandData(ei.data);di.setTriggerType(this.getType());fi.doCommand(di);}
catch(e){this._logger.warn('Error invoking trigger command, type: '+ei.type+', data: '+ei.data,e);}}};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.TriggerCommandFactory=function(){this._logger=new xmp.util.internals.CategoryLogger('TriggerCommandFactory');xmp.util.SettingsManager.getInstance().addContextChangeListener(new xmp.util.Callback('TriggerCommandFactory',this._handleContextChange,this));this._triggerCommandMap=null;this._faultCfg();};xmp.baseplayer.internals.TriggerCommandFactory._singeltonInstance=null;xmp.baseplayer.internals.TriggerCommandFactory.getInstance=function(){if(xmp.baseplayer.internals.TriggerCommandFactory._singeltonInstance===null){xmp.baseplayer.internals.TriggerCommandFactory._singeltonInstance=new xmp.baseplayer.internals.TriggerCommandFactory();}
return xmp.baseplayer.internals.TriggerCommandFactory._singeltonInstance;};xmp.baseplayer.internals.TriggerCommandFactory.prototype.create=function(gi){var hi=this._triggerCommandMap[gi];if(!hi){return(new xmp.baseplayer.internals.NullTriggerCommand(gi));}
try{var ii=xmp.getNamespacedMethod(hi);var ji=new ii();return ji;}
catch(e){this._logger.warn('Error creating Trigger Command: '+gi,e);return(new xmp.baseplayer.internals.NullTriggerCommand(gi));}};xmp.baseplayer.internals.TriggerCommandFactory.prototype._faultCfg=function(){if(this._triggerCommandMap===null){this._triggerCommandMap={};var ki=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('TriggerCommands');var li=ki.retrieveKeys();for(var i=0;i<li.length;i++){var mi=li[i];var ni=ki.getString(mi,'');this._triggerCommandMap[mi]=ni;}
this._triggerCommandMap['setImg']='xmp.baseplayer.internals.SetImageTriggerCommand';this._triggerCommandMap['echo']='xmp.baseplayer.internals.EchoTriggerCommand';}};xmp.baseplayer.internals.TriggerCommandFactory.prototype._handleContextChange=function(){this._triggerCommandMap=null;this._faultCfg();};xmp.baseplayer.internals.NullTriggerCommand=function(oi){this._type=oi;this._logger=new xmp.util.internals.CategoryLogger('NullTriggerCommand');};xmp.baseplayer.internals.NullTriggerCommand.prototype.doCommand=function(pi){if(this._logger.isDebugEnabled()){this._logger.debug('Trigger Command unrecognized: '+this._type);}};xmp.baseplayer.internals.EchoTriggerCommand=function(){this._logger=new xmp.util.internals.CategoryLogger('EchoTriggerCommand');};xmp.baseplayer.internals.EchoTriggerCommand.prototype.doCommand=function(qi){var ri=qi.getCommandData();if(this._logger.isDebugEnabled()){this._logger.debug('Trigger type: '+qi.getTriggerType()+', Doing "echo" command, data = '+ri);}};xmp.baseplayer.internals.SetImageTriggerCommand=function(){this._logger=new xmp.util.internals.CategoryLogger('SetImageTriggerCommand');};xmp.baseplayer.internals.SetImageTriggerCommand.prototype.doCommand=function(si){var ti=this._cleanImageData(si.getCommandData());var ui=xmp.baseplayer.internals.Ad.getInstance().setPingImage(ti);if(this._logger.isDebugEnabled()){this._logger.debug('Trigger type: '+si.getTriggerType()+', Doing "setImg" command, data = '+ti+', using img dom ID: '+ui);}};xmp.baseplayer.internals.SetImageTriggerCommand.prototype._cleanImageData=function(vi){var wi=vi.indexOf('\"');if(wi===-1){return vi;}
vi=vi.substr(wi+1);var xi=vi.indexOf('\"');vi=vi.substr(0,xi);return vi;};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.VideoAdMetaFileLoader=function(yi,zi){this._CLASS_NAME='VideoAdMetaFileLoader';this._AD_MAN_TYPE='adMan';this._AD_SERVER_TYPE='adServer';this._logger=new xmp.util.internals.CategoryLogger(this._CLASS_NAME);this._THIS_TYPE='videoAdMeta';this._owner=yi;this._loaderId=zi;this._resBundle=null;this._callback=null;this._companionAdId=xmp.baseplayer.internals.Ad.createCompanionAdId();this._latchCompleteCb=this._createCb(null,'LatchComplete',this._handleLatchComplete);this._latch=new xmp.util.Latch([],this._latchCompleteCb);};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype.getLoaderId=function(){return this._loaderId;};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype.setResBundle=function(Ai,Bi){this._resBundle=Ai;this._callback=Bi;};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype.load=function(){try{if(this._shortCircuit()){return;}
this._latchCompleteCb.setMetadata('LatchPhase',this._AD_MAN_TYPE);var Ci=this._resBundle.getResourceTypes();for(var i=0;i<Ci.length;i++){var Di=this._resBundle.getMetaResource(Ci[i]);Di.setCompanionAdId(this._companionAdId);this._loadARM(Di,this._AD_MAN_TYPE,xmp.net.ContentTypes.TEXT,Di.getId());}}
catch(e){this._handleError(e);}};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._shortCircuit=function(){if(this._resBundle.getCount()===0){this._resBundle._setRawData('Loaded (no resources)');}
if(this._resBundle.isLoaded()||this._resBundle.isError()){xmp.util.Timer.doSimpleCallback(this._createCb(null,'endAsynch',this._end));return true;}
return false;};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._handleLatchComplete=function(cb){try{var Ei=this._latchCompleteCb.getMetadata('LatchPhase','');if(Ei===this._AD_MAN_TYPE){this._doAdManComplete();}
else if(Ei===this._AD_SERVER_TYPE){this._doAdServerComplete();}
else{throw new Error('Unrecognized phase: '+Ei);}}
catch(e){this._handleError(e);}};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._doAdManComplete=function(){this._latchCompleteCb.setMetadata('LatchPhase',this._AD_SERVER_TYPE);var Fi=this._resBundle.getResourceTypes();var Gi=0;for(var i=0;i<Fi.length;i++){var Hi=this._resBundle.getMetaResource(Fi[i]);var Ii=this._makeCbName(Hi,this._AD_MAN_TYPE);var Ji=this._latchCompleteCb.getMetadata(Ii,xmp.util.internals.MetadataMap.defaultObj);if(!Ji.isError()){var Ki=this._buildAdServerRelUrl(Hi,Ji.getText());if(Hi.getType()==='primary'){Gi++;this._loadARM(Hi,this._AD_SERVER_TYPE,xmp.net.ContentTypes.JSON,Ki);}
else if(Hi.getType()==='synch_unit'){var Li=xmp.baseplayer.internals.Ad.getAdServerRoot();Hi._setRawData(Li+Ki);}}
else{Hi._setErrorMessage(Ji.getErrorMessage());}}
if(Gi===0){this._end();}};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._doAdServerComplete=function(){var Mi=this._resBundle.getMetaResource('primary');var Ni=this._makeCbName(Mi,this._AD_SERVER_TYPE);var Oi=this._latchCompleteCb.getMetadata(Ni,xmp.util.internals.MetadataMap.defaultObj);if(!Oi.isError()){Mi._setRawData(Oi.getJsonObject());}
else{Mi._setErrorMessage(Oi.getErrorMessage());}
this._end();};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._handleError=function(e){this._handleErrorMessage(xmp.extractErrorMessage(e));};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._handleErrorMessage=function(Pi){this._resBundle._setErrorMessage(Pi);this._end();};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._end=function(){if(this._owner!==null){this._owner._release(this);this._owner=null;}
if(!this._resBundle.isError()){var Qi=this._resBundle.getMetaResource('primary');if(Qi!==null&&Qi.isError()){this._resBundle._setErrorMessage('Primary Resource Error: '+Qi.getErrorMessage());}}
if(!this._resBundle.isError()){this._resBundle._setRawData('Loaded');}
try{this._callback.call(this._resBundle);}
catch(e){this._logger.warn('Error calling callback',e);}};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._createCb=function(Ri,Si,Ti){return(new xmp.util.Callback(this._makeCbName(Ri,Si),Ti,this));};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._makeCbName=function(Ui,Vi){var Wi=(Ui!==null)?Ui.getType():'';return(this._CLASS_NAME+'_'+Vi+'_'+Wi+'_'+this._loaderId);};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._buildAdServerRelUrl=function(Xi,Yi){var Zi=xmp.trimString(Yi);var $i=Xi.getMetadata('segvars','');return xmp.baseplayer.internals.Ad.getInstance().buildRelativeURL(Xi.getType(),this._companionAdId,Zi,$i);};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._loadARM=function(aj,bj,cj,dj){var cb=this._createCb(aj,bj,this._handleARMResponse);this._latch.addCbName(cb.getId());xmp.net.AjaxRequestManager.getInstance().request(dj,cb,bj,dj,cj,null);};xmp.baseplayer.internals.VideoAdMetaFileLoader.prototype._handleARMResponse=function(ej,fj){this._latch.called(ej.getId(),fj);};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.VideoContentMetaFileLoader=function(gj,hj){this._logger=new xmp.util.internals.CategoryLogger('VideoContentMetaFileLoader');this._THIS_TYPE='videoContentMeta';this._owner=gj;this._loaderId=hj;this._handleArray=[];this._handleMap={};this._perIdCallback=null;this._allLoadedCallback=null;this._loadedCount=0;this._loadCalled=false;};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype.getLoaderId=function(){return this._loaderId;};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype.setIds=function(ij,jj){this._loadCalled=false;this._handleArray=[];this._perIdCallback=jj;var kj={};for(var i=0;i<ij.length;i++){var id=ij[i];if(!(typeof id==='string'&&id.length>0)){throw new xmp.util.internals.InvalidArgsError("The 'ids' argument must be an array of non-empty strings.");}
if(typeof kj[id]!=='undefined'){this._logger.warn('Skipping duplicate ID: '+id);continue;}
kj[id]=id;var lj=xmp.baseplayer.internals.MetaFileCache.getInstance().findOrCreate(this._THIS_TYPE,id,this);var mj={h:lj,ready:false};this._handleArray.push(mj);this._handleMap[lj.getId()]=mj;}
return this._extractPlayableDataArray();};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype.setAllLoadedCallback=function(nj){this._allLoadedCallback=nj;};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype.load=function(){this._loadCalled=true;if(this._handleArray.length===0){this._releaseThis();this._notifyAllLoaded();return;}
this._loadedCount=0;for(var i=0;i<this._handleArray.length;i++){var oj=this._handleArray[i];if(oj.ready){this._notifyPerFile(oj.h);}}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._extractPlayableDataArray=function(){var pj=[];for(var i=0;i<this._handleArray.length;i++){var qj=this._handleArray[i].h;pj.push(qj.getDataObject());}
return pj;};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._notifyPerFile=function(rj){if(rj.isLoaded()){this._loadedCount++;this._notifyPerFileCore(rj);}
if(this._loadedCount>=this._handleArray.length){this._releaseThis();this._notifyAllLoaded();}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._releaseThis=function(){if(this._owner!==null){this._owner._release(this);this._owner=null;}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._notifyPerFileCore=function(sj){try{if(this._perIdCallback!==null){this._perIdCallback.call(sj.getDataObject());}}
catch(e){this._logger.warn('Error calling per-file-callback',e);}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._notifyAllLoaded=function(){try{if(this._allLoadedCallback!==null){this._allLoadedCallback.call();}}
catch(e){this._logger.warn('Error calling all-loaded-callback',e);}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._notifyFileRequestLoaded=function(tj){if(this._loadCalled){this._notifyPerFile(tj);}
else{var uj=this._handleMap[tj.getId()];if(uj.h!==tj){throw new Error('Unexpected, handles not the same reference.');}
uj.ready=true;}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._loadFileRequest=function(vj){var wj=null;try{wj=new xmp.util.PlayableData(vj.getId());vj._setDataObject(wj);var xj=new xmp.util.Callback('VideoContentMetaFileLoader'+'_'+this.getLoaderId()+'_'+vj.getId(),this._handleAjaxResponse,this);var yj=xmp.net.AjaxRequestManager.getInstance();xj.setMetadata('handle',vj);yj.request(vj.getId(),xj,vj.getType(),vj.getId(),xmp.net.ContentTypes.JSON,null);return xmp.baseplayer.internals.FileRequestHandle.STATE_LOADING;}
catch(e){try{if(wj!==null){wj._setErrorMessage(xmp.extractErrorMessage(e));}}
catch(e2){this._logger.warn('Second chance error handling created file request',e2);}
throw e;}};xmp.baseplayer.internals.VideoContentMetaFileLoader.prototype._handleAjaxResponse=function(zj,Aj){var Bj=zj.getMetadata('handle',{});var Cj=Bj.getDataObject();if(!Aj.isError()){Cj._setRawData(Aj.getJsonObject());}
else{Bj._setErrorMessage(Aj.getErrorMessage());Cj._setErrorMessage(Aj.getErrorMessage());}
Bj._setAsLoaded();};xmp.createNamespace("xmp.baseplayer.internals");xmp.baseplayer.internals.VideoPromoMetaFileLoader=function(Dj,Ej){this._logger=new xmp.util.internals.CategoryLogger('VideoPromoMetaFileLoader');this._THIS_TYPE='videoPromoMeta';this._owner=Dj;this._loaderId=Ej;this._playableNode=null;this._callback=null;};xmp.baseplayer.internals.VideoPromoMetaFileLoader.prototype.getLoaderId=function(){return this._loaderId;};xmp.baseplayer.internals.VideoPromoMetaFileLoader.prototype.setNode=function(Fj,Gj){this._playableNode=Fj;this._callback=Gj;};xmp.baseplayer.internals.VideoPromoMetaFileLoader.prototype.load=function(){var Hj=new xmp.util.Callback('VideoPromoMetaFileLoader'+'_'+this._loaderId,this._handleAjaxResponse,this);var Ij=xmp.net.AjaxRequestManager.getInstance();var Jj=this._playableNode.getPlayableData();var id=Jj.getMetaResourceId();Ij.request(id,Hj,this._THIS_TYPE,id,xmp.net.ContentTypes.JSON,null);};xmp.baseplayer.internals.VideoPromoMetaFileLoader.prototype._handleAjaxResponse=function(Kj,Lj){var Mj=this._playableNode.getPlayableData();if(!Lj.isError()){Mj._setRawData(Lj.getJsonObject());}
else{Mj._setErrorMessage(Lj.getErrorMessage());}
if(this._owner!==null){this._owner._release(this);this._owner=null;}
try{this._callback.call(this._playableNode);}
catch(e){this._logger.warn('Error calling callback',e);}};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.AdLoaderNodeListener=function(Nj){xmp.baseplayer.listeners.AdLoaderNodeListener.ctor.call(this,'AdLoader',Nj);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AdResNodeListener,xmp.baseplayer.listeners.AdLoaderNodeListener);xmp.baseplayer.listeners.AdLoaderNodeListener.prototype._handleResBundleLoaded=function(Oj,Pj){if(Pj.isError()){Oj.getPlayableData()._setErrorMessage(Pj.getErrorMessage());}
else{Oj.getPlayableData()._setRawData(Pj.getMetaResource('primary').getDataObject());}};xmp.baseplayer.listeners.NonAdLoaderNodeListener=function(Qj){xmp.baseplayer.listeners.NonAdLoaderNodeListener.ctor.call(this,'NonAdLoader',Qj);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AdResNodeListener,xmp.baseplayer.listeners.NonAdLoaderNodeListener);xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.CompositeNodeListener=function(Rj){this._com_logger=new xmp.util.internals.CategoryLogger('CompositeNodeListener');this._constants=xmp.baseplayer.listeners.CompositeNodeListener;xmp.baseplayer.listeners.CompositeNodeListener.ctor.call(this,this._constants.COMPOSITE_NODE_LISTENER,Rj);this.children=[];};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AbstractNodeListener,xmp.baseplayer.listeners.CompositeNodeListener);xmp.baseplayer.listeners.CompositeNodeListener.COMPOSITE_NODE_LISTENER="Composite";xmp.baseplayer.listeners.CompositeNodeListener.INITIALIZE="Initialize";xmp.baseplayer.listeners.CompositeNodeListener.COMPLETE="Complete";xmp.baseplayer.listeners.CompositeNodeListener.RENDER="Render";xmp.baseplayer.listeners.CompositeNodeListener.DYNAMIC_RULES="DynamicRules";xmp.baseplayer.listeners.CompositeNodeListener.TIMELINE_CHANGE="TimelineChange";xmp.baseplayer.listeners.CompositeNodeListener.CAN_USER_CONTROL="CanUserControl";xmp.baseplayer.listeners.CompositeNodeListener.CAN_COMPLETE_NOW="CanCompleteNow";xmp.baseplayer.listeners.CompositeNodeListener.COMPLETE_ASNCH="CompleteAsynch";xmp.baseplayer.listeners.CompositeNodeListener.OVERRIDE_AD_RESOURCES="OverrideAdResources";xmp.baseplayer.listeners.CompositeNodeListener.prototype.canUserControl=function(Sj){return this.dispatch(this._constants.CAN_USER_CONTROL,[Sj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleDynamicRules=function(Tj){this.dispatch(this._constants.DYNAMIC_RULES,[Tj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleRender=function(Uj){this.dispatch(this._constants.RENDER,[Uj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleInitialize=function(Vj){this.dispatch(this._constants.INITIALIZE,[Vj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleComplete=function(Wj){this.dispatch(this._constants.COMPLETE,[Wj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.canCompleteNow=function(Xj){return this.dispatch(this._constants.CAN_COMPLETE_NOW,[Xj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleCompleteAsynch=function(Yj,Zj){this.dispatch(this._constants.COMPLETE_ASNCH,[Yj,Zj]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleOpen=function($j){this.dispatch(xmp.OPEN,[$j]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleConnecting=function(ak){this.dispatch(xmp.CONNECTING,[ak]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleConnected=function(bk){this.dispatch(xmp.CONNECTED,[bk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handlePlay=function(ck){this.dispatch(xmp.PLAY,[ck]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleFirstFrameRendered=function(dk){this.dispatch(xmp.FIRST_FRAME_RENDERED,[dk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handlePause=function(ek){this.dispatch(xmp.PAUSE,[ek]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleStop=function(fk){this.dispatch(xmp.STOP,[fk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleRewind=function(gk){this.dispatch(xmp.REWIND,[gk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleFastForward=function(hk){this.dispatch(xmp.FAST_FORWARD,[hk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleSeekable=function(ik){this.dispatch(xmp.SEEKABLE,[ik]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleEnded=function(jk){this.dispatch(xmp.ENDED,[jk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleBuffering=function(kk,lk){this.dispatch(xmp.BUFFERING,[kk,lk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleTimelineChange=function(mk,nk,ok){this.dispatch(this._constants.TIMELINE_CHANGE,[mk,nk,ok]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleError=function(pk,e){this.dispatch(xmp.ERRORS,[pk,e]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.handleOverrideAdResources=function(qk,rk){this.dispatch(this._constants.OVERRIDE_AD_RESOURCES,[qk,rk]);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.dispatch=function(sk,tk){var uk=this.children.length;for(var i=0;i<uk;i++){var vk=this.children[i];var wk=vk.callbacks[sk];var xk=null;try{xk=wk.method.apply(vk.listener,tk);}
catch(e){this._com_logger.warn('Error dispatching: '+sk+' on '+vk.listener.getId()+' node listener.',e);try{var yk=tk[0];vk.listener.handleError(yk,e);}
catch(e2){try{this._com_logger.warn('Error calling handleError while dispatching: '+sk+' on '+vk.listener.getId()+' node listener.',e2);}
catch(e3){}}}
if(wk.return_type===xmp.BOOLEAN_TYPE&&false===xk){return false;}}
return true;};xmp.baseplayer.listeners.CompositeNodeListener.prototype.addChild=function(zk){var Ak={listener:zk,callbacks:null};this.initChildCallbacks(Ak,zk);this.children.push(Ak);};xmp.baseplayer.listeners.CompositeNodeListener.prototype.initChildCallbacks=function(Bk,Ck){var Dk=[{name:this._constants.CAN_USER_CONTROL,data:{method:Ck.canUserControl,return_type:xmp.BOOLEAN_TYPE}},{name:this._constants.DYNAMIC_RULES,data:{method:Ck.handleDynamicRules,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.INITIALIZE,data:{method:Ck.handleInitialize,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.COMPLETE,data:{method:Ck.handleComplete,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.RENDER,data:{method:Ck.handleRender,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.OPEN,data:{method:Ck.handleOpen,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.CONNECTING,data:{method:Ck.handleConnecting,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.CONNECTED,data:{method:Ck.handleConnected,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.FIRST_FRAME_RENDERED,data:{method:Ck.handleFirstFrameRendered,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.PLAY,data:{method:Ck.handlePlay,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.PAUSE,data:{method:Ck.handlePause,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.STOP,data:{method:Ck.handleStop,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.REWIND,data:{method:Ck.handleRewind,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.FAST_FORWARD,data:{method:Ck.handleFastForward,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.SEEKABLE,data:{method:Ck.handleSeekable,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.ENDED,data:{method:Ck.handleEnded,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.BUFFERING,data:{method:Ck.handleBuffering,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.TIMELINE_CHANGE,data:{method:Ck.handleTimelineChange,return_type:xmp.UNDEFINED_TYPE}},{name:xmp.ERRORS,data:{method:Ck.handleError,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.CAN_COMPLETE_NOW,data:{method:Ck.canCompleteNow,return_type:xmp.BOOLEAN_TYPE}},{name:this._constants.COMPLETE_ASNCH,data:{method:Ck.handleCompleteAsynch,return_type:xmp.UNDEFINED_TYPE}},{name:this._constants.OVERRIDE_AD_RESOURCES,data:{method:Ck.handleOverrideAdResources,return_type:xmp.UNDEFINED_TYPE}}];Bk.callbacks={};var Ek=Dk.length;for(var i=0;i<Ek;i++){Bk.callbacks[Dk[i].name]=Dk[i].data;}};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.FirstFrameNodeListener=function(Fk){this._logger=new xmp.util.internals.CategoryLogger('FirstFrameNodeListener');this._FIRST_FRAME_TIMEOUT_MIN=10000;this._firstFrameTimer=null;this._FIRST_FRAME_TIMER_ID="FIRST_FRAME_TIMER";this._currentNode=null;xmp.baseplayer.listeners.FirstFrameNodeListener.ctor.call(this,'FirstFrameCheck',Fk);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AbstractNodeListener,xmp.baseplayer.listeners.FirstFrameNodeListener);xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleConnecting=function(Gk){if(this._firstFrameTimer){this._firstFrameTimer.stop();}
var Hk=new xmp.util.Callback('basePlayerTimeout',this._handleFirstFrameTimeout,this);var Ik=xmp.util.SettingsManager.getInstance().getContextNode();var Jk=Ik.getNodeForPath('Global');var Kk=Jk.getInt('first frame timeout',this._FIRST_FRAME_TIMEOUT_MIN);this._firstFrameTimer=new xmp.util.Timer(this._FIRST_FRAME_TIMER_ID,Kk,1,Hk);this._currentNode=Gk;this._startTimer(this._firstFrameTimer);};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleFirstFrameRendered=function(Lk){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handlePause=function(Mk){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleStop=function(Nk){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleRewind=function(Ok){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleFastForward=function(Pk){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleSeekable=function(Qk){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype.handleError=function(Rk,e){this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype._reset=function(){this._currentNode=null;this._stopTimer(this._firstFrameTimer);this._firstFrameTimer=null;};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype._handleFirstFrameTimeout=function(){var Sk=xmp.CriticalException.createCriticalException(xmp.XmpErrorCodes.CRITICAL_FIRST_FRAME_TIMEOUT,'FirstFrameNodeListener',"Timeout received in playing "+this._currentNode.getBestId());this._logger.critical('First Frame Timeout',Sk);this.getPlayer().getMediaPlayer().close();this.getPlayer().onError(this._currentNode,Sk);this._reset();};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype._startTimer=function(Tk){if(Tk){Tk.start();}};xmp.baseplayer.listeners.FirstFrameNodeListener.prototype._stopTimer=function(Uk){if(Uk){Uk.stop();}};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.MeteringNodeListener=function(Vk){this._constants=xmp.baseplayer.listeners.MeteringNodeListener;xmp.baseplayer.listeners.MeteringNodeListener.ctor.call(this,this._constants.METERING_NODE_LISTENER,Vk);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.TriggerNodeListener,xmp.baseplayer.listeners.MeteringNodeListener);xmp.baseplayer.listeners.MeteringNodeListener.METERING_NODE_LISTENER="Metering";xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.PromoLoaderNodeListener=function(Wk){xmp.baseplayer.listeners.PromoLoaderNodeListener.ctor.call(this,'PromoLoader',Wk);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.AbstractNodeListener,xmp.baseplayer.listeners.PromoLoaderNodeListener);xmp.baseplayer.listeners.PromoLoaderNodeListener.prototype.canCompleteNow=function(Xk){if(Xk.getPlayableData().isError()){return true;}
return Xk.getPlayableData().isLoaded();};xmp.baseplayer.listeners.PromoLoaderNodeListener.prototype.handleCompleteAsynch=function(Yk,Zk){var $k=xmp.baseplayer.MetaFileLoaderFactory.getInstance().create('videoPromoMeta');var al=new xmp.util.Callback('gotPromoCallback',this._gotPromoCallback,this);al.setMetadata('RelayCallback',Zk);$k.setNode(Yk,al);$k.load();};xmp.baseplayer.listeners.PromoLoaderNodeListener.prototype._gotPromoCallback=function(bl,cl){var dl=bl.getMetadata('RelayCallback',{});dl.call(cl);};xmp.createNamespace("xmp.baseplayer.listeners");xmp.baseplayer.listeners.TrackingNodeListener=function(el){this._constants=xmp.baseplayer.listeners.TrackingNodeListener;xmp.baseplayer.listeners.TrackingNodeListener.ctor.call(this,this._constants.TRACKING_NODE_LISTENER,el);};xmp.DERIVE_CLASS(xmp.baseplayer.listeners.TriggerNodeListener,xmp.baseplayer.listeners.TrackingNodeListener);xmp.baseplayer.listeners.TrackingNodeListener.TRACKING_NODE_LISTENER="Tracking";