@castlabs/prestoplay 6.19.1 → 6.20.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 (65) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +8 -6
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +7 -7
  6. package/cjs/cl.cast.js +108 -108
  7. package/cjs/cl.conviva.js +33 -33
  8. package/cjs/cl.core.js +571 -567
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +77 -77
  11. package/cjs/cl.externs.js +34 -35
  12. package/cjs/cl.freewheel.js +21 -20
  13. package/cjs/cl.hls.js +71 -70
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +29 -28
  16. package/cjs/cl.ima.js +24 -24
  17. package/cjs/cl.mse.js +311 -309
  18. package/cjs/cl.muxdata.js +15 -15
  19. package/cjs/cl.onboard.js +3 -3
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.sessions.js +16 -16
  23. package/cjs/cl.simid.js +15 -15
  24. package/cjs/cl.smooth.js +72 -71
  25. package/cjs/cl.thumbnails.js +26 -26
  26. package/cjs/cl.tizen.js +69 -69
  27. package/cjs/cl.ttml.js +29 -28
  28. package/cjs/cl.verimatrix.js +5 -5
  29. package/cjs/cl.vimond.js +13 -12
  30. package/cjs/cl.vr.js +19 -19
  31. package/cjs/cl.vtt.js +14 -14
  32. package/cjs/cl.youbora.js +16 -16
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +459 -455
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +72 -72
  41. package/cl.externs.js +34 -35
  42. package/cl.freewheel.js +18 -18
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -25
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +278 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -9
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.youbora.js +14 -14
  63. package/clpp.styles.css +0 -8
  64. package/package.json +1 -1
  65. package/typings.d.ts +36 -14
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 OS="Ad Error",PS="onAdBreakStarted()",QS="onAdBreakStopped()",RS=function(a){var b=_.yk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.kk()&&(f="Apple");_.jk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.lk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.kk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.dk()||_.ak()||_.Zj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.dk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.ak()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Zj("Hisense")&&(b="",f="Hisense")):_.Zj("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},SS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},TS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},VS=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
- SS(!!d);e[Conviva.Constants.ASSET_NAME]=OS;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"]=US(a.getId()),e["c3.ad.creativeId"]=US(a.getCreativeId()),e["c3.ad.system"]=US(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=US(a.getApiFramework()),e["c3.ad.advertiser"]=US(a.getAdvertiserName()),e["c3.ad.position"]=TS(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=US(a.hb()),e["c3.ad.adManagerVersion"]=US(a.ib()),e["c3.ad.advertiserCategory"]=US(null),e["c3.ad.advertiserId"]=US(null),e["c3.ad.breakId"]=US(null),e["c3.ad.campaignName"]=US(null),e["c3.ad.category"]=US(null),e["c3.ad.classification"]=US(null),e["c3.ad.creativeName"]=US(null),e["c3.ad.sequence"]=US(a.Cb()),e["c3.ad.sessionStartEvent"]=US(null),e["c3.ad.unitName"]=US(null),e["c3.ad.dayPart"]=US(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"]=US(b),e["c3.ad.firstAdSystem"]=US(c),e["c3.ad.firstCreativeId"]=US(a));return e},US=function(a){return a?""+a:"NA"},ZS=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.sc,a.L.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.qc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.tc,a.M.bind(a));
7
- a.f.on(a.m,_.rc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.lc,a.I.bind(a));a.f.on(a.m,_.mc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.nc,a.S.bind(a));a.f.on(a.m,_.uc,a.O.bind(a));a.f.on(a.m,_.Vd,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=OS}null===a.a&&WS(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- XS(a,YS,c)}})},XS=function(a,b,c=OS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case YS:a.a.reportAdFailed(c,VS(null,a.B,a.A));break;case $S:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},WS=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=VS(b,a.B,a.A,a.m.isLive()),d=String(b.ib()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.hb();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)}}},aT=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(RS(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]=_.da;a.a.setPlayerInfo(b)},bT=function(a){return a.m.getConfiguration().autoplay||!1},dT=function(a){if(!a.l)if(a.C)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 _.Rl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.lj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;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.g.debug("reportMiscellaneousMetrics()");if(cT(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.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.hf(h.args)}));a.j=[]}},eT=function(a){if(!a.l&&a.a){const b=SS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},cT=function(a){return null!==a.a&&a.C},fT=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.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},gT=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Fe;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.kd&&(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.")},hT=function(a){const b=[];typeof a===_.Fe&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var jT=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.R("clpp.conviva.ad");this.f=new _.Fs;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.B=a.viewerId;this.A=a.playerName||_.ra;ZS(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.nh(this.f),this.a&&XS(this,iT),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}C(){this.g.debug(PS)}F(){this.g.debug(QS)}L(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"),WS(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.lb(),a.kb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())}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 _.pc:case _.qc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.oc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&XS(this,iT)}K(){this.g.debug("onAdSkipped()");this.a&&XS(this,$S)}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;WS(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Xf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Xf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},$S=0,iT=1,YS=2;var kT=class{constructor(a,b){this.m=a;this.f=new _.Fs;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=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=_.Rg(b),this.K=c,this.m=a,aT(this,this.F),this.f.on(this.m,_.Te,this.da.bind(this)),this.f.on(this.m,_.Mf,this.Y.bind(this)),this.f.on(this.m,_.Pc,this.L.bind(this)),this.f.on(this.m,_.gg,this.X.bind(this)),this.f.on(this.m,
19
- _.fg,this.V.bind(this)),this.f.on(this.m,_.cc,this.R.bind(this)),this.f.on(this.m,_.dc,this.S.bind(this)),this.f.on(this.m,_.wc,this.Z.bind(this)),this.f.on(this.m,_.Oc,this.ba.bind(this)),this.f.on(this.m,_.Vd,this.M.bind(this)),bT(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),dT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.nh(this.f),cT(this)||this.o||!bT(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),cT(this)&&
20
- fT(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}da(){this.g.debug("onPlayRequest()");cT(this)||bT(this)?cT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),cT(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
- dT(this))}Y(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),aT(this,this.F),dT(this),eT(this),cT(this))){var d=this.m.getTrackManager();d=d.ma()||d.jb();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)}cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.go:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.fo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Yn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Vn:this.g.debug("onVideoEnded()"),cT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):fT(this))}}L(a){this.g.debug(_.Ge);if(cT(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({hf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(PS);
24
- var b=a.ad;a=0===b.Ua();const c=TS(b.getPodIndex());cT(this)||bT(this)||!a||dT(this);if(cT(this)){a=0===b.ob()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.nb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.jk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(QS);
25
- cT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&fT(this))}M(a){this.g.debug(_.He);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,cT(this)||dT(this));cT(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,fT(this))):this.j.push({hf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");cT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,cT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var lT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new kT(a,this.g)}onContentWillLoad(a,b){gT(this,a);if(this.a){var c=a.getConfiguration();c=_.Rg(c.conviva||{});try{hT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new jT(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&eT(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"}T(a,b){a.trigger(new _.C(_.Vd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",lT);lT.prototype.reportAppEvent=lT.prototype.reportAppEvent;lT.Id="conviva";_.jr(new class{create(){return new lT}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var eT="Ad Error",fT="onAdBreakStarted()",gT="onAdBreakStopped()",hT=function(a){var b=_.Ok();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Ak()&&(f="Apple");_.zk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Bk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Ak()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.tk()||_.qk()||_.pk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.tk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.qk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.pk("Hisense")&&(b="",f="Hisense")):_.pk("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},iT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},jT=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},lT=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
+ iT(!!d);e[Conviva.Constants.ASSET_NAME]=eT;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"]=kT(a.getId()),e["c3.ad.creativeId"]=kT(a.getCreativeId()),e["c3.ad.system"]=kT(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=kT(a.getApiFramework()),e["c3.ad.advertiser"]=kT(a.getAdvertiserName()),e["c3.ad.position"]=jT(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=kT(a.hb()),e["c3.ad.adManagerVersion"]=kT(a.ib()),e["c3.ad.advertiserCategory"]=kT(null),e["c3.ad.advertiserId"]=kT(null),e["c3.ad.breakId"]=kT(null),e["c3.ad.campaignName"]=kT(null),e["c3.ad.category"]=kT(null),e["c3.ad.classification"]=kT(null),e["c3.ad.creativeName"]=kT(null),e["c3.ad.sequence"]=kT(a.Cb()),e["c3.ad.sessionStartEvent"]=kT(null),e["c3.ad.unitName"]=kT(null),e["c3.ad.dayPart"]=kT(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"]=kT(b),e["c3.ad.firstAdSystem"]=kT(c),e["c3.ad.firstCreativeId"]=kT(a));return e},kT=function(a){return a?""+a:"NA"},pT=function(a){a.f.on(a.m,_.bc,a.C.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.rc,a.L.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.sc,a.M.bind(a));
7
+ a.f.on(a.m,_.qc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.kc,a.I.bind(a));a.f.on(a.m,_.lc,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.mc,a.S.bind(a));a.f.on(a.m,_.tc,a.O.bind(a));a.f.on(a.m,_.Ud,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=eT}null===a.a&&mT(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ nT(a,oT,c)}})},nT=function(a,b,c=eT){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case oT:a.a.reportAdFailed(c,lT(null,a.B,a.A));break;case qT:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},mT=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=lT(b,a.B,a.A,a.m.isLive()),d=String(b.ib()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.hb();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)}}},rT=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(hT(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)},sT=function(a){return a.m.getConfiguration().autoplay||!1},uT=function(a){if(!a.l)if(a.C)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 _.cm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ej(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.g.debug("reportMiscellaneousMetrics()");if(tT(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.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.jf(h.args)}));a.j=[]}},vT=function(a){if(!a.l&&a.a){const b=iT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},tT=function(a){return null!==a.a&&a.C},wT=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.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},xT=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.De;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.jd&&(a.a=!1,
14
+ a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},yT=function(a){const b=[];typeof a===_.De&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var AT=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.pa;this.g=new _.R("clpp.conviva.ad");this.f=new _.Rs;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.B=a.viewerId;this.A=a.playerName||_.pa;pT(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ha):(_.ph(this.f),this.a&&nT(this,zT),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Cd);this.o?this.g.debug(_.fa):this.o=!0}C(){this.g.debug(fT)}F(){this.g.debug(gT)}L(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"),mT(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.lb(),a.kb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())}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 _.oc:case _.pc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.nc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&nT(this,zT)}K(){this.g.debug("onAdSkipped()");this.a&&nT(this,qT)}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;mT(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Wf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Wf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},qT=0,zT=1,oT=2;var BT=class{constructor(a,b){this.m=a;this.f=new _.Rs;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=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=_.Pg(b),this.K=c,this.m=a,rT(this,this.F),this.f.on(this.m,_.Re,this.da.bind(this)),this.f.on(this.m,_.Mf,this.Y.bind(this)),this.f.on(this.m,_.Oc,this.L.bind(this)),this.f.on(this.m,_.fg,this.X.bind(this)),this.f.on(this.m,
19
+ _.eg,this.V.bind(this)),this.f.on(this.m,_.bc,this.R.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.vc,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.ba.bind(this)),this.f.on(this.m,_.Ud,this.M.bind(this)),sT(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),uT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ha):(_.ph(this.f),tT(this)||this.o||!sT(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),tT(this)&&
20
+ wT(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Cd);this.l?this.g.debug(_.fa):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}da(){this.g.debug("onPlayRequest()");tT(this)||sT(this)?tT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),tT(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
+ uT(this))}Y(a){this.g.debug(_.Ie);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),rT(this,this.F),uT(this),vT(this),tT(this))){var d=this.m.getTrackManager();d=d.ma()||d.jb();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)}tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.so:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.ro:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ko:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.ho:this.g.debug("onVideoEnded()"),tT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):wT(this))}}L(a){this.g.debug(_.Ee);if(tT(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({jf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");tT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(fT);
24
+ var b=a.ad;a=0===b.Va();const c=jT(b.getPodIndex());tT(this)||sT(this)||!a||uT(this);if(tT(this)){a=0===b.ob()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.nb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.zk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(gT);
25
+ tT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&wT(this))}M(a){this.g.debug(_.Fe);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,tT(this)||uT(this));tT(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,wT(this))):this.j.push({jf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");tT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,tT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var CT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new BT(a,this.g)}onContentWillLoad(a,b){xT(this,a);if(this.a){var c=a.getConfiguration();c=_.Pg(c.conviva||{});try{yT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new AT(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&vT(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"}T(a,b){a.trigger(new _.C(_.Ud,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",CT);CT.prototype.reportAppEvent=CT.prototype.reportAppEvent;CT.Id="conviva";_.Hq(new class{create(){return new CT}});};f.call(g, window);