// Turner XMP, Release Build, © 2007 Turner Broadcasting System, Inc. A Time Warner Company.  Version: 0.1.633.2120
// xmp_playerapi, xmp_playerapi_0_1_633_2120.js
xmp.PlaybackMode=function(aa,ba,ca){this.p_type=aa;this.p_name=ba;this.p_transitionTable=ca;};xmp.PlaybackMode.prototype.i_getName=function(){return this.p_name;};xmp.PlaybackMode.prototype.i_getType=function(){return this.p_type;};xmp.PlaybackMode.prototype.i_changeMode=function(da,ea,fa,ga){this.p_validateModeChange(da,ea,fa);da.i_changeState(ea,ga);};xmp.PlaybackMode.prototype.p_invalidOperation=function(ha,ia){throw new xmp.PlaybackModeError("Validating state operation.","Invalid mode operation.  The \""+this.p_name+"\" mode does not change or transition to a mode that supports the \""+ia.toLowerCase()+"\" operation.",this);};xmp.PlaybackMode.prototype.p_validateModeChange=function(ja,ka,la){if(false===this.i_isAvailable(ja,ka)){this.p_invalidOperation(ja,la);}};xmp.PlaybackMode.prototype.i_canTransition=function(ma){if(this.p_transitionTable===null){return false;}
for(var i=0;i<this.p_transitionTable.length;i++){if(this.p_transitionTable[i]===ma){return true;}}
return false;};xmp.PlaybackMode.prototype.i_getPlayer=function(na){return na.i_getPlayer();};xmp.PlaybackMode.prototype.i_open=function(oa,pa){};xmp.PlaybackMode.prototype.i_close=function(qa){};xmp.PlaybackMode.prototype.i_play=function(ra){};xmp.PlaybackMode.prototype.i_pause=function(sa){};xmp.PlaybackMode.prototype.i_stop=function(ta){};xmp.PlaybackMode.prototype.i_rewind=function(ua){};xmp.PlaybackMode.prototype.i_fastForward=function(va){};xmp.PlaybackMode.prototype.i_seek=function(wa,xa){};xmp.PlaybackMode.prototype.i_ended=function(ya){};xmp.PlaybackMode.prototype.i_error=function(za){};xmp.PlaybackMode.prototype.i_transition=function(Aa,Ba,Ca){};xmp.PlaybackMode.prototype.i_isAvailable=function(Da,Ea){return false;};xmp.PlaybackMode.prototype.i_getPosition=function(Fa){return 0;};xmp.PlaybackMode.prototype.i_getDuration=function(Ga){return 0;};xmp.PlaybackMode.prototype.i_getVolume=function(Ha){return 0;};xmp.PlaybackMode.prototype.i_setVolume=function(Ia,Ja){};xmp.PlaybackMode.prototype.i_getMute=function(Ka){return false;};xmp.PlaybackMode.prototype.i_setMute=function(La,Ma){};xmp.PlaybackMode.prototype.i_getFullscreen=function(Na){return false;};xmp.PlaybackMode.prototype.i_setFullscreen=function(Oa,Pa){};xmp.PlaybackMode.prototype.i_getBufferingProgress=function(Qa){return null;};xmp.PlugInError=function(Ra,Sa,Ta,Ua){xmp.PlugInError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLUGIN,Ra,Sa,Ta);this.plugIn=Ua;};xmp.DERIVE_CLASS(xmp.FatalException,xmp.PlugInError);xmp.i_NATIVE_PLAYER_Z_INDEX=1;xmp.i_VERSION_DELIMITER=".";xmp.i_MOVETO_OPERATION="moveTo";xmp.i_ACTIVEX_VERSION_DETECTION_JSON="ActiveX Version Detection JSON";xmp.i_MOZILLA_VERSION_DETECTION_JSON="Mozilla Version Detection JSON";xmp.AbstractNativePlayer=function(Va,Wa,Xa){this.p_type=Va;this.p_listener=Wa;this.p_configuration=Xa;this.p_data=null;this.p_volume=0;this.p_mute=false;this.p_bufferingProgress={percent:0,bytesDownloaded:0,bytesTotal:0};this.p_opened=false;this.p_monitorTimer=null;this.p_logger=null;this.p_plugIns=null;};xmp.AbstractNativePlayer.prototype.i_open=function(Ya){};xmp.AbstractNativePlayer.prototype.i_close=function(){this.p_opened=false;this.i_stopMonitor();this.p_bufferingProgress={percent:0,bytesDownloaded:0,bytesTotal:0};};xmp.AbstractNativePlayer.prototype.i_fini=function(){try{if(this.p_data===null){return;}
this.i_close();var Za=this.i_getNative();var $a=xmp.getDomParent(Za);$a.removeChild(Za);}
catch(e){}};xmp.AbstractNativePlayer.prototype.i_play=function(){this.i_startMonitor();};xmp.AbstractNativePlayer.prototype.i_pause=function(){this.i_stopMonitor();};xmp.AbstractNativePlayer.prototype.i_stop=function(){this.i_stopMonitor();};xmp.AbstractNativePlayer.prototype.i_rewind=function(){this.i_startMonitor();};xmp.AbstractNativePlayer.prototype.i_fastForward=function(){this.i_startMonitor();};xmp.AbstractNativePlayer.prototype.i_seek=function(ab){this.i_startMonitor();};xmp.AbstractNativePlayer.prototype.i_ended=function(){this.i_stopMonitor();};xmp.AbstractNativePlayer.prototype.i_error=function(){this.i_close();};xmp.AbstractNativePlayer.prototype.i_isAvailable=function(bb){return false;};xmp.AbstractNativePlayer.prototype.i_getPosition=function(){return 0;};xmp.AbstractNativePlayer.prototype.i_getDuration=function(){return 0;};xmp.AbstractNativePlayer.prototype.i_getVolume=function(){return this.p_volume;};xmp.AbstractNativePlayer.prototype.i_setVolume=function(cb){this.p_volume=cb;};xmp.AbstractNativePlayer.prototype.i_getMute=function(){return this.p_mute;};xmp.AbstractNativePlayer.prototype.i_setMute=function(db){this.p_mute=db;};xmp.AbstractNativePlayer.prototype.i_getFullscreen=function(){return false;};xmp.AbstractNativePlayer.prototype.i_setFullscreen=function(eb){var fb="The \"setFullscreen\" method is not supported.";if(false===this.isFullscreenEnabled()){fb="The \"setFullscreen\" method is not supported.  Fullscreen disabled.";}
throw new xmp.NativePlayerUnsupportedError("Invoking \"setFullscreen\" method.",fb,this);};xmp.AbstractNativePlayer.prototype.i_getBufferingProgress=function(){return this.p_bufferingProgress;};xmp.AbstractNativePlayer.prototype.i_moveTo=function(gb,hb,ib,jb){var kb=((this.i_getNative().style.zIndex)?"z-Index: "+this.i_getNative().style.zIndex+";":"")+"left: "+xmp.getPixelUnits(gb)+"; top: "+xmp.getPixelUnits(hb)+"; width: "+xmp.getPixelUnits(ib)+"; height: "+xmp.getPixelUnits(jb);this.i_getNative().style.cssText=kb;};xmp.AbstractNativePlayer.prototype.i_validate=function(lb){this.p_plugIns=xmp.PlayerPolicy.i_getPlugins();this.i_onValidatePlugIn(lb);};xmp.AbstractNativePlayer.prototype.i_onValidatePlugIn=function(mb){};xmp.AbstractNativePlayer.prototype.i_onMonitorTimelineChange=function(nb,ob){};xmp.AbstractNativePlayer.prototype.i_setState=function(pb,qb){if(pb===xmp.OPEN){this.p_opened=true;}
else if(pb===xmp.BUFFERING){this.p_bufferingProgress=qb;}
this.i_createTimer({object:this,id:"setState",interval:xmp.i_DEFAULT_TIMER_INTERVAL,handler:this.i_onSetState,context:{type:pb,data:qb}}).start();};xmp.AbstractNativePlayer.prototype.i_setError=function(rb,e){this.i_stopMonitor();var sb=e;if(false===(sb instanceof xmp.NativePlayerError)&&false===(sb instanceof xmp.NativePlayerConnectionError)){sb=new xmp.NativePlayerError(((e.context)?e.context:rb),((e.rawMessage)?e.rawMessage:e.message),this);sb.setInnerError(e);}
this.i_createTimer({object:this,id:"setError",interval:xmp.i_DEFAULT_TIMER_INTERVAL,handler:this.p_onSetError,context:sb}).start();};xmp.AbstractNativePlayer.prototype.i_setTrigger=function(tb,ub){this.i_createTimer({object:this,id:"setTrigger",interval:xmp.i_DEFAULT_TIMER_INTERVAL,handler:this.p_onSetTrigger,context:{name:tb,data:ub}}).start();};xmp.AbstractNativePlayer.prototype.i_setCreated=function(){this.p_data.viewport.i_setNativePlayer(this);this.i_createTimer({object:this,id:"setCreated",interval:xmp.i_DEFAULT_TIMER_INTERVAL,handler:this.i_onSetCreated,context:null}).start();};xmp.AbstractNativePlayer.prototype.i_invoke=function(vb,wb){this.i_createTimer({object:this,id:"setInvoke",interval:xmp.i_DEFAULT_TIMER_INTERVAL,handler:this.p_onSetInvoke,context:{method:vb,_arguments:wb}}).start();};xmp.AbstractNativePlayer.prototype.i_create=function(xb){this.p_data=xb;if(this.p_logger){this.p_logger=null;}
this.p_logger=new xmp.util.internals.CategoryLogger("Native Player ("+this.i_getName()+")");};xmp.AbstractNativePlayer.prototype.i_attach=function(yb){this.p_data=yb;};xmp.AbstractNativePlayer.prototype.i_getNative=function(){var zb=xmp.findDomElement(this.p_data.id);if(!zb){throw new xmp.NativePlayerError("Retrieving native player.","Unable to retrieve \""+this.p_type+"\" native player.",this);}
return zb;};xmp.AbstractNativePlayer.prototype.i_getName=function(){return((this.p_data)?this.p_data.id:"");};xmp.AbstractNativePlayer.prototype.i_getType=function(){return this.p_type;};xmp.AbstractNativePlayer.prototype.i_getGroup=function(){return((this.p_data)?this.p_data.group:"");};xmp.AbstractNativePlayer.prototype.i_isFullscreenEnabled=function(){return((this.p_data)?this.p_data.fullscreenEnabled:false);};xmp.AbstractNativePlayer.prototype.i_startMonitor=function(){if(!this.p_monitorTimer){var Ab=this.i_getMonitorInterval();this.p_monitorTimer=this.i_createTimer({object:this,id:"timelineChange",interval:Ab,handler:this.p_onTimelineChange,context:null});this.p_monitorTimer.start();}};xmp.AbstractNativePlayer.prototype.i_stopMonitor=function(){if(this.p_monitorTimer){this.p_monitorTimer.stop();this.p_monitorTimer=null;}};xmp.AbstractNativePlayer.prototype.i_parseVersion=function(Bb){var Cb=Bb;var Db=0;var Eb=-1;var Fb=-1;var Gb=-1;var Hb=Cb.indexOf(xmp.i_VERSION_DELIMITER);if(Hb!==-1){Db=parseInt(Cb.substr(0,Hb),10);Cb=Cb.substr(Hb+1);Hb=Cb.indexOf(xmp.i_VERSION_DELIMITER);if(Hb!==-1){Eb=parseInt(Cb.substr(0,Hb),10);Cb=Cb.substr(Hb+1);Hb=Cb.indexOf(xmp.i_VERSION_DELIMITER);if(Hb!==-1){Fb=parseInt(Cb.substr(0,Hb),10);Cb=Cb.substr(Hb+1);if(Cb.length>0){Gb=parseInt(Cb,10);}}
else{Fb=parseInt(Cb,10);}}
else{Eb=parseInt(Cb,10);}}
else{Db=parseInt(Cb,10);Db=((true===isNaN(Db))?-1:Db);}
return{major:Db,minor:Eb,revision:Fb,build:Gb};};xmp.AbstractNativePlayer.prototype.i_validatePlugInVersion=function(Ib,Jb){var Kb=Ib+"PlugInVersion";xmp.util.PlayerStats.getInstance().i_setValue(Kb,Jb);var Lb=this.i_parseVersion(Jb);var Mb=this.i_getPlugInInfo(Ib);var Nb=this.i_parseVersion(Mb.minVersion);var Ob=this.i_parseVersion(Mb.maxVersion);var Pb=[{version:Lb.major,minVersion:Nb.major,maxVersion:Ob.major},{version:Lb.minor,minVersion:Nb.minor,maxVersion:Ob.minor},{version:Lb.revision,minVersion:Nb.revision,maxVersion:Ob.revision},{version:Lb.build,minVersion:Nb.build,maxVersion:Ob.build}];var Qb=Pb.length;for(var i=0;i<Qb;i++){if((Pb[i].version<Pb[i].minVersion)){throw new xmp.InvalidPlugInVersionError("Validating native player plugin version.",Mb,Jb);}
if((Pb[i].maxVersion!==-1)&&(Pb[i].version>Pb[i].maxVersion)){throw new xmp.UnsupportedPlugInVersionError("Validating native player plugin version.",Mb,Jb);}
if((Pb[i].version!==Pb[i].minVersion)&&(Pb[i].version!==Pb[i].maxVersion)){break;}}};xmp.AbstractNativePlayer.prototype.i_getPlugInInfo=function(Rb){var Sb=this.p_plugIns[Rb];if(!Sb){throw new xmp.NativePlayerError("Retrieving plugin info.","Unable to retrieve \""+Rb+"\" plugin information.",this);}
return Sb;};xmp.AbstractNativePlayer.prototype.i_createTimer=function(Tb){var Ub=new xmp.util.Callback(Tb.id,Tb.handler,Tb.object);Ub.setMetadata(xmp.i_CONTEXT,Tb.context);return new xmp.util.Timer(Tb.id,Tb.interval,-1,Ub);};xmp.AbstractNativePlayer.prototype.p_onTimelineChange=function(Vb,Wb){try{var Xb=parseInt(this.i_getDuration(),10);var Yb=((Xb>0)?parseInt(this.i_getPosition(),10):0);this.i_onMonitorTimelineChange(Yb,Xb);this.p_listener.i_onNativePlayerTimelineChange(Yb,Xb);}
catch(e){this.i_setError("Forwarding timeline change to listener.",e);}};xmp.AbstractNativePlayer.prototype.i_onSetState=function(Zb,$b){try{$b.stop();var ac=Zb.getMetadata(xmp.i_CONTEXT,{});this.p_listener.i_onNativePlayerStateChange(ac.type,ac.data);}
catch(e){this.i_setError("Forwarding state change notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.p_onSetError=function(bc,dc){var ec=null;try{dc.stop();ec=bc.getMetadata(xmp.i_CONTEXT,{});this.p_listener.i_onNativePlayerError(ec);}
catch(e){var fc=((ec)?ec:e);xmp.handleFatalError(fc);}};xmp.AbstractNativePlayer.prototype.p_onSetTrigger=function(gc,hc){try{hc.stop();var ic=gc.getMetadata(xmp.i_CONTEXT,{});this.p_listener.i_onNativePlayerTrigger(ic.name,ic.data);}
catch(e){this.i_setError("Forwarding trigger notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.p_onSetInvoke=function(jc,kc){try{kc.stop();var lc=jc.getMetadata(xmp.i_CONTEXT,{});this.p_listener.i_onNativePlayerInvoke(lc.method,lc._arguments);}
catch(e){this.i_setError("Forwarding invoke notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.i_onSetCreated=function(mc,nc){try{nc.stop();this.p_listener.i_onNativePlayerCreated(this,this.p_data);}
catch(e){this.i_setError("Forwarding created notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.i_getCallbackMethod=function(oc){return"xmp.NativePlayerRegistry.findPlayerByType( '"+this.p_data.group+"', '"+this.p_type+"' )."+oc;};xmp.AbstractNativePlayer.prototype.i_getLogger=function(){return this.p_logger;};xmp.AbstractNativePlayer.prototype.i_isOpen=function(){return this.p_opened;};xmp.AbstractNativePlayer.prototype.i_getMonitorInterval=function(){return xmp.i_MONITOR_INTERVAL;};xmp.AbstractNativePlayer.prototype.i_getConfigProperty=function(pc){return xmp.PlayerPolicy.i_getNativePlayerConfig(this.p_configuration)[pc];};xmp.AbstractNativePlayer.prototype.i_getVersionFromString=function(qc,rc){var sc=this.i_getConfigProperty(qc);sc=sc.replace(/\{\{version\}\}/g,"\""+rc+"\"");var tc='{getVersion:function(){'+sc+'}}';var uc=xmp.net.AjaxRequestManager.getInstance().i_parseJson(tc);return uc.getVersion();};xmp.i_HOST_REL_NODE_PATH="video";xmp.i_HOST_PARAMETER="{host}";xmp.i_PATH_PARAMETER="{path}";xmp.i_SIZE_PARAMETER="{size}";xmp.AbstractPlayingPolicy=function(vc,wc){this.p_type=vc;this.p_playerPolicy=wc;};xmp.AbstractPlayingPolicy.prototype.i_apply=function(xc,yc){if(false===this.p_canApply(yc)){return true;}
try{this.i_validatePlatform(xc.i_getName(),yc.i_getStreamingMode());}
catch(e){this.p_handleApplyError(xc,yc,e,false);return false;}
var zc=this.p_getApplyPolicy(yc);var Ac=zc.media.length;for(var i=0;i<Ac;i++){try{var Bc=this.p_playerPolicy.i_getMediaType(zc.media[i]);this.p_validateMedia(zc.type,zc.media[i],Bc);if(false===this.p_isPlayable(Bc,yc)){continue;}
this.p_playerPolicy.i_getLogger().debug("Applying playing policy \""+zc.type+"\" to playable node.");this.p_setPolicy(xc.i_getName(),Bc,yc);return true;}
catch(e2){var Cc=this.p_handleApplyError(xc,yc,e2,this.p_canFailover(zc.type,yc,i,zc.media));if(true===Cc){continue;}
return false;}}
var Dc=[];try{Dc=this.p_playerPolicy.i_getSizes();}
catch(e3){}
throw new xmp.PlayingPolicyApplyError("Applying playing policy.",Dc,zc,yc);};xmp.AbstractPlayingPolicy.prototype.i_getType=function(){return this.p_type;};xmp.AbstractPlayingPolicy.prototype.p_getApplyPolicy=function(Ec){var Fc=this.p_playerPolicy.i_getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var Gc=Ec.i_getStreamingMode();var Hc=this.p_playerPolicy.i_getPlaybackPriorityGroup(Fc.modes[Gc]);var Ic=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((Gc&&Gc.length>0)?("/"+Gc):"");return{type:Ic,media:Hc};};xmp.AbstractPlayingPolicy.prototype.p_isPlayable=function(Jc,Kc){if(false===this.p_validateMimeType(Jc,Kc)){return false;}
return this.p_validateSize(Jc,Kc);};xmp.AbstractPlayingPolicy.prototype.p_setupNode=function(Lc,Mc){if(!Mc.isUriAbsolute()){var Nc=Lc.streamingModes[Mc.i_getStreamingMode()];var Oc=Nc.url_mask;var Pc=[{name:xmp.i_HOST_PARAMETER,value:this.p_getHost(Lc,Nc)},{name:xmp.i_PATH_PARAMETER,value:Mc.getURI()},{name:xmp.i_SIZE_PARAMETER,value:this.p_getSize(Lc,Mc)}];for(var i=0;i<Pc.length;i++){Oc=Oc.replace(Pc[i].name,Pc[i].value);}
Mc.setMimeType(Lc.mimeType);Mc.setURI(Oc);this.p_playerPolicy.i_getLogger().debug("Setting up playable node URI from mask ("+Nc.url_mask+") and MIME type ("+Lc.mimeType+"). URI - "+Oc);}
Mc.setUriAbsolute(true);};xmp.AbstractPlayingPolicy.prototype.p_getSize=function(Qc,Rc){var Sc="";if(true===this.p_urlMaskContainsSize(Qc,Rc)){Sc=this.p_playerPolicy.getSizeFromPlayer(Rc.i_getSizes());}
return Sc;};xmp.AbstractPlayingPolicy.prototype.p_getHost=function(Tc,Uc){if(-1===Uc.url_mask.indexOf(xmp.i_HOST_PARAMETER)){return"";}
var Vc=xmp.i_HOST_REL_NODE_PATH+"/"+Tc.type+"/"+Uc.type;var Wc=xmp.util.RootUrlProvider.getInstance().i_getRootUrl(Vc);if(Wc.length===0){throw new xmp.PlayingPolicyError("Retrieving host.","Unable to find \""+Tc.type+"\" playing policy streaming host configuration for \""+Uc.type+"\".");}
return Wc;};xmp.AbstractPlayingPolicy.prototype.p_validateMedia=function(Xc,Yc,Zc){if(!Zc){throw new xmp.PlayingPolicyError("Validating media.","Invalid \""+Xc+"\" playing policy media type \""+Yc+"\".");}};xmp.AbstractPlayingPolicy.prototype.p_setPolicy=function($c,ad,bd){xmp.NativePlayerRegistry.i_validate($c,ad.mimeType);this.p_setupNode(ad,bd);};xmp.AbstractPlayingPolicy.prototype.p_validateMimeType=function(cd,dd){var ed=dd.i_getMimeTypes();var fd=ed.length;for(var i=0;i<fd;i++){if(cd.mimeType===ed[i]){return true;}}
return false;};xmp.AbstractPlayingPolicy.prototype.p_validateSize=function(gd,hd){if(false===this.p_urlMaskContainsSize(gd,hd)){return true;}
return(this.p_playerPolicy.getSizeFromPlayer(hd.i_getSizes()).length>0);};xmp.AbstractPlayingPolicy.prototype.p_urlMaskContainsSize=function(jd,kd){return(jd.streamingModes[kd.i_getStreamingMode()].url_mask.indexOf(xmp.i_SIZE_PARAMETER)!==-1);};xmp.AbstractPlayingPolicy.prototype.i_validateBootstrap=function(ld){};xmp.AbstractPlayingPolicy.prototype.i_validatePlatform=function(md,nd){var od=this.p_playerPolicy.i_getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);if(!od||(nd&&!od.modes[nd])){var pd=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((nd&&nd.length>0)?("/"+nd):"");throw new xmp.UnsupportedPlatformError(md,"The platform \""+pd+"\" is unsupported.");}};xmp.AbstractPlayingPolicy.prototype.p_handleApplyError=function(qd,rd,e,sd){if(true===this.p_playerPolicy.i_getFailover()&&true===sd){this.p_playerPolicy.i_getLogger().warn("\n\n"+e.message,e);return true;}
this.p_playerPolicy.i_getLogger().i_critical("\n\n"+e.message,e);qd.onError(rd,e);return false;};xmp.AbstractPlayingPolicy.prototype.p_canApply=function(td){var ud=td.i_getStreamingMode();return((ud&&ud.length>0)?true:false);};xmp.AbstractPlayingPolicy.prototype.p_canFailover=function(vd,wd,xd,yd){try{var zd=yd.length;for(var i=xd+1;i<zd;i++){var Ad=this.p_playerPolicy.i_getMediaType(yd[i]);this.p_validateMedia(vd,yd[i],Ad);if(false===this.p_isPlayable(Ad,wd)){continue;}
return true;}}
catch(e){}
return false;};xmp.AbstractPlayingPolicy.prototype.i_getPlayerPolicy=function(){return this.p_playerPolicy;};xmp.i_BANDWIDTH_RECORDER_SAMPLE_TIMER="BandwidthRecorderSampleTimer";xmp.i_CURRENT_BANDWIDTH_LABEL="CurrentBandwidth";xmp.i_CUMULATIVE_BANDWIDTH_LABEL="CumulativeBandwidth";xmp.i_BANDWIDTH_SAMPLE_INTERVAL="Bandwidth Sample Interval";xmp.BandwidthRecorder=function(Bd,Cd){var Dd=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Cd).getInt(xmp.i_BANDWIDTH_SAMPLE_INTERVAL,-1);if(-1===Dd.length){throw new xmp.BandwidthRecorderError("Initializing.","Missing bandwidth recorder sample interval.");}
this.p_player=Bd;this.p_logger=new xmp.util.internals.CategoryLogger('BandwidthRecorder');var Ed=new xmp.util.Callback(xmp.i_BANDWIDTH_RECORDER_SAMPLE_TIMER,this.p_onSample,this);this.p_sampleTimer=new xmp.util.Timer(xmp.i_BANDWIDTH_RECORDER_SAMPLE_TIMER,Dd,-1,Ed);this.p_totalBytesDownloaded=0;this.p_totalDuration=0;this.p_reset();};xmp.BandwidthRecorder.prototype.i_start=function(){this.i_stop();this.p_sampleStartTime=this.p_initSampleTime();this.p_sampleTimer.start();};xmp.BandwidthRecorder.prototype.i_stop=function(){this.p_sampleTimer.stop();this.p_totalDuration+=this.lastDuration;this.p_totalBytesDownloaded+=this.lastBytesDownloaded;this.p_reset();};xmp.BandwidthRecorder.prototype.p_onSample=function(Fd,Gd){try{var Hd=this.p_player.getBufferingProgress();this.p_validateSample(Hd);var Id=this.p_initSampleTime();var Jd=(Id-this.p_sampleStartTime);var Kd=this.p_calcBandwidth(Jd,Hd.bytesDownloaded);this.p_logBandwidth(Kd,xmp.i_CURRENT_BANDWIDTH_LABEL,Hd.bytesDownloaded,"Downloaded Bytes");var Ld=(this.p_totalBytesDownloaded+Hd.bytesDownloaded);Kd=this.p_calcBandwidth((this.p_totalDuration+Jd),Ld);this.p_logBandwidth(Kd,xmp.i_CUMULATIVE_BANDWIDTH_LABEL,Ld,"Cumulative Bytes");this.lastBytesDownloaded=Hd.bytesDownloaded;this.lastDuration=Jd;if(100===Hd.percent){this.i_stop();}}
catch(e){this.p_logger.warn("\n\n"+e.message);this.i_stop();}};xmp.BandwidthRecorder.prototype.p_reset=function(){this.p_sampleStartTime=0;this.lastBytesDownloaded=0;this.lastDuration=0;};xmp.BandwidthRecorder.prototype.p_initSampleTime=function(){return(new Date()).getTime();};xmp.BandwidthRecorder.prototype.p_calcBandwidth=function(Md,b){try{var Nd=(Md/1000);var x=((b*8)/1024);return(x/Nd);}
catch(e){var Od=new xmp.BandwidthRecorderError("Calculating bandwidth.",e.message);Od.setInnerError(e);throw Od;}};xmp.BandwidthRecorder.prototype.p_logBandwidth=function(Pd,Qd,Rd,Sd){try{var Td=Math.ceil(Pd)+"KB/sec";this.p_logger.info(Qd+":  "+Td+", "+Sd+":  "+Rd);xmp.util.PlayerStats.getInstance().i_setValue(Qd,Td);}
catch(e){var Ud=new xmp.BandwidthRecorderError("Logging bandwidth.",((e.rawMessage)?e.rawMessage:e.message));Ud.setInnerError(e);throw Ud;}};xmp.BandwidthRecorder.prototype.p_validateSample=function(Vd){if(!Vd){throw new xmp.BandwidthRecorderError("Validating sample.","Missing sample.");}
if(false===xmp.isDefined(Vd.bytesDownloaded)){throw new xmp.BandwidthRecorderError("Validating sample.","Missing bytes downloaded.");}};xmp.BandwidthRecorderError=function(Wd,Xd){xmp.BandwidthRecorderError.ctor.call(this,"BandwidthRecorderError",Wd,Xd);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.BandwidthRecorderError);xmp.DHTMLObjectError=function(Yd,Zd){xmp.DHTMLObjectError.ctor.call(this,"DHTMLObjectError",Yd,Zd);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.DHTMLObjectError);xmp.InvalidMimeTypeError=function($d,ae){xmp.InvalidMimeTypeError.ctor.call(this,"InvalidMimeTypeError",$d,ae);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidMimeTypeError);xmp.InvalidNativePlayerViewportError=function(be,ce,de){var ee=[{label:"Native Player Type",text:de.i_getType()},{label:"Native Player Name",text:de.i_getName()}];xmp.InvalidNativePlayerViewportError.ctor.call(this,"InvalidNativePlayerViewportError",be,ce,ee);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidNativePlayerViewportError);xmp.InvalidPlayableNodeError=function(fe,ge){xmp.InvalidPlayableNodeError.ctor.call(this,"InvalidMimeTypeError",fe,ge);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidPlayableNodeError);xmp.InvalidPlugInVersionError=function(he,ie,je){var ke="Invalid "+ie.displayName+" version \""+je+"\".  Expected version is ";ke+=((parseInt(ie.maxVersion,10)>0)?"between \""+ie.minVersion+"\" and \""+ie.maxVersion+"\".":"\""+ie.minVersion+"\" or greater.");ke+="\n\nThe latest plugin can be downloaded at \""+ie.downloadUrl+"\".";xmp.InvalidPlugInVersionError.ctor.call(this,"InvalidPlugInVersionError",he,ke,ie);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.InvalidPlugInVersionError);xmp.MediaPlayerError=function(le,me){xmp.MediaPlayerError.ctor.call(this,"MediaPlayerError",le,me);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.MediaPlayerError);xmp.NativePlayerConnectionError=function(ne,oe,pe,qe){var re=[{label:"Native Player Type",text:((pe)?pe.i_getType():"")},{label:"Native Player Name",text:((pe)?pe.i_getName():"")}];if(qe){re=re.concat(qe);}
xmp.NativePlayerConnectionError.ctor.call(this,xmp.XmpErrorCodes.CRITICAL_PLAYER_CONNECTION,"NativePlayerConnectionError",ne,oe,re);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerConnectionError);xmp.NativePlayerError=function(se,te,ue,ve){var we=[];if(ue){we.push({label:"Native Player Type",text:ue.i_getType()});we.push({label:"Native Player Name",text:ue.i_getName()});}
if(ve){we=we.concat(ve);}
xmp.NativePlayerError.ctor.call(this,"NativePlayerError",se,te,we);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerError);xmp.NativePlayerGroupNotFoundError=function(xe,ye,ze,Ae){var Be=[{label:"Native Player Group",text:ze}];if(Ae){Be=Be.concat(Ae);}
xmp.NativePlayerGroupNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_UNSPECIFIED_ERROR,"NativePlayerGroupNotFoundError",xe,ye,Be);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.NativePlayerGroupNotFoundError);xmp.NativePlayerNotFoundError=function(Ce,De,Ee,Fe,Ge){var He=[{label:"Native Player Group",text:Ee},{label:"MIME Type",text:Fe}];if(Ge){He=He.concat(Ge);}
xmp.NativePlayerNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"NativePlayerNotFoundError",Ce,De,He);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerNotFoundError);xmp.NativePlayerUnsupportedError=function(Ie,Je,Ke){var Le=[{label:"Native Player Type",text:((Ke)?Ke.i_getType():"")},{label:"Native Player Name",text:((Ke)?Ke.i_getName():"")}];xmp.NativePlayerUnsupportedError.ctor.call(this,"NativePlayerUnsupportedError",Ie,Je,Le);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerUnsupportedError);xmp.PlaybackModeError=function(Me,Ne,Oe){var Pe=[{label:"Playback Mode",text:((Oe)?Oe.i_getName():"")}];xmp.PlaybackModeError.ctor.call(this,"PlaybackModeError",Me,Ne,Pe);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlaybackModeError);xmp.PlayingPolicyApplyError=function(Qe,Re,Se,Te){var Ue="Unable to apply playing policy to playable node.\n\nPlayer Sizes:              "+Re.join(", ")+"\n\nPolicy:"+"\n\n  Type:                     "+Se.type+"\n  Media:                   "+Se.media.join(", ")+"\n\nPlayable Node:"+"\n\n  Location:               "+Te.getURI()+"\n  Streaming Mode:  "+Te.i_getStreamingMode()+"\n  Mime Types:         "+Te.i_getMimeTypes().join(", ")+"\n  Sizes:                   "+Te.i_getSizes().join(", ");xmp.PlayingPolicyApplyError.ctor.call(this,"PlayingPolicyApplyError",Qe,Ue);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyApplyError);xmp.PlayingPolicyError=function(Ve,We){xmp.PlayingPolicyError.ctor.call(this,"PlayingPolicyError",Ve,We);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyError);xmp.PlugInDisabledError=function(Xe,Ye,Ze){var $e="The "+Ye.displayName+" is disabled or not associated with the \""+Ze+"\" MIME type.";xmp.PlugInDisabledError.ctor.call(this,"PlugInDisabledError",Xe,$e,Ye);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInDisabledError);xmp.PlugInNotFoundError=function(af,bf){var cf=bf.displayName+" not found.  \n\nThe plugin can be downloaded at \""+bf.downloadUrl+"\".";xmp.PlugInNotFoundError.ctor.call(this,"PlugInNotFoundError",af,cf,bf);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInNotFoundError);xmp.ServiceError=function(df,ef){xmp.ServiceError.ctor.call(this,"ServiceError",df,ef);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ServiceError);xmp.UnsupportedPlatformError=function(ff,gf){xmp.UnsupportedPlatformError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"UnsupportedPlatformError",ff,gf);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.UnsupportedPlatformError);xmp.UnsupportedPlugInVersionError=function(hf,jf,kf){var lf="The "+jf.displayName+" version \""+kf+"\" is not supported.  Expected version is ";lf+=((parseInt(jf.maxVersion,10)>0)?"between \""+jf.minVersion+"\" and \""+jf.maxVersion+"\".":"\""+jf.minVersion+"\" or greater.");lf+="\n\nA supported plugin can be downloaded at \""+jf.downloadUrl+"\".";xmp.UnsupportedPlugInVersionError.ctor.call(this,"UnsupportedPlugInVersionError",hf,lf,jf);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.UnsupportedPlugInVersionError);xmp.i_LAZY_PLAYING_POLICY="Lazy";xmp.i_VALIDATE_ON_BOOTSTRAP="ValidateOnBootstrap";xmp.LazyPlayingPolicy=function(mf){xmp.LazyPlayingPolicy.ctor.call(this,xmp.i_LAZY_PLAYING_POLICY,mf);};xmp.DERIVE_CLASS(xmp.AbstractPlayingPolicy,xmp.LazyPlayingPolicy);xmp.LazyPlayingPolicy.prototype.i_validateBootstrap=function(nf){try{xmp.NativePlayerRegistry.i_createGroup(xmp.i_VALIDATE_ON_BOOTSTRAP,nf);this.i_validatePlatform(xmp.i_VALIDATE_ON_BOOTSTRAP);var of=this.i_getPlayerPolicy().i_getBootstrapMedia();for(var i=0;i<of.length;i++){xmp.NativePlayerRegistry.i_validate(xmp.i_VALIDATE_ON_BOOTSTRAP,of[i].mimeType);}}
catch(e){this.i_getPlayerPolicy().i_getLogger().i_fatal("\n\n"+e.message,e);if(e.plugIn){nf.onPlugInError(e);}
else if(true===(e instanceof xmp.UnsupportedPlatformError)){nf.onUnsupportedPlatformError(e);}}
finally{xmp.NativePlayerRegistry.i_destoryGroup(xmp.i_VALIDATE_ON_BOOTSTRAP);}};xmp.DefaultPlaybackMode=function(pf,qf,rf){xmp.DefaultPlaybackMode.ctor.call(this,pf,qf,rf);};xmp.DERIVE_CLASS(xmp.PlaybackMode,xmp.DefaultPlaybackMode);xmp.DefaultPlaybackMode.prototype.i_open=function(sf,tf){this.i_changeMode(sf,xmp.i_INIT,xmp.OPEN_OPERATION,tf);};xmp.DefaultPlaybackMode.prototype.i_close=function(uf){this.i_changeMode(uf,xmp.i_FINI,xmp.CLOSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_play=function(vf){this.i_changeMode(vf,xmp.PLAY,xmp.i_PLAY_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_pause=function(wf){this.i_changeMode(wf,xmp.PAUSE,xmp.i_PAUSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_stop=function(xf){this.i_changeMode(xf,xmp.STOP,xmp.i_STOP_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_rewind=function(yf){this.i_changeMode(yf,xmp.REWIND,xmp.i_REWIND_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_fastForward=function(zf){this.i_changeMode(zf,xmp.FAST_FORWARD,xmp.i_FAST_FORWARD_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_seek=function(Af,Bf){this.i_changeMode(Af,xmp.SEEKABLE,xmp.i_SEEK_OPERATION,Bf);};xmp.DefaultPlaybackMode.prototype.i_ended=function(Cf){this.i_changeMode(Cf,xmp.ENDED,xmp.ENDED_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_error=function(Df){this.i_changeMode(Df,xmp.ERRORS,xmp.ERROR_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.i_isAvailable=function(Ef,Ff){try{return((true===this.i_canTransition(Ff))||(true===this.i_getPlayer(Ef).i_isAvailable(Ff)));}
catch(e){this.i_handleError(Ef,xmp.i_IS_AVAILABLE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.i_getPosition=function(Gf){try{return parseInt(this.i_getPlayer(Gf).i_getPosition(),10);}
catch(e){this.i_handleError(Gf,xmp.i_GET_POSITION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.i_getDuration=function(Hf){try{return parseInt(this.i_getPlayer(Hf).i_getDuration(),10);}
catch(e){this.i_handleError(Hf,xmp.i_GET_DURATION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.i_getVolume=function(If){try{return this.i_getPlayer(If).i_getVolume();}
catch(e){this.i_handleError(If,xmp.i_GET_VOLUME,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.i_setVolume=function(Jf,Kf){try{this.i_getPlayer(Jf).i_setVolume(Kf);}
catch(e){this.i_handleError(Jf,xmp.i_SET_VOLUME,e);}};xmp.DefaultPlaybackMode.prototype.i_getMute=function(Lf){try{return this.i_getPlayer(Lf).i_getMute();}
catch(e){this.i_handleError(Lf,xmp.i_GET_MUTE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.i_setMute=function(Mf,Nf){try{this.i_getPlayer(Mf).i_setMute(Nf);}
catch(e){this.i_handleError(Mf,xmp.i_SET_MUTE,e);}};xmp.DefaultPlaybackMode.prototype.i_getFullscreen=function(Of){try{return this.i_getPlayer(Of).i_getFullscreen();}
catch(e){this.i_handleError(Of,xmp.i_GET_FULLSCREEN,e);}
return false;};xmp.DefaultPlaybackMode.prototype.i_setFullscreen=function(Pf,Qf){try{this.i_getPlayer(Pf).i_setFullscreen(Qf);}
catch(e){this.i_handleError(Pf,xmp.i_SET_FULLSCREEN,e);}};xmp.DefaultPlaybackMode.prototype.i_getBufferingProgress=function(Rf){try{return this.i_getPlayer(Rf).i_getBufferingProgress();}
catch(e){this.i_handleError(Rf,xmp.i_GET_BUFFERING_PROGRESS,e);}
return null;};xmp.DefaultPlaybackMode.prototype.i_handleError=function(Sf,Tf,e){var Uf="Delegating \""+Tf.toLowerCase()+"\" operation to native player.";var Vf=((xmp.i_STRING_TYPE===typeof(e))?new xmp.NativePlayerError(Uf,e,this.i_getPlayer(Sf),[{label:"Playback Mode",text:this.i_getName()}]):e);if(false===(Vf instanceof xmp.NativePlayerError)&&false===(Vf instanceof xmp.NativePlayerUnsupportedError)){Vf=new xmp.NativePlayerError(((e.context)?e.context:Uf),((e.rawMessage)?e.rawMessage:e.message),this.i_getPlayer(Sf),[{label:"Playback Mode",text:this.i_getName()}]);Vf.setInnerError(e);}
throw Vf;};xmp.i_ENDED_PLAYBACK_STATE="EndedPlayback";xmp.ENDED="Ended";xmp.ENDED_OPERATION="Ended";xmp.EndedPlaybackMode=function(){xmp.EndedPlaybackMode.ctor.call(this,xmp.ENDED,xmp.i_ENDED_PLAYBACK_STATE,[xmp.i_FINI,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.EndedPlaybackMode);xmp.EndedPlaybackMode.prototype.i_transition=function(Wf,Xf,Yf){this.i_ended(Wf);};xmp.EndedPlaybackMode.prototype.i_ended=function(Zf){try{this.i_getPlayer(Zf).i_ended();}
catch(e){this.i_handleError(Zf,xmp.ENDED_OPERATION,e);}};xmp.ERRORS_PLAYBACK_STATE="ErrorPlayback";xmp.ERRORS="Error";xmp.ERROR_OPERATION="Error";xmp.ErrorPlaybackMode=function(){xmp.ErrorPlaybackMode.ctor.call(this,xmp.ERRORS,xmp.ERRORS_PLAYBACK_STATE,[xmp.i_FINI]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.ErrorPlaybackMode);xmp.ErrorPlaybackMode.prototype.i_transition=function($f,ag,bg){this.i_error($f);};xmp.ErrorPlaybackMode.prototype.i_error=function(cg){try{this.i_getPlayer(cg).i_error();}
catch(e){}};xmp.i_FAST_FORWARD_PLAYBACK_STATE="FastForwardPlayback";xmp.FAST_FORWARD="FastForward";xmp.i_FAST_FORWARD_OPERATION="FastForward";xmp.FastForwardPlaybackMode=function(){xmp.FastForwardPlaybackMode.ctor.call(this,xmp.FAST_FORWARD,xmp.i_FAST_FORWARD_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.FastForwardPlaybackMode);xmp.FastForwardPlaybackMode.prototype.i_transition=function(dg,eg,fg){this.i_fastForward(dg);};xmp.FastForwardPlaybackMode.prototype.i_fastForward=function(gg){try{this.i_getPlayer(gg).i_fastForward();}
catch(e){this.i_handleError(gg,xmp.i_FAST_FORWARD_OPERATION,e);}};xmp.i_FINI_PLAYBACK_STATE="FiniPlayback";xmp.i_FINI="Fini";xmp.CLOSE_OPERATION="Close";xmp.FiniPlaybackMode=function(){xmp.FiniPlaybackMode.ctor.call(this,xmp.i_FINI,xmp.i_FINI_PLAYBACK_STATE,[xmp.i_INIT,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.FiniPlaybackMode);xmp.FiniPlaybackMode.prototype.i_transition=function(hg,ig,jg){try{this.i_getPlayer(hg).i_close();}
catch(e){this.i_handleError(hg,xmp.CLOSE_OPERATION,e);}};xmp.FiniPlaybackMode.prototype.i_close=function(kg){};xmp.i_INIT_PLAYBACK_STATE="InitPlayback";xmp.i_INIT="Init";xmp.OPEN_OPERATION="Open";xmp.InitPlaybackMode=function(){xmp.InitPlaybackMode.ctor.call(this,xmp.i_INIT,xmp.i_INIT_PLAYBACK_STATE,[xmp.i_FINI,xmp.PLAY,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.InitPlaybackMode);xmp.InitPlaybackMode.prototype.i_transition=function(lg,mg,ng){try{this.i_getPlayer(lg).i_open(mg);}
catch(e){this.i_handleError(lg,xmp.OPEN_OPERATION,e);}};xmp.InitPlaybackMode.prototype.i_open=function(og,pg){throw new xmp.PlaybackModeError("Invoking state operation.","The \""+xmp.OPEN_OPERATION.toLowerCase()+"\" operation has already been executed.",this);};xmp.i_NORMAL_PLAYBACK_STATE="NormalPlayback";xmp.PLAY="Play";xmp.i_PLAY_OPERATION="Play";xmp.NormalPlaybackMode=function(){xmp.NormalPlaybackMode.ctor.call(this,xmp.PLAY,xmp.i_NORMAL_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.NormalPlaybackMode);xmp.NormalPlaybackMode.prototype.i_transition=function(qg,rg,sg){this.i_play(qg);};xmp.NormalPlaybackMode.prototype.i_play=function(tg){try{this.i_getPlayer(tg).i_play();}
catch(e){this.i_handleError(tg,xmp.i_PLAY_OPERATION,e);}};xmp.i_PAUSE_PLAYBACK_STATE="PausePlayback";xmp.PAUSE="Pause";xmp.i_PAUSE_OPERATION="Pause";xmp.PausePlaybackMode=function(){xmp.PausePlaybackMode.ctor.call(this,xmp.PAUSE,xmp.i_PAUSE_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.PausePlaybackMode);xmp.PausePlaybackMode.prototype.i_transition=function(ug,vg,wg){this.i_pause(ug);};xmp.PausePlaybackMode.prototype.i_pause=function(xg){try{this.i_getPlayer(xg).i_pause();}
catch(e){this.i_handleError(xg,xmp.i_PAUSE_OPERATION,e);}};xmp.PlayerModeRegistry=function(){this.p_modes=[];var yg=[new xmp.InitPlaybackMode(),new xmp.FiniPlaybackMode(),new xmp.PausePlaybackMode(),new xmp.NormalPlaybackMode(),new xmp.PausePlaybackMode(),new xmp.StopPlaybackMode(),new xmp.RewindPlaybackMode(),new xmp.FastForwardPlaybackMode(),new xmp.SeekablePlaybackMode(),new xmp.EndedPlaybackMode(),new xmp.ErrorPlaybackMode()];for(var i=0;i<yg.length;i++){this.p_addMode(yg[i]);}};xmp.PlayerModeRegistry.prototype.p_addMode=function(zg){this.p_modes[zg.i_getType()]=zg;};xmp.PlayerModeRegistry.prototype.i_findMode=function(Ag){var Bg=this.p_modes[Ag];if(Bg!==null){return Bg;}
throw new xmp.PlaybackModeError("Finding playback mode.","Unable to find player mode \""+Ag+"\".",null);};xmp.i_REWIND_PLAYBACK_STATE="RewindPlayback";xmp.REWIND="Rewind";xmp.i_REWIND_OPERATION="Rewind";xmp.RewindPlaybackMode=function(){xmp.RewindPlaybackMode.ctor.call(this,xmp.REWIND,xmp.i_REWIND_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.RewindPlaybackMode);xmp.RewindPlaybackMode.prototype.i_transition=function(Cg,Dg,Eg){this.i_rewind(Cg);};xmp.RewindPlaybackMode.prototype.i_rewind=function(Fg){try{this.i_getPlayer(Fg).i_rewind();}
catch(e){this.i_handleError(Fg,xmp.i_REWIND_OPERATION,e);}};xmp.i_SEEKABLE_PLAYBACK_STATE="SeekablePlayback";xmp.SEEKABLE="Seekable";xmp.i_SEEK_OPERATION="Seek";xmp.SeekablePlaybackMode=function(){xmp.SeekablePlaybackMode.ctor.call(this,xmp.SEEKABLE,xmp.i_SEEKABLE_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.SeekablePlaybackMode);xmp.SeekablePlaybackMode.prototype.i_transition=function(Gg,Hg,Ig){this.i_seek(Gg,Hg);};xmp.SeekablePlaybackMode.prototype.i_seek=function(Jg,Kg){try{this.i_getPlayer(Jg).i_seek(Kg);}
catch(e){this.i_handleError(Jg,xmp.i_SEEK_OPERATION,e);}};xmp.i_STOP_PLAYBACK_STATE="StopPlayback";xmp.STOP="Stop";xmp.i_STOP_OPERATION="Stop";xmp.StopPlaybackMode=function(){xmp.StopPlaybackMode.ctor.call(this,xmp.STOP,xmp.i_STOP_PLAYBACK_STATE,[xmp.i_FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.StopPlaybackMode);xmp.StopPlaybackMode.prototype.i_transition=function(Lg,Mg,Ng){this.i_stop(Lg);};xmp.StopPlaybackMode.prototype.i_stop=function(Og){try{this.i_getPlayer(Og).i_stop();}
catch(e){this.i_handleError(Og,xmp.i_STOP_OPERATION,e);}};xmp.NativePlayerRegistry=function(){var Pg={};var Qg=new xmp.util.internals.CategoryLogger("NativePlayerRegistry");return{i_createGroup:function(Rg,Sg){if(Pg[Rg]!==null&&true===xmp.isDefined(Pg[Rg])){throw new xmp.NativePlayerError("Creating group.","A native player group already exists with the name \""+Rg+"\".",null);}
var Tg=xmp.PlayerPolicy.i_getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var Ug=((Tg)?xmp.PlayerPolicy.i_getNativePlayerGroup(Tg.playersGroup):xmp.PlayerPolicy.getDefaultNativePlayerGroup());Pg[Rg]={owner:Sg,template:Ug,players:{}};Qg.info("Created native player group \""+Rg+"\".");},i_findPlayerByMimeType:function(Vg,Wg){var Xg=this.p_findGroup(Vg);var Yg=Xg.players[Wg];if(Yg){return Yg;}
this.i_validate(Vg,Wg);Yg=Xg.players[Wg];if(Yg){return Yg;}
throw new xmp.NativePlayerNotFoundError("Finding player by mime type.","Unable to find native player for mime type \""+Wg+"\".",Vg,Wg);},findPlayerByType:function(Zg,$g){var ah=this.p_findGroup(Zg);for(var bh=xmp.MapIterator.create(ah.players);bh.hasNext();bh.next()){var ch=bh.currentValue();if(ch.i_getType()===$g){return ch;}}
throw new xmp.NativePlayerNotFoundError("Finding player by media type.","Unable to find native player for type \""+$g+"\".",Zg,$g);},i_validate:function(dh,eh){var fh=this.p_findGroup(dh);var gh=fh.players[eh];if(gh){gh.i_validate(eh);return;}
var hh=fh.template[eh];if(!hh){throw new xmp.NativePlayerNotFoundError("Validating player.","Unable to find native player for mime type \""+eh+"\".  Missing native player group.",dh,eh);}
var ih=hh.length;var jh=null;for(var i=0;i<ih;i++){try{gh=this.p_createNativePlayer(fh.owner,hh[i]);gh.i_validate(eh);fh.players[eh]=gh;Qg.info("Registered native player \""+gh.i_getType()+"\" for mime type \""+eh+"\" and group \""+dh+"\".");return;}
catch(e){Qg.warn("\n\n"+e.message,e);if(i===0){jh=e;}
if(i===(ih-1)){throw jh;}}}},i_destoryGroup:function(kh){var lh=this.p_findGroup(kh);if(!lh){return;}
for(var mh=xmp.MapIterator.create(lh.players);mh.hasNext();mh.next()){var nh=mh.currentValue();nh.i_fini();}
Pg[kh]=null;Qg.info("Destroyed native player group \""+kh+"\".");},p_createNativePlayer:function(oh,ph){var qh=xmp.getNamespacedMethod(ph);return new qh(oh,ph);},p_validateGroup:function(rh,sh){if(!sh){throw new xmp.NativePlayerGroupNotFoundError("Validating native player group.","Invalid native player group \""+rh+"\".",rh);}},p_findGroup:function(th){var uh=Pg[th];this.p_validateGroup(th,uh);return uh;}};}();xmp.i_NULL_PLAYER="Null";xmp.i_NULL_MIME_TYPE="application/x-null";xmp.NullPlayer=function(vh,wh){xmp.NullPlayer.ctor.call(this,xmp.i_NULL_PLAYER,null,wh);};xmp.DERIVE_CLASS(xmp.AbstractNativePlayer,xmp.NullPlayer);xmp.NullPlayer.prototype.i_create=function(xh){xh.id=xh.viewport.name;if(xh.viewport&&xh.viewport.i_getType()===xmp.DHTML_VIEWPORT){xh.viewport.i_getNative().style.backgroundColor=xmp.i_BLACK_BACKGROUND_COLOR;xh.viewport.i_getNative().innerHTML="";}
xmp.NullPlayer.base.i_create.call(this,xh);};xmp.PlayerPolicy=function(){var yh="/PlayerContexts/Global/PlayingPolicy";var zh="PlayingPolicy/MediaTypes";var Ah="PlayingPolicy/PlugIns";var Bh="Strategy";var Ch="PlayingPolicy/Streaming Modes";var Dh="PlayingPolicy/Bootstrap Media";var Eh="PlayingPolicy/Supported Platforms";var Fh="PlayingPolicy/Playback Priority Groups";var Gh="PlayingPolicy/Native Players";var Hh="PlayingPolicy/Native Player Groups";var Ih="PlayingPolicy/Playback Platforms";var Jh="Streaming Modes";var Kh="Players";var Lh="Properties";var Mh="mime-type";var Nh="display-name";var Oh="download-url";var Ph="minimum-version";var Qh="maximum-version";var Rh="Failover";var Sh="BasePlayer/PlayerSizes";var Th="PlugIns Overrides";return{p_initMediaTypes:function(){this.p_mediaTypes={};var Uh=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var Vh=Uh.getNodeForPath(zh);var Wh=Vh.retrieveChildren();var Xh=Wh.length;for(var i=0;i<Xh;i++){var Yh=Wh[i];var Zh=Yh.getString(Mh,xmp.NO_DEFAULT_VALUE);this.p_validateMimeType(Yh.getName(),Zh);var $h={type:Yh.getName(),mimeType:Zh,streamingModes:{}};var ai=Yh.getNodeForPath(Jh);var bi=ai.retrieveKeys();var ci=bi.length;for(var j=0;j<ci;j++){var di=this.p_getStreamingMode($h.type,ai,bi[j]);$h.streamingModes[di.type]=di;}
this.p_mediaTypes[$h.type]=$h;}},p_initPlugins:function(){this.p_plugIns={};var ei=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var fi=ei.getNodeForPath(Ah);var gi=fi.retrieveChildren();var hi=gi.length;for(var i=0;i<hi;i++){var ii=gi[i];var ji={name:ii.getName(),displayName:ii.getString(Nh,xmp.NO_DEFAULT_VALUE),minVersion:ii.getString(Ph,xmp.NO_DEFAULT_VALUE),maxVersion:ii.getString(Qh,xmp.NO_DEFAULT_VALUE),downloadUrl:ii.getString(Oh,xmp.NO_DEFAULT_VALUE),properties:{}};this.p_validatePlugIn(ji);this.p_plugIns[ii.getName()]=ji;}},i_apply:function(ki,li){this.p_init();return this.p_getStrategy().i_apply(ki,li);},p_validateMimeType:function(mi,ni){if(!ni){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","NULL \""+mi+"\" playing policy MIME type \""+ni+"\".");}
if(ni.length===0){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","Missing \""+mi+"\" playing policy MIME type \""+ni+"\".");}},p_getStreamingMode:function(oi,pi,qi){var ri={type:qi,url_mask:pi.getString(qi,xmp.NO_DEFAULT_VALUE)};this.p_validateStreamingMode(oi,ri);return ri;},p_validateStreamingMode:function(si,ti){if(false===this.p_isStreamingModeSupported(ti.type)){throw new xmp.PlayingPolicyError("Validating streaming mode.","Invalid streaming mode "+ti.type+" for media type "+si+".");}
if(ti.url_mask.length===0){throw new xmp.PlayingPolicyError("Validating streaming mode.","Missing \""+si+"\" playing policy \""+ti.type+"\" url mask.");}},p_getStrategy:function(){if(this.p_strategy===null){var ui=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(yh);var vi=ui.getString(Bh,xmp.NO_DEFAULT_VALUE);if(vi.length===0){throw new xmp.PlayingPolicyError("Retrieving strategy.","Missing playing policy strategy.  Expected \"Lazy\".");}
this.p_strategy=xmp.PlayingPolicyFactory.i_createStrategy(vi,this);this.i_getLogger().debug("Created player policy \""+vi+"\" strategy.");}
return this.p_strategy;},i_getMediaType:function(wi){return this.p_mediaTypes[wi];},i_getPlugins:function(){this.p_init();return this.p_plugIns;},p_getPlugin:function(xi){return this.i_getPlugins()[xi];},p_validatePlugIn:function(yi){if(yi.displayName.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin display name.");}
if(yi.minVersion.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+yi.displayName+"\" minimum version.");}
if(yi.downloadUrl.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+yi.displayName+"\" download url.");}},i_getLogger:function(){return this.p_logger;},p_init:function(){if(this.p_initialized&&true===this.p_initialized){return;}
this.p_initialized=true;this.p_strategy=null;this.p_logger=new xmp.util.internals.CategoryLogger('PlayerPolicy');xmp.util.PlayerStats.getInstance().i_setValue("OS",navigator.platform);xmp.util.PlayerStats.getInstance().i_setValue("Browser",navigator.userAgent);this.p_initStreamingModes();this.p_initMediaTypes();this.p_initBootstrapMedia();this.p_initPlugins();this.p_initNativePlayers();this.p_initNativePlayerGroups();this.p_initSupportedPlatforms();this.p_initPlaybackPriorityGroups();this.p_initPlaybackPlatforms();},i_getFailover:function(){if(!this.p_failover){var zi=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(yh);this.p_failover=zi.getBoolean(Rh,false);}
return this.p_failover;},i_getSizes:function(){this.p_init();if(!this.p_playerSizes){this.p_initPlayerSizes();}
return this.p_playerSizes;},getSizeFromPlayer:function(Ai){this.p_init();var Bi=this.i_getSizes();var Ci=Bi.length;for(var i=0;i<Ci;i++){var Di=Ai.length;for(var j=0;j<Di;j++){if(Bi[i]===Ai[j]){return Bi[i];}}}
return"";},p_initPlayerSizes:function(){this.p_playerSizes=[];var Ei=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath(Sh);var Fi=Ei.retrieveKeys();var Gi=Fi.length;if(Gi===0){throw new xmp.PlayingPolicyError("Validating player sizes.","Missing player sizes.");}
for(var i=0;i<Gi;i++){var Hi=Ei.getString(Fi[i],xmp.NO_DEFAULT_VALUE);if(Hi.length===0){throw new xmp.PlayingPolicyError("Validating player size.","Missing player size.");}
this.p_playerSizes.push(Hi);}},i_validateBootstrap:function(Ii){this.p_init();this.p_getStrategy().i_validateBootstrap(Ii);},p_initStreamingModes:function(){var Ji=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Ch);var Ki=Ji.retrieveKeys();var Li=Ki.length;this.p_modes=[];for(var i=0;i<Li;i++){var Mi=Ji.getString(Ki[i],xmp.NO_DEFAULT_VALUE);if(Mi.length===0){throw new xmp.PlayingPolicyError("Validating streaming mode.","Missing mode.");}
this.p_modes.push(Mi);}
return this.p_modes;},i_getStreamingModes:function(){this.p_init();if(!this.p_modes){throw new xmp.PlayingPolicyError("Retrieving streaming modes.","Missing modes.");}
if(this.p_modes.length===0){throw new xmp.PlayingPolicyError("Validating streaming modes.","Missing modes.");}
return this.p_modes;},p_initBootstrapMedia:function(){var Ni=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Dh);var Oi=Ni.retrieveKeys();var Pi=Oi.length;if(Pi===0){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Missing media.");}
this.p_bootstrapMedia=[];for(var i=0;i<Pi;i++){var Qi=Ni.getString(Oi[i],xmp.NO_DEFAULT_VALUE);var Ri=this.i_getMediaType(Qi);if(!Ri){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Invalid bootstrap media type \""+Qi+"\".");}
this.p_bootstrapMedia.push(Ri);}
return this.p_bootstrapMedia;},i_getBootstrapMedia:function(){this.p_init();if(!this.p_bootstrapMedia){throw new xmp.PlayingPolicyError("Retrieving bootstrap media.","Missing media.");}
return this.p_bootstrapMedia;},p_initNativePlayers:function(){var Si=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Gh);var Ti=Si.retrieveChildren();var Ui=Ti.length;if(Ui===0){throw new xmp.PlayingPolicyError("Validating native players.","Missing players.");}
this.p_nativePlayers=[];for(var i=0;i<Ui;i++){var Vi=Ti[i];if(!xmp.getNamespacedMethod(Vi.getName())){throw new xmp.PlayingPolicyError("Validating native player.","Invalid "+Vi.getName()+" native player.");}
var Wi=Vi.retrieveKeys();var Xi=Wi.length;var Yi={};for(var j=0;j<Xi;j++){Yi[Wi[j]]=Vi.getString(Wi[j],xmp.NO_DEFAULT_VALUE);}
this.p_nativePlayers[Vi.getName()]=Yi;}},p_initNativePlayerGroups:function(){var Zi=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Hh);var $i=Zi.retrieveChildren();var aj=$i.length;if(aj===0){throw new xmp.PlayingPolicyError("Validating native player groups.","Missing groups.");}
this.p_nativePlayerGroups=[];for(var i=0;i<aj;i++){var bj=this.p_getDefaultNativePlayerGroup();var cj=$i[i];var dj=cj.retrieveChildren();var ej=dj.length;if(ej===0){throw new xmp.PlayingPolicyError("Validating native player group mime types.","Missing "+cj.getName()+" mime types.");}
for(var j=0;j<ej;j++){var fj=dj[j].getString(Mh,xmp.NO_DEFAULT_VALUE);if(fj.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type.","Missing \""+cj.getName()+"\" mime type.");}
if(false===this.i_isMimeTypeSupported(fj)){continue;}
var gj=dj[j].getNodeForPath(Kh);var hj=gj.retrieveKeys();var ij=hj.length;if(ij===0){throw new xmp.PlayingPolicyError("Validating native player group mime type players.","Missing "+cj.getName()+" native player group \""+fj+"\" players.");}
var jj=[];for(var k=0;k<ij;k++){var kj=gj.getString(hj[k],xmp.NO_DEFAULT_VALUE);if(kj.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Missing "+cj.getName()+" native player group \""+fj+"\" player.");}
if(false===xmp.isDefined(this.i_getNativePlayerConfig(kj))){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Invalid "+cj.getName()+" native player group \""+fj+"\" player \""+kj+".");}
jj.push(kj);}
bj[fj]=jj;}
this.p_nativePlayerGroups[cj.getName()]=bj;}},p_initSupportedPlatforms:function(){var lj=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Eh);var mj=lj.retrieveChildren();var nj=mj.length;if(nj===0){throw new xmp.PlayingPolicyError("Validating supported platforms.","Missing platforms.");}
this.p_platforms={};for(var i=0;i<nj;i++){var oj=mj[i];var pj=oj.retrieveKeys();var qj=pj.length;if(qj===0){throw new xmp.PlayingPolicyError("Validating supported platform browsers.","Missing "+oj.getName()+" browsers.");}
var rj=[];for(var j=0;j<qj;j++){var sj=oj.getString(pj[j],xmp.NO_DEFAULT_VALUE);if(sj.length===0){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Missing "+oj.getName()+" platform \""+pj[j]+"\" browser native player group.");}
if(false===xmp.isDefined(this.i_getNativePlayerGroup(sj))){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Invalid "+oj.getName()+" platform \""+pj[j]+"\" browser native player group \""+sj+"\".");}
rj.push({name:pj[j],playersGroup:sj,modes:{}});}
if(xmp.util.internals.BrowserDetect.OS===oj.getName()){this.p_initPlatformPlugInOverrides(oj);}
this.p_platforms[oj.getName()]=rj;}},p_initPlaybackPriorityGroups:function(){var tj=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Fh);var uj=tj.retrieveChildren();var vj=uj.length;if(vj===0){throw new xmp.PlayingPolicyError("Validating playback priority groups.","Missing groups.");}
this.p_playbackPriorityGroups=[];for(var i=0;i<vj;i++){var wj=uj[i];var xj=wj.retrieveKeys();var yj=xj.length;if(yj===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+wj.getName()+" media.");}
var zj=[];for(var j=0;j<yj;j++){var Aj=wj.getString(xj[j],xmp.NO_DEFAULT_VALUE);if(Aj.length===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+wj.getName()+" media type.");}
if(false===xmp.isDefined(this.i_getMediaType(Aj))){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Invalid "+wj.getName()+" media type \""+Aj+"\".");}
zj.push(Aj);}
this.p_playbackPriorityGroups[wj.getName()]=zj;}},p_initPlaybackPlatforms:function(){var Bj=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Ih);var Cj=Bj.retrieveChildren();var Dj=Cj.length;if(Dj===0){throw new xmp.PlayingPolicyError("Validating playback platforms.","Missing platforms.");}
for(var i=0;i<Dj;i++){var Ej=Cj[i];if(this.p_getSupportedPlatform(Ej.getName())===null){throw new xmp.PlayingPolicyError("Validating playback platform OS.","The "+Ej.getName()+"platform OS is not supported.");}
var Fj=Ej.retrieveChildren();var Gj=Fj.length;if(Gj===0){throw new xmp.PlayingPolicyError("Validating playback platform browsers.","Missing "+Ej.getName()+" platform browsers.");}
for(var j=0;j<Gj;j++){var Hj=Fj[j];var Ij=this.i_getSupportedPlatformBrowser(Ej.getName(),Hj.getName());if(!Ij){throw new xmp.PlayingPolicyError("Validating playback platform browser.","The "+Ej.getName()+" platform browser "+Hj.getName()+" is not supported.");}
var Jj=Hj.retrieveKeys();var Kj=Jj.length;if(Kj===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming modes.","Missing "+Ej.getName()+" platform browser "+Hj.getName()+" streaming modes.");}
for(var k=0;k<Kj;k++){if(false===this.p_isStreamingModeSupported(Jj[k])){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode.","Invalid "+Ej.getName()+" platform browser "+Hj.getName()+" streaming mode "+Jj[k]+".");}
var Lj=Hj.getString(Jj[k],xmp.NO_DEFAULT_VALUE);if(Lj.length===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Missing "+Ej.getName()+" platform browser "+Hj.getName()+" streaming mode "+Jj[k]+" playback priority group.");}
if(false===xmp.isDefined(this.i_getPlaybackPriorityGroup(Lj))){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Invalid "+Ej.getName()+" platform browser "+Hj.getName()+" streaming mode "+Jj[k]+" playback priority group "+Lj+".");}
Ij.modes[Jj[k]]=Lj;}}}},p_initPlatformPlugInOverrides:function(Mj){var Nj=Mj.getNodeForPath(Th);var Oj=Nj.retrieveChildren();var Pj=Oj.length;for(var i=0;i<Pj;i++){var Qj=Oj[i];var Rj=this.p_getPlugin(Qj.getName());if(!Rj){throw new xmp.PlayingPolicyError("Validating platform plugin override.","Invalid "+Mj.getName()+" platform \""+Qj.getName()+"\" plugin.");}
var Sj=Qj.getString(Ph,xmp.NO_DEFAULT_VALUE);if(Sj.length>0){Rj.minVersion=Sj;}
var Tj=Qj.getString(Qh,xmp.NO_DEFAULT_VALUE);if(Tj.length>0){Rj.maxVersion=Tj;}
var Uj=Qj.getString(Oh,xmp.NO_DEFAULT_VALUE);if(Uj.length>0){Rj.downloadUrl=Uj;}}},p_getSupportedPlatform:function(Vj){return this.p_platforms[Vj];},i_getPlaybackPriorityGroup:function(Wj){this.p_init();return this.p_playbackPriorityGroups[Wj];},i_getSupportedPlatformBrowser:function(Xj,Yj){this.p_init();var Zj=this.p_getSupportedPlatform(Xj);if(!Zj){return null;}
var $j=Zj.length;for(var i=0;i<$j;i++){if(Yj===Zj[i].name){return Zj[i];}}
return null;},p_isStreamingModeSupported:function(ak){var bk=this.p_modes.length;for(var i=0;i<bk;i++){if(ak===this.p_modes[i]){return true;}}
return false;},i_isMimeTypeSupported:function(ck){this.p_init();for(var dk=xmp.MapIterator.create(this.p_mediaTypes);dk.hasNext();dk.next()){var ek=dk.currentValue();if(ek.mimeType===ck){return true;}}
return((this.p_getDefaultNativePlayerGroup()[ck])?true:false);},i_getMimeTypes:function(){this.p_init();var fk=[];for(var gk=xmp.MapIterator.create(this.p_mediaTypes);gk.hasNext();gk.next()){fk.push(gk.currentValue().mimeType);}
return fk;},i_getNativePlayerConfig:function(hk){this.p_init();return this.p_nativePlayers[hk];},i_getNativePlayerGroup:function(ik){this.p_init();return this.p_nativePlayerGroups[ik];},p_getDefaultNativePlayerGroup:function(){this.p_init();return{"application/x-null":["xmp.NullPlayer"],"application/x-dhtml":["xmp.DHTMLPlayer"],"application/xmp-mock":["xmp.MockNativePlayer"]};}};}();xmp.PlayingPolicyFactory=function(){return{i_createStrategy:function(jk,kk){if(jk===xmp.i_LAZY_PLAYING_POLICY){return new xmp.LazyPlayingPolicy(kk);}
throw new xmp.PlayingPolicyError("Creating playing policy strategy.","Unable to create playing policy strategy \""+jk+"\".");}};}();xmp.ContextualUrlStrategy=function(){this.p_logger=new xmp.util.internals.CategoryLogger('ContextualUrlStrategy');this.p_mapMimeTypeToUrlStrategy=null;this.p_mapStrategyNameToStrategyObject={};this.p_defaultStrategy=new xmp.SimpleUrlStrategy();xmp.util.SettingsManager.getInstance().i_addContextChangeListener(new xmp.util.Callback('ContextualUrlStrategy',this.p_handleContextChange,this));};xmp.ContextualUrlStrategy.create=function(){var lk=new xmp.ContextualUrlStrategy();return lk;};xmp.ContextualUrlStrategy.prototype.getName=function(){return'Contextual';};xmp.ContextualUrlStrategy.prototype.tryFailover=function(mk,nk,ok){if((!mk)||(!nk)||(!ok)){return false;}
if(ok instanceof xmp.NativePlayerConnectionError&&(this.p_mapStrategyNameToStrategyObject[this.p_getStrategyName(nk)].getName()!==this.p_defaultStrategy.getName())){this.p_setFailoverStrategy(nk,ok);nk.setURI(nk.getMetadata('originalUri','foo'));nk.setUriAbsolute(false);mk.open(nk);return true;}
return false;};xmp.ContextualUrlStrategy.prototype.buildUrlAsynch=function(pk,qk){var rk=new xmp.util.Callback('ContextualUrlStrategy',this.p_handleDelegateBuildUrlAsynch,this);rk.setMetadata('relayCb',qk);try{this.p_getStrategy(pk).buildUrlAsynch(pk,rk);}
catch(ex){this.p_logger.warn('Error calling buildUrlAsynch: '+ex);this.p_handleDelegateBuildUrlAsynch(rk,pk,ex);}};xmp.ContextualUrlStrategy.prototype.p_handleDelegateBuildUrlAsynch=function(sk,tk,uk){var vk=sk.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);if(uk!==null){this.p_setFailoverStrategy(tk,uk);if(uk.octoError){this.p_logger.warn('Trying again after fail over.');this.buildUrlAsynch(tk,vk);return;}}
vk.call(tk,uk);};xmp.ContextualUrlStrategy.prototype.p_setFailoverStrategy=function(wk,xk){try{if(xk instanceof xmp.PlugInError){return;}
var yk=this.p_getStrategyName(wk);this.p_logger.i_critical('Failing over for strategy: '+yk,xk);this.p_mapStrategyNameToStrategyObject[yk]=this.p_defaultStrategy;}
catch(ex){this.p_logger.i_critical('Error setting failover strategy, setting all strategies to default: '+ex);for(var zk=xmp.MapIterator.create(this.p_mapStrategyNameToStrategyObject);zk.hasNext();zk.next()){zk.updateCurrentValue(this.p_defaultStrategy);}}};xmp.ContextualUrlStrategy.prototype.p_getStrategyName=function(Ak){var Bk=Ak.getMimeType();if(!xmp.isNonEmptyString(Bk)){throw new Error('No mime-type on playable node.');}
this.p_loadMimeTypeToUrlStrategyMap();var Ck=this.p_mapMimeTypeToUrlStrategy[Bk];if(!xmp.isNonEmptyString(Ck)){Ck='Simple';this.p_mapMimeTypeToUrlStrategy[Bk]=Ck;}
return Ck;};xmp.ContextualUrlStrategy.prototype.p_getStrategy=function(Dk){var Ek=this.p_getStrategyName(Dk);var Fk=this.p_mapStrategyNameToStrategyObject[Ek];if(typeof(Fk)==='undefined'){Fk=this.p_createStrategy(Ek);this.p_mapStrategyNameToStrategyObject[Ek]=Fk;}
if(this.p_logger.isInfoEnabled()){this.p_logger.info('For mime-type: '+Dk.getMimeType()+', requested strategy: '+Ek+', actual strategy: '+Fk.getName());}
return Fk;};xmp.ContextualUrlStrategy.prototype.p_createStrategy=function(Gk){if(Gk==='Simple'){return this.p_defaultStrategy;}
if(Gk==='Octoshape'){return new xmp.OctoshapeUrlStrategy();}
if(Gk==='OctoshapeConditional'){if(xmp.InternalUserDetection.getInstance().isInternal()&&xmp.OctoshapeUrlStrategy.canUse()){return new xmp.OctoshapeUrlStrategy();}
else{return this.p_defaultStrategy;}}
throw new Error('Unrecogonized URL strategy name: '+Gk);};xmp.ContextualUrlStrategy.prototype.p_loadMimeTypeToUrlStrategyMap=function(){if(this.p_mapMimeTypeToUrlStrategy!==null){return;}
this.p_mapMimeTypeToUrlStrategy={};this.p_mapStrategyNameToStrategyObject={};var Hk=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('UrlStrategies');var Ik=Hk.retrieveKeys();for(var i=0;i<Ik.length;i++){var Jk=Ik[i];var Kk=Hk.getString(Jk,'dummy');this.p_mapMimeTypeToUrlStrategy[Jk]=Kk;}};xmp.ContextualUrlStrategy.prototype.p_handleContextChange=function(){this.p_mapMimeTypeToUrlStrategy=null;};xmp.InternalUserDetection=function(){this.p_logger=new xmp.util.internals.CategoryLogger('InternalUserDetection');this.p_isInited=false;this.p_isInternal=false;this.p_primaryCheckResult=-1;};xmp.InternalUserDetection.p_instance=null;xmp.InternalUserDetection.getInstance=function(){if(xmp.InternalUserDetection.p_instance===null){xmp.InternalUserDetection.p_instance=new xmp.InternalUserDetection();}
return xmp.InternalUserDetection.p_instance;};xmp.InternalUserDetection.prototype.isInternal=function(){if(!this.p_isInited){throw new Error('InternalUserDetection not initialized.');}
return this.p_isInternal;};xmp.InternalUserDetection.prototype.init=function(Lk){this.p_isInited=false;this.p_isInternal=false;this.p_primaryCheckResult=-1;try{var Mk=this.p_getPrefs();if(!Mk.getBoolean('do primary check',false)){this.p_logger.info('Primary check turned OFF, NOT an internal user.');this.p_finish(Lk,false);return;}
this.p_primaryCheckResult=this.p_isInternalPrimaryCheck();if(1===this.p_primaryCheckResult){if(Mk.getBoolean('do secondary check',false)){this.p_logger.info('Primary check returned true, and secondary check turned ON, doing secondary check.');this.p_checkResourceLoadedFromWeb(Lk);return;}
else{this.p_logger.info('Primary check returned true, and secondary check turned OFF, IS an internal user.');this.p_finish(Lk,true);return;}}
else{this.p_logger.info('Primary check returned: '+this.p_primaryCheckResult+', NOT an internal user.');this.p_finish(Lk,false);return;}}
catch(ex){this.p_logger.info('Error checking internal user.',ex);this.p_finish(Lk,false);}};xmp.InternalUserDetection.prototype.p_finish=function(Nk,Ok){this.p_isInternal=Ok;this.p_doAsynchCallback(Nk);};xmp.InternalUserDetection.prototype.p_isInternalPrimaryCheck=function(){var cc=this.p_getCountryCode();if(!xmp.isNonEmptyString(cc)){return-1;}
if(cc==='***'){return 1;}
return 0;};xmp.InternalUserDetection.prototype.p_getCountryCode=function(){var cc='';if(xmp.util.Cookie.canUse()){var Pk=xmp.util.Cookie.read('adDEmas');if(xmp.isNonEmptyString(Pk)){var Qk=Pk.split('&');if(Qk.length>=5){cc=Qk[4];}}}
return cc;};xmp.InternalUserDetection.prototype.p_doAsynchCallback=function(Rk){this.p_isInited=true;Rk.i_callAsynch([]);};xmp.InternalUserDetection.prototype.p_checkResourceLoadedFromWeb=function(Sk){var Tk=this.p_getPrefs();var Uk=Tk.getString('rel url','dummy');var Vk='internalUserCheckResource';this.p_isInternal=false;var Wk=new xmp.util.Callback('InternalUserDetection.p_checkResourceLoadedFromWeb',this.p_onResourceLoadedFromWeb,this);Wk.setMetadata('relayCb',Sk);xmp.net.AjaxRequestManager.getInstance().request(Uk,Wk,Vk,Uk,xmp.net.ContentTypes.TEXT,null);};xmp.InternalUserDetection.prototype.p_onResourceLoadedFromWeb=function(Xk,Yk){var Zk=Xk.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);this.p_isInited=true;this.p_isInternal=!Yk.isError();this.p_logger.info('Secondary check returned: '+this.p_isInternal+', user '+(this.p_isInternal?'IS':'is NOT')+' an internal user.');try{Zk.call();}
catch(ex){this.p_logger.error('Error calling callback.',ex);}};xmp.InternalUserDetection.prototype.p_getPrefs=function(){return xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath('InternalUserCheck');};xmp.OctoshapeUrlStrategy=function(){this.p_logger=new xmp.util.internals.CategoryLogger('OctoshapeUrlStrategy');this.p_OCTO_MIME_TYPE='application/x-octoshapeplugin';this.p_VALIDATE_OCTO='ValidateOctoshape';this.p_OCTO_ASYNCH_INTERVAL=5;this.p_OCTO_POLL_INTERVAL=this.p_getPrefs().getInt('octo poll interval',2000);this.p_OCTO_TRY_LIMIT=this.p_getPrefs().getInt('octo try limit',8);this.p_OCTO_STATE_PLUGIN_INITIALIZING=-4500;this.p_OCTO_STATE_STARTING=1;this.p_OCTO_STATE_READY=2;this.p_octoGroup='';this.p_octoPlugin=null;this.p_initializingOctoPlugin=null;this.p_octoException=null;try{this.p_createOctoPlugin();}
catch(ex){this.p_initializingOctoPlugin=this.p_octoPlugin=null;this.p_octoException=ex;this.p_logger.warn('Error creating octoshape plugin: '+ex);}};xmp.OctoshapeUrlStrategy.canUse=function(){try{if(typeof(xmp.OctoshapeUrlStrategy._canUseInternal)==='undefined'){var $k=xmp.OctoshapeUrlStrategy.p_staticGetPrefs();var al='{fn:function(){'+$k.getString('octo can use fn','return false;')+'}}';var bl=xmp.net.AjaxRequestManager.getInstance().i_parseJson(al);xmp.OctoshapeUrlStrategy._canUseInternal=bl.fn;}
return xmp.OctoshapeUrlStrategy._canUseInternal();}
catch(ex){xmp.util.internals.CategoryLogger.i_create('OctoshapeUrlStrategy').warn('Error calling canUse.',ex);return false;}};xmp.OctoshapeUrlStrategy.prototype.getName=function(){return'Octoshape';};xmp.OctoshapeUrlStrategy.prototype.buildUrlAsynch=function(cl,dl){if(this.p_octoException!==null){throw this.p_octoException;}
try{var el=new xmp.util.Callback('OctoshapeUrlStrategy',this.p_handleTimer,this);el.setMetadata('relayCb',dl);el.setMetadata('node',cl);this.p_doTimer(el);}
catch(ex){this.p_octoException=ex;throw this.p_octoException;}};xmp.OctoshapeUrlStrategy.prototype.p_doTimer=function(fl){var gl=fl.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var hl=this.p_OCTO_POLL_INTERVAL;var il=fl.getMetadata('octo_tries',0);var jl=this.p_getOctoStatus(il);switch(jl){case this.p_OCTO_STATE_PLUGIN_INITIALIZING:case this.p_OCTO_STATE_STARTING:hl=this.p_OCTO_POLL_INTERVAL;il++;fl.setMetadata('octo_tries',il);break;case this.p_OCTO_STATE_READY:hl=this.p_OCTO_ASYNCH_INTERVAL;var kl=gl.getURI();var ll=gl.getBestId();var ml=this.p_getPrefs().getNodeForPath('url mapping');var nl=ml.getString(ll,kl);kl=nl;var ol=this.p_octoPlugin.getLink(kl,false);gl.setURI(ol);this.p_logger.info('Old URI: '+kl+', New Octoshape URI: '+ol);fl.setMetadata('octo_ready',true);break;default:throw new Error('Unexepected octoshape status: '+jl);}
if(this.p_logger.isDebugEnabled()){this.p_logger.debug('Node: '+gl.getBestId()+', timer duration: '+hl+', tries: '+il+', status: '+jl);}
xmp.util.Timer.i_doSimpleCallbackEx(hl,fl);};xmp.OctoshapeUrlStrategy.p_staticGetPrefs=function(){return xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('UrlStrategies/Octoshape');};xmp.OctoshapeUrlStrategy.prototype.p_getPrefs=function(){return xmp.OctoshapeUrlStrategy.p_staticGetPrefs();};xmp.OctoshapeUrlStrategy.prototype.p_handleTimer=function(pl){var ql=pl.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);var rl=pl.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var sl=pl.getMetadata('octo_ready',false);if(sl){ql.call(rl,null);}
else{try{this.p_doTimer(pl);}
catch(ex){this.p_octoException=ex;ql.call(rl,ex);}}};xmp.OctoshapeUrlStrategy.prototype.p_getOctoStatus=function(tl){if(tl>=this.p_OCTO_TRY_LIMIT){var ul=new Error('Exceeded limit of attempts to start octoshape: '+this.p_OCTO_TRY_LIMIT);ul.octoError=true;throw ul;}
if(this.p_checkOctoPlugin(tl===(this.p_OCTO_TRY_LIMIT-1))){return this.p_octoPlugin.getStatus(true);}
else{return this.p_OCTO_STATE_PLUGIN_INITIALIZING;}};xmp.OctoshapeUrlStrategy.prototype.p_checkOctoPlugin=function(vl){if(this.p_octoPlugin){return true;}
if(!this.p_octoPlugin){if(!(typeof(this.p_initializingOctoPlugin.getStatus)!=='undefined'&&typeof(this.p_initializingOctoPlugin.getLink)!=='undefined')){if(vl){throw new xmp.InvalidPlugInVersionError(this.p_VALIDATE_OCTO,this.p_getPluginInfo(),'out-of-date-version');}
else{return false;}}
this.p_octoPlugin=this.p_initializingOctoPlugin;return true;}};xmp.OctoshapeUrlStrategy.prototype.p_createOctoPlugin=function(){this.p_octoPlugin=null;this.p_initializingOctoPlugin=null;if(window.ActiveXObject){try{this.p_initializingOctoPlugin=new window.ActiveXObject('octoshapeplugin'+this.p_octoGroup+'.client');}
catch(ex){this.p_logger.info('Error creating Octoshape ActiveXObject',ex);this.p_initializingOctoPlugin=null;}}
else{var wl=this.p_OCTO_MIME_TYPE+this.p_octoGroup+'-client';var xl=null;if(window.navigator&&window.navigator.mimeTypes&&window.navigator.mimeTypes.length){xl=window.navigator.mimeTypes[wl];}
if(!xl){throw new xmp.PlugInNotFoundError(this.p_VALIDATE_OCTO,this.p_getPluginInfo());}
if(!xl.enabledPlugin){throw new xmp.PlugInDisabledError(this.p_VALIDATE_OCTO,this.p_getPluginInfo(),this.p_OCTO_MIME_TYPE);}
var yl=window.document.createElement("DIV");window.document.body.appendChild(yl);yl.innerHTML='<object id="xmp_octoshapeclientobject" type="'+wl+'" hidden="true"></object>';this.p_initializingOctoPlugin=window.document.getElementById('xmp_octoshapeclientobject');}
if(!this.p_initializingOctoPlugin){throw new xmp.PlugInNotFoundError(this.p_VALIDATE_OCTO,this.p_getPluginInfo());}};xmp.OctoshapeUrlStrategy.prototype.p_getPluginInfo=function(){var zl=xmp.PlayerPolicy;var Al=zl.i_getPlugins();var Bl=Al.Octoshape;if(!Bl){var ex=new Error('Octoshape plugin incorrectly configured.');this.p_logger.i_fatal('Octoshape error',ex);throw ex;}
return Bl;};xmp.SimpleUrlStrategy=function(){};xmp.SimpleUrlStrategy.prototype.getName=function(){return'Simple';};xmp.SimpleUrlStrategy.prototype.buildUrlAsynch=function(Cl,Dl){Dl.i_callAsynch([Cl,null]);};xmp.MediaPlayer=function(El,Fl){this.p_name=El;this.p_defaultEventListener=Fl;this.p_logger=new xmp.util.internals.CategoryLogger('MediaPlayer');this.p_MEDIA_PLAYER_CONFIGURATION_PATH="/PlayerContexts/Global/Media Player";this.p_FULLSCREEN_ENABLED="Fullscreen Enabled";this.p_STRETCH_TO_FIT="Stretch To Fit";};xmp.MediaPlayer.prototype.p_name=null;xmp.MediaPlayer.prototype.p_defaultEventListener=null;xmp.MediaPlayer.prototype.init=function(){try{this.p_urlStrategy=xmp.ContextualUrlStrategy.create();this.p_registry=new xmp.PlayerModeRegistry();this.p_state=this.p_registry.i_findMode(xmp.i_FINI);this.p_viewManager=new xmp.ViewManager(this.p_name);xmp.NativePlayerRegistry.i_createGroup(this.p_name,this);this.p_player=xmp.NativePlayerRegistry.i_findPlayerByMimeType(this.p_name,xmp.i_NULL_MIME_TYPE);this.setViewportConfig(xmp.i_NULL_MIME_TYPE,xmp.DHTML_VIEWPORT);this.p_bandwidthRecorder=new xmp.BandwidthRecorder(this,this.p_MEDIA_PLAYER_CONFIGURATION_PATH);this.p_fullscreenEnabled=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(this.p_MEDIA_PLAYER_CONFIGURATION_PATH).getBoolean(this.p_FULLSCREEN_ENABLED,false);this.p_stretchToFit=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(this.p_MEDIA_PLAYER_CONFIGURATION_PATH).getBoolean(this.p_STRETCH_TO_FIT,false);this.p_listeners=[];this.p_node=null;this.p_mute=false;this.p_volume=0;this.p_validateDefaultListener();this.p_addListener(this.p_defaultEventListener);if(!this.p_name||this.p_name.length===0){throw new xmp.MediaPlayerError("Validating media player name.","Invalid media player name.  Missing name.");}
if(this.p_name.indexOf(" ")!==-1){throw new xmp.MediaPlayerError("Validating media player name.","Invalid media player name.  Name cannot contain spaces.");}
this.p_listeners[0].onInitialized();}
catch(e){this.p_handleMethodError("Initializing.",e);}};xmp.MediaPlayer.prototype.fini=function(){try{this.p_close();this.p_viewManager.i_close();xmp.NativePlayerRegistry.i_destoryGroup(this.p_name);}
catch(e){this.p_handleMethodError("Fini.",e);}};xmp.MediaPlayer.prototype.setViewportConfig=function(Gl,Hl){try{xmp.validateArguments(arguments,[xmp.i_STRING_TYPE,xmp.i_STRING_TYPE],"MediaPlayer.setViewportConfig");if(false===xmp.PlayerPolicy.i_isMimeTypeSupported(Gl)){throw new xmp.InvalidMimeTypeError("Setting viewport configuration.","Invalid media player viewport MIME type \""+Gl+"\".");}
this.p_viewManager.i_setViewportConfig(Gl,Hl);}
catch(e){this.p_handleMethodError("Setting viewport configuration.",e);}};xmp.MediaPlayer.prototype.getViewport=function(){try{return new xmp.ViewportProxy(this.p_viewManager);}
catch(e){this.p_handleMethodError("Retrieving viewport.",e);}
return null;};xmp.MediaPlayer.prototype.open=function(Il){try{xmp.validateArguments(arguments,[xmp.i_OBJECT_TYPE],"MediaPlayer.open");this.p_node=Il;Il.setMetadata('originalUri',Il.getURI());if(false===xmp.PlayerPolicy.i_apply(this,Il)){return;}
this.p_validateNode(Il);if(false===this.p_initNativePlayer(Il)){this.p_handleNativePlayerReady(Il);}}
catch(e){this.p_handleMethodError("Opening.",e);}};xmp.MediaPlayer.prototype.close=function(){try{this.p_close();this.p_viewManager.i_close();this.p_setNullPlayer();}
catch(e){this.p_handleMethodError("Closing.",e);}};xmp.MediaPlayer.prototype.play=function(){try{this.p_state.i_play(this);}
catch(e){this.p_handleMethodError("Playing.",e);}};xmp.MediaPlayer.prototype.pause=function(){try{this.p_state.i_pause(this);}
catch(e){this.p_handleMethodError("Pausing.",e);}};xmp.MediaPlayer.prototype.stop=function(){try{this.p_state.i_stop(this);}
catch(e){this.p_handleMethodError("Stopping.",e);}};xmp.MediaPlayer.prototype.rewind=function(){try{this.p_state.i_rewind(this);}
catch(e){this.p_handleMethodError("Rewinding.",e);}};xmp.MediaPlayer.prototype.fastForward=function(){try{this.p_state.i_fastForward(this);}
catch(e){this.p_handleMethodError("Fast forwarding.",e);}};xmp.MediaPlayer.prototype.seek=function(Jl){try{xmp.validateArguments(arguments,[xmp.i_NUMBER_TYPE],"MediaPlayer.seek");this.p_validatePosition(Jl);this.p_state.i_seek(this,Jl);}
catch(e){this.p_handleMethodError("Seeking.",e);}};xmp.MediaPlayer.prototype.isAvailable=function(Kl){try{xmp.validateArguments(arguments,[xmp.i_STRING_TYPE],"MediaPlayer.isAvailable");return this.p_state.i_isAvailable(this,Kl);}
catch(e){this.p_handleMethodError("Checking information or action available.",e);}
return false;};xmp.MediaPlayer.prototype.getPosition=function(){try{return this.p_state.i_getPosition(this);}
catch(e){this.p_handleMethodError("Retrieving position.",e);}
return 0;};xmp.MediaPlayer.prototype.getDuration=function(){try{return this.p_state.i_getDuration(this);}
catch(e){this.p_handleMethodError("Retrieving duration.",e);}
return 0;};xmp.MediaPlayer.prototype.setVolume=function(Ll){try{xmp.validateArguments(arguments,[xmp.i_NUMBER_TYPE],"MediaPlayer.setVolume");this.p_validateVolume(Ll);this.p_state.i_setVolume(this,Ll);this.p_volume=this.p_state.i_getVolume(this);}
catch(e){this.p_handleMethodError("Setting volume.",e);}};xmp.MediaPlayer.prototype.getVolume=function(){try{return this.p_state.i_getVolume(this);}
catch(e){this.p_handleMethodError("Retrieving volume.",e);}
return 0;};xmp.MediaPlayer.prototype.setMute=function(Ml){try{xmp.validateArguments(arguments,[xmp.i_BOOLEAN_TYPE],"MediaPlayer.setMute");this.p_state.i_setMute(this,Ml);this.p_mute=this.p_state.i_getMute(this);}
catch(e){this.p_handleMethodError("Setting mute.",e);}};xmp.MediaPlayer.prototype.getMute=function(){try{return this.p_state.i_getMute(this);}
catch(e){this.p_handleMethodError("Retrieving mute.",e);}
return false;};xmp.MediaPlayer.prototype.setFullscreen=function(Nl){try{xmp.validateArguments(arguments,[xmp.i_BOOLEAN_TYPE],"MediaPlayer.setFullscreen");this.p_state.i_setFullscreen(this,Nl);}
catch(e){this.p_handleMethodError("Setting fullscreen.",e);}};xmp.MediaPlayer.prototype.getFullscreen=function(){try{return this.p_state.i_getFullscreen(this);}
catch(e){this.p_handleMethodError("Retrieving fullscreen.",e);}
return false;};xmp.MediaPlayer.prototype.getBufferingProgress=function(){try{return this.p_state.i_getBufferingProgress(this);}
catch(e){this.p_handleMethodError("Retrieving buffering progress.",e);}
return null;};xmp.MediaPlayer.prototype.addEventListener=function(Ol){try{xmp.validateArguments(arguments,[xmp.i_OBJECT_TYPE],"MediaPlayer.addEventListener");this.p_addListener(Ol);}
catch(e){this.p_handleMethodError("Adding event listener.",e);}};xmp.MediaPlayer.prototype.p_initNativePlayer=function(Pl){try{this.p_close();var Ql=Pl.getMimeType();var Rl=xmp.NativePlayerRegistry.i_findPlayerByMimeType(this.p_name,Ql);if(!Rl){throw new xmp.InvalidMimeTypeError("Initializing native player.","Unable to find native player for MIME type \""+Ql+"\".");}
if(Ql===xmp.MOCK_MIME_TYPE){this.p_player=Rl;return false;}
var Sl={player:Rl,data:{group:this.p_name,viewport:null,volume:this.p_volume,mute:this.p_mute,node:Pl,fullscreenEnabled:this.p_fullscreenEnabled,stretchToFit:this.p_stretchToFit}};if(false===this.p_viewManager.i_openViewport(this,this.p_name,Pl.getMimeType(),Sl)){if(Rl.i_getType()!==this.p_player.i_getType()){Rl.i_create({group:this.p_name,viewport:this.p_viewManager.i_getActiveViewport(),volume:this.p_volume,mute:this.p_mute,node:Pl,fullscreenEnabled:this.p_fullscreenEnabled,stretchToFit:this.p_stretchToFit});this.p_player=Rl;return true;}
return false;}
return true;}
catch(e){this.p_setNullPlayer();throw e;}
return false;};xmp.MediaPlayer.prototype.i_onNativePlayerStateChange=function(Tl,Ul){try{if(Tl===xmp.OPEN){if(this.p_state.i_getType()===xmp.ERRORS||this.p_state.i_getType()===xmp.i_FINI){this.p_logger.debug("Ignoring native player \""+xmp.OPEN+"\" state change.  Media player is in an idle (closed) or error state.");return;}
this.p_notifyStateChange(Tl,Ul);this.p_notifyTimelineChange(this.p_state.i_getPosition(this),this.p_state.i_getDuration(this));this.p_state.i_play(this);return;}
else{if(Tl===xmp.ENDED){this.p_notifyTimelineChange(this.p_state.i_getPosition(this),this.p_state.i_getDuration(this));this.p_state.i_ended(this);}
else if(Tl===xmp.CONNECTING){this.p_bandwidthRecorder.i_start();}}
this.p_notifyStateChange(Tl,Ul);}
catch(e){this.p_handleError(e);}};xmp.MediaPlayer.prototype.i_onNativePlayerTrigger=function(Vl,Wl){for(var i=0;i<this.p_listeners.length;i++){this.p_listeners[i].onTrigger(this.p_node,Vl,Wl);}};xmp.MediaPlayer.prototype.i_onNativePlayerError=function(e){this.p_handleError(e);};xmp.MediaPlayer.prototype.i_onNativePlayerTimelineChange=function(Xl,Yl){this.p_notifyTimelineChange(Xl,Yl);this.p_checkTimeLimit(Xl,Yl);};xmp.MediaPlayer.prototype.i_onNativePlayerCreated=function(Zl,$l){if(this.p_state.i_getType()===xmp.ERRORS){return;}
this.p_logger.debug("Created \""+Zl.i_getType()+"\" native player \""+Zl.i_getName()+"\".");this.p_handleNativePlayerReady($l.node);};xmp.MediaPlayer.prototype.i_onNativePlayerInvoke=function(am,bm){if(!this[am]){throw new xmp.NativePlayerUnsupportedError("Handling invoke.","Invalid method \""+am+"\".",this.p_player);}
this[am].apply(this,bm);};xmp.MediaPlayer.prototype.i_onViewportOpened=function(cm,dm){dm.data.viewport=cm;dm.player.i_create(dm.data);this.p_player=dm.player;};xmp.MediaPlayer.prototype.i_onCreateViewport=function(em,fm,gm,hm){return this.p_listeners[0].onCreateViewport(em,fm,gm,hm);};xmp.MediaPlayer.prototype.i_onDestroyViewport=function(im,jm){this.p_listeners[0].onDestroyViewport(im,jm);};xmp.MediaPlayer.prototype.i_onViewportCreated=function(km,lm){if(this.p_state.i_getType()===xmp.ERRORS){return;}
if(lm===null){return;}
this.p_logger.debug("Created \""+km.i_getType()+"\" viewport.");this.p_viewManager.i_openViewport(this,this.p_name,km.i_getMimeType(),lm);};xmp.MediaPlayer.prototype.i_onViewportError=function(e){this.p_handleError(e);};xmp.MediaPlayer.prototype.p_handleMethodError=function(mm,e){var nm=e;if(false===(nm instanceof xmp.MediaPlayerError)){nm=new xmp.MediaPlayerError(((e.context)?e.context:mm),((e.rawMessage)?e.rawMessage:e.message));nm.setInnerError(e);}
this.p_handleError(nm);};xmp.MediaPlayer.prototype.p_handleError=function(e){try{var om=((this.p_node)?this.p_node.getURI():"");if(om&&om.length>0&&(e instanceof xmp.util.internals.XMPError)){e.addExtendedInfo({label:"Url",text:om});}
var pm="\n\n"+e.message;this.p_logger.debug(pm);var qm=new xmp.baseplayer.ApplicationError(e,'mediaPlayerError',e.context,[{label:"Url",text:om}]);if(!this.p_listeners||this.p_listeners.length===0){this.p_logAppError(qm);xmp.handleFatalError(qm);}
else{this.p_error();if(this.p_urlStrategy.tryFailover(this,this.p_node,e)){return;}
this.p_logAppError(qm);for(var i=0;i<this.p_listeners.length;i++){this.p_listeners[i].onError(this.p_node,qm);}}}
catch(e2){}};xmp.MediaPlayer.prototype.p_logAppError=function(rm){if(rm.getInnerError()instanceof xmp.NativePlayerConnectionError){this.p_logger.i_critical(rm.message,rm);}
else{this.p_logger.warn(rm.message,rm);}};xmp.MediaPlayer.prototype.p_validateNode=function(sm){if(sm===null){throw new xmp.InvalidPlayableNodeError("Validating playable node.","Invalid playable node.  Missing node.");}
var tm=sm.getMimeType();if(!tm||tm.length===0){throw new xmp.InvalidPlayableNodeError("Validating playable node mime type.","Invalid playable node.  Missing MIME type.");}
var um=sm.getURI();if(!um||um.length===0){throw new xmp.InvalidPlayableNodeError("Validating playable node URI.","Invalid playable node.  Missing URI.");}
this.p_validateTimeLimit(sm);};xmp.MediaPlayer.prototype.p_setNullPlayer=function(){try{var vm=xmp.NativePlayerRegistry.i_findPlayerByMimeType(this.p_name,xmp.i_NULL_MIME_TYPE);if(this.p_viewManager.i_getActiveViewport()===null){this.p_viewManager.i_createViewport(this,this.p_name,xmp.i_NULL_MIME_TYPE,null);}
vm.i_create({group:this.p_name,viewport:this.p_viewManager.i_getActiveViewport(),volume:0,mute:false,node:null,fullscreenEnabled:false,stretchToFit:false});this.p_player=vm;}
catch(e){}};xmp.MediaPlayer.prototype.p_validateVolume=function(wm){if(wm<0||wm>100){throw new xmp.util.internals.InvalidArgsError("Invalid volume \""+wm+"\".  Valid values are 1 to 100.");}};xmp.MediaPlayer.prototype.p_validatePosition=function(xm){var ym=this.getDuration();if(xm<0||xm>ym){throw new xmp.util.internals.InvalidArgsError("Invalid position \""+xm+"\".  Valid values are 0 to "+ym+" seconds.");}};xmp.MediaPlayer.prototype.p_addListener=function(zm){this.p_validateListener(zm);this.p_listeners.push(zm);};xmp.MediaPlayer.prototype.p_validateListener=function(Am){if(!Am){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  NULL listener.");}
if(false===xmp.isDefined(Am.onError)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onError\" handler.");}
if(false===xmp.isDefined(Am.onStateChange)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onStateChange\" handler.");}
if(false===xmp.isDefined(Am.i_onTimelineChange)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"i_onTimelineChange\" handler.");}
if(false===xmp.isDefined(Am.onTrigger)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onTrigger\" handler.");}};xmp.MediaPlayer.prototype.p_validateDefaultListener=function(){if(false===xmp.isDefined(this.p_defaultEventListener.onInitialized)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onInitialized\" handler.");}
if(false===xmp.isDefined(this.p_defaultEventListener.onCreateViewport)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onCreateViewport\" handler.");}
if(false===xmp.isDefined(this.p_defaultEventListener.onDestroyViewport)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onDestroyViewport\" handler.");}
if(false===xmp.isDefined(this.p_defaultEventListener.onPlugInError)){throw new xmp.MediaPlayerError("Invalid media player event listener.  Missing \"onPlugInError\" handler.");}
if(false===xmp.isDefined(this.p_defaultEventListener.onUnsupportedPlatformError)){throw new xmp.MediaPlayerError("Invalid media player event listener.  Missing \"onUnsupportedPlatformError\" handler.");}};xmp.MediaPlayer.prototype.p_checkTimeLimit=function(Bm,Cm){this.p_validateTimeLimit(this.p_node);var Dm=this.p_node.getTimeLimitInSeconds();if(Dm!==xmp.NO_TIME_LIMIT&&Bm>=Dm){this.p_state.i_ended(this);this.p_notifyStateChange(xmp.ENDED,null);}};xmp.MediaPlayer.prototype.p_notifyTimelineChange=function(Em,Fm){for(var i=0;i<this.p_listeners.length;i++){this.p_listeners[i].i_onTimelineChange(this.p_node,Em,Fm);}};xmp.MediaPlayer.prototype.p_notifyStateChange=function(Gm,Hm){for(var i=0;i<this.p_listeners.length;i++){this.p_listeners[i].onStateChange(this.p_node,Gm,Hm);}};xmp.MediaPlayer.prototype.onError=function(Im,e){this.p_node=Im;this.p_handleError(e);};xmp.MediaPlayer.prototype.i_onPlugInError=function(e){this.p_error();this.p_listeners[0].onPlugInError(e);};xmp.MediaPlayer.prototype.i_onUnsupportedPlatformError=function(e){this.p_error();this.p_listeners[0].onUnsupportedPlatformError(e);};xmp.MediaPlayer.prototype.i_changeState=function(Jm,Km){var Lm=this.p_registry.i_findMode(Jm);Lm.i_transition(this,Km,this.p_state);this.p_logger.debug("Changed/transitioned to \""+Lm.i_getName()+"\" mode.");this.p_state=Lm;};xmp.MediaPlayer.prototype.i_getPlayer=function(){return this.p_player;};xmp.MediaPlayer.prototype.p_validateTimeLimit=function(Mm){var Nm=Mm.getTimeLimitInSeconds();if(false===xmp.isDefined(Nm)){throw new xmp.InvalidPlayableNodeError("Invalid playable node.  Missing time limit.");}
if(Nm!==xmp.NO_TIME_LIMIT&&Nm<=0){throw new xmp.InvalidPlayableNodeError("Invalid playable node.  Invalid time limit \""+Nm+"\". Expected values are "+xmp.NO_TIME_LIMIT+" and greater than 1 seconds.");}};xmp.MediaPlayer.prototype.i_getName=function(){return this.p_name;};xmp.MediaPlayer.prototype.p_error=function(){this.p_viewManager.hideOverlays(xmp.ALL_OVERLAYS);this.p_bandwidthRecorder.i_stop();this.p_state.i_error(this);this.p_setNullPlayer();};xmp.MediaPlayer.prototype.p_close=function(){this.p_bandwidthRecorder.i_stop();this.p_state.i_close(this);};xmp.MediaPlayer.prototype.p_handleNativePlayerReady=function(Om){this.p_urlStrategy.buildUrlAsynch(Om,new xmp.util.Callback('buildUrlAsynch',this.p_handleBuildUrlAsynch,this));};xmp.MediaPlayer.prototype.p_handleBuildUrlAsynch=function(Pm,Qm,Rm){if(this.p_state.i_getType()===xmp.ERRORS){return;}
if(Rm!==null){if(Rm instanceof xmp.PlugInError){this.i_onPlugInError(Rm);}
else{this.onError(Qm,Rm);xmp.handleFatalError(Rm);}
return;}
this.p_state.i_open(this,Qm);};xmp.MediaPlayerFactory=function(){};xmp.MediaPlayerFactory.createPlayer=function(Sm,Tm){return new xmp.MediaPlayer(Sm,Tm);};
