@castlabs/prestoplay 6.2.8 → 6.3.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 (58) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -106
  6. package/cjs/cl.conviva.js +32 -31
  7. package/cjs/cl.core.js +371 -360
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +69 -69
  10. package/cjs/cl.externs.js +68 -17
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +44 -44
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +32 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +250 -255
  17. package/cjs/cl.muxdata.js +12 -11
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -5
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +22 -22
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +26 -26
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +19 -18
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +85 -81
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +346 -337
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +62 -63
  38. package/cl.externs.js +68 -17
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +37 -37
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -24
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +220 -224
  45. package/cl.muxdata.js +8 -9
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -4
  49. package/cl.smooth.js +57 -57
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +21 -21
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/package.json +1 -1
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 zH="Ad Error",AH="onAdBreakStarted()",BH="onAdBreakStopped()",CH=function(a){var b=_.Yh();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Kh()&&(f="Apple");_.Jh()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Lh()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Kh()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Dh()||_.Ah()||_.zh("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Dh()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Ah()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.zh("Hisense")&&(b="",f="Hisense")):_.zh("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},DH=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},EH=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},GH=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
- DH(!!d);e[Conviva.Constants.ASSET_NAME]=zH;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"]=FH(a.ba()),e["c3.ad.creativeId"]=FH(a.getCreativeId()),e["c3.ad.system"]=FH(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=FH(a.getApiFramework()),e["c3.ad.advertiser"]=FH(a.getAdvertiserName()),e["c3.ad.position"]=EH(a.getPodIndex()),e["c3.ad.technology"]=0===a.mb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=FH(a.gb()),e["c3.ad.adManagerVersion"]=FH(a.hb()),e["c3.ad.advertiserCategory"]=FH(null),e["c3.ad.advertiserId"]=FH(null),e["c3.ad.breakId"]=FH(null),e["c3.ad.campaignName"]=FH(null),e["c3.ad.category"]=FH(null),e["c3.ad.classification"]=FH(null),e["c3.ad.creativeName"]=FH(null),e["c3.ad.sequence"]=FH(a.Bb()),e["c3.ad.sessionStartEvent"]=FH(null),e["c3.ad.unitName"]=FH(null),e["c3.ad.dayPart"]=FH(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.ba(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=FH(b),e["c3.ad.firstAdSystem"]=FH(c),e["c3.ad.firstCreativeId"]=FH(a));return e},FH=function(a){return a?""+a:"NA"},KH=function(a){a.g.on(a.l,_.ob,a.C.bind(a));a.g.on(a.l,_.pb,a.D.bind(a));a.g.on(a.l,_.Bb,a.L.bind(a));a.g.on(a.l,_.yb,a.m.bind(a));a.g.on(a.l,_.xb,a.m.bind(a));a.g.on(a.l,_.zb,a.m.bind(a));a.g.on(a.l,_.qb,a.m.bind(a));a.g.on(a.l,_.Cb,a.N.bind(a));
7
- a.g.on(a.l,_.Ab,a.K.bind(a));a.g.on(a.l,_.rb,a.F.bind(a));a.g.on(a.l,_.ub,a.I.bind(a));a.g.on(a.l,_.vb,a.J.bind(a));a.g.on(a.l,_.tb,a.H.bind(a));a.g.on(a.l,_.wb,a.T.bind(a));a.g.on(a.l,_.Db,a.R.bind(a));a.g.on(a.l,_.Qc,b=>{var c=b.detail;if(10003===c.code&&(a.f.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=zH}null===a.a&&HH(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
- IH(a,JH,c)}})},LH=function(a,b){a.f.debug("Initialize Ad Insights");a.w=!1;a.h=!1;a.B=b.viewerId;a.A=b.playerName||_.la;KH(a)},IH=function(a,b,c=zH){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case JH:a.a.reportAdFailed(c,GH(null,a.B,a.A));break;case MH:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},HH=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=
9
- GH(b,a.B,a.A,a.l.isLive()),d=String(b.hb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.gb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},NH=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,
10
- null,c);Conviva.Analytics.setDeviceMetadata(CH(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.la;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},OH=function(a){return a.l.getConfiguration().autoplay||!1},QH=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||
11
- a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=new _.Vi(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ri(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.la;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.y(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>
12
- {a.a.debug("reportMiscellaneousMetrics()");if(PH(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.fe(h.Ud)}));a.j=[]}},RH=function(a,b,c,d){a.m||(a.a.debug("Initialize conviva"),a.F=
13
- !1,a.D=_.ef(c),a.K=d,a.l=b,NH(a,a.D),a.g.on(a.l,_.Ld,a.na.bind(a)),a.g.on(a.l,_.ee,a.aa.bind(a)),a.g.on(a.l,_.$b,a.L.bind(a)),a.g.on(a.l,_.ze,a.W.bind(a)),a.g.on(a.l,_.xe,a.V.bind(a)),a.g.on(a.l,_.ob,a.S.bind(a)),a.g.on(a.l,_.pb,a.T.bind(a)),a.g.on(a.l,_.Fb,a.ca.bind(a)),a.g.on(a.l,_.Zb,a.ga.bind(a)),a.g.on(a.l,_.Qc,a.N.bind(a)),OH(a)&&(a.a.debug("Start a new session: A new video starts in autoplay."),QH(a)))},SH=function(a){if(!a.m&&a.f){const b=DH(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=
14
- b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},PH=function(a){return null!==a.f&&a.C},TH=function(a){a.a.debug("terminateSession()");a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},UH=function(a,b){var c=b.getConfiguration();a.a=!_.y(c.conviva)&&typeof c.conviva===_.td;a.a?
15
- "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()===_.rc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},VH=function(a){const b=[];typeof a===_.td&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var XH=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.la;this.f=new _.O("clpp.conviva.ad");this.g=new _.mn;this.a=null;this.h=this.o=this.w=this.j=!1}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Gf(this.g),this.a&&IH(this,WH),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Ec);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(AH)}D(){this.f.debug(BH)}L(a){this.f.debug("onAdStarted()");a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),
16
- HH(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.jb(),a.ib());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Xa())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.yb:case _.zb:b(Conviva.Constants.PlayerState.PLAYING);break;case _.xb:b(Conviva.Constants.PlayerState.PAUSED);
17
- break;case _.qb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&IH(this,WH)}K(){this.f.debug("onAdSkipped()");this.a&&IH(this,MH)}F(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.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.f.debug("onAdLoaded()");const b=a.ad,c=()=>{this.j=
18
- !0;HH(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.pe,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.pe),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},
19
- MH=0,WH=1,JH=2;var YH=class{constructor(a,b){this.l=a;this.g=new _.mn;this.f=null;this.o=!1;this.F=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.D=null;this.j=[];this.H=0}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Gf(this.g),PH(this)||this.o||!OH(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),PH(this)&&TH(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Ec);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,
20
- b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}na(){this.a.debug("onPlayRequest()");PH(this)||OH(this)?PH(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),PH(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),QH(this))}aa(a){this.a.debug(_.zd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),
21
- NH(this,this.D),QH(this),SH(this),PH(this))){var d=this.l.getTrackManager();d=d.fa()||d.Ia();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}PH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Lk:b(Conviva.Constants.PlayerState.PLAYING);break;case _.Kk:b(Conviva.Constants.PlayerState.PAUSED);
22
- break;case _.Dk:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Ak:this.a.debug("onVideoEnded()"),PH(this)&&(this.w&&this.w.Ya()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):TH(this))}}L(a){this.a.debug(_.ud);if(PH(this)){if(a=a.detail,typeof a.width===_.p&&typeof a.height===_.p&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=
23
- a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({fe:this.L.bind(this),Ud:a})}W(){this.a.debug("onSeeking()");PH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");PH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ca(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(AH);var b=
24
- a.ad;a=0===b.Ja();const c=EH(b.getPodIndex());PH(this)||OH(this)||!a||QH(this);if(PH(this)){a=0===b.mb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.lb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Jh()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}T(){this.a.debug(BH);
25
- PH(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&TH(this))}N(a){this.a.debug(_.wd);if(this.o&&this.I)this.a.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===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,PH(this)||QH(this));PH(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
- this.I=!0,TH(this))):this.j.push({fe:this.N.bind(this),Ud:a})}}ga(){this.a.debug("onAutoPlayBlocked()");PH(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,PH(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var ZH=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new YH(a,this.h)}onContentWillLoad(a,b){UH(this,a);if(this.a){var c=a.getConfiguration();c=_.ef(c.conviva||{});try{VH(c);const d=c.enableAdInsights||!1;RH(this.f,a,c,b);d&&(this.g=new XH(a,()=>this.f.f),LH(this.g,c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&SH(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),this.f=
27
- 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 _.F(_.Qc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",ZH);ZH.prototype.reportAppEvent=ZH.prototype.reportAppEvent;ZH.Id="conviva";_.Ll(new class{create(){return new ZH}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var FH="Ad Error",GH="onAdBreakStarted()",HH="onAdBreakStopped()",IH=function(a){var b=_.ai();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Nh()&&(f="Apple");_.Mh()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Oh()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Nh()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Gh()||_.Dh()||_.Ch("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Gh()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Dh()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Ch("Hisense")&&(b="",f="Hisense")):_.Ch("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},JH=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},KH=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},MH=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
+ JH(!!d);e[Conviva.Constants.ASSET_NAME]=FH;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"]=LH(a.ba()),e["c3.ad.creativeId"]=LH(a.getCreativeId()),e["c3.ad.system"]=LH(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=LH(a.getApiFramework()),e["c3.ad.advertiser"]=LH(a.getAdvertiserName()),e["c3.ad.position"]=KH(a.getPodIndex()),e["c3.ad.technology"]=0===a.nb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=LH(a.hb()),e["c3.ad.adManagerVersion"]=LH(a.ib()),e["c3.ad.advertiserCategory"]=LH(null),e["c3.ad.advertiserId"]=LH(null),e["c3.ad.breakId"]=LH(null),e["c3.ad.campaignName"]=LH(null),e["c3.ad.category"]=LH(null),e["c3.ad.classification"]=LH(null),e["c3.ad.creativeName"]=LH(null),e["c3.ad.sequence"]=LH(a.Cb()),e["c3.ad.sessionStartEvent"]=LH(null),e["c3.ad.unitName"]=LH(null),e["c3.ad.dayPart"]=LH(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.ba(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=LH(b),e["c3.ad.firstAdSystem"]=LH(c),e["c3.ad.firstCreativeId"]=LH(a));return e},LH=function(a){return a?""+a:"NA"},QH=function(a){a.g.on(a.l,_.qb,a.C.bind(a));a.g.on(a.l,_.rb,a.D.bind(a));a.g.on(a.l,_.Db,a.L.bind(a));a.g.on(a.l,_.Ab,a.m.bind(a));a.g.on(a.l,_.zb,a.m.bind(a));a.g.on(a.l,_.Bb,a.m.bind(a));a.g.on(a.l,_.sb,a.m.bind(a));a.g.on(a.l,_.Eb,a.N.bind(a));
7
+ a.g.on(a.l,_.Cb,a.K.bind(a));a.g.on(a.l,_.tb,a.F.bind(a));a.g.on(a.l,_.wb,a.I.bind(a));a.g.on(a.l,_.xb,a.J.bind(a));a.g.on(a.l,_.vb,a.H.bind(a));a.g.on(a.l,_.yb,a.T.bind(a));a.g.on(a.l,_.Fb,a.R.bind(a));a.g.on(a.l,_.Tc,b=>{var c=b.detail;if(10003===c.code&&(a.f.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=FH}null===a.a&&NH(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
+ OH(a,PH,c)}})},OH=function(a,b,c=FH){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case PH:a.a.reportAdFailed(c,MH(null,a.B,a.A));break;case RH:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},NH=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=MH(b,a.B,a.A,a.l.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.f.error("Could not create ad analytics session",c)}}},SH=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.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(IH(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.la;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},TH=function(a){return a.l.getConfiguration().autoplay||!1},VH=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=
11
+ new _.Yi(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ui(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.la;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.y(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(UH(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.he(h.Wd)}));a.j=[]}},WH=function(a){if(!a.m&&a.f){const b=JH(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},UH=function(a){return null!==a.f&&a.C},XH=function(a){a.a.debug("terminateSession()");
13
+ a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},YH=function(a,b){var c=b.getConfiguration();a.a=!_.y(c.conviva)&&typeof c.conviva===_.wd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.U(b,c)):b.namespace()===_.tc&&(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.")},ZH=function(a){const b=[];typeof a===_.wd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var aI=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.la;this.f=new _.O("clpp.conviva.ad");this.g=new _.Fn;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.la;QH(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Jf(this.g),this.a&&OH(this,$H),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Hc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(GH)}D(){this.f.debug(HH)}L(a){this.f.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),NH(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.kb(),a.jb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Ya())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.Ab:case _.Bb:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.zb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.sb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&OH(this,$H)}K(){this.f.debug("onAdSkipped()");this.a&&OH(this,RH)}F(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.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.f.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;NH(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.re,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.re),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},RH=0,$H=1,PH=2;var bI=class{constructor(a,b){this.l=a;this.g=new _.Fn;this.f=null;this.o=!1;this.F=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.D=null;this.j=[];this.H=0}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.F=!1,this.D=_.gf(b),this.K=c,this.l=a,SH(this,this.D),this.g.on(this.l,_.Nd,this.na.bind(this)),this.g.on(this.l,_.ge,this.aa.bind(this)),this.g.on(this.l,_.bc,this.L.bind(this)),this.g.on(this.l,_.Be,this.W.bind(this)),this.g.on(this.l,
19
+ _.Ae,this.V.bind(this)),this.g.on(this.l,_.qb,this.S.bind(this)),this.g.on(this.l,_.rb,this.T.bind(this)),this.g.on(this.l,_.Hb,this.ca.bind(this)),this.g.on(this.l,_.ac,this.ga.bind(this)),this.g.on(this.l,_.Tc,this.N.bind(this)),TH(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),VH(this)))}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Jf(this.g),UH(this)||this.o||!TH(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),UH(this)&&
20
+ XH(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Hc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}na(){this.a.debug("onPlayRequest()");UH(this)||TH(this)?UH(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),UH(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ VH(this))}aa(a){this.a.debug(_.Bd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),SH(this,this.D),VH(this),WH(this),UH(this))){var d=this.l.getTrackManager();d=d.fa()||d.Ja();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}UH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.dl:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.bl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Vk:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Sk:this.a.debug("onVideoEnded()"),UH(this)&&(this.w&&this.w.Za()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):XH(this))}}L(a){this.a.debug(_.xd);if(UH(this)){if(a=a.detail,typeof a.width===_.p&&typeof a.height===_.p&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.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.f.setContentInfo(b)}}else this.j.push({he:this.L.bind(this),Wd:a})}W(){this.a.debug("onSeeking()");UH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");UH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ca(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(GH);
24
+ var b=a.ad;a=0===b.Ka();const c=KH(b.getPodIndex());UH(this)||TH(this)||!a||VH(this);if(UH(this)){a=0===b.nb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.mb()&&(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||_.Mh()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}T(){this.a.debug(HH);
25
+ UH(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&XH(this))}N(a){this.a.debug(_.yd);if(this.o&&this.I)this.a.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,UH(this)||VH(this));UH(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
+ this.I=!0,XH(this))):this.j.push({he:this.N.bind(this),Wd:a})}}ga(){this.a.debug("onAutoPlayBlocked()");UH(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,UH(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var cI=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new bI(a,this.h)}onContentWillLoad(a,b){YH(this,a);if(this.a){var c=a.getConfiguration();c=_.gf(c.conviva||{});try{ZH(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new aI(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.G?this.U(a,d):this.U(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&WH(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 _.B(_.Tc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",cI);cI.prototype.reportAppEvent=cI.prototype.reportAppEvent;cI.Id="conviva";_.cm(new class{create(){return new cI}});};f.call(g, window);