@castlabs/prestoplay 6.4.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +419 -416
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +26 -26
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +47 -47
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +258 -255
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +354 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +26 -26
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -39
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +230 -231
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -16
  58. package/package.json +6 -2
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Qr="VerimatrixVCAS",Rr="clpp.verimatrix.Vcas",Sr="clpp.verimatrix.VcasComponent",ds=function(a){_.rk.call(this,Qr);var b={};b[Tr]=Tr;b[Ur]=Ur;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Vr: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?Wr:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=Xr(this,e);this.o=Xr(this,f);this.m=Xr(this,g);this.j=h;this.G=l;this.D=m;this.f=new _.H(Rr);_.yh(this.w)?this.f.warn(_.Cb):this.Ka(_.Pc,{licenseUrl:this.w,videoRobustness:[_.nb,void 0],audioRobustness:[_.mb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.yh(this.o)?this.f.warn(_.db):this.Ka(_.Oc,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.yh(this.m)?this.f.warn(_.Ja):_.yh(this.j)?this.f.warn(_.Ia):this.Ka(_.Nc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Xr=function(a,b){if(a.C===Vr){var c=Object.assign({},{deviceId:_.bk(_.uh(a.A))},a.a&&{authenticator:_.bk(_.uh(a.a))});return b+_.oi(c)}return b},ls=function(){this.l=null;this.a=new _.H(Sr)};_.v(ds,_.rk);
5
- ds.prototype.h=function(a,b){if(this.C===ms){var c=this.B[Ur],d={};d[this.B[Tr]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};ds.prototype.I=function(a,b){var c=_.Ok(b);switch(this.D){case ns:c=_.oi({r:c,uk:this.G},!0)}return c};ds.prototype.K=function(a,b){this.h(a,b);_.Rk(b)};ds.prototype.L=function(a,b){_.Sk(b)};_.B(Rr,ds);ds.prototype.constructor=ds.prototype.constructor;ds.NAME=Qr;var Vr="query-string",ms="http-header";
6
- ds.LicenseRequestVuidLocation={QUERY_STRING:Vr,HTTP_HEADER:ms};var Tr="DeviceId",Ur="Authenticator";ds.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Tr,AUTHENTICATOR_HEADER:Ur};var Wr="keyid",ns="contentid-siteid";ds.FairPlayAssetIdStrategy={KEYID:Wr,CONTENTID_SITEID:ns};_.v(ls,_.zo);_.t=ls.prototype;_.t.Ja=function(a){this.l=a};_.t.Ca=function(){this.l=null};_.t.Wb=function(){var a=this.l.getConfiguration();if(a.drm&&a.drm.env===Qr){a=a.drm.customData;if(!a)throw new _.L(_.M,7,7100,_.Qc);a=new ds(a);this.a.info("Registering the Verimatrix VCAS Ultra environment");_.mk(a)}};_.t.release=function(){};_.t.id=function(){return"verimatrix-vcas"};_.B(Sr,ls);};
2
+ var f=function(window){var Ur="VerimatrixVCAS",Vr="clpp.verimatrix.Vcas",Wr="clpp.verimatrix.VcasComponent",os=function(a){_.sk.call(this,Ur);var b={};b[Xr]=Xr;b[Yr]=Yr;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Zr: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?fs:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.D=d;this.B=b;this.w=ns(this,e);this.o=ns(this,f);this.m=ns(this,g);this.j=h;this.I=l;this.F=m;this.f=new _.H(Vr);_.zh(this.w)?this.f.warn(_.Cb):this.Ka(_.Qc,{licenseUrl:this.w,videoRobustness:[_.nb,void 0],audioRobustness:[_.mb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.zh(this.o)?this.f.warn(_.db):this.Ka(_.Pc,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.zh(this.m)?this.f.warn(_.Ka):_.zh(this.j)?this.f.warn(_.Ja):this.Ka(_.Oc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.L.bind(this),licenseResponse:this.N.bind(this),extractContentId:this.J.bind(this)}})},ns=function(a,b){if(a.D===Zr){var c=Object.assign({},{deviceId:_.ck(_.vh(a.A))},a.a&&{authenticator:_.ck(_.vh(a.a))});return b+_.pi(c)}return b},ps=function(){this.l=null;this.a=new _.H(Wr)};_.v(os,_.sk);
5
+ os.prototype.h=function(a,b){if(this.D===qs){var c=this.B[Yr],d={};d[this.B[Xr]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};os.prototype.J=function(a,b){var c=_.Pk(b);switch(this.F){case rs:c=_.pi({r:c,xk:this.I},!0)}return c};os.prototype.L=function(a,b){this.h(a,b);_.Sk(b)};os.prototype.N=function(a,b){_.Tk(b)};_.C(Vr,os);os.prototype.constructor=os.prototype.constructor;os.NAME=Ur;var Zr="query-string",qs="http-header";
6
+ os.LicenseRequestVuidLocation={QUERY_STRING:Zr,HTTP_HEADER:qs};var Xr="DeviceId",Yr="Authenticator";os.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Xr,AUTHENTICATOR_HEADER:Yr};var fs="keyid",rs="contentid-siteid";os.FairPlayAssetIdStrategy={KEYID:fs,CONTENTID_SITEID:rs};_.v(ps,_.Bo);_.t=ps.prototype;_.t.Ja=function(a){this.l=a};_.t.Ca=function(){this.l=null};_.t.Yb=function(){var a=this.l.getConfiguration();if(a.drm&&a.drm.env===Ur){a=a.drm.customData;if(!a)throw new _.L(_.M,7,7100,_.Rc);a=new os(a);this.a.info("Registering the Verimatrix VCAS Ultra environment");_.nk(a)}};_.t.release=function(){};_.t.id=function(){return"verimatrix-vcas"};_.C(Wr,ps);};
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,17 +1,17 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Gr="Registering listeners",Hr="clpp.vimond.VimondPlugin",Ir=function(a,b,c,d,e){this.D=a;this.G=b;this.I=c;this.l=d;this.C=e;this.f=new _.cg;this.m=!0;this.g=this.j=this.A=!1;this.B=null;this.h=new _.Li(this.Df.bind(this));this.a=new _.H("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.l&&this.f&&(this.a.debug(Gr),this.f.on(this.l,_.pe,this.Ph.bind(this)),this.f.on(this.l,_.De,this.Qh.bind(this)),this.f.on(this.l,_.Fb,this.Nh.bind(this)),this.f.on(this.l,_.Gb,this.Oh.bind(this)))},Jr=function(a,
3
- b){a.l.trigger(new _.I(_.Ue,{detail:b}))},Kr=function(a,b,c){b&&(a.A=!0,a.h.stop());a.l.onError(new _.L(b?_.M:1,9,9201,c))},Lr=function(a,b,c,d,e){this.o=a;this.m=c;this.g=b;this.a=d;this.j=e;this.h=new _.H("clpp.vimond.VimondService");this.f=0},Mr=function(a){this.l=a;this.a=new _.cg;this.g=new _.H("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.l&&this.a&&(this.g.debug(Gr),this.a.on(this.l,_.de,this.jj.bind(this)),this.a.on(this.l,_.Fb,this.Lh.bind(this)),this.a.on(this.l,_.Gb,this.Mh.bind(this)))},
4
- Nr=function(a,b){var c=a.l.getState();if(1===b)return["str-start",_.Xd];if(a.h)return[_.dd,_.Sd];if(c===_.Vm)return[_.dd,null];if(c===_.Zm)return[_.fd,_.Sd];var d=_.Sd;if(c===_.Tm||c===_.bn||a.f)d=_.Xd;return["period",d]},Or=function(){this.a=!1;this.h=new _.H(Hr);this.j=this.g=this.f=null},Pr=function(){};_.t=Ir.prototype;_.t.Qh=function(){this.g||(this.g=1<Math.abs(this.w-this.l.getPosition()));this.w=this.l.getPosition()};_.t.Nh=function(){this.a.debug("Ad break started");this.j=!0};
5
- _.t.Oh=function(){this.a.debug("Ad break stopped");this.j=!1};
6
- _.t.Ph=function(a){var b=this,c,d,e,f,g;return _.A(function(h){if(1==h.a){c=a.detail;d=_.Xm;e=c.currentState;f=c.previousState;b.a.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.g)return b.a.debug("Ignore transition"),h["return"]();if(b.m&&e!==d.PLAYING)return h["return"]();if(b.g&&[d.PAUSED,d.BUFFERING].includes(e))return b.a.debug("Seeking"),h["return"]();b.g&&e===d.PLAYING&&(b.a.debug("Seeked"),b.g=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.H(0);
7
- b.B=e;return _.y(h,b.Df(),3)}e===d.ENDED&&b.h.stop();_.z(h)})};
8
- _.t.Df=function(){var a=this,b,c,d,e,f,g;return _.A(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.a.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.Z(a.m?10:a.D);a.m=!1;_.xf(h,2);l=a.C;l.f++;var m=_.J.Va(l.m);m.client.buildName=_.ta;m.client.buildVersion=_.ia;var n=m.client,p=l.a.l.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.l.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
- l.a.l.getLoadedSource().type||"";n=m.client;p=l.a.l.getLoadedSource();p=((new _.mi(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Nr(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.l.getPresentationStartTime()||0;p=Math.floor(q+p.l.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.l.getPosition();q=q.l.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
- typeof n.liveResumePossible!==_.rc&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.h.debug("Fire an event");n=_.Hh(l.o);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.g;n.body=_.uh(JSON.stringify(m));l=l.j.fetch(n).P;return _.y(h,l,4)}if(2!=h.a)return b=h.f,Jr(a,b),_.yf(h,0);d=c=_.zf(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.a.debug("Unreachable service"),Jr(a,f),Kr(a,a.G,f)):1001===e?(a.a.debug("Generic service error"),
11
- Jr(a,f),Kr(a,a.I,f)):a.a.error(c.toString());_.z(h)})};_.t.dispose=function(){this.a.debug(_.yb);_.fg(this.f);this.h.stop()};Lr.prototype.df=function(a){this.g=a};_.t=Mr.prototype;_.t.getPosition=function(){return Math.floor(this.l.getPosition())};_.t.jj=function(){this.h=!0};_.t.Lh=function(){this.f=!0};_.t.Mh=function(){this.f=!1};_.t.dispose=function(){this.g.debug(_.yb);_.fg(this.a)};_.v(Or,_.cq);_.t=Or.prototype;_.t.onPlayerCreated=function(){};
12
- _.t.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.J.R(b.vimond)&&typeof b.vimond===_.Id)?a.namespace()===_.Fc&&(this.a=!1,this.h.info("Vimond does not report when casting.")):this.h.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.u(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.h.warn(d+" key is missing");a.onError(new _.L(1,9,9200));return}this.h.debug("Configuration is valid");
13
- c=b.failIfUnreachable;typeof c!==_.rc&&(c=!0);d=b.failOnError;typeof d!==_.rc&&(d=!0);this.f=new Mr(a);this.g=new Lr(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Ir(b.playerEventRequest.eventInterval,c,d,a,this.g)}};_.t.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.g=this.f=null)};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"vimond"};
14
- _.t.df=function(a){this.a&&this.g&&this.g.df(a)};_.B(Hr,Or);Or.prototype.updateAuthToken=Or.prototype.df;Or.Id="vimond";Pr.prototype.create=function(){return new Or};_.uo(new Pr);};
2
+ var f=function(window){var Kr="Registering listeners",Lr="clpp.vimond.VimondPlugin",Mr=function(a,b,c,d,e){this.F=a;this.I=b;this.J=c;this.l=d;this.D=e;this.f=new _.dg;this.m=!0;this.g=this.j=this.A=!1;this.B=null;this.h=new _.Ni(this.Ff.bind(this));this.a=new _.H("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.l&&this.f&&(this.a.debug(Kr),this.f.on(this.l,_.re,this.Rh.bind(this)),this.f.on(this.l,_.Ee,this.Sh.bind(this)),this.f.on(this.l,_.Fb,this.Ph.bind(this)),this.f.on(this.l,_.Gb,this.Qh.bind(this)))},Nr=function(a,
3
+ b){a.l.trigger(new _.J(_.Ve,{detail:b}))},Or=function(a,b,c){b&&(a.A=!0,a.h.stop());a.l.onError(new _.L(b?_.M:1,9,9201,c))},Pr=function(a,b,c,d,e){this.o=a;this.m=c;this.g=b;this.a=d;this.j=e;this.h=new _.H("clpp.vimond.VimondService");this.f=0},Qr=function(a){this.l=a;this.a=new _.dg;this.g=new _.H("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.l&&this.a&&(this.g.debug(Kr),this.a.on(this.l,_.ee,this.kj.bind(this)),this.a.on(this.l,_.Fb,this.Nh.bind(this)),this.a.on(this.l,_.Gb,this.Oh.bind(this)))},
4
+ Rr=function(a,b){var c=a.l.getState();if(1===b)return["str-start",_.Yd];if(a.h)return[_.ed,_.Td];if(c===_.Wm)return[_.ed,null];if(c===_.$m)return[_.gd,_.Td];var d=_.Td;if(c===_.Um||c===_.cn||a.f)d=_.Yd;return["period",d]},Sr=function(){this.a=!1;this.h=new _.H(Lr);this.j=this.g=this.f=null},Tr=function(){};_.t=Mr.prototype;_.t.Sh=function(){this.g||(this.g=1<Math.abs(this.w-this.l.getPosition()));this.w=this.l.getPosition()};_.t.Ph=function(){this.a.debug("Ad break started");this.j=!0};
5
+ _.t.Qh=function(){this.a.debug("Ad break stopped");this.j=!1};
6
+ _.t.Rh=function(a){var b=this,c,d,e,f,g;return _.B(function(h){if(1==h.a){c=a.detail;d=_.Ym;e=c.currentState;f=c.previousState;b.a.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.g)return b.a.debug("Ignore transition"),h["return"]();if(b.m&&e!==d.PLAYING)return h["return"]();if(b.g&&[d.PAUSED,d.BUFFERING].includes(e))return b.a.debug("Seeking"),h["return"]();b.g&&e===d.PLAYING&&(b.a.debug("Seeked"),b.g=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.H(0);
7
+ b.B=e;return _.x(h,b.Ff(),3)}e===d.ENDED&&b.h.stop();_.z(h)})};
8
+ _.t.Ff=function(){var a=this,b,c,d,e,f,g;return _.B(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.a.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.Z(a.m?10:a.F);a.m=!1;_.yf(h,2);l=a.D;l.f++;var m=_.K.Wa(l.m);m.client.buildName=_.ta;m.client.buildVersion=_.ea;var n=m.client,p=l.a.l.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.l.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
+ l.a.l.getLoadedSource().type||"";n=m.client;p=l.a.l.getLoadedSource();p=((new _.ni(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Rr(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.l.getPresentationStartTime()||0;p=Math.floor(q+p.l.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.l.getPosition();q=q.l.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
+ typeof n.liveResumePossible!==_.rc&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.h.debug("Fire an event");n=_.Ih(l.o);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.g;n.body=_.vh(JSON.stringify(m));l=l.j.fetch(n).P;return _.x(h,l,4)}if(2!=h.a)return b=h.f,Nr(a,b),_.zf(h,0);d=c=_.Af(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.a.debug("Unreachable service"),Nr(a,f),Or(a,a.I,f)):1001===e?(a.a.debug("Generic service error"),
11
+ Nr(a,f),Or(a,a.J,f)):a.a.error(c.toString());_.z(h)})};_.t.dispose=function(){this.a.debug(_.yb);_.gg(this.f);this.h.stop()};Pr.prototype.ff=function(a){this.g=a};_.t=Qr.prototype;_.t.getPosition=function(){return Math.floor(this.l.getPosition())};_.t.kj=function(){this.h=!0};_.t.Nh=function(){this.f=!0};_.t.Oh=function(){this.f=!1};_.t.dispose=function(){this.g.debug(_.yb);_.gg(this.a)};_.v(Sr,_.eq);_.t=Sr.prototype;_.t.onPlayerCreated=function(){};
12
+ _.t.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.K.S(b.vimond)&&typeof b.vimond===_.Jd)?a.namespace()===_.Gc&&(this.a=!1,this.h.info("Vimond does not report when casting.")):this.h.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.u(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.h.warn(d+" key is missing");a.onError(new _.L(1,9,9200));return}this.h.debug("Configuration is valid");
13
+ c=b.failIfUnreachable;typeof c!==_.rc&&(c=!0);d=b.failOnError;typeof d!==_.rc&&(d=!0);this.f=new Qr(a);this.g=new Pr(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Mr(b.playerEventRequest.eventInterval,c,d,a,this.g)}};_.t.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.g=this.f=null)};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"vimond"};
14
+ _.t.ff=function(a){this.a&&this.g&&this.g.ff(a)};_.C(Lr,Sr);Sr.prototype.updateAuthToken=Sr.prototype.ff;Sr.Id="vimond";Tr.prototype.create=function(){return new Sr};_.wo(new Tr);};
15
15
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
16
16
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
17
17
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vr.js CHANGED
@@ -1,23 +1,24 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var lr="touchmove",mr="touchstart",nr=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},or=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)},pr=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new nr(a/d*e,b/d*e,0/d*e,Math.cos(c))},qr=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},rr=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
3
- b):(a.x=0,a.y=0,a.a=0)},sr=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},tr=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},ur=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},vr=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},wr=function(a){var b=new qr(0,0,0),c=new qr(0,0,1),d=new qr,e=new qr,f=new qr;a=a.a;var g=new qr(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();rr(f,1/g);c=tr(d,c,f);g=c.length();rr(c,1/g);tr(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-sr(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-sr(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-sr(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},yr=function(a){this.a=a;this.f=a.createProgram();this.j=
5
- xr(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.h=xr(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.j);a.attachShader(this.f,this.h);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 _.L(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)},xr=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 _.L(1,
7
- 9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},zr=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.g=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)},Ar=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)},Br=function(){var a=this;this.o=this.w=this.L=this.J=this.A=
10
- this.U=this.G=this.f=this.a=this.l=null;this.h=new _.H("clpp.vr");this.I=70;this.D=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.m=this.j=0;this.g={x:0,y:0};this.O=new ur;this.S=new ur;this.X=new ur;this.$=new ur;this.B=this.gj.bind(this);this.C=this.hj.bind(this);this.K=
11
- this.fj.bind(this)},Cr=function(a){var b=pr(1,0,a.m*Math.PI/180);or(pr(0,1,a.j*Math.PI/180),a.O);or(b,a.S);wr(a.X);vr(a.$,a.O,a.X);vr(a.G,a.S,a.$)},Dr=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(lr,a.B,!1),a.a.removeEventListener("mouseup",a.C,!1),a.a.removeEventListener("touchend",a.C,!1))},Er=function(){};qr.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};ur.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r,w,x){var C=this.a;C[0]=a;C[4]=b;C[8]=c;C[12]=d;C[1]=e;C[5]=f;C[9]=g;C[13]=h;C[2]=l;C[6]=m;C[10]=n;C[14]=p;C[3]=q;C[7]=r;C[11]=w;C[15]=x;return this};var Fr={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.v(Br,_.cq);_.t=Br.prototype;_.t.onPlayerCreated=function(a){this.h.info("Player created");this.l=a};
12
- _.t.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable)if(this.I=b.vr.fieldOfView?b.vr.fieldOfView:70,a=a.getSurface()){var c=a.getMedia();if(c&&c.tagName.toLowerCase()===_.Pe){this.h.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Fr)||this.a.getContext("experimental-webgl",Fr);if(!this.f)throw new _.L(1,9,9003,"Unable to create GL context");this.G=new ur;wr(this.G);this.U=new zr(this.f);
13
- this.A=new yr(this.f);this.J=new ur;this.L=new ur;this.o=this.w=null;this.a.addEventListener(_.ge,this.D)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,!1),this.a.addEventListener(mr,this.K,!1));this.D();this.mg()}else this.h.info("No video element found, can not initialize VR plugin")}else this.h.info("No surface found, can not initialize VR plugin")};
14
- _.t.onPlayerWillRelease=function(){this.h.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.m=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Dr(this),this.a.removeEventListener(_.ge,this.D),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.t.onPlayerWillDestroy=function(){var a=this;return _.A(function(b){a.l=null;_.z(b)})};_.t.id=function(){return"vr"};
15
- _.t.mg=function(){if(this.l&&this.f){var a=this.l.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Pe){this.w=requestAnimationFrame(this.mg.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Ar(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,
16
- 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=vr(this.J,this.L,this.G).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.g,!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.U;a.a.bindBuffer(a.a.ARRAY_BUFFER,
2
+ var f=function(window){var pr="touchmove",qr="touchstart",rr=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},sr=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)},tr=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new rr(a/d*e,b/d*e,0/d*e,Math.cos(c))},ur=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},vr=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
3
+ b):(a.x=0,a.y=0,a.a=0)},wr=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},xr=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},yr=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},zr=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},Ar=function(a){var b=new ur(0,0,0),c=new ur(0,0,1),d=new ur,e=new ur,f=new ur;a=a.a;var g=new ur(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();vr(f,1/g);c=xr(d,c,f);g=c.length();vr(c,1/g);xr(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-wr(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-wr(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-wr(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Cr=function(a){this.a=a;this.f=a.createProgram();this.j=
5
+ Br(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.h=Br(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.j);a.attachShader(this.f,this.h);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 _.L(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)},Br=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 _.L(1,
7
+ 9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},Dr=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.g=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)},Er=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)},Fr=function(){var a=this;this.o=this.w=this.N=this.K=this.A=
10
+ this.ba=this.I=this.f=this.a=this.l=null;this.h=new _.H("clpp.vr");this.J=70;this.aa=1;this.T=this.R=!1;this.F=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.N.a,c=Math.tan(.5*a.J*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.m=this.j=0;this.g={x:0,y:0};this.V=new yr;this.$=new yr;this.da=new yr;this.fa=new yr;this.B=this.hj.bind(this);
11
+ this.D=this.ij.bind(this);this.L=this.gj.bind(this)},Gr=function(a){var b=tr(1,0,a.m*Math.PI/180);sr(tr(0,1,a.j*Math.PI/180),a.V);sr(b,a.$);Ar(a.da);zr(a.fa,a.V,a.da);zr(a.I,a.$,a.fa)},Hr=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(pr,a.B,!1),a.a.removeEventListener("mouseup",a.D,!1),a.a.removeEventListener("touchend",a.D,!1))},Ir=function(){};ur.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};yr.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r,w,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]=r;A[11]=w;A[15]=y;return this};var Jr={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.v(Fr,_.eq);_.t=Fr.prototype;_.t.onPlayerCreated=function(a){this.h.info("Player created");this.l=a};
12
+ _.t.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&&_.K.ka(d))this.J=d;else throw new _.L(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.K.ka(e)&&0<e)this.aa=e;else throw new _.L(1,7,7100,"sensitivity configuration must be a positive number");this.R=!!f;this.T=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.Qe){this.h.info("Initialize VR Surface");
13
+ if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Jr)||this.a.getContext("experimental-webgl",Jr);if(!this.f)throw new _.L(1,9,9003,"Unable to create GL context");this.I=new yr;Ar(this.I);this.ba=new Dr(this.f);this.A=new Cr(this.f);this.K=new yr;this.N=new yr;this.o=this.w=null;this.a.addEventListener(_.he,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.L,
14
+ !1),this.a.addEventListener(qr,this.L,!1));this.F();this.pg()}else this.h.info("No video element found, can not initialize VR plugin");else this.h.info("No surface found, can not initialize VR plugin")}};
15
+ _.t.onPlayerWillRelease=function(){this.h.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.m=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Hr(this),this.a.removeEventListener(_.he,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.L,!1),delete this.a,this.a=null)};_.t.onPlayerWillDestroy=function(){var a=this;return _.B(function(b){a.l=null;_.z(b)})};_.t.id=function(){return"vr"};
16
+ _.t.pg=function(){if(this.l&&this.f){var a=this.l.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Qe){this.w=requestAnimationFrame(this.pg.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Er(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=zr(this.K,this.N,this.I).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.g,!1,this.K.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.ba;a.a.bindBuffer(a.a.ARRAY_BUFFER,
17
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.g);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.A.a.useProgram(null)}}}};
18
- _.t.fj=function(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===mr)a.type===mr?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(lr,this.B,!1),this.a.addEventListener("mouseup",this.C,!1),this.a.addEventListener("touchend",this.C,!1)};
19
- _.t.gj=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===lr&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;var d=this.g.y-c;this.g.x=b;this.g.y=c;this.j+=a;this.m+=d;Cr(this)};_.t.hj=function(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Dr(this)};_.t.Ci=function(a,b){this.m=b;this.j=a;Cr(this)};_.t.fi=function(){return{x:this.j,y:this.m}};_.t.Hj=function(a){this.I=a;this.D()};_.B("clpp.vr.VrPlugin",Br);
20
- Br.prototype.setCameraFieldOfView=Br.prototype.Hj;Br.prototype.getCameraCoordinates=Br.prototype.fi;Br.prototype.moveCamera=Br.prototype.Ci;Br.Id="vr";Er.prototype.create=function(){return new Br};_.uo(new Er);};
19
+ _.t.gj=function(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===qr)a.type===qr?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(pr,this.B,!1),this.a.addEventListener("mouseup",this.D,!1),this.a.addEventListener("touchend",this.D,!1)};
20
+ _.t.hj=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===pr&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;var d=this.g.y-c;this.g.x=b;this.g.y=c;b=this.aa;c=d*b*(this.T?-1:1);this.j+=a*b*(this.R?-1:1);this.m+=c;Gr(this)};_.t.ij=function(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Hr(this)};_.t.Di=function(a,b){this.m=b;this.j=a;Gr(this)};_.t.hi=function(){return{x:this.j,y:this.m}};
21
+ _.t.Jj=function(a){this.J=a;this.F()};_.C("clpp.vr.VrPlugin",Fr);Fr.prototype.setCameraFieldOfView=Fr.prototype.Jj;Fr.prototype.getCameraCoordinates=Fr.prototype.hi;Fr.prototype.moveCamera=Fr.prototype.Di;Fr.Id="vr";Ir.prototype.create=function(){return new Fr};_.wo(new Ir);};
21
22
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
22
23
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
23
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 Sq=" The setting will be ignored.",Tq="VTT parser encountered an invalid VTT setting: ",Uq="application/x-subrip",Vq="text/srt",Wq='text/vtt; codecs\x3d"vtt"',Xq='text/vtt; codecs\x3d"wvtt"',Yq=function(a){_.$g(a,/[ \t]+/gm)},Zq=function(a){return a.a==a.f.length?null:(a=_.$g(a,/[^ \t\n]*/gm))?a[0]:null},$q=function(){},ar=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},br=function(){},cr=function(a){this.a=a},er=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.sg:a.textAlign=
4
- _.iq[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Ne:_.Oe;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==_.rd||b==_.oe?_.rd:b==_.sd||b==_.dd?_.sd:_.Ac);else if(d=/^region:(.*)$/.exec(b)){if(b=dr(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=Number(c[1]),
5
- c[2]&&(a.lineAlign=_.jq[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.ug,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.jq[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},dr=function(a,b){var c=a.filter(function(d){return d.id==b});return c.length?c[0]:(_.F("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},fr=function(a){a=_.$g(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==a)return null;
6
- 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)},gr=function(){cr.apply(this,arguments)},hr=function(){this.a=null;this.f=new _.H("clpp.vtt.mp4")},jr=function(a,b,c){var d,e,f;(new _.Fk).M("payl",_.Ik(function(g){d=_.oh(g)})).M("iden",_.Ik(function(g){e=_.oh(g)})).M("sttg",_.Ik(function(g){f=_.oh(g)})).parse(a);return d?ir(d,e,f,b,c):null},ir=function(a,b,c,d,e){a=new _.xg(d,e,a);b&&(a.id=b);if(c)for(b=new _.Zg(c),c=Zq(b);c;)er(a,c,[])||_.F(Tq,
7
- c,Sq),Yq(b),c=Zq(b);return a},kr=function(){this.a=new br};$q.prototype.a=function(a){a=_.oh(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=_.u(b);for(var c=b.next();!c.done;c=b.next())a+=ar(c.value)}return _.sh(a)};br.prototype.create=function(){return new $q};br.prototype.probe=function(a,b){return(a===Vq||a===Uq)&&b===_.Be};cr.prototype.parseInit=function(){};
8
- cr.prototype.parseMedia=function(a,b){var c=_.oh(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 _.L(_.M,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=fr(new _.Zg(e[1]));if(null==c)throw new _.L(_.M,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=_.u(d);for(var g=e.next();!g.done;g=e.next()){var h=g.value;if(/^region/.test(h.toLowerCase())){h=new _.Zg(h.replace(/\n/g," "));g=new _.Ag;Zq(h);Yq(h);for(var l=Zq(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||_.F("VTT parser encountered an invalid VTTRegion setting: ",l,Sq);Yq(h);l=Zq(h)}f.push(g)}}e=[];h=_.u(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=_.u(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 _.Zg(p[0]);m=fr(l);var r=_.$g(l,/[ \t]+--\x3e[ \t]+/g);n=fr(l);if(null==m||null==r||null==n)throw new _.L(_.M,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.xg(m,n,p,_.We);g&&(m.id=g);Yq(l);for(n=Zq(l);n;)er(m,n,f)||_.F(Tq,
12
- n,Sq),Yq(l),n=Zq(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.v(gr,cr);gr.prototype.parseMedia=function(a,b){return cr.prototype.parseMedia.call(this,(new $q).a(a),b)};hr.prototype.parseInit=function(a){var b=this,c=!1;(new _.Fk).M(_.Cd,_.Gk).M(_.Ee,_.Gk).M(_.xd,_.Gk).V("mdhd",function(d){0==d.version?(d.F.skip(4),d.F.skip(4),b.a=_.U(d.F),d.F.skip(4)):(d.F.skip(8),d.F.skip(8),b.a=_.U(d.F),d.F.skip(8));d.F.skip(4)}).M(_.Bd,_.Gk).M(_.se,_.Gk).V(_.ue,_.Hk).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.L(_.M,2,2008);if(!c)throw new _.L(_.M,2,2008);};
13
- hr.prototype.parseMedia=function(a,b){if(!this.a)throw this.f.error("No init segment for MP4+VTT!"),new _.L(_.M,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.Fk).M("moof",_.Gk).M("traf",_.Gk).V("tfdt",function(K){g=!0;c=0==K.version?_.U(K.F):_.Dk(K.F)}).V("tfhd",function(K){var O=K.flags;K=K.F;K.skip(4);O&1&&K.skip(8);O&2&&K.skip(4);m=O&8?_.U(K):null}).V("trun",function(K){h=!0;var O=K.version,T=K.flags;K=K.F;var Da=_.U(K);T&1&&K.skip(4);T&4&&K.skip(4);for(var ea=[],fa=0;fa<Da;fa++){var xa=
14
- {duration:null,sampleSize:null,af:null};T&256&&(xa.duration=_.U(K));T&512&&(xa.sampleSize=_.U(K));T&1024&&K.skip(4);T&2048&&(xa.af=0==O?_.U(K):_.Bk(K));ea.push(xa)}d=ea}).M(_.wd,_.Ik(function(K){l=!0;e=K})).parse(a);if(!l&&!g&&!h)throw new _.L(_.M,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.wk(p,!1);for(var q=_.u(d),r=q.next();!r.done;r=q.next()){r=r.value;var w=r.duration||m,x=r.af?c+r.af:n;n=x+(w||0);var C=0;do{var D=_.U(p);C+=D;var E=_.U(p);E=_.Kk(E);var G=null;"vttc"==
15
- E?8<D&&(G=_.Ek(p,D-8)):("vtte"!=E&&this.f.error("Unknown box "+E+"! Skipping!"),p.skip(D-8));w?G&&f.push(jr(G,b.periodStart+x/this.a,b.periodStart+n/this.a)):this.f.error("WVTT sample duration unknown, and no default found!")}while(r.sampleSize&&C<r.sampleSize)}return{cues:f.filter(_.Dg),styles:[]}};_.v(kr,_.zo);kr.prototype.Ja=function(){_.Rp[_.Be]=cr;_.Rp[Wq]=cr;_.Rp[Xq]=cr;_.Rp[_.ec]=hr;_.Rp[Vq]=gr;_.Rp[Uq]=gr;_.Ci.push(this.a)};kr.prototype.Ca=function(){_.Sp(_.Be);_.Sp(Wq);_.Sp(Xq);_.Sp(_.ec);_.Sp(Vq);_.Sp(Uq);_.Ei(this.a)};kr.prototype.id=function(){return _.ye};_.B("clpp.vtt.VttComponent",kr);};
2
+ var f=function(window){var Wq=" The setting will be ignored.",Xq="VTT parser encountered an invalid VTT setting: ",Yq="application/x-subrip",Zq="text/srt",$q='text/vtt; codecs\x3d"vtt"',ar='text/vtt; codecs\x3d"wvtt"',br=function(a){_.ah(a,/[ \t]+/gm)},cr=function(a){return a.a==a.f.length?null:(a=_.ah(a,/[^ \t\n]*/gm))?a[0]:null},dr=function(){},er=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},fr=function(){},gr=function(a){this.a=a},ir=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.tg:a.textAlign=
4
+ _.kq[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Oe:_.Pe;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==_.sd||b==_.pe?_.sd:b==_.td||b==_.ed?_.td:_.Ac);else if(d=/^region:(.*)$/.exec(b)){if(b=hr(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=Number(c[1]),
5
+ c[2]&&(a.lineAlign=_.lq[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.vg,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.lq[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},hr=function(a,b){var c=a.filter(function(d){return d.id==b});return c.length?c[0]:(_.G("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},jr=function(a){a=_.ah(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==a)return null;
6
+ 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)},kr=function(){gr.apply(this,arguments)},lr=function(){this.a=null;this.f=new _.H("clpp.vtt.mp4")},nr=function(a,b,c){var d,e,f;(new _.Gk).M("payl",_.Jk(function(g){d=_.ph(g)})).M("iden",_.Jk(function(g){e=_.ph(g)})).M("sttg",_.Jk(function(g){f=_.ph(g)})).parse(a);return d?mr(d,e,f,b,c):null},mr=function(a,b,c,d,e){a=new _.yg(d,e,a);b&&(a.id=b);if(c)for(b=new _.$g(c),c=cr(b);c;)ir(a,c,[])||_.G(Xq,
7
+ c,Wq),br(b),c=cr(b);return a},or=function(){this.a=new fr};dr.prototype.a=function(a){a=_.ph(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=_.u(b);for(var c=b.next();!c.done;c=b.next())a+=er(c.value)}return _.th(a)};fr.prototype.create=function(){return new dr};fr.prototype.probe=function(a,b){return(a===Zq||a===Yq)&&b===_.Ce};gr.prototype.parseInit=function(){};
8
+ gr.prototype.parseMedia=function(a,b){var c=_.ph(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 _.L(_.M,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=jr(new _.$g(e[1]));if(null==c)throw new _.L(_.M,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=_.u(d);for(var g=e.next();!g.done;g=e.next()){var h=g.value;if(/^region/.test(h.toLowerCase())){h=new _.$g(h.replace(/\n/g," "));g=new _.Bg;cr(h);br(h);for(var l=cr(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||_.G("VTT parser encountered an invalid VTTRegion setting: ",l,Wq);br(h);l=cr(h)}f.push(g)}}e=[];h=_.u(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=_.u(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 _.$g(p[0]);m=jr(l);var r=_.ah(l,/[ \t]+--\x3e[ \t]+/g);n=jr(l);if(null==m||null==r||null==n)throw new _.L(_.M,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.yg(m,n,p,_.Xe);g&&(m.id=g);br(l);for(n=cr(l);n;)ir(m,n,f)||_.G(Xq,
12
+ n,Wq),br(l),n=cr(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.v(kr,gr);kr.prototype.parseMedia=function(a,b){return gr.prototype.parseMedia.call(this,(new dr).a(a),b)};lr.prototype.parseInit=function(a){var b=this,c=!1;(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).W("mdhd",function(d){0==d.version?(d.G.skip(4),d.G.skip(4),b.a=_.U(d.G),d.G.skip(4)):(d.G.skip(8),d.G.skip(8),b.a=_.U(d.G),d.G.skip(8));d.G.skip(4)}).M(_.Cd,_.Hk).M(_.te,_.Hk).W(_.ve,_.Ik).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.L(_.M,2,2008);if(!c)throw new _.L(_.M,2,2008);};
13
+ lr.prototype.parseMedia=function(a,b){if(!this.a)throw this.f.error("No init segment for MP4+VTT!"),new _.L(_.M,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.Gk).M("moof",_.Hk).M("traf",_.Hk).W("tfdt",function(I){g=!0;c=0==I.version?_.U(I.G):_.Ek(I.G)}).W("tfhd",function(I){var O=I.flags;I=I.G;I.skip(4);O&1&&I.skip(8);O&2&&I.skip(4);m=O&8?_.U(I):null}).W("trun",function(I){h=!0;var O=I.version,T=I.flags;I=I.G;var Fa=_.U(I);T&1&&I.skip(4);T&4&&I.skip(4);for(var fa=[],ka=0;ka<Fa;ka++){var wa=
14
+ {duration:null,sampleSize:null,cf:null};T&256&&(wa.duration=_.U(I));T&512&&(wa.sampleSize=_.U(I));T&1024&&I.skip(4);T&2048&&(wa.cf=0==O?_.U(I):_.Ck(I));fa.push(wa)}d=fa}).M(_.xd,_.Jk(function(I){l=!0;e=I})).parse(a);if(!l&&!g&&!h)throw new _.L(_.M,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.xk(p,!1);for(var q=_.u(d),r=q.next();!r.done;r=q.next()){r=r.value;var w=r.duration||m,y=r.cf?c+r.cf:n;n=y+(w||0);var A=0;do{var E=_.U(p);A+=E;var F=_.U(p);F=_.Lk(F);var D=null;"vttc"==
15
+ F?8<E&&(D=_.Fk(p,E-8)):("vtte"!=F&&this.f.error("Unknown box "+F+"! Skipping!"),p.skip(E-8));w?D&&f.push(nr(D,b.periodStart+y/this.a,b.periodStart+n/this.a)):this.f.error("WVTT sample duration unknown, and no default found!")}while(r.sampleSize&&A<r.sampleSize)}return{cues:f.filter(_.Eg),styles:[]}};_.v(or,_.Bo);or.prototype.Ja=function(){_.Tp[_.Ce]=gr;_.Tp[$q]=gr;_.Tp[ar]=gr;_.Tp[_.ec]=lr;_.Tp[Zq]=kr;_.Tp[Yq]=kr;_.Di.push(this.a)};or.prototype.Ca=function(){_.Up(_.Ce);_.Up($q);_.Up(ar);_.Up(_.ec);_.Up(Zq);_.Up(Yq);_.Fi(this.a)};or.prototype.id=function(){return _.ze};_.C("clpp.vtt.VttComponent",or);};
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.youbora.js CHANGED
@@ -1,24 +1,24 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Jq="accountCode key is missing in Youbora config",Kq="clpp.npaw.YouboraPlugin",Lq="content.isLive",Mq=function(a,b){for(var c=a.split("."),d=b.split("."),e=0;e<c.length;e++){var f=parseInt(c[e],10),g=parseInt(d[e],10);if(f<g)return!0;if(f>g)break}return!1},Nq=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.l=c;d.f=new _.cg;d.a=new _.H("clpp.npaw.YouboraAdapter");d.o=!1;d.h=!1;d.registerListeners();d.A=!1;return d}_.v(b,youbora.Adapter);b.prototype.getPlayhead=function(){return this.l.getPosition()};
3
- b.prototype.getDuration=function(){return this.l.getDuration()};b.prototype.getRendition=function(){var c=this.l.getTrackManager();if(c&&(c=c.ea())){var d=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.l.isLive()};b.prototype.getResource=function(){var c=this.l.getLoadedSource();return c&&c.url};b.prototype.getBitrate=function(){return this.j().streamBandwidth};
4
- b.prototype.getThroughput=function(){return this.j().estimatedBandwidth};b.prototype.getPlayrate=function(){return this.l.getPlaybackRate()};b.prototype.getFramesPerSecond=function(){var c=this.l.getTrackManager();return c&&(c=c.Ia())?c.frameRate:null};b.prototype.getPlayerName=function(){return _.ta};b.prototype.getVersion=function(){return"6.4.1-castlabsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.l&&this.f&&(this.a.debug("registering listeners"),
5
- youbora.Util.logAllEvents(this.l),this.f.on(this.l,_.pe,this.J.bind(this)),this.f.on(this.l,_.fd,this.D.bind(this)),this.f.on(this.l,_.Le,this.I.bind(this)),this.f.on(this.l,_.Ke,this.G.bind(this)),this.f.on(this.l,_.Wb,this.B.bind(this)),this.f.on(this.l,_.wc,this.C.bind(this)))};b.prototype.unregisterListeners=function(){this.a.debug(_.yb);_.fg(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.A=!0};b.prototype.j=function(){return this.l.getStats()||_.Km()};
6
- b.prototype.m=function(){return!!this.l.getConfiguration().autoplay};b.prototype.J=function(c){this.a.debug("State changed",c);if(c=c.detail)switch(c.currentState){case _.$m:this.m()&&this.g();break;case _.bn:this.g();this.w();this.fireResume();this.fireBufferEnd();break;case _.an:this.m()&&this.g();this.w();this.fireBufferEnd();this.firePause();break;case _.Om:this.fireBufferEnd();this.fireStop();break;case _.Vm:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();
7
- break;case _.Tm:this.fireBufferBegin();break;default:this.a.debug("Unhandled state",c)}};b.prototype.g=function(){this.plugin.isInitiated||(this.h=!1,this.fireInit())};b.prototype.w=function(){var c=this.l.getDrmInfo();c&&(c=c.keySystem,(c=c.startsWith(_.Pc)?"Widevine":c.startsWith(_.Nc)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Qd)?"ClearKey":c.startsWith(_.Mc)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()};b.prototype.D=
8
- function(c){this.a.debug("Fire error",c);!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c.severity===_.M?(this.h=!0,this.fireFatalError(""+c.code,c.message)):this.fireError(""+c.code,c.message))};b.prototype.I=function(c){this.a.debug("Seeking",c);this.l.isEnded()||(this.g(),this.fireSeekBegin())};b.prototype.G=function(c){this.a.debug("Seeked",c);this.fireSeekEnd()};b.prototype.B=function(c){this.a.debug("adsTimeline",c);c=c.adsTimeline;this.o=!!c&&c.hb()};b.prototype.C=function(c){this.a.debug("Casting",
9
- c);this.fireCasted()};return new b(a)},Oq=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.l=c;d.a=null;d.h=null;d.f=new _.cg;d.g=new _.H("clpp.npaw.YouboraAdsAdapter");d.registerListeners();d.m=!1;return d}_.v(b,youbora.Adapter);b.prototype.getDuration=function(){return this.a&&this.a.getDuration()};b.prototype.getRendition=function(){var c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.vb(),this.a.ub(),this.a.gb()));return c};b.prototype.getBitrate=function(){return this.a&&
10
- this.a.gb()};b.prototype.getPlayhead=function(){var c=this.l.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&&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.Ua()){case 0:d=
11
- 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.l.getAdsManager();return c&&0<c.getVolume()};b.prototype.getExpectedBreaks=function(){return this.h&&this.h.getCuePoints().length};b.prototype.getGivenBreaks=function(){return this.getExpectedBreaks()};b.prototype.getExpectedAds=function(){return this.a&&this.a.xb()};
12
- b.prototype.getGivenAds=function(){return this.getExpectedAds()};b.prototype.getBreaksTime=function(){var c=this;return this.h&&this.h.getCuePoints().map(function(d){return-1===d?c.l.getDuration():d})};b.prototype.getIsFullscreen=function(){return this.l.getSurface().isFullscreen()};b.prototype.getIsVisible=function(){var c=this.l.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug("is container visible",c);return c};b.prototype.getPlayerName=function(){return _.ta};
13
- b.prototype.getVersion=function(){return"6.4.1-castlabsadsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.l&&this.f&&(this.f.on(this.l,_.Wb,this.I.bind(this)),this.f.on(this.l,_.Sb,this.G.bind(this)),this.f.on(this.l,_.Ob,this.B.bind(this)),this.f.on(this.l,_.Qb,this.C.bind(this)),this.f.on(this.l,_.Jb,this.w.bind(this)),this.f.on(this.l,_.Kb,this.j.bind(this,1)),this.f.on(this.l,_.Nb,this.j.bind(this,2)),this.f.on(this.l,_.Ub,this.j.bind(this,
14
- 3)),this.f.on(this.l,_.Ib,this.o.bind(this)),this.f.on(this.l,_.Rb,this.D.bind(this)),this.f.on(this.l,_.fd,this.A.bind(this)),this.f.on(this.l,_.Fb,this.J.bind(this)),this.f.on(this.l,_.Gb,this.K.bind(this)),this.f.on(this.l,_.Hb,this.L.bind(this)),this.f.on(this.l,_.Pb,this.O.bind(this)))};b.prototype.unregisterListeners=function(){_.fg(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.m=!0};b.prototype.I=function(c){this.g.debug("ad timeline changed",c);
15
- this.h=c.adsTimeline};b.prototype.G=function(c){this.g.debug("ad start",c);this.a=c.ad;this.fireStart();this.fireJoin()};b.prototype.w=function(c){this.g.debug("ad end",c);this.fireStop()};b.prototype.B=function(c){this.g.debug("ad pause",c);this.firePause()};b.prototype.C=function(c){this.g.debug("ad resume",c);this.fireResume()};b.prototype.L=function(c){this.g.debug("on buffering",c);this.fireBufferBegin()};b.prototype.O=function(c){this.g.debug("on progress",c);this.fireBufferEnd()};b.prototype.j=
16
- function(c,d){this.g.debug("ad quartile",c,d);this.fireQuartile(c)};b.prototype.o=function(c){this.g.debug("ad clicked",c);c=this.a&&this.a.Ib();this.g.debug("ad click through url: ",c);this.fireClick(c)};b.prototype.D=function(c){this.g.debug("ad skipped",c);this.fireSkip()};b.prototype.J=function(c){this.g.debug("break start",c);this.a=c.ad;this.fireBreakStart()};b.prototype.K=function(c){this.g.debug("ad break stop",c);this.fireBreakStop();this.getPosition()===youbora.Constants.AdPosition.Postroll&&
17
- (c=this.plugin.getAdapter())&&c.fireStop()};b.prototype.A=function(c){this.g.warn("ad error",c);(c=c.detail)&&10003===c.code&&(c.severity===_.M?this.fireFatalError(""+c.code,c.message):this.fireError(""+c.code,c.message))};return new b(a)},Pq=function(){this.a=null;this.f=!1;this.g=new _.H(Kq);this.l=null},Qq=function(a,b){var c=b.getConfiguration();a.f=!_.J.R(c.youbora)&&typeof c.youbora===_.Id;if(a.f)if(null==window.youbora)a.f=!1,a.g.warn("Youbora SDK not found."),b.onError(new _.L(1,9,9100));
18
- else{c=youbora.VERSION;var d;if(typeof c===_.te&&null!=c.match(/^\d+\.\d+\.\d+$/)){if(d=!Mq(c,"6.8.12"))d="6.8.25"===c||Mq(c,"6.8.25")}else d=!1;d||(a.g.warn("Youbora SDK version is not supported. Supported versions are 6.8.12 - 6.8.25, found version "+(c+". Some or all features of YouboraPlugin may not work correctly.")),b.onError(new _.L(1,9,9102)));b.namespace()===_.Fc&&(a.f=!1,a.g.info("Youbora does not report when casting."))}else a.g.warn("Youbora plugin is loaded but not configured. Will do nothing.")},
19
- Rq=function(){};_.v(Pq,_.cq);_.t=Pq.prototype;_.t.Xe=function(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Nq(this.l)),this.a.setAdsAdapter(Oq(this.l))};_.t.getAdapter=function(){return this.a&&this.a.getAdapter()};_.t.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.t.onPlayerCreated=function(a){this.l=a;Qq(this,a);if(this.f){var b=a.getConfiguration().youbora;b.accountCode?this.Xe(new youbora.Plugin(b)):(this.g.warn(Jq),a.onError(new _.L(1,9,9101)))}};
20
- _.t.onContentWillLoad=function(a,b){Qq(this,a);if(this.f){var c=a.getConfiguration(),d=c.youbora;d.accountCode?(void 0===d[Lq]&&(d[Lq]=b.isLive),void 0===d["content.title"]&&(d["content.title"]=b.name),void 0===d.viewerId&&(d.viewerId=c.viewerId),this.a||this.Xe(new youbora.Plugin(d)),this.a.setOptions(d)):(this.g.warn(Jq),a.onError(new _.L(1,9,9101)))}};_.t.onPlayerWillRelease=function(){};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"youbora"};_.B(Kq,Pq);
21
- Pq.prototype.getAdsAdapter=Pq.prototype.getAdsAdapter;Pq.prototype.getAdapter=Pq.prototype.getAdapter;Pq.prototype.setYouboraPlugin=Pq.prototype.Xe;Pq.Id="youbora";Rq.prototype.create=function(){return new Pq};_.uo(new Rq);};
2
+ var f=function(window){var Lq='" event to Youbora',Mq='Reporting "',Nq="clpp.npaw.YouboraPlugin",Oq="content.isLive",Pq=function(a){return(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:function(b){return{code:""+b.code,message:b.message,severity:b.severity}}},Qq=function(a,b,c,d){b=Pq(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.gd;b.severity===_.M?(d.fireFatalError(b.code,b.message,b.metadata),c.debug('Reporting "fatal '+a+'" to Youbora',b.code,
3
+ b)):(d.fireError(b.code,b.message,b.metadata),c.debug(Mq+a+'" to Youbora',b.code,b));return b},Rq=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.l=c;d.a=new _.dg;d.f=new _.H("clpp.npaw.YouboraAdapter");d.w=!1;d.h=!1;d.registerListeners();d.B=!1;return d}_.v(b,youbora.Adapter);b.prototype.getPlayhead=function(){return this.getIsLive()?-1:this.l.getPosition()};b.prototype.getDuration=function(){return this.l.getDuration()};b.prototype.getRendition=function(){var c=this.l.getTrackManager();
4
+ if(c&&(c=c.ga())){var d=c.width;var e=c.height;var f=c.bandwidth}d&&e&&f||(c=this.m(),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.l.isLive()};b.prototype.getResource=function(){var c=this.l.getLoadedSource();return c&&c.url};b.prototype.getBitrate=function(){return this.m().streamBandwidth};b.prototype.getThroughput=function(){return this.m().estimatedBandwidth};b.prototype.getPlayrate=function(){return this.l.getPlaybackRate()};
5
+ b.prototype.getFramesPerSecond=function(){var c=this.l.getTrackManager();return c&&(c=c.Ia())?c.frameRate:null};b.prototype.getPlayerName=function(){return _.ta};b.prototype.getVersion=function(){return"6.5.0-castlabsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ea};b.prototype.registerListeners=function(){this.l&&this.a&&(this.f.debug("registering listeners"),youbora.Util.logAllEvents(this.l),this.a.on(this.l,_.re,this.L.bind(this)),this.a.on(this.l,_.gd,this.I.bind(this)),this.a.on(this.l,
6
+ _.Me,this.K.bind(this)),this.a.on(this.l,_.Le,this.J.bind(this)),this.a.on(this.l,_.Wb,this.D.bind(this)),this.a.on(this.l,_.wc,this.F.bind(this)))};b.prototype.unregisterListeners=function(){this.f.debug(_.yb);_.gg(this.a)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.B=!0};b.prototype.m=function(){return this.l.getStats()||_.Lm()};b.prototype.o=function(){return!!this.l.getConfiguration().autoplay};b.prototype.L=function(c){c=c.detail;this.j("state change",c);
7
+ if(c)switch(c.currentState){case _.an:this.o()&&this.g();break;case _.cn:this.g();this.A();this.fireResume();this.fireBufferEnd();break;case _.bn:this.o()&&this.g();this.A();this.fireBufferEnd();this.firePause();break;case _.Pm:this.fireBufferEnd();this.fireStop();break;case _.Wm:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.Um:this.fireBufferBegin();break;default:this.f.debug("Unhandled state",c)}};b.prototype.g=function(){this.plugin.isInitiated||
8
+ (this.h=!1,this.fireInit())};b.prototype.A=function(){var c=this.l.getDrmInfo();c&&(c=c.keySystem,(c=c.startsWith(_.Qc)?"Widevine":c.startsWith(_.Oc)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Rd)?"ClearKey":c.startsWith(_.Nc)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()};b.prototype.I=function(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=Qq(c,this.l,this.f,this))&&c.severity===_.M&&(this.h=!0)};
9
+ b.prototype.K=function(){this.j(_.ke);this.l.isEnded()||(this.g(),this.fireSeekBegin())};b.prototype.J=function(){this.j(_.je);this.fireSeekEnd()};b.prototype.D=function(c){this.f.debug("adsTimeline",c);c=c.adsTimeline;this.w=!!c&&c.ib()};b.prototype.F=function(c){this.f.debug("Casting",c);this.fireCasted()};b.prototype.j=function(c,d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.f.debug.apply(this.f,[Mq+c+Lq].concat(_.lf(e)))};return new b(a)},Sq=function(a){function b(c){var d=
10
+ youbora.Adapter.call(this,c)||this;d.l=c;d.a=null;d.j=null;d.f=new _.dg;d.h=new _.H("clpp.npaw.YouboraAdsAdapter");d.registerListeners();d.o=!1;return d}_.v(b,youbora.Adapter);b.prototype.getDuration=function(){return this.a&&this.a.getDuration()};b.prototype.getRendition=function(){var c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.vb(),this.a.ub(),this.a.hb()));return c};b.prototype.getBitrate=function(){return this.a&&this.a.hb()};b.prototype.getPlayhead=function(){var c=this.l.getAdsManager();
11
+ 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&&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.Va()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.h.debug("Ad position",
12
+ d);return d};b.prototype.getIsSkippable=function(){return this.a&&-1!==this.a.getSkipTimeOffset()};b.prototype.getAudioEnabled=function(){var c=this.l.getAdsManager();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.xb()};b.prototype.getGivenAds=function(){return this.getExpectedAds()};b.prototype.getBreaksTime=
13
+ function(){var c=this;return this.j&&this.j.getCuePoints().map(function(d){return-1===d?c.l.getDuration():d})};b.prototype.getIsFullscreen=function(){return this.l.getSurface().isFullscreen()};b.prototype.getIsVisible=function(){var c=this.l.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.h.debug("is container visible",c);return c};b.prototype.getPlayerName=function(){return _.ta};b.prototype.getVersion=function(){return"6.5.0-castlabsadsadapter-js"};b.prototype.getPlayerVersion=
14
+ function(){return _.ea};b.prototype.registerListeners=function(){this.l&&this.f&&(this.f.on(this.l,_.Wb,this.T.bind(this)),this.f.on(this.l,_.Sb,this.R.bind(this)),this.f.on(this.l,_.Ob,this.J.bind(this)),this.f.on(this.l,_.Qb,this.L.bind(this)),this.f.on(this.l,_.Jb,this.F.bind(this)),this.f.on(this.l,_.Kb,this.m.bind(this,1)),this.f.on(this.l,_.Nb,this.m.bind(this,2)),this.f.on(this.l,_.Ub,this.m.bind(this,3)),this.f.on(this.l,_.Ib,this.D.bind(this)),this.f.on(this.l,_.Rb,this.N.bind(this)),this.f.on(this.l,
15
+ _.gd,this.I.bind(this)),this.f.on(this.l,_.Fb,this.w.bind(this)),this.f.on(this.l,_.Gb,this.A.bind(this)),this.f.on(this.l,_.Hb,this.B.bind(this)),this.f.on(this.l,_.Pb,this.K.bind(this)))};b.prototype.unregisterListeners=function(){_.gg(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.o=!0};b.prototype.T=function(c){this.h.debug("ad timeline changed",c);this.j=c.adsTimeline};b.prototype.R=function(c){this.a=c.ad;this.g("ad start",this.a);this.fireStart();
16
+ this.fireJoin()};b.prototype.F=function(){this.g("ad ended");this.fireStop()};b.prototype.J=function(){this.g("ad pause");this.firePause()};b.prototype.L=function(){this.g("ad resume");this.fireResume()};b.prototype.B=function(){this.g("ad buffering started");this.fireBufferBegin()};b.prototype.K=function(){this.g("ad buffering ended");this.fireBufferEnd()};b.prototype.m=function(c){this.g("ad quartile",c);this.fireQuartile(c)};b.prototype.D=function(){this.g("ad clicked");var c=this.a&&this.a.Kb();
17
+ this.h.debug("ad click through url: ",c);this.fireClick(c)};b.prototype.N=function(){this.g("ad skipped");this.fireSkip()};b.prototype.w=function(c){this.a=c.ad;this.g("ad break start",this.a);this.fireBreakStart()};b.prototype.A=function(){this.g("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){var c=this.plugin.getAdapter();c&&c.fireStop()}};b.prototype.I=function(c){(c=c.detail)&&10003===c.code&&Qq(c,this.l,this.h,this)};b.prototype.g=function(c,
18
+ d){for(var e=[],f=1;f<arguments.length;++f)e[f-1]=arguments[f];this.h.debug.apply(this.h,[Mq+c+Lq].concat(_.lf(e)))};return new b(a)},Tq=function(){this.a=null;this.f=new _.H(Nq);this.l=null},Uq=function(a,b){if(b.namespace()===_.Gc)return a.f.info("Youbora does not report when casting."),!1;var c=b.getConfiguration().youbora;if(!_.K.Qf(c))return a.f.warn("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.f.warn("accountCode key is missing in Youbora config"),
19
+ b.onError(new _.L(1,9,9101)),!1;if(_.K.S(window.youbora))return a.f.warn("Youbora SDK not found."),b.onError(new _.L(1,9,9100)),!1;"6.8.49"!==youbora.VERSION&&(a.f.warn("Youbora SDK version is not supported. The supported version is 6.8.49, found version "+(youbora.VERSION+". Some or all features of YouboraPlugin may not work correctly.")),b.onError(new _.L(1,9,9102)));return!0},Vq=function(){};_.v(Tq,_.eq);_.t=Tq.prototype;_.t.Ze=function(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Rq(this.l)),this.a.setAdsAdapter(Sq(this.l))};_.t.getAdapter=function(){return this.a&&this.a.getAdapter()};_.t.getAdsAdapter=function(){return this.a&&this.a.getAdsAdapter()};_.t.onPlayerCreated=function(a){this.l=a;Uq(this,a)&&(a=a.getConfiguration().youbora,this.Ze(new youbora.Plugin(a)))};
20
+ _.t.onContentWillLoad=function(a,b){if(Uq(this,a)){var c=a.getConfiguration(),d=c.youbora;void 0===d[Oq]&&(d[Oq]=b.isLive);void 0===d["content.title"]&&(d["content.title"]=b.name);void 0===d.viewerId&&(d.viewerId=c.viewerId);this.a||this.Ze(new youbora.Plugin(d));this.a.setOptions(d)}};_.t.onPlayerWillRelease=function(){};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"youbora"};_.C(Nq,Tq);Tq.prototype.getAdsAdapter=Tq.prototype.getAdsAdapter;Tq.prototype.getAdapter=Tq.prototype.getAdapter;
21
+ Tq.prototype.setYouboraPlugin=Tq.prototype.Ze;Tq.Id="youbora";Vq.prototype.create=function(){return new Tq};_.wo(new Vq);};
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/cl.adobe.js CHANGED
@@ -1,3 +1,3 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var TK=function(a){a.f=new _.mo;a.f.on(a.l,_.Be,()=>RK(a));a.f.on(a.l,_.Ae,()=>{s.Media.play(a.a,a.l.getPosition())});a.f.on(a.l,_.nd,()=>SK(a));a.f.on(a.l,_.ie,b=>{b=b.detail;switch(b.currentState){case _.Ll:a.a.length||SK(a);s.Media.play(a.a,a.l.getPosition());break;case _.Kl:case _.Dl:RK(a);break;case _.Al:case _.Il:case _.Hl:a.g.info(`Close session for ${a.a} `+`in player state ${b.currentState}.`),RK(a),s.Media.close(a.a),a.a=""}})},RK=function(a){s.Media.stop(a.a,a.l.getPosition())},
2
- SK=function(a){{const b=a.l.getLoadedSource();a.a=b?b.name||b.url:""}a.g.info(`Open session for ${a.a} `+`with duration ${a.l.getDuration()}`);s.Media.open(a.a,a.l.getDuration(),_.pa)},UK=class extends _.Zp{constructor(){super();this.l=this.f=null;this.a="";this.g=new _.O("clpp.adobe.AdobePlugin")}onPlayerCreated(a){window.s&&s.Media?(this.l=a,TK(this)):this.g.warn("Adobe API not available.")}onPlayerWillDestroy(){this.f&&(this.f.release(),this.f=null);this.l=null;this.a=""}id(){return"adobe"}};
3
- _.x("clpp.adobe.AdobeAnalyticsPlugin",UK);UK.Id="adobe";_.Km(new class{create(){return new UK}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ZK=function(a){a.f=new _.po;a.f.on(a.l,_.Ce,()=>XK(a));a.f.on(a.l,_.Be,()=>{s.Media.play(a.a,a.l.getPosition())});a.f.on(a.l,_.od,()=>YK(a));a.f.on(a.l,_.je,b=>{b=b.detail;switch(b.currentState){case _.Nl:a.a.length||YK(a);s.Media.play(a.a,a.l.getPosition());break;case _.Ml:case _.Fl:XK(a);break;case _.Cl:case _.Kl:case _.Jl:a.g.info(`Close session for ${a.a} `+`in player state ${b.currentState}.`),XK(a),s.Media.close(a.a),a.a=""}})},XK=function(a){s.Media.stop(a.a,a.l.getPosition())},
2
+ YK=function(a){{const b=a.l.getLoadedSource();a.a=b?b.name||b.url:""}a.g.info(`Open session for ${a.a} `+`with duration ${a.l.getDuration()}`);s.Media.open(a.a,a.l.getDuration(),_.pa)},$K=class extends _.bq{constructor(){super();this.l=this.f=null;this.a="";this.g=new _.O("clpp.adobe.AdobePlugin")}onPlayerCreated(a){window.s&&s.Media?(this.l=a,ZK(this)):this.g.warn("Adobe API not available.")}onPlayerWillDestroy(){this.f&&(this.f.release(),this.f=null);this.l=null;this.a=""}id(){return"adobe"}};
3
+ _.x("clpp.adobe.AdobeAnalyticsPlugin",$K);$K.Id="adobe";_.Nm(new class{create(){return new $K}});};f.call(g, window);
package/cl.airplay.js CHANGED
@@ -1,3 +1,3 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var QK=class extends _.Zp{constructor(){super();this.a=this.l=null;this.j=this.f=this.h=!1;this.m=new _.No(()=>{this.l.play().catch(()=>{})});this.g=new _.mo}onPlayerCreated(a){this.l=a;this.a=a.getSurface().getMedia()}onContentWillLoad(){this.a&&(this.g.on(this.a,"webkitplaybacktargetavailabilitychanged",this.o.bind(this)),this.g.on(this.a,"webkitcurrentplaybacktargetiswirelesschanged",this.w.bind(this)))}onPlayerWillRelease(){this.m.stop();this.g.release()}id(){return"airplay"}o(a){switch(a.availability){case "available":this.f=
2
- !0;break;case "not-available":this.f=!1}this.l.trigger(new _.C(_.Pb,{canCast:this.f}))}w(){const a=(this.h=this.a.webkitCurrentPlaybackTargetIsWireless)?_.Nb:_.Mb;if(this.j||!this.l.isPaused()||this.l.getState()===_.Ll)this.j?this.l.play().catch(()=>{}):this.m.aa(.01);this.l.trigger(new _.C(a))}fb(){return this.h}fd(){return this.f}Qf(){this.f&&(this.j=!this.l.isPaused(),this.a.webkitShowPlaybackTargetPicker())}};_.x("clpp.airplay.AirPlayPlugin",QK);QK.prototype.showCastMenu=QK.prototype.Qf;
3
- QK.prototype.canCast=QK.prototype.fd;QK.prototype.isCasting=QK.prototype.fb;QK.Id="airplay";_.Km(new class{create(){return new QK}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var WK=class extends _.bq{constructor(){super();this.a=this.l=null;this.j=this.f=this.h=!1;this.m=new _.Qo(()=>{this.l.play().catch(()=>{})});this.g=new _.po}onPlayerCreated(a){this.l=a;this.a=a.getSurface().getMedia()}onContentWillLoad(){this.a&&(this.g.on(this.a,"webkitplaybacktargetavailabilitychanged",this.o.bind(this)),this.g.on(this.a,"webkitcurrentplaybacktargetiswirelesschanged",this.w.bind(this)))}onPlayerWillRelease(){this.m.stop();this.g.release()}id(){return"airplay"}o(a){switch(a.availability){case "available":this.f=
2
+ !0;break;case "not-available":this.f=!1}this.l.trigger(new _.C(_.Pb,{canCast:this.f}))}w(){const a=(this.h=this.a.webkitCurrentPlaybackTargetIsWireless)?_.Nb:_.Mb;if(this.j||!this.l.isPaused()||this.l.getState()===_.Nl)this.j?this.l.play().catch(()=>{}):this.m.aa(.01);this.l.trigger(new _.C(a))}gb(){return this.h}hd(){return this.f}Uf(){this.f&&(this.j=!this.l.isPaused(),this.a.webkitShowPlaybackTargetPicker())}};_.x("clpp.airplay.AirPlayPlugin",WK);WK.prototype.showCastMenu=WK.prototype.Uf;
3
+ WK.prototype.canCast=WK.prototype.hd;WK.prototype.isCasting=WK.prototype.gb;WK.Id="airplay";_.Nm(new class{create(){return new WK}});};f.call(g, window);
package/cl.broadpeak.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JK=function(){return!window.SmartLib||!window.GenericPlayerApi},KK=function(a,b){const c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"";b=b.uuid||null;a.g||(a.g=SmartLib.getInstance(),a.g.init(c,d,e),typeof b===_.le&&a.g.setUUID(b))},MK=function(a,b){b=b.customParameters||{};a.a=a.g.createStreamingSession();for(const c in b)a.a.setCustomParameter(c,b[c]);a.j.on(a.l,_.Wc,a.T.bind(a));a.h=new LK(a.l);a.a.attachPlayer(a.h)},NK=function(a,b){_.Mf(a.j);a.f&&
2
- (a.f.release(),a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},OK=class{constructor(a,b){this.l=a;this.f=b;this.a=new _.mo;this.g=!1}init(){const a=this.l,b=this.a;b.on(a,_.ie,this.m.bind(this));b.on(a,_.ec,this.h.bind(this));b.on(a,"seek",this.j.bind(this))}h(a){a=a.detail;typeof a.bandwidth===_.p&&this.f.notifyLayerSwitch(a.bandwidth/1E3)}m(a){const b=this.l,c=this.f;a=a.detail;const d=a.currentState;a.previousState===_.Dl&&c.notifyStallEnd(!b.isPaused());switch(d){case _.Dl:c.notifyStallStart();
3
- break;case _.Ll:this.g?c.notifyResume():(c.notifyFirstImage(),this.g=!0);break;case _.Kl:c.notifyPause()}}j(){const a=1E3*this.l.getPosition();this.f.notifySeek(a)}release(){this.a&&(_.Mf(this.a),this.a=null)}};var LK=class extends GenericPlayerApi{constructor(a){super();this.l=a;this.a=_.ri()}getPlayerName(){return _.pa}getVersion(){return _.da}getOSName(){return this.a.os}getDeviceVersion(){return this.a.osVersion.name}getDeviceType(){return"browser"}getTotalDuration(){return this.l.isLive()?0:1E3*this.l.getDuration()}getCurrentPosition(){return 1E3*this.l.getPosition()}getCurrentBitrate(){const a=this.l.getStats();return(a?a.streamBandwidth:0)/1E3}};var PK=class extends _.Zp{constructor(){super();this.h=this.f=this.a=this.g=this.l=null;this.j=new _.mo}onPlayerCreated(a){this.l=a}onContentWillLoad(a,b){const c=a.getConfiguration().broadpeak;if(c){if(JK())return a.onError(new _.H(1,9,11E3));KK(this,c);MK(this,c);return this.a.getURL(b.url).then(d=>{if(d.isError()){const e=d.getDetailedErrorCode();d=d.getDetailedErrorMessage();this.l.onError(new _.H(1,9,11001,{bpkErrorCode:e,message:d}));NK(this,void 0)}else b.url=d.getURL(),this.f=new OK(this.l,
4
- this.h),this.f.init()})}}T(a){a=a.detail;if(7003===a.code)NK(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.F)switch(a.category){case 3:NK(this,SmartLib.BPDecodingError);break;case 1:NK(this,SmartLib.BPNetworkingError);break;case 6:NK(this,SmartLib.BPAccessRightError);break;default:NK(this,SmartLib.BPUnspecifiedError)}}onPlayerWillRelease(){JK()||NK(this,SmartLib.BPSessionEndsNormally)}id(){return"broadpeak"}};_.x("clpp.broadpeak.BroadpeakPlugin",PK);PK.isSdkMissing=JK;PK.Id="broadpeak";
5
- _.Km(new class{create(){return new PK}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var PK=function(){return!window.SmartLib||!window.GenericPlayerApi},QK=function(a,b){const c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"";b=b.uuid||null;a.g||(a.g=SmartLib.getInstance(),a.g.init(c,d,e),typeof b===_.me&&a.g.setUUID(b))},SK=function(a,b){b=b.customParameters||{};a.a=a.g.createStreamingSession();for(const c in b)a.a.setCustomParameter(c,b[c]);a.j.on(a.l,_.Xc,a.U.bind(a));a.h=RK(a.l);a.a.attachPlayer(a.h)},TK=function(a,b){_.Of(a.j);a.f&&(a.f.release(),
2
+ a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},UK=class{constructor(a,b){this.l=a;this.f=b;this.a=new _.po;this.g=!1}init(){const a=this.l,b=this.a;b.on(a,_.je,this.m.bind(this));b.on(a,_.ec,this.h.bind(this));b.on(a,"seek",this.j.bind(this))}h(a){a=a.detail;typeof a.bandwidth===_.p&&this.f.notifyLayerSwitch(a.bandwidth/1E3)}m(a){const b=this.l,c=this.f;a=a.detail;const d=a.currentState;a.previousState===_.Fl&&c.notifyStallEnd(!b.isPaused());switch(d){case _.Fl:c.notifyStallStart();break;
3
+ case _.Nl:this.g?c.notifyResume():(c.notifyFirstImage(),this.g=!0);break;case _.Ml:c.notifyPause()}}j(){const a=1E3*this.l.getPosition();this.f.notifySeek(a)}release(){this.a&&(_.Of(this.a),this.a=null)}};var RK=a=>{class b extends GenericPlayerApi{constructor(c){super();this.l=c;this.a=_.ti()}getPlayerName(){return _.pa}getVersion(){return _.da}getOSName(){return this.a.os}getDeviceVersion(){return this.a.osVersion.name}getDeviceType(){return"browser"}getTotalDuration(){return this.l.isLive()?0:1E3*this.l.getDuration()}getCurrentPosition(){return 1E3*this.l.getPosition()}getCurrentBitrate(){const c=this.l.getStats();return(c?c.streamBandwidth:0)/1E3}}return new b(a)};var VK=class extends _.bq{constructor(){super();this.h=this.f=this.a=this.g=this.l=null;this.j=new _.po}onPlayerCreated(a){this.l=a}onContentWillLoad(a,b){const c=a.getConfiguration().broadpeak;if(c){if(PK())return a.onError(new _.H(1,9,11E3));QK(this,c);SK(this,c);return this.a.getURL(b.url).then(d=>{if(d.isError()){const e=d.getDetailedErrorCode();d=d.getDetailedErrorMessage();this.l.onError(new _.H(1,9,11001,{bpkErrorCode:e,message:d}));TK(this,void 0)}else b.url=d.getURL(),this.f=new UK(this.l,
4
+ this.h),this.f.init()})}}U(a){a=a.detail;if(7003===a.code)TK(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.F)switch(a.category){case 3:TK(this,SmartLib.BPDecodingError);break;case 1:TK(this,SmartLib.BPNetworkingError);break;case 6:TK(this,SmartLib.BPAccessRightError);break;default:TK(this,SmartLib.BPUnspecifiedError)}}onPlayerWillRelease(){PK()||TK(this,SmartLib.BPSessionEndsNormally)}id(){return"broadpeak"}};_.x("clpp.broadpeak.BroadpeakPlugin",VK);VK.isSdkMissing=PK;VK.Id="broadpeak";
5
+ _.Nm(new class{create(){return new VK}});};f.call(g, window);