@castlabs/prestoplay 6.14.1 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +114 -112
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -538
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +193 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +368 -264
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +455 -443
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +189 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +318 -236
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +393 -57
package/cl.conviva.js CHANGED
@@ -1,27 +1,27 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var aP="Ad Error",bP="onAdBreakStarted()",cP="onAdBreakStopped()",dP=function(a){var b=_.bk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Nj()&&(f="Apple");_.Mj()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Oj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Nj()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Gj()||_.Dj()||_.Cj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Gj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Dj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Cj("Hisense")&&(b="",f="Hisense")):_.Cj("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
- c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},eP=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},fP=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},hP=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
- eP(!!d);e[Conviva.Constants.ASSET_NAME]=aP;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=gP(a.getId()),e["c3.ad.creativeId"]=gP(a.getCreativeId()),e["c3.ad.system"]=gP(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=gP(a.getApiFramework()),e["c3.ad.advertiser"]=gP(a.getAdvertiserName()),e["c3.ad.position"]=fP(a.getPodIndex()),e["c3.ad.technology"]=0===a.zb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=gP(a.sb()),e["c3.ad.adManagerVersion"]=gP(a.tb()),e["c3.ad.advertiserCategory"]=gP(null),e["c3.ad.advertiserId"]=gP(null),e["c3.ad.breakId"]=gP(null),e["c3.ad.campaignName"]=gP(null),e["c3.ad.category"]=gP(null),e["c3.ad.classification"]=gP(null),e["c3.ad.creativeName"]=gP(null),e["c3.ad.sequence"]=gP(a.Kb()),e["c3.ad.sessionStartEvent"]=gP(null),e["c3.ad.unitName"]=gP(null),e["c3.ad.dayPart"]=gP(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=gP(b),e["c3.ad.firstAdSystem"]=gP(c),e["c3.ad.firstCreativeId"]=gP(a));return e},gP=function(a){return a?""+a:"NA"},lP=function(a){a.f.on(a.m,_.Xb,a.C.bind(a));a.f.on(a.m,_.Zb,a.F.bind(a));a.f.on(a.m,_.kc,a.M.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.ic,a.l.bind(a));a.f.on(a.m,_.$b,a.l.bind(a));a.f.on(a.m,_.lc,a.O.bind(a));
7
- a.f.on(a.m,_.jc,a.K.bind(a));a.f.on(a.m,_.ac,a.G.bind(a));a.f.on(a.m,_.dc,a.I.bind(a));a.f.on(a.m,_.ec,a.J.bind(a));a.f.on(a.m,_.cc,a.H.bind(a));a.f.on(a.m,_.fc,a.V.bind(a));a.f.on(a.m,_.mc,a.R.bind(a));a.f.on(a.m,_.Qd,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=aP}null===a.a&&iP(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
- jP(a,kP,c)}})},jP=function(a,b,c=aP){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case kP:a.a.reportAdFailed(c,hP(null,a.B,a.A));break;case mP:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},iP=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.U()),b){const c=hP(b,a.B,a.A,a.m.isLive()),d=String(b.tb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.sb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},nP=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(dP(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},oP=function(a){return a.m.getConfiguration().autoplay||!1},qP=function(a){if(!a.l)if(a.C)a.h.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.h.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.ql(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ri(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(pP(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.Te(h.args)}));a.j=[]}},rP=function(a){if(!a.l&&a.a){const b=eP(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},pP=function(a){return null!==a.a&&a.C},sP=function(a){a.h.debug("terminateSession()");
13
- a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},tP=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.ye;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.T(b,c)):b.namespace()===_.fd&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},uP=function(a){const b=[];typeof a===_.ye&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var wP=class{constructor(a,b){this.m=a;this.U=b;this.B="";this.A=_.pa;this.h=new _.R("clpp.conviva.ad");this.f=new _.Er;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;lP(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ia):(_.Xg(this.f),this.a&&jP(this,vP),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.zd);this.o?this.h.debug(_.ha):this.o=!0}C(){this.h.debug(bP)}F(){this.h.debug(cP)}M(a){this.h.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),iP(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.wb(),a.vb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.jb())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.hc:case _.ic:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.gc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.$b:b(Conviva.Constants.PlayerState.BUFFERING)}}}O(){this.h.debug("onAdStopped()");this.a&&!this.g&&jP(this,vP)}K(){this.h.debug("onAdSkipped()");this.a&&jP(this,mP)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.h.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;iP(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Ff,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Ff),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}V(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},mP=0,vP=1,kP=2;var xP=class{constructor(a,b){this.m=a;this.f=new _.Er;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.yg(b),this.K=c,this.m=a,nP(this,this.F),this.f.on(this.m,_.Me,this.oa.bind(this)),this.f.on(this.m,_.vf,this.aa.bind(this)),this.f.on(this.m,_.Lc,this.M.bind(this)),this.f.on(this.m,_.Pf,this.Z.bind(this)),this.f.on(this.m,
19
- _.Of,this.W.bind(this)),this.f.on(this.m,_.Xb,this.U.bind(this)),this.f.on(this.m,_.Zb,this.V.bind(this)),this.f.on(this.m,_.oc,this.ba.bind(this)),this.f.on(this.m,_.Kc,this.fa.bind(this)),this.f.on(this.m,_.Qd,this.O.bind(this)),oP(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),qP(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ia):(_.Xg(this.f),pP(this)||this.o||!oP(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),pP(this)&&
20
- sP(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.zd);this.l?this.h.debug(_.ha):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}oa(){this.h.debug("onPlayRequest()");pP(this)||oP(this)?pP(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),pP(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- qP(this))}aa(a){this.h.debug(_.De);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),nP(this,this.F),qP(this),rP(this),pP(this))){var d=this.m.getTrackManager();d=d.ka()||d.Va();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Fn:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.En:b(Conviva.Constants.PlayerState.PAUSED);break;case _.xn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.un:this.h.debug("onVideoEnded()"),pP(this)&&(this.w&&this.w.kb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):sP(this))}}M(a){this.h.debug(_.ze);if(pP(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
- a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({Te:this.M.bind(this),args:a})}Z(){this.h.debug("onSeeking()");pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}U(a){this.h.debug(bP);
24
- var b=a.ad;a=0===b.Wa();const c=fP(b.getPodIndex());pP(this)||oP(this)||!a||qP(this);if(pP(this)){a=0===b.zb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.yb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Mj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}V(){this.h.debug(cP);
25
- pP(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&sP(this))}O(a){this.h.debug(_.Ae);if(this.o&&this.I)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,pP(this)||qP(this));pP(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
- this.I=!0,sP(this))):this.j.push({Te:this.O.bind(this),args:a})}}fa(){this.h.debug("onAutoPlayBlocked()");pP(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,pP(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var yP=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new xP(a,this.h)}onContentWillLoad(a,b){tP(this,a);if(this.a){var c=a.getConfiguration();c=_.yg(c.conviva||{});try{uP(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new wP(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&rP(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.Qd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",yP);yP.prototype.reportAppEvent=yP.prototype.reportAppEvent;yP.Id="conviva";_.Ho(new class{create(){return new yP}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VT="Ad Error",WT="onAdBreakStarted()",XT="onAdBreakStopped()",YT=function(a){var b=_.rk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.dk()&&(f="Apple");_.ck()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ek()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.dk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Wj()||_.Tj()||_.Sj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Wj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Tj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Sj("Hisense")&&(b="",f="Hisense")):_.Sj("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
+ c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},ZT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},$T=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},bU=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
+ ZT(!!d);e[Conviva.Constants.ASSET_NAME]=VT;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=aU(a.getId()),e["c3.ad.creativeId"]=aU(a.getCreativeId()),e["c3.ad.system"]=aU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=aU(a.getApiFramework()),e["c3.ad.advertiser"]=aU(a.getAdvertiserName()),e["c3.ad.position"]=$T(a.getPodIndex()),e["c3.ad.technology"]=0===a.Mb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=aU(a.Gb()),e["c3.ad.adManagerVersion"]=aU(a.Hb()),e["c3.ad.advertiserCategory"]=aU(null),e["c3.ad.advertiserId"]=aU(null),e["c3.ad.breakId"]=aU(null),e["c3.ad.campaignName"]=aU(null),e["c3.ad.category"]=aU(null),e["c3.ad.classification"]=aU(null),e["c3.ad.creativeName"]=aU(null),e["c3.ad.sequence"]=aU(a.Zb()),e["c3.ad.sessionStartEvent"]=aU(null),e["c3.ad.unitName"]=aU(null),e["c3.ad.dayPart"]=aU(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=aU(b),e["c3.ad.firstAdSystem"]=aU(c),e["c3.ad.firstCreativeId"]=aU(a));return e},aU=function(a){return a?""+a:"NA"},fU=function(a){a.f.on(a.m,_.bc,a.D.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.pc,a.M.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.lc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.qc,a.N.bind(a));
7
+ a.f.on(a.m,_.oc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.hc,a.I.bind(a));a.f.on(a.m,_.ic,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.jc,a.T.bind(a));a.f.on(a.m,_.rc,a.R.bind(a));a.f.on(a.m,_.q,b=>{var c=b.detail;if(10003===c.code&&(a.g.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=VT}null===a.a&&cU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ dU(a,eU,c)}})},dU=function(a,b,c=VT){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case eU:a.a.reportAdFailed(c,bU(null,a.C,a.A));break;case gU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},cU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=bU(b,a.C,a.A,a.m.isLive()),d=String(b.Hb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.Gb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},hU=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(YT(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.fa;a.a.setPlayerInfo(b)},iU=function(a){return a.m.getConfiguration().autoplay||!1},kU=function(a){if(!a.l)if(a.D)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.Fl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.fj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.A(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(jU(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.D=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.vf(h.args)}));a.j=[]}},lU=function(a){if(!a.l&&a.a){const b=ZT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},jU=function(a){return null!==a.a&&a.D},mU=function(a){a.g.debug("terminateSession()");
13
+ a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.D=!1,a.A=!1,a.h=!1,a.w=null,a.C=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},nU=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.Ce;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.W(b,c)):b.namespace()===_.jd&&(a.a=!1,
14
+ a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},oU=function(a){const b=[];typeof a===_.Ce&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var qU=class{constructor(a,b){this.m=a;this.S=b;this.C="";this.A=_.ra;this.g=new _.S("clpp.conviva.ad");this.f=new _.$r;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.C=a.viewerId;this.A=a.playerName||_.ra;fU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.lh(this.f),this.a&&dU(this,pU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Dd);this.o?this.g.debug(_.ia):this.o=!0}D(){this.g.debug(WT)}F(){this.g.debug(XT)}M(a){this.g.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),cU(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.Kb(),a.Jb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.yb())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.mc:case _.nc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.lc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.g.debug("onAdStopped()");this.a&&!this.h&&dU(this,pU)}K(){this.g.debug("onAdSkipped()");this.a&&dU(this,gU)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.g.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;cU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Tf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Tf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},gU=0,pU=1,eU=2;var rU=class{constructor(a,b){this.m=a;this.f=new _.$r;this.a=null;this.o=!1;this.G=!0;this.C=this.h=this.A=this.D=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Mg(b),this.K=c,this.m=a,hU(this,this.F),this.f.on(this.m,_.Qe,this.ga.bind(this)),this.f.on(this.m,_.Jf,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.M.bind(this)),this.f.on(this.m,_.bg,this.Y.bind(this)),this.f.on(this.m,
19
+ _.ag,this.X.bind(this)),this.f.on(this.m,_.bc,this.S.bind(this)),this.f.on(this.m,_.cc,this.T.bind(this)),this.f.on(this.m,_.tc,this.aa.bind(this)),this.f.on(this.m,_.Lc,this.da.bind(this)),this.f.on(this.m,_.q,this.N.bind(this)),iU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),kU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.lh(this.f),jU(this)||this.o||!iU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),jU(this)&&
20
+ mU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Dd);this.l?this.g.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}ga(){this.g.debug("onPlayRequest()");jU(this)||iU(this)?jU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),jU(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ kU(this))}Z(a){this.g.debug(_.He);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),hU(this,this.F),kU(this),lU(this),jU(this))){var d=this.m.getTrackManager();d=d.oa()||d.kb();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Un:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.Tn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Mn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Jn:this.g.debug("onVideoEnded()"),jU(this)&&(this.w&&this.w.Ab()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):mU(this))}}M(a){this.g.debug(_.De);if(jU(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
+ a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({vf:this.M.bind(this),args:a})}Y(){this.g.debug("onSeeking()");jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}X(){this.g.debug("onSeeked()");jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.g.debug(WT);
24
+ var b=a.ad;a=0===b.lb();const c=$T(b.getPodIndex());jU(this)||iU(this)||!a||kU(this);if(jU(this)){a=0===b.Mb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Lb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.ck()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.C=!0}else this.g.debug("Bug: should already have a valid session")}T(){this.g.debug(XT);
25
+ jU(this)&&this.C&&(this.a.reportAdBreakEnded(),this.C=!1,this.J&&mU(this))}N(a){this.g.debug(_.Ee);if(this.o&&this.I)this.g.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.E&&(d=Conviva.Constants.ErrorSeverity.FATAL,jU(this)||kU(this));jU(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
+ this.I=!0,mU(this))):this.j.push({vf:this.N.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");jU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,jU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var sU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new rU(a,this.g)}onContentWillLoad(a,b){nU(this,a);if(this.a){var c=a.getConfiguration();c=_.Mg(c.conviva||{});try{oU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new qU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?this.W(a,d):this.W(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&lU(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}W(a,b){a.trigger(new _.D(_.q,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",sU);sU.prototype.reportAppEvent=sU.prototype.reportAppEvent;sU.Id="conviva";_.Wo(new class{create(){return new sU}});};f.call(g, window);