@castlabs/prestoplay 6.4.1 → 6.5.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 (58) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +419 -416
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +26 -26
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +47 -47
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +258 -255
  17. package/cjs/cl.muxdata.js +12 -12
  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.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +354 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +26 -26
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -39
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +230 -231
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -16
  58. package/package.json +6 -2
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var xK="Ad Error",yK="onAdBreakStarted()",zK="onAdBreakStopped()",AK=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Vh(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Ti()&&(g="Apple");_.Si()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Ui()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.Ti()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Uh()||_.Th()||_.Pi("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Uh()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Th()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Pi("Hisense")&&(c="",g="Hisense")):_.Pi("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},BK=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},CK=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},EK=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]=BK(!!d);e[Conviva.Constants.ASSET_NAME]=xK;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"]=DK(a.getId()),e["c3.ad.creativeId"]=DK(a.getCreativeId()),e["c3.ad.system"]=DK(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=DK(a.getApiFramework()),e["c3.ad.advertiser"]=DK(a.getAdvertiserName()),e["c3.ad.position"]=CK(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=DK(a.sb()),e["c3.ad.adManagerVersion"]=DK(a.tb()),e["c3.ad.advertiserCategory"]=DK(null),e["c3.ad.advertiserId"]=DK(null),e["c3.ad.breakId"]=DK(null),e["c3.ad.campaignName"]=DK(null),e["c3.ad.category"]=DK(null),e["c3.ad.classification"]=DK(null),e["c3.ad.creativeName"]=DK(null),e["c3.ad.sequence"]=DK(a.Kb()),e["c3.ad.sessionStartEvent"]=DK(null),e["c3.ad.unitName"]=DK(null),e["c3.ad.dayPart"]=DK(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"]=DK(b),e["c3.ad.firstAdSystem"]=DK(c),e["c3.ad.firstCreativeId"]=DK(a));return e},DK=function(a){return a?""+a:"NA"},FK=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.ta;this.f=new _.H("clpp.conviva.ad");this.g=new _.cg;this.a=null;this.j=this.m=this.o=this.h=!1},GK=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=EK(b,a.A,a.w,a.l.isLive()),d=String(b.tb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.sb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.f.error("Could not create ad analytics session",f)}}},JK=function(a,b,c){c=void 0===c?xK:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case HK:a.a.reportAdFailed(c,EK(null,a.A,a.w));break;case IK:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},KK=function(a){a.g.on(a.l,_.Fb,a.Ug.bind(a));a.g.on(a.l,_.Gb,a.Vg.bind(a));a.g.on(a.l,_.Sb,a.ah.bind(a));a.g.on(a.l,_.Pb,a.Ld.bind(a));a.g.on(a.l,_.Ob,a.Ld.bind(a));a.g.on(a.l,_.Qb,a.Ld.bind(a));a.g.on(a.l,_.Hb,a.Ld.bind(a));a.g.on(a.l,_.Tb,a.bh.bind(a));a.g.on(a.l,_.Rb,a.$g.bind(a));a.g.on(a.l,_.Ib,a.Wg.bind(a));a.g.on(a.l,_.Lb,a.Yg.bind(a));a.g.on(a.l,_.Mb,a.Zg.bind(a));a.g.on(a.l,_.Kb,a.Xg.bind(a));a.g.on(a.l,_.Nb,a.Ji.bind(a));a.g.on(a.l,_.Ub,a.dh.bind(a));a.g.on(a.l,_.fd,function(b){var c=
10
- b.detail;if(10003===c.code&&(a.f.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=xK}null===a.a&&GK(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.f.debug("Ad Playback Failure");JK(a,HK,c)}})},LK=function(a,b){this.l=a;this.g=new _.cg;this.f=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.m=!1;this.O=0;this.K=!1;this.w=null;this.J=!1;this.a=b;this.L=this.D=null;this.j=[];this.I=0},
11
- MK=function(a){if(!a.m&&a.f){var b=BK(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},NK=function(a){return null!==a.f&&a.C},OK=function(a){return a.l.getConfiguration().autoplay||!1},PK=function(a,b){var c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.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(AK(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;c={};c[Conviva.Constants.FRAMEWORK_NAME]=_.ta;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.f.setPlayerInfo(c)},QK=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.L,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||
13
- "N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=new _.mi(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.ni(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ta;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.J.R(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(function(){a.a.debug("reportMiscellaneousMetrics()");if(NK(a)){var l=
14
- 1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.l.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.a.debug("Current FPS",m),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.C=!0;a.h=!0;a.J=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(function(l){l.If(l.ff)}));a.j=[]}},RK=function(a){a.a.debug("terminateSession()");a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,
15
- Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.K=!1,a.j=[],a.I=0)},SK=function(){this.g=this.f=null;this.a=!1;this.h=new _.H("clpp.conviva")},TK=function(a){var b=[];typeof a===_.Id&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.L(1,9,9001,{missingKeys:b});},UK=function(a,b){var c=b.getConfiguration();a.a=!_.J.R(c.conviva)&&typeof c.conviva===
16
- _.Id;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.L(1,9,9E3),a.T(b,c)):b.namespace()===_.Fc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},VK=function(){};_.t=FK.prototype;_.t.initialize=function(a){this.f.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.ta;KK(this)};_.t.release=function(){this.f.debug("Release Ad Insights");this.o?this.f.debug(_.la):(_.fg(this.g),this.a&&JK(this,WK),this.g.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.f.debug(_.Tc);this.m?this.f.debug(_.ka):this.m=!0};_.t.Ug=function(){this.f.debug(yK)};_.t.Vg=function(){this.f.debug(zK)};
17
- _.t.ah=function(a){this.f.debug("onAdStarted()");a=a.ad;this.h||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),GK(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.vb(),a.ub());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.gb())};
18
- _.t.Ld=function(a){var b=this;this.f.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Pb:case _.Qb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Ob:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Hb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.bh=function(){this.f.debug("onAdStopped()");this.a&&!this.j&&JK(this,WK)};_.t.$g=function(){this.f.debug("onAdSkipped()");this.a&&JK(this,IK)};
19
- _.t.Wg=function(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Yg=function(){this.f.debug("onAdImpression()");if(this.a){var a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}};
20
- _.t.Zg=function(a){var b=this;this.f.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)b.h=!0,GK(b,c);else this.g.on(this.l,_.De,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.g.off(b.l,_.De),b.h=!0,GK(b,c))})};_.t.Xg=function(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Ji=function(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.t.dh=function(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var IK=0,WK=1,HK=2;_.t=LK.prototype;
22
- _.t.initialize=function(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.D=_.J.Ma(b),this.L=c,this.l=a,PK(this,this.D),this.g.on(this.l,_.Wd,this.ij.bind(this)),this.g.on(this.l,_.pe,this.ih.bind(this)),this.g.on(this.l,_.qc,this.qf.bind(this)),this.g.on(this.l,_.Le,this.hh.bind(this)),this.g.on(this.l,_.Ke,this.gh.bind(this)),this.g.on(this.l,_.Fb,this.eh.bind(this)),this.g.on(this.l,_.Gb,this.fh.bind(this)),this.g.on(this.l,_.Wb,this.Pi.bind(this)),this.g.on(this.l,_.pc,this.Ri.bind(this)),
23
- this.g.on(this.l,_.fd,this.rf.bind(this)),OK(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),QK(this)))};_.t.release=function(){this.a.debug("Release conviva");this.G?this.a.debug(_.la):(_.fg(this.g),NK(this)||this.o||!OK(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),NK(this)&&RK(this),this.f=null,this.G=!0)};_.t.destroy=function(){this.a.debug(_.Tc);this.m?this.a.debug(_.ka):this.m=!0};
24
- _.t.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c};_.t.ij=function(){this.a.debug("onPlayRequest()");NK(this)||OK(this)?NK(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),NK(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),QK(this))};
25
- _.t.ih=function(a){function b(d){if(c.o&&(c.a.debug("Creating conviva session (On Seek / Replay)"),PK(c,c.D),QK(c),MK(c),NK(c))){var e=c.l.getTrackManager();e=e.ea()||e.Ta();e.width&&e.height&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,e.width,e.height);e.bandwidth&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e.bandwidth/1E3)}NK(c)&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.a.debug(_.Nd);switch(a.detail.currentState){case _.bn:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.an:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Tm:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Vm:this.a.debug("onVideoEnded()"),NK(this)&&(this.w&&this.w.hb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.K=!0):RK(this))}};
27
- _.t.qf=function(a){this.a.debug(_.Jd);if(NK(this)){if(a=a.detail,typeof a.width===_.k&&typeof a.height===_.k&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.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.f.setContentInfo(b)}}else this.j.push({If:this.qf.bind(this),ff:a})};
28
- _.t.hh=function(){this.a.debug("onSeeking()");NK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.gh=function(){this.a.debug("onSeeked()");NK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Pi=function(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.t.eh=function(a){this.a.debug(yK);var b=a.ad;a=0===b.Ua();var c=CK(b.getPodIndex());NK(this)||OK(this)||!a||QK(this);if(NK(this)){a=0===b.yb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.xb()&&(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||_.Si()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,
30
- b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")};_.t.fh=function(){this.a.debug(zK);NK(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.K&&RK(this))};
31
- _.t.rf=function(a){this.a.debug(_.Kd);if(this.o&&this.J)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.M&&(d=Conviva.Constants.ErrorSeverity.FATAL,NK(this)||QK(this));NK(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),this.J=!0,RK(this))):this.j.push({If:this.rf.bind(this),
32
- ff:a})}};_.t.Ri=function(){this.a.debug("onAutoPlayBlocked()");NK(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,NK(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=SK.prototype;_.t.onPlayerCreated=function(a){this.f=new LK(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;UK(this,a);if(this.a){var d=a.getConfiguration();d=_.J.Ma(d.conviva||{});try{TK(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new FK(a,function(){return c.f.f}),this.g.initialize(d))}catch(f){f instanceof _.L?this.T(a,f):this.T(a,new _.L(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&MK(this.f)};
33
- _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.g&&(this.g.destroy(),this.g=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.g&&this.g.release())};_.t.id=function(){return"conviva"};_.t.T=function(a,b){a.trigger(new _.I(_.fd,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.B("clpp.conviva.ConvivaPlugin",SK);SK.prototype.reportAppEvent=SK.prototype.reportAppEvent;SK.Id="conviva";
34
- VK.prototype.create=function(){return new SK};_.uo(new VK);};
2
+ var f=function(window){var CK="Ad Error",DK="onAdBreakStarted()",EK="onAdBreakStopped()",FK=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Wh(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Ui()&&(g="Apple");_.Ti()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Vi()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.Ui()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Vh()||_.Uh()||_.Qi("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Vh()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Uh()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Qi("Hisense")&&(c="",g="Hisense")):_.Qi("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},GK=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},HK=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},JK=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]=GK(!!d);e[Conviva.Constants.ASSET_NAME]=CK;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"]=IK(a.getId()),e["c3.ad.creativeId"]=IK(a.getCreativeId()),e["c3.ad.system"]=IK(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=IK(a.getApiFramework()),e["c3.ad.advertiser"]=IK(a.getAdvertiserName()),e["c3.ad.position"]=HK(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=IK(a.sb()),e["c3.ad.adManagerVersion"]=IK(a.tb()),e["c3.ad.advertiserCategory"]=IK(null),e["c3.ad.advertiserId"]=IK(null),e["c3.ad.breakId"]=IK(null),e["c3.ad.campaignName"]=IK(null),e["c3.ad.category"]=IK(null),e["c3.ad.classification"]=IK(null),e["c3.ad.creativeName"]=IK(null),e["c3.ad.sequence"]=IK(a.Mb()),e["c3.ad.sessionStartEvent"]=IK(null),e["c3.ad.unitName"]=IK(null),e["c3.ad.dayPart"]=IK(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"]=IK(b),e["c3.ad.firstAdSystem"]=IK(c),e["c3.ad.firstCreativeId"]=IK(a));return e},IK=function(a){return a?""+a:"NA"},KK=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.ta;this.f=new _.H("clpp.conviva.ad");this.g=new _.dg;this.a=null;this.j=this.m=this.o=this.h=!1},LK=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=JK(b,a.A,a.w,a.l.isLive()),d=String(b.tb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.sb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.f.error("Could not create ad analytics session",f)}}},OK=function(a,b,c){c=void 0===c?CK:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case MK:a.a.reportAdFailed(c,JK(null,a.A,a.w));break;case NK:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},PK=function(a){a.g.on(a.l,_.Fb,a.Xg.bind(a));a.g.on(a.l,_.Gb,a.Yg.bind(a));a.g.on(a.l,_.Sb,a.eh.bind(a));a.g.on(a.l,_.Pb,a.Nd.bind(a));a.g.on(a.l,_.Ob,a.Nd.bind(a));a.g.on(a.l,_.Qb,a.Nd.bind(a));a.g.on(a.l,_.Hb,a.Nd.bind(a));a.g.on(a.l,_.Tb,a.fh.bind(a));a.g.on(a.l,_.Rb,a.dh.bind(a));a.g.on(a.l,_.Ib,a.Zg.bind(a));a.g.on(a.l,_.Lb,a.ah.bind(a));a.g.on(a.l,_.Mb,a.bh.bind(a));a.g.on(a.l,_.Kb,a.$g.bind(a));a.g.on(a.l,_.Nb,a.Ki.bind(a));a.g.on(a.l,_.Ub,a.gh.bind(a));a.g.on(a.l,_.gd,function(b){var c=
10
+ b.detail;if(10003===c.code&&(a.f.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=CK}null===a.a&&LK(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.f.debug("Ad Playback Failure");OK(a,MK,c)}})},QK=function(a,b){this.l=a;this.g=new _.dg;this.f=null;this.o=!1;this.I=!0;this.B=this.h=this.A=this.D=this.m=!1;this.R=0;this.L=!1;this.w=null;this.K=!1;this.a=b;this.N=this.F=null;this.j=[];this.J=0},
11
+ RK=function(a){if(!a.m&&a.f){var b=GK(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},SK=function(a){return null!==a.f&&a.D},TK=function(a){return a.l.getConfiguration().autoplay||!1},UK=function(a,b){var c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.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(FK(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;c={};c[Conviva.Constants.FRAMEWORK_NAME]=_.ta;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.f.setPlayerInfo(c)},VK=function(a){if(!a.m)if(a.D)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.N,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||
13
+ "N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=new _.ni(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.oi(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ta;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.K.S(c.customTags))for(var h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(function(){a.a.debug("reportMiscellaneousMetrics()");if(SK(a)){var l=
14
+ 1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.l.getStats()){l=l.decodedFrames;var m=l-a.J;a.J=l;isFinite(m)&&(a.a.debug("Current FPS",m),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.D=!0;a.h=!0;a.K=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(function(l){l.Kf(l.hf)}));a.j=[]}},WK=function(a){a.a.debug("terminateSession()");a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,
15
+ Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.D=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.L=!1,a.j=[],a.J=0)},XK=function(){this.g=this.f=null;this.a=!1;this.h=new _.H("clpp.conviva")},YK=function(a){var b=[];typeof a===_.Jd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.L(1,9,9001,{missingKeys:b});},ZK=function(a,b){var c=b.getConfiguration();a.a=!_.K.S(c.conviva)&&typeof c.conviva===
16
+ _.Jd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.L(1,9,9E3),a.U(b,c)):b.namespace()===_.Gc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},$K=function(){};_.t=KK.prototype;_.t.initialize=function(a){this.f.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.ta;PK(this)};_.t.release=function(){this.f.debug("Release Ad Insights");this.o?this.f.debug(_.ja):(_.gg(this.g),this.a&&OK(this,aL),this.g.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.f.debug(_.Uc);this.m?this.f.debug(_.ia):this.m=!0};_.t.Xg=function(){this.f.debug(DK)};_.t.Yg=function(){this.f.debug(EK)};
17
+ _.t.eh=function(a){this.f.debug("onAdStarted()");a=a.ad;this.h||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),LK(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.vb(),a.ub());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.hb())};
18
+ _.t.Nd=function(a){var b=this;this.f.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Pb:case _.Qb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Ob:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Hb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.fh=function(){this.f.debug("onAdStopped()");this.a&&!this.j&&OK(this,aL)};_.t.dh=function(){this.f.debug("onAdSkipped()");this.a&&OK(this,NK)};
19
+ _.t.Zg=function(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.ah=function(){this.f.debug("onAdImpression()");if(this.a){var a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}};
20
+ _.t.bh=function(a){var b=this;this.f.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)b.h=!0,LK(b,c);else this.g.on(this.l,_.Ee,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.g.off(b.l,_.Ee),b.h=!0,LK(b,c))})};_.t.$g=function(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Ki=function(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.t.gh=function(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var NK=0,aL=1,MK=2;_.t=QK.prototype;
22
+ _.t.initialize=function(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.I=!1,this.F=_.K.Na(b),this.N=c,this.l=a,UK(this,this.F),this.g.on(this.l,_.Xd,this.jj.bind(this)),this.g.on(this.l,_.re,this.lh.bind(this)),this.g.on(this.l,_.qc,this.sf.bind(this)),this.g.on(this.l,_.Me,this.kh.bind(this)),this.g.on(this.l,_.Le,this.jh.bind(this)),this.g.on(this.l,_.Fb,this.hh.bind(this)),this.g.on(this.l,_.Gb,this.ih.bind(this)),this.g.on(this.l,_.Wb,this.Qi.bind(this)),this.g.on(this.l,_.pc,this.Si.bind(this)),
23
+ this.g.on(this.l,_.gd,this.tf.bind(this)),TK(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),VK(this)))};_.t.release=function(){this.a.debug("Release conviva");this.I?this.a.debug(_.ja):(_.gg(this.g),SK(this)||this.o||!TK(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),SK(this)&&WK(this),this.f=null,this.I=!0)};_.t.destroy=function(){this.a.debug(_.Uc);this.m?this.a.debug(_.ia):this.m=!0};
24
+ _.t.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c};_.t.jj=function(){this.a.debug("onPlayRequest()");SK(this)||TK(this)?SK(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),SK(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),VK(this))};
25
+ _.t.lh=function(a){function b(d){if(c.o&&(c.a.debug("Creating conviva session (On Seek / Replay)"),UK(c,c.F),VK(c),RK(c),SK(c))){var e=c.l.getTrackManager();e=e.ga()||e.Ua();e.width&&e.height&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,e.width,e.height);e.bandwidth&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e.bandwidth/1E3)}SK(c)&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.a.debug(_.Od);switch(a.detail.currentState){case _.cn:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.bn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Um:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Wm:this.a.debug("onVideoEnded()"),SK(this)&&(this.w&&this.w.ib()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.L=!0):WK(this))}};
27
+ _.t.sf=function(a){this.a.debug(_.Kd);if(SK(this)){if(a=a.detail,typeof a.width===_.k&&typeof a.height===_.k&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.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.f.setContentInfo(b)}}else this.j.push({Kf:this.sf.bind(this),hf:a})};
28
+ _.t.kh=function(){this.a.debug("onSeeking()");SK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.jh=function(){this.a.debug("onSeeked()");SK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Qi=function(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.t.hh=function(a){this.a.debug(DK);var b=a.ad;a=0===b.Va();var c=HK(b.getPodIndex());SK(this)||TK(this)||!a||VK(this);if(SK(this)){a=0===b.yb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.xb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Ti()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,
30
+ b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")};_.t.ih=function(){this.a.debug(EK);SK(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.L&&WK(this))};
31
+ _.t.tf=function(a){this.a.debug(_.Ld);if(this.o&&this.K)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.M&&(d=Conviva.Constants.ErrorSeverity.FATAL,SK(this)||VK(this));SK(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),this.K=!0,WK(this))):this.j.push({Kf:this.tf.bind(this),
32
+ hf:a})}};_.t.Si=function(){this.a.debug("onAutoPlayBlocked()");SK(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,SK(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=XK.prototype;_.t.onPlayerCreated=function(a){this.f=new QK(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;ZK(this,a);if(this.a){var d=a.getConfiguration();d=_.K.Na(d.conviva||{});try{YK(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new KK(a,function(){return c.f.f}),this.g.initialize(d))}catch(f){f instanceof _.L?this.U(a,f):this.U(a,new _.L(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&RK(this.f)};
33
+ _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.g&&(this.g.destroy(),this.g=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.g&&this.g.release())};_.t.id=function(){return"conviva"};_.t.U=function(a,b){a.trigger(new _.J(_.gd,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.C("clpp.conviva.ConvivaPlugin",XK);XK.prototype.reportAppEvent=XK.prototype.reportAppEvent;XK.Id="conviva";
34
+ $K.prototype.create=function(){return new XK};_.wo(new $K);};
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));}