adarsh_hello_world 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +140 -3
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -1,6 +1,143 @@
1
- var adarsh = () =>{
2
- console.log("adarsh")
1
+ function loadPolyfill(){var t=document.createElement("script");t.src="https://cdn.polyfill.io/v2/polyfill.js",document.head.appendChild(t)}"use strict";window.Promise||loadPolyfill();"use strict";var MMChunkInformation=function t(e,i,r,n,a,s,o,d){var h={};return void 0===e?h.trackIdx=-1:h.trackIdx=e,void 0===e?h.trackIdx=-1:h.trackIdx=e,void 0===i?h.bitrate=-1:h.bitrate=i,void 0===r?h.sequence=-1:h.sequence=r,void 0===a?h.startTime=-1:h.startTime=a,void 0===o?h.startByte=-1:h.startByte=o,void 0===d?h.endByte=-1:h.endByte=d,void 0===s?h.duration=-1:h.duration=s,h.initStartByte=-1,h.initEndByte=-1,h.resourceURL=n||null,h},MMRepresentation=function t(e,i,r,n,a,s){var o={};return o.trackIdx=e||0,o.bitrate=i||0,o.width=r||0,o.height=n||0,o.codecIdentifier=a||{},o.segmentInfo=s||[],o},MMPresentationInfo=function t(e,i,r,n){var a={};return 1===e&&(e=!0),a.isLive=e||!1,a.duration=i||-1,a.representationArray=r||[],a.contentType=n||"NA",a},MMAdState=Object.freeze({AD_BLOCKED:1,AD_IMPRESSION:2,AD_STARTED:3,AD_PLAYING:4,AD_CLICKED:5,AD_PAUSED:6,AD_RESUMED:7,AD_SKIPPED:8,AD_COMPLETED:9,AD_ERROR:10,AD_REQUEST:11,AD_PLAY:12,AD_BUFFERING:13,AD_MIDPOINT:14,AD_FIRST_QUARTILE:15,AD_THIRD_QUARTILE:16,AD_ENDED:17}),MMAdInfo=function t(){var e={};return e.adClient=void 0,e.adId=void 0,e.adDuration=0,e.adPosition=void 0,e.adIsLinear=!1,e.adCreativeType=void 0,e.adServer=void 0,e.adResolution=void 0,e.adPodIndex=void 0,e.adPositionInPod=void 0,e.adPodLength=void 0,e.isBumper=!1,e.adScheduledTime=-1,e.adCreativeId=void 0,e.adUrl=void 0,e.adTitle=void 0,e.adBitrate=void 0,e},MMPlayerState=Object.freeze({PLAYING:1,PAUSED:2,STOPPED:3}),SeekState=Object.freeze({SeekStarted:1,SeekCompleted:2,Playing:3}),MMQBRMode=Object.freeze({QBRModeDisabled:"QBRDisabled",QBRModeQuality:"QBRQuality",QBRModeBitsave:"QBRBitsave",QBRModeCostsave:"QBRCostsave"}),MMConnectionInfo=Object.freeze({Cellular:"Cellular",Cellular_2G:"Cellular_2G",Cellular_3G:"Cellular_3G",Cellular_4G:"Cellular_4G",Cellular_LTE:"Cellular_LTE",Cellular_5G:"Cellular_5G",NotReachable:"WebNotReachable",Wifi:"Wifi",WiredNetwork:"WiredNetwork"}),MMOverridableMetric=Object.freeze({Latency:"Latency",ServerAddress:"CDN",DurationWatched:"DurationWatched"}),MMSTREAMSMARTERCONSTANTS={SDK_REGISTER_URL:"https://register.mediamelon.com/mm-apis/register/",SDK_CONFIG:{sdkVersion:"JSSDKv4.4.2_",hintFileVersion:"2.0.0",EP_SCHEMA_VERSION:"2.0.0",platform:"Browser",qmetric:!0,statistics:!1,log_level:2},SDK_BUILD_VERSION:"17032021"},MMMD5=function(t){"use strict";var e=function(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i},i=function(t,i,r,n,a,s){var o,d;return e((o=e(e(i,t),e(n,s)),o<<(d=a)|o>>>32-d),r)},r=function(t,e,r,n,a,s,o){return i(e&r|~e&n,t,e,a,s,o)},n=function(t,e,r,n,a,s,o){return i(e&n|r&~n,t,e,a,s,o)},a=function(t,e,r,n,a,s,o){return i(e^r^n,t,e,a,s,o)},s=function(t,e,r,n,a,s,o){return i(r^(e|~n),t,e,a,s,o)},o=function(t,i){t[i>>5]|=128<<i%32,t[(i+64>>>9<<4)+14]=i;var o,d,h,u,f,c=1732584193,p=-271733879,l=-1732584194,S=271733878;for(o=0;o<t.length;o+=16)d=c,h=p,u=l,f=S,c=r(c,p,l,S,t[o],7,-680876936),S=r(S,c,p,l,t[o+1],12,-389564586),l=r(l,S,c,p,t[o+2],17,606105819),p=r(p,l,S,c,t[o+3],22,-1044525330),c=r(c,p,l,S,t[o+4],7,-176418897),S=r(S,c,p,l,t[o+5],12,1200080426),l=r(l,S,c,p,t[o+6],17,-1473231341),p=r(p,l,S,c,t[o+7],22,-45705983),c=r(c,p,l,S,t[o+8],7,1770035416),S=r(S,c,p,l,t[o+9],12,-1958414417),l=r(l,S,c,p,t[o+10],17,-42063),p=r(p,l,S,c,t[o+11],22,-1990404162),c=r(c,p,l,S,t[o+12],7,1804603682),S=r(S,c,p,l,t[o+13],12,-40341101),l=r(l,S,c,p,t[o+14],17,-1502002290),p=r(p,l,S,c,t[o+15],22,1236535329),c=n(c,p,l,S,t[o+1],5,-165796510),S=n(S,c,p,l,t[o+6],9,-1069501632),l=n(l,S,c,p,t[o+11],14,643717713),p=n(p,l,S,c,t[o],20,-373897302),c=n(c,p,l,S,t[o+5],5,-701558691),S=n(S,c,p,l,t[o+10],9,38016083),l=n(l,S,c,p,t[o+15],14,-660478335),p=n(p,l,S,c,t[o+4],20,-405537848),c=n(c,p,l,S,t[o+9],5,568446438),S=n(S,c,p,l,t[o+14],9,-1019803690),l=n(l,S,c,p,t[o+3],14,-187363961),p=n(p,l,S,c,t[o+8],20,1163531501),c=n(c,p,l,S,t[o+13],5,-1444681467),S=n(S,c,p,l,t[o+2],9,-51403784),l=n(l,S,c,p,t[o+7],14,1735328473),p=n(p,l,S,c,t[o+12],20,-1926607734),c=a(c,p,l,S,t[o+5],4,-378558),S=a(S,c,p,l,t[o+8],11,-2022574463),l=a(l,S,c,p,t[o+11],16,1839030562),p=a(p,l,S,c,t[o+14],23,-35309556),c=a(c,p,l,S,t[o+1],4,-1530992060),S=a(S,c,p,l,t[o+4],11,1272893353),l=a(l,S,c,p,t[o+7],16,-155497632),p=a(p,l,S,c,t[o+10],23,-1094730640),c=a(c,p,l,S,t[o+13],4,681279174),S=a(S,c,p,l,t[o],11,-358537222),l=a(l,S,c,p,t[o+3],16,-722521979),p=a(p,l,S,c,t[o+6],23,76029189),c=a(c,p,l,S,t[o+9],4,-640364487),S=a(S,c,p,l,t[o+12],11,-421815835),l=a(l,S,c,p,t[o+15],16,530742520),p=a(p,l,S,c,t[o+2],23,-995338651),c=s(c,p,l,S,t[o],6,-198630844),S=s(S,c,p,l,t[o+7],10,1126891415),l=s(l,S,c,p,t[o+14],15,-1416354905),p=s(p,l,S,c,t[o+5],21,-57434055),c=s(c,p,l,S,t[o+12],6,1700485571),S=s(S,c,p,l,t[o+3],10,-1894986606),l=s(l,S,c,p,t[o+10],15,-1051523),p=s(p,l,S,c,t[o+1],21,-2054922799),c=s(c,p,l,S,t[o+8],6,1873313359),S=s(S,c,p,l,t[o+15],10,-30611744),l=s(l,S,c,p,t[o+6],15,-1560198380),p=s(p,l,S,c,t[o+13],21,1309151649),c=s(c,p,l,S,t[o+4],6,-145523070),S=s(S,c,p,l,t[o+11],10,-1120210379),l=s(l,S,c,p,t[o+2],15,718787259),p=s(p,l,S,c,t[o+9],21,-343485551),c=e(c,d),p=e(p,h),l=e(l,u),S=e(S,f);return[c,p,l,S]},d=function(t){var e,i="",r=32*t.length;for(e=0;e<r;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i},h=function(t){var e,i=[];for(e=0,i[(t.length>>2)-1]=void 0;e<i.length;e+=1)i[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i},u=function(t,e){var i,r,n=h(t),a=[],s=[];for(a[15]=s[15]=void 0,n.length>16&&(n=o(n,8*t.length)),i=0;i<16;i+=1)a[i]=909522486^n[i],s[i]=1549556828^n[i];return r=o(a.concat(h(e)),512+8*e.length),d(o(s.concat(r),640))},f=function(t){var e,i,r="0123456789abcdef",n="";for(i=0;i<t.length;i+=1)n+=r.charAt((e=t.charCodeAt(i))>>>4&15)+r.charAt(15&e);return n},c=function(t){return unescape(encodeURIComponent(t))},p=function(t){var e;return e=c(t),d(o(h(e),8*e.length))},l=function(t){return f(p(t))},S=function(t,e){return u(c(t),c(e))},m=function(t,e){return f(S(t,e))};return{mm_md5:function(t,e,i){return e?i?S(e,t):m(e,t):i?p(t):l(t)},hexMD5:l,rawMD5:p,hexHMACMD5:m,rawHMACMD5:S}};function ObjectIron(t){e=[];for(var e,i=0,r=t.length;i<r;i+=1)t[i].isRoot?e.push("root"):e.push(t[i].name);var n=function(t,e){var i;if(null!==t&&null!==e)for(i in t)t.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&(e[i]=t[i])},a=function(t,e,i){var r,a,s,o,d;if(null!==t&&0!==t.length)for(r=0,a=t.length;r<a;r+=1)s=t[r],e.hasOwnProperty(s.name)&&(i.hasOwnProperty(s.name)?s.merge&&(o=e[s.name],d=i[s.name],"object"==typeof o&&"object"==typeof d?n(o,d):null!=s.mergeFunction?i[s.name]=s.mergeFunction(o,d):i[s.name]=o+d):i[s.name]=e[s.name])},s=function(t,e){var i,r,n,o,d,h,u,f=t;if(null!==f.children&&0!==f.children.length){for(i=0,r=f.children.length;i<r;i+=1)if(h=f.children[i],e.hasOwnProperty(h.name)){if(h.isArray)for(n=0,o=(d=e[h.name+"_asArray"]).length;n<o;n+=1)u=d[n],a(f.properties,e,u),s(h,u);else u=e[h.name],a(f.properties,e,u),s(h,u)}}},o=function(i){var r,n,a,d,h,u,f;if(null===i||"object"!=typeof i)return i;for(r=0,n=e.length;r<n;r+=1)"root"===e[r]&&s(h=t[r],u=i);for(d in i)if(i.hasOwnProperty(d)&&"__children"!=d){if(-1!==(a=e.indexOf(d))){if((h=t[a]).isArray)for(r=0,n=(f=i[d+"_asArray"]).length;r<n;r+=1)s(h,u=f[r]);else s(h,u=i[d])}o(i[d])}return i};return{run:o}}"use strict";var MMX2JS=function(t,e,i){null==e&&(e="_"),null==i&&(i=!1);var r=!1,n={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};function a(t){var e=t.localName;return null==e&&(e=t.baseName),(null==e||""==e)&&(e=t.nodeName),e}function s(t){return"string"==typeof t?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):t}function o(t,e,i,r){var n="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+e;if(null!=i)for(var a=0;a<i.length;a++){var s=i[a],o=t[s];n+=" "+s.substr(1)+"='"+o+"'"}return r?n+="/>":n+=">",n}function d(t,e){return"</"+(null!=t.__prefix?t.__prefix+":":"")+e+">"}function h(t,e){var i,r="_asArray";return -1!==(i=e.toString()).indexOf(r,i.length-r.length)||0==e.toString().indexOf("_")||t[e]instanceof Function}function u(t){var e=0;if(t instanceof Object)for(var i in t)!h(t,i)&&e++;return e}function f(t){var e=[];if(t instanceof Object)for(var i in t)-1==i.toString().indexOf("__")&&0==i.toString().indexOf("_")&&e.push(i);return e}function c(t){var e,i,n="";return t instanceof Object?n+=(i="",null!=(e=t).__cdata&&(i+="<![CDATA["+e.__cdata+"]]>"),null!=e.__text&&(r?i+=s(e.__text):i+=e.__text),i):null!=t&&(r?n+=s(t):n+=t),n}function p(t,e,i){var r="";if(0==t.length)r+=o(t,e,i,!0);else for(var n=0;n<t.length;n++)r+=o(t[n],e,f(t[n]),!1),r+=l(t[n]),r+=d(t[n],e);return r}function l(t){var e="";if(u(t)>0){for(var i in t)if(!h(t,i)){var r=t[i],n=f(r);null==r||void 0==r?e+=o(r,i,n,!0):r instanceof Object?r instanceof Array?e+=p(r,i,n):u(r)>0||null!=r.__text||null!=r.__cdata?(e+=o(r,i,n,!1),e+=l(r),e+=d(r,i)):e+=o(r,i,n,!0):(e+=o(r,i,n,!1),e+=c(r),e+=d(r,i))}}return e+c(t)}return{escapeMode:function(t){r=t},getVersion:function(){return"1.0.11"},json2xml:function(t){var e=this.json2xml_str(t);return this.parseXmlString(e)},json2xml_str:function(t){return l(t)},xml_str2json:function(t){var e=this.parseXmlString(t);return e?this.xml2json(e):void 0},xml2json:function(s){return function s(o){if(o.nodeType==n.DOCUMENT_NODE){var d,h,u,f=o.firstChild;for(h=0,u=o.childNodes.length;h<u;h+=1)if(o.childNodes[h].nodeType!==n.COMMENT_NODE){f=o.childNodes[h];break}if(i)d=s(f);else{d={};var c=a(f);d[c]=s(f)}return d}if(o.nodeType==n.ELEMENT_NODE){var p,d={};d.__cnt=0;for(var l=[],S=o.childNodes,m=0;m<S.length;m++){var f=S.item(m),c=a(f);if(d.__cnt++,null==d[c]){var I=s(f);if("#text"!=c||/[^\s]/.test(I)){var v={};v[c]=I,l.push(v)}d[c]=I,d[c+"_asArray"]=[,],d[c+"_asArray"][0]=d[c]}else{if(null!=d[c]&&!(d[c]instanceof Array)){var T=d[c];d[c]=[],d[c][0]=T,d[c+"_asArray"]=d[c]}for(var E=0;null!=d[c][E];)E++;var I=s(f);if("#text"!=c||/[^\s]/.test(I)){var v={};v[c]=I,l.push(v)}d[c][E]=I}}d.__children=l;for(var $=0;$<o.attributes.length;$++){var P=o.attributes.item($);d.__cnt++;for(var b=P.value,D=0,y=t.length;D<y;D++){var M=t[D];M.test.call(this,P)&&(b=M.converter.call(this,P.value))}d[e+P.name]=b}var g,R=(g=o).prefix;return null!=R&&""!=R&&(d.__cnt++,d.__prefix=R),1==d.__cnt&&null!=d["#text"]&&(d=d["#text"]),null!=d["#text"]&&(d.__text=d["#text"],r&&(d.__text=(p=d.__text).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/")),delete d["#text"],delete d["#text_asArray"]),null!=d["#cdata-section"]&&(d.__cdata=d["#cdata-section"],delete d["#cdata-section"],delete d["#cdata-section_asArray"]),(null!=d.__text||null!=d.__cdata)&&(d.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),d}return o.nodeType==n.TEXT_NODE||o.nodeType==n.CDATA_SECTION_NODE?o.nodeValue:o.nodeType==n.COMMENT_NODE?null:void 0}(s)},parseXmlString:function(t){var e,i,r;if(window.DOMParser){i=new window.DOMParser;try{r=i.parseFromString("<","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(n){}try{e=i.parseFromString(t,"text/xml"),r&&e.getElementsByTagNameNS(r,"parsererror").length&&(e=void 0)}catch(a){}}else 0==t.indexOf("<?")&&(t=t.substr(t.indexOf("?>")+2)),(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t);return e}}};function _defineEnumerableProperties(t,e){for(var i in e){var r=e[i];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,i,r)}if(Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),a=0;a<n.length;a++){var s=n[a],r=e[s];r.configurable=r.enumerable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s,r)}return t}function _defineProperty(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function t(e){return typeof e}:function t(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}"use strict";"use strict";"use strict";"use strict";"use strict";"use strict";"use strict";var MMAdvertisentInformation={_adClient:void 0,_adId:void 0,_adPosition:void 0,_adDuration:void 0,_adResolution:void 0,_adLinear:void 0,_adCreativeType:void 0,_adServer:void 0,_prevAdState:void 0,_playSent:!1,_adCreativeId:void 0,_adTitle:void 0,_adBitrate:void 0,_adUrl:void 0,_adPlaybackStartWallClockTime:0,_adplaydur:0,_adPlaybackTime:0,_adLastPlayingEventTimeStamp:-1,_adLastAdEventTimeStamp:-1,_isBumper:!1,_adPodIndex:-2,_adPodLength:-1,_adPositionInPod:-1,_adScheduledTime:-1},MMExperienceProbeState=Object.freeze({IDLE:0,INITIALIZED:1,ONLOAD_SENT:2,STARTED:3,STOPPED:4,ERROR:5}),ExperienceProbe=function t(){var e,i,r,n,a,s,o,d,h,u,f,c,p,l,S,m;return S={_httpUtil:void 0,_playerName:void 0,_customerID:void 0,_subscriberID:void 0,_assetID:void 0,_assetName:void 0,_videoId:void 0,_contentMetadata:void 0,_domainName:void 0,_component:void 0,_inProgress:!1,_simulatedEndedSent:!1,_mode:null,_modeFromResponse:null,_timerObj:null,_timerObj2:null,_timerTimestampSynchro:null,_regStatus:"",_enableVideoQoE:!0,_enableAdQoE:!0,_sdkVersion:"",_hintFileVersion:"",_playDur:0,_latencyStartTime:0,_enableEP:!1,_KAdKeepAliveInterval:5e3,_adInformation:Object.create(MMAdvertisentInformation),_flagStartLatencyViaPlayer:!1,_statsMetric:{version:"1.0.0",qubitData:[]},_recordIndex:0,_upshiftCount:0,_downshiftCount:0,_pbTime:0,_progressMark:0,_totalDuration:0,_buffWait:0,_sumBuffWait:0,_sumBuffWaitCIRR:0,_buffWaitType:"",_sumBuffWaitVRT:0,_prevPlayerState:0,_seekState:0,_EPState:0,_pauseStartTime:0,_pauseDuration:0,_adPlaybackTime:0,_bufferLength:0,_downloadRate:0,_downloadRateCount:0,_avgDownloadRate:0,_networkType:"",adClient:"",adURL:"",adDuration:0,adPosition:0,adLinear:!1,_adServer:"",_adCreativeMime:"",_wifiDataRate:0,frameLoss:0,_wifiSignalStrenth:0,_wifiSSID:"",_presentationWidth:0,_presentationHeight:0,_videoQuality:"",_deviceCapabilities:"",_deviceID:"",_playbackStatus:"",_bufferStartTime:0,_isBufferingState:!1,prevBitrate:0,newBitrate:0,_playerBrand:"",_playerModel:"",_playerVersion:"",_appName:"",_appVersion:"",_deviceType:"",_deviceBrand:"",_deviceModel:"",_deviceOs:"",_deviceOsVersion:"",_deviceOperator:"",_deviceMarketingName:"",_timeShift:0,_timeDeltaInMs:0,_isFirstBatch:!0,_eventToSend:[],_SESEventToSend:[],deviceIdStarz:"",_statsToSend:[],_epocTime:0,_setState:!1,_qoeMetric:{},_bwExtSet:!1,_prevSegInfo:{},_segINfoStatus:!1,_adBeforePlayback:!1,_cfVal:0,_maxSteps:0,_maxStepUp:0,_maxStepDown:0,_maxEventsInQ:40,_onLoadSentAtTS:0,_lastStatsPostedAtTS:0,_statsMonitorStartedAtTS:0,_bufferingCount:0,_subscriberType:void 0,_subscriberTag:void 0,_pbTimeBeforeAdStart:0,_adLoadTime:0,_adStartEpocTime:0,_adBuffWaitForInterval:0,_adSumBuffWait:0,_adPauseStartTime:0,_adPauseDuration:0,_adPauseDurationToOffsetFromInterval:0,_adLoadStartTime:0,_segRepeatationCount:0,_httpPostTimeout:9e4,sessionId:"",_eventMetric:{version:"1.0.0",qubitData:[]},attributes:{UPSHIFTCOUNT:"upShiftCount",DOWNSHIFTCOUNT:"downShiftCount",SDKBOOTTIME:"sdkBootuptime",STREAMFORMAT:"streamFormat",SDKVERSION:"sdkVersion",HFILEVERSION:"hFileVersion",ISLIVE:"isLive",DATASOURCE:"dataSrc",CUSTID:"custId",SESSIONID:"sessionId",CDN:"cdn",PBTIME:"pbTime",OPERATOR:"operator",NETWORKTYPE:"nwType",WIFISSID:"wifissid",WIFIDATERATE:"wifidatarate",SIGNALSTRENGTH:"signalstrength",PLATFORM:"platform",LOCATION:"location",SCREENRES:"scrnRes",BANDWIDTH:"bwInUse",LATENCY:"latency",BUFFERING:"buffWait",BUFFERINGTYPE:"buffWaitType",SUMBUFFERING:"sumBuffWait",SUMBUFFERINGCIRR:"sumBuffWaitCIRR",SUMBUFFERINGVRT:"sumBuffWaitVRT",PLAYDUR:"playDur",FRAMELOSS:"frameloss",ASSETID:"assetId",ASSETNAME:"assetName",VIDEOID:"videoId",STREAMURL:"streamURL",PLAYERVERSION:"playerVersion",MINRES:"minRes",MAXRES:"maxRes",MAXFPS:"maxFps",MINFPS:"minFps",NUMPROFILE:"numOfProfile",TOTALDURATION:"totalDuration",RESOLUTION:"res",QBRBITRATE:"qbrBitrate",CBRBITRATE:"cbrBitrate",QBRQUALITY:"qbrQual",CBRQUALITY:"cbrQual",DURATION:"dur",FPS:"fps",SEQNUM:"seqNum",STARTTIME:"startTime",PROFILENUM:"profileNum",LASTTS:"lastTS",CBRSIZE:"cbrSize",QBRSIZE:"qbrSize",PAUSEDURATION:"pauseDuration",SUBSCRIBERID:"subscriberId",DOMAINNAME:"domainName",PLAYERNAME:"playerName",QBRSDKMODE:"mode",DEVICETYPE:"device",DEVICEBRAND:"brand",DEVICEMODEL:"model",DEVICEMARKETINGNAME:"deviceMarketingName",OSVERSION:"version",SUBSCRIBERTYPE:"subscriberType",SUBSCRIBERTAG:"subscriberTag",CONTENTTYPE:"contentType",DRMPROTECTION:"drmProtection",EPISODENUMBER:"episodeNumber",GENRE:"genre",SEASON:"season",SERIESTITLE:"seriesTitle",VIDEOTYPE:"videoType",VIDEOTRACK:"videoTrack",SUBTITLETRACK:"subtitleTrack",AUDIOTRACK:"audioTrack",ISVDSACTIVE:"isVDSActive",ISSUBTITLEACTIVE:"isSubtitleActive",PROGRESSMARK:"progressMark",APPNAME:"appName",APPVERSION:"appVersion",VIDEOQUALITY:"videoQuality",DEVICECAPABILITIES:"deviceCapabilities",DEVICEID:"deviceId",PLAYBACKSTATUS:"playbackStatus"},_producerURL:void 0,_producerURLSES:void 0,sesRequirements:void 0,profiledIdSES:void 0,index:0,deviceIdStarz:"",_postInterval:10,_customTag:{},_baseServerTimeStampMS:0,_prevBitrate:-1,_streamUrl:"",_initLatancy:0},_defineProperty(S,"_adPauseStartTime",0),_defineProperty(S,"_adEpocTime",0),_defineProperty(S,"setEPState",function t(e){this._EPState=e}),_defineProperty(S,"getEPState",function t(){return this._EPState}),_defineProperty(S,"getQbrMode",function t(){return this._mode}),_defineProperty(S,"isValidStateTransition",function t(e){return!0}),_defineProperty(S,"setRegistrationStatus",function t(e){this._regStatus=e}),_defineProperty(S,"getRegistrationStatusWithBackend",function t(){return this._regStatus}),(m={})[e="postInterval"]=m[e]||{},m[e].set=function(t){this._postInterval=t},m[i="postInterval"]=m[i]||{},m[i].get=function(){return this._postInterval},m[r="producerURL"]=m[r]||{},m[r].set=function(t){this._producerURL=t},m[n="producerURL"]=m[n]||{},m[n].get=function(){return this._producerURL},m[a="recordIndex"]=m[a]||{},m[a].set=function(t){this._recordIndex=t},m[s="recordIndex"]=m[s]||{},m[s].get=function(){return this._recordIndex},m[o="upShiftCount"]=m[o]||{},m[o].set=function(t){this._upshiftCount=t},m[d="upshiftCount"]=m[d]||{},m[d].get=function(){return this._upshiftCount},m[h="downShiftCount"]=m[h]||{},m[h].set=function(t){this._downshiftCount=t},m[u="downshiftCount"]=m[u]||{},m[u].get=function(){return this._downshiftCount},m[f="qoeMetric"]=m[f]||{},m[f].set=function(t){this._qoeMetric=t},m[c="qoeMetric"]=m[c]||{},m[c].get=function(){return this._qoeMetric},m[p="eventMetric"]=m[p]||{},m[p].set=function(t){this._eventMetric=t},m[l="eventMetric"]=m[l]||{},m[l].get=function(){return this._eventMetric},_defineProperty(S,"registerMMSmartStreaming",function t(e,i,r,n,a,s){this._playerName=e,this._customerID=i,this._subscriberID=r,this._domainName=n,this._subscriberType=a,this._subscriberTag=s}),_defineProperty(S,"updateSubscriberID",function t(e){this._subscriberID=e}),_defineProperty(S,"updateSubscriber",function t(e,i,r){this._subscriberID=e,this._subscriberType=i,this._subscriberTag=r}),_defineProperty(S,"initializeSession",function t(e,i,r,n){return this._mode=e,this._httpUtil&&(this._httpUtil.cleanUp(),this._httpUtil=void 0),this._producerURL=void 0,//!my own endpoint for SES
2
+ this._producerURLSES=void 0,this.deviceIdStarz="",this.index=0,this.setRegistrationStatus("PENDING"),this._statsMetric.version=this._eventMetric.version=MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.EP_SCHEMA_VERSION,this._streamUrl=i,this._assetID=n.assetId,this._assetName=n.assetName,this._videoId=n.videoId,this._contentMetadata=n,this.setSESURL("https://mediamelon-builds.s3.amazonaws.com/MM-RELEASE-BUILDS/1185727140/files/endPoint.json"),this.initialize(),this.registerSdkWithBackend(e)}),_defineProperty(S,"registerSdkWithBackend",function t(e){var i=MMSTREAMSMARTERCONSTANTS.SDK_REGISTER_URL+this._customerID,r=MMSTREAMSMARTERCONSTANTS.SDK_CONFIG;return r.component=this._component,r.mode=e,this._httpUtil=new HttpUtil,this._httpUtil.doGet(i,r)}),_defineProperty(S,"getProfiledIdforToolbox",function t(){if(this.sesRequirements){var e=this.sesRequirements.JWT,i=new XMLHttpRequest;i.open("GET",this.sesRequirements.toolboxEndpoint_profiledId,!0),i.setRequestHeader("Access-Control-Allow-Origin","*"),i.setRequestHeader("Authorization","JWT "+e),i.onerror=function(){console.log("Error while getting profiledId for Toolbox")};var r=this;i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){var t=i.status;if(0===t||t>=200&&t<400){var e=i.response;try{r.profiledId=JSON.parse(e).result[0].id}catch(n){console.log("JSON format incorrect for profiledId -Toolbox")}}else console.log("Error while getting profiledId for Toolbox - HTTP error",t)}},i.send()}}),_defineProperty(S,"sendHearbeatToStarz",function t(){if(this.sesRequirements){var e=this.sesRequirements.sid,i=parseFloat(this._pbTime.toFixed(2)),r=this.sesRequirements.cid,n=new XMLHttpRequest;n.open("POST",this._producerURLSES+"PLAYBACK_UPDATE",!0),n.timeout=this._httpPostTimeout,n.setRequestHeader("Access-Control-Allow-Origin","*"),n.setRequestHeader("Content-type","application/json");var a=this.sesRequirements.starzEndpoint.split("track/")[1],s={apiKey:a.substring(0,a.length-1),eventType:"",deviceId:this.deviceIdStarz};s.eventType="PLAYBACK_UPDATE",s.properties={session_id:e,affiliate_name:"Dish_MX_SES",content_id:r,position_milliseconds:1e3*i};var o=JSON.stringify(s);n.onerror=function(){console.log("Error in sending heartbeat to starz")},n.send(o)}}),_defineProperty(S,"sendHeartbeatToToolbox",function t(){if(this._producerURLSES&&this.profiledId&&this.sesRequirements&&!this.sesRequirements.isStarz){this.index+=1;var e=this.index,i=this._eventMetric.qubitData[this._recordIndex].clientInfo[this.attributes.SCREENRES].split("x");i[0],i[1];var r={content:{id:this.sesRequirements.cid,drmType:"com.widevine.alpha",formatType:"application/dash+xml"},events:[],playback:{position:parseFloat(this._pbTime.toFixed(2)),timeSpent:this.getPlayDur(),bitrate:this._prevSegInfo.cbrBitrate},user:{profiledId:this.profiledId},playerID:this.deviceIdStarz};r.events.push({name:"StreamingProgress",number:e});var n=JSON.stringify(r),a=new XMLHttpRequest;a.open("POST",this._producerURLSES),a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("Access-Control-Allow-Origin","*"),a.setRequestHeader("Accept","application/json");var s=this.sesRequirements.JWT;a.setRequestHeader("Authorization","JWT "+s),a.onerror=function(){console.log("Error while sending heartbeat to Toolbox")},a.send(n)}}),_defineProperty(S,"packageToolBoxEvent",function t(e,i){if(this.sesRequirements&&!this.sesRequirements.isStarz){this.sesRequirements.isToolbox&&""==this.sesRequirements.toolboxEndpoint_profiledId&&this.getProfiledIdforToolbox();var r=e;if("ONLOAD"!==r&&"COMPLETE"!==r&&"SEEKED"!==r&&"BUFFERING"!==r&&"VideoPlaybackQualityChanged"!==r&&"ERROR"!==r&&"SEEKING"!==r&&"BUFFERING_FINISHED"!==r){this.index+=1;var n=this.index,a=this._eventMetric.qubitData[this._recordIndex].clientInfo[this.attributes.SCREENRES].split("x");a[0],a[1];var s={content:{id:this.sesRequirements.cid,drmType:"com.widevine.alpha",formatType:"application/dash+xml"},events:[],playback:{position:parseFloat(this._pbTime.toFixed(2)),timeSpent:this.getPlayDur(),bitrate:this._prevSegInfo.cbrBitrate},user:{profiledId:this.profiledId},playerID:this.deviceIdStarz};if("START"===r||"PAUSE"===r||"RESUME"===r){var o={name:r.toLowerCase(),number:n};return s.events.push(o),JSON.stringify(s)}if("SES_ERROR"!==r)return s.events.push({name:r,value:"firstquartile"===r?25:"midpoint"===r?50:"thirdquartile"===r?75:"complete"===r?95:"ended"===r?99:"COMPLETE"===r?100:"progressmark"===r?10:void 0,number:n}),JSON.stringify(s);var d={name:"playbackError",value:{errorCode:i.code,errorMessage:i.name}};return s.events.push(d),JSON.stringify(s)}}}),_defineProperty(S,"sendEventToToolbox",function t(){if(this.sesRequirements&&!this.sesRequirements.isStarz&&this._producerURLSES&&this.profiledId){this._SESEventToSend.length;for(var e=this.sesRequirements.JWT,i=0;i<this._SESEventToSend.length;i++){var r=new XMLHttpRequest;r.open("POST",this._producerURLSES,!0),r.timeout=this._httpPostTimeout,r.setRequestHeader("Access-Control-Allow-Origin","*"),r.setRequestHeader("Content-type","application/json"),r.setRequestHeader("Authorization","JWT "+e),r.setRequestHeader("Accept","application/json"),r.onerror=function(){console.log("Error while sending event to Toolbox")},r.send(this._SESEventToSend[i]),this._SESEventToSend[i]=null}this._SESEventToSend=[]}}),_defineProperty(S,"GenerateDeviceIdStarz",function t(){return"NULL"}),_defineProperty(S,"packageStarzEvent",function t(e,i){if(this.sesRequirements&&!this.sesRequirements.isToolbox){var r=this.sesRequirements.sid,n=parseFloat(this._pbTime.toFixed(2)),a=this._playerBrand,s=this._playerVersion,o=this._deviceOs,d=this._deviceOsVersion,h=this._deviceBrand,u=this._deviceModel,f=this.sesRequirements.cid,c="Dish_MX",p=this.sesRequirements.starzEndpoint.split("track/")[1],l={apiKey:p.substring(0,p.length-1),eventType:"",deviceId:this.deviceIdStarz};if("VideoPlaybackQualityChanged"===e)return l.eventType="VIDEO_PLAYBACK_QUALITY_CHANGED",l.properties={session_id:r,target_quality_resolution:i.targetQuality.width+"X"+i.targetQuality.height,target_quality_bitrate:i.targetQuality.bitrate},JSON.stringify(l);var S=e;if("PAUSE"===S||"RESUME"===S||"COMPLETE"===S||"SEEKING"===S||"SEEKED"===S||"ENDED"===S)return"PAUSE"===S?(l.eventType="PLAYBACK_PAUSED",l.properties={session_id:r,paused_position_milliseconds:1e3*n}):"RESUME"===S?(l.eventType="PLAYBACK_RESUMED",l.properties={session_id:r,resumed_position_milliseconds:1e3*n}):"COMPLETE"===S||"ENDED"===S?(l.eventType="PLAYBACK_FINISHED",l.properties={session_id:r,end_time_milliseconds:1e3*n}):"SEEKING"===S?(l.eventType="SEEK_STARTED",l.properties={session_id:r,start_position_milliseconds:1e3*n}):"SEEKED"===S&&(l.eventType="SEEK_FINISHED",l.properties={session_id:r,end_position_milliseconds:1e3*n}),JSON.stringify(l);if("ONLOAD"===S)return l.eventType="PLAYER_READY",l.properties={session_id:r,player_name:a,player_version:s,os_name:o,os_version:d,platform_name:h,platform_version:u,device_type:"PC",content_id:f},JSON.stringify(l);if("downloadFinished"===S)return l.eventType="DOWNLOAD_FINISHED",l.properties={session_id:r,http_status:i.httpStatus,success:i.success,download_time:i.downloadTime,size:i.size,attempt:i.attempt,max_attempts:i.maxAttempts,download_Type:i.downloadType},JSON.stringify(l);if("SES_ERROR"===S)return l.eventType="ERROR",l.properties={session_id:r,error_details:{code:i.code,message:i.name,content_id:f,detail:i.data},user_residency_country:"NA",user_residency_region:"NA",catalog_partner:c},JSON.stringify(l);if("SES_WARNING"===S)return l.eventType="WARNING",l.properties={session_id:r,warning_details:{code:i.code,name:i.name,timestamp:i.timestamp,data:i.data,message:i.message}},JSON.stringify(l);if("BUFFERING_FINISHED"===S)return l.eventType="BUFFERING_FINISHED",l.properties={session_id:r},JSON.stringify(l);if("BUFFERING"===S)return l.eventType="BUFFERING_STARTED",l.properties={session_id:r},JSON.stringify(l);if("START"===S)return l.eventType="PLAYBACK_STARTED",l.properties={session_id:r,startup_time_milliseconds:this._initLatency,content_id:f,affiliate_name:"Dish_MX_SES",type:"Play Button",user_residency_country:"NA",user_residency_region:"NA",catalog_partner:c},JSON.stringify(l)}}),_defineProperty(S,"sendEventToStarz",function t(){if(this.sesRequirements&&!this.sesRequirements.isToolbox&&this._producerURLSES){this._SESEventToSend.length;for(var e=0;e<this._SESEventToSend.length;e++){var i=new XMLHttpRequest,r=JSON.parse(this._SESEventToSend[e]),n=this._producerURLSES+r.eventType;i.open("POST",n,!0),i.timeout=this._httpPostTimeout,i.setRequestHeader("Access-Control-Allow-Origin","*"),i.setRequestHeader("Content-type","application/json"),i.onerror=function(){console.log("Error while sending payload to Starz")},i.send(this._SESEventToSend[e]),this._SESEventToSend[e]=null}return this._SESEventToSend=[],0}}),_defineProperty(S,"reportRegistrationSuccess",function t(e){var i,r;this.setRegistrationStatus("SUCCESS"),this._modeFromResponse=e.mode,this.setCfVal(e.cfVal),void 0===e.maxStepsUp||isNaN(e.maxStepsUp)||(i=e.maxStepsUp),void 0===e.maxStepsDown||isNaN(e.maxStepsDown)||(r=e.maxStepsDown),void 0!==i||void 0!==r||void 0===e.maxSteps||isNaN(e.maxSteps)||(i=r=e.maxSteps),this.setMaxSteps(i,r),this.reportServerTimeStamp(e.timestamp),this.reportProducer(e.producerURL,e.statsInterval),this.monitorRegistration(),this._inProgress=!0,this._simulatedEndedSent=!1}),_defineProperty(S,"setSDKQoEConfig",function t(e,i){void 0!==e&&(this._enableVideoQoE=e),void 0!==i&&(this._enableAdQoE=i)}),_defineProperty(S,"reportRegistrationFailure",function t(){this.setRegistrationStatus("FAILED"),this._producerURL=void 0,this._modeFromResponse=null,this._postInterval=-1,this._eventToSend=[],this._SESEventToSend=[],this._statsToSend=[],this.stopMonitoring()}),_defineProperty(S,"synchronizeTimestamp",function t(){this.registerSdkWithBackend(this._mode).then(function(t){var e=JSON.parse(t);e&&e.timestamp&&this.reportServerTimeStamp(e.timestamp)}).catch(function(t){})}),_defineProperty(S,"addSegInfo",function t(e){if(!(this._prevSegInfo&&-1!=e.seqNum&&this._prevSegInfo.seqNum==e.seqNum&&this._prevSegInfo.startTime===e.startTime&&this._prevSegInfo.cbrBitrate===e.cbrBitrate&&this._segRepeatationCount++<10)&&(this._prevSegInfo.cbrBitrate!==e.cbrBitrate||this._prevSegInfo.res!==e.res)){if(e.cbrBitrate)this._downloadRate>0&&(e.downloadRate=parseFloat((1024*this._downloadRate).toFixed(2))),this._bufferLength>=0&&(e.bufferLength=parseInt(this._bufferLength)),e.cbrSize?e.dur<0&&(e.cbrSize=e.qbrSize=0):e.dur>0?e.cbrSize=e.qbrSize=e.dur*e.cbrBitrate:e.cbrSize=e.qbrSize=0,e.timestamp=this.getCorrectedCurrentTimeinMs(),void 0!==e.qbrBitrate&&delete e.qbrBitrate,void 0!==e.qbrQual&&delete e.qbrQual,void 0!==e.cbrQual&&delete e.cbrQual,void 0!==e.dur&&delete e.dur,void 0!==e.seqNum&&delete e.seqNum,void 0!==e.startTime&&delete e.startTime,void 0!==e.fps&&delete e.fps,void 0!==e.profileNum&&delete e.profileNum,void 0!==e.cbrProfileNum&&delete e.cbrProfileNum,void 0!==e.qbrSize&&delete e.qbrSize,void 0!==e.bufferLength&&delete e.bufferLength,void 0!==e.cbrSize&&e.cbrSize<=0&&delete e.cbrSize,void 0!==e.vCodec&&""===e.vCodec&&delete e.vCodec,void 0!==e.aCodec&&""===e.aCodec&&delete e.aCodec,this._statsMetric.qubitData[this._recordIndex].segInfo.push(e),this._prevSegInfo=e.constructor===Array?e[length-1]:e,this._segINfoStatus=!0,this._segRepeatationCount=0}}),_defineProperty(S,"setBandwidth",function t(e){void 0!==e&&e>0&&(this._downloadRate=e/1024,this._downloadRateCount=this._downloadRateCount+1,this._avgDownloadRate=this._downloadRate+this._avgDownloadRate)}),_defineProperty(S,"reportBufferLength",function t(e){e>=0&&(this._bufferLength=e)}),_defineProperty(S,"clearAdInfo",function t(){delete this._eventMetric.qubitData[this._recordIndex].adInfo}),_defineProperty(S,"setCustomTag",function t(e,i){void 0===this._eventMetric.qubitData[this._recordIndex].customTags&&(this._eventMetric.qubitData[this._recordIndex].customTags={}),void 0===this._statsMetric.qubitData[this._recordIndex].customTags&&(this._statsMetric.qubitData[this._recordIndex].customTags={});var r=this._eventMetric.qubitData[this._recordIndex].customTags;r[e]=i,this._eventMetric.qubitData[this._recordIndex].customTags=r,this._statsMetric.qubitData[this._recordIndex].customTags=r}),_defineProperty(S,"reportContentMetadata",function t(e){void 0!==e.assetId&&null!==e.assetId&&this.setContentMetadata(this.attributes.ASSETID,e.assetId),void 0!==e.assetName&&null!==e.assetName&&this.setContentMetadata(this.attributes.ASSETNAME,e.assetName),e.videoId&&this.setContentMetadata(this.attributes.VIDEOID,e.videoId),e.contentType&&this.setContentMetadata(this.attributes.CONTENTTYPE,e.contentType),e.drmProtection&&this.setContentMetadata(this.attributes.DRMPROTECTION,e.drmProtection),e.episodeNumber&&this.setContentMetadata(this.attributes.EPISODENUMBER,e.episodeNumber),e.genre&&this.setContentMetadata(this.attributes.GENRE,e.genre),e.season&&this.setContentMetadata(this.attributes.SEASON,e.season),e.seriesTitle&&this.setContentMetadata(this.attributes.SERIESTITLE,e.seriesTitle),e.videoType&&this.setContentMetadata(this.attributes.VIDEOTYPE,e.videoType)}),_defineProperty(S,"setContentMetadata",function t(e,i){null!=i&&(this._statsMetric.qubitData[this._recordIndex].contentMetadata[e]=i,this._eventMetric.qubitData[this._recordIndex].contentMetadata[e]=i)}),_defineProperty(S,"reportNetworkType",function t(e){e&&(this._networkType=e,this.setClientInfo(this.attributes.NETWORKTYPE,this._networkType))}),_defineProperty(S,"reportDeviceType",function t(e){this._deviceType=e}),_defineProperty(S,"setCfVal",function t(e){this._cfVal=e}),_defineProperty(S,"getCfVal",function t(){return this._cfVal}),_defineProperty(S,"setMaxSteps",function t(e,i){e>=0&&(this._maxStepUp=e),i>=0&&(this._maxStepDown=i)}),_defineProperty(S,"getMaxStepsToSwitch",function t(){return[this._maxStepUp,this._maxStepDown]}),_defineProperty(S,"reportWifiSSID",function t(e){e&&(this._wifiSSID=e,this.setClientInfo(this.attributes.WIFISSID,this._wifiSSID))}),_defineProperty(S,"reportWifiSignalStrenthPercentage",function t(e){e&&(this._wifiSignalStrenth=e,this.setClientInfo(this.attributes.SIGNALSTRENGTH,this._wifiSignalStrenth))}),_defineProperty(S,"reportWifiDataRate",function t(e){e&&(this._wifiDataRate=e,this.setClientInfo(this.attributes.WIFIDATERATE,this._wifiDataRate))}),_defineProperty(S,"reportServerTimeStamp",function t(e){this._baseServerTimeStampMS=e,this.setCurrentTimeDelta()}),_defineProperty(S,"reportProducer",function t(e,i){this._producerURL=e,this._postInterval=i}),_defineProperty(S,"reportProducerForSES",function t(e){this._producerURLSES=e,this.deviceIdStarz=this.GenerateDeviceIdStarz()}),_defineProperty(S,"reportMode",function t(e){this._mode=e,this.setStreamID(this.attributes.QBRSDKMODE,this._mode),this.sendEventInfo()}),_defineProperty(S,"reportAssetID",function t(e,i,r){e&&(this._assetID=e),i&&(this._assetName=i),r&&(this._videoId=r)}),_defineProperty(S,"reportPresentationSize",function t(e,i){this._presentationWidth=e,this._presentationHeight=i}),_defineProperty(S,"reportFrameLoss",function t(e){this.frameloss=e,this.setPBStats(this.attributes.FRAMELOSS,this.frameloss)}),_defineProperty(S,"reportABRSwitch",function t(e,i){e<i?this._upshiftCount++:e>i&&this._downshiftCount++,this.setSegInfo(this.attributes.CBRBITRATE,i)}),_defineProperty(S,"monitorRegistration",function t(){this.sendEventInfo(),this.sendQueuedStats(),this.startMonitoring()}),_defineProperty(S,"sendQueuedStats",function t(){if(void 0!==this._producerURL){for(var e=0;e<this._statsToSend.length;e++){var i=this._statsToSend[e],r=new XMLHttpRequest;r.open("POST",this._producerURL,!0),r.timeout=this._httpPostTimeout,r.setRequestHeader("Access-Control-Allow-Origin","*"),r.setRequestHeader("Content-type","application/json"),r.send(i),this._lastStatsPostedAtTS=this.getCurrentTimeinMs(),this._statsToSend[e]=null}this._statsToSend=[]}}),_defineProperty(S,"reportPlayerInfo",function t(e,i,r){this._playerBrand=e,this._playerModel=i,this._playerVersion=r}),_defineProperty(S,"reportAppInfo",function t(e,i){this._appName=e,this._appVersion=i}),_defineProperty(S,"reportDeviceCapabilities",function t(e){this._deviceCapabilities=e}),_defineProperty(S,"reportVideoQuality",function t(e){this._videoQuality=e}),_defineProperty(S,"reportManifestLoaded",function t(e){this.notifyEvent("MANIFEST_LOADED","Manifest Load Complete","MANIFEST_LOADED",this._pbTime)}),_defineProperty(S,"reportDeviceId",function t(e){this._deviceID=e}),_defineProperty(S,"reportDeviceInfo",function t(e,i,r,n,a,s,o,d){e&&(this._deviceBrand=e),i&&(this._deviceModel=i),r&&(this._deviceOs=r),n&&(this._deviceOsVersion=n),a&&(this._deviceOperator=a),o&&(this._presentationWidth=o),d&&(this._presentationHeight=d),s&&(this._deviceMarketingName=s),this.setScreenRes()}),_defineProperty(S,"reportMetricValue",function t(e,i){e===MMOverridableMetric.Latency?(this._initLatency=parseFloat(i.toFixed(2)),this._flagStartLatencyViaPlayer=!0):e===MMOverridableMetric.ServerAddress?this.setClientInfo(this.attributes.CDN,i):MMOverridableMetric.DurationWatched}),_defineProperty(S,"reportAdBufferingStarted",function t(){if(this._adInformation&&this._adInformation._playSent&&!this._isBufferingState){this._isBufferingState=!0;var e=this.getCurrentTimeinMs();populateAdRelatedInfo(e),this._bufferStartTime=e,this.setBufPBEvent(this.attributes.SUMBUFFERING,this._adSumBuffWait),notifyEvent("AD_BUFFERING","Ad Buffering started","AD_BUFFERING",null),_adInformation._adLastAdEventTimeStamp=e}}),_defineProperty(S,"reportAdBufferingCompleted",function t(){if(this._adInformation&&_adInformation._playSent&&!1!=this._isBufferingState&&(this._playbackStatus="AD_BUFFERING_COMPLETE",this._isBufferingState=!1,this._prevPlayerState===MMPlayerState.PLAYING)){var e=this.getCurrentTimeinMs();this._bufferStartTime&&(this._adBuffWaitForInterval=e-this._bufferStartTime,this._adSumBuffWait=this._adSumBuffWait+this._adBuffWaitForInterval,this.setPBStats(this.attributes.BUFFERING,this._adBuffWaitForInterval),this.setBufPBEvent(this.attributes.SUMBUFFERING,this._adSumBuffWait),this._bufferStartTime=0)}}),_defineProperty(S,"reportBufferingStarted",function t(){this.getEPState()===MMExperienceProbeState.STARTED&&!this._isBufferingState&&(this._isBufferingState=!0,this._bufferStartTime=this.getCurrentTimeinMs(),this._bufferingCount++,this.setBufPBEvent(this.attributes.SUMBUFFERING,this._sumBuffWait),this.setBufPBEvent(this.attributes.SUMBUFFERINGCIRR,this._sumBuffWaitCIRR),this.setBufPBEvent(this.attributes.SUMBUFFERINGVRT,this._sumBuffWaitVRT),this.notifyEvent("BUFFERING_START","Playback Buffering Started","BUFFERING_START",this._pbTime))}),_defineProperty(S,"reportBufferingCompleted",function t(){this.getEPState()===MMExperienceProbeState.STARTED&&(this.notifyEvent("BUFFERING_COMPLETE","Playback Buffering Completed","BUFFERING_COMPLETE",this._pbTime),this._isBufferingState=!1,this.setBuffering())}),_defineProperty(S,"reportEventWithValue",function t(e,i){this.notifyEvent(e,i,e,this._pbTime)}),_defineProperty(S,"reportUserInitiatedPlayback",function t(){var e=this.getCurrentTimeinMs();this.getEPState()===MMExperienceProbeState.INITIALIZED?(this._latencyStartTime=e,this.notifyEvent("ONLOAD","Player Initializing..","ONLOAD",0),this.notifyPackager("ONLOAD"),this.setEPState(MMExperienceProbeState.ONLOAD_SENT)):console.log("Warn: State not valid")}),_defineProperty(S,"reportPlayerState",function t(e){var i=this.getEPState(),r=this.getCurrentTimeinMs();this.setBufPBEvent(this.attributes.SUMBUFFERING,this._sumBuffWait),this.setBufPBEvent(this.attributes.SUMBUFFERINGCIRR,this._sumBuffWaitCIRR),this.setBufPBEvent(this.attributes.SUMBUFFERINGVRT,this._sumBuffWaitVRT);var n=!1,a=!1;switch(e){case MMPlayerState.PLAYING:if(this._seekState=SeekState.Playing,this._prevPlayerState==MMPlayerState.PAUSED&&i===MMExperienceProbeState.ONLOAD_SENT&&(this._pauseDuration=r-this._pauseStartTime,this.setBufPBEvent(this.attributes.PAUSEDURATION,this._pauseDuration),this._pauseStartTime=0,this.notifyEvent("RESUME","Playback resumed","RESUME",this._pbTime),this.startMonitoring(),this._initLatency=this._initLatency-this._pauseDuration,a=!0),i===MMExperienceProbeState.ONLOAD_SENT){if(!this._flagStartLatencyViaPlayer){var s=r-this._latencyStartTime;this._initLatency=s,this._adBeforePlayback&&this._adInformation&&this._initLatency>0&&(this._adLoadTime>0&&(this._initLatency-=this._adLoadTime),this._initLatency>0&&this._adInformation._adDuration>0&&(this._initLatency-=this._adInformation._adDuration),this._initLatency>0&&this._adPauseDuration>0&&(this._initLatency-=this._adPauseDuration)),this._initLatency<0&&(this._initLatency=0)}this._epocTime=r,this._statsMonitorStartedAtTS||(this._statsMonitorStartedAtTS=r),this.setPBStats(this.attributes.LATENCY,this._initLatency),this.setEPState(MMExperienceProbeState.STARTED),this.notifyPackager("START"),this._adBeforePlayback?this.notifyEvent("START_AFTER_AD","Playback Started after ad","START_AFTER_AD",this._pbTime):this.notifyEvent("START","Playback Start","START",this._pbTime),this._latencyStartTime=0,this.startMonitoring(),a=!0,this._pbTimeBeforeAdStart=this._pbTime}else if(i===MMExperienceProbeState.STARTED&&this._prevPlayerState===MMPlayerState.PAUSED)this._pauseStartTime&&(this._pauseDuration=r-this._pauseStartTime,this.setBufPBEvent(this.attributes.PAUSEDURATION,this._pauseDuration),this._epocTime+=this._pauseDuration,this._pauseStartTime=0,this._bufferStartTime=r,this.notifyEvent("RESUME","Playback resumed","RESUME",this._pbTime),this.notifyPackager("RESUME"),this._isBufferingState&&(this._isBufferingState=!1,n=!0),this.startMonitoring(),a=!0,this._pbTimeBeforeAdStart=this._pbTime);else if(i===MMExperienceProbeState.STOPPED&&this._prevPlayerState===MMPlayerState.STOPPED){var o=this.getStreamInfo(),d=this.getStreamId(),h=this._mode;this.reset(),this.initialize(),this.reportMode(h),this.setPresentationStreamInfo(o.maxRes,o.minRes,o.maxFps,o.minFps,o.numOfProfile,o.streamFormat),this.setVideoDuration(o.totalDuration),this.setPresentationType(d.isLive),this.setEPState(MMExperienceProbeState.INITIALIZED),this.reportUserInitiatedPlayback(),this.reportPlayerState(MMPlayerState.PLAYING),this.setEPState(MMExperienceProbeState.STARTED),a=!0}break;case MMPlayerState.PAUSED:(i===MMExperienceProbeState.STARTED||i===MMExperienceProbeState.ONLOAD_SENT)&&(this.sendQBRStats(),this._pauseStartTime=r,this.notifyEvent("PAUSE","Playback Paused","PAUSE",this._pbTime),this.notifyPackager("PAUSE"),this.stopMonitoring(),a=!0,this._pbTimeBeforeAdStart=this._pbTime);break;case MMPlayerState.STOPPED:if(!0===this._simulatedEndedSent||i===MMExperienceProbeState.STOPPED||void 0===this._prevPlayerState||this._prevPlayerState===MMPlayerState.STOPPED)break;this.startMonitoring();var u=this._sumBuffWait+this._initLatency;this.setBufPBEvent(this.attributes.SUMBUFFERING,u),this._totalDuration&&this.sendQBRStats(),this._totalDuration<=0||this._pbTime<.9*this._totalDuration?(this.notifyEvent("ENDED","Playback completion","ENDED",this._pbTime),this.notifyPackager("ENDED")):(this.notifyEvent("COMPLETE","Playback completion","COMPLETE",this._pbTime),this.notifyPackager("COMPLETE")),this.stopMonitoring(),this._inProgress=!1,this.setEPState(MMExperienceProbeState.STOPPED),a=!0;break;default:MMLogger.log("INFO","Unknown State");return}a&&(this._prevPlayerState=e),n&&this.reportBufferingStarted()}),_defineProperty(S,"reportError",function t(e,i){this.setPlaybackPos(i),this.getEPState()>=MMExperienceProbeState.ONLOAD_SENT&&this.notifyEvent("ERROR",e,"ERROR",this._pbTime)}),_defineProperty(S,"isValid",function t(e){return null!=e&&e.length}),_defineProperty(S,"reportResolutionChange",function t(e){this.notifyEvent("RESIZE",e,"RESIZE",this._pbTime)}),_defineProperty(S,"reportVolumeChange",function t(e){this.notifyEvent("VOLUME_CHANGE",e,"VOLUME_CHANGE",this._pbTime)}),_defineProperty(S,"reportPlaybackRateChange",function t(){this.notifyEvent("RATE_CHANGE","Playback Rate Changed","RATE_CHANGE",this._pbTime)}),_defineProperty(S,"reportDurationChange",function t(){this.notifyEvent("DURATION_CHANGE","Playback Duration Changed","DURATION_CHANGE",this._pbTime)}),_defineProperty(S,"reportPlayerSeekStarted",function t(){this._seekState=SeekState.SeekStarted,this.notifyEvent("SEEK_START","Playback Seek Started","SEEK_START",this._pbTime)}),_defineProperty(S,"reportPlayerSeekCompleted",function t(e){var i=this.getCurrentTimeinMs();this.getEPState()===MMExperienceProbeState.STARTED&&(this._pauseStartTime&&(this._epocTime+=i-this._pauseStartTime),this.setPlaybackPos(e),this._seekState=SeekState.SeekCompleted,this.notifyEvent("SEEK_COMPLETE","Playback Seek Completed","SEEK_COMPLETE",e/1e3),this.notifyPackager("SEEKED"),this._pauseStartTime&&(this._epocTime-=i-this._pauseStartTime))}),_defineProperty(S,"reset",function t(){this._inProgress&&this.getEPState()===MMExperienceProbeState.STARTED&&(this.reportPlayerState(MMPlayerState.STOPPED),this._inProgress=!1,this._simulatedEndedSent=!0),this._mode=null,this._bufferLength=0,this._downloadRate=0,this._downloadRateCount=0,this._avgDownloadRate=0,this._isFirstBatch=!0,this._onLoadSentAtTS=0,this._lastStatsPostedAtTS=0,this._statsMonitorStartedAtTS=0,this._bufferingCount=0,this._recordIndex=0,this._prevBitrate=-1,this._upshiftCount=0,this._pbTime=0,this._progressMark=0,this._pbTimeBeforeAdStart=0,this._downshiftCount=0,this._playDur=0,this._baseServerTimeStampMS=0,this._totalDuration=0,this._buffWait=0,this._sumBuffWait=0,this._sumBuffWaitCIRR=0,this._buffWaitType="",this._sumBuffWaitVRT=0,this._initLatency=0,this._latencyStartTime=0,this._enableEP=!1,this._flagStartLatencyViaPlayer=!1,this._prevPlayerState=void 0,this._prevSegInfo={},this._pauseStartTime=0,this._pauseDuration=0,this._adPlaybackTime=0,this.adDuration=0,this.adPosition=0,this._adBeforePlayback=!1,this._bufferStartTime=0,this._isBufferingState=!1,this.newBitrate=0,this._epocTime=0,this._qoeMetric={},this._statsMetric.qubitData=[],this._eventMetric.qubitData=[],this._statsMetric.qubitData.push(this.QBRMetricTemplate()),this._eventMetric.qubitData.push(this.EventMetricTemplate()),this._eventToSend=[],this._SESEventToSend=[],this.deviceIdStarz="",this._statsToSend=[],this.sessionId="",this._segRepeatationCount=0,this._maxSteps=0,this._maxStepUp=0,this._maxStepDown=0,this.index=0,this.setEPState(MMExperienceProbeState.IDLE)}),_defineProperty(S,"initialize",function t(){this.setStreamID(this.attributes.CUSTID,parseInt(this._customerID)),this.setStreamID(this.attributes.DATASOURCE,"Player"),this.setStreamID(this.attributes.PLAYERNAME,this._playerName),this.sessionId=this.getSessionId(),this.deviceIdStarz=this.GenerateDeviceIdStarz(),this.setStreamID(this.attributes.SESSIONID,this.sessionId),this.setStreamID(this.attributes.DOMAINNAME,this.getDomainName()),this.setStreamID(this.attributes.STREAMURL,this._streamUrl),this.setStreamID(this.attributes.PLAYERVERSION,this._playerVersion),this.setSDKInfo(this.attributes.SDKVERSION,this._sdkVersion),this.setSDKInfo(this.attributes.HFILEVERSION,this._hintFileVersion),this.setClientInfo(this.attributes.DEVICETYPE,this._deviceType),this.setClientInfo(this.attributes.DEVICEBRAND,this._deviceBrand),this.setClientInfo(this.attributes.DEVICEMODEL,this._deviceModel),this.setClientInfo(this.attributes.OSVERSION,this._deviceOsVersion),this.setClientInfo(this.attributes.PLATFORM,this._deviceOs),this.setClientInfo(this.attributes.OPERATOR,this._deviceOperator),this.setClientInfo(this.attributes.NETWORKTYPE,this._networkType),this.setClientInfo(this.attributes.WIFISSID,this._wifiSSID),this.setClientInfo(this.attributes.WIFIDATERATE,this._wifiDataRate),this.setClientInfo(this.attributes.SIGNALSTRENGTH,this._wifiSignalStrenth),this.setClientInfo(this.attributes.APPNAME,this._appName),this.setClientInfo(this.attributes.APPVERSION,this._appVersion),this.setClientInfo(this.attributes.DEVICEMARKETINGNAME,this._deviceMarketingName),this.setSubscriberID(),this.setSubscriberType(),this.setSubscriberTag(),this.setAssetID(),this.reportContentMetadata(this._contentMetadata),this.setScreenRes(),this.setEPState(MMExperienceProbeState.INITIALIZED)}),_defineProperty(S,"getSessionId",function t(){var e=new Date().getTime(),i="xxxxxyyxxxyyxxxyxxx-ymxyxxyxxyxx-".replace(/[xy]/g,function(t){var i=(e+32*Math.random())%32|0;return e=Math.floor(e/32),("x"==t?i:3&i|8).toString(32)});return i+=new Date().getTime(),this._playerName&&(i+="_"+this._playerName),this._playerBrand&&(i+="_"+this._playerBrand),this._playerModel&&(i+="_"+this._playerModel),this._playerVersion&&(i+="_"+this._playerVersion),i=(i=i.replace(/\//gi,"_")).replace(/\s/gi,"_")}),_defineProperty(S,"getDomainName",function t(){return this.isValid(this._domainName)||(this._domainName=this.getDefaultDomainName()),this._domainName}),_defineProperty(S,"getDefaultDomainName",function t(){return"NA"}),_defineProperty(S,"isEmpty",function t(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0}),_defineProperty(S,"getCustomTag",function t(e){return this._customTag[e]}),_defineProperty(S,"notifyPackager",function t(e,i){var r;this.sesRequirements&&(this&&this.sesRequirements.isToolbox&&((r="SES_ERROR"===e||"SES_WARNING"===e?this.packageToolBoxEvent(e,i):this.packageToolBoxEvent(e,this._pbTime))&&this._SESEventToSend.push(r),this.sendEventToToolbox()),this&&this.sesRequirements.isStarz&&((r="VideoPlaybackQualityChanged"===e||"SES_ERROR"===e||"downloadFinished"===e||"SES_WARNING"===e?this.packageStarzEvent(e,i):this.packageStarzEvent(e,this._pbTime))&&this._SESEventToSend.push(r),this.sendEventToStarz()))}),_defineProperty(S,"setSESRequirements",function t(e){this.sesRequirements=e}),_defineProperty(S,"setSESURL",function t(e){if(this.sesRequirements){var i=new XMLHttpRequest;i.open("GET",e,!0);var r=this;i.onload=function(){if(200===i.status){var t=JSON.parse(i.response);r.sesRequirements.isToolbox?(r.reportProducerForSES(t.toolboxEndpoint_events),r.sesRequirements.toolboxEndpoint_events=t.toolboxEndpoint_events,r.sesRequirements.toolboxEndpoint_profiledId=t.toolboxEndpoint_profiledId,r.getProfiledIdforToolbox()):r.sesRequirements.isStarz&&(r.reportProducerForSES(t.starzEndpoint),r.sesRequirements.starzEndpoint=t.starzEndpoint)}else console.log("Error while fetching MM URL tracker file "+i.response)},i.send()}}),_defineProperty(S,"notifyEvent",function t(e,i,r,n){if("object"===_typeof(i)&&(i="Unknown error took place: "+i),"FAILED"!==this._regStatus&&this&&this._eventMetric&&this._eventMetric.qubitData&&!(this._recordIndex<0)&&this._eventMetric.qubitData[this._recordIndex]&&this._eventMetric.qubitData[this._recordIndex].clientInfo&&this.attributes&&this.attributes.SCREENRES){this._eventMetric.playDur=this.getPlayDur();var a=this._eventMetric.qubitData[this._recordIndex].clientInfo[this.attributes.SCREENRES];0!==e.indexOf("AD_")?this.clearAdInfo():(void 0!==this._adInformation._adResolution&&(this._eventMetric.qubitData[this._recordIndex].clientInfo[this.attributes.SCREENRES]=this._adInformation._adResolution),this._eventMetric.playDur=parseInt(this.getAdPlayDur())),n=n?parseFloat(n):parseFloat(0),this._eventMetric.playDur||(this._eventMetric.playDur=0),this._eventMetric.qubitData[this._recordIndex].pbEventInfo.event=e,this._eventMetric.qubitData[this._recordIndex].pbEventInfo.desc=i,this._eventMetric.qubitData[this._recordIndex].pbEventInfo.id=r,this._eventMetric.qubitData[this._recordIndex].pbEventInfo.pbTime=parseFloat(n.toFixed(2)),this._qoeMetric.timestamp=this._eventMetric.timestamp=this.getCorrectedCurrentTimeinMs(),this._totalDuration>0&&(this._progressMark=this._pbTime/this._totalDuration*100,this._qoeMetric[this.attributes.PROGRESSMARK]=parseFloat(this._progressMark.toFixed(2))),this._eventMetric.interval=this._postInterval,this._eventMetric.pbTime=parseFloat(n.toFixed(2)),Object.keys(this._qoeMetric).length&&this._eventMetric.qubitData[this._recordIndex].pbInfo.push(this._qoeMetric),this._eventMetric.qubitData[this._recordIndex].pbInfo[0].hasOwnProperty(this.attributes.BUFFERING)&&delete this._eventMetric.qubitData[this._recordIndex].pbInfo[0][this.attributes.BUFFERING],this._eventMetric.qubitData[this._recordIndex].pbInfo[0].hasOwnProperty(this.attributes.UPSHIFTCOUNT)&&delete this._eventMetric.qubitData[this._recordIndex].pbInfo[0][this.attributes.UPSHIFTCOUNT],this._eventMetric.qubitData[this._recordIndex].pbInfo[0].hasOwnProperty(this.attributes.DOWNSHIFTCOUNT)&&delete this._eventMetric.qubitData[this._recordIndex].pbInfo[0][this.attributes.DOWNSHIFTCOUNT];var s=JSON.parse(JSON.stringify(this._eventMetric));this._eventToSend.push(s),this.sendEventInfo(),this._eventMetric.qubitData[this._recordIndex].clientInfo[this.attributes.SCREENRES]=a,this._eventMetric.qubitData[this._recordIndex].adInfo=void 0,this._eventMetric.qubitData[this._recordIndex].pbEventInfo={},this._eventMetric.qubitData[this._recordIndex].pbInfo=[],this._playbackStatus=e,this._qoeMetric.hasOwnProperty(this.attributes.LATENCY)&&delete this._qoeMetric[this.attributes.LATENCY],this._qoeMetric.hasOwnProperty(this.attributes.PAUSEDURATION)&&delete this._qoeMetric[this.attributes.PAUSEDURATION]}}),_defineProperty(S,"downShift",function t(){this._downshiftCount++}),_defineProperty(S,"upShift",function t(){this._upshiftCount++}),_defineProperty(S,"getInitialDelay",function t(){return this._initLatency}),_defineProperty(S,"getBuffWait",function t(){return this._sumBuffWait}),_defineProperty(S,"getBufferingCount",function t(){return this._bufferingCount}),_defineProperty(S,"setStreamID",function t(e,i){null!=i&&(this._statsMetric.qubitData[this._recordIndex].streamID[e]=i,this._eventMetric.qubitData[this._recordIndex].streamID[e]=i)}),_defineProperty(S,"setMode",function t(e){void 0!==e&&String(e).length>0&&(statsMetric.qubitData[this._recordIndex].streamID.mode=e,eventMetric.qubitData[this._recordIndex].streamID.mode=e)}),_defineProperty(S,"setClientInfo",function t(e,i){this._eventMetric.qubitData&&(void 0===this._eventMetric.qubitData[this._recordIndex].clientInfo&&(this._eventMetric.qubitData[this._recordIndex].clientInfo={}),void 0===this._statsMetric.qubitData[this._recordIndex].clientInfo&&(this._statsMetric.qubitData[this._recordIndex].clientInfo={}),i&&(this._statsMetric.qubitData[this._recordIndex].clientInfo[e]=i,this._eventMetric.qubitData[this._recordIndex].clientInfo[e]=i))}),_defineProperty(S,"setPlaybackPos",function t(e){this._pbTime=e/1e3}),_defineProperty(S,"getPlaybackPos",function t(){return this._pbTime}),_defineProperty(S,"setPBStats",function t(e,i){if(e!==this.attributes.LATENCY){var r={};r.timestamp=this.getCorrectedCurrentTimeinMs(),r[e]=parseFloat(i.toFixed(2)),r[this.attributes.PBTIME]=parseFloat(this._pbTime.toFixed(2)),this._totalDuration>0&&(this._progressMark=this._pbTime/this._totalDuration*100,r[this.attributes.PROGRESSMARK]=parseFloat(this._progressMark.toFixed(2))),e===this.attributes.BUFFERING&&(r[this.attributes.BUFFERINGTYPE]=this._buffWaitType),this._statsMetric.qubitData[this._recordIndex].pbInfo.push(r)}(i||e==this.attributes.LATENCY)&&(this._qoeMetric[e]=parseFloat(i.toFixed(2)))}),_defineProperty(S,"setBufPBEvent",function t(e,i){i&&(e in this._qoeMetric&&e===this.attributes.BUFFERING?this._qoeMetric[e]=parseInt(i):this._qoeMetric[e]=i)}),_defineProperty(S,"setSDKInfo",function t(e,i){i&&(this._statsMetric.qubitData[this._recordIndex].sdkInfo[e]=i,this._eventMetric.qubitData[this._recordIndex].sdkInfo[e]=i)}),_defineProperty(S,"getPBStats",function t(e){return this._qoeMetric[e]}),_defineProperty(S,"setDiagnostics",function t(e,i){i&&(this._statsMetric.qubitData[this._recordIndex].diagnostics[e]=i)}),_defineProperty(S,"setStreamInfo",function t(e,i){void 0!==e&&void 0!==i&&(this._statsMetric.qubitData[this._recordIndex].streamInfo[e]=i,this._eventMetric.qubitData[this._recordIndex].streamInfo[e]=i)}),_defineProperty(S,"getStreamInfo",function t(){return this._statsMetric.qubitData[this._recordIndex].streamInfo}),_defineProperty(S,"getStreamId",function t(){return this._statsMetric.qubitData[this._recordIndex].streamID}),_defineProperty(S,"setSegInfo",function t(e,i){i&&(this._statsMetric.qubitData[this._recordIndex].segInfo[e]=i)}),_defineProperty(S,"setScreenRes",function t(){var e="";this.isValid(this._presentationHeight)&&this.isValid(this._presentationWidth)||this._presentationHeight>0&&this._presentationWidth>0?e=this._presentationWidth+"x"+this._presentationHeight:window.innerWidth&&window.innerHeight&&(e=window.innerWidth+"x"+window.innerHeight),this.setClientInfo(this.attributes.SCREENRES,e),this.setClientInfo(this.attributes.VIDEOQUALITY,this._videoQuality),this.setClientInfo(this.attributes.DEVICEID,this._deviceID),this._deviceCapabilities&&this.setClientInfo(this.attributes.DEVICECAPABILITIES,this._deviceCapabilities)}),_defineProperty(S,"setAssetID",function t(){void 0!==this._assetID&&null!==this._assetID&&this.setStreamID(this.attributes.ASSETID,this._assetID),void 0!==this._assetName&&null!==this._assetName&&this.setStreamID(this.attributes.ASSETNAME,this._assetName),this._videoId&&this.setStreamID(this.attributes.VIDEOID,this._videoId)}),_defineProperty(S,"setSubscriberIDCookie",function t(e,i,r){var n=e+"="+encodeURIComponent(i);"number"==typeof r&&(n+="; max-age="+86400*r,document.cookie=n)}),_defineProperty(S,"getSubscriberIDCookie",function t(e){for(var i=document.cookie.split(";"),r=0;r<i.length;r++){var n=i[r].split("=");if(e==n[0].trim())return decodeURIComponent(n[1])}return null}),_defineProperty(S,"uuidv4_subscriberID",function t(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})}),_defineProperty(S,"checkSubscriberIDCookie",function t(){var e=this.getSubscriberIDCookie("subscrId");null!=e||""==(e=this.uuidv4_subscriberID())||null==e||this.setSubscriberIDCookie("subscrId",e,730),""!=e&&null!=e&&this.setStreamID(this.attributes.SUBSCRIBERID,MMMD5().mm_md5(e))}),_defineProperty(S,"setSubscriberID",function t(){this._subscriberID&&this.setStreamID(this.attributes.SUBSCRIBERID,MMMD5().mm_md5(this._subscriberID))}),_defineProperty(S,"setSubscriberType",function t(){this._subscriberType&&this.setStreamID(this.attributes.SUBSCRIBERTYPE,this._subscriberType)}),_defineProperty(S,"setSubscriberTag",function t(){this._subscriberTag&&this.setStreamID(this.attributes.SUBSCRIBERTAG,this._subscriberTag)}),_defineProperty(S,"setVideoDuration",function t(e){e&&(this._totalDuration=e,this.setStreamInfo(this.attributes.TOTALDURATION,parseFloat(e.toFixed(2))))}),_defineProperty(S,"setPresentationType",function t(e){this.setStreamID(this.attributes.ISLIVE,e)}),_defineProperty(S,"setPresentationStreamInfo",function t(e,i,r,n,a,s){this.setStreamInfo(this.getAttribute().MAXRES,e),this.setStreamInfo(this.getAttribute().MINRES,i),this.setStreamInfo(this.getAttribute().MAXFPS,parseFloat(r)),this.setStreamInfo(this.getAttribute().MINFPS,parseFloat(n)),this.setStreamInfo(this.getAttribute().NUMPROFILE,a),this.setStreamInfo(this.getAttribute().STREAMFORMAT,s)}),_defineProperty(S,"reportTrackinfo",function t(e,i,r,n,a){this.setStreamInfo(this.getAttribute().VIDEOTRACK,e),this.setStreamInfo(this.getAttribute().SUBTITLETRACK,i),this.setStreamInfo(this.getAttribute().AUDIOTRACK,r),this.setStreamInfo(this.getAttribute().ISVDSACTIVE,n),this.setStreamInfo(this.getAttribute().ISSUBTITLEACTIVE,a)}),_defineProperty(S,"reportComponent",function t(e){this._component=e}),_defineProperty(S,"reportSDKVersion",function t(e){this._sdkVersion=MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.sdkVersion+e}),_defineProperty(S,"getSDKVersion",function t(){return this._sdkVersion}),_defineProperty(S,"reportHintFileVersion",function t(e){this._hintFileVersion=e}),_defineProperty(S,"setBuffering",function t(){var e=this.getCurrentTimeinMs();this._bufferStartTime&&(this._buffWait=e-this._bufferStartTime,this._sumBuffWait=this._sumBuffWait+this._buffWait,this._seekState===SeekState.SeekStarted||this._seekState===SeekState.SeekCompleted?(this._sumBuffWaitVRT=this._sumBuffWaitVRT+this._buffWait,this._buffWaitType="VRT"):(this._sumBuffWaitCIRR=this._sumBuffWaitCIRR+this._buffWait,this._buffWaitType="CIRR"),this.setPBStats(this.attributes.BUFFERING,this._buffWait),this.setBufPBEvent(this.attributes.SUMBUFFERING,this._sumBuffWait),this.setBufPBEvent(this.attributes.SUMBUFFERINGCIRR,this._sumBuffWaitCIRR),this.setBufPBEvent(this.attributes.SUMBUFFERINGVRT,this._sumBuffWaitVRT),this._bufferStartTime=0)}),_defineProperty(S,"setCurrentTimeDelta",function t(){var e=new Date().getTime();this._baseServerTimeStampMS&&(this._baseServerTimeStampMS>e?(this._timeShift=-1,this._timeDeltaInMs=this._baseServerTimeStampMS-e):(this._timeShift=1,this._timeDeltaInMs=e-this._baseServerTimeStampMS))}),_defineProperty(S,"getCorrectedCurrentTimeinMs",function t(){var e=new Date().getTime(),i=e;return this._timeShift>0?e-this._timeDeltaInMs:e+this._timeDeltaInMs}),_defineProperty(S,"getCurrentTimeinMs",function t(){return new Date().getTime()}),_defineProperty(S,"setProducerURL",function t(e){this._producerUrl=e}),_defineProperty(S,"setPostInterval",function t(e){this._postInterval=e}),_defineProperty(S,"stopMonitoring",function t(){this._enableEP=!1,this._lastStatsPostedAtTS=0,this._statsMonitorStartedAtTS=0,this._timerObj&&clearInterval(this._timerObj),this._timerObj2&&clearInterval(this._timerObj2),this._timerObj=null,this._timerObj2=null,this._timerTimestampSynchro&&clearInterval(this._timerTimestampSynchro),this._timerTimestampSynchro=null}),_defineProperty(S,"startMonitoringForSES",function t(){this.sesRequirements&&(this&&this.sesRequirements.isToolbox&&null===this._timerObj2&&this._producerURLSES&&(this._timerObj2=setInterval(this.sendHeartbeatToToolbox.bind(this),3e5)),this&&this.sesRequirements.isStarz&&null===this._timerObj2&&this._producerURLSES&&(this._timerObj2=setInterval(this.sendHearbeatToStarz.bind(this),6e4)))}),_defineProperty(S,"startMonitoring",function t(){"SUCCESS"===this._regStatus&&(this._enableEP=!0,null===this._timerObj&&this.getEPState()===MMExperienceProbeState.STARTED&&this._postInterval>0&&this._producerURL&&(this._timerObj=setInterval(this.sendQBRStats.bind(this),1e3*this._postInterval),this.sesRequirements&&this.sesRequirements.isToolbox&&null===this._timerObj2&&this._producerURLSES&&(this._timerObj2=setInterval(this.sendHeartbeatToToolbox.bind(this),3e5)),this.sesRequirements&&this.sesRequirements.isStarz&&null===this._timerObj2&&this._producerURLSES&&(this._timerObj2=setInterval(this.sendHearbeatToStarz.bind(this),6e4)),this._statsMonitorStartedAtTS||(this._statsMonitorStartedAtTS=this.getCurrentTimeinMs()),this._timerTimestampSynchro=setInterval(this.synchronizeTimestamp.bind(this),12e4),this.synchronizeTimestamp()))}),_defineProperty(S,"getChecksum",function t(e,i,r){var n=MMMD5().mm_md5(e+i+r);return n.substr(8,8)+n.substr(24,8)+n.substr(0,8)+n.substr(16,8)}),_defineProperty(S,"sendEventInfo",function t(){if(void 0===this._producerURL){this._eventToSend.length>this._maxEventsInQ&&this._eventToSend.splice(this._maxEventsInQ-4,2);return}if("FAILED"!==this._regStatus){for(var e=0;e<this._eventToSend.length;e++){var i=this._eventToSend[e];if(i&&i.qubitData[this._recordIndex].streamID){if(!0===this._isFirstBatch?(i.timestamp=this.getCorrectedCurrentTimeinMs(),i.qubitData[this._recordIndex].pbInfo[0].timestamp=i.timestamp,i.qubitData[this._recordIndex].streamID.mode=this._mode,i.interval=this._postInterval):(isNaN(i.timestamp)||void 0===i.timestamp||null===i.timestamp)&&(i.timestamp=this.getCorrectedCurrentTimeinMs()),"ONLOAD"===i.qubitData[this._recordIndex].pbEventInfo.event)this._onLoadSentAtTS=i.timestamp,this._modeFromResponse&&(i.qubitData[this._recordIndex].streamID.mode=this._modeFromResponse);else if("BUFFERING"!==i.qubitData[this._recordIndex].pbEventInfo.event&&"SEEKED"!==i.qubitData[this._recordIndex].pbEventInfo.event)this._modeFromResponse&&(i.qubitData[this._recordIndex].streamID.mode=this._modeFromResponse);else{if(null===this._mode)return;i.qubitData[this._recordIndex].streamID.mode=this._mode}if(this._onLoadSentAtTS&&"START"===i.qubitData[this._recordIndex].pbEventInfo.event){if(null===this._mode||(this._modeFromResponse=this._mode,-1===this._totalDuration&&void 0===i.qubitData[this._recordIndex].streamID.isLive&&(i.qubitData[this._recordIndex].streamID.isLive=!0),void 0===i.qubitData[this._recordIndex].streamID.isLive&&this._totalDuration>=0&&(i.qubitData[this._recordIndex].streamID.isLive=!1),void 0===i.qubitData[this._recordIndex].streamID.isLive))return;i.qubitData[this._recordIndex].streamID.mode=this._mode}if(this._onLoadSentAtTS&&i.qubitData[this._recordIndex].pbEventInfo.event,this._onLoadSentAtTS&&"AD_BLOCK"===i.qubitData[this._recordIndex].pbEventInfo.event&&(i.timestamp=this._onLoadSentAtTS),0===i.qubitData[this._recordIndex].pbEventInfo.event.indexOf("AD_")&&(i.qubitData[this._recordIndex].streamID.mode=void 0),0===i.qubitData[this._recordIndex].pbEventInfo.event.indexOf("AD_")){if(!this._enableAdQoE){this._eventToSend[e]=null;return}}else if(!this._enableVideoQoE){this._eventToSend[e]=null;return}console.log("EVENT == ",i.qubitData[this._recordIndex].pbEventInfo.event),i.qubitData[this._recordIndex].streamID.pId=this.getChecksum(this._customerID,this.sessionId,i.timestamp);var r=JSON.stringify(i),n=new XMLHttpRequest;n.open("POST",this.producerURL,!0),n.timeout=this._httpPostTimeout,n.setRequestHeader("Access-Control-Allow-Origin","*"),n.setRequestHeader("Content-type","application/json"),n.send(r),this._eventToSend[e]=null}}this._isFirstBatch=!1,this._eventToSend=[]}}),_defineProperty(S,"sendQBRStats",function t(){if("FAILED"!==this._regStatus&&this._enableVideoQoE&&("PENDING"===this._regStatus||this._enableEP&&this.getEPState()===MMExperienceProbeState.STARTED)){if(!1===this._bwExtSet){var e=this._avgDownloadRate/this._downloadRateCount;!isNaN(e)&&e>0&&this.setPBStats(this.attributes.BANDWIDTH,e),this._downloadRateCount=0,this._avgDownloadRate=0}if(this._totalDuration>0&&(this._progressMark=this._pbTime/this._totalDuration*100,this.setPBStats(this.attributes.PROGRESSMARK,parseFloat(this._progressMark.toFixed(2)))),!1===this._segINfoStatus){if(this._statsMetric&&this._statsMetric.pbTime>-1&&parseFloat(this._statsMetric.pbTime.toFixed(2))===parseFloat(this._pbTime.toFixed(2)))return;this._prevSegInfo&&this._prevSegInfo.cbrBitrate?(this._prevSegInfo.timestamp=this.getCorrectedCurrentTimeinMs(),this._prevSegInfo.dur=-1,this._prevSegInfo.cbrSize=this._prevSegInfo.qbrSize=0,this._statsMetric.qubitData[this._recordIndex].segInfo.push(this._prevSegInfo)):this._statsMetric.qubitData[this._recordIndex].segInfo=[]}this._segINfoStatus=!1,this._bwExtSet=!1,this._statsMetric.timestamp=this.getCorrectedCurrentTimeinMs(),this._statsMetric.pbTime=parseFloat(this._pbTime.toFixed(2)),this._statsMetric.playDur=this.getPlayDur();var i=this._statsMonitorStartedAtTS?this.getCurrentTimeinMs()-this._statsMonitorStartedAtTS:0;if(i=this._lastStatsPostedAtTS?this.getCurrentTimeinMs()-this._lastStatsPostedAtTS:i,this._statsMetric.interval=parseInt(i?i/1e3:0),"PENDING"===this._regStatus||this._statsMetric.interval){this._upshiftCount>0&&this.setPBStats(this.attributes.UPSHIFTCOUNT,this._upshiftCount),this._downshiftCount>0&&this.setPBStats(this.attributes.DOWNSHIFTCOUNT,this._downshiftCount),this._statsMetric.qubitData[this._recordIndex].streamID.pId=this.getChecksum(this._customerID,this.sessionId,this._statsMetric.timestamp);var r=JSON.stringify(this._statsMetric);if(this._statsMetric.qubitData[this._recordIndex].segInfo=[],this._statsMetric.qubitData[this._recordIndex].pbInfo=[],this._statsToSend.push(r),void 0!==this._producerURL){for(var n=0;n<this._statsToSend.length;n++){var a=this._statsToSend[n],s=new XMLHttpRequest;s.open("POST",this._producerURL,!0),s.timeout=this._httpPostTimeout,s.setRequestHeader("Access-Control-Allow-Origin","*"),s.setRequestHeader("Content-type","application/json"),s.send(a),this._lastStatsPostedAtTS=this.getCurrentTimeinMs(),this._statsToSend[n]=null}this._statsToSend=[]}else this._statsToSend.length>this._maxEventsInQ&&this._statsToSend.splice(this._maxEventsInQ-4,2)}}}),_defineProperty(S,"StreamInfo",function t(e,i,r,n,a,s,o,d,h,u,f){return{maxRes:void 0!==e?e:"1080*720",minRes:void 0!==i?i:"720*640",maxFps:void 0!==r?r:0,minFps:void 0!==n?n:0,numOfProfile:void 0!==a?a:0,totalDuration:void 0!==s?s:0,videoTrack:void 0!==o?o:"None",subtitleTrack:void 0!==d?d:"None",audioTrack:void 0!==h?h:"None",isVDSActive:void 0!==u?u:"None",isSubtitleActive:void 0!==f?f:"None"}}),_defineProperty(S,"getPlayDur",function t(){var e=this.getCurrentTimeinMs();return 0!==this._epocTime?e>this._epocTime&&(this._playDur=parseInt((e-this._epocTime)/1e3)):this._playDur=0,this._playDur}),_defineProperty(S,"getAdPlayDur",function t(){var e=0;return this._adInformation&&(e=this._adInformation._adPlayDur),e}),_defineProperty(S,"getAttribute",function t(){return this.attributes}),_defineProperty(S,"StreamID",function t(e,i,r,n,a,s){return{streamURL:void 0!==e?e:"http://localhost",assetId:void 0!==i?i:"",custId:void 0!==r?r:1111,sessionId:void 0!==n?n:"session1",isLive:void 0!==a&&a,dataSrc:void 0!==s?s:"player"}}),_defineProperty(S,"ContentMetadata",function t(e,i,r,n,a,s,o,d,h,u){return{assetId:void 0!==e?e:"",assetName:void 0!==e?i:"",contentType:void 0!==r?r:"",drmProtection:void 0!==n?n:"",episodeNumber:void 0!==a?a:"",genre:void 0!==s?s:"",season:void 0!==o?o:"",seriesTitle:void 0!==d?d:"",videoId:void 0!==h?h:"",videoType:void 0!==u?u:""}}),_defineProperty(S,"SegmentInfo",function t(e,i,r,n,a,s,o,d,h,u,f,c,p,l,S){return{res:e,qbrBitrate:void 0!==i&&i>0?i:0,cbrBitrate:void 0!==r&&r>0?r:0,qbrQual:void 0!==n?parseFloat(n.toFixed(2)):0,cbrQual:void 0!==a?parseFloat(a.toFixed(2)):0,dur:void 0!==s?s:0,seqNum:void 0!==o?o:0,startTime:void 0!==d?d:0,fps:void 0!==h?h:0,cbrProfileNum:void 0!==f?f:0,profileNum:void 0!==u?u:0,cbrSize:void 0!==c?Math.floor(c):0,qbrSize:void 0!==p?Math.floor(p):0,vCodec:void 0!==l?l:"",aCodec:void 0!==S?S:""}}),_defineProperty(S,"ClientInfo",function t(e,i,r,n,a,s){return{location:void 0!==e?e:"",operator:void 0!==i?i:"",cdn:void 0!==r?r:"",nwType:void 0!==n?n:"",platform:void 0!==a?a:"",scrnRes:void 0!==s?s:""}}),_defineProperty(S,"PlaybackInfo",function t(e,i,r,n,a,s){return{latency:void 0!==e?e:0,buffWait:void 0!==i?i:0,frameloss:void 0!==r?r:0,bwInUse:void 0!==n?n:0,lastTS:void 0!==a?a:0,playerState:void 0!==s?s:0}}),_defineProperty(S,"EventMetricTemplate",function t(){return{streamID:{},pbEventInfo:{},streamInfo:{},contentMetadata:{},sdkInfo:{},pbInfo:[]}}),_defineProperty(S,"QBRMetricTemplate",function t(){return{streamID:{},streamInfo:{},contentMetadata:{},segInfo:[],pbInfo:[],sdkInfo:{}}}),_defineProperty(S,"resetAdvertisementInfo",function t(){this._adInformation._adResolution=void 0,this._adInformation._adClient=void 0,this._adInformation._adId=void 0,this._adInformation._adDuration=void 0,this._adInformation._adPosition=void 0,this._adInformation._adLinear=void 0,this._adInformation._adCreativeType=void 0,this._adInformation._adServer=void 0,this._adInformation._prevAdState=void 0,this._adInformation._adPlaybackTime=void 0,this._adInformation._adCreativeId=void 0,this._adInformation._adTitle=void 0,this._adInformation._adBitrate=void 0,this._adInformation._adUrl=void 0,this._adInformation._playSent=!1,this._adInformation._adPlaybackStartWallClockTime=void 0,this._adInformation._adPlayDur=0,this._adInformation._adLastPlayingEventTimeStamp=-1,this._adInformation._adLastAdEventTimeStamp=-1,this._adInformation._isBumper=!1,this._adInformation._adPodIndex=-2,this._adInformation._adPodLength=-1,this._adInformation._adPositionInPod=-1,this._adInformation._adScheduledTime=-1,this._adEpocTime=0,this._adPauseStartTime=0,this._adStartEpocTime=0,this._adLoadTime=0,this._adStartEpocTime=0,this._adBuffWaitForInterval=0,this._adSumBuffWait=0,this._adPauseDuration=0,this._adPauseDurationToOffsetFromInterval=0,this._adLoadStartTime=0}),_defineProperty(S,"resetForNewAd",function t(){this._adInformation._prevAdState=null,this._adInformation._adPlaybackTime=-1,this._adInformation._playSent=!1,this._adInformation._adPlaybackStartWallClockTime=-1,this._adInformation._adLastPlayingEventTimeStamp=-1,this._adInformation._adLastAdEventTimeStamp=-1,this._adInformation._adPlayDur=0,this._adInformation._adPodIndex=-2,this._adInformation._adPodLength=-1,this._adInformation._adPositionInPod=-1,this._adInformation._adCreativeId=void 0,this._adInformation._adTitle=void 0,this._adInformation._adBitrate=void 0,this._adInformation._adUrl=void 0,this._adEpocTime=0,this._adPauseStartTime=0,this._adStartEpocTime=0,this._adLoadTime=0,this._adStartEpocTime=0,this._adBuffWaitForInterval=0,this._adSumBuffWait=0,this._adPauseDuration=0,this._adPauseDurationToOffsetFromInterval=0,this._adLoadStartTime=0}),_defineProperty(S,"sendAdPlayingEvent",function t(e,i){if(null!=this._adInformation&&this._adInformation._playSent&&this._adInformation._prevAdState!=MMAdState.AD_PAUSED){var r=parseInt((e-this._adInformation._adPlaybackStartWallClockTime)/1e3);(i||r>0&&r%(this._KAdKeepAliveInterval/1e3)==0)&&(this._adInformation._adPlaybackStartWallClockTime=e,this.populateAdRelatedInfo(e),this.notifyEvent("AD_PLAYING","AD KEEP ALIVE","AD_PLAYING",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastPlayingEventTimeStamp=e,this._adInformation._adLastAdEventTimeStamp=this.getCurrentTimeinMs())}}),_defineProperty(S,"resetAdInfoIfInitialState",function t(e){null==this._adInformation&&(this._adInformation=new MMAdvertisentInformation),e==MMAdState.AD_REQUEST||null==this._adInformation._prevAdState?(this.resetAdvertisementInfo(),this._adLoadStartTime=this._adPauseStartTime=this._adPauseDuration=this._adLoadTime=0,this._adBuffWaitForInterval=this._adSumBuffWait=0):e==MMAdState.AD_IMPRESSION&&this._adInformation._prevAdState!=MMAdState.AD_STARTED&&this._adInformation._prevAdState!=MMAdState.AD_REQUEST&&this._adInformation._prevAdState!=MMAdState.AD_IMPRESSION&&(this.resetForNewAd(),this._adLoadStartTime=this._adPauseStartTime=this._adPauseDuration=this._adLoadTime=0,this._adBuffWaitForInterval=this._adSumBuffWait=0);var i=Math.ceil(this._pbTime+3);(void 0==this._adInformation._adPosition||null==this._adInformation._adPosition)&&(this.getEPState()==MMExperienceProbeState.STARTED||this._pbTime<=1?this._adInformation._adPosition="pre":!this._adInformation.prevAdState&&this._adInformation.prevAdState!=MMPlayerState.STOPPED&&this._pbTime>0&&i<this._totalDuration?this._adInformation._adPosition="mid":(!this._adInformation.prevAdState&&this._adInformation.prevAdState==MMPlayerState.STOPPED||this._pbTime>0&&i>=this._totalDuration)&&(this._adInformation._adPosition="post")),this._adInformation._prevAdState=e}),_defineProperty(S,"populateAdRelatedInfo",function t(e){this._adInformation&&(void 0===this._eventMetric.qubitData[this._recordIndex].adInfo&&(this._eventMetric.qubitData[this._recordIndex].adInfo={}),void 0!==this._adInformation._adClient&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adClient=this._adInformation._adClient),void 0!==this._adInformation._adId&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adId=this._adInformation._adId),void 0!==this._adInformation._adDuration&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adDuration=parseFloat((this._adInformation._adDuration/1e3).toFixed(2))),void 0!==this._adInformation._adPosition&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adPosition=this._adInformation._adPosition),void 0!==this._adInformation._adLinear&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adLinear=this._adInformation._adLinear),void 0!==this._adInformation._adCreativeType&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adCreativeType=this._adInformation._adCreativeType),void 0!==this._adInformation._adServer&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adSystem=this._adInformation._adServer),void 0!==this._adInformation._adResolution&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adResolution=this._adInformation._adResolution),void 0!==this._adInformation._adTitle&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adTitle=this._adInformation._adTitle),void 0!==this._adInformation._adBitrate&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adBitrate=this._adInformation._adBitrate),void 0!==this._adInformation._adUrl&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adUrl=this._adInformation._adUrl),void 0!==this._adInformation._adCreativeId&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adCreativeId=this._adInformation._adCreativeId),this._adInformation._adPodLength>0&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adPodLength=this._adInformation._adPodLength),this._adInformation._adPodIndex>=-1&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adPodIndex=this._adInformation._adPodIndex),this._adInformation._adPositionInPod>0&&(this._eventMetric.qubitData[this._recordIndex].adInfo.adPodPosition=this._adInformation._adPositionInPod),this._eventMetric.qubitData[this._recordIndex].adInfo.isBumper=this._adInformation._isBumper,this._eventMetric.qubitData[this._recordIndex].adInfo.adInterval=this.getAdInterval(e))}),_defineProperty(S,"getAdInterval",function t(e){var i=0;return null!=this._adInformation&&this._adInformation._adLastAdEventTimeStamp>0&&(null!=this._adPauseStartTime&&this._adPauseStartTime>0&&(e=this._adPauseStartTime),i=(e-this._adInformation._adLastAdEventTimeStamp)*1/1e3),this._adPauseDurationToOffsetFromInterval>0&&(i-=this._adPauseDurationToOffsetFromInterval/1e3,this._adPauseDurationToOffsetFromInterval=0),this._adBuffWaitForInterval>0&&(i-=this._adBuffWaitForInterval/1e3,this._adInformation._adPlayDur+=this._adBuffWaitForInterval/1e3,this._adBuffWaitForInterval=0),i<0&&(i=0),this._adInformation._adPlayDur+=i,i}),_defineProperty(S,"millisecToSec",function t(e){return parseFloat(1*e/1e3).toFixed(2)}),_defineProperty(S,"reportAdState",function t(e){var i=this.getCurrentTimeinMs();switch(this.resetAdInfoIfInitialState(e),this.populateAdRelatedInfo(i),e){case MMAdState.AD_BLOCKED:this.notifyEvent("AD_BLOCK","Ad blocked","AD_BLOCK",0);break;case MMAdState.AD_IMPRESSION:this._adLoadStartTime=i,this._adPauseStartTime=-1,this.notifyEvent("AD_IMPRESSION","Ad impression has been made","AD_IMPRESSION",0);break;case MMAdState.AD_STARTED:case MMAdState.AD_PLAY:this._adBeforePlayback=!0,!1==this._adInformation._playSent&&(this._adInformation._playSent=!0,this._adLoadStartTime>0&&(this.loadStartTime>0&&(this._adLoadStartTime,this.loadStartTime),this._adLoadTime=i-this._adLoadStartTime,this._adPauseDuration>0&&(this._adLoadTime-=this._adPauseDuration),this._adLoadTime<0&&(this._adLoadTime=0),this._adInformation._adPlayDur+=Math.ceil(this._adLoadTime/1e3)),this.populateAdRelatedInfo(i),this.setPBStats(this.attributes.LATENCY,this._adLoadTime),this.notifyEvent("AD_PLAY","Ad Playback started","AD_PLAY",0),this.adLoadStartTime=0,this._adInformation._adLastPlayingEventTimeStamp=this._adInformation._adPlaybackStartWallClockTime=this.getCurrentTimeinMs(),this._adInformation._adLastAdEventTimeStamp=this._adInformation._adLastPlayingEventTimeStamp);break;case MMAdState.AD_CLICKED:this._adBeforePlayback=!0,this.notifyEvent("AD_CLICK","Ad has been clicked","AD_CLICK",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i;break;case MMAdState.AD_PAUSED:this._adPauseStartTime=this.getCurrentTimeinMs(),this.notifyEvent("AD_PAUSED","Ad has been paused","AD_PAUSED",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i;break;case MMAdState.AD_RESUMED:this._adPauseStartTime>0&&(this._adPauseDuration=i-this._adPauseStartTime,this._adPauseDuration<0&&(this._adPauseDuration=0),this._adPauseDurationToOffsetFromInterval=this._adPauseDuration),this.setPBStats(this.attributes.PAUSEDURATION,this._adPauseDuration),this.populateAdRelatedInfo(i),this.notifyEvent("AD_RESUMED","Ad has been resumed","AD_RESUMED",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i,this._adPauseStartTime=-1;break;case MMAdState.AD_SKIPPED:this._adBeforePlayback=!0,this._adSumBuffWait<0&&(this._adSumBuffWait=0),this._adSumBuffWait+=1*this._adLoadTime,this.setBufPBEvent(this.attributes.SUMBUFFERING,this._adSumBuffWait),this.notifyEvent("AD_SKIPPED","Ad has been skipped","AD_SKIPPED",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i,this._pbTimeBeforeAdStart>0&&(this._pbTime=this._pbTimeBeforeAdStart);break;case MMAdState.AD_COMPLETED:this._adBeforePlayback=!0,this._adSumBuffWait<0&&(this._adSumBuffWait=0),this._adSumBuffWait+=1*this._adLoadTime,this.setBufPBEvent(this.attributes.SUMBUFFERING,this._adSumBuffWait),this._adInformation._adDuration>0&&(this._adInformation._adPlaybackTime-90*this._adInformation._adDuration/100>=0||2>Math.abs(this._adInformation._adPlaybackTime-this._adInformation._adDuration))?this.notifyEvent("AD_COMPLETE","Ad completed playing","AD_COMPLETE",this.millisecToSec(this._adInformation._adPlaybackTime)):(this.notifyEvent("AD_ENDED","Ad ended","AD_ENDED",this.millisecToSec(this._adInformation._adPlaybackTime)),this._pbTimeBeforeAdStart>0&&(this._pbTime=this._pbTimeBeforeAdStart)),this._adInformation._playSent=!1,this._adInformation._adLastAdEventTimeStamp=i;break;case MMAdState.AD_ENDED:this._adBeforePlayback=!0,this._adSumBuffWait<0&&(this._adSumBuffWait=0),this._adSumBuffWait+=1*this._adLoadTime,this.setBufPBEvent(this.attributes.SUMBUFFERING,this._adSumBuffWait),this.notifyEvent("AD_ENDED","Ad ended","AD_ENDED",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._playSent=!1,this._adInformation._adLastAdEventTimeStamp=i,this._pbTimeBeforeAdStart>0&&(this._pbTime=this._pbTimeBeforeAdStart);break;case MMAdState.AD_ERROR:this.notifyEvent("AD_ERROR",event.message,"AD_ERROR",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._playSent=!1,this._adInformation._adLastAdEventTimeStamp=i,this._pbTimeBeforeAdStart>0&&(this._pbTime=this._pbTimeBeforeAdStart);break;case MMAdState.AD_REQUEST:this.notifyEvent("AD_REQUEST","Ad has been requested","AD_REQUEST",0);break;case MMAdState.AD_PLAYING:this.sendAdPlayingEvent(i,!1);break;case MMAdState.AD_FIRST_QUARTILE:this.notifyEvent("AD_PLAYED_FIRST_QUARTILE","Ad reached first quartile","AD_PLAYED_FIRST_QUARTILE",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i;break;case MMAdState.AD_MIDPOINT:this.notifyEvent("AD_PLAYED_SECOND_QUARTILE","Ad reached midpoint","AD_PLAYED_SECOND_QUARTILE",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i;break;case MMAdState.AD_THIRD_QUARTILE:this.notifyEvent("AD_PLAYED_THIRD_QUARTILE","Ad reached third quartile","AD_PLAYED_THIRD_QUARTILE",this.millisecToSec(this._adInformation._adPlaybackTime)),this._adInformation._adLastAdEventTimeStamp=i}}),_defineProperty(S,"reportAdError",function t(e,i){this.populateAdRelatedInfo(),void 0==i&&(i=this._adInformation._adPlaybackTime),void 0===i&&(i=0),this.notifyEvent("AD_ERROR",e,"AD_ERROR",this.millisecToSec(i))}),_defineProperty(S,"reportAdPlaybackTime",function t(e){if(e>=0&&this._adInformation){var i=this.getCurrentTimeinMs();this._adInformation._adPlaybackTime=e,this.sendAdPlayingEvent(i,!1)}}),_defineProperty(S,"reportAdInfo",function t(e){this._adInformation||(this._adInformation=new MMAdvertisentInformation),e&&(void 0!==e.adClient&&(this._adInformation._adClient=e.adClient),void 0!==e.adId&&(this._adInformation._adId=e.adId),void 0!==e.adDuration&&(this._adInformation._adDuration=e.adDuration),void 0!==e.adPosition&&(this._adInformation._adPosition=e.adPosition),void 0!==e.adIsLinear&&(e.adIsLinear?this._adInformation._adLinear="linear":this._adInformation._adLinear="nonlinear"),void 0!==e.adCreativeType&&(this._adInformation._adCreativeType=e.adCreativeType),void 0!==e.adServer&&(this._adInformation._adServer=e.adServer),void 0!==e.adResolution&&(this._adInformation._adResolution=e.adResolution),this._adInformation._isBumper=e.isBumper,e.adPodIndex>=-1&&(this._adInformation._adPodIndex=e.adPodIndex),e.adPodLength>0&&(this._adInformation._adPodLength=e.adPodLength),e.adPositionInPod>0&&(this._adInformation._adPositionInPod=e.adPositionInPod),e.adScheduledTime>=0&&(this._adInformation._adScheduledTime=e.adScheduledTime),void 0!==e.adUrl&&(this._adInformation._adUrl=e.adUrl),void 0!==e.adCreativeId&&(this._adInformation._adCreativeId=e.adCreativeId),void 0!==e.adTitle&&(this._adInformation._adTitle=e.adTitle),void 0!==e.adBitrate&&(this._adInformation._adBitrate=e.adBitrate))}),_defineProperty(S,"isQBRDisabled",function t(){return null===this._mode||"QBRDisabled-NoMetafile"==this._mode||this._mode==MMQBRMode.QBRModeDisabled||"QBRDisabled-QMetric"==this._mode||"QBRDisabled-NoPresentationInfo"==this._mode||"QBRDisabled-NoABR"==this._mode||"QBRDisabled-LiveSessionNotSupported"==this._mode||"QBRDisabled-ContentNotSupportedForQBR"==this._mode}),_defineEnumerableProperties(S,m),S},HttpUtil=function t(){var e,i,r=new XMLHttpRequest,n=function t(e){return"?"+Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")};return{doGet:function t(e,i){return new Promise(function(t,a){void 0!==i&&(e+=n(i)),r.open("GET",e),r.timeout=25e3,r.onload=function(){200==r.status?t(r.response):a(Error(r.statusText))},r.onerror=function(){a(Error("Network Error"))},r.abort=function(){a(Error("NetRequest Aborted"))},r.ontimeout=function(){a(Error("NetRequest timeout"))},r.send()})},cleanUp:function t(){r&&4!=r.readyState&&r.abort()}}},MMEXPERIENCEPROBEMETRICS={MMEXP_LATENCY:0,MMEXP_STALLCOUNT:0,MMEXP_SUMBUFFWAIT:0,MMEXP_PLAYDURATION:0,MMEXP_PLAYBACKPOSITION:0,MMEXP_OPERATOR:"Unknown",MMEXP_MANIFESTURL:"",MMEXP_LASTSTATE:"IDLE",MMEXP_STATE:"IDLE",MMEXP_FRAMELOSS:0},QBRFactoryMaker=function(){var t,e=[],i=[];function r(t,e){for(var r in i){var n=i[r];if(n.context===t&&n.name===e)return n.instance}return null}function n(e,i,r,n){var s=a(r)[e];if(s){var o=s.instance;if(!s.override)return o.apply({context:r,factory:t},n);for(var d in o=o.apply({context:r,factory:t,parent:i},n))i.hasOwnProperty(d)&&(i[d]=o[d])}return i}function a(t){var i;return e.forEach(function(e){e===t&&(i=e)}),i||(i=e.push(t)),i}return t={extend:function t(e,i,r,n){var s=a(n);!s[e]&&i&&(s[e]={instance:i,override:r})},getSingletonInstance:r,setSingletonInstance:function t(e,r,n){for(var a in i){var s=i[a];if(s.context===e&&s.name===r){i[a].instance=n;return}}i.push({name:r,context:e,instance:n})},getSingletonFactory:function t(e){return function(t){var a;return void 0===t&&(t={}),{getInstance:function s(){return a||(a=r(t,e.__dashjs_factory_name)),a||(a=n(e.__dashjs_factory_name,e.apply({context:t},arguments),t,arguments),i.push({name:e.__dashjs_factory_name,context:t,instance:a})),a}}}},getClassFactory:function t(e){return function(t){return void 0===t&&(t={}),{create:function i(){return n(e.__dashjs_factory_name,e.apply({context:t},arguments),t,arguments)}}}}}}(),MMLogger=function(){var t=isNaN(MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.log_level)?2:MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.log_level,e={VERBOSE:6,DEBUG:5,INFO:4,ANALYZE:3,WARN:2,ERROR:1,OFF:0},i=function t(i){for(var r in e)if(r===i)return e[r];return e.OFF};return{setLogLevel:function e(i){i<0&&(i=0),t=i},log:function e(r,n){i(r)<=t&&console.log("["+r+"] : "+n)}}}(),utils={append:function t(e,i){for(var r in i)e[r]=i[r]}},MMSmartStreamingImpl=function t(){var e,i,r,n,a=!1,s=void 0,o=new ExperienceProbe,d=null,h=void 0,u=!1,f=!1,c=!1,p=!1,l=void 0,S=void 0;"undefined"!=typeof MMQubitEngineImpl&&(s=new MMQubitEngineImpl),"undefined"!=typeof crsPoller&&(l=new crsPoller),"undefined"!=typeof statistics&&(h=new statistics);var m,I,v,T,E,$,P,b,D,y,M,g=function t(e){f&&console.log("mmTrace:"+new Date().getTime()+"::"+e)},R=function t(h){if(null!=h&&(g(" setPresentationInformation In - live?"+h.isLive+" duration:"+h.duration+" repsCnt:"+h.representationArray.length),1===(d=h).isLive&&(d.isLive=!0),0===d.isLive&&(d.isLive=!1),a)){s?(s.setPresentationInformation(d),c&&p&&(p=!1,s.initializeDisableManifestFetch(o,i,r,n,d).then(function(t){e.resolve(t)}).catch(function(t){e.reject(t)}))):o.reportMode("QBRDisabled");var u=d.isLive?-1:d.duration/1e3;o.setVideoDuration(u),o.setPresentationType(d.isLive);var f="",l="",S=0,m=0,I=d.representationArray.length,v=d.contentType;if(I)for(var T=0;T<I;T++)d.representationArray[T].width&&d.representationArray[T].height&&d.representationArray[T].width>0&&d.representationArray[T].height>0&&((0===S||S>d.representationArray[T].width*d.representationArray[T].height)&&(l=d.representationArray[T].width+"x"+d.representationArray[T].height,S=d.representationArray[T].width*d.representationArray[T].height),(0===m||m<d.representationArray[T].width*d.representationArray[T].height)&&(f=d.representationArray[T].width+"x"+d.representationArray[T].height,m=d.representationArray[T].width*d.representationArray[T].height));o.setPresentationStreamInfo(f,l,0,0,I,v)}},A=function t(e){var i=e.endByte>0?e.endByte-e.startByte:-1,r=void 0,n=void 0,a=e.duration>0?parseInt(e.duration/1e3):-1,s=e.startTime>0?e.startTime/1e3:-1;-1==e.trackIdx?-1!=e.bitrate&&(r=C(e.bitrate),n=B(e.bitrate)):(r=N(e.trackIdx),n=x(e.trackIdx));var d=void 0,h=void 0;return n&&n.video&&(h=n.video),n&&n.audio&&(d=n.audio),o.SegmentInfo(r,e.bitrate,e.bitrate,void 0,void 0,a,e.sequence,s,void 0,e.trackIdx,e.trackIdx,i,void 0,h,d)},C=function t(e){var i=_(e),r=void 0;return void 0!==i&&void 0!==i.width&&void 0!==i.height&&i.width>0&&i.height>0&&(r=i.width+"x"+i.height),r},B=function t(e){var i=_(e),r=void 0;return i&&(r=i.codecIdentifier),r},N=function t(e){var i=L(e),r=void 0;return void 0!==i&&void 0!==i.width&&void 0!==i.height&&i.width>0&&i.height>0&&(r=i.width+"x"+i.height),r},x=function t(e){var i=L(e),r=void 0;return i&&(r=i.codecIdentifier),r},_=function t(e){var i=void 0;if(d){for(var r=0;r<d.representationArray.length;r++)if(d.representationArray[r].bitrate===e){i=d.representationArray[r];break}}return i},L=function t(e){var i=void 0;if(d){for(var r=0;r<d.representationArray.length;r++)if(d.representationArray[r].trackIdx===e){i=d.representationArray[r];break}}return i};return{getSmartRouteUrl:function t(e){return l?l.getCRSUrl(e):e},enableLogTrace:function t(e){f=e},updateSubscriberID:function t(e){o.updateSubscriberID(e)},updateSubscriber:function t(e,i,r){o.updateSubscriber(e,i,r)},getRegistrationStatus:function t(){return a},getRegistrationStatusWithBackend:function t(){return o.getRegistrationStatusWithBackend()},registerMMSmartStreaming:function t(e,i,r,n,s,d,u){g(" registerMMSmartStreaming In "+e+" "+i+" "+n+" "+s+" "+r," ",+d+" "+u),o.reset(),MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.statistics&&h&&h.setExpProbe(o),o.registerMMSmartStreaming(e,i,n,s,d,u),o.reportHintFileVersion(MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.hintFileVersion),o.reportComponent(r),a=!0,S=i},initializeSession:function t(a,u,f,m){return g(" initializeSession In mode: "+a+" url:"+u+" metaurl: "+f+" contentMetadata:"+m),d=null,o.reset(),MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.statistics&&h&&h.resetStatistics(),s&&(s.reset(),s.setInitialParameter(o,MMQBRMode.QBRModeDisabled)),o.initializeSession(a,u,f,m).then(function(t){var a,h,I,v=JSON.parse(t);if(void 0!==S&&void 0!==v.crsUrl&&void 0!==v.crsEnabled&&void 0!==v.crsInterval&&l&&l.initialize(S,v.crsUrl,v.crsEnabled,v.crsInterval,o),void 0===v.producerURL)return o.reportRegistrationFailure(),o.reset(),new Promise(function(t,e){MMLogger.log("VERBOSE","Playback Registration Failed"),e("Playback Registration Failed.")});if(o.reportRegistrationSuccess(v),o.reportAssetID(m.assetID,m.assetName,m.videoId),s&&(s.setInitialParameter(o,v.mode),f=s.getHintFileUrlFromResponse(u,f,v,m.assetID,m.assetName)),R(d),MMLogger.log("VERBOSE"," initializing QEngine"),!s)return new Promise(function(t,e){MMLogger.log("VERBOSE","InitializeSession Success"),t(v),v&&o.setSDKQoEConfig(v.mmVideo,v.mmAd)});if(c){if(s)return p=!0,i=v.mode,n=f,r=u,e=((I=new Promise(function(t,e){a=t,h=e})).resolve=a,I.reject=h,I)}else{var T=s.initialize(o,v.mode,u,f);return s.setPresentationInformation(d),T}}).catch(function(t){return"QBRSDK : QEngine cannot be initialized...."!=t?(t="Experience Probe Initialisation Failed.",o.reportRegistrationFailure(),o.reset(),s&&s.setInitialParameter(o,"QBRDisabled")):(t="MMSmartStreaming : QBR component cannot be initialized...",s&&s.setInitialParameter(o,"QBRDisabled")),R(d),new Promise(function(e,i){MMLogger.log("VERBOSE",t),i(t)})})},setPresentationInformation:R,blacklistRepresentation:function t(e,i){g(" blacklistRepresentation In blacklist:"+e+"="+i),s&&s.blacklistRepresentation(e,i)},getQBRBandwidth:function t(e,i,r,n){return(g(" getQBRBandwidth In trackIdx:"+e+" downloadRate:"+i+" buffLength:"+r+" playbackPos:"+n),this.reportBufferLength(r),s)?s.getQBRBandwidth(e,i,r,n):i},getQBRChunk:function t(e){if(g(" getQBRChunk In"),s){u=!0,s.getQBRChunk(e);var i=s.getLastUpdateSegmentInfo();h&&!0===i.valid&&MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.statistics&&h.updateStatistics(i,!1,s.getDownloadRate(),i.totalSegments)}return e},reportChunkRequest:function t(e){if(a&&!u){if(g("reportChunkRequest In"),o.isQBRDisabled()&&MMSTREAMSMARTERCONSTANTS.SDK_CONFIG.qmetric&&s)s.getQBRChunk(e);else{var i=A(e);o.addSegInfo(i)}}},reportDownloadRate:function t(e){a&&(g(" reportDownloadRate In :"+e),s&&s.setDownloadRate(e),o.setBandwidth(e))},reportBufferLength:function t(e){a&&(g(" reportBufferLength In :"+e),s&&s.reportBufferLength(e),o.reportBufferLength(e))},reportCustomMetadata:function t(e,i){a&&(g(" reportCustomMetadata In"),o.setCustomTag(e,i))},reportPlaybackPosition:function t(e){a&&(g(" reportPlaybackPosition In :"+e),s&&s.setPlaybackPos(e),o.setPlaybackPos(e))},reportNetworkType:function t(e){a&&(g(" reportNetworkType In"),o.reportNetworkType(e))},reportMetricValue:function t(e,i){a&&(g(" reportMetricValue In"),o.reportMetricValue(e,i))},reportDeviceInfo:function t(e,i,r,n,a,s,d,h){g(" reportDeviceInfo In "),o.reportDeviceInfo(e,i,r,n,a,s,d,h),"CHROMECAST"===i?o.reportDeviceType("ChromeCast"):"SMARTTV"===i&&o.reportDeviceType("SmartTV")},reportPlayerInfo:function t(e,i,r){g(" reportPlayerInfo In"),o.reportPlayerInfo(e,i,r)},reportAppInfo:function t(e,i){g(" reportAppInfo In"),o.reportAppInfo(e,i)},reportDeviceType:function t(e){g(" reportDeviceType In"),o.reportDeviceType(e)},reportDeviceCapabilities:function t(e){g(" reportdeviceCapabilities In"),o.reportDeviceCapabilities(e)},reportVideoQuality:function t(e){g(" reportVideoQuality In"),o.reportVideoQuality(e)},reportManifestLoaded:function t(){g(" reportManifestLoaded In"),o.reportManifestLoaded()},reportDeviceId:function t(e){g(" reportDeviceId In"),o.reportDeviceId(e)},reportPlayerState:function t(e){g(" reportPlayerState In "+e),o.reportPlayerState(e)},notifyPackager:function t(e,i){o.notifyPackager(e,i)},setSESRequirements:function t(e){o.setSESRequirements(e)},setSESURL:function t(e){o.setSESURL(e)},reportTrackinfo:function t(e,i,r,n,a){o.reportTrackinfo(e,i,r,n,a)},reportUserInitiatedPlayback:function t(){g(" reportUserInitiatedPlayback In "),o.reportUserInitiatedPlayback()},reportBufferingStarted:function t(){g(" reportBufferingStarted In "),o.reportBufferingStarted()},reportBufferingCompleted:function t(){g(" reportBufferingCompleted In "),o.reportBufferingCompleted()},reportEventWithValue:function t(e,i){o.reportEventWithValue(e,i)},reportABRSwitch:function t(e,i){a&&o.isQBRDisabled()&&(g(" reportABRSwitch "+e+"->"+i),o.reportABRSwitch(e,i))},reportFrameLoss:function t(e){a&&(g(" reportFrameLoss In "+e),o.reportFrameLoss(e))},reportPresentationSize:function t(e,i){g("reportPresentationSize w:"+e+" h:"+i),o.reportPresentationSize(e,i)},reportError:function t(e,i){a&&(g(" reportError In "+e),o.reportError(e,i))},reportPlayerSeekCompleted:function t(e){a&&(g(" reportPlayerSeekCompleted In"),o.reportPlayerSeekCompleted(e))},reportPlayerSeekStarted:function t(){a&&(g(" reportPlayerSeekStarted In"),o.reportPlayerSeekStarted())},reportResolutionChange:function t(e){a&&(g(" reportResolutionChange In"),o.reportResolutionChange(e))},reportVolumeChange:function t(e){a&&(g(" reportVolumeChange In"),o.reportVolumeChange(e))},reportPlaybackRateChange:function t(){a&&(g(" reportPlaybackRateChange In"),o.reportPlaybackRateChange())},reportDurationChange:function t(){a&&(g(" reportDurationChange In"),o.reportDurationChange())},reportSDKVersion:function t(e){o.reportSDKVersion(e)},getSDKVersion:function t(){return o.getSDKVersion()},reportWifiSSID:function t(e){a&&(g(" reportWifiSSID In"),o.reportWifiSSID(e))},reportWifiSignalStrenthPercentage:function t(e){a&&(g(" reportWifiSignalStrenthPercentage In"),o.reportWifiSignalStrenthPercentage(e))},reportWifiDataRate:function t(e){a&&(g(" reportWifiDataRate In"),o.reportWifiDataRate(e))},reportAdInfo:function t(e){a&&(g(" reportAdInfo "),e&&o.reportAdInfo(e))},reportAdError:function t(e,i){g(" reportAdError "+e),o.reportAdError(e,i)},reportAdBufferingStarted:function t(){g(" reportAdBufferingStarted In "),o.reportAdBufferingStarted()},reportAdBufferingCompleted:function t(){g(" reportAdBufferingCompleted In "),o.reportAdBufferingCompleted()},reportAdPlaybackTime:function t(e){a&&(g(" reportAdPlaybackTime "+e),o.reportAdPlaybackTime(e))},reportAdState:function t(e){a&&(g(" reportAdState "+e),o.reportAdState(e))},reportComponent:function t(e){a&&(g(" reportComponent "+e),o.reportComponent(e))},getPanelStats:function t(){return h.getPanelStats()},getProfileProperties:function t(){return a&&s?s.getProfileProperties():null},setRegistrationStatus:function t(e){a=e},setCfValue:function t(e){a&&s&&s.setCfKonstant(e)},getSessionId:function t(){if(a)return o.sessionId},getPresentationInfoInternal:function t(){if(a&&s)return s.getPresentationInfoInternal()},disableManifestsFetch:function t(e){a&&(c=e)}}},MMSmartStreaming=function(){var t;return{createInstance:function t(e){var i,r=Object.create((i=new MMSmartStreamingImpl,{getSmartRouteUrl:function t(e){return i.getSmartRouteUrl(e)},getSDKVersion:function t(){return i.getSDKVersion()},getRegistrationStatus:function t(){return i.getRegistrationStatus()},getRegistrationStatusWithBackend:function t(){return i.getRegistrationStatusWithBackend()},registerMMSmartStreaming:function t(e,r,n,a,s,o,d){return i.registerMMSmartStreaming(e,r,n,a,s,o,d)},updateSubscriberID:function t(e){return i.updateSubscriberID(e)},disableManifestsFetch:function t(e){i.disableManifestsFetch(e)},reportDeviceInfo:function t(e,r,n,a,s,o,d,h){i.reportDeviceInfo(e,r,n,a,s,o,d,h)},reportPlayerInfo:function t(e,r,n){i.reportPlayerInfo(e,r,n)},reportDeviceCapabilities:function t(e){i.reportDeviceCapabilities(e)},reportAppInfo:function t(e,r){i.reportAppInfo(e,r)},reportDeviceType:function t(e){i.reportDeviceType(e)},reportVideoQuality:function t(e){i.reportVideoQuality(e)},reportManifestLoaded:function t(){i.reportManifestLoaded()},reportDeviceId:function t(e){i.reportDeviceId(e)},initializeSession:function t(e,r,n,a){return i.initializeSession(e,r,n,a)},setPresentationInformation:function t(e){i.setPresentationInformation(e)},blacklistRepresentation:function t(e,r){i.blacklistRepresentation(e,r)},getQBRBandwidth:function t(e,r,n,a){return i.getQBRBandwidth(e,r,n,a)},getQBRChunk:function t(e){return i.getQBRChunk(e)},reportChunkRequest:function t(e){i.reportChunkRequest(e)},reportDownloadRate:function t(e){i.reportDownloadRate(e)},reportBufferLength:function t(e){i.reportBufferLength(e)},reportCustomMetadata:function t(e,r){i.reportCustomMetadata(e,r)},reportPlaybackPosition:function t(e){i.reportPlaybackPosition(e)},reportNetworkType:function t(e){i.reportNetworkType(e)},reportMetricValue:function t(e,r){i.reportMetricValue(e,r)},reportBufferingStarted:function t(){i.reportBufferingStarted()},reportBufferingCompleted:function t(){i.reportBufferingCompleted()},reportEventWithValue:function t(e,r){i.reportEventWithValue(e,r)},reportUserInitiatedPlayback:function t(){i.reportUserInitiatedPlayback()},reportPlayerState:function t(e){i.reportPlayerState(e)},notifyPackager:function t(e,r){i.notifyPackager(e,r)},setSESRequirements:function t(e){i.setSESRequirements(e)},setSESURL:function t(e){i.setSESURL(e)},reportABRSwitch:function t(e,r){i.reportABRSwitch(e,r)},reportFrameLoss:function t(e){i.reportFrameLoss(e)},reportPresentationSize:function t(e,r){i.reportPresentationSize(e,r)},reportError:function t(e,r){i.reportError(e,r)},reportPlayerSeekCompleted:function t(e){i.reportPlayerSeekCompleted(e)},reportPlayerSeekStarted:function t(){i.reportPlayerSeekStarted()},reportResolutionChange:function t(e){i.reportResolutionChange(e)},reportVolumeChange:function t(e){i.reportVolumeChange(e)},reportPlaybackRateChange:function t(){i.reportPlaybackRateChange()},reportDurationChange:function t(){i.reportDurationChange()},reportSDKVersion:function t(e){i.reportSDKVersion(e)},reportWifiSSID:function t(e){i.reportWifiSSID(e)},reportWifiSignalStrengthPercentage:function t(e){i.reportWifiSignalStrenthPercentage(e)},reportWifiDataRate:function t(e){i.reportWifiDataRate(e)},reportAdState:function t(e){i.reportAdState(e)},reportAdInfo1:function t(e,r,n,a,s,o,d,h){i.reportAdInfo(e,r,n,a,s,o,d,h)},reportAdInfo:function t(e){i.reportAdInfo(e)},reportAdPlaybackTime:function t(e){i.reportAdPlaybackTime(e)},reportAdError:function t(e,r){i.reportAdError(e,r)},reportAdBufferingStarted:function t(){i.reportAdBufferingStarted()},reportAdBufferingCompleted:function t(){i.reportAdBufferingCompleted()},enableLogTrace:function t(e){i.enableLogTrace(e)},updateSubscriber:function t(e,r,n){return i.updateSubscriber(e,r,n)},getPanelStats:function t(){return i.getPanelStats()},getProfileProperties:function t(){return i.getProfileProperties()},setCfValue:function t(e){i.setCfValue(e)},setRegistrationStatus:function t(e){i.setRegistrationStatus(e)},getSessionId:function t(){return i.getSessionId()},getPresentationInfoInternal:function t(){return i.getPresentationInfoInternal()},reportTrackinfo:function t(e,r,n,a,s){return i.reportTrackinfo(e,r,n,a,s)}}));return r.__dashjs_factory_name="MMSmartStreamingSdk",QBRFactoryMaker.setSingletonInstance(e,"MMSmartStreamingSdk",r),r},getInstance:function e(i){if(void 0===i)return t||(t=this.createInstance(this));var r=QBRFactoryMaker.getSingletonInstance(i,"MMSmartStreamingSdk");return r||console.log("ERROR MMSDK Instance not created!"),r}}}(),mmStreamType=Object.freeze({DASH:"dash",HLS:"hls",MSS:"mss",MP4:"mp4"}),mmReactVideoPlayerAdapter=function(){var t=Object.freeze({READY:0,PLAYING:1,PAUSED:2,STOPPED:3}),e=Object.freeze({READY:1,WAITING:2}),i=MMSmartStreaming.createInstance(this),r=void 0,n=void 0,a=!1,s=void 0,o=void 0,d=void 0,h=!1,u=void 0,f=void 0,c=void 0,p=!1,l=void 0,S=0,m=void 0,I={streamURL:"",height:0,width:0,contentHeight:0,contentWidth:0,profileCount:0,duration:0,isLive:void 0,contentType:void 0,title:null,representationArray:[]},v=function(){r=void 0,n=void 0,a=!1,h=!1,p=!1},T=function(t){var e=[],i={assetId:null,assetName:null,videoId:null,contentType:null,metaUrl:null,serverAddress:void 0},r={assetId:null,assetName:null,contentType:null,drmProtection:null,episodeNumber:null,genre:null,season:null,seriesTitle:null,videoId:null};if(void 0!=t&&(t.assetId&&(r.assetId=i.assetId=t.assetId),t.assetName&&(r.assetName=i.assetName=t.assetName),t.videoId&&(r.videoId=i.videoId=t.videoId),t.contentType&&(r.contentType=i.contentType=t.contentType),t.drmProtection&&(r.drmProtection=i.drmProtection=t.drmProtection),t.episodeNumber&&(r.episodeNumber=i.episodeNumber=t.episodeNumber),t.genre&&(r.genre=i.genre=t.genre),t.season&&(r.season=i.season=t.season),t.seriesTitle&&(r.seriesTitle=i.seriesTitle=t.seriesTitle),t.title&&(r.title=i.title=t.title),t.videoType&&(r.videoType=i.videoType=t.videoType),t.customTags))for(var n in t.customTags)e.push({key:n,attributeValue:t.customTags[n]});return{assetInfo:i,customMeta:e,contentMetadata:r}},E=function(){var t;return s&&(-1!==s.indexOf(".m3u8")?t="HLS":-1!==s.indexOf(".mpd")?t="DASH":-1!==s.indexOf("/Manifest")?t="MSS":-1!==s.indexOf("mp4")&&(t="MP4")),t},$=function(){if(!a){v(),r=void 0,n=void 0;var t=T(l),e=t.assetInfo;if(f=t.contentMetadata,d=e.metaUrl,i.initializeSession(MMQBRMode.QBRModeDisabled,s,d,f).catch(function(t){console.log("init SDK Status "+t)}),t.customMeta&&t.customMeta.length)for(var o=0;o<t.customMeta.length;o++)i.reportCustomMetadata(t.customMeta[o].key,t.customMeta[o].attributeValue);e.serverAddress&&i.reportMetricValue(MMOverridableMetric.ServerAddress,e.serverAddress),a=!0}},P=function(t,e,r){o=MMQBRMode.QBRModeDisabled,r&&void 0!=r&&(I.isLive=r),l=e,s=t,i.reportSDKVersion("ReactNative6_1.0.0"),console.log("MMSmartStreaming- "+i.getSDKVersion()),$(),y("Integrating with the MMSmartStreaming- Player Integration - "+i.getSDKVersion())},b=function(){return i.getRegistrationStatus()},D=function(t){try{return u=t,i.enableLogTrace(t)}catch(e){console.log("MMError:"+e.message)}},y=function(t){try{u&&t&&console.log(t)}catch(e){console.log("MMError:"+e.message)}},M=function(){return 1e3*S},g=function(t,e,r,n,a,s){i.registerMMSmartStreaming(t,e,"HTML5JSSDK",r,n,a,s)},R=function(t){I.duration=1e3*t,I.contentType=E(),i.setPresentationInformation(I)},A=function(t,e,r){return i.reportPlayerInfo(t,e,r)},C=function(t,e){try{return i.reportAppInfo(t,e)}catch(r){console.log("MMError:"+r.message)}},B=function(t){let{width:e,height:r}=Dimensions.get("window"),n=PixelRatio.get();var a=void 0;"android"===Platform.OS&&(a="ANDROID"),"ios"===Platform.OS&&(a="IOS"),i.reportDeviceType(a);try{c=t,i.reportDeviceInfo(void 0,void 0,void 0,void 0,void 0,c,e*n,r*n)}catch(s){console.log("MMError:"+s.message)}},N=function(){void 0!==this._prevState&&this._prevState!==t.STOPPED&&(r=void 0,i.reportPlayerState(MMPlayerState.STOPPED)),_player=null},x=function(e){R(e),a||$(),p||void 0!=r&&r!=t.STOPPED||(i.reportUserInitiatedPlayback(),p=!0,r=t.READY,y("User initiated playback reported"))},_=function(){y("onPlay"),void 0!==r&&r!==t.PLAYING&&(r=t.PLAYING,y("Playing"),i.reportPlayerState(MMPlayerState.PLAYING))},L=function(){void 0!==r&&r===t.PLAYING&&(r=t.PAUSED,y("Paused"),i.reportPlayerState(MMPlayerState.PAUSED))},O=function(t){y("Seeked Event"),i.reportPlayerSeekCompleted(t)},k=function(){r=t.STOPPED,i.reportPlayerState(MMPlayerState.STOPPED),a=!1,y("Ended event")},U=function(t){i.reportError(t,M())};let F=t=>{t&&t.currentTime>0&&S!=t.currentTime&&(S=t.currentTime,i.reportPlaybackPosition(M()))},q=a=>{a.isBuffering?void 0!==r&&r!==t.STOPPED&&n!==e.WAITING&&(n=e.WAITING,y("Buffering Started"),i.reportBufferingStarted()):n===e.WAITING&&void 0!==r&&r!==t.STOPPED&&(n=e.READY,y("Buffering Completed"),i.reportBufferingCompleted())};return{initialize:P,getRegistrationStatus:b,registerMMSmartStreaming:g,reportPlayerInfo:A,reportAppInfo:C,setDeviceInfo:B,onLoad:x,onSeekComplete:O,onEnd:k,onError:U,onProgress:F,onBuffer:q,enableLogTrace:D,onDestroy:N,onPlay:_,onPause:L,onBandwidthUpdate:function(t){m!=t.bitrate&&(m=t.bitrate,i.reportDownloadRate(t.bitrate))}}};
3
+
4
+ import React, { useState, useEffect , useRef } from 'react';
5
+ import { Dimensions ,PixelRatio,Platform } from 'react-native';
6
+
7
+ let instance = null;
8
+ export function getMMPlayerAdapter() {
9
+ if (!instance) {
10
+ instance = mmReactVideoPlayerAdapter();
11
+ }
12
+ return instance;
3
13
  }
4
14
 
5
- export default adarsh;
15
+ const createMMVideoPlayer = (VideoComponent) => {
16
+
17
+ return ({
18
+ source,
19
+ style,
20
+ controls = false,
21
+ resizeMode = 'contain',
22
+ onLoad,
23
+ mmOptions
24
+ }) => {
25
+ const mmPlayerAdapter = getMMPlayerAdapter();
26
+ const {
27
+ data: {
28
+ application_name = '',
29
+ application_version = '',
30
+ player_name = '',
31
+ customer_id = '',
32
+ subscriber_id = '',
33
+ domain_name = '',
34
+ subscriber_type = '',
35
+ subscriber_tag = '',
36
+ player_brand = '',
37
+ player_model = '',
38
+ player_version = '',
39
+ device_marketing_name = ''
40
+ } = {},
41
+ content_metadata:{
42
+ asset_name = '',
43
+ asset_id = '',
44
+ video_Id = '',
45
+ content_type = '',
46
+ genre = '',
47
+ drm_protection = '',
48
+ episode_number = '',
49
+ season = '',
50
+ series_title = '',
51
+ is_live = undefined
52
+ } = {},
53
+ custom_tags = {},
54
+ enableLogTrace = true,
55
+ } = mmOptions || {};
56
+
57
+ var mmVideoAssetInfo = {
58
+ "assetName": asset_name,
59
+ "assetId": asset_id,
60
+ "videoId": video_Id,
61
+ "contentType": content_type,
62
+ "genre": genre,
63
+ "drmProtection": drm_protection,
64
+ "episodeNumber": episode_number,
65
+ "season": season,
66
+ "seriesTitle": series_title,
67
+ "customTags": custom_tags
68
+ };
69
+
70
+ let mediaURL = "";
71
+ if(source !== undefined && source){
72
+ mediaURL = source.uri;
73
+ }
74
+ useEffect(() => {
75
+ mmPlayerAdapter.enableLogTrace(enableLogTrace)
76
+ if (mmPlayerAdapter.getRegistrationStatus() === false) {
77
+ mmPlayerAdapter.registerMMSmartStreaming(player_name, customer_id, subscriber_id, domain_name, subscriber_type, subscriber_tag);
78
+ mmPlayerAdapter.reportPlayerInfo(player_brand, player_model, player_version);
79
+ mmPlayerAdapter.reportAppInfo(application_name, application_version);
80
+ mmPlayerAdapter.setDeviceInfo(device_marketing_name);
81
+ mmPlayerAdapter.initialize(mediaURL, mmVideoAssetInfo, is_live);
82
+ }
83
+ }, []);
84
+
85
+
86
+ const handleEnd = () => {
87
+ mmPlayerAdapter.onEnd()
88
+ };
89
+ const handelOnLoad = (event) =>{
90
+ onLoad(event)
91
+ mmPlayerAdapter.onLoad(event.duration)
92
+ }
93
+
94
+ const handelSeek = (event) =>{
95
+ mmPlayerAdapter.onSeekComplete(event.currentTime)
96
+ }
97
+
98
+ const handelOnBuffer = (event) =>{
99
+ mmPlayerAdapter.onBuffer(event)
100
+ }
101
+
102
+ const handelOnVideoError = (event) =>{
103
+ mmPlayerAdapter.onError(JSON.stringify(event.error))
104
+ }
105
+
106
+ const handleOnBandwidthUpdate = (event) => {
107
+ mmPlayerAdapter.onBandwidthUpdate(event)
108
+ };
109
+ return (
110
+ <VideoComponent
111
+ source={source}
112
+ style={style}
113
+ onLoad={handelOnLoad}
114
+ controls={controls}
115
+ resizeMode={resizeMode}
116
+ onProgress={(event) => {
117
+ mmPlayerAdapter.onProgress(event);
118
+ }}
119
+
120
+ onEnd={handleEnd}
121
+ onError={(event) => {handelOnVideoError(event)}}
122
+ onBuffer={handelOnBuffer}
123
+ onSeek = {(event) => {
124
+ handelSeek(event)
125
+ }}
126
+ onPlaybackRateChange = {(event) => {
127
+ if(event.playbackRate == 0){
128
+ mmPlayerAdapter.onPause()
129
+ }else{
130
+ mmPlayerAdapter.onPlay()
131
+ }
132
+ }}
133
+ onPlaybackStateChanged = {(event) => {
134
+ console.log("onPlaybackStateChanged"+event)
135
+ }}
136
+ reportBandwidth={true} // Enable bandwidth reporting on Android
137
+ onBandwidthUpdate={handleOnBandwidthUpdate} // Handle bandwidth update event
138
+ />
139
+ );
140
+ };
141
+ };
6
142
 
143
+ export default createMMVideoPlayer;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "adarsh_hello_world",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "hello ",
5
5
  "main": "index.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "test": "test"
8
9
  },