@castlabs/prestoplay 6.30.0 → 6.31.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 +247 -179
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -7
  5. package/cjs/cl.cast.js +120 -120
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +567 -566
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +95 -92
  10. package/cjs/cl.externs.js +224 -40
  11. package/cjs/cl.freewheel.js +26 -25
  12. package/cjs/cl.hls.js +79 -78
  13. package/cjs/cl.hlssmpte.js +4 -4
  14. package/cjs/cl.htmlcue.js +19 -19
  15. package/cjs/cl.ima.js +26 -25
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -350
  18. package/cjs/cl.muxdata.js +13 -13
  19. package/cjs/cl.onboard.js +2 -2
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +10 -10
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +16 -16
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +15 -15
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -11
  29. package/cjs/cl.vr.js +12 -12
  30. package/cjs/cl.vtt.js +12 -12
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +35 -35
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -6
  36. package/cl.cast.js +99 -98
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +413 -412
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +87 -84
  41. package/cl.externs.js +225 -37
  42. package/cl.freewheel.js +20 -19
  43. package/cl.hls.js +76 -76
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -19
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +299 -300
  49. package/cl.muxdata.js +12 -12
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +62 -60
  55. package/cl.thumbnails.js +17 -17
  56. package/cl.tizen.js +55 -55
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +8 -7
  65. package/typings.d.ts +85 -61
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 lU="Ad Error",mU="onAdBreakStarted()",nU="onAdBreakStopped()",oU=function(a){var b=_.mj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Zi()&&(f="Apple");_.Yi()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.$i()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Zi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mU="Ad Error",nU="onAdBreakStarted()",oU="onAdBreakStopped()",pU=function(a){var b=_.lj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Yi()&&(f="Apple");_.Xi()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Zi()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Yi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
2
  _.Si()||_.Pi()||_.Oi("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Si()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Pi()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Oi("Hisense")&&(b="",f="Hisense")):_.Oi("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},pU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},qU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},sU=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
