@castlabs/prestoplay 6.17.1 → 6.19.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 (64) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +115 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +575 -565
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -74
  10. package/cjs/cl.externs.js +175 -293
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +70 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +315 -314
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +90 -89
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +473 -466
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +72 -70
  40. package/cl.externs.js +172 -294
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +74 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +276 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +11 -11
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/clpp.styles.css +14 -0
  63. package/package.json +2 -2
  64. package/typings.d.ts +406 -377
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var zT="Ad Error",AT="onAdBreakStarted()",BT="onAdBreakStopped()",CT=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Xj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.dl()&&(g="Apple");_.bl()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.el()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.dl()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Wj()||_.Vj()||_.Zk("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Wj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Vj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Zk("Hisense")&&(c="",g="Hisense")):_.Zk("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},DT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},ET=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},GT=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]=DT(!!d);e[Conviva.Constants.ASSET_NAME]=zT;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"]=FT(a.getId()),e["c3.ad.creativeId"]=FT(a.getCreativeId()),e["c3.ad.system"]=FT(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=FT(a.getApiFramework()),e["c3.ad.advertiser"]=FT(a.getAdvertiserName()),e["c3.ad.position"]=ET(a.getPodIndex()),e["c3.ad.technology"]=0===a.Gb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=FT(a.zb()),e["c3.ad.adManagerVersion"]=FT(a.Ab()),e["c3.ad.advertiserCategory"]=FT(null),e["c3.ad.advertiserId"]=FT(null),e["c3.ad.breakId"]=FT(null),e["c3.ad.campaignName"]=FT(null),e["c3.ad.category"]=FT(null),e["c3.ad.classification"]=FT(null),e["c3.ad.creativeName"]=FT(null),e["c3.ad.sequence"]=FT(a.Vb()),e["c3.ad.sessionStartEvent"]=FT(null),e["c3.ad.unitName"]=FT(null),e["c3.ad.dayPart"]=FT(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"]=FT(b),e["c3.ad.firstAdSystem"]=FT(c),e["c3.ad.firstCreativeId"]=FT(a));return e},FT=function(a){return a?""+a:"NA"},HT=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.va;this.g=new _.K("clpp.conviva.ad");this.f=new _.Uh;this.a=null;this.j=this.l=this.o=this.h=!1},IT=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=GT(b,a.A,a.w,a.m.isLive()),d=String(b.Ab()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.zb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.g.error("Could not create ad analytics session",f)}}},LT=function(a,b,c){c=void 0===c?zT:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case JT:a.a.reportAdFailed(c,GT(null,a.A,a.w));break;case KT:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},MT=function(a){a.f.on(a.m,_.xc,a.lj.bind(a));a.f.on(a.m,_.yc,a.mj.bind(a));a.f.on(a.m,_.Kc,a.sj.bind(a));a.f.on(a.m,_.Hc,a.He.bind(a));a.f.on(a.m,_.Gc,a.He.bind(a));a.f.on(a.m,_.Ic,a.He.bind(a));a.f.on(a.m,_.zc,a.He.bind(a));a.f.on(a.m,_.Lc,a.tj.bind(a));a.f.on(a.m,_.Jc,a.rj.bind(a));a.f.on(a.m,_.Ac,a.nj.bind(a));a.f.on(a.m,_.Dc,a.pj.bind(a));a.f.on(a.m,_.Ec,a.qj.bind(a));a.f.on(a.m,_.Cc,a.oj.bind(a));a.f.on(a.m,_.Fc,a.Nl.bind(a));a.f.on(a.m,_.Mc,a.uj.bind(a));a.f.on(a.m,_.re,function(b){var c=
10
- b.detail;if(10003===c.code&&(a.g.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=zT}null===a.a&&IT(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");LT(a,JT,c)}})},NT=function(a,b){this.m=a;this.f=new _.Uh;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.D=this.l=!1;this.N=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
- OT=function(a){if(!a.l&&a.a){var b=DT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},PT=function(a){return null!==a.a&&a.D},QT=function(a){return a.m.getConfiguration().autoplay||!1},RT=function(a,b){var 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,
12
- null,c);Conviva.Analytics.setDeviceMetadata(CT(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]=_.va;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.a.setPlayerInfo(c)},ST=function(a){if(!a.l)if(a.D)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.L,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||
13
- "N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=new _.qk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.rk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.va;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.O.R(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(function(){a.g.debug("reportMiscellaneousMetrics()");if(PT(a)){var l=
14
- 1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.m.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.g.debug("Current FPS",m),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.D=!0;a.h=!0;a.J=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(function(l){l.lh(l.args)}));a.j=[]}},TT=function(a){a.g.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.h=!1,a.w=null,a.B=!1,a.N=0,a.K=!1,a.j=[],a.I=0)},UT=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},VT=function(a){var b=[];typeof a===_.Xe&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.P(1,9,9001,{missingKeys:b});},WT=function(a,b){var c=b.getConfiguration();a.a=!_.O.R(c.conviva)&&typeof c.conviva===
16
- _.Xe;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.P(1,9,9E3),a.T(b,c)):b.namespace()===_.Ed&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},XT=function(){};_.t=HT.prototype;_.t.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.va;MT(this)};_.t.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.la):(_.Xh(this.f),this.a&&LT(this,YT),this.f.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.g.debug(_.Yd);this.l?this.g.debug(_.ka):this.l=!0};_.t.lj=function(){this.g.debug(AT)};_.t.mj=function(){this.g.debug(BT)};
17
- _.t.sj=function(a){this.g.debug("onAdStarted()");a=a.ad;this.h||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),IT(this,a));this.h=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.Db(),a.Cb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.pb())};
18
- _.t.He=function(a){var b=this;this.g.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Hc:case _.Ic:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Gc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.zc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.tj=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&LT(this,YT)};_.t.rj=function(){this.g.debug("onAdSkipped()");this.a&&LT(this,KT)};
19
- _.t.nj=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.pj=function(){this.g.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.qj=function(a){var b=this;this.g.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)b.h=!0,IT(b,c);else this.f.on(this.m,_.rg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.rg),b.h=!0,IT(b,c))})};_.t.oj=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Nl=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.t.uj=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var KT=0,YT=1,JT=2;_.t=NT.prototype;
22
- _.t.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.O.Na(b),this.L=c,this.m=a,RT(this,this.G),this.f.on(this.m,_.lf,this.om.bind(this)),this.f.on(this.m,_.gg,this.zj.bind(this)),this.f.on(this.m,_.jd,this.Fg.bind(this)),this.f.on(this.m,_.Dg,this.yj.bind(this)),this.f.on(this.m,_.Cg,this.xj.bind(this)),this.f.on(this.m,_.xc,this.vj.bind(this)),this.f.on(this.m,_.yc,this.wj.bind(this)),this.f.on(this.m,_.Oc,this.Tl.bind(this)),this.f.on(this.m,_.id,this.Vl.bind(this)),
23
- this.f.on(this.m,_.re,this.Gg.bind(this)),QT(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),ST(this)))};_.t.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.la):(_.Xh(this.f),PT(this)||this.o||!QT(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),PT(this)&&TT(this),this.a=null,this.H=!0)};_.t.destroy=function(){this.g.debug(_.Yd);this.l?this.g.debug(_.ka):this.l=!0};
24
- _.t.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c};_.t.om=function(){this.g.debug("onPlayRequest()");PT(this)||QT(this)?PT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),PT(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"),ST(this))};
25
- _.t.zj=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),RT(c,c.G),ST(c),OT(c),PT(c))){var e=c.m.getTrackManager();e=e.na()||e.eb();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)}PT(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.bf);switch(a.detail.currentState){case _.zp:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.yp:b(Conviva.Constants.PlayerState.PAUSED);break;case _.qp:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.sp:this.g.debug("onVideoEnded()"),PT(this)&&(this.w&&this.w.rb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):TT(this))}};
27
- _.t.Fg=function(a){this.g.debug(_.Ye);if(PT(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({lh:this.Fg.bind(this),args:a})};
28
- _.t.yj=function(){this.g.debug("onSeeking()");PT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.xj=function(){this.g.debug("onSeeked()");PT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Tl=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.t.vj=function(a){this.g.debug(AT);var b=a.ad;a=0===b.fb();var c=ET(b.getPodIndex());PT(this)||QT(this)||!a||ST(this);if(PT(this)){a=0===b.Gb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.Fb()&&(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||_.bl()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,
30
- b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")};_.t.wj=function(){this.g.debug(BT);PT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&TT(this))};
31
- _.t.Gg=function(a){this.g.debug(_.Ze);if(this.o&&this.J)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===_.Q&&(d=Conviva.Constants.ErrorSeverity.FATAL,PT(this)||ST(this));PT(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),this.J=!0,TT(this))):this.j.push({lh:this.Gg.bind(this),
32
- args:a})}};_.t.Vl=function(){this.g.debug("onAutoPlayBlocked()");PT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,PT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=UT.prototype;_.t.onPlayerCreated=function(a){this.f=new NT(a,this.g)};_.t.onContentWillLoad=function(a,b){var c=this;WT(this,a);if(this.a){var d=a.getConfiguration();d=_.O.Na(d.conviva||{});try{VT(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new HT(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.P?this.T(a,f):this.T(a,new _.P(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&OT(this.f)};
33
- _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.t.id=function(){return"conviva"};_.t.T=function(a,b){a.trigger(new _.L(_.re,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.J("clpp.conviva.ConvivaPlugin",UT);UT.prototype.reportAppEvent=UT.prototype.reportAppEvent;UT.Id="conviva";
34
- XT.prototype.create=function(){return new UT};_.$q(new XT);};
2
+ var f=function(window){var PT="Ad Error",QT="onAdBreakStarted()",RT="onAdBreakStopped()",ST=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Wj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.bl()&&(g="Apple");_.al()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.dl()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.bl()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Vj()||_.Uj()||_.Yk("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Vj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Uj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Yk("Hisense")&&(c="",g="Hisense")):_.Yk("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},TT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},UT=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},WT=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]=TT(!!d);e[Conviva.Constants.ASSET_NAME]=PT;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"]=VT(a.getId()),e["c3.ad.creativeId"]=VT(a.getCreativeId()),e["c3.ad.system"]=VT(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=VT(a.getApiFramework()),e["c3.ad.advertiser"]=VT(a.getAdvertiserName()),e["c3.ad.position"]=UT(a.getPodIndex()),e["c3.ad.technology"]=0===a.qb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=VT(a.jb()),e["c3.ad.adManagerVersion"]=VT(a.kb()),e["c3.ad.advertiserCategory"]=VT(null),e["c3.ad.advertiserId"]=VT(null),e["c3.ad.breakId"]=VT(null),e["c3.ad.campaignName"]=VT(null),e["c3.ad.category"]=VT(null),e["c3.ad.classification"]=VT(null),e["c3.ad.creativeName"]=VT(null),e["c3.ad.sequence"]=VT(a.Db()),e["c3.ad.sessionStartEvent"]=VT(null),e["c3.ad.unitName"]=VT(null),e["c3.ad.dayPart"]=VT(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"]=VT(b),e["c3.ad.firstAdSystem"]=VT(c),e["c3.ad.firstCreativeId"]=VT(a));return e},VT=function(a){return a?""+a:"NA"},XT=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.va;this.g=new _.K("clpp.conviva.ad");this.f=new _.Sh;this.a=null;this.j=this.l=this.o=this.h=!1},YT=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=WT(b,a.A,a.w,a.m.isLive()),d=String(b.kb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.jb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.g.error("Could not create ad analytics session",f)}}},aU=function(a,b,c){c=void 0===c?PT:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case ZT:a.a.reportAdFailed(c,WT(null,a.A,a.w));break;case $T:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},bU=function(a){a.f.on(a.m,_.uc,a.zj.bind(a));a.f.on(a.m,_.vc,a.Aj.bind(a));a.f.on(a.m,_.Jc,a.Gj.bind(a));a.f.on(a.m,_.Gc,a.Oe.bind(a));a.f.on(a.m,_.Fc,a.Oe.bind(a));a.f.on(a.m,_.Hc,a.Oe.bind(a));a.f.on(a.m,_.wc,a.Oe.bind(a));a.f.on(a.m,_.Kc,a.Hj.bind(a));a.f.on(a.m,_.Ic,a.Fj.bind(a));a.f.on(a.m,_.xc,a.Bj.bind(a));a.f.on(a.m,_.Cc,a.Dj.bind(a));a.f.on(a.m,_.Dc,a.Ej.bind(a));a.f.on(a.m,_.zc,a.Cj.bind(a));a.f.on(a.m,_.Ec,a.Wl.bind(a));a.f.on(a.m,_.Lc,a.Ij.bind(a));a.f.on(a.m,_.ne,function(b){var c=
10
+ b.detail;if(10003===c.code&&(a.g.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=PT}null===a.a&&YT(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");aU(a,ZT,c)}})},cU=function(a,b){this.m=a;this.f=new _.Sh;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.C=this.l=!1;this.N=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
+ dU=function(a){if(!a.l&&a.a){var b=TT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},eU=function(a){return null!==a.a&&a.C},fU=function(a){return a.m.getConfiguration().autoplay||!1},gU=function(a,b){var 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,
12
+ null,c);Conviva.Analytics.setDeviceMetadata(ST(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]=_.va;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.a.setPlayerInfo(c)},hU=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.L,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||
13
+ "N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=new _.pk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.qk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.va;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.M.R(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(function(){a.g.debug("reportMiscellaneousMetrics()");if(eU(a)){var l=
14
+ 1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.m.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.g.debug("Current FPS",m),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.C=!0;a.h=!0;a.J=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(function(l){l.vh(l.args)}));a.j=[]}},iU=function(a){a.g.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.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.N=0,a.K=!1,a.j=[],a.I=0)},jU=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},kU=function(a){var b=[];typeof a===_.Ue&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.N(1,9,9001,{missingKeys:b});},lU=function(a,b){var c=b.getConfiguration();a.a=!_.M.R(c.conviva)&&typeof c.conviva===
16
+ _.Ue;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.N(1,9,9E3),a.S(b,c)):b.namespace()===_.Bd&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},mU=function(){};_.u=XT.prototype;_.u.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.va;bU(this)};_.u.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.la):(_.Vh(this.f),this.a&&aU(this,nU),this.f.release(),this.o=!0,this.h=this.j=!1)};_.u.destroy=function(){this.g.debug(_.Ud);this.l?this.g.debug(_.ka):this.l=!0};_.u.zj=function(){this.g.debug(QT)};_.u.Aj=function(){this.g.debug(RT)};
17
+ _.u.Gj=function(a){this.g.debug("onAdStarted()");a=a.ad;this.h||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),YT(this,a));this.h=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.ob(),a.nb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.ab())};
18
+ _.u.Oe=function(a){var b=this;this.g.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Gc:case _.Hc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Fc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.wc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.u.Hj=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&aU(this,nU)};_.u.Fj=function(){this.g.debug("onAdSkipped()");this.a&&aU(this,$T)};
19
+ _.u.Bj=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.u.Dj=function(){this.g.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
+ _.u.Ej=function(a){var b=this;this.g.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)b.h=!0,YT(b,c);else this.f.on(this.m,_.og,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.og),b.h=!0,YT(b,c))})};_.u.Cj=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.u.Wl=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.u.Ij=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var $T=0,nU=1,ZT=2;_.u=cU.prototype;
22
+ _.u.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.M.$a(b),this.L=c,this.m=a,gU(this,this.G),this.f.on(this.m,_.hf,this.xm.bind(this)),this.f.on(this.m,_.cg,this.Nj.bind(this)),this.f.on(this.m,_.id,this.Qg.bind(this)),this.f.on(this.m,_.yg,this.Mj.bind(this)),this.f.on(this.m,_.xg,this.Lj.bind(this)),this.f.on(this.m,_.uc,this.Jj.bind(this)),this.f.on(this.m,_.vc,this.Kj.bind(this)),this.f.on(this.m,_.Nc,this.bm.bind(this)),this.f.on(this.m,_.hd,this.dm.bind(this)),
23
+ this.f.on(this.m,_.ne,this.Rg.bind(this)),fU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),hU(this)))};_.u.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.la):(_.Vh(this.f),eU(this)||this.o||!fU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),eU(this)&&iU(this),this.a=null,this.H=!0)};_.u.destroy=function(){this.g.debug(_.Ud);this.l?this.g.debug(_.ka):this.l=!0};
24
+ _.u.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c};_.u.xm=function(){this.g.debug("onPlayRequest()");eU(this)||fU(this)?eU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),eU(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"),hU(this))};
25
+ _.u.Nj=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),gU(c,c.G),hU(c),dU(c),eU(c))){var e=c.m.getTrackManager();e=e.na()||e.lb();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)}eU(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.Ze);switch(a.detail.currentState){case _.xp:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.wp:b(Conviva.Constants.PlayerState.PAUSED);break;case _.op:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.qp:this.g.debug("onVideoEnded()"),eU(this)&&(this.w&&this.w.Eb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):iU(this))}};
27
+ _.u.Qg=function(a){this.g.debug(_.Ve);if(eU(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({vh:this.Qg.bind(this),args:a})};
28
+ _.u.Mj=function(){this.g.debug("onSeeking()");eU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.u.Lj=function(){this.g.debug("onSeeked()");eU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.u.bm=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.u.Jj=function(a){this.g.debug(QT);var b=a.ad;a=0===b.Ua();var c=UT(b.getPodIndex());eU(this)||fU(this)||!a||hU(this);if(eU(this)){a=0===b.qb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.pb()&&(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||_.al()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,
30
+ b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")};_.u.Kj=function(){this.g.debug(RT);eU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&iU(this))};
31
+ _.u.Rg=function(a){this.g.debug(_.We);if(this.o&&this.J)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===_.O&&(d=Conviva.Constants.ErrorSeverity.FATAL,eU(this)||hU(this));eU(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),this.J=!0,iU(this))):this.j.push({vh:this.Rg.bind(this),
32
+ args:a})}};_.u.dm=function(){this.g.debug("onAutoPlayBlocked()");eU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,eU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.u=jU.prototype;_.u.onPlayerCreated=function(a){this.f=new cU(a,this.g)};_.u.onContentWillLoad=function(a,b){var c=this;lU(this,a);if(this.a){var d=a.getConfiguration();d=_.M.$a(d.conviva||{});try{kU(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new XT(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.N?this.S(a,f):this.S(a,new _.N(1,9,9002,f,f))}}};_.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&dU(this.f)};
33
+ _.u.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.u.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.u.id=function(){return"conviva"};_.u.S=function(a,b){a.trigger(new _.L(_.ne,{detail:b}))};_.u.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.J("clpp.conviva.ConvivaPlugin",jU);jU.prototype.reportAppEvent=jU.prototype.reportAppEvent;jU.Id="conviva";
34
+ mU.prototype.create=function(){return new jU};_.qs(new mU);};
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));}