@castlabs/prestoplay 6.28.0 → 6.30.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 (66) hide show
  1. package/CHANGELOG.md +37 -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 +128 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +619 -614
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +92 -89
  10. package/cjs/cl.externs.js +154 -60
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +25 -23
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +350 -349
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +57 -58
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +60 -60
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -6
  37. package/cl.cast.js +101 -92
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +500 -496
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +84 -83
  42. package/cl.externs.js +150 -60
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +82 -80
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -17
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +304 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +56 -56
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +14 -14
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -31
  65. package/package.json +1 -1
  66. package/typings.d.ts +198 -88
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 tU="Ad Error",uU="onAdBreakStarted()",vU="onAdBreakStopped()",wU=function(a){var b=_.pj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.$i()&&(f="Apple");_.Zi()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.aj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.$i()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Ti()||_.Qi()||_.Pi("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Ti()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Qi()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Pi("Hisense")&&(b="",f="Hisense")):_.Pi("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},xU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},yU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},AU=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
- xU(!!d);e[Conviva.Constants.ASSET_NAME]=tU;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"]=zU(a.getId()),e["c3.ad.creativeId"]=zU(a.getCreativeId()),e["c3.ad.system"]=zU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=zU(a.getApiFramework()),e["c3.ad.advertiser"]=zU(a.getAdvertiserName()),e["c3.ad.position"]=yU(a.getPodIndex()),e["c3.ad.technology"]=0===a.sb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=zU(a.lb()),e["c3.ad.adManagerVersion"]=zU(a.nb()),e["c3.ad.advertiserCategory"]=zU(null),e["c3.ad.advertiserId"]=zU(null),e["c3.ad.breakId"]=zU(null),e["c3.ad.campaignName"]=zU(null),e["c3.ad.category"]=zU(null),e["c3.ad.classification"]=zU(null),e["c3.ad.creativeName"]=zU(null),e["c3.ad.sequence"]=zU(a.qb()),e["c3.ad.sessionStartEvent"]=zU(null),e["c3.ad.unitName"]=zU(null),e["c3.ad.dayPart"]=zU(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"]=zU(b),e["c3.ad.firstAdSystem"]=zU(c),e["c3.ad.firstCreativeId"]=zU(a));return e},zU=function(a){return a?""+a:"NA"},EU=function(a){a.f.on(a.m,_.Rb,a.C.bind(a));a.f.on(a.m,_.Sb,a.F.bind(a));a.f.on(a.m,_.kc,a.L.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.ic,a.l.bind(a));a.f.on(a.m,_.Tb,a.l.bind(a));a.f.on(a.m,_.lc,a.M.bind(a));
7
- a.f.on(a.m,_.jc,a.K.bind(a));a.f.on(a.m,_.Ub,a.G.bind(a));a.f.on(a.m,_.cc,a.I.bind(a));a.f.on(a.m,_.ec,a.J.bind(a));a.f.on(a.m,_.Wb,a.H.bind(a));a.f.on(a.m,_.fc,a.T.bind(a));a.f.on(a.m,_.mc,a.P.bind(a));a.f.on(a.m,_.Wd,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=tU}null===a.a&&BU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- CU(a,DU,c)}})},CU=function(a,b,c=tU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case DU:a.a.reportAdFailed(c,AU(null,a.B,a.A));break;case FU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},BU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=AU(b,a.B,a.A,a.m.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.lb();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)}}},GU=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(wU(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)},HU=function(a){return a.m.getConfiguration().autoplay||!1},JU=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 _.bp(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Im(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(IU(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.Yf(h.args)}));a.j=[]}},KU=function(a){if(!a.l&&a.a){const b=xU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},IU=function(a){return null!==a.a&&a.C},LU=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)},NU=function(a,b){const c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Ge;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.H(1,9,9E3),MU(b,a)):b.namespace()===_.fd&&(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.")},OU=function(a){const b=[];typeof a===_.Ge&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});},MU=function(a,b){a.trigger(new _.G(_.Wd,{detail:b}))};var QU=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.S("clpp.conviva.ad");this.f=new _.Gt;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;EU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.Wh(this.f),this.a&&CU(this,PU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Bd);this.o?this.g.debug(_.ia):this.o=!0}C(){this.g.debug(uU)}F(){this.g.debug(vU)}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"),BU(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.cb(),a.bb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Na())}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 _.hc:case _.ic:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.gc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Tb:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&CU(this,PU)}K(){this.g.debug("onAdSkipped()");this.a&&CU(this,FU)}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;BU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.eg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.eg),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)}},FU=0,PU=1,DU=2;var RU=class{constructor(a,b){this.m=a;this.f=new _.Gt;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=_.ch(b),this.K=c,this.m=a,GU(this,this.F),this.f.on(this.m,_.Ve,this.ia.bind(this)),this.f.on(this.m,_.Pf,this.ba.bind(this)),this.f.on(this.m,_.Kc,this.L.bind(this)),this.f.on(this.m,_.sg,this.Y.bind(this)),this.f.on(this.m,
19
- _.rg,this.V.bind(this)),this.f.on(this.m,_.Rb,this.R.bind(this)),this.f.on(this.m,_.Sb,this.T.bind(this)),this.f.on(this.m,_.oc,this.da.bind(this)),this.f.on(this.m,_.Jc,this.ha.bind(this)),this.f.on(this.m,_.Wd,this.M.bind(this)),HU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),JU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.Wh(this.f),IU(this)||this.o||!HU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),IU(this)&&
20
- LU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Bd);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}ia(){this.g.debug("onPlayRequest()");IU(this)||HU(this)?IU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),IU(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
- JU(this))}ba(a){this.g.debug(_.Me);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),GU(this,this.F),JU(this),KU(this),IU(this))){var d=this.m.getTrackManager();d=d.qa()||d.pb();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)}IU(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()"),IU(this)&&(this.w&&this.w.Gb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):LU(this))}}L(a){this.g.debug(_.He);if(IU(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({Yf:this.L.bind(this),args:a})}Y(){this.g.debug("onSeeking()");IU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");IU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}da(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(uU);
24
- var b=a.ad;a=0===b.Oa();const c=yU(b.getPodIndex());IU(this)||HU(this)||!a||JU(this);if(IU(this)){a=0===b.sb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.eb()&&(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||_.Zi()?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(vU);
25
- IU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&LU(this))}M(a){this.g.debug(_.Je);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===_.C&&(d=Conviva.Constants.ErrorSeverity.FATAL,IU(this)||JU(this));IU(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,LU(this))):this.j.push({Yf:this.M.bind(this),args:a})}}ha(){this.g.debug("onAutoPlayBlocked()");IU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,IU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var SU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new RU(a,this.g)}onContentWillLoad(a,b){NU(this,a);if(this.a){var c=a.getConfiguration();c=_.ch(c.conviva||{});try{OU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new QU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?MU(a,d):MU(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&KU(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",SU);SU.prototype.reportAppEvent=SU.prototype.reportAppEvent;SU.Id="conviva";_.Ln(new class{create(){return new SU}});};f.call(g, window);
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)):
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);