@castlabs/prestoplay 6.7.0 → 6.9.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 (59) hide show
  1. package/CHANGELOG.md +50 -0
  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 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +419 -420
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +26 -26
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +72 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +272 -261
  17. package/cjs/cl.muxdata.js +15 -11
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +18 -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 +87 -87
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +358 -363
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +26 -26
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +61 -57
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +238 -228
  45. package/cl.muxdata.js +12 -9
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -15
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/package.json +1 -1
  59. package/typings.d.ts +74 -20
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uL="Ad Error",vL="onAdBreakStarted()",wL="onAdBreakStopped()",xL=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.mi(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.hj()&&(g="Apple");_.gj()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.ij()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.hj()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.li()||_.ki()||_.dj("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.li()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.ki()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.dj("Hisense")&&(c="",g="Hisense")):_.dj("Xbox One")&&(g="Microsoft",d=Conviva.Constants.DeviceType.CONSOLE,e=Conviva.Constants.DeviceCategory.XBOX);var h=a.deviceMetadata||{};b(Conviva.Constants.DeviceMetadata.TYPE,
4
- a.deviceType||d);b(Conviva.Constants.DeviceMetadata.OS_NAME,f);b(Conviva.Constants.DeviceMetadata.OS_VERSION,c);b(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||e);b(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||g);return h},yL=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},zL=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},BL=function(a,b,c,d){var e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=
5
- b;e[Conviva.Constants.IS_LIVE]=yL(!!d);e[Conviva.Constants.ASSET_NAME]=uL;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"]=AL(a.getId()),e["c3.ad.creativeId"]=AL(a.getCreativeId()),e["c3.ad.system"]=AL(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=AL(a.getApiFramework()),e["c3.ad.advertiser"]=AL(a.getAdvertiserName()),e["c3.ad.position"]=zL(a.getPodIndex()),e["c3.ad.technology"]=0===a.Ab()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=AL(a.ub()),e["c3.ad.adManagerVersion"]=AL(a.vb()),e["c3.ad.advertiserCategory"]=AL(null),e["c3.ad.advertiserId"]=AL(null),e["c3.ad.breakId"]=AL(null),e["c3.ad.campaignName"]=AL(null),e["c3.ad.category"]=AL(null),e["c3.ad.classification"]=AL(null),e["c3.ad.creativeName"]=AL(null),e["c3.ad.sequence"]=AL(a.Pb()),e["c3.ad.sessionStartEvent"]=AL(null),e["c3.ad.unitName"]=AL(null),e["c3.ad.dayPart"]=AL(null),
7
- b=a.getWrapperAdIds().slice(-1)[0]||a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=AL(b),e["c3.ad.firstAdSystem"]=AL(c),e["c3.ad.firstCreativeId"]=AL(a));return e},AL=function(a){return a?""+a:"NA"},CL=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.ra;this.h=new _.H("clpp.conviva.ad");this.f=new _.eg;this.a=null;this.j=this.m=this.o=this.g=!1},DL=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=BL(b,a.A,a.w,a.l.isLive()),d=String(b.vb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.ub();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.h.error("Could not create ad analytics session",f)}}},GL=function(a,b,c){c=void 0===c?uL:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case EL:a.a.reportAdFailed(c,BL(null,a.A,a.w));break;case FL:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.g=!1}},HL=function(a){a.f.on(a.l,_.Ib,a.Gh.bind(a));a.f.on(a.l,_.Jb,a.Hh.bind(a));a.f.on(a.l,_.Vb,a.Nh.bind(a));a.f.on(a.l,_.Sb,a.Xd.bind(a));a.f.on(a.l,_.Rb,a.Xd.bind(a));a.f.on(a.l,_.Tb,a.Xd.bind(a));a.f.on(a.l,_.Kb,a.Xd.bind(a));a.f.on(a.l,_.Wb,a.Oh.bind(a));a.f.on(a.l,_.Ub,a.Mh.bind(a));a.f.on(a.l,_.Lb,a.Ih.bind(a));a.f.on(a.l,_.Ob,a.Kh.bind(a));a.f.on(a.l,_.Pb,a.Lh.bind(a));a.f.on(a.l,_.Nb,a.Jh.bind(a));a.f.on(a.l,_.Qb,a.Oj.bind(a));a.f.on(a.l,_.Xb,a.Ph.bind(a));a.f.on(a.l,_.jd,function(b){var c=
10
- b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.j)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=uL}null===a.a&&DL(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.h.debug("Ad Playback Failure");GL(a,EL,c)}})},IL=function(a,b){this.l=a;this.f=new _.eg;this.a=null;this.o=!1;this.H=!0;this.B=this.g=this.A=this.D=this.m=!1;this.P=0;this.K=!1;this.w=null;this.J=!1;this.h=b;this.M=this.F=null;this.j=[];this.I=0},
11
- JL=function(a){if(!a.m&&a.a){var b=yL(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.a.setContentInfo(c)}},KL=function(a){return null!==a.a&&a.D},LL=function(a){return a.l.getConfiguration().autoplay||!1},ML=function(a,b){var c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,
12
- null,c);Conviva.Analytics.setDeviceMetadata(xL(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;c={};c[Conviva.Constants.FRAMEWORK_NAME]=_.ra;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.a.setPlayerInfo(c)},NL=function(a){if(!a.m)if(a.D)a.h.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.M,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||
13
- "N/A",e=c&&c.defaultResource||"N/A";a.h.debug(a.l.getConfiguration().source);var f={},g=new _.Bi(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ci(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.K.R(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(function(){a.h.debug("reportMiscellaneousMetrics()");if(KL(a)){var l=
14
- 1E3*a.l.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.l.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.h.debug("Current FPS",m),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.D=!0;a.g=!0;a.J=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(function(l){l.bg(l.zf)}));a.j=[]}},OL=function(a){a.h.debug("terminateSession()");a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,
15
- Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.D=!1,a.A=!1,a.g=!1,a.w=null,a.B=!1,a.P=0,a.K=!1,a.j=[],a.I=0)},PL=function(){this.g=this.f=null;this.a=!1;this.h=new _.H("clpp.conviva")},QL=function(a){var b=[];typeof a===_.Ld&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.L(1,9,9001,{missingKeys:b});},RL=function(a,b){var c=b.getConfiguration();a.a=!_.K.R(c.conviva)&&typeof c.conviva===
16
- _.Ld;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.L(1,9,9E3),a.S(b,c)):b.namespace()===_.Kc&&(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.")},SL=function(){};_.t=CL.prototype;_.t.initialize=function(a){this.h.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.ra;HL(this)};_.t.release=function(){this.h.debug("Release Ad Insights");this.o?this.h.debug(_.ia):(_.hg(this.f),this.a&&GL(this,TL),this.f.release(),this.o=!0,this.g=this.j=!1)};_.t.destroy=function(){this.h.debug(_.Yc);this.m?this.h.debug(_.ha):this.m=!0};_.t.Gh=function(){this.h.debug(vL)};_.t.Hh=function(){this.h.debug(wL)};
17
- _.t.Nh=function(a){this.h.debug("onAdStarted()");a=a.ad;this.g||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),DL(this,a));this.g=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.xb(),a.wb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.jb())};
18
- _.t.Xd=function(a){var b=this;this.h.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Sb:case _.Tb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Rb:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Kb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.Oh=function(){this.h.debug("onAdStopped()");this.a&&!this.j&&GL(this,TL)};_.t.Mh=function(){this.h.debug("onAdSkipped()");this.a&&GL(this,FL)};
19
- _.t.Ih=function(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Kh=function(){this.h.debug("onAdImpression()");if(this.a){var a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}};
20
- _.t.Lh=function(a){var b=this;this.h.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)b.g=!0,DL(b,c);else this.f.on(this.l,_.Fe,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.f.off(b.l,_.Fe),b.g=!0,DL(b,c))})};_.t.Jh=function(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Oj=function(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.t.Ph=function(){this.h.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var FL=0,TL=1,EL=2;_.t=IL.prototype;
22
- _.t.initialize=function(a,b,c){this.m||(this.h.debug("Initialize conviva"),this.H=!1,this.F=_.K.Qa(b),this.M=c,this.l=a,ML(this,this.F),this.f.on(this.l,_.Zd,this.mk.bind(this)),this.f.on(this.l,_.se,this.Uh.bind(this)),this.f.on(this.l,_.uc,this.Jf.bind(this)),this.f.on(this.l,_.Ne,this.Th.bind(this)),this.f.on(this.l,_.Me,this.Sh.bind(this)),this.f.on(this.l,_.Ib,this.Qh.bind(this)),this.f.on(this.l,_.Jb,this.Rh.bind(this)),this.f.on(this.l,_.Zb,this.Uj.bind(this)),this.f.on(this.l,_.tc,this.Wj.bind(this)),
23
- this.f.on(this.l,_.jd,this.Kf.bind(this)),LL(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),NL(this)))};_.t.release=function(){this.h.debug("Release conviva");this.H?this.h.debug(_.ia):(_.hg(this.f),KL(this)||this.o||!LL(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),KL(this)&&OL(this),this.a=null,this.H=!0)};_.t.destroy=function(){this.h.debug(_.Yc);this.m?this.h.debug(_.ha):this.m=!0};
24
- _.t.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c};_.t.mk=function(){this.h.debug("onPlayRequest()");KL(this)||LL(this)?KL(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),KL(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),NL(this))};
25
- _.t.Uh=function(a){function b(d){if(c.o&&(c.h.debug("Creating conviva session (On Seek / Replay)"),ML(c,c.F),NL(c),JL(c),KL(c))){var e=c.l.getTrackManager();e=e.fa()||e.Xa();e.width&&e.height&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,e.width,e.height);e.bandwidth&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e.bandwidth/1E3)}KL(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.h.debug(_.Qd);switch(a.detail.currentState){case _.mn:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.ln:b(Conviva.Constants.PlayerState.PAUSED);break;case _.cn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.en:this.h.debug("onVideoEnded()"),KL(this)&&(this.w&&this.w.kb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.K=!0):OL(this))}};
27
- _.t.Jf=function(a){this.h.debug(_.Md);if(KL(this)){if(a=a.detail,typeof a.width===_.k&&typeof a.height===_.k&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){var b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({bg:this.Jf.bind(this),zf:a})};
28
- _.t.Th=function(){this.h.debug("onSeeking()");KL(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.Sh=function(){this.h.debug("onSeeked()");KL(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Uj=function(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.t.Qh=function(a){this.h.debug(vL);var b=a.ad;a=0===b.Ya();var c=zL(b.getPodIndex());KL(this)||LL(this)||!a||NL(this);if(KL(this)){a=0===b.Ab()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.zb()&&(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||_.gj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,
30
- b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")};_.t.Rh=function(){this.h.debug(wL);KL(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&OL(this))};
31
- _.t.Kf=function(a){this.h.debug(_.Nd);if(this.o&&this.J)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.M&&(d=Conviva.Constants.ErrorSeverity.FATAL,KL(this)||NL(this));KL(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),this.J=!0,OL(this))):this.j.push({bg:this.Kf.bind(this),
32
- zf:a})}};_.t.Wj=function(){this.h.debug("onAutoPlayBlocked()");KL(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,KL(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))};_.t=PL.prototype;_.t.onPlayerCreated=function(a){this.f=new IL(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;RL(this,a);if(this.a){var d=a.getConfiguration();d=_.K.Qa(d.conviva||{});try{QL(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new CL(a,function(){return c.f.a}),this.g.initialize(d))}catch(f){f instanceof _.L?this.S(a,f):this.S(a,new _.L(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&JL(this.f)};
33
- _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.g&&(this.g.destroy(),this.g=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.g&&this.g.release())};_.t.id=function(){return"conviva"};_.t.S=function(a,b){a.trigger(new _.I(_.jd,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.C("clpp.conviva.ConvivaPlugin",PL);PL.prototype.reportAppEvent=PL.prototype.reportAppEvent;PL.Id="conviva";
34
- SL.prototype.create=function(){return new PL};_.Fo(new SL);};
2
+ var f=function(window){var UL="Ad Error",VL="onAdBreakStarted()",WL="onAdBreakStopped()",XL=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.ki(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.cj()&&(g="Apple");_.bj()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.dj()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.cj()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.ji()||_.ii()||_.Zi("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.ji()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.ii()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Zi("Hisense")&&(c="",g="Hisense")):_.Zi("Xbox One")&&(g="Microsoft",d=Conviva.Constants.DeviceType.CONSOLE,e=Conviva.Constants.DeviceCategory.XBOX);var h=a.deviceMetadata||{};b(Conviva.Constants.DeviceMetadata.TYPE,
4
+ a.deviceType||d);b(Conviva.Constants.DeviceMetadata.OS_NAME,f);b(Conviva.Constants.DeviceMetadata.OS_VERSION,c);b(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||e);b(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||g);return h},YL=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},ZL=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},aM=function(a,b,c,d){var e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=
5
+ b;e[Conviva.Constants.IS_LIVE]=YL(!!d);e[Conviva.Constants.ASSET_NAME]=UL;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"]=$L(a.getId()),e["c3.ad.creativeId"]=$L(a.getCreativeId()),e["c3.ad.system"]=$L(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=$L(a.getApiFramework()),e["c3.ad.advertiser"]=$L(a.getAdvertiserName()),e["c3.ad.position"]=ZL(a.getPodIndex()),e["c3.ad.technology"]=0===a.Bb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=$L(a.vb()),e["c3.ad.adManagerVersion"]=$L(a.wb()),e["c3.ad.advertiserCategory"]=$L(null),e["c3.ad.advertiserId"]=$L(null),e["c3.ad.breakId"]=$L(null),e["c3.ad.campaignName"]=$L(null),e["c3.ad.category"]=$L(null),e["c3.ad.classification"]=$L(null),e["c3.ad.creativeName"]=$L(null),e["c3.ad.sequence"]=$L(a.Pb()),e["c3.ad.sessionStartEvent"]=$L(null),e["c3.ad.unitName"]=$L(null),e["c3.ad.dayPart"]=$L(null),
7
+ b=a.getWrapperAdIds().slice(-1)[0]||a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=$L(b),e["c3.ad.firstAdSystem"]=$L(c),e["c3.ad.firstCreativeId"]=$L(a));return e},$L=function(a){return a?""+a:"NA"},bM=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.oa;this.h=new _.I("clpp.conviva.ad");this.f=new _.dg;this.a=null;this.j=this.m=this.o=this.g=!1},cM=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=aM(b,a.A,a.w,a.l.isLive()),d=String(b.wb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.vb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.h.error("Could not create ad analytics session",f)}}},fM=function(a,b,c){c=void 0===c?UL:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case dM:a.a.reportAdFailed(c,aM(null,a.A,a.w));break;case eM:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.g=!1}},gM=function(a){a.f.on(a.l,_.Fb,a.Nh.bind(a));a.f.on(a.l,_.Gb,a.Oh.bind(a));a.f.on(a.l,_.Sb,a.Uh.bind(a));a.f.on(a.l,_.Pb,a.Yd.bind(a));a.f.on(a.l,_.Ob,a.Yd.bind(a));a.f.on(a.l,_.Qb,a.Yd.bind(a));a.f.on(a.l,_.Hb,a.Yd.bind(a));a.f.on(a.l,_.Tb,a.Vh.bind(a));a.f.on(a.l,_.Rb,a.Th.bind(a));a.f.on(a.l,_.Ib,a.Ph.bind(a));a.f.on(a.l,_.Lb,a.Rh.bind(a));a.f.on(a.l,_.Mb,a.Sh.bind(a));a.f.on(a.l,_.Kb,a.Qh.bind(a));a.f.on(a.l,_.Nb,a.Zj.bind(a));a.f.on(a.l,_.Ub,a.Wh.bind(a));a.f.on(a.l,_.hd,function(b){var c=
10
+ b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.j)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=UL}null===a.a&&cM(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.h.debug("Ad Playback Failure");fM(a,dM,c)}})},hM=function(a,b){this.l=a;this.f=new _.dg;this.a=null;this.o=!1;this.H=!0;this.B=this.g=this.A=this.D=this.m=!1;this.N=0;this.K=!1;this.w=null;this.J=!1;this.h=b;this.M=this.F=null;this.j=[];this.I=0},
11
+ iM=function(a){if(!a.m&&a.a){var b=YL(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.a.setContentInfo(c)}},jM=function(a){return null!==a.a&&a.D},kM=function(a){return a.l.getConfiguration().autoplay||!1},lM=function(a,b){var c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,
12
+ null,c);Conviva.Analytics.setDeviceMetadata(XL(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;c={};c[Conviva.Constants.FRAMEWORK_NAME]=_.oa;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.a.setPlayerInfo(c)},mM=function(a){if(!a.m)if(a.D)a.h.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.M,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||
13
+ "N/A",e=c&&c.defaultResource||"N/A";a.h.debug(a.l.getConfiguration().source);var f={},g=new _.zi(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ai(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.oa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.K.R(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(function(){a.h.debug("reportMiscellaneousMetrics()");if(jM(a)){var l=
14
+ 1E3*a.l.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.l.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.h.debug("Current FPS",m),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.D=!0;a.g=!0;a.J=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(function(l){l.hg(l.Df)}));a.j=[]}},nM=function(a){a.h.debug("terminateSession()");a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,
15
+ Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.D=!1,a.A=!1,a.g=!1,a.w=null,a.B=!1,a.N=0,a.K=!1,a.j=[],a.I=0)},oM=function(){this.g=this.f=null;this.a=!1;this.h=new _.I("clpp.conviva")},pM=function(a){var b=[];typeof a===_.Jd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.L(1,9,9001,{missingKeys:b});},qM=function(a,b){var c=b.getConfiguration();a.a=!_.K.R(c.conviva)&&typeof c.conviva===
16
+ _.Jd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.L(1,9,9E3),a.U(b,c)):b.namespace()===_.Hc&&(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.")},rM=function(){};_.t=bM.prototype;_.t.initialize=function(a){this.h.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.oa;gM(this)};_.t.release=function(){this.h.debug("Release Ad Insights");this.o?this.h.debug(_.ia):(_.gg(this.f),this.a&&fM(this,sM),this.f.release(),this.o=!0,this.g=this.j=!1)};_.t.destroy=function(){this.h.debug(_.Vc);this.m?this.h.debug(_.ha):this.m=!0};_.t.Nh=function(){this.h.debug(VL)};_.t.Oh=function(){this.h.debug(WL)};
17
+ _.t.Uh=function(a){this.h.debug("onAdStarted()");a=a.ad;this.g||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),cM(this,a));this.g=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.yb(),a.xb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.kb())};
18
+ _.t.Yd=function(a){var b=this;this.h.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Pb:case _.Qb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Ob:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Hb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.Vh=function(){this.h.debug("onAdStopped()");this.a&&!this.j&&fM(this,sM)};_.t.Th=function(){this.h.debug("onAdSkipped()");this.a&&fM(this,eM)};
19
+ _.t.Ph=function(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Rh=function(){this.h.debug("onAdImpression()");if(this.a){var a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}};
20
+ _.t.Sh=function(a){var b=this;this.h.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)b.g=!0,cM(b,c);else this.f.on(this.l,_.De,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.f.off(b.l,_.De),b.g=!0,cM(b,c))})};_.t.Qh=function(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Zj=function(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.t.Wh=function(){this.h.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var eM=0,sM=1,dM=2;_.t=hM.prototype;
22
+ _.t.initialize=function(a,b,c){this.m||(this.h.debug("Initialize conviva"),this.H=!1,this.F=_.K.Ra(b),this.M=c,this.l=a,lM(this,this.F),this.f.on(this.l,_.Xd,this.zk.bind(this)),this.f.on(this.l,_.pe,this.ai.bind(this)),this.f.on(this.l,_.rc,this.Nf.bind(this)),this.f.on(this.l,_.Le,this.$h.bind(this)),this.f.on(this.l,_.Ke,this.Zh.bind(this)),this.f.on(this.l,_.Fb,this.Xh.bind(this)),this.f.on(this.l,_.Gb,this.Yh.bind(this)),this.f.on(this.l,_.Wb,this.ek.bind(this)),this.f.on(this.l,_.qc,this.gk.bind(this)),
23
+ this.f.on(this.l,_.hd,this.Of.bind(this)),kM(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),mM(this)))};_.t.release=function(){this.h.debug("Release conviva");this.H?this.h.debug(_.ia):(_.gg(this.f),jM(this)||this.o||!kM(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),jM(this)&&nM(this),this.a=null,this.H=!0)};_.t.destroy=function(){this.h.debug(_.Vc);this.m?this.h.debug(_.ha):this.m=!0};
24
+ _.t.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c};_.t.zk=function(){this.h.debug("onPlayRequest()");jM(this)||kM(this)?jM(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),jM(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),mM(this))};
25
+ _.t.ai=function(a){function b(d){if(c.o&&(c.h.debug("Creating conviva session (On Seek / Replay)"),lM(c,c.F),mM(c),iM(c),jM(c))){var e=c.l.getTrackManager();e=e.fa()||e.Za();e.width&&e.height&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,e.width,e.height);e.bandwidth&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e.bandwidth/1E3)}jM(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.h.debug(_.Od);switch(a.detail.currentState){case _.Xm:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.Wm:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Om:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Qm:this.h.debug("onVideoEnded()"),jM(this)&&(this.w&&this.w.lb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.K=!0):nM(this))}};
27
+ _.t.Nf=function(a){this.h.debug(_.Kd);if(jM(this)){if(a=a.detail,typeof a.width===_.k&&typeof a.height===_.k&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){var b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({hg:this.Nf.bind(this),Df:a})};
28
+ _.t.$h=function(){this.h.debug("onSeeking()");jM(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.Zh=function(){this.h.debug("onSeeked()");jM(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.ek=function(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.t.Xh=function(a){this.h.debug(VL);var b=a.ad;a=0===b.$a();var c=ZL(b.getPodIndex());jM(this)||kM(this)||!a||mM(this);if(jM(this)){a=0===b.Bb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.Ab()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.N;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.bj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,
30
+ b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")};_.t.Yh=function(){this.h.debug(WL);jM(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&nM(this))};
31
+ _.t.Of=function(a){this.h.debug(_.Ld);if(this.o&&this.J)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.M&&(d=Conviva.Constants.ErrorSeverity.FATAL,jM(this)||mM(this));jM(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),this.J=!0,nM(this))):this.j.push({hg:this.Of.bind(this),
32
+ Df:a})}};_.t.gk=function(){this.h.debug("onAutoPlayBlocked()");jM(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,jM(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))};_.t=oM.prototype;_.t.onPlayerCreated=function(a){this.f=new hM(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;qM(this,a);if(this.a){var d=a.getConfiguration();d=_.K.Ra(d.conviva||{});try{pM(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new bM(a,function(){return c.f.a}),this.g.initialize(d))}catch(f){f instanceof _.L?this.U(a,f):this.U(a,new _.L(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&iM(this.f)};
33
+ _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.g&&(this.g.destroy(),this.g=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.g&&this.g.release())};_.t.id=function(){return"conviva"};_.t.U=function(a,b){a.trigger(new _.J(_.hd,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.C("clpp.conviva.ConvivaPlugin",oM);oM.prototype.reportAppEvent=oM.prototype.reportAppEvent;oM.Id="conviva";
34
+ rM.prototype.create=function(){return new oM};_.qo(new rM);};
35
35
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
36
36
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
37
37
  else{_=this.clpp._;(f.call(g,this));}