@castlabs/prestoplay 6.30.1-beta.1 → 6.31.1

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 (65) hide show
  1. package/CHANGELOG.md +44 -9
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -7
  5. package/cjs/cl.cast.js +127 -127
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +509 -510
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +95 -95
  10. package/cjs/cl.externs.js +214 -40
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +79 -78
  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 +350 -348
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -11
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -6
  36. package/cl.cast.js +99 -99
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +387 -386
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +86 -86
  41. package/cl.externs.js +215 -37
  42. package/cl.freewheel.js +20 -20
  43. package/cl.hls.js +82 -82
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -19
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +300 -298
  49. package/cl.muxdata.js +12 -12
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +61 -61
  55. package/cl.thumbnails.js +17 -17
  56. package/cl.tizen.js +55 -55
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +10 -6
  65. package/typings.d.ts +84 -60
package/cjs/cl.conviva.js CHANGED
@@ -1,36 +1,36 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var OU="Ad Error",PU="onAdBreakStarted()",QU="onAdBreakStopped()",RU=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Lj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.oj()&&(g="Apple");_.nj()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.pj()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.oj()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.mj()||_.lj()||_.kj("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.mj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.lj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.kj("Hisense")&&(c="",g="Hisense")):_.kj("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},SU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},TU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},VU=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]=SU(!!d);e[Conviva.Constants.ASSET_NAME]=OU;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"]=UU(a.getId()),e["c3.ad.creativeId"]=UU(a.getCreativeId()),e["c3.ad.system"]=UU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=UU(a.getApiFramework()),e["c3.ad.advertiser"]=UU(a.getAdvertiserName()),e["c3.ad.position"]=TU(a.getPodIndex()),e["c3.ad.technology"]=0===a.Eb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=UU(a.yb()),e["c3.ad.adManagerVersion"]=UU(a.zb()),e["c3.ad.advertiserCategory"]=UU(null),e["c3.ad.advertiserId"]=UU(null),e["c3.ad.breakId"]=UU(null),e["c3.ad.campaignName"]=UU(null),e["c3.ad.category"]=UU(null),e["c3.ad.classification"]=UU(null),e["c3.ad.creativeName"]=UU(null),e["c3.ad.sequence"]=UU(a.Cb()),e["c3.ad.sessionStartEvent"]=UU(null),e["c3.ad.unitName"]=UU(null),e["c3.ad.dayPart"]=UU(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"]=UU(b),e["c3.ad.firstAdSystem"]=UU(c),e["c3.ad.firstCreativeId"]=UU(a));return e},UU=function(a){return a?""+a:"NA"},WU=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.ya;this.g=new _.L("clpp.conviva.ad");this.f=new _.wi;this.a=null;this.j=this.l=this.o=this.h=!1},XU=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=VU(b,a.A,a.w,a.m.isLive()),d=String(b.zb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.yb();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)}}},$U=function(a,b,c){c=void 0===c?OU:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case YU:a.a.reportAdFailed(c,VU(null,a.A,a.w));break;case ZU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},aV=function(a){a.f.on(a.m,_.jc,a.Mk.bind(a));a.f.on(a.m,_.kc,a.Nk.bind(a));a.f.on(a.m,_.Bc,a.Tk.bind(a));a.f.on(a.m,_.yc,a.If.bind(a));a.f.on(a.m,_.xc,a.If.bind(a));a.f.on(a.m,_.zc,a.If.bind(a));a.f.on(a.m,_.lc,a.If.bind(a));a.f.on(a.m,_.Cc,a.Uk.bind(a));a.f.on(a.m,_.Ac,a.Sk.bind(a));a.f.on(a.m,_.mc,a.Ok.bind(a));a.f.on(a.m,_.uc,a.Qk.bind(a));a.f.on(a.m,_.vc,a.Rk.bind(a));a.f.on(a.m,_.oc,a.Pk.bind(a));a.f.on(a.m,_.wc,a.qn.bind(a));a.f.on(a.m,_.Dc,a.Vk.bind(a));a.f.on(a.m,_.qe,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=OU}null===a.a&&XU(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");$U(a,YU,c)}})},bV=function(a,b){this.m=a;this.f=new _.wi;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.D=this.l=!1;this.O=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
- cV=function(a){if(!a.l&&a.a){var b=SU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},dV=function(a){return null!==a.a&&a.D},eV=function(a){return a.m.getConfiguration().autoplay||!1},fV=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(RU(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]=_.ya;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.a.setPlayerInfo(c)},gV=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 _.vn(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.wn(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ya;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(dV(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.pi(l.args)}));a.j=[]}},hV=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.O=0,a.K=!1,a.j=[],a.I=0)},iV=function(){this.h=this.f=null;this.a=!1;this.g=new _.L("clpp.conviva")},jV=function(a){var b=[];typeof a===_.$e&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.O(1,9,9001,{missingKeys:b});},lV=function(a,b){var c=b.getConfiguration();a.a=!_.M.R(c.conviva)&&typeof c.conviva===
16
- _.$e;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.O(1,9,9E3),kV(b,c)):b.namespace()===_.xd&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},kV=function(a,b){a.trigger(new _.Q(_.qe,{detail:b}))},mV=function(){};_.r=WU.prototype;_.r.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.ya;aV(this)};_.r.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.ma):(_.zi(this.f),this.a&&$U(this,nV),this.f.release(),this.o=!0,this.h=this.j=!1)};_.r.destroy=function(){this.g.debug(_.Vd);this.l?this.g.debug(_.la):this.l=!0};_.r.Mk=function(){this.g.debug(PU)};_.r.Nk=function(){this.g.debug(QU)};
17
- _.r.Tk=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"),XU(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.pb(),a.ob());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())};
18
- _.r.If=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 _.yc:case _.zc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.xc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.lc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.r.Uk=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&$U(this,nV)};_.r.Sk=function(){this.g.debug("onAdSkipped()");this.a&&$U(this,ZU)};
19
- _.r.Ok=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.r.Qk=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
- _.r.Rk=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,XU(b,c);else this.f.on(this.m,_.zg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.zg),b.h=!0,XU(b,c))})};_.r.Pk=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.r.qn=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.r.Vk=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var ZU=0,nV=1,YU=2;_.r=bV.prototype;
22
- _.r.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.M.lb(b),this.L=c,this.m=a,fV(this,this.G),this.f.on(this.m,_.pf,this.Rn.bind(this)),this.f.on(this.m,_.ig,this.$k.bind(this)),this.f.on(this.m,_.ad,this.Oh.bind(this)),this.f.on(this.m,_.Ng,this.Zk.bind(this)),this.f.on(this.m,_.Mg,this.Yk.bind(this)),this.f.on(this.m,_.jc,this.Wk.bind(this)),this.f.on(this.m,_.kc,this.Xk.bind(this)),this.f.on(this.m,_.Fc,this.vn.bind(this)),this.f.on(this.m,_.$c,this.wn.bind(this)),
23
- this.f.on(this.m,_.qe,this.Ph.bind(this)),eV(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),gV(this)))};_.r.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.ma):(_.zi(this.f),dV(this)||this.o||!eV(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),dV(this)&&hV(this),this.a=null,this.H=!0)};_.r.destroy=function(){this.g.debug(_.Vd);this.l?this.g.debug(_.la):this.l=!0};
24
- _.r.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};_.r.Rn=function(){this.g.debug("onPlayRequest()");dV(this)||eV(this)?dV(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),dV(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"),gV(this))};
25
- _.r.$k=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),fV(c,c.G),gV(c),cV(c),dV(c))){var e=c.m.getTrackManager();e=e.qa()||e.Bb();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)}dV(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.ff);switch(a.detail.currentState){case 3:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case 4:b(Conviva.Constants.PlayerState.PAUSED);break;case 2:b(Conviva.Constants.PlayerState.BUFFERING);break;case 5:this.g.debug("onVideoEnded()"),dV(this)&&(this.w&&this.w.Ub()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):hV(this))}};
27
- _.r.Oh=function(a){this.g.debug(_.af);if(dV(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({pi:this.Oh.bind(this),args:a})};
28
- _.r.Zk=function(){this.g.debug("onSeeking()");dV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.r.Yk=function(){this.g.debug("onSeeked()");dV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.r.vn=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.r.Wk=function(a){this.g.debug(PU);var b=a.ad;a=0===b.$a();var c=TU(b.getPodIndex());dV(this)||eV(this)||!a||gV(this);if(dV(this)){a=0===b.Eb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.qb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.nj()?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")};_.r.Xk=function(){this.g.debug(QU);dV(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&hV(this))};
31
- _.r.Ph=function(a){this.g.debug(_.cf);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===_.P&&(d=Conviva.Constants.ErrorSeverity.FATAL,dV(this)||gV(this));dV(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,hV(this))):this.j.push({pi:this.Ph.bind(this),
32
- args:a})}};_.r.wn=function(){this.g.debug("onAutoPlayBlocked()");dV(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,dV(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.r=iV.prototype;_.r.onPlayerCreated=function(a){this.f=new bV(a,this.g)};_.r.onContentWillLoad=function(a,b){var c=this;lV(this,a);if(this.a){var d=a.getConfiguration();d=_.M.lb(d.conviva||{});try{jV(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new WU(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.O?kV(a,f):kV(a,new _.O(1,9,9002,f,f))}}};_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&cV(this.f)};
33
- _.r.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.r.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.r.id=function(){return"conviva"};_.r.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.K("clpp.conviva.ConvivaPlugin",iV);iV.prototype.reportAppEvent=iV.prototype.reportAppEvent;iV.Id="conviva";mV.prototype.create=function(){return new iV};_.ap(new mV);};
2
+ var f=function(window){var QU="Ad Error",RU="onAdBreakStarted()",SU="onAdBreakStopped()",TU=function(a){function b(l,m){l in k||!m||(k[l]=m)}var c=_.Lj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.oj()&&(g="Apple");_.nj()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.pj()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.oj()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.mj()||_.lj()||_.kj("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.mj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.lj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.kj("Hisense")&&(c="",g="Hisense")):_.kj("Xbox One")&&(g="Microsoft",d=Conviva.Constants.DeviceType.CONSOLE,e=Conviva.Constants.DeviceCategory.XBOX);var k=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 k},UU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},VU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},XU=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]=UU(!!d);e[Conviva.Constants.ASSET_NAME]=QU;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"]=WU(a.getId()),e["c3.ad.creativeId"]=WU(a.getCreativeId()),e["c3.ad.system"]=WU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=WU(a.getApiFramework()),e["c3.ad.advertiser"]=WU(a.getAdvertiserName()),e["c3.ad.position"]=VU(a.getPodIndex()),e["c3.ad.technology"]=0===a.nb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=WU(a.jb()),e["c3.ad.adManagerVersion"]=WU(a.kb()),e["c3.ad.advertiserCategory"]=WU(null),e["c3.ad.advertiserId"]=WU(null),e["c3.ad.breakId"]=WU(null),e["c3.ad.campaignName"]=WU(null),e["c3.ad.category"]=WU(null),e["c3.ad.classification"]=WU(null),e["c3.ad.creativeName"]=WU(null),e["c3.ad.sequence"]=WU(a.lb()),e["c3.ad.sessionStartEvent"]=WU(null),e["c3.ad.unitName"]=WU(null),e["c3.ad.dayPart"]=WU(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"]=WU(b),e["c3.ad.firstAdSystem"]=WU(c),e["c3.ad.firstCreativeId"]=WU(a));return e},WU=function(a){return a?""+a:"NA"},YU=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.ya;this.g=new _.M("clpp.conviva.ad");this.f=new _.wi;this.a=null;this.j=this.l=this.o=this.h=!1},ZU=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=XU(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)}}},bV=function(a,b,c){c=void 0===c?QU:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case $U:a.a.reportAdFailed(c,XU(null,a.A,a.w));break;case aV:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},cV=function(a){a.f.on(a.m,_.jc,a.Ok.bind(a));a.f.on(a.m,_.kc,a.Pk.bind(a));a.f.on(a.m,_.Bc,a.Vk.bind(a));a.f.on(a.m,_.yc,a.Kf.bind(a));a.f.on(a.m,_.xc,a.Kf.bind(a));a.f.on(a.m,_.zc,a.Kf.bind(a));a.f.on(a.m,_.lc,a.Kf.bind(a));a.f.on(a.m,_.Cc,a.Wk.bind(a));a.f.on(a.m,_.Ac,a.Uk.bind(a));a.f.on(a.m,_.mc,a.Qk.bind(a));a.f.on(a.m,_.sc,a.Sk.bind(a));a.f.on(a.m,_.uc,a.Tk.bind(a));a.f.on(a.m,_.oc,a.Rk.bind(a));a.f.on(a.m,_.wc,a.rn.bind(a));a.f.on(a.m,_.Dc,a.Xk.bind(a));a.f.on(a.m,_.qe,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=QU}null===a.a&&ZU(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");bV(a,$U,c)}})},dV=function(a,b){this.m=a;this.f=new _.wi;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.D=this.l=!1;this.M=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
+ eV=function(a){if(!a.l&&a.a){var b=UU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},fV=function(a){return null!==a.a&&a.D},gV=function(a){return a.m.getConfiguration().autoplay||!1},hV=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(TU(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]=_.ya;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.a.setPlayerInfo(c)},iV=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 _.vn(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.wn(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ya;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.N.R(c.customTags))for(var k in c.customTags)f[k]=c.customTags[k];a.a.reportPlaybackRequested(f);a.a.setCallback(function(){a.g.debug("reportMiscellaneousMetrics()");if(fV(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.vi(l.args)}));a.j=[]}},jV=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.M=0,a.K=!1,a.j=[],a.I=0)},kV=function(){this.h=this.f=null;this.a=!1;this.g=new _.M("clpp.conviva")},lV=function(a){var b=[];typeof a===_.$e&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.O(1,9,9001,{missingKeys:b});},nV=function(a,b){var c=b.getConfiguration();a.a=!_.N.R(c.conviva)&&typeof c.conviva===
16
+ _.$e;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.O(1,9,9E3),mV(b,c)):b.namespace()===_.xd&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},mV=function(a,b){a.trigger(new _.Q(_.qe,{detail:b}))},oV=function(){};_.r=YU.prototype;_.r.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.ya;cV(this)};_.r.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.ma):(_.zi(this.f),this.a&&bV(this,pV),this.f.release(),this.o=!0,this.h=this.j=!1)};_.r.destroy=function(){this.g.debug(_.Vd);this.l?this.g.debug(_.la):this.l=!0};_.r.Ok=function(){this.g.debug(RU)};_.r.Pk=function(){this.g.debug(SU)};
17
+ _.r.Vk=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"),ZU(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.eb(),a.cb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Ga())};
18
+ _.r.Kf=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 _.yc:case _.zc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.xc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.lc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.r.Wk=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&bV(this,pV)};_.r.Uk=function(){this.g.debug("onAdSkipped()");this.a&&bV(this,aV)};
19
+ _.r.Qk=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.r.Sk=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
+ _.r.Tk=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,ZU(b,c);else this.f.on(this.m,_.zg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.zg),b.h=!0,ZU(b,c))})};_.r.Rk=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.r.rn=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.r.Xk=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var aV=0,pV=1,$U=2;_.r=dV.prototype;
22
+ _.r.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.N.wb(b),this.L=c,this.m=a,hV(this,this.G),this.f.on(this.m,_.pf,this.Tn.bind(this)),this.f.on(this.m,_.ig,this.cl.bind(this)),this.f.on(this.m,_.ad,this.Rh.bind(this)),this.f.on(this.m,_.Ng,this.al.bind(this)),this.f.on(this.m,_.Mg,this.$k.bind(this)),this.f.on(this.m,_.jc,this.Yk.bind(this)),this.f.on(this.m,_.kc,this.Zk.bind(this)),this.f.on(this.m,_.Fc,this.xn.bind(this)),this.f.on(this.m,_.$c,this.yn.bind(this)),
23
+ this.f.on(this.m,_.qe,this.Sh.bind(this)),gV(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),iV(this)))};_.r.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.ma):(_.zi(this.f),fV(this)||this.o||!gV(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),fV(this)&&jV(this),this.a=null,this.H=!0)};_.r.destroy=function(){this.g.debug(_.Vd);this.l?this.g.debug(_.la):this.l=!0};
24
+ _.r.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};_.r.Tn=function(){this.g.debug("onPlayRequest()");fV(this)||gV(this)?fV(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),fV(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"),iV(this))};
25
+ _.r.cl=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),hV(c,c.G),iV(c),eV(c),fV(c))){var e=c.m.getTrackManager();e=e.sa()||e.Fb();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)}fV(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.ff);switch(a.detail.currentState){case 3:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case 4:b(Conviva.Constants.PlayerState.PAUSED);break;case 2:b(Conviva.Constants.PlayerState.BUFFERING);break;case 5:this.g.debug("onVideoEnded()"),fV(this)&&(this.w&&this.w.Xb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):jV(this))}};
27
+ _.r.Rh=function(a){this.g.debug(_.af);if(fV(this)){if(a=a.detail,typeof a.width===_.h&&typeof a.height===_.h&&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({vi:this.Rh.bind(this),args:a})};
28
+ _.r.al=function(){this.g.debug("onSeeking()");fV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.r.$k=function(){this.g.debug("onSeeked()");fV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.r.xn=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.r.Yk=function(a){this.g.debug(RU);var b=a.ad;a=0===b.Ha();var c=VU(b.getPodIndex());fV(this)||gV(this)||!a||iV(this);if(fV(this)){a=0===b.nb()?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.M;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.nj()?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")};_.r.Zk=function(){this.g.debug(SU);fV(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&jV(this))};
31
+ _.r.Sh=function(a){this.g.debug(_.cf);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===_.P&&(d=Conviva.Constants.ErrorSeverity.FATAL,fV(this)||iV(this));fV(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,jV(this))):this.j.push({vi:this.Sh.bind(this),
32
+ args:a})}};_.r.yn=function(){this.g.debug("onAutoPlayBlocked()");fV(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,fV(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.r=kV.prototype;_.r.onPlayerCreated=function(a){this.f=new dV(a,this.g)};_.r.onContentWillLoad=function(a,b){var c=this;nV(this,a);if(this.a){var d=a.getConfiguration();d=_.N.wb(d.conviva||{});try{lV(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new YU(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.O?mV(a,f):mV(a,new _.O(1,9,9002,f,f))}}};_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&eV(this.f)};
33
+ _.r.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.r.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.r.id=function(){return"conviva"};_.r.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.K("clpp.conviva.ConvivaPlugin",kV);kV.prototype.reportAppEvent=kV.prototype.reportAppEvent;kV.Id="conviva";oV.prototype.create=function(){return new kV};_.bp(new oV);};
34
34
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
35
35
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
36
36
  else{_=this.clpp._;(f.call(g,this));}