@castlabs/prestoplay 6.23.1 → 6.24.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 (65) hide show
  1. package/CHANGELOG.md +14 -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 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +608 -591
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +87 -86
  10. package/cjs/cl.externs.js +94 -30
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +73 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +344 -339
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +492 -478
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +81 -80
  41. package/cl.externs.js +94 -30
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +75 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +307 -305
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +44 -10
package/cjs/cl.conviva.js CHANGED
@@ -1,36 +1,36 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var RV="Ad Error",SV="onAdBreakStarted()",TV="onAdBreakStopped()",UV=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.yk(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Gl()&&(g="Apple");_.Fl()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Hl()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
- _.Gl()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.xk()||_.wk()||_.Cl("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.xk()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.wk()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Cl("Hisense")&&(c="",g="Hisense")):_.Cl("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},VV=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},WV=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},YV=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]=VV(!!d);e[Conviva.Constants.ASSET_NAME]=RV;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"]=XV(a.getId()),e["c3.ad.creativeId"]=XV(a.getCreativeId()),e["c3.ad.system"]=XV(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=XV(a.getApiFramework()),e["c3.ad.advertiser"]=XV(a.getAdvertiserName()),e["c3.ad.position"]=WV(a.getPodIndex()),e["c3.ad.technology"]=0===a.wb()?
6
- Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=XV(a.sb()),e["c3.ad.adManagerVersion"]=XV(a.tb()),e["c3.ad.advertiserCategory"]=XV(null),e["c3.ad.advertiserId"]=XV(null),e["c3.ad.breakId"]=XV(null),e["c3.ad.campaignName"]=XV(null),e["c3.ad.category"]=XV(null),e["c3.ad.classification"]=XV(null),e["c3.ad.creativeName"]=XV(null),e["c3.ad.sequence"]=XV(a.Kb()),e["c3.ad.sessionStartEvent"]=XV(null),e["c3.ad.unitName"]=XV(null),e["c3.ad.dayPart"]=XV(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"]=XV(b),e["c3.ad.firstAdSystem"]=XV(c),e["c3.ad.firstCreativeId"]=XV(a));return e},XV=function(a){return a?""+a:"NA"},ZV=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.va;this.g=new _.K("clpp.conviva.ad");this.f=new _.Yh;this.a=null;this.j=this.l=this.o=this.h=!1},$V=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
- b){var c=YV(b,a.A,a.w,a.m.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.g.error("Could not create ad analytics session",f)}}},cW=function(a,b,c){c=void 0===c?RV:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case aW:a.a.reportAdFailed(c,YV(null,a.A,a.w));break;case bW:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
- a.a=null;a.h=!1}},dW=function(a){a.f.on(a.m,_.qc,a.jk.bind(a));a.f.on(a.m,_.sc,a.kk.bind(a));a.f.on(a.m,_.Ic,a.rk.bind(a));a.f.on(a.m,_.Fc,a.lf.bind(a));a.f.on(a.m,_.Ec,a.lf.bind(a));a.f.on(a.m,_.Gc,a.lf.bind(a));a.f.on(a.m,_.uc,a.lf.bind(a));a.f.on(a.m,_.Jc,a.sk.bind(a));a.f.on(a.m,_.Hc,a.qk.bind(a));a.f.on(a.m,_.vc,a.lk.bind(a));a.f.on(a.m,_.Bc,a.nk.bind(a));a.f.on(a.m,_.Cc,a.pk.bind(a));a.f.on(a.m,_.xc,a.mk.bind(a));a.f.on(a.m,_.Dc,a.Jm.bind(a));a.f.on(a.m,_.Kc,a.tk.bind(a));a.f.on(a.m,_.se,function(b){var c=
10
- b.detail;if(10003===c.code&&(a.g.debug("onAdError()"),!a.j)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=RV}null===a.a&&$V(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");cW(a,aW,c)}})},eW=function(a,b){this.m=a;this.f=new _.Yh;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.C=this.l=!1;this.M=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
- fW=function(a){if(!a.l&&a.a){var b=VV(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},gW=function(a){return null!==a.a&&a.C},hW=function(a){return a.m.getConfiguration().autoplay||!1},iW=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(UV(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)},jW=function(a){if(!a.l)if(a.C)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 _.Rk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Sk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.va;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(gW(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.bi(l.args)}));a.j=[]}},kW=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.M=0,a.K=!1,a.j=[],a.I=0)},lW=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},mW=function(a){var b=[];typeof a===_.Ze&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.P(1,9,9001,{missingKeys:b});},oW=function(a,b){var c=b.getConfiguration();a.a=!_.N.R(c.conviva)&&typeof c.conviva===
16
- _.Ze;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),nW(b,c)):b.namespace()===_.zd&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},nW=function(a,b){a.trigger(new _.L(_.se,{detail:b}))},pW=function(){};_.t=ZV.prototype;_.t.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.va;dW(this)};_.t.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.la):(_.ai(this.f),this.a&&cW(this,qW),this.f.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.g.debug(_.Xd);this.l?this.g.debug(_.ka):this.l=!0};_.t.jk=function(){this.g.debug(SV)};_.t.kk=function(){this.g.debug(TV)};
17
- _.t.rk=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"),$V(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.jb(),a.ib());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Ta())};
18
- _.t.lf=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 _.Fc:case _.Gc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Ec:c(Conviva.Constants.PlayerState.PAUSED);break;case _.uc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.sk=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&cW(this,qW)};_.t.qk=function(){this.g.debug("onAdSkipped()");this.a&&cW(this,bW)};
19
- _.t.lk=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.nk=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
- _.t.pk=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,$V(b,c);else this.f.on(this.m,_.tg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.tg),b.h=!0,$V(b,c))})};_.t.mk=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Jm=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
- _.t.tk=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var bW=0,qW=1,aW=2;_.t=eW.prototype;
22
- _.t.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.N.gb(b),this.L=c,this.m=a,iW(this,this.G),this.f.on(this.m,_.of,this.kn.bind(this)),this.f.on(this.m,_.ig,this.yk.bind(this)),this.f.on(this.m,_.gd,this.uh.bind(this)),this.f.on(this.m,_.Dg,this.xk.bind(this)),this.f.on(this.m,_.Cg,this.wk.bind(this)),this.f.on(this.m,_.qc,this.uk.bind(this)),this.f.on(this.m,_.sc,this.vk.bind(this)),this.f.on(this.m,_.Mc,this.Om.bind(this)),this.f.on(this.m,_.fd,this.Pm.bind(this)),
23
- this.f.on(this.m,_.se,this.vh.bind(this)),hW(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),jW(this)))};_.t.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.la):(_.ai(this.f),gW(this)||this.o||!hW(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),gW(this)&&kW(this),this.a=null,this.H=!0)};_.t.destroy=function(){this.g.debug(_.Xd);this.l?this.g.debug(_.ka):this.l=!0};
24
- _.t.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};_.t.kn=function(){this.g.debug("onPlayRequest()");gW(this)||hW(this)?gW(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),gW(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"),jW(this))};
25
- _.t.yk=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),iW(c,c.G),jW(c),fW(c),gW(c))){var e=c.m.getTrackManager();e=e.ma()||e.vb();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)}gW(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.ef);switch(a.detail.currentState){case _.Iq:b(Conviva.Constants.PlayerState.PLAYING);
26
- break;case _.Hq:b(Conviva.Constants.PlayerState.PAUSED);break;case _.zq:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Bq:this.g.debug("onVideoEnded()"),gW(this)&&(this.w&&this.w.Lb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):kW(this))}};
27
- _.t.uh=function(a){this.g.debug(_.$e);if(gW(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({bi:this.uh.bind(this),args:a})};
28
- _.t.xk=function(){this.g.debug("onSeeking()");gW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.wk=function(){this.g.debug("onSeeked()");gW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.Om=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
- _.t.uk=function(a){this.g.debug(SV);var b=a.ad;a=0===b.Ua();var c=WV(b.getPodIndex());gW(this)||hW(this)||!a||jW(this);if(gW(this)){a=0===b.wb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.kb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.M;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Fl()?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")};_.t.vk=function(){this.g.debug(TV);gW(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&kW(this))};
31
- _.t.vh=function(a){this.g.debug(_.bf);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,gW(this)||jW(this));gW(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,kW(this))):this.j.push({bi:this.vh.bind(this),
32
- args:a})}};_.t.Pm=function(){this.g.debug("onAutoPlayBlocked()");gW(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,gW(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=lW.prototype;_.t.onPlayerCreated=function(a){this.f=new eW(a,this.g)};_.t.onContentWillLoad=function(a,b){var c=this;oW(this,a);if(this.a){var d=a.getConfiguration();d=_.N.gb(d.conviva||{});try{mW(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new ZV(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.P?nW(a,f):nW(a,new _.P(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&fW(this.f)};
33
- _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.t.id=function(){return"conviva"};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.J("clpp.conviva.ConvivaPlugin",lW);lW.prototype.reportAppEvent=lW.prototype.reportAppEvent;lW.Id="conviva";pW.prototype.create=function(){return new lW};_.Ht(new pW);};
2
+ var f=function(window){var GW="Ad Error",HW="onAdBreakStarted()",IW="onAdBreakStopped()",JW=function(a){function b(l,m){l in h||!m||(h[l]=m)}var c=_.Ok(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.Sl()&&(g="Apple");_.Rl()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.Tl()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
3
+ _.Sl()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.Nk()||_.Mk()||_.Ol("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.Nk()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.Mk()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Ol("Hisense")&&(c="",g="Hisense")):_.Ol("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},KW=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},LW=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},NW=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]=KW(!!d);e[Conviva.Constants.ASSET_NAME]=GW;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"]=MW(a.getId()),e["c3.ad.creativeId"]=MW(a.getCreativeId()),e["c3.ad.system"]=MW(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=MW(a.getApiFramework()),e["c3.ad.advertiser"]=MW(a.getAdvertiserName()),e["c3.ad.position"]=LW(a.getPodIndex()),e["c3.ad.technology"]=0===a.Db()?
6
+ Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=MW(a.yb()),e["c3.ad.adManagerVersion"]=MW(a.zb()),e["c3.ad.advertiserCategory"]=MW(null),e["c3.ad.advertiserId"]=MW(null),e["c3.ad.breakId"]=MW(null),e["c3.ad.campaignName"]=MW(null),e["c3.ad.category"]=MW(null),e["c3.ad.classification"]=MW(null),e["c3.ad.creativeName"]=MW(null),e["c3.ad.sequence"]=MW(a.Cb()),e["c3.ad.sessionStartEvent"]=MW(null),e["c3.ad.unitName"]=MW(null),e["c3.ad.dayPart"]=MW(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"]=MW(b),e["c3.ad.firstAdSystem"]=MW(c),e["c3.ad.firstCreativeId"]=MW(a));return e},MW=function(a){return a?""+a:"NA"},OW=function(a,b){this.m=a;this.B=b;this.A="";this.w=_.wa;this.g=new _.K("clpp.conviva.ad");this.f=new _.vi;this.a=null;this.j=this.l=this.o=this.h=!1},PW=function(a,b){if(!a.l){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),
8
+ b){var c=NW(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)}}},SW=function(a,b,c){c=void 0===c?GW:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case QW:a.a.reportAdFailed(c,NW(null,a.A,a.w));break;case RW:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();
9
+ a.a=null;a.h=!1}},TW=function(a){a.f.on(a.m,_.wc,a.wk.bind(a));a.f.on(a.m,_.xc,a.xk.bind(a));a.f.on(a.m,_.Mc,a.Dk.bind(a));a.f.on(a.m,_.Jc,a.rf.bind(a));a.f.on(a.m,_.Ic,a.rf.bind(a));a.f.on(a.m,_.Kc,a.rf.bind(a));a.f.on(a.m,_.yc,a.rf.bind(a));a.f.on(a.m,_.Nc,a.Ek.bind(a));a.f.on(a.m,_.Lc,a.Ck.bind(a));a.f.on(a.m,_.zc,a.yk.bind(a));a.f.on(a.m,_.Fc,a.Ak.bind(a));a.f.on(a.m,_.Gc,a.Bk.bind(a));a.f.on(a.m,_.Bc,a.zk.bind(a));a.f.on(a.m,_.Hc,a.Zm.bind(a));a.f.on(a.m,_.Oc,a.Fk.bind(a));a.f.on(a.m,_.ze,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=GW}null===a.a&&PW(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.g.debug("Ad Playback Failure");SW(a,QW,c)}})},UW=function(a,b){this.m=a;this.f=new _.vi;this.a=null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.C=this.l=!1;this.M=0;this.K=!1;this.w=null;this.J=!1;this.g=b;this.L=this.G=null;this.j=[];this.I=0},
11
+ VW=function(a){if(!a.l&&a.a){var b=KW(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},WW=function(a){return null!==a.a&&a.C},XW=function(a){return a.m.getConfiguration().autoplay||!1},YW=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(JW(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]=_.ia;a.a.setPlayerInfo(c)},ZW=function(a){if(!a.l)if(a.C)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 _.hl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.il(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(WW(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.hi(l.args)}));a.j=[]}},$W=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.M=0,a.K=!1,a.j=[],a.I=0)},aX=function(){this.h=this.f=null;this.a=!1;this.g=new _.K("clpp.conviva")},bX=function(a){var b=[];typeof a===_.ff&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.O(1,9,9001,{missingKeys:b});},dX=function(a,b){var c=b.getConfiguration();a.a=!_.N.R(c.conviva)&&typeof c.conviva===
16
+ _.ff;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.O(1,9,9E3),cX(b,c)):b.namespace()===_.Fd&&(a.a=!1,a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},cX=function(a,b){a.trigger(new _.L(_.ze,{detail:b}))},eX=function(){};_.t=OW.prototype;_.t.initialize=function(a){this.g.debug("Initialize Ad Insights");this.j=this.o=!1;this.A=a.viewerId;this.w=a.playerName||_.wa;TW(this)};_.t.release=function(){this.g.debug("Release Ad Insights");this.o?this.g.debug(_.na):(_.yi(this.f),this.a&&SW(this,fX),this.f.release(),this.o=!0,this.h=this.j=!1)};_.t.destroy=function(){this.g.debug(_.de);this.l?this.g.debug(_.ma):this.l=!0};_.t.wk=function(){this.g.debug(HW)};_.t.xk=function(){this.g.debug(IW)};
17
+ _.t.Dk=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"),PW(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.qb(),a.pb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Xa())};
18
+ _.t.rf=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 _.Jc:case _.Kc:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Ic:c(Conviva.Constants.PlayerState.PAUSED);break;case _.yc:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.t.Ek=function(){this.g.debug("onAdStopped()");this.a&&!this.j&&SW(this,fX)};_.t.Ck=function(){this.g.debug("onAdSkipped()");this.a&&SW(this,RW)};
19
+ _.t.yk=function(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.t.Ak=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
+ _.t.Bk=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,PW(b,c);else this.f.on(this.m,_.Gg,function(){b.m.getPosition()>=b.m.getDuration()-5&&(b.f.off(b.m,_.Gg),b.h=!0,PW(b,c))})};_.t.zk=function(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.t.Zm=function(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
21
+ _.t.Fk=function(){this.g.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var RW=0,fX=1,QW=2;_.t=UW.prototype;
22
+ _.t.initialize=function(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.H=!1,this.G=_.N.nb(b),this.L=c,this.m=a,YW(this,this.G),this.f.on(this.m,_.vf,this.Bn.bind(this)),this.f.on(this.m,_.qg,this.Kk.bind(this)),this.f.on(this.m,_.ld,this.Ah.bind(this)),this.f.on(this.m,_.Sg,this.Jk.bind(this)),this.f.on(this.m,_.Rg,this.Ik.bind(this)),this.f.on(this.m,_.wc,this.Gk.bind(this)),this.f.on(this.m,_.xc,this.Hk.bind(this)),this.f.on(this.m,_.Qc,this.dn.bind(this)),this.f.on(this.m,_.kd,this.en.bind(this)),
23
+ this.f.on(this.m,_.ze,this.Bh.bind(this)),XW(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),ZW(this)))};_.t.release=function(){this.g.debug("Release conviva");this.H?this.g.debug(_.na):(_.yi(this.f),WW(this)||this.o||!XW(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),WW(this)&&$W(this),this.a=null,this.H=!0)};_.t.destroy=function(){this.g.debug(_.de);this.l?this.g.debug(_.ma):this.l=!0};
24
+ _.t.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};_.t.Bn=function(){this.g.debug("onPlayRequest()");WW(this)||XW(this)?WW(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),WW(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"),ZW(this))};
25
+ _.t.Kk=function(a){function b(d){if(c.o&&(c.g.debug("Creating conviva session (On Seek / Replay)"),YW(c,c.G),ZW(c),VW(c),WW(c))){var e=c.m.getTrackManager();e=e.na()||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)}WW(c)&&c.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.g.debug(_.mf);switch(a.detail.currentState){case _.Uq:b(Conviva.Constants.PlayerState.PLAYING);
26
+ break;case _.Tq:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Lq:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Nq:this.g.debug("onVideoEnded()"),WW(this)&&(this.w&&this.w.Rb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.K=!0):$W(this))}};
27
+ _.t.Ah=function(a){this.g.debug(_.gf);if(WW(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({hi:this.Ah.bind(this),args:a})};
28
+ _.t.Jk=function(){this.g.debug("onSeeking()");WW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.t.Ik=function(){this.g.debug("onSeeked()");WW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.t.dn=function(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
29
+ _.t.Gk=function(a){this.g.debug(HW);var b=a.ad;a=0===b.Ya();var c=LW(b.getPodIndex());WW(this)||XW(this)||!a||ZW(this);if(WW(this)){a=0===b.Db()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.rb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.M;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Rl()?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")};_.t.Hk=function(){this.g.debug(IW);WW(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.K&&$W(this))};
31
+ _.t.Bh=function(a){this.g.debug(_.jf);if(this.o&&this.J)this.g.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.P&&(d=Conviva.Constants.ErrorSeverity.FATAL,WW(this)||ZW(this));WW(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,$W(this))):this.j.push({hi:this.Bh.bind(this),
32
+ args:a})}};_.t.en=function(){this.g.debug("onAutoPlayBlocked()");WW(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,WW(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.t=aX.prototype;_.t.onPlayerCreated=function(a){this.f=new UW(a,this.g)};_.t.onContentWillLoad=function(a,b){var c=this;dX(this,a);if(this.a){var d=a.getConfiguration();d=_.N.nb(d.conviva||{});try{bX(d);var e=d.enableAdInsights||!1;this.f.initialize(a,d,b);e&&(this.h=new OW(a,function(){return c.f.a}),this.h.initialize(d))}catch(f){f instanceof _.O?cX(a,f):cX(a,new _.O(1,9,9002,f,f))}}};_.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&VW(this.f)};
33
+ _.t.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.h&&(this.h.destroy(),this.h=null))};_.t.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.h&&this.h.release())};_.t.id=function(){return"conviva"};_.t.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.J("clpp.conviva.ConvivaPlugin",aX);aX.prototype.reportAppEvent=aX.prototype.reportAppEvent;aX.Id="conviva";eX.prototype.create=function(){return new aX};_.bu(new eX);};
34
34
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
35
35
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
36
36
  else{_=this.clpp._;(f.call(g,this));}