@castlabs/prestoplay 6.14.1 → 6.16.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 (61) hide show
  1. package/CHANGELOG.md +28 -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 +114 -112
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -538
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +193 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -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 +368 -264
  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.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +455 -443
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +189 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +318 -236
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +393 -57
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var $P="Ad Error",aQ="onAdBreakStarted()",bQ="onAdBreakStopped()",cQ=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Ij(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Nk()&&(g="Apple");_.Mk()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Ok()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.Nk()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Hj()||_.Gj()||_.Jk("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Hj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Gj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Jk("Hisense")&&(c="",g="Hisense")):_.Jk("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},dQ=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},eQ=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},gQ=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]=dQ(!!d);e[Conviva.Constants.ASSET_NAME]=$P;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"]=fQ(a.getId()),e["c3.ad.creativeId"]=fQ(a.getCreativeId()),e["c3.ad.system"]=fQ(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=fQ(a.getApiFramework()),e["c3.ad.advertiser"]=fQ(a.getAdvertiserName()),e["c3.ad.position"]=eQ(a.getPodIndex()),e["c3.ad.technology"]=0===a.Fb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=fQ(a.yb()),e["c3.ad.adManagerVersion"]=fQ(a.zb()),e["c3.ad.advertiserCategory"]=fQ(null),e["c3.ad.advertiserId"]=fQ(null),e["c3.ad.breakId"]=fQ(null),e["c3.ad.campaignName"]=fQ(null),e["c3.ad.category"]=fQ(null),e["c3.ad.classification"]=fQ(null),e["c3.ad.creativeName"]=fQ(null),e["c3.ad.sequence"]=fQ(a.Tb()),e["c3.ad.sessionStartEvent"]=fQ(null),e["c3.ad.unitName"]=fQ(null),e["c3.ad.dayPart"]=fQ(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"]=fQ(b),e["c3.ad.firstAdSystem"]=fQ(c),e["c3.ad.firstCreativeId"]=fQ(a));return e},fQ=function(a){return a?""+a:"NA"},hQ=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.va;this.g=new _.K("clpp.conviva.ad");this.f=new _.Eh;this.a=null;this.j=this.l=this.o=this.h=!1},iQ=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=gQ(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)}}},lQ=function(a,b,c){c=void 0===c?$P:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case jQ:a.a.reportAdFailed(c,gQ(null,a.A,a.w));break;case kQ:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},mQ=function(a){a.f.on(a.m,_.uc,a.Gi.bind(a));a.f.on(a.m,_.vc,a.Hi.bind(a));a.f.on(a.m,_.Hc,a.Ni.bind(a));a.f.on(a.m,_.Ec,a.ue.bind(a));a.f.on(a.m,_.Dc,a.ue.bind(a));a.f.on(a.m,_.Fc,a.ue.bind(a));a.f.on(a.m,_.wc,a.ue.bind(a));a.f.on(a.m,_.Ic,a.Oi.bind(a));a.f.on(a.m,_.Gc,a.Mi.bind(a));a.f.on(a.m,_.xc,a.Ii.bind(a));a.f.on(a.m,_.Ac,a.Ki.bind(a));a.f.on(a.m,_.Bc,a.Li.bind(a));a.f.on(a.m,_.zc,a.Ji.bind(a));a.f.on(a.m,_.Cc,a.Xk.bind(a));a.f.on(a.m,_.Jc,a.Pi.bind(a));a.f.on(a.m,_.pe,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=$P}null===a.a&&iQ(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");lQ(a,jQ,c)}})},nQ=function(a,b){this.m=a;this.f=new _.Eh;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.D=this.l=!1;this.P=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
- oQ=function(a){if(!a.l&&a.a){var b=dQ(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},pQ=function(a){return null!==a.a&&a.D},qQ=function(a){return a.m.getConfiguration().autoplay||!1},rQ=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(cQ(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)},sQ=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 _.bk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.ck(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(pQ(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.Kg(l.args)}));a.j=[]}},tQ=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.P=0,a.K=!1,a.j=[],a.I=0)},uQ=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},vQ=function(a){var b=[];typeof a===_.Ve&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.P(1,9,9001,{missingKeys:b});},wQ=function(a,b){var c=b.getConfiguration();a.a=!_.O.R(c.conviva)&&typeof c.conviva===
16
- _.Ve;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()===_.Dd&&(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.")},xQ=function(){};_.r=hQ.prototype;_.r.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.va;mQ(this)};_.r.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.la):(_.Hh(this.f),this.a&&lQ(this,yQ),this.f.release(),this.o=!0,this.h=this.j=!1)};_.r.destroy=function(){this.g.debug(_.Xd);this.l?this.g.debug(_.ka):this.l=!0};_.r.Gi=function(){this.g.debug(aQ)};_.r.Hi=function(){this.g.debug(bQ)};
17
- _.r.Ni=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"),iQ(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.Cb(),a.Bb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.ob())};
18
- _.r.ue=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 _.Ec:case _.Fc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Dc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.wc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.r.Oi=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&lQ(this,yQ)};_.r.Mi=function(){this.g.debug("onAdSkipped()");this.a&&lQ(this,kQ)};
19
- _.r.Ii=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.r.Ki=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.Li=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,iQ(b,c);else this.f.on(this.m,_.fg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.fg),b.h=!0,iQ(b,c))})};_.r.Ji=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.r.Xk=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.r.Pi=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var kQ=0,yQ=1,jQ=2;_.r=nQ.prototype;
22
- _.r.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,rQ(this,this.G),this.f.on(this.m,_.jf,this.wl.bind(this)),this.f.on(this.m,_.Vf,this.Ui.bind(this)),this.f.on(this.m,_.hd,this.jg.bind(this)),this.f.on(this.m,_.pg,this.Ti.bind(this)),this.f.on(this.m,_.og,this.Si.bind(this)),this.f.on(this.m,_.uc,this.Qi.bind(this)),this.f.on(this.m,_.vc,this.Ri.bind(this)),this.f.on(this.m,_.Lc,this.cl.bind(this)),this.f.on(this.m,_.gd,this.el.bind(this)),
23
- this.f.on(this.m,_.pe,this.kg.bind(this)),qQ(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),sQ(this)))};_.r.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.la):(_.Hh(this.f),pQ(this)||this.o||!qQ(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),pQ(this)&&tQ(this),this.a=null,this.H=!0)};_.r.destroy=function(){this.g.debug(_.Xd);this.l?this.g.debug(_.ka):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.wl=function(){this.g.debug("onPlayRequest()");pQ(this)||qQ(this)?pQ(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),pQ(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"),sQ(this))};
25
- _.r.Ui=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),rQ(c,c.G),sQ(c),oQ(c),pQ(c))){var e=c.m.getTrackManager();e=e.ka()||e.cb();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)}pQ(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.$e);switch(a.detail.currentState){case _.ip:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.hp:b(Conviva.Constants.PlayerState.PAUSED);break;case _.$o:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.bp:this.g.debug("onVideoEnded()"),pQ(this)&&(this.w&&this.w.pb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):tQ(this))}};
27
- _.r.jg=function(a){this.g.debug(_.We);if(pQ(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({Kg:this.jg.bind(this),args:a})};
28
- _.r.Ti=function(){this.g.debug("onSeeking()");pQ(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.r.Si=function(){this.g.debug("onSeeked()");pQ(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.r.cl=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.r.Qi=function(a){this.g.debug(aQ);var b=a.ad;a=0===b.eb();var c=eQ(b.getPodIndex());pQ(this)||qQ(this)||!a||sQ(this);if(pQ(this)){a=0===b.Fb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.Eb()&&(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||_.Mk()?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.Ri=function(){this.g.debug(bQ);pQ(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&tQ(this))};
31
- _.r.kg=function(a){this.g.debug(_.Xe);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,pQ(this)||sQ(this));pQ(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,tQ(this))):this.j.push({Kg:this.kg.bind(this),
32
- args:a})}};_.r.el=function(){this.g.debug("onAutoPlayBlocked()");pQ(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,pQ(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.r=uQ.prototype;_.r.onPlayerCreated=function(a){this.f=new nQ(a,this.g)};_.r.onContentWillLoad=function(a,b){var c=this;wQ(this,a);if(this.a){var d=a.getConfiguration();d=_.O.Na(d.conviva||{});try{vQ(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new hQ(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))}}};_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&oQ(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.T=function(a,b){a.trigger(new _.L(_.pe,{detail:b}))};_.r.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.I("clpp.conviva.ConvivaPlugin",uQ);uQ.prototype.reportAppEvent=uQ.prototype.reportAppEvent;uQ.Id="conviva";
34
- xQ.prototype.create=function(){return new uQ};_.Dq(new xQ);};
2
+ var f=function(window){var hV="Ad Error",iV="onAdBreakStarted()",jV="onAdBreakStopped()",kV=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Zj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.gl()&&(g="Apple");_.fl()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.hl()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.gl()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Yj()||_.Xj()||_.bl("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Yj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Xj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.bl("Hisense")&&(c="",g="Hisense")):_.bl("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},lV=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},mV=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},oV=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]=lV(!!d);e[Conviva.Constants.ASSET_NAME]=hV;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"]=nV(a.getId()),e["c3.ad.creativeId"]=nV(a.getCreativeId()),e["c3.ad.system"]=nV(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=nV(a.getApiFramework()),e["c3.ad.advertiser"]=nV(a.getAdvertiserName()),e["c3.ad.position"]=mV(a.getPodIndex()),e["c3.ad.technology"]=0===a.Tb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=nV(a.Nb()),e["c3.ad.adManagerVersion"]=nV(a.Ob()),e["c3.ad.advertiserCategory"]=nV(null),e["c3.ad.advertiserId"]=nV(null),e["c3.ad.breakId"]=nV(null),e["c3.ad.campaignName"]=nV(null),e["c3.ad.category"]=nV(null),e["c3.ad.classification"]=nV(null),e["c3.ad.creativeName"]=nV(null),e["c3.ad.sequence"]=nV(a.fc()),e["c3.ad.sessionStartEvent"]=nV(null),e["c3.ad.unitName"]=nV(null),e["c3.ad.dayPart"]=nV(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"]=nV(b),e["c3.ad.firstAdSystem"]=nV(c),e["c3.ad.firstCreativeId"]=nV(a));return e},nV=function(a){return a?""+a:"NA"},pV=function(a,b){this.m=a;this.C=b;this.A="";this.w=_.wa;this.g=new _.K("clpp.conviva.ad");this.f=new _.Uh;this.a=null;this.j=this.l=this.o=this.h=!1},qV=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.C()),
8
+ b){var c=oV(b,a.A,a.w,a.m.isLive()),d=String(b.Ob()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.Nb();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)}}},tV=function(a,b,c){c=void 0===c?hV:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case rV:a.a.reportAdFailed(c,oV(null,a.A,a.w));break;case sV:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},uV=function(a){a.f.on(a.m,_.yc,a.Cj.bind(a));a.f.on(a.m,_.zc,a.Dj.bind(a));a.f.on(a.m,_.Lc,a.Jj.bind(a));a.f.on(a.m,_.Ic,a.We.bind(a));a.f.on(a.m,_.Hc,a.We.bind(a));a.f.on(a.m,_.Jc,a.We.bind(a));a.f.on(a.m,_.Ac,a.We.bind(a));a.f.on(a.m,_.Mc,a.Kj.bind(a));a.f.on(a.m,_.Kc,a.Ij.bind(a));a.f.on(a.m,_.Bc,a.Ej.bind(a));a.f.on(a.m,_.Ec,a.Gj.bind(a));a.f.on(a.m,_.Fc,a.Hj.bind(a));a.f.on(a.m,_.Dc,a.Fj.bind(a));a.f.on(a.m,_.Gc,a.am.bind(a));a.f.on(a.m,_.Nc,a.Lj.bind(a));a.f.on(a.m,_.se,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=hV}null===a.a&&qV(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");tV(a,rV,c)}})},vV=function(a,b){this.m=a;this.f=new _.Uh;this.a=null;this.o=!1;this.H=!0;this.C=this.h=this.A=this.D=this.l=!1;this.P=0;this.L=!1;this.w=null;this.J=!1;this.g=b;this.M=this.G=null;this.j=[];this.I=0},
11
+ wV=function(a){if(!a.l&&a.a){var b=lV(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},xV=function(a){return null!==a.a&&a.D},yV=function(a){return a.m.getConfiguration().autoplay||!1},zV=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(kV(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]=_.wa;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ja;a.a.setPlayerInfo(c)},AV=function(a){if(!a.l)if(a.D)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.M,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 _.sk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.tk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.wa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.O.S(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(xV(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.Dh(l.args)}));a.j=[]}},BV=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.C=!1,a.P=0,a.L=!1,a.j=[],a.I=0)},CV=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},DV=function(a){var b=[];typeof a===_.Ye&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.P(1,9,9001,{missingKeys:b});},EV=function(a,b){var c=b.getConfiguration();a.a=!_.O.S(c.conviva)&&typeof c.conviva===
16
+ _.Ye;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.V(b,c)):b.namespace()===_.Fd&&(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.")},FV=function(){};_.u=pV.prototype;_.u.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.wa;uV(this)};_.u.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.ma):(_.Xh(this.f),this.a&&tV(this,GV),this.f.release(),this.o=!0,this.h=this.j=!1)};_.u.destroy=function(){this.g.debug(_.Zd);this.l?this.g.debug(_.la):this.l=!0};_.u.Cj=function(){this.g.debug(iV)};_.u.Dj=function(){this.g.debug(jV)};
17
+ _.u.Jj=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"),qV(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.Rb(),a.Qb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Db())};
18
+ _.u.We=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 _.Ic:case _.Jc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Hc:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Ac:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.u.Kj=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&tV(this,GV)};_.u.Ij=function(){this.g.debug("onAdSkipped()");this.a&&tV(this,sV)};
19
+ _.u.Ej=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.u.Gj=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.Hj=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,qV(b,c);else this.f.on(this.m,_.sg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.sg),b.h=!0,qV(b,c))})};_.u.Fj=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.u.am=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.u.Lj=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var sV=0,GV=1,rV=2;_.u=vV.prototype;
22
+ _.u.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.O.Xa(b),this.M=c,this.m=a,zV(this,this.G),this.f.on(this.m,_.mf,this.ym.bind(this)),this.f.on(this.m,_.hg,this.Qj.bind(this)),this.f.on(this.m,_.kd,this.Wg.bind(this)),this.f.on(this.m,_.Bg,this.Pj.bind(this)),this.f.on(this.m,_.Ag,this.Oj.bind(this)),this.f.on(this.m,_.yc,this.Mj.bind(this)),this.f.on(this.m,_.zc,this.Nj.bind(this)),this.f.on(this.m,_.Pc,this.gm.bind(this)),this.f.on(this.m,_.jd,this.im.bind(this)),
23
+ this.f.on(this.m,_.se,this.Xg.bind(this)),yV(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),AV(this)))};_.u.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.ma):(_.Xh(this.f),xV(this)||this.o||!yV(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),xV(this)&&BV(this),this.a=null,this.H=!0)};_.u.destroy=function(){this.g.debug(_.Zd);this.l?this.g.debug(_.la):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.ym=function(){this.g.debug("onPlayRequest()");xV(this)||yV(this)?xV(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),xV(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"),AV(this))};
25
+ _.u.Qj=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),zV(c,c.G),AV(c),wV(c),xV(c))){var e=c.m.getTrackManager();e=e.qa()||e.pb();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)}xV(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.cf);switch(a.detail.currentState){case _.Bp:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.Ap:b(Conviva.Constants.PlayerState.PAUSED);break;case _.sp:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.up:this.g.debug("onVideoEnded()"),xV(this)&&(this.w&&this.w.Fb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.L=!0):BV(this))}};
27
+ _.u.Wg=function(a){this.g.debug(_.Ze);if(xV(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({Dh:this.Wg.bind(this),args:a})};
28
+ _.u.Pj=function(){this.g.debug("onSeeking()");xV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.u.Oj=function(){this.g.debug("onSeeked()");xV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.u.gm=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.u.Mj=function(a){this.g.debug(iV);var b=a.ad;a=0===b.qb();var c=mV(b.getPodIndex());xV(this)||yV(this)||!a||AV(this);if(xV(this)){a=0===b.Tb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.Sb()&&(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||_.fl()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,
30
+ b,e);this.C=!0}else this.g.debug("Bug: should already have a valid session")};_.u.Nj=function(){this.g.debug(jV);xV(this)&&this.C&&(this.a.reportAdBreakEnded(),this.C=!1,this.L&&BV(this))};
31
+ _.u.Xg=function(a){this.g.debug(_.$e);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,xV(this)||AV(this));xV(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,BV(this))):this.j.push({Dh:this.Xg.bind(this),
32
+ args:a})}};_.u.im=function(){this.g.debug("onAutoPlayBlocked()");xV(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,xV(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.u=CV.prototype;_.u.onPlayerCreated=function(a){this.f=new vV(a,this.g)};_.u.onContentWillLoad=function(a,b){var c=this;EV(this,a);if(this.a){var d=a.getConfiguration();d=_.O.Xa(d.conviva||{});try{DV(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new pV(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.P?this.V(a,f):this.V(a,new _.P(1,9,9002,f,f))}}};_.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&wV(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.V=function(a,b){a.trigger(new _.L(_.se,{detail:b}))};_.u.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.J("clpp.conviva.ConvivaPlugin",CV);CV.prototype.reportAppEvent=CV.prototype.reportAppEvent;CV.Id="conviva";
34
+ FV.prototype.create=function(){return new CV};_.Zq(new FV);};
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));}