- pU(!!d);e[Conviva.Constants.ASSET_NAME]=lU;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"]=rU(a.getId()),e["c3.ad.creativeId"]=rU(a.getCreativeId()),e["c3.ad.system"]=rU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=rU(a.getApiFramework()),e["c3.ad.advertiser"]=rU(a.getAdvertiserName()),e["c3.ad.position"]=qU(a.getPodIndex()),e["c3.ad.technology"]=0===a.ub()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=rU(a.nb()),e["c3.ad.adManagerVersion"]=rU(a.ob()),e["c3.ad.advertiserCategory"]=rU(null),e["c3.ad.advertiserId"]=rU(null),e["c3.ad.breakId"]=rU(null),e["c3.ad.campaignName"]=rU(null),e["c3.ad.category"]=rU(null),e["c3.ad.classification"]=rU(null),e["c3.ad.creativeName"]=rU(null),e["c3.ad.sequence"]=rU(a.rb()),e["c3.ad.sessionStartEvent"]=rU(null),e["c3.ad.unitName"]=rU(null),e["c3.ad.dayPart"]=rU(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"]=rU(b),e["c3.ad.firstAdSystem"]=rU(c),e["c3.ad.firstCreativeId"]=rU(a));return e},rU=function(a){return a?""+a:"NA"},wU=function(a){a.f.on(a.m,_.Tb,a.C.bind(a));a.f.on(a.m,_.Ub,a.F.bind(a));a.f.on(a.m,_.lc,a.L.bind(a));a.f.on(a.m,_.ic,a.l.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.jc,a.l.bind(a));a.f.on(a.m,_.Vb,a.l.bind(a));a.f.on(a.m,_.mc,a.M.bind(a));
7
- a.f.on(a.m,_.kc,a.K.bind(a));a.f.on(a.m,_.Wb,a.G.bind(a));a.f.on(a.m,_.bc,a.I.bind(a));a.f.on(a.m,_.ec,a.J.bind(a));a.f.on(a.m,_.Yb,a.H.bind(a));a.f.on(a.m,_.gc,a.T.bind(a));a.f.on(a.m,_.nc,a.P.bind(a));a.f.on(a.m,_.Xd,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=lU}null===a.a&&tU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- uU(a,vU,c)}})},uU=function(a,b,c=lU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case vU:a.a.reportAdFailed(c,sU(null,a.B,a.A));break;case xU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},tU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=sU(b,a.B,a.A,a.m.isLive()),d=String(b.ob()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.nb();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)}}},yU=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(oU(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]=_.ea;a.a.setPlayerInfo(b)},zU=function(a){return a.m.getConfiguration().autoplay||!1},BU=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 _.gp(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Nm(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(AU(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.ig(h.args)}));a.j=[]}},CU=function(a){if(!a.l&&a.a){const b=pU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},AU=function(a){return null!==a.a&&a.C},DU=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.P=0,a.J=!1,a.j=[],a.H=0)},FU=function(a,b){const c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.He;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.I(1,9,9E3),EU(b,a)):b.namespace()===_.hd&&(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.")},GU=function(a){const b=[];typeof a===_.He&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},EU=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))};var IU=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.T("clpp.conviva.ad");this.f=new _.Kt;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;wU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.Xh(this.f),this.a&&uU(this,HU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Dd);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(mU)}F(){this.g.debug(nU)}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"),tU(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.eb(),a.cb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Pa())}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 _.ic:case _.jc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.hc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Vb:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&uU(this,HU)}K(){this.g.debug("onAdSkipped()");this.a&&uU(this,xU)}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;tU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.fg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.fg),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)}P(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},xU=0,HU=1,vU=2;var JU=class{constructor(a,b){this.m=a;this.f=new _.Kt;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.P=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=_.dh(b),this.K=c,this.m=a,yU(this,this.F),this.f.on(this.m,_.We,this.ia.bind(this)),this.f.on(this.m,_.Qf,this.ba.bind(this)),this.f.on(this.m,_.Mc,this.L.bind(this)),this.f.on(this.m,_.tg,this.Y.bind(this)),this.f.on(this.m,
19
- _.sg,this.V.bind(this)),this.f.on(this.m,_.Tb,this.R.bind(this)),this.f.on(this.m,_.Ub,this.T.bind(this)),this.f.on(this.m,_.pc,this.ca.bind(this)),this.f.on(this.m,_.Lc,this.ga.bind(this)),this.f.on(this.m,_.Xd,this.M.bind(this)),zU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),BU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.Xh(this.f),AU(this)||this.o||!zU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),AU(this)&&
20
- DU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Dd);this.l?this.g.debug(_.ha):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}ia(){this.g.debug("onPlayRequest()");AU(this)||zU(this)?AU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),AU(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
- BU(this))}ba(a){this.g.debug(_.Ne);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),yU(this,this.F),BU(this),CU(this),AU(this))){var d=this.m.getTrackManager();d=d.ra()||d.qb();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)}AU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case 3:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case 4:b(Conviva.Constants.PlayerState.PAUSED);break;case 2:b(Conviva.Constants.PlayerState.BUFFERING);break;case 5:this.g.debug("onVideoEnded()"),AU(this)&&(this.w&&this.w.Ib()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):DU(this))}}L(a){this.g.debug(_.Ie);if(AU(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({ig:this.L.bind(this),args:a})}Y(){this.g.debug("onSeeking()");AU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");AU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ca(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(mU);
24
- var b=a.ad;a=0===b.Qa();const c=qU(b.getPodIndex());AU(this)||zU(this)||!a||BU(this);if(AU(this)){a=0===b.ub()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.fb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.P;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Yi()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}T(){this.g.debug(nU);
25
- AU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&DU(this))}M(a){this.g.debug(_.Ke);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===_.D&&(d=Conviva.Constants.ErrorSeverity.FATAL,AU(this)||BU(this));AU(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,DU(this))):this.j.push({ig:this.M.bind(this),args:a})}}ga(){this.g.debug("onAutoPlayBlocked()");AU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,AU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var KU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.T("clpp.conviva")}onPlayerCreated(a){this.f=new JU(a,this.g)}onContentWillLoad(a,b){FU(this,a);if(this.a){var c=a.getConfiguration();c=_.dh(c.conviva||{});try{GU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new IU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?EU(a,d):EU(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&CU(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"}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",KU);KU.prototype.reportAppEvent=KU.prototype.reportAppEvent;KU.Id="conviva";_.Qn(new class{create(){return new KU}});};f.call(g, window);
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},qU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},rU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},tU=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
+ qU(!!d);e[Conviva.Constants.ASSET_NAME]=mU;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"]=sU(a.getId()),e["c3.ad.creativeId"]=sU(a.getCreativeId()),e["c3.ad.system"]=sU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=sU(a.getApiFramework()),e["c3.ad.advertiser"]=sU(a.getAdvertiserName()),e["c3.ad.position"]=rU(a.getPodIndex()),e["c3.ad.technology"]=0===a.fb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=sU(a.bb()),e["c3.ad.adManagerVersion"]=sU(a.cb()),e["c3.ad.advertiserCategory"]=sU(null),e["c3.ad.advertiserId"]=sU(null),e["c3.ad.breakId"]=sU(null),e["c3.ad.campaignName"]=sU(null),e["c3.ad.category"]=sU(null),e["c3.ad.classification"]=sU(null),e["c3.ad.creativeName"]=sU(null),e["c3.ad.sequence"]=sU(a.eb()),e["c3.ad.sessionStartEvent"]=sU(null),e["c3.ad.unitName"]=sU(null),e["c3.ad.dayPart"]=sU(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"]=sU(b),e["c3.ad.firstAdSystem"]=sU(c),e["c3.ad.firstCreativeId"]=sU(a));return e},sU=function(a){return a?""+a:"NA"},xU=function(a){a.f.on(a.m,_.Tb,a.C.bind(a));a.f.on(a.m,_.Ub,a.F.bind(a));a.f.on(a.m,_.lc,a.L.bind(a));a.f.on(a.m,_.ic,a.l.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.jc,a.l.bind(a));a.f.on(a.m,_.Vb,a.l.bind(a));a.f.on(a.m,_.mc,a.M.bind(a));
7
+ a.f.on(a.m,_.kc,a.K.bind(a));a.f.on(a.m,_.Wb,a.G.bind(a));a.f.on(a.m,_.bc,a.I.bind(a));a.f.on(a.m,_.cc,a.J.bind(a));a.f.on(a.m,_.Yb,a.H.bind(a));a.f.on(a.m,_.dc,a.S.bind(a));a.f.on(a.m,_.nc,a.N.bind(a));a.f.on(a.m,_.Xd,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=mU}null===a.a&&uU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ vU(a,wU,c)}})},vU=function(a,b,c=mU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case wU:a.a.reportAdFailed(c,tU(null,a.B,a.A));break;case yU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},uU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=tU(b,a.B,a.A,a.m.isLive()),d=String(b.cb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.bb();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)}}},zU=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(pU(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]=_.ea;a.a.setPlayerInfo(b)},AU=function(a){return a.m.getConfiguration().autoplay||!1},CU=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 _.gp(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Mm(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(BU(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.kg(h.args)}));a.j=[]}},DU=function(a){if(!a.l&&a.a){const b=qU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},BU=function(a){return null!==a.a&&a.C},EU=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.N=0,a.J=!1,a.j=[],a.H=0)},GU=function(a,b){const c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.He;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.I(1,9,9E3),FU(b,a)):b.namespace()===_.hd&&(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.")},HU=function(a){const b=[];typeof a===_.He&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},FU=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))};var JU=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.T("clpp.conviva.ad");this.f=new _.Lt;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;xU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.Xh(this.f),this.a&&vU(this,IU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Dd);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(nU)}F(){this.g.debug(oU)}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"),uU(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.Ua(),a.Ta());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Ba())}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 _.ic:case _.jc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.gc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Vb:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&vU(this,IU)}K(){this.g.debug("onAdSkipped()");this.a&&vU(this,yU)}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;uU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.fg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.fg),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)}N(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},yU=0,IU=1,wU=2;var KU=class{constructor(a,b){this.m=a;this.f=new _.Lt;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.N=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=_.dh(b),this.K=c,this.m=a,zU(this,this.F),this.f.on(this.m,_.We,this.ia.bind(this)),this.f.on(this.m,_.Qf,this.X.bind(this)),this.f.on(this.m,_.Mc,this.L.bind(this)),this.f.on(this.m,_.tg,this.W.bind(this)),this.f.on(this.m,
19
+ _.sg,this.U.bind(this)),this.f.on(this.m,_.Tb,this.R.bind(this)),this.f.on(this.m,_.Ub,this.S.bind(this)),this.f.on(this.m,_.pc,this.$.bind(this)),this.f.on(this.m,_.Lc,this.da.bind(this)),this.f.on(this.m,_.Xd,this.M.bind(this)),AU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),CU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.Xh(this.f),BU(this)||this.o||!AU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),BU(this)&&
20
+ EU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Dd);this.l?this.g.debug(_.ha):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}ia(){this.g.debug("onPlayRequest()");BU(this)||AU(this)?BU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),BU(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
+ CU(this))}X(a){this.g.debug(_.Ne);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),zU(this,this.F),CU(this),DU(this),BU(this))){var d=this.m.getTrackManager();d=d.ta()||d.vb();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)}BU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case 3:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case 4:b(Conviva.Constants.PlayerState.PAUSED);break;case 2:b(Conviva.Constants.PlayerState.BUFFERING);break;case 5:this.g.debug("onVideoEnded()"),BU(this)&&(this.w&&this.w.Mb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):EU(this))}}L(a){this.g.debug(_.Ie);if(BU(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({kg:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");BU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}U(){this.g.debug("onSeeked()");BU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}$(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(nU);
24
+ var b=a.ad;a=0===b.Ca();const c=rU(b.getPodIndex());BU(this)||AU(this)||!a||CU(this);if(BU(this)){a=0===b.fb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Va()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.N;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Xi()?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(oU);
25
+ BU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&EU(this))}M(a){this.g.debug(_.Ke);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===_.D&&(d=Conviva.Constants.ErrorSeverity.FATAL,BU(this)||CU(this));BU(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,EU(this))):this.j.push({kg:this.M.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");BU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,BU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var LU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.T("clpp.conviva")}onPlayerCreated(a){this.f=new KU(a,this.g)}onContentWillLoad(a,b){GU(this,a);if(this.a){var c=a.getConfiguration();c=_.dh(c.conviva||{});try{HU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new JU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?FU(a,d):FU(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&DU(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"}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",LU);LU.prototype.reportAppEvent=LU.prototype.reportAppEvent;LU.Id="conviva";_.Pn(new class{create(){return new LU}});};f.call(g, window);