@castlabs/prestoplay 6.3.0 → 6.4.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 +48 -1
  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 +108 -107
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +410 -398
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +72 -69
  10. package/cjs/cl.externs.js +55 -52
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +49 -44
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +32 -32
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +259 -254
  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 -23
  23. package/cjs/cl.tizen.js +69 -69
  24. package/cjs/cl.ttml.js +27 -26
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -19
  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 -87
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +353 -345
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -63
  38. package/cl.externs.js +55 -52
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -37
  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 +232 -221
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +10 -10
  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 -21
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -14
  58. package/package.json +2 -2
package/cjs/cl.conviva.js CHANGED
@@ -1,37 +1,37 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var nJ="Ad Error",oJ="onAdBreakStarted()",pJ="onAdBreakStopped()",qJ=function(a){function b(l,m){l in k||!m||(k[l]=m)}var c=_.ji(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.wi()&&(g="Apple");_.vi()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.xi()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.wi()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.ii()||_.hi()||_.si("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.ii()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.hi()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.si("Hisense")&&(c="",g="Hisense")):_.si("Xbox One")&&(g="Microsoft",d=Conviva.Constants.DeviceType.CONSOLE,e=Conviva.Constants.DeviceCategory.XBOX);var k=a.deviceMetadata||{};b(Conviva.Constants.DeviceMetadata.TYPE,
4
- a.deviceType||d);b(Conviva.Constants.DeviceMetadata.OS_NAME,f);b(Conviva.Constants.DeviceMetadata.OS_VERSION,c);b(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||e);b(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||g);return k},rJ=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},sJ=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},uJ=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]=rJ(!!d);e[Conviva.Constants.ASSET_NAME]=nJ;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"]=tJ(a.ba()),e["c3.ad.creativeId"]=tJ(a.getCreativeId()),e["c3.ad.system"]=tJ(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=tJ(a.getApiFramework()),e["c3.ad.advertiser"]=tJ(a.getAdvertiserName()),e["c3.ad.position"]=sJ(a.getPodIndex()),e["c3.ad.technology"]=0===a.ub()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=tJ(a.ob()),e["c3.ad.adManagerVersion"]=tJ(a.pb()),e["c3.ad.advertiserCategory"]=tJ(null),e["c3.ad.advertiserId"]=tJ(null),e["c3.ad.breakId"]=tJ(null),e["c3.ad.campaignName"]=tJ(null),e["c3.ad.category"]=tJ(null),e["c3.ad.classification"]=tJ(null),e["c3.ad.creativeName"]=tJ(null),e["c3.ad.sequence"]=tJ(a.Jb()),e["c3.ad.sessionStartEvent"]=tJ(null),e["c3.ad.unitName"]=tJ(null),e["c3.ad.dayPart"]=tJ(null),
7
- b=a.getWrapperAdIds().slice(-1)[0]||a.ba(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=tJ(b),e["c3.ad.firstAdSystem"]=tJ(c),e["c3.ad.firstCreativeId"]=tJ(a));return e},tJ=function(a){return a?""+a:"NA"},vJ=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.oa;this.f=new _.G("clpp.conviva.ad");this.g=new _.Wf;this.a=null;this.j=this.m=this.o=this.h=!1},wJ=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=uJ(b,a.A,a.w,a.l.isLive()),d=String(b.pb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.ob();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)}}},zJ=function(a,b,c){c=void 0===c?nJ:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case xJ:a.a.reportAdFailed(c,uJ(null,a.A,a.w));break;case yJ:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},AJ=function(a){a.g.on(a.l,_.wb,a.Jg.bind(a));a.g.on(a.l,_.xb,a.Kg.bind(a));a.g.on(a.l,_.Jb,a.Qg.bind(a));a.g.on(a.l,_.Gb,a.Dd.bind(a));a.g.on(a.l,_.Fb,a.Dd.bind(a));a.g.on(a.l,_.Hb,a.Dd.bind(a));a.g.on(a.l,_.yb,a.Dd.bind(a));a.g.on(a.l,_.Kb,a.Rg.bind(a));a.g.on(a.l,_.Ib,a.Pg.bind(a));a.g.on(a.l,_.zb,a.Lg.bind(a));a.g.on(a.l,_.Cb,a.Ng.bind(a));a.g.on(a.l,_.Db,a.Og.bind(a));a.g.on(a.l,_.Bb,a.Mg.bind(a));a.g.on(a.l,_.Eb,a.oi.bind(a));a.g.on(a.l,_.Lb,a.Sg.bind(a));a.g.on(a.l,_.Zc,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=nJ}null===a.a&&wJ(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.f.debug("Ad Playback Failure");zJ(a,xJ,c)}})},BJ=function(a,b){this.l=a;this.g=new _.Wf;this.f=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.m=!1;this.N=0;this.K=!1;this.w=null;this.J=!1;this.a=b;this.L=this.D=null;this.j=[];this.I=0},
11
- CJ=function(a){if(!a.m&&a.f){var b=rJ(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},DJ=function(a){return null!==a.f&&a.C},EJ=function(a){return a.l.getConfiguration().autoplay||!1},FJ=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(qJ(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]=_.oa;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.f.setPlayerInfo(c)},GJ=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 _.Wj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Xj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.oa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.J.R(c.customTags))for(var k in c.customTags)f[k]=c.customTags[k];a.f.reportPlaybackRequested(f);a.f.setCallback(function(){a.a.debug("reportMiscellaneousMetrics()");if(DJ(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.Af(l.Xe)}));a.j=[]}},HJ=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.N=0,a.K=!1,a.j=[],a.I=0)},IJ=function(){this.g=this.f=null;this.a=!1;this.h=new _.G("clpp.conviva")},JJ=function(a){var b=[];typeof a===_.Bd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.K(1,9,9001,{missingKeys:b});},KJ=function(a,b){var c=b.getConfiguration();a.a=!_.J.R(c.conviva)&&typeof c.conviva===
16
- _.Bd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.K(1,9,9E3),a.S(b,c)):b.namespace()===_.yc&&(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.")},LJ=function(){};_.t=vJ.prototype;_.t.initialize=function(a){this.f.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.oa;AJ(this)};_.t.release=function(){this.f.debug("Release Ad Insights");this.o?this.f.debug(_.ja):(_.ag(this.g),this.a&&zJ(this,MJ),this.g.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.f.debug(_.Mc);this.m?this.f.debug(_.ia):this.m=!0};_.t.Jg=function(){this.f.debug(oJ)};_.t.Kg=function(){this.f.debug(pJ)};
17
- _.t.Qg=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"),wJ(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.bb())};
18
- _.t.Dd=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 _.Gb:case _.Hb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Fb:c(Conviva.Constants.PlayerState.PAUSED);break;case _.yb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.Rg=function(){this.f.debug("onAdStopped()");this.a&&!this.j&&zJ(this,MJ)};_.t.Pg=function(){this.f.debug("onAdSkipped()");this.a&&zJ(this,yJ)};
19
- _.t.Lg=function(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Ng=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.Og=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,wJ(b,c);else this.g.on(this.l,_.we,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.g.off(b.l,_.we),b.h=!0,wJ(b,c))})};_.t.Mg=function(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.oi=function(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.t.Sg=function(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var yJ=0,MJ=1,xJ=2;_.t=BJ.prototype;
22
- _.t.initialize=function(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.D=_.J.Ha(b),this.L=c,this.l=a,FJ(this,this.D),this.g.on(this.l,_.Pd,this.Ri.bind(this)),this.g.on(this.l,_.ie,this.Xg.bind(this)),this.g.on(this.l,_.ic,this.ff.bind(this)),this.g.on(this.l,_.Ee,this.Wg.bind(this)),this.g.on(this.l,_.De,this.Vg.bind(this)),this.g.on(this.l,_.wb,this.Tg.bind(this)),this.g.on(this.l,_.xb,this.Ug.bind(this)),this.g.on(this.l,_.Nb,this.xi.bind(this)),this.g.on(this.l,_.gc,this.zi.bind(this)),
23
- this.g.on(this.l,_.Zc,this.gf.bind(this)),EJ(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),GJ(this)))};_.t.release=function(){this.a.debug("Release conviva");this.G?this.a.debug(_.ja):(_.ag(this.g),DJ(this)||this.o||!EJ(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),DJ(this)&&HJ(this),this.f=null,this.G=!0)};_.t.destroy=function(){this.a.debug(_.Mc);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.Ri=function(){this.a.debug("onPlayRequest()");DJ(this)||EJ(this)?DJ(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),DJ(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"),GJ(this))};
25
- _.t.Xg=function(a){function b(d){if(c.o&&(c.a.debug("Creating conviva session (On Seek / Replay)"),FJ(c,c.D),GJ(c),CJ(c),DJ(c))){var e=c.l.getTrackManager();e=e.fa()||e.Qa();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)}DJ(c)&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.a.debug(_.Gd);switch(a.detail.currentState){case _.km:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.jm:b(Conviva.Constants.PlayerState.PAUSED);break;case _.bm:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.dm:this.a.debug("onVideoEnded()"),DJ(this)&&(this.w&&this.w.cb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.K=!0):HJ(this))}};
27
- _.t.ff=function(a){this.a.debug(_.Cd);if(DJ(this)){if(a=a.detail,typeof a.width===_.h&&typeof a.height===_.h&&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({Af:this.ff.bind(this),Xe:a})};
28
- _.t.Wg=function(){this.a.debug("onSeeking()");DJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.Vg=function(){this.a.debug("onSeeked()");DJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.xi=function(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.t.Tg=function(a){this.a.debug(oJ);var b=a.ad;a=0===b.Ra();var c=sJ(b.getPodIndex());DJ(this)||EJ(this)||!a||GJ(this);if(DJ(this)){a=0===b.ub()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.tb()&&(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||_.vi()?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.Ug=function(){this.a.debug(pJ);DJ(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.K&&HJ(this))};
31
- _.t.gf=function(a){this.a.debug(_.Dd);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,DJ(this)||GJ(this));DJ(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,HJ(this))):this.j.push({Af:this.gf.bind(this),
32
- Xe:a})}};_.t.zi=function(){this.a.debug("onAutoPlayBlocked()");DJ(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,DJ(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=IJ.prototype;_.t.onPlayerCreated=function(a){this.f=new BJ(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;KJ(this,a);if(this.a){var d=a.getConfiguration();d=_.J.Ha(d.conviva||{});try{JJ(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new vJ(a,function(){return c.f.f}),this.g.initialize(d))}catch(f){f instanceof _.K?this.S(a,f):this.S(a,new _.K(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&CJ(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.S=function(a,b){a.trigger(new _.I(_.Zc,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.B("clpp.conviva.ConvivaPlugin",IJ);IJ.prototype.reportAppEvent=IJ.prototype.reportAppEvent;IJ.Id="conviva";
34
- LJ.prototype.create=function(){return new IJ};_.Fn(new LJ);};
2
+ var f=function(window){var gK="Ad Error",hK="onAdBreakStarted()",iK="onAdBreakStopped()",jK=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.vi(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Ii()&&(g="Apple");_.Hi()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Ji()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.Ii()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.ui()||_.ti()||_.Ei("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.ui()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.ti()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Ei("Hisense")&&(c="",g="Hisense")):_.Ei("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},kK=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},lK=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},nK=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]=kK(!!d);e[Conviva.Constants.ASSET_NAME]=gK;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"]=mK(a.getId()),e["c3.ad.creativeId"]=mK(a.getCreativeId()),e["c3.ad.system"]=mK(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=mK(a.getApiFramework()),e["c3.ad.advertiser"]=mK(a.getAdvertiserName()),e["c3.ad.position"]=lK(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=mK(a.sb()),e["c3.ad.adManagerVersion"]=mK(a.tb()),e["c3.ad.advertiserCategory"]=mK(null),e["c3.ad.advertiserId"]=mK(null),e["c3.ad.breakId"]=mK(null),e["c3.ad.campaignName"]=mK(null),e["c3.ad.category"]=mK(null),e["c3.ad.classification"]=mK(null),e["c3.ad.creativeName"]=mK(null),e["c3.ad.sequence"]=mK(a.Kb()),e["c3.ad.sessionStartEvent"]=mK(null),e["c3.ad.unitName"]=mK(null),e["c3.ad.dayPart"]=mK(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"]=mK(b),e["c3.ad.firstAdSystem"]=mK(c),e["c3.ad.firstCreativeId"]=mK(a));return e},mK=function(a){return a?""+a:"NA"},oK=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.sa;this.f=new _.H("clpp.conviva.ad");this.g=new _.bg;this.a=null;this.j=this.m=this.o=this.h=!1},pK=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=nK(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)}}},sK=function(a,b,c){c=void 0===c?gK:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case qK:a.a.reportAdFailed(c,nK(null,a.A,a.w));break;case rK:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},tK=function(a){a.g.on(a.l,_.Bb,a.Sg.bind(a));a.g.on(a.l,_.Cb,a.Tg.bind(a));a.g.on(a.l,_.Pb,a.Zg.bind(a));a.g.on(a.l,_.Mb,a.Kd.bind(a));a.g.on(a.l,_.Lb,a.Kd.bind(a));a.g.on(a.l,_.Nb,a.Kd.bind(a));a.g.on(a.l,_.Eb,a.Kd.bind(a));a.g.on(a.l,_.Qb,a.$g.bind(a));a.g.on(a.l,_.Ob,a.Yg.bind(a));a.g.on(a.l,_.Fb,a.Ug.bind(a));a.g.on(a.l,_.Ib,a.Wg.bind(a));a.g.on(a.l,_.Jb,a.Xg.bind(a));a.g.on(a.l,_.Hb,a.Vg.bind(a));a.g.on(a.l,_.Kb,a.Hi.bind(a));a.g.on(a.l,_.Rb,a.ah.bind(a));a.g.on(a.l,_.dd,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=gK}null===a.a&&pK(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.f.debug("Ad Playback Failure");sK(a,qK,c)}})},uK=function(a,b){this.l=a;this.g=new _.bg;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
+ vK=function(a){if(!a.m&&a.f){var b=kK(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},wK=function(a){return null!==a.f&&a.C},xK=function(a){return a.l.getConfiguration().autoplay||!1},yK=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(jK(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]=_.sa;c[Conviva.Constants.FRAMEWORK_VERSION]=_.ia;a.f.setPlayerInfo(c)},zK=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 _.gk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.hk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.sa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.K.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(wK(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.Gf(l.df)}));a.j=[]}},AK=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)},BK=function(){this.g=this.f=null;this.a=!1;this.h=new _.H("clpp.conviva")},CK=function(a){var b=[];typeof a===_.Gd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.L(1,9,9001,{missingKeys:b});},DK=function(a,b){var c=b.getConfiguration();a.a=!_.K.R(c.conviva)&&typeof c.conviva===
16
+ _.Gd;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.S(b,c)):b.namespace()===_.Dc&&(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.")},EK=function(){};_.t=oK.prototype;_.t.initialize=function(a){this.f.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.sa;tK(this)};_.t.release=function(){this.f.debug("Release Ad Insights");this.o?this.f.debug(_.la):(_.eg(this.g),this.a&&sK(this,FK),this.g.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.f.debug(_.Rc);this.m?this.f.debug(_.ka):this.m=!0};_.t.Sg=function(){this.f.debug(hK)};_.t.Tg=function(){this.f.debug(iK)};
17
+ _.t.Zg=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"),pK(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.Kd=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 _.Mb:case _.Nb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Lb:c(Conviva.Constants.PlayerState.PAUSED);break;case _.Eb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.$g=function(){this.f.debug("onAdStopped()");this.a&&!this.j&&sK(this,FK)};_.t.Yg=function(){this.f.debug("onAdSkipped()");this.a&&sK(this,rK)};
19
+ _.t.Ug=function(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Wg=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.Xg=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,pK(b,c);else this.g.on(this.l,_.Ce,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.g.off(b.l,_.Ce),b.h=!0,pK(b,c))})};_.t.Vg=function(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Hi=function(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.t.ah=function(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var rK=0,FK=1,qK=2;_.t=uK.prototype;
22
+ _.t.initialize=function(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.D=_.K.Ma(b),this.L=c,this.l=a,yK(this,this.D),this.g.on(this.l,_.Ud,this.gj.bind(this)),this.g.on(this.l,_.oe,this.gh.bind(this)),this.g.on(this.l,_.oc,this.nf.bind(this)),this.g.on(this.l,_.Ke,this.fh.bind(this)),this.g.on(this.l,_.Je,this.eh.bind(this)),this.g.on(this.l,_.Bb,this.bh.bind(this)),this.g.on(this.l,_.Cb,this.dh.bind(this)),this.g.on(this.l,_.Tb,this.Ni.bind(this)),this.g.on(this.l,_.nc,this.Pi.bind(this)),
23
+ this.g.on(this.l,_.dd,this.pf.bind(this)),xK(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),zK(this)))};_.t.release=function(){this.a.debug("Release conviva");this.G?this.a.debug(_.la):(_.eg(this.g),wK(this)||this.o||!xK(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),wK(this)&&AK(this),this.f=null,this.G=!0)};_.t.destroy=function(){this.a.debug(_.Rc);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.gj=function(){this.a.debug("onPlayRequest()");wK(this)||xK(this)?wK(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),wK(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"),zK(this))};
25
+ _.t.gh=function(a){function b(d){if(c.o&&(c.a.debug("Creating conviva session (On Seek / Replay)"),yK(c,c.D),zK(c),vK(c),wK(c))){var e=c.l.getTrackManager();e=e.fa()||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)}wK(c)&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.a.debug(_.Ld);switch(a.detail.currentState){case _.xm:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.wm:b(Conviva.Constants.PlayerState.PAUSED);break;case _.om:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.qm:this.a.debug("onVideoEnded()"),wK(this)&&(this.w&&this.w.hb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.K=!0):AK(this))}};
27
+ _.t.nf=function(a){this.a.debug(_.Hd);if(wK(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({Gf:this.nf.bind(this),df:a})};
28
+ _.t.fh=function(){this.a.debug("onSeeking()");wK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.eh=function(){this.a.debug("onSeeked()");wK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Ni=function(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.t.bh=function(a){this.a.debug(hK);var b=a.ad;a=0===b.Ua();var c=lK(b.getPodIndex());wK(this)||xK(this)||!a||zK(this);if(wK(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||_.Hi()?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.dh=function(){this.a.debug(iK);wK(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.K&&AK(this))};
31
+ _.t.pf=function(a){this.a.debug(_.Id);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,wK(this)||zK(this));wK(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,AK(this))):this.j.push({Gf:this.pf.bind(this),
32
+ df:a})}};_.t.Pi=function(){this.a.debug("onAutoPlayBlocked()");wK(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,wK(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=BK.prototype;_.t.onPlayerCreated=function(a){this.f=new uK(a,this.h)};_.t.onContentWillLoad=function(a,b){var c=this;DK(this,a);if(this.a){var d=a.getConfiguration();d=_.K.Ma(d.conviva||{});try{CK(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.g=new oK(a,function(){return c.f.f}),this.g.initialize(d))}catch(f){f instanceof _.L?this.S(a,f):this.S(a,new _.L(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&vK(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.S=function(a,b){a.trigger(new _.J(_.dd,{detail:b}))};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.C("clpp.conviva.ConvivaPlugin",BK);BK.prototype.reportAppEvent=BK.prototype.reportAppEvent;BK.Id="conviva";
34
+ EK.prototype.create=function(){return new BK};_.Un(new EK);};
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));}