@castlabs/prestoplay 6.14.0 → 6.15.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 (62) hide show
  1. package/CHANGELOG.md +25 -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 +113 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +550 -529
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +191 -64
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -68
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +290 -275
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.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 +70 -70
  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 +457 -438
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +187 -64
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  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 +255 -240
  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/clpp.styles.css +2 -0
  61. package/package.json +1 -1
  62. package/typings.d.ts +387 -90
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var DP="Ad Error",EP="onAdBreakStarted()",FP="onAdBreakStopped()",GP=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Fj(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Bk()&&(g="Apple");_.Ak()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Ck()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.Bk()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Ej()||_.Dj()||_.xk("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Ej()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Dj()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.xk("Hisense")&&(c="",g="Hisense")):_.xk("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},HP=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},IP=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},KP=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]=HP(!!d);e[Conviva.Constants.ASSET_NAME]=DP;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"]=JP(a.getId()),e["c3.ad.creativeId"]=JP(a.getCreativeId()),e["c3.ad.system"]=JP(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=JP(a.getApiFramework()),e["c3.ad.advertiser"]=JP(a.getAdvertiserName()),e["c3.ad.position"]=IP(a.getPodIndex()),e["c3.ad.technology"]=0===a.Eb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=JP(a.xb()),e["c3.ad.adManagerVersion"]=JP(a.yb()),e["c3.ad.advertiserCategory"]=JP(null),e["c3.ad.advertiserId"]=JP(null),e["c3.ad.breakId"]=JP(null),e["c3.ad.campaignName"]=JP(null),e["c3.ad.category"]=JP(null),e["c3.ad.classification"]=JP(null),e["c3.ad.creativeName"]=JP(null),e["c3.ad.sequence"]=JP(a.Tb()),e["c3.ad.sessionStartEvent"]=JP(null),e["c3.ad.unitName"]=JP(null),e["c3.ad.dayPart"]=JP(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"]=JP(b),e["c3.ad.firstAdSystem"]=JP(c),e["c3.ad.firstCreativeId"]=JP(a));return e},JP=function(a){return a?""+a:"NA"},LP=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.wa;this.g=new _.K("clpp.conviva.ad");this.f=new _.Eh;this.a=null;this.j=this.l=this.o=this.h=!1},MP=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=KP(b,a.A,a.w,a.m.isLive()),d=String(b.yb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.xb();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)}}},PP=function(a,b,c){c=void 0===c?DP:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case NP:a.a.reportAdFailed(c,KP(null,a.A,a.w));break;case OP:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},QP=function(a){a.f.on(a.m,_.uc,a.Ei.bind(a));a.f.on(a.m,_.vc,a.Fi.bind(a));a.f.on(a.m,_.Hc,a.Li.bind(a));a.f.on(a.m,_.Ec,a.ve.bind(a));a.f.on(a.m,_.Dc,a.ve.bind(a));a.f.on(a.m,_.Fc,a.ve.bind(a));a.f.on(a.m,_.wc,a.ve.bind(a));a.f.on(a.m,_.Ic,a.Mi.bind(a));a.f.on(a.m,_.Gc,a.Ki.bind(a));a.f.on(a.m,_.xc,a.Gi.bind(a));a.f.on(a.m,_.Ac,a.Ii.bind(a));a.f.on(a.m,_.Bc,a.Ji.bind(a));a.f.on(a.m,_.zc,a.Hi.bind(a));a.f.on(a.m,_.Cc,a.Wk.bind(a));a.f.on(a.m,_.Jc,a.Ni.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=DP}null===a.a&&MP(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");PP(a,NP,c)}})},RP=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.C=this.l=!1;this.P=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.M=this.G=null;this.j=[];this.I=0},
11
- SP=function(a){if(!a.l&&a.a){var b=HP(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},TP=function(a){return null!==a.a&&a.C},UP=function(a){return a.m.getConfiguration().autoplay||!1},VP=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(GP(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)},WP=function(a){if(!a.l)if(a.C)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 _.Xj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Yj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.wa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.N.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(TP(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.Kg(l.args)}));a.j=[]}},XP=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.P=0,a.K=!1,a.j=[],a.I=0)},YP=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},ZP=function(a){var b=[];typeof a===_.Te&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.P(1,9,9001,{missingKeys:b});},$P=function(a,b){var c=b.getConfiguration();a.a=!_.N.R(c.conviva)&&typeof c.conviva===
16
- _.Te;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.U(b,c)):b.namespace()===_.Cd&&(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.")},aQ=function(){};_.r=LP.prototype;_.r.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.wa;QP(this)};_.r.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.ma):(_.Hh(this.f),this.a&&PP(this,bQ),this.f.release(),this.o=!0,this.h=this.j=!1)};_.r.destroy=function(){this.g.debug(_.Wd);this.l?this.g.debug(_.la):this.l=!0};_.r.Ei=function(){this.g.debug(EP)};_.r.Fi=function(){this.g.debug(FP)};
17
- _.r.Li=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"),MP(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.Bb(),a.Ab());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.ob())};
18
- _.r.ve=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.Mi=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&PP(this,bQ)};_.r.Ki=function(){this.g.debug("onAdSkipped()");this.a&&PP(this,OP)};
19
- _.r.Gi=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.r.Ii=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.Ji=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,MP(b,c);else this.f.on(this.m,_.eg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.eg),b.h=!0,MP(b,c))})};_.r.Hi=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.r.Wk=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.r.Ni=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var OP=0,bQ=1,NP=2;_.r=RP.prototype;
22
- _.r.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.N.Oa(b),this.M=c,this.m=a,VP(this,this.G),this.f.on(this.m,_.gf,this.vl.bind(this)),this.f.on(this.m,_.Tf,this.Si.bind(this)),this.f.on(this.m,_.gd,this.jg.bind(this)),this.f.on(this.m,_.og,this.Ri.bind(this)),this.f.on(this.m,_.mg,this.Qi.bind(this)),this.f.on(this.m,_.uc,this.Oi.bind(this)),this.f.on(this.m,_.vc,this.Pi.bind(this)),this.f.on(this.m,_.Nc,this.bl.bind(this)),this.f.on(this.m,_.fd,this.dl.bind(this)),
23
- this.f.on(this.m,_.ne,this.kg.bind(this)),UP(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),WP(this)))};_.r.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.ma):(_.Hh(this.f),TP(this)||this.o||!UP(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),TP(this)&&XP(this),this.a=null,this.H=!0)};_.r.destroy=function(){this.g.debug(_.Wd);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.vl=function(){this.g.debug("onPlayRequest()");TP(this)||UP(this)?TP(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),TP(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"),WP(this))};
25
- _.r.Si=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),VP(c,c.G),WP(c),SP(c),TP(c))){var e=c.m.getTrackManager();e=e.ka()||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)}TP(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.Ye);switch(a.detail.currentState){case _.Vo:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.Uo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Mo:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Oo:this.g.debug("onVideoEnded()"),TP(this)&&(this.w&&this.w.pb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):XP(this))}};
27
- _.r.jg=function(a){this.g.debug(_.Ue);if(TP(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.Ri=function(){this.g.debug("onSeeking()");TP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.r.Qi=function(){this.g.debug("onSeeked()");TP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.r.bl=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.r.Oi=function(a){this.g.debug(EP);var b=a.ad;a=0===b.cb();var c=IP(b.getPodIndex());TP(this)||UP(this)||!a||WP(this);if(TP(this)){a=0===b.Eb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.Db()&&(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||_.Ak()?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.Pi=function(){this.g.debug(FP);TP(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&XP(this))};
31
- _.r.kg=function(a){this.g.debug(_.Ve);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,TP(this)||WP(this));TP(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,XP(this))):this.j.push({Kg:this.kg.bind(this),
32
- args:a})}};_.r.dl=function(){this.g.debug("onAutoPlayBlocked()");TP(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,TP(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.r=YP.prototype;_.r.onPlayerCreated=function(a){this.f=new RP(a,this.g)};_.r.onContentWillLoad=function(a,b){var c=this;$P(this,a);if(this.a){var d=a.getConfiguration();d=_.N.Oa(d.conviva||{});try{ZP(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new LP(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.P?this.U(a,f):this.U(a,new _.P(1,9,9002,f,f))}}};_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&SP(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.U=function(a,b){a.trigger(new _.L(_.ne,{detail:b}))};_.r.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.H("clpp.conviva.ConvivaPlugin",YP);YP.prototype.reportAppEvent=YP.prototype.reportAppEvent;YP.Id="conviva";
34
- aQ.prototype.create=function(){return new YP};_.nq(new aQ);};
2
+ var f=function(window){var oR="Ad Error",pR="onAdBreakStarted()",qR="onAdBreakStopped()",rR=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="";_.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)):_.Yj()||_.Vj()||_.Yk("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Yj()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Vj()?(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},sR=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},tR=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},vR=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]=sR(!!d);e[Conviva.Constants.ASSET_NAME]=oR;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"]=uR(a.getId()),e["c3.ad.creativeId"]=uR(a.getCreativeId()),e["c3.ad.system"]=uR(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=uR(a.getApiFramework()),e["c3.ad.advertiser"]=uR(a.getAdvertiserName()),e["c3.ad.position"]=tR(a.getPodIndex()),e["c3.ad.technology"]=0===a.Fb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=uR(a.yb()),e["c3.ad.adManagerVersion"]=uR(a.zb()),e["c3.ad.advertiserCategory"]=uR(null),e["c3.ad.advertiserId"]=uR(null),e["c3.ad.breakId"]=uR(null),e["c3.ad.campaignName"]=uR(null),e["c3.ad.category"]=uR(null),e["c3.ad.classification"]=uR(null),e["c3.ad.creativeName"]=uR(null),e["c3.ad.sequence"]=uR(a.Ub()),e["c3.ad.sessionStartEvent"]=uR(null),e["c3.ad.unitName"]=uR(null),e["c3.ad.dayPart"]=uR(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"]=uR(b),e["c3.ad.firstAdSystem"]=uR(c),e["c3.ad.firstCreativeId"]=uR(a));return e},uR=function(a){return a?""+a:"NA"},wR=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},xR=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=vR(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)}}},AR=function(a,b,c){c=void 0===c?oR:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case yR:a.a.reportAdFailed(c,vR(null,a.A,a.w));break;case zR:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},BR=function(a){a.f.on(a.m,_.xc,a.Yi.bind(a));a.f.on(a.m,_.yc,a.Zi.bind(a));a.f.on(a.m,_.Kc,a.ej.bind(a));a.f.on(a.m,_.Hc,a.Ce.bind(a));a.f.on(a.m,_.Gc,a.Ce.bind(a));a.f.on(a.m,_.Ic,a.Ce.bind(a));a.f.on(a.m,_.zc,a.Ce.bind(a));a.f.on(a.m,_.Lc,a.fj.bind(a));a.f.on(a.m,_.Jc,a.dj.bind(a));a.f.on(a.m,_.Ac,a.$i.bind(a));a.f.on(a.m,_.Dc,a.bj.bind(a));a.f.on(a.m,_.Ec,a.cj.bind(a));a.f.on(a.m,_.Cc,a.aj.bind(a));a.f.on(a.m,_.Fc,a.tl.bind(a));a.f.on(a.m,_.Mc,a.gj.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=oR}null===a.a&&xR(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");AR(a,yR,c)}})},CR=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.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
+ DR=function(a){if(!a.l&&a.a){var b=sR(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},ER=function(a){return null!==a.a&&a.D},FR=function(a){return a.m.getConfiguration().autoplay||!1},GR=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(rR(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)},HR=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(ER(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.Zg(l.args)}));a.j=[]}},IR=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)},JR=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},KR=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});},LR=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.U(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.")},MR=function(){};_.r=wR.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;BR(this)};_.r.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.la):(_.Vh(this.f),this.a&&AR(this,NR),this.f.release(),this.o=!0,this.h=this.j=!1)};_.r.destroy=function(){this.g.debug(_.Zd);this.l?this.g.debug(_.ka):this.l=!0};_.r.Yi=function(){this.g.debug(pR)};_.r.Zi=function(){this.g.debug(qR)};
17
+ _.r.ej=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"),xR(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.Ce=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)}}};_.r.fj=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&AR(this,NR)};_.r.dj=function(){this.g.debug("onAdSkipped()");this.a&&AR(this,zR)};
19
+ _.r.$i=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.r.bj=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.cj=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,xR(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,xR(b,c))})};_.r.aj=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.r.tl=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.r.gj=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var zR=0,NR=1,yR=2;_.r=CR.prototype;
22
+ _.r.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.O.Ma(b),this.L=c,this.m=a,GR(this,this.G),this.f.on(this.m,_.lf,this.Tl.bind(this)),this.f.on(this.m,_.eg,this.lj.bind(this)),this.f.on(this.m,_.jd,this.yg.bind(this)),this.f.on(this.m,_.Bg,this.kj.bind(this)),this.f.on(this.m,_.Ag,this.jj.bind(this)),this.f.on(this.m,_.xc,this.hj.bind(this)),this.f.on(this.m,_.yc,this.ij.bind(this)),this.f.on(this.m,_.Oc,this.zl.bind(this)),this.f.on(this.m,_.id,this.Bl.bind(this)),
23
+ this.f.on(this.m,_.re,this.zg.bind(this)),FR(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),HR(this)))};_.r.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.la):(_.Vh(this.f),ER(this)||this.o||!FR(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),ER(this)&&IR(this),this.a=null,this.H=!0)};_.r.destroy=function(){this.g.debug(_.Zd);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.Tl=function(){this.g.debug("onPlayRequest()");ER(this)||FR(this)?ER(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),ER(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"),HR(this))};
25
+ _.r.lj=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),GR(c,c.G),HR(c),DR(c),ER(c))){var e=c.m.getTrackManager();e=e.ma()||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)}ER(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.bf);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()"),ER(this)&&(this.w&&this.w.qb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):IR(this))}};
27
+ _.r.yg=function(a){this.g.debug(_.Ye);if(ER(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({Zg:this.yg.bind(this),args:a})};
28
+ _.r.kj=function(){this.g.debug("onSeeking()");ER(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.r.jj=function(){this.g.debug("onSeeked()");ER(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.r.zl=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.r.hj=function(a){this.g.debug(pR);var b=a.ad;a=0===b.eb();var c=tR(b.getPodIndex());ER(this)||FR(this)||!a||HR(this);if(ER(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.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")};_.r.ij=function(){this.g.debug(qR);ER(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&IR(this))};
31
+ _.r.zg=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,ER(this)||HR(this));ER(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,IR(this))):this.j.push({Zg:this.zg.bind(this),
32
+ args:a})}};_.r.Bl=function(){this.g.debug("onAutoPlayBlocked()");ER(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,ER(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.r=JR.prototype;_.r.onPlayerCreated=function(a){this.f=new CR(a,this.g)};_.r.onContentWillLoad=function(a,b){var c=this;LR(this,a);if(this.a){var d=a.getConfiguration();d=_.O.Ma(d.conviva||{});try{KR(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new wR(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.P?this.U(a,f):this.U(a,new _.P(1,9,9002,f,f))}}};_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&DR(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.U=function(a,b){a.trigger(new _.L(_.re,{detail:b}))};_.r.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.H("clpp.conviva.ConvivaPlugin",JR);JR.prototype.reportAppEvent=JR.prototype.reportAppEvent;JR.Id="conviva";
34
+ MR.prototype.create=function(){return new JR};_.Vq(new MR);};
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));}