@castlabs/prestoplay 6.17.1 → 6.19.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 (64) hide show
  1. package/CHANGELOG.md +55 -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 +115 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +575 -565
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -74
  10. package/cjs/cl.externs.js +175 -293
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +70 -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 +315 -314
  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.sessions.js +16 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +90 -89
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +473 -466
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +72 -70
  40. package/cl.externs.js +172 -294
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +74 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +276 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +11 -11
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/clpp.styles.css +14 -0
  63. package/package.json +2 -2
  64. package/typings.d.ts +406 -377
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 qS="Ad Error",rS="onAdBreakStarted()",sS="onAdBreakStopped()",tS=function(a){var b=_.sk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.ek()&&(f="Apple");_.dk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.fk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.ek()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Xj()||_.Uj()||_.Tj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Xj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Uj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Tj("Hisense")&&(b="",f="Hisense")):_.Tj("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},uS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},vS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},xS=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
- uS(!!d);e[Conviva.Constants.ASSET_NAME]=qS;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"]=wS(a.getId()),e["c3.ad.creativeId"]=wS(a.getCreativeId()),e["c3.ad.system"]=wS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=wS(a.getApiFramework()),e["c3.ad.advertiser"]=wS(a.getAdvertiserName()),e["c3.ad.position"]=vS(a.getPodIndex()),e["c3.ad.technology"]=0===a.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=wS(a.vb()),e["c3.ad.adManagerVersion"]=wS(a.wb()),e["c3.ad.advertiserCategory"]=wS(null),e["c3.ad.advertiserId"]=wS(null),e["c3.ad.breakId"]=wS(null),e["c3.ad.campaignName"]=wS(null),e["c3.ad.category"]=wS(null),e["c3.ad.classification"]=wS(null),e["c3.ad.creativeName"]=wS(null),e["c3.ad.sequence"]=wS(a.Ob()),e["c3.ad.sessionStartEvent"]=wS(null),e["c3.ad.unitName"]=wS(null),e["c3.ad.dayPart"]=wS(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"]=wS(b),e["c3.ad.firstAdSystem"]=wS(c),e["c3.ad.firstCreativeId"]=wS(a));return e},wS=function(a){return a?""+a:"NA"},BS=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,_.pc,a.L.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,_.r,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=qS}null===a.a&&yS(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
- zS(a,AS,c)}})},zS=function(a,b,c=qS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case AS:a.a.reportAdFailed(c,xS(null,a.B,a.A));break;case CS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},yS=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=xS(b,a.B,a.A,a.m.isLive()),d=String(b.wb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.vb();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)}}},DS=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(tS(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)},ES=function(a){return a.m.getConfiguration().autoplay||!1},GS=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 _.Hl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.gj(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.h.debug("reportMiscellaneousMetrics()");if(FS(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.ff(h.args)}));a.j=[]}},HS=function(a){if(!a.l&&a.a){const b=uS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},FS=function(a){return null!==a.a&&a.C},IS=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)},JS=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.Ce;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.U(b,c)):b.namespace()===_.jd&&(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.")},KS=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 MS=class{constructor(a,b){this.m=a;this.S=b;this.B="";this.A=_.ra;this.h=new _.R("clpp.conviva.ad");this.f=new _.ks;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||_.ra;BS(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ja):(_.mh(this.f),this.a&&zS(this,LS),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.Dd);this.o?this.h.debug(_.ia):this.o=!0}C(){this.h.debug(rS)}F(){this.h.debug(sS)}L(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"),yS(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.zb(),a.yb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.nb())}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 _.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.h.debug("onAdStopped()");this.a&&!this.g&&zS(this,LS)}K(){this.h.debug("onAdSkipped()");this.a&&zS(this,CS)}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;yS(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.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){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)}},CS=0,LS=1,AS=2;var NS=class{constructor(a,b){this.m=a;this.f=new _.ks;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=_.Ng(b),this.K=c,this.m=a,DS(this,this.F),this.f.on(this.m,_.Qe,this.da.bind(this)),this.f.on(this.m,_.Jf,this.Y.bind(this)),this.f.on(this.m,_.Mc,this.L.bind(this)),this.f.on(this.m,_.cg,this.X.bind(this)),this.f.on(this.m,
19
- _.bg,this.W.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.ea.bind(this)),this.f.on(this.m,_.r,this.N.bind(this)),ES(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),GS(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ja):(_.mh(this.f),FS(this)||this.o||!ES(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),FS(this)&&
20
- IS(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.Dd);this.l?this.h.debug(_.ia):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}da(){this.h.debug("onPlayRequest()");FS(this)||ES(this)?FS(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),FS(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
- GS(this))}Y(a){this.h.debug(_.He);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),DS(this,this.F),GS(this),HS(this),FS(this))){var d=this.m.getTrackManager();d=d.ma()||d.$a();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)}FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Wn:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.Vn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.On:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Ln:this.h.debug("onVideoEnded()"),FS(this)&&(this.w&&this.w.pb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):IS(this))}}L(a){this.h.debug(_.De);if(FS(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({ff:this.L.bind(this),args:a})}X(){this.h.debug("onSeeking()");FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");FS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.h.debug(rS);
24
- var b=a.ad;a=0===b.ab();const c=vS(b.getPodIndex());FS(this)||ES(this)||!a||GS(this);if(FS(this)){a=0===b.Cb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Bb()&&(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||_.dk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}T(){this.h.debug(sS);
25
- FS(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&IS(this))}N(a){this.h.debug(_.Ee);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,FS(this)||GS(this));FS(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,IS(this))):this.j.push({ff:this.N.bind(this),args:a})}}ea(){this.h.debug("onAutoPlayBlocked()");FS(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,FS(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var OS=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new NS(a,this.h)}onContentWillLoad(a,b){JS(this,a);if(this.a){var c=a.getConfiguration();c=_.Ng(c.conviva||{});try{KS(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new MS(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&HS(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"}U(a,b){a.trigger(new _.E(_.r,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",OS);OS.prototype.reportAppEvent=OS.prototype.reportAppEvent;OS.Id="conviva";_.ap(new class{create(){return new OS}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var MS="Ad Error",NS="onAdBreakStarted()",OS="onAdBreakStopped()",PS=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},QS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},RS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},TS=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
+ QS(!!d);e[Conviva.Constants.ASSET_NAME]=MS;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"]=SS(a.getId()),e["c3.ad.creativeId"]=SS(a.getCreativeId()),e["c3.ad.system"]=SS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=SS(a.getApiFramework()),e["c3.ad.advertiser"]=SS(a.getAdvertiserName()),e["c3.ad.position"]=RS(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=SS(a.hb()),e["c3.ad.adManagerVersion"]=SS(a.ib()),e["c3.ad.advertiserCategory"]=SS(null),e["c3.ad.advertiserId"]=SS(null),e["c3.ad.breakId"]=SS(null),e["c3.ad.campaignName"]=SS(null),e["c3.ad.category"]=SS(null),e["c3.ad.classification"]=SS(null),e["c3.ad.creativeName"]=SS(null),e["c3.ad.sequence"]=SS(a.Cb()),e["c3.ad.sessionStartEvent"]=SS(null),e["c3.ad.unitName"]=SS(null),e["c3.ad.dayPart"]=SS(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"]=SS(b),e["c3.ad.firstAdSystem"]=SS(c),e["c3.ad.firstCreativeId"]=SS(a));return e},SS=function(a){return a?""+a:"NA"},XS=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=MS}null===a.a&&US(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ VS(a,WS,c)}})},VS=function(a,b,c=MS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case WS:a.a.reportAdFailed(c,TS(null,a.B,a.A));break;case YS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},US=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=TS(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)}}},ZS=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(PS(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)},$S=function(a){return a.m.getConfiguration().autoplay||!1},bT=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 _.Nl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.mj(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(aT(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=[]}},cT=function(a){if(!a.l&&a.a){const b=QS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},aT=function(a){return null!==a.a&&a.C},dT=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)},eT=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.")},fT=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 hT=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 _.Bs;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;XS(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.rh(this.f),this.a&&VS(this,gT),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(NS)}F(){this.g.debug(OS)}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"),US(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&&VS(this,gT)}K(){this.g.debug("onAdSkipped()");this.a&&VS(this,YS)}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;US(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)}},YS=0,gT=1,WS=2;var iT=class{constructor(a,b){this.m=a;this.f=new _.Bs;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,ZS(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)),$S(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),bT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.rh(this.f),aT(this)||this.o||!$S(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),aT(this)&&
20
+ dT(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()");aT(this)||$S(this)?aT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),aT(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
+ bT(this))}Y(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),ZS(this,this.F),bT(this),cT(this),aT(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)}aT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.bo:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.ao:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Un:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Rn:this.g.debug("onVideoEnded()"),aT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):dT(this))}}L(a){this.g.debug(_.Ge);if(aT(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()");aT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");aT(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(NS);
24
+ var b=a.ad;a=0===b.Ua();const c=RS(b.getPodIndex());aT(this)||$S(this)||!a||bT(this);if(aT(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(OS);
25
+ aT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&dT(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,aT(this)||bT(this));aT(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,dT(this))):this.j.push({hf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");aT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,aT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var jT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new iT(a,this.g)}onContentWillLoad(a,b){eT(this,a);if(this.a){var c=a.getConfiguration();c=_.Rg(c.conviva||{});try{fT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new hT(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&&cT(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",jT);jT.prototype.reportAppEvent=jT.prototype.reportAppEvent;jT.Id="conviva";_.rq(new class{create(){return new jT}});};f.call(g, window);