function AkaHTML5MediaAnalytics(bT){var cs="$Id: //projects/agents/analytics-player-html5-plugin-2.3/akamai/analytics-player-html5-plugin/akamaihtml5.js#15 $";function G(){return(((1+Math.random())*65536)|0).toString(16).substring(1)}function cv(){return(G()+G()+"-"+G()+"-"+G()+"-"+G()+"-"+G()+G()+G())}var bd=bd||function(cD,cB){var cE={},cG=cE.lib={},cx=cG.Base=function(){function i(){}return{extend:function(cI){i.prototype=this;var cJ=new i;cI&&cJ.mixIn(cI);cJ.$super=this;return cJ},create:function(){var cI=this.extend();cI.init.apply(cI,arguments);return cI},init:function(){},mixIn:function(cI){for(var cJ in cI){cI.hasOwnProperty(cJ)&&(this[cJ]=cI[cJ])}cI.hasOwnProperty("toString")&&(this.toString=cI.toString)},clone:function(){return this.$super.extend(this)}}}(),cy=cG.WordArray=cx.extend({init:function(i,cI){i=this.words=i||[];this.sigBytes=cI!=cB?cI:4*i.length},toString:function(i){return(i||cF).stringify(this)},concat:function(cI){var cJ=this.words,cL=cI.words,cK=this.sigBytes,cI=cI.sigBytes;this.clamp();if(cK%4){for(var i=0;i>>2]|=(cL[i>>>2]>>>24-8*(i%4)&255)<<24-8*((cK+i)%4)}}else{if(65535>>2]=cL[i>>>2]}}else{cJ.push.apply(cJ,cL)}}this.sigBytes+=cI;return this},clamp:function(){var i=this.words,cI=this.sigBytes;i[cI>>>2]&=4294967295<<32-8*(cI%4);i.length=cD.ceil(cI/4)},clone:function(){var i=cx.clone.call(this);i.words=this.words.slice(0);return i},random:function(i){for(var cI=[],cJ=0;cJ>>2]>>>24-8*(i%4)&255;cL.push((cK>>>4).toString(16));cL.push((cK&15).toString(16))}return cL.join("")},parse:function(cI){for(var cJ=cI.length,cK=[],i=0;i>>3]|=parseInt(cI.substr(i,2),16)<<24-4*(i%8)}return cy.create(cK,cJ/2)}},cA=e.Latin1={stringify:function(cI){for(var cJ=cI.words,cI=cI.sigBytes,i=[],cK=0;cK>>2]>>>24-8*(cK%4)&255))}return i.join("")},parse:function(cI){for(var i=cI.length,cK=[],cJ=0;cJ>>2]|=(cI.charCodeAt(cJ)&255)<<24-8*(cJ%4)}return cy.create(cK,i)}},cz=e.Utf8={stringify:function(cI){try{return decodeURIComponent(escape(cA.stringify(cI)))}catch(i){throw Error("Malformed UTF-8 data")}},parse:function(i){return cA.parse(unescape(encodeURIComponent(i)))}},cC=cG.BufferedBlockAlgorithm=cx.extend({reset:function(){this._data=cy.create();this._nDataBytes=0},_append:function(i){"string"==typeof i&&(i=cz.parse(i));this._data.concat(i);this._nDataBytes+=i.sigBytes},_process:function(cI){var i=this._data,cN=i.words,cM=i.sigBytes,cJ=this.blockSize,cK=cM/(4*cJ),cK=cI?cD.ceil(cK):cD.max((cK|0)-this._minBufferSize,0),cI=cK*cJ,cM=cD.min(4*cI,cM);if(cI){for(var cL=0;cLcG;cG++){if(16>cG){cx[cG]=cF[i+cG]|0}else{var cI=cx[cG-3]^cx[cG-8]^cx[cG-14]^cx[cG-16];cx[cG]=cI<<1|cI>>>31}cI=(cC<<5|cC>>>27)+cJ+cx[cG];cI=20>cG?cI+((cB&cD|~cB&cE)+1518500249):40>cG?cI+((cB^cD^cE)+1859775393):60>cG?cI+((cB&cD|cB&cE|cD&cE)-1894007588):cI+((cB^cD^cE)-899497514);cJ=cE;cE=cD;cD=cB<<30|cB>>>2;cB=cC;cC=cI}cH[0]=cH[0]+cC|0;cH[1]=cH[1]+cB|0;cH[2]=cH[2]+cD|0;cH[3]=cH[3]+cE|0;cH[4]=cH[4]+cJ|0},_doFinalize:function(){var i=this._data,cC=i.words,cD=8*this._nDataBytes,cB=8*i.sigBytes;cC[cB>>>5]|=128<<24-cB%32;cC[(cB+64>>>9<<4)+15]=cD;i.sigBytes=4*cC.length;this._process()}});cz.SHA1=cy._createHelper(e);cz.HmacSHA1=cy._createHmacHelper(e)})();(function(){var cx=bd,e=cx.enc.Utf8;cx.algo.HMAC=cx.lib.Base.extend({init:function(cD,cF){cD=this._hasher=cD.create();"string"==typeof cF&&(cF=e.parse(cF));var cC=cD.blockSize,cy=4*cC;cF.sigBytes>cy&&(cF=cD.finalize(cF));for(var i=this._oKey=cF.clone(),cE=this._iKey=cF.clone(),cA=i.words,cz=cE.words,cB=0;cBthis.initWaitPenalty+cx){e=this.startWaitPenalty}else{e=this.initWaitPenalty+cx}return e};this.penalizedWaitTime=function(cy,cz,cB){var cx=0;var i=(cy+this.rebufferReductionFactor)/this.rebufferReductionFactor;var cC=(cz+this.rebufferReductionFactor)/this.rebufferReductionFactor;try{if(cy>=0&&cz>cy){cx=(this.initWaitPenalty-1)*(cz-cy);if(cB){this.initWaitPenalty+=Math.log(cC)}cx+=((cC*Math.log(cC))-cC-(i*Math.log(i))+i)}}catch(cA){bl("exception in penalizedWaitTime"+cA)}return cx};this.agingArea=function(cy,i,cx){if(cx==0){return 0}try{return(Math.exp(i/cx)-Math.exp(cy/cx))}catch(cz){bl("exception in aging area "+cz);return 0}};this.getStartupPatienceBits=function(e){var cA=0;var cx=0;var cz=this.bitrateReductionFactor;var i=0;var cy=0;while(e>0){cx+=100;if(i==0){i=this.startupBitrate*cz}else{if((cx%500==0)||(cx>=1700)){i=i*cz}}if(i>1){cA+=Math.log(i)*((e>100)?100:e)}else{break}if(cx%1000==0){cz-=this.bitrateReductionDecrement}e-=100}return cA};this.getStartupTVBits=function(i){var e=i*Math.log(this.startupBitrate);return e};this.currSubSessionQuality=function(cz){try{var cI;var cH=0;var cJ=0;var cL=this.qoeEventsArray.length;var cA=this.qoeEventsArray[0].startTime;var cK=this.qoeEventsArray[cL-1].endTime;var cB=0;var cE=0;var cD=0;var cG=0;for(var cC=0;cC0){cC=(cz*100/cB).toFixed(3);return cC}else{return(100*this.bitrateReductionFactor).toFixed(3)}}for(var cA=0;cA";e+="Please refer 'Set Custom Data' section in Integration guide for more details.";bl(e,"INTEGRATION")}}function m(cy,cL,cx,cG){try{if(cy==4&&cL==200&&cx){var cE=cx.documentElement;if(cE){var cF=document.getElementsByTagName("script");var cM=0;var cH=false;var cB="";var cJ="";if(typeof(akamaiBCVideoObject)!="undefined"){if(bi){cH=true;cJ=bi}}else{if(cF.length){for(cM=0;cM";cK+="Kindly refer the Integration Guide and use the correct plugin path for integration";cK+="The plugin path should be one of the below :";if(typeof(akamaiBCVideoObject)!="undefined"){cK+="- http://79423.analytics.edgesuite.net/html5/brightcoveAkamaihtml5-min.js
";cK+="- https://79423.analytics.edgekey.net/html5/brightcoveAkamaihtml5-min.js
"}else{cK+="- http://79423.analytics.edgesuite.net/html5/akamaihtml5-min.js
";cK+="- https://79423.analytics.edgekey.net/html5/akamaihtml5-min.js
"}cK+="";bl(cK,"ERROR")}if(cA==bt){bl("Plugin is Latest (Version = "+cA+" )","INTEGRATION")}else{cK="Old Plugin Version";cK+="";cK+="- Current Plugin Version is "+bt+"
";cK+="- The latest plugin version in "+cA+" which was released on date "+cC+"
";cK+="- Kindly check if proper path mentioned in integration guide is used for integration
";cK+="- If proper path is used, try by clearing browser cache.
";bl(cK,"ERROR")}}}}}catch(cN){}}var aA=parseInt(H("beaconSentNotify",window.AKAMAI_MEDIA_ANALYTICS_CONFIG_FILE_PATH));function bQ(cy,i,e){var cx;if(U){cx=new XDomainRequest();cx.onload=function(){bl("XML Request : xmlClient.onload");cy("4","200",cx.responseText)};cx.onerror=function(cz){bl("Error in ais request")};cx.open("GET",i,e);cx.send(null)}else{cx=new XMLHttpRequest();cx.responseType="json";cx.open("GET",i,e);if(cx.overrideMimeType){cx.overrideMimeType("application/json")}cx.onreadystatechange=function(){cy(cx.readyState,cx.status,cx.responseText)};cx.send(null)}}function au(cz,cx,i){bl("XML Request: isXDomainRequest = "+U+":::funcCallback = :url: "+cx);var cy;if(cx==null||cx=="undefined"||cx==""){return}try{if(U){cy=new XDomainRequest();cy.onload=function(){bl("XML Request : xmlClient.onload");if(window.DOMParser){var cB=new DOMParser();var e=cB.parseFromString(cy.responseText,"text/xml");cz("4","200",e,cy.responseText)}};cy.onerror=function(cB){bl("XML Request : Error in loading xml. url = :"+cx);if(cx.indexOf("serverIp")!=-1){Y=true}if(cx.indexOf("protocol-info")!=-1){c.fastTCPFailed=true}};cy.open("GET",cx,i);cy.send(null)}else{cy=new XMLHttpRequest();cy.open("GET",cx,i);if(cy.overrideMimeType){cy.overrideMimeType("text/xml")}cy.onreadystatechange=function(){bl("XML Request : xmlClient.onreadystatechange");cz(cy.readyState,cy.status,cy.responseXML,cy.responseText)};cy.send(null)}}catch(cA){bl("exception in XML Request for url :"+cx+",Exception:"+cA)}}function ao(cA,cR,cy,cL){bl("readConfig: readyState = "+cA+":::status = "+cR);try{if(cA==4&&cR==200&&cy){var cG=cy.documentElement;var cV=cG.getElementsByTagName("dataMetrics");for(var cO=0;cOo.isSessionWithRebufferLimit){cx.isSessionWithRebuffer=1}if(cx.rebufferSession){cx.rebufferSession=cx.rebufferSession+";"+cz+":"+cA}else{cx.rebufferSession=cz+":"+cA}}catch(cy){bl("Error in set RebufferSession"+cy.message)}}function bY(cD,cx){var cA;var cC;if(cx=="B"){var cy="";if(cD.rebufferSession){var e=cD.rebufferSession.split(";");for(var cz=0;cz0){cA=cD.firstRebufferStartEpoch-cD.lastRebufferEndEpoch}else{cA=-1}}cD.rebufferSession=cC+":"+cA+";"+cD.rebufferSession;cD.lastRebufferEndEpoch=cD.currRebufferEndEpoch}function bM(cA,cz){bl("get rebufferSessionH line");var cx=1;cA.rebufferSessionH=null;if(!cA.rebufferSessionArrayHLine||((cA.rebufferSessionArrayHLine)&&(cA.rebufferSessionArrayHLine.length===0))){return}while(cA.rebufferSessionArrayHLine[cx]&&((cz-cA.rebufferSessionArrayHLine[cx])>(2*o.heartBeatInterval))){cA.rebufferSessionArrayHLine.shift();cA.rebufferSessionArrayHLine.shift();if(cA.isSessionWithRebufferH==1){cA.sendIsSessionWithRebufferH=0;cA.isSessionWithRebufferH=null}}while(cA.rebufferSessionArrayHLine[cx]){var e=cz-cA.rebufferSessionArrayHLine[cx-1];var cy=cA.rebufferSessionArrayHLine[cx]-cA.rebufferSessionArrayHLine[cx-1];if(cA.sendIsSessionWithRebufferH==1){if(cy>o.isSessionWithRebufferLimit){cA.isSessionWithRebufferH=1}}if(cA.rebufferSessionH){cA.rebufferSessionH=cA.rebufferSessionH+";"+e+":"+cy}else{cA.rebufferSessionH=e+":"+cy}cx=cx+2}cx=cx-1;if(cA.rebufferSessionArrayHLine[cx]){var e=cz-cA.rebufferSessionArrayHLine[cx];if(cA.sendIsSessionWithRebufferH==1){if(e>o.isSessionWithRebufferLimit){cA.isSessionWithRebufferH=1}}if(cA.rebufferSessionH){cA.rebufferSessionH=cA.rebufferSessionH+";"+e+":"+e}else{cA.rebufferSessionH=e+":"+e}}}function bV(e){if(aY.deliveryType){return aY.deliveryType}else{return e.deliveryType}}function bF(e,i,cz,cy){bl("readServerIp: this.status = "+i);if(parseInt(i/100)===4||i===0){bl("readServerIp: serverIpFailed request falied as status is in 400 series");Y=true}if(e==4&&i==200&&cz){var cx=cz.documentElement;bU.serverip=cx.getElementsByTagName("serverip")[0].childNodes[0].nodeValue;bl("readServerIp : diagnostics.serverip = "+bU.serverip)}}function af(e){var cy=e.akamai;if(Y){bl("getting ServerIp : serverIp request failed");return}if(cy.hostName){try{var cx=cy.protocol+"://"+cy.hostName+"/serverIp";bl("getting ServerIp : serverIpPath = "+cx);au(bF,cx,true)}catch(i){Y=true;bl("getting ServerIp: error in xmphttprequest")}}}function ae(cy,cx,cD,cB){bl("readFastTCP: this.status = "+cx);var i="";if(parseInt(cx/100)===4||cx===0){bl("read fast tcp: fast tcp Failed request falied as status is in 400 series");c.fastTCPFailed=true}try{if(cy==4&&cx==200&&cD){bl("populating fast tcp");var cE=cD.documentElement;if(cE&&cE.firstElementChild){var e=cE.firstElementChild;var cz="";var cC="";if(e){if(e.hasAttribute("key")){cC=e.getAttribute("key");cz=e.childNodes[0].nodeValue;i=cC+":"+cz}while(e.nextElementSibling){e=e.nextElementSibling;if(e.hasAttribute("key")){cC=e.getAttribute("key");cz=e.childNodes[0].nodeValue;if(i){i+=","+cC+":"+cz}else{i=cC+":"+cz}}}}}}if(i){c.ftcp=i}}catch(cA){bl("Exception in read fast tcp"+cA)}}function bN(e){var cy=e.akamai;if(c.fastTCPFailed){bl("getting fast tcp: request failed");return}if(cy.hostName){try{var cx=cy.protocol+"://"+cy.hostName+"/protocol-info";bl("getting fast tcp : fastTCPPath = "+cx);au(ae,cx,true)}catch(i){c.fastTCPFailed=true;bl("getting ServerIp: error in xmphttprequest")}}}function aH(e){var i=e.akamai;if(!Y){af(e)}if(!c.fastTCPFailed&&c.fastTCPEnabled){bN(e)}if(Y&&c.fastTCPFailed){window.clearInterval(i.fastTCPServerIpTimer)}}function a0(e){var i=null;if(e.isObjectBasedVideo){if(e.errorReason){i=e.errorReason}else{i=bG[0]}}else{if(e.error&&e.error.code){i=bG[e.error.code]}else{i=bG[0]}}return i}function ad(i){var e="Play.End.Detected";if(i.isObjectBasedVideo){if(i.endReason){e=i.endReason}}return e}function z(){bH.viewerId=aY.viewerId?aY.viewerId:null;bH.viewerDiagnosticsId=aY.viewerDiagnosticsId?aY.viewerDiagnosticsId:(aY.viewerId?aY.viewerId:null)}function d(i){var e=cv();return e}function aR(cx){var cz=bH.viewerId;if(cz=="-"){return}if(!cz){try{if(window.localStorage.getItem("akamai_clientId")){cz=window.localStorage.getItem("akamai_clientId")}else{if(B("HTML_ViewerId")){cz=B("HTML_ViewerId")}else{try{cz=cv();window.localStorage.setItem("akamai_clientId",cz);try{a3("HTML_ViewerId",cz)}catch(cy){}}catch(i){bl("window.localStorage exception :"+i)}}}}catch(cy){bl("Exception in getting viewerId"+cy);cz=cv()}}return cz}function bx(cB,cy){var cA=null;if(bH&&bH.viewerDiagnosticsId){cA=bH.viewerDiagnosticsId}var i="";var cz=50;var e=16*2;if(!cA||cA=="-"){return}if(cy&&cB.xViewerId){return}aO(cB);bl("get Viewer DiagnosticsID");cA=encodeURIComponent(cA);if(aF&&aF.viewerDiagnostics&&aF.viewerDiagnostics.salt&&aF.viewerDiagnostics.salt.value){i=aF.viewerDiagnostics.salt.value}if(aF&&aF.viewerDiagnostics&&aF.viewerDiagnostics.salt&&aF.viewerDiagnostics.salt.iterations){cz=aF.viewerDiagnostics.salt.iterations}if(aF&&aF.viewerDiagnostics&&aF.viewerDiagnostics.salt&&aF.viewerDiagnostics.salt.bytes){e=aF.viewerDiagnostics.salt.bytes}var cx=bd.PBKDF2(cA,i,{keySize:e/8,iterations:cz});cB.xViewerId=cx;bH.xViewerId=cx}function aO(i){var e=null;if(aF&&aF.viewerDiagnostics&&aF.viewerDiagnostics.salt&&aF.viewerDiagnostics.salt.version){e=aF.viewerDiagnostics.salt.version}i.xViewerIdVersion=e;bH.xViewerIdVersion=e}function ce(cx,cy,i){var e;if(cy=="viewerId"||cy=="clientId"||cy=="viewerDiagnosticsId"){return}if(i){if(aY[i]){e=aY[i]}else{if(cx[i]){e=cx[i]}}}cx[cy]=e}this.getValueFromQueryString=function(){return H(key,searchURL)};function H(cx,cB,cz){if(cz==null){cz=""}cx=cx.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var cy=new RegExp("[\\?&]"+cx+"=([^]*)");try{var i=cy.exec(cB);if(i==null){return cz}else{return i[1]}}catch(cA){bl("Exception in getValueFromQueryString :"+cA);return cz}}function bp(e){var i=e.akamai;window.clearInterval(i.fastTCPServerIpTimer);i.fastTCPServerIpTimer=window.setInterval(function(){aH(e)},o.logInterval);aH(e)}function x(e){bl("startBeaconTImer");var i=e.akamai;if(i.areTimerStarted){return}bl("startBeaconTimer: starting beacon timer");i.firstPLineTimer=window.setTimeout(function(){cp(e)},o.secondaryLogTime);i.hLineTimer=window.setInterval(function(){cj(e)},o.heartBeatInterval);i.fastTCPServerIpTimer=window.setInterval(function(){bp(e)},(o.logInterval-5000));if(e.isObjectBasedVideo){I=500}i.pollingTimer=window.setInterval(function(){b3(e)},I);i.areTimerStarted=true}function bf(e){var i=e.akamai;if(i){if(i.hLineTimer){window.clearInterval(i.hLineTimer)}if(i.pollingTimer){window.clearInterval(i.pollingTimer)}if(i.fastTCPServerIpTimer){window.clearInterval(i.fastTCPServerIpTimer)}if(i.firstPLineTimer){window.clearTimeout(i.firstPLineTimer)}if(bA&&bA.retryTimer){window.clearTimeout(bA.retryTimer)}}}function cn(i){var cy=i.akamai;a7.akamai={};a7.dataSent={};cy.areTimerStarted=false;cy.isCLineSent=false;cy.isELineSent=false;cy.lastRebufferEndEpoch=0;cy.connectTime=0;cy.totalPlayClockTime=cy.totalStreamTime=cy.totalRebufferCount=cy.totalRebufferTime=0;cy.isVisitEnd=0;cy.sequenceId="0";cy.attemptId=cy.sessionId=d(cy);z();cy.clientId=cy.viewerId=aR(cy);if(aF.viewerDiagnosticsEnabled){bx(cy)}else{}cy.lastPLineSentTime=cy.hLineSentCount=cy.lastSLineSentTime=cy.lastHLineSentTime=0;cy.lastHTime=0;T("HTML_LastCLineTime");bn=[0,0,0,0,0,0,0,0,0,0,0,0,0];var cz=parseInt(B("HTML_VisitCountCookie"));if(!cz||cz==""){cy.isVisitStart=1;cz=0;a3("HTML_VisitCountCookie",cz)}var cA=parseInt(B("HTML_isPlayingCount"));if(!cA||cA==""){cA=0;a3("HTML_isPlayingCount",cA)}var e=B("HTML_VisitValueCookie");if(!e||e==""){a3("HTML_VisitValueCookie","0|0|0|0|0|0|0|0|0|0|0|0|0")}var cx=B(bI);if(!cx||cx==""){cy.browserSessionId=cy.visitId=cv();a3(bI,cy.visitId)}else{cy.browserSessionId=cy.visitId=B(bI)}}function D(e){var cx=e.akamai;cx.isILineSent=true;++cx.iLineCount;cx.lastSLineSentTime=by();if(cx.iLineCount==1){var cy=parseInt(B("HTML_VisitCountCookie"));++cy;a3("HTML_VisitCountCookie",cy);f=by()}var i=parseInt(B("HTML_VisitIntervalStartTime"));if(!i||i==" "){i=by();a3("HTML_VisitIntervalStartTime",i)}cu[0]="visitAttempts";bn[0]=1;cx.sendVLine=true}function am(cz){if(aB!=null&&aB.akamai&&aB.akamai.clearVisitTimeoutId){window.clearTimeout(aB.akamai.clearVisitTimeoutId)}cn(v);var cy=v.akamai;var cx=by();cy.logInterval="0";if(!bX){var i=ca(cy);var e={element:i,code:"init",synch:cz};cc.push(e)}else{bv(cy,"init",cz)}cy.lastLogTime=cx;++cy.sequenceId;D(v);cy.currentState.state=bW.init;bl(by()+": sendBeaconILineAd : Setting state to init");cy.currentState.timeUpdateClockTime=by()}function cp(e){var i=e.akamai;i.lastPLineSentTime=by();t(e,"playing",false)}function u(cy,cx,cA,i){bl("start of the session function");var cz=cy.akamai;if(!cz||!cz.firstTimePlay){return}if(!cz.connectTime){if(cx>0){cz.connectTime=cx}else{cz.connectTime=0}cz.bufferingTime=0}else{cz.bufferingTime=cx}cz.startupTime=cz.bufferingTime+cz.connectTime;cz.bufferingTime=cz.startupTime;cz.connectTime=0;if(cz.startupTime>o.startupTimeOutlierLimit){cz.outlierStartupTime=cz.startupTime;cz.startupTime=0;cz.bufferingTime=0}var e={type:"startup",startTime:0,endTime:cz.startupTime};if(bq&&bq.qoeEventsArray){bq.qoeEventsArray.push(e)}bq.totalQoeTime+=cz.startupTime;if(!cz.isURLParsed){var cB=A(cy);p(cB,cz);cz.streamUrl=cB}cz.played=[];var cC=parseInt(B("HTML_isPlayingCount"));cC=cC+1;a3("HTML_isPlayingCount",cC);z();if(aF.viewerDiagnosticsEnabled){bx(cz,true)}cz.lastSLineSentTime=by();t(cy,"playStart",false);aV(cz);cz.rebufferSessionArrayHLine=new Array();cz.isSLineSent=true;if(bX){x(cy)}cu[1]="visitPlays";bn[1]=1;cz.isFirstTitle=null;cz.isVisitStart=null;cz.firstTimePlay=false;cz.initPlayed(i)}function ch(e,cx){bl("send beacon I line");var i=e.akamai;var cy=A(e);if(cy!=null&&cy!=""){p(cy,i);i.streamUrl=cy}bq=new ap();bq.sessionStartTime=by();i.cdn=aE(i);aH(e);if(e.videoWidth&&e.videoHeight){i.videoSize=e.videoWidth+"x"+e.videoHeight}if(typeof(v)!="undefined"&&v.akamai&&v.akamai.isILineSent){i=ca(v.akamai,i);delete v.akamai}else{cn(e);t(e,"init",cx);D(e);if(e.akamai.clearVisitTimeoutId){window.clearTimeout(e.akamai.clearVisitTimeoutId)}}}function cj(e){var i=e.akamai;t(e,"heartBeat",false);i.lastHLineSentTime=by();i.hLineSentCount++;if((i.hLineSentCount%(o.logInterval/o.heartBeatInterval))==0){t(e,"playing",false);i.lastPLineSentTime=by()}}function bj(e,cy,cx){bl("sendBeaconCLine : endReasonCode = "+cy);var i=e.akamai;i.endReasonCode=cy;t(e,"complete",cx);var cA=parseInt(B("HTML_isPlayingCount"));cA=cA-1;a3("HTML_isPlayingCount",cA);i.isVisitStart=null;i.isCLineSent=true;i.firstTimePlay=true;bf(e);var cz=by();a3("HTML_LastCLineTime",cz)}function g(e,cz,cx){var i=e.akamai;if(cz){i.errorCode=cz}else{i.errorCode="UNKNOWN"}bl("sendBeaconELine : errorCode = "+i.errorCode);cu[3]="visitErrors";bn[3]=1;if(i.sequenceId==1){cu[11]="visitStartupErrors";bn[11]=1;z();if(aF.viewerDiagnosticsEnabled){bx(i,true)}}i.playerState="E";t(e,"error",cx);if(i.isSLineSent){var cA=parseInt(B("HTML_isPlayingCount"));cA=cA-1;a3("HTML_isPlayingCount",cA)}i.isELineSent=true;i.isVisitStart=null;i.firstTimePlay=true;bf(e);var cy=by();bK(i);a3("HTML_LastCLineTime",cy)}function aj(e){bl("sendBeaconVLine");var cz=e.akamai;cz.isVisitEnd=1;cz.visitPlays=parseInt(q("visitPlays"));cz.visitAttempts=parseInt(q("visitAttempts"));cz.visitViews=parseInt(q("visitViews"));cz.visitErrors=parseInt(q("visitErrors"));cz.visitUniqueTitles=parseInt(q("visitUniqueTitles"));var i=parseInt(B("HTML_VisitIntervalStartTime"));var cy=by();cz.visitInterval=cy-i;if(i==""||i==null||isNaN(i)){cz.visitInterval=cy-f}cz.visitPlayClockTime=parseInt(q("visitPlayClockTime"));cz.visitPlayStreamTime=parseInt(q("visitPlayStreamTime"));cz.visitRebufferCount=parseInt(q("visitRebufferCount"));cz.visitRebufferTime=parseInt(q("visitRebufferTime"));cz.visitAdPlayClockTime=parseInt(q("visitAdPlayClockTime"));cz.visitAdStartCount=parseInt(q("visitAdStartCount"));cz.visitAdAbandonCount=parseInt(q("visitAdAbandonCount"));cz.visitStartupErrors=parseInt(q("visitStartupErrors"));cz.sessionId=null;cz.attemptId=null;cz.sequenceId=null;T("HTML_VisitValueCookie");T("HTML_VisitIntervalStartTime");T("HTML_LastCLineTime");T("HTML_VisitCountCookie");T("HTML_isPlayingCount");T("HTML_VisitUniqueTitles");br="";T(bI);t(e,"visit",true);a7.akamai={};a7.dataSent={};bl("sendBeaconVLine: beacon sent");cz.sendVLine=false;cz.iLineCount=0;window.clearTimeout(e.akamai.clearVisitTimeoutId);if(typeof(akamaiBCVideoObject)!="undefined"){var cx;if(v&&v.akamai){cx=v.akamai.isPlaylist;v.akamai=new aT(v);v.akamai.isPlaylist=cx}if(aB&&aB.akamai){cx=aB.akamai.isPlaylist;aB.akamai=new aT(aB);aB.akamai.isPlaylist=cx}}else{if(v&&v.akamai){v.akamai=new aT(v)}if(aB&&aB.akamai){aB.akamai=new aT(aB)}}}function aV(i){var e="|";if(i.title){if(i.title=="-"||i.title=="unknown"){e+=encodeURIComponent("unknown_title")+"|"}else{e+=encodeURIComponent(i.title)+"|"}}else{e+=encodeURIComponent("unknown_title")+"|"}var cx=B("HTML_VisitUniqueTitles");if(!cx||cx==""){if(br==""||!br){a3("HTML_VisitUniqueTitles",e);br=e;cu[12]="visitUniqueTitles";bn[12]=1}else{if(br.indexOf(e)==-1){br=br+e;a3("HTML_VisitUniqueTitles",e);cu[12]="visitUniqueTitles";bn[12]=1}}}else{if(cx.indexOf(e)==-1){e=cx+e;a3("HTML_VisitUniqueTitles",e);cu[12]="visitUniqueTitles";bn[12]=1}}}function X(){var e=B("HTML_VisitValueCookie");var cA=e.split("|");var cB;for(var cy=0;cy5000){bn[2]=1}X()}function q(i){var e=B("HTML_VisitValueCookie");var cx=e.split("|");var cz=true;if(cx==""||cx==null){cz=false}var cy;switch(i){case"visitAttempts":return(cz?cx[0]:C[0]);break;case"visitPlays":return(cz?cx[1]:C[1]);break;case"visitViews":return(cz?cx[2]:C[2]);break;case"visitErrors":return(cz?cx[3]:C[3]);break;case"visitPlayClockTime":return(cz?cx[4]:C[4]);break;case"visitPlayStreamTime":return(cz?cx[5]:C[5]);break;case"visitRebufferCount":return(cz?cx[6]:C[6]);break;case"visitRebufferTime":return(cz?cx[7]:C[7]);break;case"visitAdPlayClockTime":return(cz?cx[8]:C[8]);break;case"visitAdStartCount":return(cz?cx[9]:C[9]);break;case"visitAdAbandonCount":return(cz?cx[10]:C[10]);break;case"visitStartupErrors":return(cz?cx[11]:C[11]);break;case"visitUniqueTitles":return(cz?cx[12]:C[12]);break}}function a4(cy){try{var i=encodeURI(cy);i=i.replace(/#/g,"%23");return i}catch(cx){bl("Exception in encoding beacon");return cy}}function ax(cB,cA,cz){if(bB==0){bl("put beacon On Wire, dont send beacon isACtive is zero");return}var cx=o.beaconUrl+"?"+cB;bl(cx,"BEACON");try{var e;if(U){e=new window.XDomainRequest()}else{e=new XMLHttpRequest()}e.open("GET",cx,!cA);e.send()}catch(cy){bl("failed to send beacon");bl(cy)}if(aA==1){try{var i=document.createEvent("Events");i.data=cx;i.initEvent("beaconSentNotify",true,false);aB.dispatchEvent(i)}catch(cy){bl("Exception in dispatching akamaiBeaconSent"+cy)}}}function b9(i,cx){try{i=i.substring(0,cx);return i}catch(cy){bl("exception in getTruncatedMetric"+cy);return i}}function cq(cz,cx,e,cy){for(itr in cx){bC=cx[itr].name;var i=null;if(bC in cz){i=cz[bC]}if(cx[itr].value){i=cx[itr].value}if(i||i==0){if(cx[itr].sendOnce){if(cx[itr].isSent===false){if(i!=0){cx[itr].isSent=true}h(i,cx,bC,itr,cy,e)}}else{h(i,cx,bC,itr,cy,e)}}}}function h(cD,cE,cy,cA,cx,cB){try{if(cE[cA].regExp){var cF=new RegExp(cE[cA].regExp);var cz=cF.exec(cD);if(cz){cD=cz[1]}}}catch(cC){bl("Exception in evaluating regExp attribute for metric : "+cy)}cD=String(cD).replace(/~/g,o.encodedParamSeparator);if(cE[cA].size){cD=b9(cD,cE[cA].size)}if(cE[cA].key in cx){}else{cx[cE[cA].key]=cE[cA].key;cB.push((o.useKey?cE[cA].key:cy)+"="+cD)}}function bv(cG,cC,cB){bl("getBeaconStrings : eventCode = "+cC);var cz=be.common;var cT=[];var cF=be[cC];var cM=[];var cS={};if(!cG.eventCode){cG.eventCode=ag[cC]}cq(cG,cz,cT,cS);if(cC=="error"){cG.updateTerminateMetrics();cG.updateAdTerminateMetrics();bJ(cG,cu,bn)}if(cC=="complete"){cG.updateTerminateMetrics();cG.updateAdTerminateMetrics();var cx=be.playing;bJ(cG,cu,bn);cq(cG,cx,cM,cS)}cq(cG,cF,cM,cS);var cK=cT.join(o.urlParamSeparator);cK=a4(cK);var cL=be.split;var cR=0;for(cQ in cL){if(o.useKey){cR+=cL[cQ].key.length+3+o.urlParamSeparator.length}else{cR+=cQ.length+3+o.urlParamSeparator.length}}cR--;var cE=o.maxLogLineLength-cR-cK.length-3-o.beaconUrl.length;var cN=[];var cO=[];var cI="";if(cE>0){if(cM.length>0){var cP;for(cP=0;cPcE){cM[cP]=a4(cM[cP]);cO.push(cM[cP])}else{cM[cP]=a4(cM[cP]);cN.push(cM[cP])}}cI=cK+o.urlParamSeparator+cN.join(o.urlParamSeparator)}else{cI=cK}if(((cI.length+o.beaconUrl.length+1)>o.maxLogLineLength)||(cO.length>0)){var cA="";var e=0;var cy=0;var cQ=0;while(cQ5000){cB.isView=1}if(cy){cB.currentState.lastEventClockTime=cz}if(cB.played){var e=cB.played;cB.playStreamTime=0;for(var cA=0;cA0){cy.lastHTime=(cx-cy.lastHLineSentTime)/1000}else{cy.lastHTime=(cx-cy.lastSLineSentTime)/1000}if(cz=="heartBeat"){var cD=cy.logInterval;cy.logInterval=(cx-cy.lastPLineSentTime)/1000;bM(cy,cx)}if(cy.logInterval<0){cy.logInterval="0"}var i=false;if(cz=="complete"){cz="playing";i=true}cy.endOfStream=cB.ended?"1":"0";cy.currentClockTime=cx-cy.startTimer;cy.currentStreamTime=parseInt(ay(cB));if(cz=="playStart"){if(bq&&bq.getQoeMetric){bq.startupTime=cy.startupTime;cy.qualityOfExperience=bq.getQoeMetric("playStart")}}if(cz=="error"){if(bq&&bq.getQoeMetric){cy.qualityOfExperience=bq.getQoeMetric("error")}}if(cz=="playing"&&!cy.playEndMetricsUpdated){if(i){bM(cy,cx)}bl("send Beacon, updating play and end metrics");aW(cB,cE,cx,i)}if(!cy.customDataPopulated){bo(cy)}if(!bX){var cC=ca(cy);var e={element:cC,code:(i)?"complete":cz,synch:cA};cc.push(e);if(cz!="heartBeat"){bl("send beacon :configurationPopulated false sequenceId = "+cy.sequenceId);++cy.sequenceId;cy.lastLogTime=cx}else{cy.logInterval=cD}return}if(cz=="playStart"){aN()}cy.populateMetricsFromConfiguration();cy.xViewerId=bH.xViewerId;cy.xViewerIdVersion=bH.xViewerIdVersion;if(i){bv(cy,"complete",cA)}else{bv(cy,cz,cA)}cy.qualityOfExperience=null;i=false;if(cz=="playing"&&cy.logType=="R"){cy.clearRelativeMetrics()}if(cz!="heartBeat"){++cy.sequenceId;cy.lastLogTime=cx;cy.clearAdRelativeMetrics()}else{cy.logInterval=cD}}function ab(cz){try{var cy=by();var i=v.akamai;var cx=0;if(i.currentState&&i.currentState.timeUpdateClockTime){cx=i.currentState.timeUpdateClockTime}cz.adSession=i.adSession;if(i.isAdPlaying){cz.adPlayClockTime+=cy-cx;cz.tempAdPlayClockTime=cy-cx;++cz.adAbandonCount;l(cz)}else{if(i.playBucket=="-1"){l(cz)}else{if(i.playBucket=="4"){cz.adPlayClockTime=i.adPlayClockTime}else{++cz.adAbandonCount}}}i.currentState.timeUpdateClockTime=cy;i.adSessionSent=true}catch(cA){}}function l(cB){try{var cx=v.akamai;var cy="";var cz=["adId","type","startPos","tempAdStartupTime","tempAdPlayClockTime","playBucket","endStatus","adDuration","adTitle","adCategory","adPartnerId","adServer","adDaypart","adIndustryCategory","adEvent"];for(var cA=0;cAcy[cx][0];cx++){}bl("playingIndex "+this.playingIndex+" index: "+cx);if(cx!=this.playingIndex){cy[this.playingIndex][1]=Math.max(e,cy[cx-1][1]);cy.splice(this.playingIndex+1,cx-this.playingIndex-1)}else{cy[this.playingIndex][1]=Math.max(e,cy[this.playingIndex][1])}if(cz==null){return}for(cx=0;cx=cz){this.playingIndex=cx;return}else{if((cx+1)cz){cx++;this.playingIndex=cx;cy.splice(cx,0,[cz,cz]);return}}}if(cx==cy.length){cy.push([cz,cz]);this.playingIndex=cx}}};function b1(){var cx,e;for(cx in be){for(e in be[cx]){if(be[cx][e].isSent&&be[cx][e].isSent===true){be[cx][e].isSent=false}}}}function aX(cA){bl("endOfTheSession");var cz=cA.akamai;var cB=cz.isPlaylist;var cx=cz.visitId;var e=cz.viewerId;var cy=cz.streamName;var cD=cz.cdn;var cC=cz.sendVLine;var i=cz.iLineCount;var cE=cz.isFirstTitle;cA.akamai=null;b1();cz=cA.akamai=new aT(cA);cz.visitId=cz.browserSessionId=cx;cz.viewerId=cz.clientId=e;cz.cdn=cD;cz.streamName=cy;cz.iLineCount=i;cA.akamai.clearVisitTimeoutId=window.setTimeout(function(){cd(cA,1)},o.visitTimeout);cz.sendVLine=cC;cz.isFirstTitle=cE;cz.isPlaylist=cB;if(cA.played){cA.played.length=0}}function bb(){try{if(this.readyState==4&&this.status==200&&this.responseText){var cA=this.akamai;var i=this.responseText.split("\n");var cC="";var cz=/PROGRAM-ID=(\d+)/;var cx;for(bC in i){if((cx=cz.exec(i[bC]))){if(cx[1]==cC){break}else{cC=cx[1]}}}if(bC!=i.length){cA.format="L";cA.playerFormat=cA.playerType+":"+cA.format}cz=/^#EXT((INF)|(-X-STREAM-INF))[^\n]*\n([^\n]*)\n/m;bl("Checking");if((cx=cz.exec(this.responseText))){bl("Checking done "+cx[4]);if(/.m3u8$/.exec(cx[4])){try{var cy=new XMLHttpRequest();cy.open("GET",cx[4],true);cy.onreadystatechange=function(){if(this.responseText){if(/^#EXT-X-ENDLIST/m.exec(this.responseText)){cA.deliveryType="O"}}};if(cy.overrideMimeType){cy.overrideMimeType("text/plain")}cy.send(null)}catch(cB){bl("parsePlaylist, exception in parsing play list, "+cB)}}else{if(/^#EXT-X-ENDLIST/m.exec(this.responseText)){cA.deliveryType="O"}}}}}catch(cB){bl("exception in parsePlaylist : "+cB)}}var bG=["UNKNOWN","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"];function bu(e){if(e.dataset&&e.dataset.isad&&e.dataset.isad=="true"){return true}else{return false}}function bz(cx,i){if(i=="playing"){bR=new Array()}var cz=by();var cy={};cy.eventType=i;cy.eventTime=cz;var cA=A(cx);if(cA){cy.streamUrl=cA}if(i=="error"){cy.errorCode=a0(cx)}if(bR&&bR.length>0){var e=bR[bR.length-1];if(e.eventType==cy.eventType&&e.streamUrl==cy.streamUrl){if(i=="error"){e.errorCode=cy.errorCode}e.eventTime=cy.eventTime}else{bR.push(cy)}}else{bR.push(cy)}}function O(i,cD){try{var cB=false;if(bR.length>0){var cy=by();var cx=bR[bR.length-1];bl("check error events array, previous event is : "+cx.eventType);var cC=A(i);if(cx.eventType=="error"&&cC==cx.streamUrl){if(cD=="error"){var cA=a0(i);if(cx.errorCode==cA){cB=true}else{cB=false}cx.eventTime=cy;cx.errorCode=cA}else{if(cD=="play"&&cx.eventTime&&(cy-cx.eventTime<=2000)){cB=true}}}}}catch(cz){bl("exception in checkErrorEventsArray"+cz);cB=false}return cB}function bc(cx){if(bu(cx)){bl("handle Seeking Event : video tag is of type AD, return");return}try{var cz=by();var i=parseInt(ay(cx));var cB=cx.akamai;var cy=cB.currentState;var cE=cz-cy.lastEventClockTime;var cA=cz-cB.startTimer;var cC=cy.state;if(cy.state==bW.playing){cB.playClockTime+=cE;if(bq&&bq.populateQoeEventsArray){bq.populateQoeEventsArray("play",cy.lastEventClockTime,cz)}}if(cB.isPlaylist&&(cy.state==bW.ended)&&(cB.browser=="Safari")){}cy.lastEventClockTime=cz}catch(cD){bl("Exception in handle Seeking Event : "+cD)}}function W(cx){if(bu(cx)){bl("handle Seeked Event : video tag is of type AD, return");return}try{var cz=by();var i=parseInt(ay(cx));var cB=cx.akamai;var cy=cB.currentState;var cE=cz-cy.lastEventClockTime;var cA=cz-cB.startTimer;var cC=cy.state;bl("entered function handle Seeked Event, currentstate = "+b4(cy.state));if(cC==bW.pause||cC==bW.playing||cC==bW.rebuffering||cy.state==bW.seek){if((cz-cy.timeUpdateClockTime)>0){at(cB,cz,i,"S")}switch(cC){case bW.playing:cB.playClockTime+=cE;bl("handle seeked event, state: playing, calling update played, with = "+cy.timeUpdateStreamTime+", "+i);cB.updatePlayed(cy.timeUpdateStreamTime,i);cy.lastEventClockTime=cz;cy.state=bW.seek;cy.seekStartStreamPos=i;break;case bW.rebuffering:bl("handle seeked event, previous state is rebuffering");cB.rebufferTime+=cE;cB.curRebufferTime+=cE;if(cB.rebufferSessionArrayHLine){cB.rebufferSessionArrayHLine.push(cz)}try{R(cB,cz);cB.curRebufferTime=0}catch(cD){bl("Error...Play"+cD.message)}cy.lastEventClockTime=cz;cy.state=bW.seek;break}}}catch(cD){bl("exception in handle Seeked Event :"+cD)}}function ac(cx){if(bu(cx)){bl("handlePauseEvent : video tag is of type AD, return");return}try{bl("entered function handle Pause Event");var cz=by();var i=parseInt(ay(cx));var cD=cx.akamai;var cy=cD.currentState;var cA=E(cx);if(cD.firstTimePlay||cy.state==bW.pause){return}if(cA&&cA!=0&&i&&i!=0){if(Math.abs(cA-i)<1000){return}}var cF=cz-cy.lastEventClockTime;var cB=cz-cD.startTimer;var cC=cy.state;switch(cC){case bW.playing:cD.playClockTime+=cF;if(bq&&bq.populateQoeEventsArray){bq.populateQoeEventsArray("play",cy.lastEventClockTime,cz)}++cD.pauseCount;at(cD,cz,i,"P");if(cD.pauseSeekSession!="-"){cD.pauseSeekSession+=",P("+i+":"+cB+")"}else{cD.pauseSeekSession="P("+i+":"+cB+")"}bl("handle pause event, state :playing, calling update played, currentStreamtime = "+i);cD.updatePlayed(i);break;case bW.rebuffering:++cD.pauseCount;at(cD,cz,i,"P");if(cD.pauseSeekSession!="-"){cD.pauseSeekSession+=",P("+i+":"+cB+")"}else{cD.pauseSeekSession="P("+i+":"+cB+")"}cD.rebufferTime+=cF;cD.curRebufferTime+=cF;if(cD.rebufferSessionArrayHLine){bl("handlePauseEvent : pushing in rebufferSessionArrayHLine");cD.rebufferSessionArrayHLine.push(cz)}try{R(cD,cz);cD.curRebufferTime=0}catch(cE){bl("Error...Pause"+cE.message)}break}cy.state=bW.pause;cy.pauseStartStreamTime=i;cy.pauseStartClockTime=cz;cy.lastEventClockTime=cz}catch(cE){bl("exception in handlePauseEvent : "+cE)}}function aq(cx){if(bu(cx)){bl("handle Play Event : video tag is of type AD, return");return}try{if(cx.akamai&&cx.akamai.postRollTimer){bl("handle play event: send the C line without changing set data");window.clearTimeout(cx.akamai.postRollTimer);delete cx.akamai.postRollTimer;al(cx)}if(O(cx,"play")){bl("handle play Event: play is thrown after error, return, curTime = "+by());return}bz(cx,"play");var cD=cx.akamai;var cA=by();var i=parseInt(ay(cx));var cy=cD.currentState;var cG=cA-cy.lastEventClockTime;var cC=cA-cD.startTimer;var cE=cy.state;bl("entered function handle Play Event, current state = "+b4(cy.state));switch(cE){case bW.ended:cD.startTimer=cA;cD.streamLength=parseInt(E(cx));var cB=A(cx);if(cB.indexOf("?")!=-1){cB=cB.substring(0,cB.indexOf("?"))}if(cB!=null&&cB!=""&&(/.m3u8$/.exec(cB))){cD.format="L";cD.playerFormat=cD.playerType+":"+cD.format;cD.deliveryType="L";try{var cz=new XMLHttpRequest();cz.akamai=cD;cz.open("GET",cB,true);cz.onreadystatechange=bb;if(cz.overrideMimeType){cz.overrideMimeType("text/plain")}cz.send(null)}catch(cF){bl("handleplayEvent, exception in parsing play list, "+cF)}}ch(cx,false);cD.currentState.state=bW.init;bl(by()+": handlePlayBackEvent : Setting state to init");cD.currentState.timeUpdateClockTime=cA;cD.currentState.timeUpdateStreamTime=0;cD.currentState.lastEventClockTime=cA;cD.isPlaylist=true;break;case bW.pause:cD.pauseDuration+=cG;if(cD.pauseIntervalsAsString!="-"){cD.pauseIntervalsAsString+=","+cy.pauseStartStreamTime+":"+(cA-cy.pauseStartClockTime)}else{cD.pauseIntervalsAsString=cy.pauseStartStreamTime+":"+(cA-cy.pauseStartClockTime)}if(cD.pauseSeekSession!="-"){cD.pauseSeekSession+=",R("+cy.pauseStartStreamTime+":"+cC+")"}else{cD.pauseSeekSession="R("+cy.pauseStartStreamTime+":"+cC+")"}bl("handle play event, state : pause, calling update played, with = "+cy.pauseStartStreamTime+","+i);cD.updatePlayed(cy.pauseStartStreamTime,i);cD.currentState.lastEventClockTime=cA;++cD.resumeBufferCount;cy.state=bW.resumeBuffering;break}}catch(cF){bl("exception in handle Play Event:"+cF)}}function j(cx){if(bu(cx)){bl("handle Playing Event : video tag is of type AD, return");return}try{var cz=by();bz(cx,"playing");var i=parseInt(ay(cx));var cB=cx.akamai;var cy=cB.currentState;var cE=cz-cy.lastEventClockTime;var cA=cz-cB.startTimer;var cC=cy.state;bl("entered function handle Playing Event, current State = "+b4(cy.state));switch(cC){case bW.rebuffering:cB.rebufferTime+=cE;cB.curRebufferTime+=cE;if(cB.rebufferSessionArrayHLine){cB.rebufferSessionArrayHLine.push(cz)}try{R(cB,cz);cB.curRebufferTime=0}catch(cD){bl("Error...Play"+cD.message)}break;case bW.pause:case bW.resumeBuffering:cB.resumeBufferTime+=cE;if(cE==0&&cB.resumeBufferCount>0){--cB.resumeBufferCount}break;case bW.init:u(cx,cE,cz,i);break;case bW.ended:bl("handle Playing Event : dispatch play and playing event");aq(cx);j(cx);break;case bW.playing:cB.playClockTime+=cE;if(bq&&bq.populateQoeEventsArray){bq.populateQoeEventsArray("play",cy.lastEventClockTime,cz)}break;case bW.seek:if((cz-cy.timeUpdateClockTime)>0){at(cB,cz,i,"S");bl("handle playing event, state : seek, update played using seekStart StreamPos"+cy.seekStartStreamPos+","+i);cB.updatePlayed(cy.seekStartStreamPos,i)}break}cy.state=bW.playing;cy.lastEventClockTime=cz}catch(cD){bl("Exception in handle Playing Event:"+cD)}}function F(cx){if(bu(cx)){bl("handleWaitingEvent : video tag is of type AD, return");return}try{var cB=cx.akamai;if(cB.currentState.state==bW.rebuffering){bl("already in handleWaiting Event");return}var cz=by();var i=parseInt(ay(cx));var cy=cB.currentState;var cE=cz-cy.lastEventClockTime;var cA=cz-cB.startTimer;var cC=cy.state;bl("entered function handle Waiting Event, current state = "+b4(cy.state));switch(cC){case bW.playing:cB.playClockTime+=cE;if(bq&&bq.populateQoeEventsArray){bq.populateQoeEventsArray("play",cy.lastEventClockTime,cz)}++cB.rebufferCount;if(cB.rebufferCount==1&&cB.playerState!="B"){cB.firstRebufferStartEpoch=Math.round(cz)}if(cB.rebufferSessionArrayHLine){bl("handleWaitingEvent : pushing in rebufferSessionArrayHLine"+cz);cB.rebufferSessionArrayHLine.push(cz)}bl("handle waiting event, state : playing, calling update played, currentStreamtime = "+i);cB.updatePlayed(i);if(bq&&bq.currSubSessionQuality){bq.currSubSessionQuality(true)}cy.state=bW.rebuffering;break;case bW.pause:++cB.resumeBufferCount;cy.state=bW.resumeBuffering;break;case bW.init:cB.connectTime=cE;break}cy.lastEventClockTime=cz;bl("handle waiting event, if now seek starts, stream pos = "+i);cy.seekStartStreamPos=i}catch(cD){bl("exception in handleWaitingEvent:"+cD)}}function s(e){if(bu(e)){bl("handleAbortEvent : video tag is of type AD, return");return}Q(e)}function Q(cx){if(bu(cx)){bl("handle Error Event : video tag is of type AD, return");return}try{if(O(cx,"error")){bl("handle Error Event: consecutive error events thrown, return, curTime = "+by());return}if(cx&&cx.akamai&&!cx.akamai.isILineSent){bl("handle Error Event: calling handle Play Event");aq(cx)}bz(cx,"error");var cz=by();var i=parseInt(ay(cx));var cB=cx.akamai;var cy=cB.currentState;var cG=cz-cy.lastEventClockTime;var cA=cz-cB.startTimer;var cC=cy.state;bl("entered function handle Error Event, current state = "+b4(cy.state));if(cy.state==bW.playing){cB.playClockTime+=cG;if(bq&&bq.populateQoeEventsArray){bq.populateQoeEventsArray("play",cy.lastEventClockTime,cz)}}if(cB.isELineSent||cB.isCLineSent){return}var cF=a0(cx);g(cx,cF);cy.state=bW.ended;var cE=parseInt(B("HTML_LastCLineTime"));aX(cx);cy.lastEventClockTime=cz}catch(cD){bl("Exception in handleErrorEvent:"+cD)}}function bs(cy){if(bu(cy)){bl("handle Ended Event WithDelay : video tag is of type AD, return");return}try{var cA=cy.akamai;var cx=cA.currentState;bl("entered function handle Ended Event WithDelay, current state"+b4(cx.state));var cz=by();var i=cz-cx.lastEventClockTime;if(cA.pollingTimer){window.clearInterval(cA.pollingTimer)}if(bA&&bA.retryTimer){window.clearTimeout(bA.retryTimer)}if(cA.hLineTimer){window.clearInterval(cA.hLineTimer)}if(cA.fastTCPServerIpTimer){window.clearInterval(cA.fastTCPServerIpTimer)}if(cA.firstPLineTimer){window.clearTimeout(cA.firstPLineTimer)}if(bA&&bA.retryTimer){window.clearTimeout(bA.retryTimer)}if(cA.postRollTimer){bl("handle Ended Event WithDelay: postRollTimer already started return");return}b0(cA,"complete");bo(cA);cA.postRollTimer=window.setTimeout(function(){al(cy)},1000);bK(cA);cA.customDataPopulated=true;bM(cA,cz);aW(cy,i,cz,true);cA.playEndMetricsUpdated=true}catch(cB){bl("Exception in handle Ended Event WithDelay"+cB);al(cy)}}function al(cx){try{var cC=cx.akamai;if(cC.postRollTimer){window.clearTimeout(cC.postRollTimer);delete cC.postRollTimer}if(cC.firstTimePlay||cC.isELineSent||cC.isCLineSent){bl("handle Ended Event : already sent C line, return");return}var cA=by();var i=parseInt(ay(cx));var cy=cC.currentState;var cG=cA-cy.lastEventClockTime;var cB=cA-cC.startTimer;var cD=cy.state;bl("entered function handle Ended Event, current state"+b4(cy.state));if(!cC.playEndMetricsUpdated){aW(cx,cG,cA,true);cC.playEndMetricsUpdated=true}cy.state=bW.ended;var cz=ad(cx);if(cC.streamTitleSwitchReason!=null&&cC.streamTitleSwitchReason!=""){cz=cC.streamTitleSwitchReason}bj(cx,cz,false);var cF=parseInt(B("HTML_LastCLineTime"));aX(cx);cy.lastEventClockTime=cA}catch(cE){bl("Exception in handle Ended Event :"+cE)}}this.setData=function(e,i){aZ(e,i)};this.handleStreamSwitch=function(){bZ()};this.handleTitleSwitch=function(e){b5(e)};this.handleFeedbackEvent=function(){az()};function aZ(e,i){if(e=="viewerId"||e=="viewerDiagnosticsId"){if(i==null||i==""){i="-"}}aY[e]=i;if((e.indexOf("socialShare:")!=-1)||(e.indexOf("feedback:")!=-1)){az()}}function bZ(){var e=aB.akamai;e.streamTitleSwitchReason="Stream.Switched";al(aB)}function b5(cy){var cz=aB.akamai;cz.streamTitleSwitchReason="Title.Switched";al(aB);if(cy!=null&&cy!=""){for(var cx in cy){setAkamaiMediaAnalyticsData(cx,cy[cx])}}aq(aB);j(aB);try{aB.akamai.currentState.timeUpdateStreamTime=parseInt(ay(video))}catch(cA){bl("exception in handleTitleSwitch"+cA)}}function az(){var cA="feedback:";var e=cA.length;var cz=false;for(var cy in aY){if(cy.indexOf(cA)!=-1){var cx=cy.substring(e);aY[cx]=aY[cy];delete aY[cy];cz=true}}w();bl("handleFeedbackEvent");if(a7&&a7.shouldSendFLine&&a7.akamai&&(a7.akamai.isCLineSent||a7.akamai.postRollTimer)){if(cz){a7.akamai.customDataChanged=true}if(a7.fLineCount=1000&&cC.isSLineSent){W(cx)}else{if((cA>0)&&(cA<=750)){if(cx.isObjectBasedVideo){if(cy.state==bW.seek){j(cx)}}else{if(!cC.isSLineSent||cy.state==bW.seek||cy.state==bW.rebuffering){bl("handle time update event, dispatching playing event, current Video state is : "+b4(cy.state));j(cx)}}}}cy.timeUpdateClockTime=cz;cy.timeUpdateStreamTime=i}catch(cE){bl("Exception in handleTimeupddate :"+cE)}}this.handleSessionInit=function(e){if(e){if(typeof bT!="object"){bT={}}if(e.streamHeadPosition){bT.streamHeadPosition=e.streamHeadPosition}if(e.streamLength){bT.streamLength=e.streamLength}if(e.streamURL){bT.streamURL=e.streamURL}}aq(aB)};this.handlePlaying=function(){aq(aB);j(aB)};this.handlePlayEnd=function(e){if(aB.isObjectBasedVideo){aB.endReason=e}bs(aB)};this.handleMediaChangedEvent=function(){al(aB)};this.handlePause=function(){ac(aB)};this.handleResume=function(){aq(aB);j(aB)};this.handleBufferStart=function(){F(aB)};this.handleBufferEnd=function(){aq(aB);j(aB)};this.handleError=function(e){if(aB.isObjectBasedVideo){aB.errorReason=e}Q(aB)};this.handleTimeupdateEvent=function(){ah(aB)};this.handleAdLoaded=function(e){var i=new Date().getTime();if(e){bg=e}bg.adLoadTime=i;a8(bg)};this.handleAdStarted=function(e){if(e){bg=e}aL(bg)};this.handleAdCompleted=function(){J()};this.handleAdFirstQuartile=function(){ck()};this.handleAdMidPoint=function(){b()};this.handleAdThirdQuartile=function(){bL()};this.handleAdStopped=function(){n()};this.handleAdError=function(){aG()};this.handleSetupAISEvent=function(e,i,cx){a5(e,i,cx)};function a5(i,cy,cA){try{var cx=bA.aisRequestLimit;var cz=bA.aisRequestInterval;bA=new ak();bA.aisRequestInterval=cz;bA.aisRequestLimit=cx;if(!i){bl("return from ais, platform is null");return}bA.platform=i;bA.version=cy?cy:"1.0";if(cA){bA.aisCustomDataObj=cA}bA.requestUrl="http://idp.securetve.com/rest/";bA.initUrl=bA.requestUrl+bA.version+"/"+bA.platform+"/init/?format=jsonp&responsefield=akaMediaAnalytics.receiveAISInitRequest";bA.identityUrl=bA.requestUrl+bA.version+"/"+bA.platform+"/identity/?format=jsonp&responsefield=akaMediaAnalytics.receiveAISIdentityRequest";bA.initUrlId="AkamaiAISInitUrl";bA.identityUrlId="AkamaiAISIdentityUrl";r(bA.initUrl,bA.initUrlId)}catch(cB){bA.requestFailed=true}}this.receiveAISInitRequest=function(cz){try{bA.initObj=cz;ar(bA.initUrlId);if(bA.initObj==""||bA.initObj==null){bA.requestFailed=true;return}if(bA.requestFailed){return}if(bA.initObj.authenticated){bA.akamai={};bA.akamai.ais_queryToken=bA.initObj.querytoken;if(bA.initObj.idps){var cA=bA.initObj.idps;for(var cx in cA){bA.akamai.ais_idpId=cx;bA.akamai.ais_idpName=cA[cx].name;bA.akamai.ais_idpDisplayName=cA[cx].display_name;bA.akamai.ais_idpUrl=cA[cx].url}}r(bA.identityUrl,bA.identityUrlId)}else{if(!bA.requestFailed){bl("receiveAISInitRequest, retrying the request");++bA.aisRetries;if(bA.aisRetries=bW.init&&cE==0){if(!cA.firstTimePlay){if(cA.isELineSent||cA.isCLineSent){return}var cx="Browser.Close";if(cA.postRollTimer){window.clearTimeout(cA.postRollTimer);delete cA.postRollTimer}bj(i,cx,true)}else{if(cA.isELineSent||cA.isCLineSent){return}var cC="Browser.Refresh.NoStart";if((by()-cA.startTimer)>o.initBrowserCloseTime){cC="Browser.Refresh.NoStart.Late"}g(i,cC,true)}}var cD=parseInt(B("HTML_LastCLineTime"));var cz=by();var cB=(cD+o.visitTimeout)-cz;bl("time Remaining :"+cB+"="+cD+"+"+o.visitTimeout+"-"+cz);var e=parseInt(B("HTML_isPlayingCount"));bl("handle Video Unload: HTML_isPlayingCount = "+e);bl("handle Video Unload: HTML_VisitCountCookie = "+cy);if(cy>=1&&cE==1){if(cB>0){window.clearTimeout(cA.clearVisitTimeoutId);i.akamai.clearVisitTimeoutId=window.setTimeout(function(){cd(i,1)},cB);return}else{if(cB<=0&&cy>1&&e>0){window.clearTimeout(cA.clearVisitTimeoutId);i.akamai.clearVisitTimeoutId=window.setTimeout(function(){cd(i,1)},o.visitTimeout);return}}}bl("handle Video Unload: decrementing HTML_VisitCountCookie");cy=cy-1;a3("HTML_VisitCountCookie",cy);var cy=parseInt(B("HTML_VisitCountCookie"));if(cy===0||isNaN(cy)){if(cA.sendVLine){aj(i)}}}function aU(){if(v&&v.akamai&&v.akamai.isILineSent){try{v.akamai.endStatus=2;v.akamai.playEndMetricsUpdated=true;if(!v.akamai.adSessionSent){ab(v.akamai)}}catch(i){}cd(v,0)}else{if(aB!=null&&aB.akamai){try{if(v&&v.akamai){aB.akamai.endStatus=2;aB.akamai.playEndMetricsUpdated=true;aB.akamai.type="0";aB.akamai.startPos="0";if(!v.akamai.adSessionSent){ab(aB.akamai)}}}catch(i){}cd(aB,0)}}}function co(i){bl("handlePagehide");ai=true;aU()}function cg(i){bl("handlePageshow:");try{if(aB&&aB.tagName){bl("handlePageShow: media tag is :"+aB.tagName);if(aB.akamai&&ai){bl("handlePageshow: send play and playing on timeupdate");N=true}}}catch(i){bl("Exception in handlePagehsow : "+i)}ai=false}function b7(cz){try{if(cz.data&&cz.data.type){bl("handleReceiveMessage: message received parent window");if(cz.data.type=="akamaiCustomData"){var cx;for(cx in cz.data){if(cx=="viewerId"){akamaiSetViewerId(cz.data[cx])}else{if(cx=="viewerDiagnosticsId"){akamaiSetViewerDiagnosticsId(cz.data[cx])}else{if(cx!="type"){setAkamaiMediaAnalyticsData(cx,cz.data[cx])}}}}}else{if(cz.data.type=="akamaiBeforeUnload"){}}}else{return}}catch(cy){bl("Exception in handleReceiveMessage")}}function B(i){var e=i+"=";var cx="";if(document.cookie.length>0){offset=document.cookie.indexOf(e);if(offset!=-1){offset+=e.length;end=document.cookie.indexOf(";",offset);if(end==-1){end=document.cookie.length}cx=document.cookie.substring(offset,end)}}return cx}function T(e){var cz=location.pathname.split("/");var cy=" path=";document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT;";for(var cx=0;cx