@castlabs/prestoplay 6.26.0 → 6.28.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 (68) hide show
  1. package/CHANGELOG.md +42 -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 +115 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +623 -623
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +112 -72
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +353 -345
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -72
  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 +38 -38
  33. package/cjs/polyfill.min.js +15 -3
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -5
  37. package/cl.cast.js +93 -90
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +506 -507
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +83 -82
  42. package/cl.externs.js +112 -72
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +80 -79
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +17 -17
  48. package/cl.mediatailor.js +2 -3
  49. package/cl.mse.js +308 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +57 -57
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +15 -15
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -29
  65. package/package.json +1 -1
  66. package/typings.d.ts +115 -63
  67. package/cjs/cl.sessions.js +0 -21
  68. package/cl.sessions.js +0 -10
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var xy="VerimatrixVCAS",yy="clpp.verimatrix.Vcas",zy="clpp.verimatrix.VcasComponent",Fy=function(a){_.dn.call(this,xy);var b={};b[Ay]=Ay;b[By]=By;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Cy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Dy:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.F=d;this.B=b;this.w=Ey(this,e);this.o=Ey(this,f);this.l=Ey(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.J(yy);_.Q.empty(this.w)?this.g.warn(_.Zb):this.fb(_.Gd,{licenseUrl:this.w,videoRobustness:[_.Fb,void 0],audioRobustness:[_.Eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Q.empty(this.o)?this.g.warn(_.tb):this.fb(_.Ed,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.Q.empty(this.l)?this.g.warn(_.Ra):_.Q.empty(this.j)?this.g.warn(_.Qa):this.fb(_.Cd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Ey=function(a,b){if(a.F===Cy){var c=Object.assign({},{deviceId:_.Pm(_.Q.Hd(a.A))},a.a&&{authenticator:_.Pm(_.Q.Hd(a.a))});return b+_.Zj(c)}return b},Gy=function(){this.g=new _.J(zy)};_.w(Fy,_.dn);
5
- Fy.prototype.h=function(a,b){if(this.F===Hy){var c=this.B[By],d={};d[this.B[Ay]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Fy.prototype.I=function(a,b){var c=_.Bn(b);switch(this.G){case Iy:c=_.Zj({r:c,Bp:this.H},!0)}return c};Fy.prototype.K=function(a,b){this.h(a,b);_.En(b)};Fy.prototype.L=function(a,b){_.Fn(b)};_.I(yy,Fy);Fy.prototype.constructor=Fy.prototype.constructor;Fy.NAME=xy;var Cy="query-string",Hy="http-header";
6
- Fy.LicenseRequestVuidLocation={QUERY_STRING:Cy,HTTP_HEADER:Hy};var Ay="DeviceId",By="Authenticator";Fy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Ay,AUTHENTICATOR_HEADER:By};var Dy="keyid",Iy="contentid-siteid";Fy.FairPlayAssetIdStrategy={KEYID:Dy,CONTENTID_SITEID:Iy};_.w(Gy,_.Fu);Gy.prototype.a=function(){delete _.Ym.VerimatrixVCAS};Gy.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===xy){a=a.drm.customData;if(!a)throw new _.N(_.O,7,7100,_.Hd);a=new Fy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Zm(a)}};Gy.prototype.id=function(){return"verimatrix-vcas"};_.I(zy,Gy);};
2
+ var f=function(window){var jy="VerimatrixVCAS",ky="clpp.verimatrix.Vcas",ly="clpp.verimatrix.VcasComponent",ry=function(a){_.Rp.call(this,jy);var b={};b[my]=my;b[ny]=ny;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?oy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?py:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.F=d;this.B=b;this.w=qy(this,e);this.o=qy(this,f);this.l=qy(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.L(ky);_.R.empty(this.w)?this.g.warn(_.Xb):this.bb(_.Fd,{licenseUrl:this.w,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.rb):this.bb(_.Dd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.R.empty(this.l)?this.g.warn(_.Pa):_.R.empty(this.j)?this.g.warn(_.Oa):this.bb(_.Bd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},qy=function(a,b){if(a.F===oy){var c=Object.assign({},{deviceId:_.Bm(_.R.yd(a.A))},a.a&&{authenticator:_.Bm(_.R.yd(a.a))});return b+_.on(c)}return b},sy=function(){this.g=new _.L(ly)};_.w(ry,_.Rp);
5
+ ry.prototype.h=function(a,b){if(this.F===ty){var c=this.B[ny],d={};d[this.B[my]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};ry.prototype.I=function(a,b){var c=_.oq(b);switch(this.G){case uy:c=_.on({r:c,Bp:this.H},!0)}return c};ry.prototype.K=function(a,b){this.h(a,b);_.rq(b)};ry.prototype.L=function(a,b){_.sq(b)};_.K(ky,ry);ry.prototype.constructor=ry.prototype.constructor;ry.NAME=jy;var oy="query-string",ty="http-header";
6
+ ry.LicenseRequestVuidLocation={QUERY_STRING:oy,HTTP_HEADER:ty};var my="DeviceId",ny="Authenticator";ry.LicenseRequestHttpHeader={DEVICE_ID_HEADER:my,AUTHENTICATOR_HEADER:ny};var py="keyid",uy="contentid-siteid";ry.FairPlayAssetIdStrategy={KEYID:py,CONTENTID_SITEID:uy};_.w(sy,_.Tu);sy.prototype.uninstall=function(){delete _.Mn.VerimatrixVCAS};sy.prototype.beforeLoad=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===jy){a=a.drm.customData;if(!a)throw new _.N(_.O,7,7100,_.Gd);a=new ry(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Nn(a)}};sy.prototype.id=function(){return"verimatrix-vcas"};_.K(ly,sy);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vimond.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ny="Registering listeners",oy="clpp.vimond.VimondPlugin",py=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.F=e;this.a=new _.hi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Yh(this.Uh.bind(this));this.g=new _.J("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ny),this.a.on(this.m,_.cg,this.ol.bind(this)),this.a.on(this.m,_.sg,this.pl.bind(this)),this.a.on(this.m,_.hc,this.ml.bind(this)),this.a.on(this.m,_.ic,this.nl.bind(this)))},qy=function(a,
3
- b){a.m.trigger(new _.K(_.Pg,{detail:b}))},ry=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.O:1,9,9201,c))},sy=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.J("clpp.vimond.VimondService");this.f=0},ty=function(a){this.m=a;this.a=new _.hi;this.g=new _.J("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(ny),this.a.on(this.m,_.Lf,this.o.bind(this)),this.a.on(this.m,_.hc,this.j.bind(this)),this.a.on(this.m,_.ic,this.l.bind(this)))},
4
- uy=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.sf];if(a.h)return[_.ge,_.cf];if(c===_.Dq)return[_.ge,null];if(c===_.Hq)return[_.ie,_.cf];var d=_.cf;if(c===_.Bq||c===_.Kq||a.f)d=_.sf;return["period",d]},vy=function(){this.a=!1;this.g=new _.J(oy);this.j=this.h=this.f=null},wy=function(){};_.r=py.prototype;_.r.pl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.ml=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.nl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.ol=function(a){var b=this,c,d,e,f,g;return _.H(function(h){if(1==h.a){c=a.detail;d=_.Fq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.D(0);
7
- b.B=e;return _.x(h,b.Uh(),3)}e===d.ENDED&&b.h.stop();_.z(h)})};
8
- _.r.Uh=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ha(a.l?10:a.G);a.l=!1;_.D(h,2);return _.x(h,a.F.fireEvent(),4)}if(2!=h.a)return b=h.f,qy(a,b),_.vh(h,0);d=c=_.F(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),qy(a,f),ry(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),qy(a,f),ry(a,a.I,f)):a.g.error(c.toString());_.z(h)})};sy.prototype.fireEvent=function(){this.f++;var a=_.L.ua(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Xj(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=uy(this.a,this.f);a.client.playerEvent=
9
- b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.Zc&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.ik(this.l);
10
- b.method=_.sb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.Q.Hd(JSON.stringify(a));return this.j.fetch(b).T};sy.prototype.$g=function(a){this.h=a};ty.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};ty.prototype.o=function(){this.h=!0};ty.prototype.j=function(){this.f=!0};ty.prototype.l=function(){this.f=!1};_.w(vy,_.ew);_.r=vy.prototype;_.r.onPlayerCreated=function(){};
11
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.L.R(b.vimond)&&typeof b.vimond===_.Se)?a.namespace()===_.sd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.v(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.N(1,9,9200));return}this.g.debug(_.ya);
12
- c=b.failIfUnreachable;typeof c!==_.Zc&&(c=!0);d=b.failOnError;typeof d!==_.Zc&&(d=!0);this.f=new ty(a);this.h=new sy(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new py(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Rb);_.li(a.a)}this.j&&(a=this.j,a.g.debug(_.Rb),_.li(a.a),a.h.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
- _.r.$g=function(a){this.a&&this.h&&this.h.$g(a)};_.I(oy,vy);vy.prototype.updateAuthToken=vy.prototype.$g;vy.Id="vimond";wy.prototype.create=function(){return new vy};_.bu(new wy);};
2
+ var f=function(window){var $x="Registering listeners",ay="clpp.vimond.VimondPlugin",by=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.F=e;this.a=new _.ti;this.l=!0;this.h=this.j=this.A=!1;this.B=null;this.f=new _.dj(this.Vh.bind(this));this.g=new _.L("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug($x),this.a.on(this.m,_.dg,this.pl.bind(this)),this.a.on(this.m,_.ug,this.ql.bind(this)),this.a.on(this.m,_.fc,this.nl.bind(this)),this.a.on(this.m,_.gc,this.ol.bind(this)))},cy=function(a,
3
+ b){a.m.trigger(new _.Q(_.Rg,{detail:b}))},dy=function(a,b,c){b&&(a.A=!0,a.f.stop());a.m.onError(new _.N(b?_.O:1,9,9201,c))},ey=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.L("clpp.vimond.VimondService");this.f=0},fy=function(a){this.m=a;this.a=new _.ti;this.g=new _.L("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug($x),this.a.on(this.m,_.Lf,this.o.bind(this)),this.a.on(this.m,_.fc,this.j.bind(this)),this.a.on(this.m,_.gc,this.l.bind(this)))},
4
+ gy=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.sf];if(a.h)return[_.he,_.cf];if(5===c)return[_.he,null];if(c===_.zo)return[_.je,_.cf];var d=_.cf;if(2===c||3===c||a.f)d=_.sf;return["period",d]},hy=function(){this.a=!1;this.g=new _.L(ay);this.j=this.h=this.f=null},iy=function(){};_.r=by.prototype;_.r.ql=function(){this.h||(this.h=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.nl=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.ol=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.pl=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.bu;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.h)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.h&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.h&&e===d.PLAYING&&(b.g.debug("Seeked"),b.h=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.C(0);
7
+ b.B=e;return _.x(h,b.Vh(),3)}e===d.ENDED&&b.f.stop();_.z(h)})};
8
+ _.r.Vh=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.f.stop();a.f.ha(a.l?10:a.G);a.l=!1;_.F(h,2);return _.x(h,a.F.fireEvent(),4)}if(2!=h.a)return b=h.f,cy(a,b),_.G(h,0);d=c=_.H(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),cy(a,f),dy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),cy(a,f),dy(a,a.I,f)):a.g.error(c.toString());_.z(h)})};ey.prototype.fireEvent=function(){this.f++;var a=_.M.ua(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.mn(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=gy(this.a,this.f);a.client.playerEvent=
9
+ b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.Xc&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.Mk(this.l);
10
+ b.method=_.qb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.R.yd(JSON.stringify(a));return this.j.fetch(b).T};ey.prototype.Yg=function(a){this.h=a};fy.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};fy.prototype.o=function(){this.h=!0};fy.prototype.j=function(){this.f=!0};fy.prototype.l=function(){this.f=!1};_.w(hy,_.Tv);_.r=hy.prototype;_.r.onPlayerCreated=function(){};
11
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.M.R(b.vimond)&&typeof b.vimond===_.Se)?a.namespace()===_.qd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.v(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.N(1,9,9200));return}this.g.debug("Configuration is valid");
12
+ c=b.failIfUnreachable;typeof c!==_.Xc&&(c=!0);d=b.failOnError;typeof d!==_.Xc&&(d=!0);this.f=new fy(a);this.h=new ey(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new by(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Pb);_.wi(a.a)}this.j&&(a=this.j,a.g.debug(_.Pb),_.wi(a.a),a.f.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
+ _.r.Yg=function(a){this.a&&this.h&&this.h.Yg(a)};_.K(ay,hy);hy.prototype.updateAuthToken=hy.prototype.Yg;hy.Id="vimond";iy.prototype.create=function(){return new hy};_.To(new iy);};
14
14
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
15
15
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
16
16
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vr.js CHANGED
@@ -1,24 +1,24 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Tx="touchmove",Ux="touchstart",Vx=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},Wx=function(a,b){var c=a.x,d=a.y,e=a.a,f=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*f),2*(c*e+d*f),0,2*(c*d+e*f),1-2*(c*c+e*e),2*(d*e-c*f),0,2*(c*e-d*f),2*(d*e+c*f),1-2*(c*c+d*d),0,0,0,0,1)},Xx=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Vx(a/d*e,b/d*e,0/d*e,Math.cos(c))},Yx=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},Zx=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
3
- b):(a.x=0,a.y=0,a.a=0)},$x=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},ay=function(a,b,c){var d=b.x,e=b.y;b=b.a;var f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},by=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},cy=function(a,b,c){b=b.a;c=c.a;var d=a.a,e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+
4
- 3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},dy=function(a){var b=new Yx(0,0,0),c=new Yx(0,0,1),d=new Yx,e=new Yx,f=new Yx;a=a.a;var g=new Yx(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Zx(f,1/g);c=ay(d,c,f);g=c.length();Zx(c,1/g);ay(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-$x(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-$x(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-$x(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},fy=function(a){this.a=a;this.f=a.createProgram();this.l=
5
- ey(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=ey(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,
6
- 0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.N(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)},ey=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.N(1,
7
- 9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},gy=function(a){this.a=a;var b=[],c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI,g=Math.cos(f);for(c=0;128>=c;c++){var h=c/128,l=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(l)*g),b.push(100*Math.sin(l)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=
8
- 5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)},hy=function(a,
9
- b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)},iy=function(){var a=this;this.o=this.w=this.L=this.J=this.A=
10
- this.da=this.H=this.f=this.a=this.m=null;this.g=new _.J("clpp.vr");this.I=70;this.ca=1;this.P=this.N=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.S=new by;this.Y=new by;this.ia=new by;this.ka=new by;this.B=this.wn.bind(this);
11
- this.F=this.xn.bind(this);this.K=this.vn.bind(this)},jy=function(a){var b=Xx(1,0,a.l*Math.PI/180);Wx(Xx(0,1,a.j*Math.PI/180),a.S);Wx(b,a.Y);dy(a.ia);cy(a.ka,a.S,a.ia);cy(a.H,a.Y,a.ka)},ky=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Tx,a.B,!1),a.a.removeEventListener("mouseup",a.F,!1),a.a.removeEventListener("touchend",a.F,!1))},ly=function(){};Yx.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};by.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,u,y){var A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=l;A[6]=m;A[10]=n;A[14]=p;A[3]=q;A[7]=t;A[11]=u;A[15]=y;return this};var my={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.w(iy,_.ew);_.r=iy.prototype;_.r.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
12
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable){var c=b.vr,d=c.fieldOfView,e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;if(void 0!==d&&_.L.ya(d))this.I=d;else throw new _.N(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.L.ya(e)&&0<e)this.ca=e;else throw new _.N(1,7,7100,"sensitivity configuration must be a positive number");this.N=!!f;this.P=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.Jg){this.g.info("Initialize VR Surface");
13
- if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",my)||this.a.getContext("experimental-webgl",my);if(!this.f)throw new _.N(1,9,9003,"Unable to create GL context");this.H=new by;dy(this.H);this.da=new gy(this.f);this.A=new fy(this.f);this.J=new by;this.L=new by;this.o=this.w=null;this.a.addEventListener(_.Of,this.G)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,
14
- !1),this.a.addEventListener(Ux,this.K,!1));this.G();this.ij()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
15
- _.r.onPlayerWillRelease=function(){this.g.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(ky(this),this.a.removeEventListener(_.Of,this.G),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.r.onPlayerWillDestroy=function(){var a=this;return _.H(function(b){a.m=null;_.z(b)})};_.r.id=function(){return"vr"};
16
- _.r.ij=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Jg){this.w=requestAnimationFrame(this.ij.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new hy(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
17
- 0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.A;c.a.useProgram(c.f);c=cy(this.J,this.L,this.H).a;var d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d;b.uniformMatrix4fv(this.A.h,!1,this.J.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.da;a.a.bindBuffer(a.a.ARRAY_BUFFER,
2
+ var f=function(window){var Fx="touchmove",Gx="touchstart",Hx=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},Ix=function(a,b){var c=a.x,d=a.y,e=a.a,f=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*f),2*(c*e+d*f),0,2*(c*d+e*f),1-2*(c*c+e*e),2*(d*e-c*f),0,2*(c*e-d*f),2*(d*e+c*f),1-2*(c*c+d*d),0,0,0,0,1)},Jx=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Hx(a/d*e,b/d*e,0/d*e,Math.cos(c))},Kx=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},Lx=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
3
+ b):(a.x=0,a.y=0,a.a=0)},Mx=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Nx=function(a,b,c){var d=b.x,e=b.y;b=b.a;var f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},Ox=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},Px=function(a,b,c){b=b.a;c=c.a;var d=a.a,e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+
4
+ 3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},Qx=function(a){var b=new Kx(0,0,0),c=new Kx(0,0,1),d=new Kx,e=new Kx,f=new Kx;a=a.a;var g=new Kx(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Lx(f,1/g);c=Nx(d,c,f);g=c.length();Lx(c,1/g);Nx(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Mx(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Mx(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Mx(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Sx=function(a){this.a=a;this.f=a.createProgram();this.l=
5
+ Rx(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=Rx(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,
6
+ 0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.N(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)},Rx=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.N(1,
7
+ 9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},Tx=function(a){this.a=a;var b=[],c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI,g=Math.cos(f);for(c=0;128>=c;c++){var h=c/128,l=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(l)*g),b.push(100*Math.sin(l)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=
8
+ 5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)},Ux=function(a,
9
+ b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)},Vx=function(){var a=this;this.o=this.w=this.L=this.J=this.A=
10
+ this.fa=this.H=this.f=this.a=this.m=null;this.g=new _.L("clpp.vr");this.I=70;this.da=1;this.P=this.O=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.U=new Ox;this.Z=new Ox;this.ja=new Ox;this.ka=new Ox;this.B=this.tn.bind(this);
11
+ this.F=this.un.bind(this);this.K=this.sn.bind(this)},Wx=function(a){var b=Jx(1,0,a.l*Math.PI/180);Ix(Jx(0,1,a.j*Math.PI/180),a.U);Ix(b,a.Z);Qx(a.ja);Px(a.ka,a.U,a.ja);Px(a.H,a.Z,a.ka)},Xx=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Fx,a.B,!1),a.a.removeEventListener("mouseup",a.F,!1),a.a.removeEventListener("touchend",a.F,!1))},Yx=function(){};Kx.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};Ox.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,u,y){var B=this.a;B[0]=a;B[4]=b;B[8]=c;B[12]=d;B[1]=e;B[5]=f;B[9]=g;B[13]=h;B[2]=l;B[6]=m;B[10]=n;B[14]=p;B[3]=q;B[7]=t;B[11]=u;B[15]=y;return this};var Zx={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.w(Vx,_.Tv);_.r=Vx.prototype;_.r.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
12
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable){var c=b.vr,d=c.fieldOfView,e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;if(void 0!==d&&_.M.xa(d))this.I=d;else throw new _.N(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.M.xa(e)&&0<e)this.da=e;else throw new _.N(1,7,7100,"sensitivity configuration must be a positive number");this.O=!!f;this.P=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.Mg){this.g.info("Initialize VR Surface");
13
+ if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Zx)||this.a.getContext("experimental-webgl",Zx);if(!this.f)throw new _.N(1,9,9003,"Unable to create GL context");this.H=new Ox;Qx(this.H);this.fa=new Tx(this.f);this.A=new Sx(this.f);this.J=new Ox;this.L=new Ox;this.o=this.w=null;this.a.addEventListener(_.Of,this.G)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,
14
+ !1),this.a.addEventListener(Gx,this.K,!1));this.G();this.nj()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
15
+ _.r.onPlayerWillRelease=function(){this.g.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Xx(this),this.a.removeEventListener(_.Of,this.G),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.r.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){a.m=null;_.z(b)})};_.r.id=function(){return"vr"};
16
+ _.r.nj=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Mg){this.w=requestAnimationFrame(this.nj.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Ux(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
17
+ 0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.A;c.a.useProgram(c.f);c=Px(this.J,this.L,this.H).a;var d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d;b.uniformMatrix4fv(this.A.h,!1,this.J.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.fa;a.a.bindBuffer(a.a.ARRAY_BUFFER,
18
18
  a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.A.a.useProgram(null)}}}};
19
- _.r.vn=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Ux)a.type===Ux?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(Tx,this.B,!1),this.a.addEventListener("mouseup",this.F,!1),this.a.addEventListener("touchend",this.F,!1)};
20
- _.r.wn=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Tx&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.ca;c=d*b*(this.P?-1:1);this.j+=a*b*(this.N?-1:1);this.l+=c;jy(this)};_.r.xn=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();ky(this)};_.r.Om=function(a,b){this.l=b;this.j=a;jy(this)};_.r.Sl=function(){return{x:this.j,y:this.l}};
21
- _.r.qo=function(a){this.I=a;this.G()};_.I("clpp.vr.VrPlugin",iy);iy.prototype.setCameraFieldOfView=iy.prototype.qo;iy.prototype.getCameraCoordinates=iy.prototype.Sl;iy.prototype.moveCamera=iy.prototype.Om;iy.Id="vr";ly.prototype.create=function(){return new iy};_.bu(new ly);};
19
+ _.r.sn=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Gx)a.type===Gx?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(Fx,this.B,!1),this.a.addEventListener("mouseup",this.F,!1),this.a.addEventListener("touchend",this.F,!1)};
20
+ _.r.tn=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Fx&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.da;c=d*b*(this.P?-1:1);this.j+=a*b*(this.O?-1:1);this.l+=c;Wx(this)};_.r.un=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Xx(this)};_.r.Mm=function(a,b){this.l=b;this.j=a;Wx(this)};_.r.Sl=function(){return{x:this.j,y:this.l}};
21
+ _.r.po=function(a){this.I=a;this.G()};_.K("clpp.vr.VrPlugin",Vx);Vx.prototype.setCameraFieldOfView=Vx.prototype.po;Vx.prototype.getCameraCoordinates=Vx.prototype.Sl;Vx.prototype.moveCamera=Vx.prototype.Mm;Vx.Id="vr";Yx.prototype.create=function(){return new Vx};_.To(new Yx);};
22
22
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
23
23
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
24
24
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vtt.js CHANGED
@@ -1,18 +1,18 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var zx=" The setting will be ignored.",Ax="VTT parser encountered an invalid VTT setting: ",Bx="application/x-subrip",Cx="text/srt",Dx='text/vtt; codecs\x3d"vtt"',Ex='text/vtt; codecs\x3d"wvtt"',Fx=function(a){_.Kj(a,/[ \t]+/gm)},Gx=function(a){return a.a===a.f.length?null:(a=_.Kj(a,/[^ \t\n]*/gm))?a[0]:null},Hx=function(){},Ix=function(a){var b="";for(a=a.split(/\n/);3<a.length;){for(var c=3;c<a.length;++c)a[2]+="\n"+a[c];a.splice(3,a.length-3)}if(3!==a.length)return"";c=0;!a[0].match(/\d+:\d+:\d+/)&&
3
- a[1].match(/\d+:\d+:\d+/)&&(b+=a[0].match(/\w+/)+"\n",++c);if(a[c].match(/\d+:\d+:\d+/)){var d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=d[1]+":"+d[2]+":"+d[3]+"."+d[4]+" --\x3e ",b+=d[5]+":"+d[6]+":"+d[7]+"."+d[8]+"\n",++c;else return""}else return"";a[c]&&(b+=a[c]+"\n\n");return b},Jx=function(){},Kx=function(a){this.a=a},Mx=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.Oi:a.textAlign=
4
- _.kw[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.Gg:_.Hg;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b===_.ze||b===_.bg?_.ze:b===_.Ae||b===_.ge?_.Ae:_.id);else if(d=/^region:(.*)$/.exec(b)){if(b=Lx(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=
5
- Number(c[1]),c[2]&&(a.lineAlign=_.lw[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Qi,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.lw[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Lx=function(a,b){var c=a.filter(function(d){return d.id===b});return c.length?c[0]:(_.Kh("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},Nx=function(a){a=_.Kj(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==
6
- a)return null;var b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+c+60*b+3600*(Number(a[1])||0)},Ox=function(){Kx.apply(this,arguments)},Px=function(){this.a=null;this.g=new _.J("clpp.vtt.mp4")},Rx=function(a,b,c){var d,e,f;(new _.sn).M("payl",_.vn(function(g){d=_.Q.ea(g)})).M("iden",_.vn(function(g){e=_.Q.ea(g)})).M("sttg",_.vn(function(g){f=_.Q.ea(g)})).parse(a);return d?Qx(d,e,f,b,c):null},Qx=function(a,b,c,d,e){a=new _.Ti(d,e,a,_.Rg);b&&(a.id=b);if(c)for(b=new _.Jj(c),c=
7
- Gx(b);c;)Mx(a,c,[])||_.Kh(Ax,c,zx),Fx(b),c=Gx(b);return a},Sx=function(){this.j=new Jx};Hx.prototype.a=function(a){a=_.Q.ea(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");var b=a.split("\n\n");a="";if(0<b.length){a+="WEBVTT\n\n";b=_.v(b);for(var c=b.next();!c.done;c=b.next())a+=Ix(c.value)}return _.Q.hb(a)};Jx.prototype.create=function(){return new Hx};Jx.prototype.probe=function(a,b){return(a===Cx||a===Bx)&&b===_.lg};Kx.prototype.parseInit=function(){};
8
- Kx.prototype.parseMedia=function(a,b){var c=_.Q.ea(a);c=c.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var d=c.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(d[0]))throw new _.N(_.O,2,2E3);c=b.periodStart;if(d[0].includes("X-TIMESTAMP-MAP")){var e=d[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),f=d[0].match(/MPEGTS:(\d+)/m);if(e&&f){c=Nx(new _.Jj(e[1]));if(null==c)throw new _.N(_.O,2,2E3);f=Number(f[1]);for(e=b.segmentStart;95443.7176888889<=e;)e-=95443.7176888889,f+=8589934592;c=b.periodStart+
9
- f/9E4-c}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(c=b.segmentStart);f=[];e=_.v(d);for(var g=e.next();!g.done;g=e.next()){var h=g.value;if(/^region/.test(h.toLowerCase())){h=new _.Jj(h.replace(/\n/g," "));g=new _.Wi;Gx(h);Fx(h);for(var l=Gx(h);l;){var m;a:{var n=g,p=l;if(m=/^id:(.*)$/.exec(p))n.id=m[1];else if(m=/^width:(\d{1,2}|100)%$/.exec(p))n.width=Number(m[1]);else if(m=/^lines:(\d+)$/.exec(p))n.height=Number(m[1]),n.heightUnits=2;else if(m=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.regionAnchorX=
10
- Number(m[1]),n.regionAnchorY=Number(m[2]);else if(m=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.viewportAnchorX=Number(m[1]),n.viewportAnchorY=Number(m[2]);else if(/^scroll:up$/.exec(p))n.scroll="up";else{m=!1;break a}m=!0}m||_.Kh("VTT parser encountered an invalid VTTRegion setting: ",l,zx);Fx(h);l=Gx(h)}f.push(g)}}e=[];h=_.v(d);for(g=h.next();!g.done;g=h.next())if(g=g.value,/^style/.test(g.toLowerCase())){g=g.replace(/^style/i,"").replace(/\n/g," ");l=/[^{}]+{[^{}]*}/g;do(m=l.exec(g))&&
11
- e.push(m[0]);while(m)}h=[];d=_.v(d);for(g=d.next();!g.done;g=d.next())if(g=g.value,g.includes("--\x3e")){p=g.split("\n");var q=c;if(1===p.length&&!p[0]||/^NOTE($|[ \t])/.test(p[0])||"STYLE"===p[0])g=null;else{g=null;p[0].includes("--\x3e")||(g=p[0],p.splice(0,1));l=new _.Jj(p[0]);m=Nx(l);var t=_.Kj(l,/[ \t]+--\x3e[ \t]+/g);n=Nx(l);if(null==m||null==t||null==n)throw new _.N(_.O,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.Ti(m,n,p,_.Rg);g&&(m.id=g);Fx(l);for(n=Gx(l);n;)Mx(m,n,f)||_.Kh(Ax,
12
- n,zx),Fx(l),n=Gx(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.w(Ox,Kx);Ox.prototype.parseMedia=function(a,b){return Kx.prototype.parseMedia.call(this,(new Hx).a(a),b)};Px.prototype.parseInit=function(a){var b=this,c=!1;(new _.sn).M(_.Ne,_.tn).M(_.ug,_.tn).M(_.Ie,_.tn).aa("mdhd",function(d){0===d.version?(d.reader.skip(4),d.reader.skip(4),b.a=_.nn(d.reader),d.reader.skip(4)):(d.reader.skip(8),d.reader.skip(8),b.a=_.nn(d.reader),d.reader.skip(8));d.reader.skip(4)}).M(_.Me,_.tn).M(_.eg,_.tn).aa(_.gg,_.un).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.N(_.O,2,2008);if(!c)throw new _.N(_.O,2,2008);};
13
- Px.prototype.parseMedia=function(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),new _.N(_.O,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.sn).M("moof",_.tn).M("traf",_.tn).aa("tfdt",function(G){g=!0;c=0===G.version?_.nn(G.reader):_.pn(G.reader)}).aa("tfhd",function(G){var M=G.flags;G=G.reader;G.skip(4);M&1&&G.skip(8);M&2&&G.skip(4);m=M&8?_.nn(G):null}).aa("trun",function(G){h=!0;var M=G.version,R=G.flags;G=G.reader;var ka=_.nn(G);R&1&&G.skip(4);R&4&&G.skip(4);for(var U=
14
- [],ra=0;ra<ka;ra++){var Ba={duration:null,sampleSize:null,Wg:null};R&256&&(Ba.duration=_.nn(G));R&512&&(Ba.sampleSize=_.nn(G));R&1024&&G.skip(4);R&2048&&(Ba.Wg=0===M?_.nn(G):_.on(G));U.push(Ba)}d=U}).M(_.He,_.vn(function(G){l=!0;e=G})).parse(a);if(!l&&!g&&!h)throw new _.N(_.O,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.hn(p,!1);for(var q=_.v(d),t=q.next();!t.done;t=q.next()){t=t.value;var u=t.duration||m,y=t.Wg?c+t.Wg:n;n=y+(u||0);var A=0;do{var B=_.nn(p);A+=B;var E=
15
- _.nn(p);E=_.xn(E);var C=null;"vttc"===E?8<B&&(C=_.rn(p,B-8)):("vtte"!==E&&this.g.error("Unknown box "+E+"! Skipping!"),p.skip(B-8));u?C&&f.push(Rx(C,b.periodStart+y/this.a,b.periodStart+n/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(t.sampleSize&&A<t.sampleSize)}return{cues:f.filter(_.bj),styles:[]}};_.w(Sx,_.Fu);Sx.prototype.f=function(){_.Dv(_.lg,Kx);_.Dv(Dx,Kx);_.Dv(Ex,Kx);_.Dv(_.Lc,Px);_.Dv(Cx,Ox);_.Dv(Bx,Ox);_.gl.push(this.j)};Sx.prototype.a=function(){_.Fv(_.lg);_.Fv(Dx);_.Fv(Ex);_.Fv(_.Lc);_.Fv(Cx);_.Fv(Bx);_.il(this.j)};Sx.prototype.id=function(){return"subtitles-vtt"};_.I("clpp.vtt.VttComponent",Sx);};
2
+ var f=function(window){var lx=" The setting will be ignored.",mx="VTT parser encountered an invalid VTT setting: ",nx="application/x-subrip",ox="text/srt",px='text/vtt; codecs\x3d"vtt"',qx='text/vtt; codecs\x3d"wvtt"',rx=function(a){_.Os(a,/[ \t]+/gm)},sx=function(a){return a.a===a.f.length?null:(a=_.Os(a,/[^ \t\n]*/gm))?a[0]:null},tx=function(){},ux=function(a){var b="";for(a=a.split(/\n/);3<a.length;){for(var c=3;c<a.length;++c)a[2]+="\n"+a[c];a.splice(3,a.length-3)}if(3!==a.length)return"";c=0;!a[0].match(/\d+:\d+:\d+/)&&
3
+ a[1].match(/\d+:\d+:\d+/)&&(b+=a[0].match(/\w+/)+"\n",++c);if(a[c].match(/\d+:\d+:\d+/)){var d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=d[1]+":"+d[2]+":"+d[3]+"."+d[4]+" --\x3e ",b+=d[5]+":"+d[6]+":"+d[7]+"."+d[8]+"\n",++c;else return""}else return"";a[c]&&(b+=a[c]+"\n\n");return b},vx=function(){},wx=function(a){this.a=a},yx=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.rp:a.textAlign=
4
+ _.ew[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.Kg:_.Lg;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b===_.ze||b===_.cg?_.ze:b===_.Ae||b===_.he?_.Ae:_.gd);else if(d=/^region:(.*)$/.exec(b)){if(b=xx(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=
5
+ Number(c[1]),c[2]&&(a.lineAlign=_.fw[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.tp,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.fw[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},xx=function(a,b){var c=a.filter(function(d){return d.id===b});return c.length?c[0]:(_.Lh("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},zx=function(a){a=_.Os(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==
6
+ a)return null;var b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+c+60*b+3600*(Number(a[1])||0)},Ax=function(){wx.apply(this,arguments)},Bx=function(){this.a=null;this.g=new _.L("clpp.vtt.mp4")},Dx=function(a,b,c){var d,e,f;(new _.fq).M("payl",_.iq(function(g){d=_.R.ea(g)})).M("iden",_.iq(function(g){e=_.R.ea(g)})).M("sttg",_.iq(function(g){f=_.R.ea(g)})).parse(a);return d?Cx(d,e,f,b,c):null},Cx=function(a,b,c,d,e){a=new _.wp(d,e,a,_.Tg);b&&(a.id=b);if(c)for(b=new _.Ns(c),c=
7
+ sx(b);c;)yx(a,c,[])||_.Lh(mx,c,lx),rx(b),c=sx(b);return a},Ex=function(){this.a=new vx};tx.prototype.a=function(a){a=_.R.ea(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");var b=a.split("\n\n");a="";if(0<b.length){a+="WEBVTT\n\n";b=_.v(b);for(var c=b.next();!c.done;c=b.next())a+=ux(c.value)}return _.R.eb(a)};vx.prototype.create=function(){return new tx};vx.prototype.probe=function(a,b){return(a===ox||a===nx)&&b===_.ng};wx.prototype.parseInit=function(){};
8
+ wx.prototype.parseMedia=function(a,b){var c=_.R.ea(a);c=c.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var d=c.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(d[0]))throw new _.N(_.O,2,2E3);c=b.periodStart;if(d[0].includes("X-TIMESTAMP-MAP")){var e=d[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),f=d[0].match(/MPEGTS:(\d+)/m);if(e&&f){c=zx(new _.Ns(e[1]));if(null==c)throw new _.N(_.O,2,2E3);f=Number(f[1]);for(e=b.segmentStart;95443.7176888889<=e;)e-=95443.7176888889,f+=8589934592;c=b.periodStart+
9
+ f/9E4-c}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(c=b.segmentStart);f=[];e=_.v(d);for(var g=e.next();!g.done;g=e.next()){var h=g.value;if(/^region/.test(h.toLowerCase())){h=new _.Ns(h.replace(/\n/g," "));g=new _.zp;sx(h);rx(h);for(var l=sx(h);l;){var m;a:{var n=g,p=l;if(m=/^id:(.*)$/.exec(p))n.id=m[1];else if(m=/^width:(\d{1,2}|100)%$/.exec(p))n.width=Number(m[1]);else if(m=/^lines:(\d+)$/.exec(p))n.height=Number(m[1]),n.heightUnits=2;else if(m=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.regionAnchorX=
10
+ Number(m[1]),n.regionAnchorY=Number(m[2]);else if(m=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(p))n.viewportAnchorX=Number(m[1]),n.viewportAnchorY=Number(m[2]);else if(/^scroll:up$/.exec(p))n.scroll="up";else{m=!1;break a}m=!0}m||_.Lh("VTT parser encountered an invalid VTTRegion setting: ",l,lx);rx(h);l=sx(h)}f.push(g)}}e=[];h=_.v(d);for(g=h.next();!g.done;g=h.next())if(g=g.value,/^style/.test(g.toLowerCase())){g=g.replace(/^style/i,"").replace(/\n/g," ");l=/[^{}]+{[^{}]*}/g;do(m=l.exec(g))&&
11
+ e.push(m[0]);while(m)}h=[];d=_.v(d);for(g=d.next();!g.done;g=d.next())if(g=g.value,g.includes("--\x3e")){p=g.split("\n");var q=c;if(1===p.length&&!p[0]||/^NOTE($|[ \t])/.test(p[0])||"STYLE"===p[0])g=null;else{g=null;p[0].includes("--\x3e")||(g=p[0],p.splice(0,1));l=new _.Ns(p[0]);m=zx(l);var t=_.Os(l,/[ \t]+--\x3e[ \t]+/g);n=zx(l);if(null==m||null==t||null==n)throw new _.N(_.O,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.wp(m,n,p,_.Tg);g&&(m.id=g);rx(l);for(n=sx(l);n;)yx(m,n,f)||_.Lh(mx,
12
+ n,lx),rx(l),n=sx(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.w(Ax,wx);Ax.prototype.parseMedia=function(a,b){return wx.prototype.parseMedia.call(this,(new tx).a(a),b)};Bx.prototype.parseInit=function(a){var b=this,c=!1;(new _.fq).M(_.Oe,_.gq).M(_.xg,_.gq).M(_.Je,_.gq).ba("mdhd",function(d){0===d.version?(d.reader.skip(4),d.reader.skip(4),b.a=_.aq(d.reader),d.reader.skip(4)):(d.reader.skip(8),d.reader.skip(8),b.a=_.aq(d.reader),d.reader.skip(8));d.reader.skip(4)}).M(_.Ne,_.gq).M(_.fg,_.gq).ba(_.hg,_.hq).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.N(_.O,2,2008);if(!c)throw new _.N(_.O,2,2008);};
13
+ Bx.prototype.parseMedia=function(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),new _.N(_.O,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.fq).M("moof",_.gq).M("traf",_.gq).ba("tfdt",function(D){g=!0;c=0===D.version?_.aq(D.reader):_.cq(D.reader)}).ba("tfhd",function(D){var J=D.flags;D=D.reader;D.skip(4);J&1&&D.skip(8);J&2&&D.skip(4);m=J&8?_.aq(D):null}).ba("trun",function(D){h=!0;var J=D.version,P=D.flags;D=D.reader;var U=_.aq(D);P&1&&D.skip(4);P&4&&D.skip(4);for(var V=
14
+ [],ra=0;ra<U;ra++){var Da={duration:null,sampleSize:null,Ug:null};P&256&&(Da.duration=_.aq(D));P&512&&(Da.sampleSize=_.aq(D));P&1024&&D.skip(4);P&2048&&(Da.Ug=0===J?_.aq(D):_.bq(D));V.push(Da)}d=V}).M(_.Ie,_.iq(function(D){l=!0;e=D})).parse(a);if(!l&&!g&&!h)throw new _.N(_.O,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.Wp(p,!1);for(var q=_.v(d),t=q.next();!t.done;t=q.next()){t=t.value;var u=t.duration||m,y=t.Ug?c+t.Ug:n;n=y+(u||0);var B=0;do{var A=_.aq(p);B+=A;var C=
15
+ _.aq(p);C=_.kq(C);var E=null;"vttc"===C?8<A&&(E=_.eq(p,A-8)):("vtte"!==C&&this.g.error("Unknown box "+C+"! Skipping!"),p.skip(A-8));u?E&&f.push(Dx(E,b.periodStart+y/this.a,b.periodStart+n/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(t.sampleSize&&B<t.sampleSize)}return{cues:f.filter(_.jn),styles:[]}};_.w(Ex,_.Tu);Ex.prototype.install=function(){_.zv(_.ng,wx);_.zv(px,wx);_.zv(qx,wx);_.zv(_.Jc,Bx);_.zv(ox,Ax);_.zv(nx,Ax);_.lt.push(this.a)};Ex.prototype.uninstall=function(){_.Bv(_.ng);_.Bv(px);_.Bv(qx);_.Bv(_.Jc);_.Bv(ox);_.Bv(nx);_.nt(this.a)};Ex.prototype.id=function(){return"subtitles-vtt"};_.K("clpp.vtt.VttComponent",Ex);};
16
16
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
17
17
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
18
18
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.yospace.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ux="clpp.yospace.YospacePlugin",vx=function(){this.a=null;this.g=new _.J(ux)},wx=function(){};_.w(vx,_.ew);vx.prototype.li=function(){return this.a};
3
- vx.prototype.onContentWillLoad=function(a,b){var c=this,d,e,f,g,h;return _.H(function(l){if(1==l.a){d=a.getConfiguration();e=d.yospace;if(!e.enabled)return l["return"]();if(typeof window.YospaceAdManagement!==_.Se)throw new _.N(_.O,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");f=e.streamType||xx;a:{var m=b.url;c.g.info("Creating Yospace session for stream type",f);switch(f){case xx:m=YospaceAdManagement.SessionVOD.create(m);break a;case yx:m=YospaceAdManagement.SessionLive.create(m);
4
- break a;default:m=YospaceAdManagement.SessionDVRLive.create(m)}}return _.x(l,m,2)}g=l.f;h=g.getSessionState();if(h!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",h,"URL",b.url),new _.N(_.O,9,7003,"Yospace session failed to initialize.");a.trigger(new _.K(_.dh,{detail:g}));b.url=g.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=g;_.z(l)})};
5
- vx.prototype.onPlayerWillRelease=function(a){if(this.a){this.g.info("Shutting down Yospace session.");var b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.K(_.ch,{detail:b}))}};vx.prototype.id=function(){return"yospace"};_.I(ux,vx);vx.prototype.getSession=vx.prototype.li;vx.Id="yospace";wx.prototype.create=function(){return new vx};_.bu(new wx);var xx=_.Wb,yx="LIVE";_.I("clpp.yospace.StreamType",{VOD:xx,LIVE:yx,DVR:"DVR"});};
2
+ var f=function(window){var gx="clpp.yospace.YospacePlugin",hx=function(){this.a=null;this.g=new _.L(gx)},ix=function(){};_.w(hx,_.Tv);hx.prototype.mi=function(){return this.a};
3
+ hx.prototype.onContentWillLoad=function(a,b){var c=this,d,e,f,g,h;return _.I(function(l){if(1==l.a){d=a.getConfiguration();e=d.yospace;if(!e.enabled)return l["return"]();if(typeof window.YospaceAdManagement!==_.Se)throw new _.N(_.O,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");f=e.streamType||jx;a:{var m=b.url;c.g.info("Creating Yospace session for stream type",f);switch(f){case jx:m=YospaceAdManagement.SessionVOD.create(m);break a;case kx:m=YospaceAdManagement.SessionLive.create(m);
4
+ break a;default:m=YospaceAdManagement.SessionDVRLive.create(m)}}return _.x(l,m,2)}g=l.f;h=g.getSessionState();if(h!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",h,"URL",b.url),new _.N(_.O,9,7003,"Yospace session failed to initialize.");a.trigger(new _.Q(_.fh,{detail:g}));b.url=g.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=g;_.z(l)})};
5
+ hx.prototype.onPlayerWillRelease=function(a){if(this.a){this.g.info("Shutting down Yospace session.");var b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.Q(_.eh,{detail:b}))}};hx.prototype.id=function(){return"yospace"};_.K(gx,hx);hx.prototype.getSession=hx.prototype.mi;hx.Id="yospace";ix.prototype.create=function(){return new hx};var jx=_.Ub,kx="LIVE";_.K("clpp.yospace.StreamType",{VOD:jx,LIVE:kx,DVR:"DVR"});_.To(new ix);};
6
6
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
7
7
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
8
8
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.youbora.js CHANGED
@@ -1,44 +1,44 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Qw='" event to NPAW',Rw='" event to Youbora',Sw='Reporting "',Tw="Unhandled state",Uw="accountCode key is missing in Youbora config",Vw="ad break start",Ww="ad buffering ended",Xw="ad buffering started",Yw="ad click through url: ",Zw="ad timeline changed",$w="clpp.npaw.NpawPlugin",ax="clpp.npaw.YouboraPlugin",bx="content.isLive",cx="content.title",dx="is container visible",ex="youbora",fx=function(a){return a.startsWith(_.Gd)?"Widevine":a.startsWith(_.Cd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?
3
- "PlayReady":a.startsWith(_.af)?"ClearKey":a.startsWith(_.Bd)?"Primetime":a},gx=function(a){return(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:function(b){return{code:""+b.code,message:b.message,severity:b.severity}}},hx=function(a,b,c,d){b=gx(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.ie;b.severity===_.O?(d.fireFatalError(b.code,b.message,b.metadata),c.debug('Reporting "fatal '+a+'" to Youbora',b.code,b)):(d.fireError(b.code,
4
- b.message,b.metadata),c.debug(Sw+a+'" to Youbora',b.code,b));return b},ix=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.m=c;d.a=new _.hi;d.g=new _.J("clpp.npaw.YouboraAdapter");d.o=!1;d.h=!1;d.B=!1;d.registerListeners();return d}_.w(b,youbora.Adapter);b.prototype.getPlayhead=function(){return this.getIsLive()?-1:this.m.getPosition()};b.prototype.getDuration=function(){return this.m.getDuration()};b.prototype.getRendition=function(){var c=this.m.getTrackManager();if(c&&(c=c.pa())){var d=
2
+ var f=function(window){var Cw='" event to NPAW',Dw='" event to Youbora',Ew='Reporting "',Fw="Unhandled state",Gw="accountCode key is missing in Youbora config",Hw="ad break start",Iw="ad buffering ended",Jw="ad buffering started",Kw="ad click through url: ",Lw="ad timeline changed",Mw="clpp.npaw.NpawPlugin",Nw="clpp.npaw.YouboraPlugin",Ow="content.isLive",Pw="content.title",Qw="is container visible",Rw="youbora",Sw=function(a){return a.startsWith(_.Fd)?"Widevine":a.startsWith(_.Bd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?
3
+ "PlayReady":a.startsWith(_.af)?"ClearKey":a.startsWith(_.Ad)?"Primetime":a},Tw=function(a){return(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:function(b){return{code:""+b.code,message:b.message,severity:b.severity}}},Uw=function(a,b,c,d){b=Tw(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.je;b.severity===_.O?(d.fireFatalError(b.code,b.message,b.metadata),c.debug('Reporting "fatal '+a+'" to Youbora',b.code,b)):(d.fireError(b.code,
4
+ b.message,b.metadata),c.debug(Ew+a+'" to Youbora',b.code,b));return b},Vw=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.m=c;d.a=new _.ti;d.g=new _.L("clpp.npaw.YouboraAdapter");d.o=!1;d.h=!1;d.B=!1;d.registerListeners();return d}_.w(b,youbora.Adapter);b.prototype.getPlayhead=function(){return this.getIsLive()?-1:this.m.getPosition()};b.prototype.getDuration=function(){return this.m.getDuration()};b.prototype.getRendition=function(){var c=this.m.getTrackManager();if(c&&(c=c.pa())){var d=
5
5
  c.width;var e=c.height;var f=c.bandwidth}d&&e&&f||(c=this.j(),d=d||c.width,e=e||c.height,f=f||c.streamBandwidth);return youbora.Util.buildRenditionString(d,e,f)};b.prototype.getIsLive=function(){return this.m.isLive()};b.prototype.getResource=function(){var c=this.m.getLoadedSource();return c&&c.url};b.prototype.getBitrate=function(){return this.j().streamBandwidth};b.prototype.getThroughput=function(){return this.j().estimatedBandwidth};b.prototype.getPlayrate=function(){return this.m.getPlaybackRate()};
6
- b.prototype.getFramesPerSecond=function(){var c=this.m.getTrackManager();return c&&(c=c.Ma())?c.frameRate:null};b.prototype.getPlayerName=function(){return _.xa};b.prototype.getVersion=function(){return"6.26.0-castlabsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.m&&this.a&&(this.g.debug("registering listeners"),youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.cg,this.K.bind(this)),this.a.on(this.m,_.ie,this.H.bind(this)),this.a.on(this.m,
7
- _.Dg,this.J.bind(this)),this.a.on(this.m,_.Cg,this.I.bind(this)),this.a.on(this.m,_.Cc,this.F.bind(this)),this.a.on(this.m,_.ed,this.G.bind(this)))};b.prototype.unregisterListeners=function(){this.g.debug(_.Rb);_.li(this.a)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.B=!0};b.prototype.j=function(){return this.m.getStats()||_.vq()};b.prototype.w=function(){return!!this.m.getConfiguration().autoplay};b.prototype.K=function(c){c=c.detail;this.l("state change",c);
8
- if(c)switch(c.currentState){case _.Iq:this.w()&&this.f();break;case _.Kq:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.Jq:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.wq:this.fireBufferEnd();this.fireStop();break;case _.Dq:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.Bq:this.fireBufferBegin();break;default:this.g.debug(Tw,c)}};b.prototype.f=function(){this.plugin.isInitiated||(this.h=
9
- !1,this.fireInit())};b.prototype.A=function(){var c=this.m.getDrmInfo();c&&(c=fx(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()};b.prototype.H=function(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=hx(c,this.m,this.g,this))&&c.severity===_.O&&(this.h=!0)};b.prototype.J=function(){this.m.isEnded()||(this.l(_.Vf),this.f(),this.fireSeekBegin())};b.prototype.I=function(){this.l(_.Uf);this.fireSeekEnd()};b.prototype.F=function(c){this.g.debug("adsTimeline",
10
- c);this.o=(c=c.adsTimeline)&&c.Qb()};b.prototype.G=function(c){this.g.debug("Casting",c);this.fireCasted()};b.prototype.l=function(c,d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.g.debug.apply(this.g,[Sw+c+Rw].concat(_.hh(e)))};return new b(a)},jx=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.m=c;d.a=null;d.j=null;d.f=new _.hi;d.g=new _.J("clpp.npaw.YouboraAdsAdapter");d.registerListeners();d.A=!1;d.l=!1;return d}_.w(b,youbora.Adapter);b.prototype.getDuration=
11
- function(){return this.a&&this.a.getDuration()};b.prototype.getRendition=function(){var c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.ob(),this.a.nb(),this.a.Wa()));return c};b.prototype.getBitrate=function(){return this.a&&this.a.Wa()};b.prototype.getPlayhead=function(){var c=this.m.getAdsManager();return c&&c.getPosition()};b.prototype.getResource=function(){return this.a&&this.a.getMediaUrl()};b.prototype.getTitle=function(){return this.a&&this.a.getTitle()};b.prototype.getProvider=
12
- function(){return this.a&&this.a.getAdvertiserName()};b.prototype.getCreativeId=function(){return this.a&&this.a.getCreativeId()};b.prototype.getPosition=function(){var c=youbora.Constants.AdPosition,d=null;if(this.a)switch(this.a.Xa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.debug("Ad position",d);return d};b.prototype.getIsSkippable=function(){return this.a&&-1!==this.a.getSkipTimeOffset()};b.prototype.getAudioEnabled=function(){var c=this.m.getAdsManager();
13
- return c&&0<c.getVolume()};b.prototype.getExpectedBreaks=function(){return this.j&&this.j.getCuePoints().length};b.prototype.getGivenBreaks=function(){return this.getExpectedBreaks()};b.prototype.getExpectedAds=function(){return this.a&&this.a.pb()};b.prototype.getGivenAds=function(){return this.getExpectedAds()};b.prototype.getBreaksTime=function(){var c=this;return this.j&&this.j.getCuePoints().map(function(d){return-1===d?c.m.getDuration():d})};b.prototype.getIsFullscreen=function(){return this.m.getSurface().isFullscreen()};
14
- b.prototype.getIsVisible=function(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug(dx,c);return c};b.prototype.getPlayerName=function(){return _.xa};b.prototype.getVersion=function(){return"6.26.0-castlabsadsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.m&&this.f&&(this.f.on(this.m,_.Cc,this.S.bind(this)),this.f.on(this.m,_.xc,this.P.bind(this)),this.f.on(this.m,_.tc,this.K.bind(this)),
15
- this.f.on(this.m,_.vc,this.L.bind(this)),this.f.on(this.m,_.lc,this.I.bind(this)),this.f.on(this.m,_.mc,this.o.bind(this,1)),this.f.on(this.m,_.sc,this.o.bind(this,2)),this.f.on(this.m,_.Ac,this.o.bind(this,3)),this.f.on(this.m,_.kc,this.H.bind(this)),this.f.on(this.m,_.wc,this.N.bind(this)),this.f.on(this.m,_.ie,this.J.bind(this)),this.f.on(this.m,_.hc,this.B.bind(this)),this.f.on(this.m,_.ic,this.F.bind(this)),this.f.on(this.m,_.jc,this.G.bind(this)),this.f.on(this.m,_.uc,this.w.bind(this)))};b.prototype.unregisterListeners=
16
- function(){_.li(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.A=!0};b.prototype.S=function(c){this.g.debug(Zw,c);this.j=c.adsTimeline};b.prototype.P=function(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()};b.prototype.I=function(){this.h("ad ended");this.fireStop()};b.prototype.K=function(){this.h("ad pause");this.w();this.firePause()};b.prototype.L=function(){this.h("ad resume");this.w();this.fireResume()};b.prototype.G=function(){this.l=
17
- !0;this.h(Xw);this.fireBufferBegin()};b.prototype.w=function(){this.l&&(this.h(Ww),this.l=!1,this.fireBufferEnd())};b.prototype.o=function(c){this.h("ad quartile",c);this.fireQuartile(c)};b.prototype.H=function(){this.h("ad clicked");var c=this.a&&this.a.zb();this.g.debug(Yw,c);this.fireClick(c)};b.prototype.N=function(){this.h("ad skipped");this.fireSkip()};b.prototype.B=function(c){this.a=c.ad;this.h(Vw,this.a);this.fireBreakStart()};b.prototype.F=function(){this.h("ad break stop");this.fireBreakStop();
18
- if(this.getPosition()===youbora.Constants.AdPosition.Postroll){var c=this.plugin.getAdapter();c&&c.fireStop()}};b.prototype.J=function(c){(c=c.detail)&&10003===c.code&&hx(c,this.m,this.g,this)};b.prototype.h=function(c,d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.g.debug.apply(this.g,[Sw+c+Rw].concat(_.hh(e)))};return new b(a)},lx=function(){function a(){var b=NpawPluginAdapters.video.Shaka.call(this)||this;b.h=!1;b.f=!1;b.a=null;b.G=!1;return b}_.w(a,NpawPluginAdapters.video.Shaka);
6
+ b.prototype.getFramesPerSecond=function(){var c=this.m.getTrackManager();return c&&(c=c.La())?c.frameRate:null};b.prototype.getPlayerName=function(){return _.xa};b.prototype.getVersion=function(){return"6.28.0-castlabsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.m&&this.a&&(this.g.debug("registering listeners"),youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.dg,this.K.bind(this)),this.a.on(this.m,_.je,this.H.bind(this)),this.a.on(this.m,
7
+ _.Hg,this.J.bind(this)),this.a.on(this.m,_.Gg,this.I.bind(this)),this.a.on(this.m,_.Ac,this.F.bind(this)),this.a.on(this.m,_.cd,this.G.bind(this)))};b.prototype.unregisterListeners=function(){this.g.debug(_.Pb);_.wi(this.a)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.B=!0};b.prototype.j=function(){return this.m.getStats()||_.Vt()};b.prototype.w=function(){return!!this.m.getConfiguration().autoplay};b.prototype.K=function(c){c=c.detail;this.l("state change",c);
8
+ if(c)switch(c.currentState){case 1:this.w()&&this.f();break;case 3:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case 4:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.Wt:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();break;default:this.g.debug(Fw,c)}};b.prototype.f=function(){this.plugin.isInitiated||(this.h=!1,this.fireInit())};
9
+ b.prototype.A=function(){var c=this.m.getDrmInfo();c&&(c=Sw(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()};b.prototype.H=function(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=Uw(c,this.m,this.g,this))&&c.severity===_.O&&(this.h=!0)};b.prototype.J=function(){this.m.isEnded()||(this.l(_.Wf),this.f(),this.fireSeekBegin())};b.prototype.I=function(){this.l(_.Vf);this.fireSeekEnd()};b.prototype.F=function(c){this.g.debug("adsTimeline",c);this.o=(c=
10
+ c.adsTimeline)&&c.Nb()};b.prototype.G=function(c){this.g.debug("Casting",c);this.fireCasted()};b.prototype.l=function(c,d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.g.debug.apply(this.g,[Ew+c+Dw].concat(_.jh(e)))};return new b(a)},Ww=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.m=c;d.a=null;d.j=null;d.f=new _.ti;d.g=new _.L("clpp.npaw.YouboraAdsAdapter");d.registerListeners();d.A=!1;d.l=!1;return d}_.w(b,youbora.Adapter);b.prototype.getDuration=function(){return this.a&&
11
+ this.a.getDuration()};b.prototype.getRendition=function(){var c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.lb(),this.a.kb(),this.a.Va()));return c};b.prototype.getBitrate=function(){return this.a&&this.a.Va()};b.prototype.getPlayhead=function(){var c=this.m.getAdsManager();return c&&c.getPosition()};b.prototype.getResource=function(){return this.a&&this.a.getMediaUrl()};b.prototype.getTitle=function(){return this.a&&this.a.getTitle()};b.prototype.getProvider=function(){return this.a&&
12
+ this.a.getAdvertiserName()};b.prototype.getCreativeId=function(){return this.a&&this.a.getCreativeId()};b.prototype.getPosition=function(){var c=youbora.Constants.AdPosition,d=null;if(this.a)switch(this.a.Wa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.debug("Ad position",d);return d};b.prototype.getIsSkippable=function(){return this.a&&-1!==this.a.getSkipTimeOffset()};b.prototype.getAudioEnabled=function(){var c=this.m.getAdsManager();return c&&0<c.getVolume()};
13
+ b.prototype.getExpectedBreaks=function(){return this.j&&this.j.getCuePoints().length};b.prototype.getGivenBreaks=function(){return this.getExpectedBreaks()};b.prototype.getExpectedAds=function(){return this.a&&this.a.nb()};b.prototype.getGivenAds=function(){return this.getExpectedAds()};b.prototype.getBreaksTime=function(){var c=this;return this.j&&this.j.getCuePoints().map(function(d){return-1===d?c.m.getDuration():d})};b.prototype.getIsFullscreen=function(){return this.m.getSurface().isFullscreen()};
14
+ b.prototype.getIsVisible=function(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug(Qw,c);return c};b.prototype.getPlayerName=function(){return _.xa};b.prototype.getVersion=function(){return"6.28.0-castlabsadsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.m&&this.f&&(this.f.on(this.m,_.Ac,this.U.bind(this)),this.f.on(this.m,_.wc,this.P.bind(this)),this.f.on(this.m,_.sc,this.K.bind(this)),
15
+ this.f.on(this.m,_.uc,this.L.bind(this)),this.f.on(this.m,_.jc,this.I.bind(this)),this.f.on(this.m,_.kc,this.o.bind(this,1)),this.f.on(this.m,_.rc,this.o.bind(this,2)),this.f.on(this.m,_.yc,this.o.bind(this,3)),this.f.on(this.m,_.ic,this.H.bind(this)),this.f.on(this.m,_.vc,this.O.bind(this)),this.f.on(this.m,_.je,this.J.bind(this)),this.f.on(this.m,_.fc,this.B.bind(this)),this.f.on(this.m,_.gc,this.F.bind(this)),this.f.on(this.m,_.hc,this.G.bind(this)),this.f.on(this.m,_.tc,this.w.bind(this)))};b.prototype.unregisterListeners=
16
+ function(){_.wi(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.A=!0};b.prototype.U=function(c){this.g.debug(Lw,c);this.j=c.adsTimeline};b.prototype.P=function(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()};b.prototype.I=function(){this.h("ad ended");this.fireStop()};b.prototype.K=function(){this.h("ad pause");this.w();this.firePause()};b.prototype.L=function(){this.h("ad resume");this.w();this.fireResume()};b.prototype.G=function(){this.l=
17
+ !0;this.h(Jw);this.fireBufferBegin()};b.prototype.w=function(){this.l&&(this.h(Iw),this.l=!1,this.fireBufferEnd())};b.prototype.o=function(c){this.h("ad quartile",c);this.fireQuartile(c)};b.prototype.H=function(){this.h("ad clicked");var c=this.a&&this.a.xb();this.g.debug(Kw,c);this.fireClick(c)};b.prototype.O=function(){this.h("ad skipped");this.fireSkip()};b.prototype.B=function(c){this.a=c.ad;this.h(Hw,this.a);this.fireBreakStart()};b.prototype.F=function(){this.h("ad break stop");this.fireBreakStop();
18
+ if(this.getPosition()===youbora.Constants.AdPosition.Postroll){var c=this.plugin.getAdapter();c&&c.fireStop()}};b.prototype.J=function(c){(c=c.detail)&&10003===c.code&&Uw(c,this.m,this.g,this)};b.prototype.h=function(c,d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.g.debug.apply(this.g,[Ew+c+Dw].concat(_.jh(e)))};return new b(a)},Yw=function(){function a(){var b=NpawPluginAdapters.video.Shaka.call(this)||this;b.h=!1;b.f=!1;b.a=null;b.G=!1;return b}_.w(a,NpawPluginAdapters.video.Shaka);
19
19
  a.prototype.getPlayhead=function(){return this.getIsLive()?-1:this.player.getPosition()};a.prototype.getDuration=function(){return this.player.getDuration()};a.prototype.getRendition=function(){var b=null,c=null,d=null,e=this.player.getTrackManager();e&&(e=e.pa())&&(b=e.width,c=e.height,d=e.bandwidth);b&&c&&d||(e=this.j(),b=b||e.width,c=c||e.height,d=d||e.streamBandwidth);return this.getNpawUtils().buildRenditionString(b,c,d)};a.prototype.getIsLive=function(){return this.player.isLive()};a.prototype.getResource=
20
- function(){var b=this.player.getLoadedSource();return b&&b.url};a.prototype.getBitrate=function(){return this.j().streamBandwidth};a.prototype.getThroughput=function(){return this.j().estimatedBandwidth};a.prototype.getPlayrate=function(){return this.player.getPlaybackRate()};a.prototype.getFramesPerSecond=function(){var b=this.player.getTrackManager();return b&&(b=b.Ma())?b.frameRate:null};a.prototype.getPlayerName=function(){return _.xa};a.prototype.getVersion=function(){return"castlabs-adapter-6.26.0-js"};
21
- a.prototype.getPlayerVersion=function(){return _.ia};a.prototype.registerListeners=function(){var b=this.w();this.player&&b&&(b.on(this.player,_.cg,this.N.bind(this)),b.on(this.player,_.ie,this.J.bind(this)),b.on(this.player,_.Vf,this.L.bind(this)),b.on(this.player,_.Uf,this.K.bind(this)),b.on(this.player,_.Cc,this.H.bind(this)),b.on(this.player,_.ed,this.I.bind(this)),b.on(this.player,_.Wc,this.P.bind(this)),b.on(this.player,_.ng,this.S.bind(this)))};a.prototype.unregisterListeners=function(){kx.debug(_.Rb);
22
- _.li(this.w())};a.prototype.dispose=function(){this.unregisterListeners();this.G=!0;this.f=this.h=!1;this.a=null};a.prototype.j=function(){return this.player.getStats()||_.vq()};a.prototype.o=function(){return!!this.player.getConfiguration().autoplay};a.prototype.N=function(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case _.Iq:this.plugin.setVideoOptions({"content.subtitles":this.F()});this.o()&&this.fireStart();break;case _.Kq:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();
23
- break;case _.Jq:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case _.wq:this.fireBufferEnd();this.fireStop();break;case _.Dq:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.Bq:this.fireBufferBegin();break;default:kx.debug(Tw,b)}};a.prototype.A=function(){this.fireJoin()};a.prototype.J=function(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=hx(b,this.player,kx,this))&&b.severity===_.O&&(this.f=!0)};
24
- a.prototype.L=function(){this.player.isEnded()||(this.l(_.Vf),this.fireSeekBegin())};a.prototype.B=function(b){var c=this.player.getTrackManager();if(!c)return null;var d=null;"text"===b&&(d=c.va());b===_.Pc&&(d=c.na());return d?d.language:null};a.prototype.P=function(){var b=this.B(_.Pc);this.plugin.setVideoOptions({"content.language":b})};a.prototype.S=function(){var b=this.B("text"),c=this.F();this.plugin.setVideoOptions({"content.subtitles":b||c})};a.prototype.w=function(){this.a||(this.a=new _.hi);
25
- return this.a};a.prototype.K=function(){this.l(_.Uf);this.fireSeekEnd()};a.prototype.H=function(b){kx.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Qb()};a.prototype.I=function(b){kx.debug("Casting",b);this.fireCasted()};a.prototype.l=function(b,c){for(var d=[],e=1;e<arguments.length;++e)d[e-1]=arguments[e];kx.debug.apply(kx,[Sw+b+Qw].concat(_.hh(d)))};a.prototype.F=function(){var b=this.player.getConfiguration();return b.youbora&&b.youbora.disabledSubtitlesLabel?b.youbora.disabledSubtitlesLabel:
26
- "off"};return a},nx=function(){function a(){var b=NpawPluginAdapters.ads.Ima.call(this)||this;b.a=null;b.l=null;b.h=null;b.j=null;b.F=!1;b.o=!1;return b}_.w(a,NpawPluginAdapters.ads.Ima);a.prototype.getDuration=function(){return this.a?this.a.getDuration():null};a.prototype.getRendition=function(){var b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.ob(),this.a.nb(),this.a.Wa()));return b};a.prototype.getBitrate=function(){var b=null;this.a&&(b=this.a.Wa());return b};a.prototype.getPlayhead=
27
- function(){var b=null,c=this.player.getAdsManager();c&&(b=c.getPosition());return b};a.prototype.getResource=function(){var b=null;this.a&&(b=this.a.getMediaUrl());return b};a.prototype.getTitle=function(){var b=null;this.a&&(b=this.a.getTitle());return b};a.prototype.getProvider=function(){var b=null;this.a&&(b=this.a.getAdvertiserName());return b};a.prototype.getCreativeId=function(){var b=null;this.a&&(b=this.a.getCreativeId());return b};a.prototype.dispose=function(){this.unregisterListeners();
28
- this.F=!0;this.j=this.h=this.a=null};a.prototype.getPosition=function(){var b=this.getNpawReference().Constants.AdPosition,c=null;if(this.a)switch(this.a.Xa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}mx.debug("Ad position",c);return c};a.prototype.getIsSkippable=function(){return this.a&&-1!==this.a.getSkipTimeOffset()};a.prototype.getAudioEnabled=function(){var b=this.player.getAdsManager();return b&&0<b.getVolume()};a.prototype.getExpectedBreaks=function(){return this.h&&
29
- this.h.getCuePoints().length};a.prototype.getGivenBreaks=function(){return this.getExpectedBreaks()};a.prototype.getExpectedAds=function(){return this.a&&this.a.pb()};a.prototype.getGivenAds=function(){return this.getExpectedAds()};a.prototype.getBreaksTime=function(){var b=this;return this.h&&this.h.getCuePoints().map(function(c){return-1===c?b.player.getDuration():c})};a.prototype.getIsFullscreen=function(){return this.player.getSurface().isFullscreen()};a.prototype.getIsVisible=function(){var b=
30
- this.player.getSurface().getContainer();b=this.getNpawUtils().calculateAdViewability(b);mx.debug(dx,b);return b};a.prototype.getPlayerName=function(){return _.xa};a.prototype.getVersion=function(){return"castlabs-ads-adapter-6.26.0-js"};a.prototype.getPlayerVersion=function(){return _.ia};a.prototype.B=function(){this.j||(this.j=new _.hi);return this.j};a.prototype.registerListeners=function(){var b=this.B();this.player&&b&&(b.on(this.player,_.Cc,this.ca.bind(this)),b.on(this.player,_.xc,this.Y.bind(this)),
31
- b.on(this.player,_.tc,this.N.bind(this)),b.on(this.player,_.vc,this.P.bind(this)),b.on(this.player,_.lc,this.K.bind(this)),b.on(this.player,_.mc,this.w.bind(this,1)),b.on(this.player,_.sc,this.w.bind(this,2)),b.on(this.player,_.Ac,this.w.bind(this,3)),b.on(this.player,_.kc,this.J.bind(this)),b.on(this.player,_.wc,this.S.bind(this)),b.on(this.player,_.ie,this.L.bind(this)),b.on(this.player,_.hc,this.G.bind(this)),b.on(this.player,_.ic,this.H.bind(this)),b.on(this.player,_.jc,this.I.bind(this)),b.on(this.player,
32
- _.uc,this.da.bind(this)))};a.prototype.unregisterListeners=function(){_.li(this.B())};a.prototype.ca=function(b){mx.debug(Zw,b);this.h=b.adsTimeline};a.prototype.Y=function(b){this.a=b.ad;this.f("ad start",this.a);this.fireStart();this.fireJoin()};a.prototype.K=function(){this.f("ad ended");this.fireStop({adPlayhead:this.l})};a.prototype.N=function(){this.f("ad pause");this.A();this.firePause()};a.prototype.P=function(){this.f("ad resume");this.A();this.fireResume()};a.prototype.I=function(){this.o=
33
- !0;this.f(Xw);this.fireBufferBegin()};a.prototype.da=function(){this.l=this.getPlayhead();this.A()};a.prototype.A=function(){this.o&&(this.f(Ww),this.o=!1,this.fireBufferEnd())};a.prototype.w=function(b){this.f("ad quartile",b);this.fireQuartile(b)};a.prototype.J=function(){this.f("ad clicked");var b=this.a&&this.a.zb();mx.debug(Yw,b);this.fireClick(b)};a.prototype.S=function(){this.f("ad skipped");this.fireSkip()};a.prototype.G=function(b){this.a=b.ad;this.f(Vw,this.a);this.fireBreakStart()};a.prototype.H=
34
- function(){this.f("ad break stop");this.fireBreakStop({adPlayhead:this.l});this.getPosition()===this.getNpawReference().Constants.AdPosition.Postroll&&this.fireStop({adPlayhead:this.l})};a.prototype.L=function(b){(b=b.detail)&&10003===b.code&&hx(b,this.player,mx,this)};a.prototype.f=function(b,c){for(var d=[],e=1;e<arguments.length;++e)d[e-1]=arguments[e];mx.debug.apply(mx,[Sw+b+Qw].concat(_.hh(d)))};return a},ox=function(){this.a=null;this.g=new _.J($w);this.m=null},px=function(a,b){if(b.namespace()===
35
- _.sd)return a.g.info("NPAW does not report when casting."),!1;var c=b.getConfiguration().youbora;return _.L.qg(c)?c.accountCode?_.L.R(window.NpawPlugin)||_.L.R(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.N(1,9,9100)),!1):!0:(a.g.warn(Uw),b.onError(new _.N(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},qx=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},rx=function(){this.a=
36
- null;this.g=new _.J(ax);this.m=null},sx=function(a,b){if(b.namespace()===_.sd)return a.g.info("Youbora does not report when casting."),!1;var c=b.getConfiguration().youbora;if(!_.L.qg(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.g.warn(Uw),b.onError(new _.N(1,9,9101)),!1;if(_.L.R(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.N(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found version "+
37
- (youbora.VERSION+". Some or all features of YouboraPlugin may not work correctly.")),b.onError(new _.N(1,9,9102)));return!0},tx=function(){};var kx=new _.J("clpp.npaw.NpawAdapter");var mx=new _.J("clpp.npaw.NpawAdsAdapter");_.w(ox,_.ew);_.r=ox.prototype;_.r.Qg=function(a){qx(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,lx()),this.a.registerAdsAdapterFromClass(this.m,nx())};_.r.am=function(){return this.a};_.r.getAdapter=function(){return this.a&&this.a.getAdapter()};_.r.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.r.onPlayerCreated=function(a){this.m=a;px(this,a)&&(a=a.getConfiguration().youbora,this.Qg(new NpawPlugin(a.accountCode)))};
38
- _.r.onContentWillLoad=function(a,b){if(px(this,a)){var c=a.getConfiguration(),d=c.youbora;void 0===d[bx]&&(d[bx]=b.isLive);void 0===d[cx]&&(d[cx]=b.name);void 0===d.viewerId&&(d.viewerId=c.viewerId);this.a||this.Qg(new NpawPlugin(d.accountCode));this.a.setAnalyticsOptions(d)}};_.r.onContentLoaded=function(a){var b={};(a=a.getDrmInfo())&&(a=fx(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Ue,b);this.a.setAnalyticsOptions(b)};_.r.onPlayerWillRelease=function(){};
39
- _.r.onPlayerWillDestroy=function(){qx(this);this.a.destroy()};_.r.id=function(){return ex};_.I($w,ox);ox.prototype.getAdsAdapter=ox.prototype.getAdsAdapter;ox.prototype.getAdapter=ox.prototype.getAdapter;ox.prototype.getNpawPlugin=ox.prototype.am;ox.prototype.setNpawPlugin=ox.prototype.Qg;ox.Id=ex;new _.J($w);_.w(rx,_.ew);_.r=rx.prototype;_.r.Rg=function(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(ix(this.m)),this.a.setAdsAdapter(jx(this.m))};_.r.getAdapter=function(){return this.a&&this.a.getAdapter()};_.r.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.r.onPlayerCreated=function(a){this.m=a;sx(this,a)&&(a=a.getConfiguration().youbora,this.Rg(new youbora.Plugin(a)))};
40
- _.r.onContentWillLoad=function(a,b){if(sx(this,a)){var c=a.getConfiguration(),d=c.youbora;void 0===d[bx]&&(d[bx]=b.isLive);void 0===d[cx]&&(d[cx]=b.name);void 0===d.viewerId&&(d.viewerId=c.viewerId);this.a||this.Rg(new youbora.Plugin(d));this.a.setOptions(d)}};_.r.onPlayerWillRelease=function(){};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return ex};_.I(ax,rx);rx.prototype.getAdsAdapter=rx.prototype.getAdsAdapter;rx.prototype.getAdapter=rx.prototype.getAdapter;
41
- rx.prototype.setYouboraPlugin=rx.prototype.Rg;rx.Id=ex;tx.prototype.create=function(a){return a.youbora&&a.youbora.v7?new ox:new rx};_.bu(new tx);};
20
+ function(){var b=this.player.getLoadedSource();return b&&b.url};a.prototype.getBitrate=function(){return this.j().streamBandwidth};a.prototype.getThroughput=function(){return this.j().estimatedBandwidth};a.prototype.getPlayrate=function(){return this.player.getPlaybackRate()};a.prototype.getFramesPerSecond=function(){var b=this.player.getTrackManager();return b&&(b=b.La())?b.frameRate:null};a.prototype.getPlayerName=function(){return _.xa};a.prototype.getVersion=function(){return"castlabs-adapter-6.28.0-js"};
21
+ a.prototype.getPlayerVersion=function(){return _.ia};a.prototype.registerListeners=function(){var b=this.w();this.player&&b&&(b.on(this.player,_.dg,this.O.bind(this)),b.on(this.player,_.je,this.J.bind(this)),b.on(this.player,_.Wf,this.L.bind(this)),b.on(this.player,_.Vf,this.K.bind(this)),b.on(this.player,_.Ac,this.H.bind(this)),b.on(this.player,_.cd,this.I.bind(this)),b.on(this.player,_.Uc,this.P.bind(this)),b.on(this.player,_.pg,this.U.bind(this)))};a.prototype.unregisterListeners=function(){Xw.debug(_.Pb);
22
+ _.wi(this.w())};a.prototype.dispose=function(){this.unregisterListeners();this.G=!0;this.f=this.h=!1;this.a=null};a.prototype.j=function(){return this.player.getStats()||_.Vt()};a.prototype.o=function(){return!!this.player.getConfiguration().autoplay};a.prototype.O=function(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case 1:this.plugin.setVideoOptions({"content.subtitles":this.F()});this.o()&&this.fireStart();break;case 3:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();
23
+ break;case 4:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case _.Wt:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();break;default:Xw.debug(Fw,b)}};a.prototype.A=function(){this.fireJoin()};a.prototype.J=function(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=Uw(b,this.player,Xw,this))&&b.severity===_.O&&(this.f=!0)};a.prototype.L=
24
+ function(){this.player.isEnded()||(this.l(_.Wf),this.fireSeekBegin())};a.prototype.B=function(b){var c=this.player.getTrackManager();if(!c)return null;var d=null;b===_.mg&&(d=c.va());b===_.Nc&&(d=c.na());return d?d.language:null};a.prototype.P=function(){var b=this.B(_.Nc);this.plugin.setVideoOptions({"content.language":b})};a.prototype.U=function(){var b=this.B(_.mg),c=this.F();this.plugin.setVideoOptions({"content.subtitles":b||c})};a.prototype.w=function(){this.a||(this.a=new _.ti);return this.a};
25
+ a.prototype.K=function(){this.l(_.Vf);this.fireSeekEnd()};a.prototype.H=function(b){Xw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Nb()};a.prototype.I=function(b){Xw.debug("Casting",b);this.fireCasted()};a.prototype.l=function(b,c){for(var d=[],e=1;e<arguments.length;++e)d[e-1]=arguments[e];Xw.debug.apply(Xw,[Ew+b+Cw].concat(_.jh(d)))};a.prototype.F=function(){var b=this.player.getConfiguration();return b.youbora&&b.youbora.disabledSubtitlesLabel?b.youbora.disabledSubtitlesLabel:"off"};return a},
26
+ $w=function(){function a(){var b=NpawPluginAdapters.ads.Ima.call(this)||this;b.a=null;b.l=null;b.h=null;b.j=null;b.F=!1;b.o=!1;return b}_.w(a,NpawPluginAdapters.ads.Ima);a.prototype.getDuration=function(){return this.a?this.a.getDuration():null};a.prototype.getRendition=function(){var b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.lb(),this.a.kb(),this.a.Va()));return b};a.prototype.getBitrate=function(){var b=null;this.a&&(b=this.a.Va());return b};a.prototype.getPlayhead=function(){var b=
27
+ null,c=this.player.getAdsManager();c&&(b=c.getPosition());return b};a.prototype.getResource=function(){var b=null;this.a&&(b=this.a.getMediaUrl());return b};a.prototype.getTitle=function(){var b=null;this.a&&(b=this.a.getTitle());return b};a.prototype.getProvider=function(){var b=null;this.a&&(b=this.a.getAdvertiserName());return b};a.prototype.getCreativeId=function(){var b=null;this.a&&(b=this.a.getCreativeId());return b};a.prototype.dispose=function(){this.unregisterListeners();this.F=!0;this.j=
28
+ this.h=this.a=null};a.prototype.getPosition=function(){var b=this.getNpawReference().Constants.AdPosition,c=null;if(this.a)switch(this.a.Wa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}Zw.debug("Ad position",c);return c};a.prototype.getIsSkippable=function(){return this.a&&-1!==this.a.getSkipTimeOffset()};a.prototype.getAudioEnabled=function(){var b=this.player.getAdsManager();return b&&0<b.getVolume()};a.prototype.getExpectedBreaks=function(){return this.h&&this.h.getCuePoints().length};
29
+ a.prototype.getGivenBreaks=function(){return this.getExpectedBreaks()};a.prototype.getExpectedAds=function(){return this.a&&this.a.nb()};a.prototype.getGivenAds=function(){return this.getExpectedAds()};a.prototype.getBreaksTime=function(){var b=this;return this.h&&this.h.getCuePoints().map(function(c){return-1===c?b.player.getDuration():c})};a.prototype.getIsFullscreen=function(){return this.player.getSurface().isFullscreen()};a.prototype.getIsVisible=function(){var b=this.player.getSurface().getContainer();
30
+ b=this.getNpawUtils().calculateAdViewability(b);Zw.debug(Qw,b);return b};a.prototype.getPlayerName=function(){return _.xa};a.prototype.getVersion=function(){return"castlabs-ads-adapter-6.28.0-js"};a.prototype.getPlayerVersion=function(){return _.ia};a.prototype.B=function(){this.j||(this.j=new _.ti);return this.j};a.prototype.registerListeners=function(){var b=this.B();this.player&&b&&(b.on(this.player,_.Ac,this.da.bind(this)),b.on(this.player,_.wc,this.Z.bind(this)),b.on(this.player,_.sc,this.O.bind(this)),
31
+ b.on(this.player,_.uc,this.P.bind(this)),b.on(this.player,_.jc,this.K.bind(this)),b.on(this.player,_.kc,this.w.bind(this,1)),b.on(this.player,_.rc,this.w.bind(this,2)),b.on(this.player,_.yc,this.w.bind(this,3)),b.on(this.player,_.ic,this.J.bind(this)),b.on(this.player,_.vc,this.U.bind(this)),b.on(this.player,_.je,this.L.bind(this)),b.on(this.player,_.fc,this.G.bind(this)),b.on(this.player,_.gc,this.H.bind(this)),b.on(this.player,_.hc,this.I.bind(this)),b.on(this.player,_.tc,this.fa.bind(this)))};
32
+ a.prototype.unregisterListeners=function(){_.wi(this.B())};a.prototype.da=function(b){Zw.debug(Lw,b);this.h=b.adsTimeline};a.prototype.Z=function(b){this.a=b.ad;this.f("ad start",this.a);this.fireStart();this.fireJoin()};a.prototype.K=function(){this.f("ad ended");this.fireStop({adPlayhead:this.l})};a.prototype.O=function(){this.f("ad pause");this.A();this.firePause()};a.prototype.P=function(){this.f("ad resume");this.A();this.fireResume()};a.prototype.I=function(){this.o=!0;this.f(Jw);this.fireBufferBegin()};
33
+ a.prototype.fa=function(){this.l=this.getPlayhead();this.A()};a.prototype.A=function(){this.o&&(this.f(Iw),this.o=!1,this.fireBufferEnd())};a.prototype.w=function(b){this.f("ad quartile",b);this.fireQuartile(b)};a.prototype.J=function(){this.f("ad clicked");var b=this.a&&this.a.xb();Zw.debug(Kw,b);this.fireClick(b)};a.prototype.U=function(){this.f("ad skipped");this.fireSkip()};a.prototype.G=function(b){this.a=b.ad;this.f(Hw,this.a);this.fireBreakStart()};a.prototype.H=function(){this.f("ad break stop");
34
+ this.fireBreakStop({adPlayhead:this.l});this.getPosition()===this.getNpawReference().Constants.AdPosition.Postroll&&this.fireStop({adPlayhead:this.l})};a.prototype.L=function(b){(b=b.detail)&&10003===b.code&&Uw(b,this.player,Zw,this)};a.prototype.f=function(b,c){for(var d=[],e=1;e<arguments.length;++e)d[e-1]=arguments[e];Zw.debug.apply(Zw,[Ew+b+Cw].concat(_.jh(d)))};return a},ax=function(){this.a=null;this.g=new _.L(Mw);this.m=null},bx=function(a,b){if(b.namespace()===_.qd)return a.g.info("NPAW does not report when casting."),
35
+ !1;var c=b.getConfiguration().youbora;return _.M.pg(c)?c.accountCode?_.M.R(window.NpawPlugin)||_.M.R(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.N(1,9,9100)),!1):!0:(a.g.warn(Gw),b.onError(new _.N(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},cx=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},dx=function(){this.a=null;this.g=new _.L(Nw);this.m=null},ex=function(a,b){if(b.namespace()===
36
+ _.qd)return a.g.info("Youbora does not report when casting."),!1;var c=b.getConfiguration().youbora;if(!_.M.pg(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.g.warn(Gw),b.onError(new _.N(1,9,9101)),!1;if(_.M.R(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.N(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found version "+(youbora.VERSION+
37
+ ". Some or all features of YouboraPlugin may not work correctly.")),b.onError(new _.N(1,9,9102)));return!0},fx=function(){};var Xw=new _.L("clpp.npaw.NpawAdapter");var Zw=new _.L("clpp.npaw.NpawAdsAdapter");_.w(ax,_.Tv);_.r=ax.prototype;_.r.Og=function(a){cx(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,Yw()),this.a.registerAdsAdapterFromClass(this.m,$w())};_.r.am=function(){return this.a};_.r.getAdapter=function(){return this.a&&this.a.getAdapter()};_.r.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.r.onPlayerCreated=function(a){this.m=a;bx(this,a)&&(a=a.getConfiguration().youbora,this.Og(new NpawPlugin(a.accountCode)))};
38
+ _.r.onContentWillLoad=function(a,b){if(bx(this,a)){var c=a.getConfiguration(),d=c.youbora;void 0===d[Ow]&&(d[Ow]=b.isLive);void 0===d[Pw]&&(d[Pw]=b.name);void 0===d.viewerId&&(d.viewerId=c.viewerId);this.a||this.Og(new NpawPlugin(d.accountCode));this.a.setAnalyticsOptions(d)}};_.r.onContentLoaded=function(a){var b={};(a=a.getDrmInfo())&&(a=Sw(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Ue,b);this.a.setAnalyticsOptions(b)};_.r.onPlayerWillRelease=function(){};
39
+ _.r.onPlayerWillDestroy=function(){cx(this);this.a.destroy()};_.r.id=function(){return Rw};_.K(Mw,ax);ax.prototype.getAdsAdapter=ax.prototype.getAdsAdapter;ax.prototype.getAdapter=ax.prototype.getAdapter;ax.prototype.getNpawPlugin=ax.prototype.am;ax.prototype.setNpawPlugin=ax.prototype.Og;ax.Id=Rw;new _.L(Mw);_.w(dx,_.Tv);_.r=dx.prototype;_.r.Pg=function(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Vw(this.m)),this.a.setAdsAdapter(Ww(this.m))};_.r.getAdapter=function(){return this.a&&this.a.getAdapter()};_.r.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.r.onPlayerCreated=function(a){this.m=a;ex(this,a)&&(a=a.getConfiguration().youbora,this.Pg(new youbora.Plugin(a)))};
40
+ _.r.onContentWillLoad=function(a,b){if(ex(this,a)){var c=a.getConfiguration(),d=c.youbora;void 0===d[Ow]&&(d[Ow]=b.isLive);void 0===d[Pw]&&(d[Pw]=b.name);void 0===d.viewerId&&(d.viewerId=c.viewerId);this.a||this.Pg(new youbora.Plugin(d));this.a.setOptions(d)}};_.r.onPlayerWillRelease=function(){};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return Rw};_.K(Nw,dx);dx.prototype.getAdsAdapter=dx.prototype.getAdsAdapter;dx.prototype.getAdapter=dx.prototype.getAdapter;
41
+ dx.prototype.setYouboraPlugin=dx.prototype.Pg;dx.Id=Rw;fx.prototype.create=function(a){return a.youbora&&a.youbora.v7?new ax:new dx};_.To(new fx);};
42
42
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
43
43
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
44
44
  else{_=this.clpp._;(f.call(g,this));}