@castlabs/prestoplay 6.32.0-beta.3 → 6.32.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 (68) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +18 -18
  5. package/cjs/cl.cast.js +126 -126
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +604 -604
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +1 -29
  11. package/cjs/cl.freewheel.js +26 -26
  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 +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -352
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +71 -71
  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 +18 -18
  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 +14 -14
  37. package/cl.cast.js +100 -100
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +488 -487
  40. package/cl.crypto.js +8 -8
  41. package/cl.dash.js +75 -75
  42. package/cl.externs.js +1 -25
  43. package/cl.freewheel.js +20 -20
  44. package/cl.hls.js +65 -65
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -19
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +200 -200
  50. package/cl.muxdata.js +12 -12
  51. package/cl.onboard.js +3 -3
  52. package/cl.persistent.js +8 -8
  53. package/cl.playlist.js +4 -4
  54. package/cl.simid.js +2 -2
  55. package/cl.smooth.js +47 -47
  56. package/cl.thumbnails.js +12 -12
  57. package/cl.tizen.js +41 -41
  58. package/cl.ttml.js +10 -10
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +3 -3
  62. package/cl.vtt.js +11 -11
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +27 -27
  65. package/package.json +1 -1
  66. package/typings.d.ts +6 -22
  67. package/cjs/cl.cdn.js +0 -13
  68. package/cl.cdn.js +0 -7
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 xU="Ad Error",yU="onAdBreakStarted()",zU="onAdBreakStopped()",AU=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="";_.bj()&&(f="Apple");_.aj()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.cj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.bj()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Wi()||_.Ti()||_.Si("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Wi()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Ti()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Si("Hisense")&&(b="",f="Hisense")):_.Si("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},BU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},CU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},EU=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
- BU(!!d);e[Conviva.Constants.ASSET_NAME]=xU;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"]=DU(a.getId()),e["c3.ad.creativeId"]=DU(a.getCreativeId()),e["c3.ad.system"]=DU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=DU(a.getApiFramework()),e["c3.ad.advertiser"]=DU(a.getAdvertiserName()),e["c3.ad.position"]=CU(a.getPodIndex()),e["c3.ad.technology"]=0===a.hb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=DU(a.eb()),e["c3.ad.adManagerVersion"]=DU(a.fb()),e["c3.ad.advertiserCategory"]=DU(null),e["c3.ad.advertiserId"]=DU(null),e["c3.ad.breakId"]=DU(null),e["c3.ad.campaignName"]=DU(null),e["c3.ad.category"]=DU(null),e["c3.ad.classification"]=DU(null),e["c3.ad.creativeName"]=DU(null),e["c3.ad.sequence"]=DU(a.gb()),e["c3.ad.sessionStartEvent"]=DU(null),e["c3.ad.unitName"]=DU(null),e["c3.ad.dayPart"]=DU(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"]=DU(b),e["c3.ad.firstAdSystem"]=DU(c),e["c3.ad.firstCreativeId"]=DU(a));return e},DU=function(a){return a?""+a:"NA"},IU=function(a){a.f.on(a.m,_.Ub,a.C.bind(a));a.f.on(a.m,_.Vb,a.F.bind(a));a.f.on(a.m,_.mc,a.L.bind(a));a.f.on(a.m,_.jc,a.l.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.kc,a.l.bind(a));a.f.on(a.m,_.Wb,a.l.bind(a));a.f.on(a.m,_.nc,a.M.bind(a));
7
- a.f.on(a.m,_.lc,a.K.bind(a));a.f.on(a.m,_.Xb,a.G.bind(a));a.f.on(a.m,_.cc,a.I.bind(a));a.f.on(a.m,_.dc,a.J.bind(a));a.f.on(a.m,_.Zb,a.H.bind(a));a.f.on(a.m,_.ec,a.S.bind(a));a.f.on(a.m,_.oc,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=xU}null===a.a&&FU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- GU(a,HU,c)}})},GU=function(a,b,c=xU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case HU:a.a.reportAdFailed(c,EU(null,a.B,a.A));break;case JU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},FU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=EU(b,a.B,a.A,a.m.isLive()),d=String(b.fb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.eb();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)}}},KU=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(AU(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)},LU=function(a){return a.m.getConfiguration().autoplay||!1},NU=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.Sa()||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=new _.lp(b.url);
11
- b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Qm(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(MU(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,h);if(h=a.m.getStats()){h=
12
- 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.wg(h.args)}));a.j=[]}},OU=function(a){if(!a.l&&a.a){const b=BU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},MU=function(a){return null!==a.a&&a.C},PU=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)},RU=function(a,b){const c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Ie;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),QU(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.")},SU=function(a){const b=[];typeof a===_.Ie&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},QU=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))};var UU=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 _.Vt;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;IU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.ai(this.f),this.a&&GU(this,TU),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(yU)}F(){this.g.debug(zU)}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"),FU(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.Va(),a.Ua());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 _.jc:case _.kc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.hc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Wb:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&GU(this,TU)}K(){this.g.debug("onAdSkipped()");this.a&&GU(this,JU)}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;FU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.gg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.gg),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)}P(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},JU=0,TU=1,HU=2;var VU=class{constructor(a,b){this.m=a;this.f=new _.Vt;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=_.ih(b),this.K=c,this.m=a,KU(this,this.F),this.f.on(this.m,_.Xe,this.ia.bind(this)),this.f.on(this.m,_.Rf,this.X.bind(this)),this.f.on(this.m,_.Mc,this.L.bind(this)),this.f.on(this.m,_.ug,this.W.bind(this)),this.f.on(this.m,
19
- _.qg,this.U.bind(this)),this.f.on(this.m,_.Ub,this.R.bind(this)),this.f.on(this.m,_.Vb,this.S.bind(this)),this.f.on(this.m,_.qc,this.ca.bind(this)),this.f.on(this.m,_.Lc,this.da.bind(this)),this.f.on(this.m,_.Xd,this.M.bind(this)),LU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),NU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.ai(this.f),MU(this)||this.o||!LU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),MU(this)&&
20
- PU(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()");MU(this)||LU(this)?MU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),MU(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
- NU(this))}X(a){this.g.debug(_.Oe);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),KU(this,this.F),NU(this),OU(this),MU(this))){var d=this.m.getTrackManager();d=d.ta()||d.xb();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)}MU(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()"),MU(this)&&(this.w&&this.w.Pb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):PU(this))}}L(a){this.g.debug(_.Je);if(MU(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({wg:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");MU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}U(){this.g.debug("onSeeked()");MU(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(yU);
24
- var b=a.ad;a=0===b.Ca();const c=CU(b.getPodIndex());MU(this)||LU(this)||!a||NU(this);if(MU(this)){a=0===b.hb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Wa()&&(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||_.aj()?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(zU);
25
- MU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&PU(this))}M(a){this.g.debug(_.Le);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,MU(this)||NU(this));MU(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,PU(this))):this.j.push({wg:this.M.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");MU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,MU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var WU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.T("clpp.conviva")}onPlayerCreated(a){this.f=new VU(a,this.g)}onContentWillLoad(a,b){RU(this,a);if(this.a){var c=a.getConfiguration();c=_.ih(c.conviva||{});try{SU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new UU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?QU(a,d):QU(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&OU(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",WU);WU.prototype.reportAppEvent=WU.prototype.reportAppEvent;WU.Id="conviva";_.Tn(new class{create(){return new WU}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wU="Ad Error",xU="onAdBreakStarted()",yU="onAdBreakStopped()",zU=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
+ _.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},AU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},BU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},DU=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
+ AU(!!d);e[Conviva.Constants.ASSET_NAME]=wU;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"]=CU(a.getId()),e["c3.ad.creativeId"]=CU(a.getCreativeId()),e["c3.ad.system"]=CU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=CU(a.getApiFramework()),e["c3.ad.advertiser"]=CU(a.getAdvertiserName()),e["c3.ad.position"]=BU(a.getPodIndex()),e["c3.ad.technology"]=0===a.gb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=CU(a.cb()),e["c3.ad.adManagerVersion"]=CU(a.eb()),e["c3.ad.advertiserCategory"]=CU(null),e["c3.ad.advertiserId"]=CU(null),e["c3.ad.breakId"]=CU(null),e["c3.ad.campaignName"]=CU(null),e["c3.ad.category"]=CU(null),e["c3.ad.classification"]=CU(null),e["c3.ad.creativeName"]=CU(null),e["c3.ad.sequence"]=CU(a.fb()),e["c3.ad.sessionStartEvent"]=CU(null),e["c3.ad.unitName"]=CU(null),e["c3.ad.dayPart"]=CU(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"]=CU(b),e["c3.ad.firstAdSystem"]=CU(c),e["c3.ad.firstCreativeId"]=CU(a));return e},CU=function(a){return a?""+a:"NA"},HU=function(a){a.f.on(a.m,_.Ub,a.C.bind(a));a.f.on(a.m,_.Vb,a.F.bind(a));a.f.on(a.m,_.mc,a.L.bind(a));a.f.on(a.m,_.jc,a.l.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.kc,a.l.bind(a));a.f.on(a.m,_.Wb,a.l.bind(a));a.f.on(a.m,_.nc,a.M.bind(a));
7
+ a.f.on(a.m,_.lc,a.K.bind(a));a.f.on(a.m,_.Xb,a.G.bind(a));a.f.on(a.m,_.cc,a.I.bind(a));a.f.on(a.m,_.dc,a.J.bind(a));a.f.on(a.m,_.Zb,a.H.bind(a));a.f.on(a.m,_.ec,a.S.bind(a));a.f.on(a.m,_.oc,a.P.bind(a));a.f.on(a.m,_.Yd,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=wU}null===a.a&&EU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ FU(a,GU,c)}})},FU=function(a,b,c=wU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case GU:a.a.reportAdFailed(c,DU(null,a.B,a.A));break;case IU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},EU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=DU(b,a.B,a.A,a.m.isLive()),d=String(b.eb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.cb();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)}}},JU=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(zU(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)},KU=function(a){return a.m.getConfiguration().autoplay||!1},MU=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.Ra()||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=new _.gp(b.url);
11
+ 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(LU(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,h);if(h=a.m.getStats()){h=
12
+ 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.rg(h.args)}));a.j=[]}},NU=function(a){if(!a.l&&a.a){const b=AU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},LU=function(a){return null!==a.a&&a.C},OU=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)},QU=function(a,b){const c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Ie;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),PU(b,a)):b.namespace()===_.id&&(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.")},RU=function(a){const b=[];typeof a===_.Ie&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},PU=function(a,b){a.trigger(new _.H(_.Yd,{detail:b}))};var TU=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 _.Qt;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;HU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.Xh(this.f),this.a&&FU(this,SU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Ed);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(xU)}F(){this.g.debug(yU)}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"),EU(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 _.jc:case _.kc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.hc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Wb:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&FU(this,SU)}K(){this.g.debug("onAdSkipped()");this.a&&FU(this,IU)}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;EU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.gg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.gg),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)}P(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},IU=0,SU=1,GU=2;var UU=class{constructor(a,b){this.m=a;this.f=new _.Qt;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=_.eh(b),this.K=c,this.m=a,JU(this,this.F),this.f.on(this.m,_.Xe,this.ia.bind(this)),this.f.on(this.m,_.Rf,this.X.bind(this)),this.f.on(this.m,_.Nc,this.L.bind(this)),this.f.on(this.m,_.ug,this.W.bind(this)),this.f.on(this.m,
19
+ _.tg,this.U.bind(this)),this.f.on(this.m,_.Ub,this.R.bind(this)),this.f.on(this.m,_.Vb,this.S.bind(this)),this.f.on(this.m,_.qc,this.ca.bind(this)),this.f.on(this.m,_.Mc,this.da.bind(this)),this.f.on(this.m,_.Yd,this.M.bind(this)),KU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),MU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.Xh(this.f),LU(this)||this.o||!KU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),LU(this)&&
20
+ OU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Ed);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()");LU(this)||KU(this)?LU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),LU(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
+ MU(this))}X(a){this.g.debug(_.Oe);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),JU(this,this.F),MU(this),NU(this),LU(this))){var d=this.m.getTrackManager();d=d.ta()||d.xb();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)}LU(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()"),LU(this)&&(this.w&&this.w.Pb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):OU(this))}}L(a){this.g.debug(_.Je);if(LU(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({rg:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");LU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}U(){this.g.debug("onSeeked()");LU(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(xU);
24
+ var b=a.ad;a=0===b.Ca();const c=BU(b.getPodIndex());LU(this)||KU(this)||!a||MU(this);if(LU(this)){a=0===b.gb()?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.P;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(yU);
25
+ LU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&OU(this))}M(a){this.g.debug(_.Le);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,LU(this)||MU(this));LU(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,OU(this))):this.j.push({rg:this.M.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");LU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,LU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var VU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.T("clpp.conviva")}onPlayerCreated(a){this.f=new UU(a,this.g)}onContentWillLoad(a,b){QU(this,a);if(this.a){var c=a.getConfiguration();c=_.eh(c.conviva||{});try{RU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new TU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?PU(a,d):PU(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&NU(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",VU);VU.prototype.reportAppEvent=VU.prototype.reportAppEvent;VU.Id="conviva";_.Pn(new class{create(){return new VU}});};f.call(g, window);