@castlabs/prestoplay 6.4.0 → 6.4.1

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 +22 -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 +103 -103
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +414 -398
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +53 -132
  11. package/cjs/cl.freewheel.js +21 -21
  12. package/cjs/cl.hls.js +46 -48
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -32
  15. package/cjs/cl.ima.js +21 -21
  16. package/cjs/cl.mse.js +250 -250
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  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 +69 -69
  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 +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +15 -15
  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 +85 -85
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +360 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +48 -131
  39. package/cl.freewheel.js +17 -17
  40. package/cl.hls.js +39 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +15 -15
  44. package/cl.mse.js +228 -228
  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 +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +14 -14
  58. package/package.json +3 -1
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ur="VerimatrixVCAS",vr="clpp.verimatrix.Vcas",wr="clpp.verimatrix.VcasComponent",Cr=function(a){_.Lj.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?Ar:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=Br(this,e);this.o=Br(this,f);this.m=Br(this,g);this.j=h;this.G=l;this.D=m;this.f=new _.H(vr);_.mh(this.w)?this.f.warn(_.zb):this.Ka(_.Nc,{licenseUrl:this.w,videoRobustness:[_.lb,void 0],audioRobustness:[_.kb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.mh(this.o)?this.f.warn(_.cb):this.Ka(_.Mc,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.mh(this.m)?this.f.warn(_.Ia):_.mh(this.j)?this.f.warn(_.Ha):this.Ka(_.Lc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Br=function(a,b){if(a.C===zr){var c=Object.assign({},{deviceId:_.vj(_.gh(a.A))},a.a&&{authenticator:_.vj(_.gh(a.a))});return b+_.ik(c)}return b},Dr=function(){this.l=null;this.a=new _.H(wr)};_.v(Cr,_.Lj);
5
- Cr.prototype.h=function(a,b){if(this.C===Er){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]})}};Cr.prototype.I=function(a,b){var c=_.mk(b);switch(this.D){case Fr:c=_.ik({r:c,sk:this.G},!0)}return c};Cr.prototype.K=function(a,b){this.h(a,b);_.pk(b)};Cr.prototype.L=function(a,b){_.qk(b)};_.C(vr,Cr);Cr.prototype.constructor=Cr.prototype.constructor;Cr.NAME=ur;var zr="query-string",Er="http-header";
6
- Cr.LicenseRequestVuidLocation={QUERY_STRING:zr,HTTP_HEADER:Er};var xr="DeviceId",yr="Authenticator";Cr.LicenseRequestHttpHeader={DEVICE_ID_HEADER:xr,AUTHENTICATOR_HEADER:yr};var Ar="keyid",Fr="contentid-siteid";Cr.FairPlayAssetIdStrategy={KEYID:Ar,CONTENTID_SITEID:Fr};_.v(Dr,_.Zn);_.t=Dr.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===ur){a=a.drm.customData;if(!a)throw new _.L(_.M,7,7100,_.Oc);a=new Cr(a);this.a.info("Registering the Verimatrix VCAS Ultra environment");_.Gj(a)}};_.t.release=function(){};_.t.id=function(){return"verimatrix-vcas"};_.C(wr,Dr);};
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);};
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 kr="Registering listeners",lr="clpp.vimond.VimondPlugin",mr=function(a,b,c,d,e){this.D=a;this.G=b;this.I=c;this.l=d;this.C=e;this.f=new _.bg;this.m=!0;this.g=this.j=this.A=!1;this.B=null;this.h=new _.Ch(this.Bf.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,_.oe,this.Nh.bind(this)),this.f.on(this.l,_.Ce,this.Oh.bind(this)),this.f.on(this.l,_.Bb,this.Lh.bind(this)),this.f.on(this.l,_.Cb,this.Mh.bind(this)))},nr=function(a,
3
- b){a.l.trigger(new _.J(_.Te,{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 _.bg;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,_.be,this.hj.bind(this)),this.a.on(this.l,_.Bb,this.Jh.bind(this)),this.a.on(this.l,_.Cb,this.Kh.bind(this)))},
4
- rr=function(a,b){var c=a.l.getState();if(1===b)return["str-start",_.Vd];if(a.h)return[_.bd,_.Qd];if(c===_.qm)return[_.bd,null];if(c===_.um)return[_.dd,_.Qd];var d=_.Qd;if(c===_.om||c===_.xm||a.f)d=_.Vd;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.Oh=function(){this.g||(this.g=1<Math.abs(this.w-this.l.getPosition()));this.w=this.l.getPosition()};_.t.Lh=function(){this.a.debug("Ad break started");this.j=!0};
5
- _.t.Mh=function(){this.a.debug("Ad break stopped");this.j=!1};
6
- _.t.Nh=function(a){var b=this,c,d,e,f,g;return _.A(function(h){if(1==h.a){c=a.detail;d=_.sm;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.Bf(),3)}e===d.ENDED&&b.h.stop();_.z(h)})};
8
- _.t.Bf=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.$(a.m?10:a.D);a.m=!1;_.wf(h,2);l=a.C;l.f++;var m=_.K.Va(l.m);m.client.buildName=_.sa;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 _.gk(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!==_.pc&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.h.debug("Fire an event");n=_.vh(l.o);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.g;n.body=_.gh(JSON.stringify(m));l=l.j.fetch(n).P;return _.y(h,l,4)}if(2!=h.a)return b=h.f,nr(a,b),_.xf(h,0);d=c=_.yf(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.a.debug("Unreachable service"),nr(a,f),or(a,a.G,f)):1001===e?(a.a.debug("Generic service error"),
11
- nr(a,f),or(a,a.I,f)):a.a.error(c.toString());_.z(h)})};_.t.dispose=function(){this.a.debug(_.vb);_.eg(this.f);this.h.stop()};pr.prototype.bf=function(a){this.g=a};_.t=qr.prototype;_.t.getPosition=function(){return Math.floor(this.l.getPosition())};_.t.hj=function(){this.h=!0};_.t.Jh=function(){this.f=!0};_.t.Kh=function(){this.f=!1};_.t.dispose=function(){this.g.debug(_.vb);_.eg(this.a)};_.v(sr,_.Gp);_.t=sr.prototype;_.t.onPlayerCreated=function(){};
12
- _.t.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.K.R(b.vimond)&&typeof b.vimond===_.Gd)?a.namespace()===_.Dc&&(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!==_.pc&&(c=!0);d=b.failOnError;typeof d!==_.pc&&(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.bf=function(a){this.a&&this.g&&this.g.bf(a)};_.C(lr,sr);sr.prototype.updateAuthToken=sr.prototype.bf;sr.Id="vimond";tr.prototype.create=function(){return new sr};_.Un(new tr);};
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);};
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,23 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Qq="touchmove",Rq="touchstart",Sq=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},Tq=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)},Uq=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Sq(a/d*e,b/d*e,0/d*e,Math.cos(c))},Vq=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},Wq=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
3
- b):(a.x=0,a.y=0,a.a=0)},Xq=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Yq=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},Zq=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},$q=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 Vq(0,0,0),c=new Vq(0,0,1),d=new Vq,e=new Vq,f=new Vq;a=a.a;var g=new Vq(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Wq(f,1/g);c=Yq(d,c,f);g=c.length();Wq(c,1/g);Yq(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Xq(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Xq(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Xq(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.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 Zq;this.T=new Zq;this.Y=new Zq;this.aa=new Zq;this.B=this.ej.bind(this);this.C=this.fj.bind(this);this.K=
11
- this.dj.bind(this)},gr=function(a){var b=Uq(1,0,a.m*Math.PI/180);Tq(Uq(0,1,a.j*Math.PI/180),a.O);Tq(b,a.T);ar(a.Y);$q(a.aa,a.O,a.Y);$q(a.G,a.T,a.aa)},hr=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Qq,a.B,!1),a.a.removeEventListener("mouseup",a.C,!1),a.a.removeEventListener("touchend",a.C,!1))},ir=function(){};Vq.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};Zq.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r,w,x){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]=r;B[11]=w;B[15]=x;return this};var jr={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.v(fr,_.Gp);_.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)if(this.I=b.vr.fieldOfView?b.vr.fieldOfView:70,a=a.getSurface()){var c=a.getMedia();if(c&&c.tagName.toLowerCase()===_.Oe){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",jr)||this.a.getContext("experimental-webgl",jr);if(!this.f)throw new _.L(1,9,9003,"Unable to create GL context");this.G=new Zq;ar(this.G);this.U=new dr(this.f);
13
- this.A=new cr(this.f);this.J=new Zq;this.L=new Zq;this.o=this.w=null;this.a.addEventListener(_.ee,this.D)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,!1),this.a.addEventListener(Rq,this.K,!1));this.D();this.kg()}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&&(hr(this),this.a.removeEventListener(_.ee,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.kg=function(){if(this.l&&this.f){var a=this.l.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Oe){this.w=requestAnimationFrame(this.kg.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,
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=$q(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 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,
17
17
  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.dj=function(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Rq)a.type===Rq?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(Qq,this.B,!1),this.a.addEventListener("mouseup",this.C,!1),this.a.addEventListener("touchend",this.C,!1)};
19
- _.t.ej=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Qq&&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;gr(this)};_.t.fj=function(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();hr(this)};_.t.Ai=function(a,b){this.m=b;this.j=a;gr(this)};_.t.di=function(){return{x:this.j,y:this.m}};_.t.Fj=function(a){this.I=a;this.D()};_.C("clpp.vr.VrPlugin",fr);
20
- fr.prototype.setCameraFieldOfView=fr.prototype.Fj;fr.prototype.getCameraCoordinates=fr.prototype.di;fr.prototype.moveCamera=fr.prototype.Ai;fr.Id="vr";ir.prototype.create=function(){return new fr};_.Un(new ir);};
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);};
21
21
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
22
22
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
23
23
  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 wq=" The setting will be ignored.",xq="VTT parser encountered an invalid VTT setting: ",yq="application/x-subrip",zq="text/srt",Aq='text/vtt; codecs\x3d"vtt"',Bq='text/vtt; codecs\x3d"wvtt"',Cq=function(a){_.Oo(a,/[ \t]+/gm)},Dq=function(a){return a.a==a.f.length?null:(a=_.Oo(a,/[^ \t\n]*/gm))?a[0]:null},Eq=function(){},Fq=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},Gq=function(){},Hq=function(a){this.a=a},Jq=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.rg:a.textAlign=
4
- _.Mp[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Me:_.Ne;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==_.od||b==_.ne?_.od:b==_.pd||b==_.bd?_.pd:_.yc);else if(d=/^region:(.*)$/.exec(b)){if(b=Iq(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=_.Np[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.tg,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Np[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Iq=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)},Kq=function(a){a=_.Oo(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)},Lq=function(){Hq.apply(this,arguments)},Mq=function(){this.a=null;this.f=new _.H("clpp.vtt.mp4")},Oq=function(a,b,c){var d,e,f;(new _.Zj).M("payl",_.ck(function(g){d=_.ah(g)})).M("iden",_.ck(function(g){e=_.ah(g)})).M("sttg",_.ck(function(g){f=_.ah(g)})).parse(a);return d?Nq(d,e,f,b,c):null},Nq=function(a,b,c,d,e){a=new _.wg(d,e,a);b&&(a.id=b);if(c)for(b=new _.No(c),c=Dq(b);c;)Jq(a,c,[])||_.F(xq,
7
- c,wq),Cq(b),c=Dq(b);return a},Pq=function(){this.a=new Gq};Eq.prototype.a=function(a){a=_.ah(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+=Fq(c.value)}return _.eh(a)};Gq.prototype.create=function(){return new Eq};Gq.prototype.probe=function(a,b){return(a===zq||a===yq)&&b===_.Ae};Hq.prototype.parseInit=function(){};
8
- Hq.prototype.parseMedia=function(a,b){var c=_.ah(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=Kq(new _.No(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 _.No(h.replace(/\n/g," "));g=new _.zg;Dq(h);Cq(h);for(var l=Dq(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,wq);Cq(h);l=Dq(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 _.No(p[0]);m=Kq(l);var r=_.Oo(l,/[ \t]+--\x3e[ \t]+/g);n=Kq(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 _.wg(m,n,p,_.Ve);g&&(m.id=g);Cq(l);for(n=Dq(l);n;)Jq(m,n,f)||_.F(xq,
12
- n,wq),Cq(l),n=Dq(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.v(Lq,Hq);Lq.prototype.parseMedia=function(a,b){return Hq.prototype.parseMedia.call(this,(new Eq).a(a),b)};Mq.prototype.parseInit=function(a){var b=this,c=!1;(new _.Zj).M(_.zd,_.ak).M(_.De,_.ak).M(_.ud,_.ak).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(_.yd,_.ak).M(_.re,_.ak).V(_.te,_.bk).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
- Mq.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 _.Zj).M("moof",_.ak).M("traf",_.ak).V("tfdt",function(I){g=!0;c=0==I.version?_.U(I.F):_.Xj(I.F)}).V("tfhd",function(I){var O=I.flags;I=I.F;I.skip(4);O&1&&I.skip(8);O&2&&I.skip(4);m=O&8?_.U(I):null}).V("trun",function(I){h=!0;var O=I.version,S=I.flags;I=I.F;var Ca=_.U(I);S&1&&I.skip(4);S&4&&I.skip(4);for(var da=[],fa=0;fa<Ca;fa++){var xa=
14
- {duration:null,sampleSize:null,Ze:null};S&256&&(xa.duration=_.U(I));S&512&&(xa.sampleSize=_.U(I));S&1024&&I.skip(4);S&2048&&(xa.Ze=0==O?_.U(I):_.Vj(I));da.push(xa)}d=da}).M(_.td,_.ck(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 _.Qj(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.Ze?c+r.Ze:n;n=x+(w||0);var B=0;do{var D=_.U(p);B+=D;var E=_.U(p);E=_.ek(E);var G=null;"vttc"==
15
- E?8<D&&(G=_.Yj(p,D-8)):("vtte"!=E&&this.f.error("Unknown box "+E+"! Skipping!"),p.skip(D-8));w?G&&f.push(Oq(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&&B<r.sampleSize)}return{cues:f.filter(_.Yl),styles:[]}};_.v(Pq,_.Zn);Pq.prototype.Ja=function(){_.tp[_.Ae]=Hq;_.tp[Aq]=Hq;_.tp[Bq]=Hq;_.tp[_.bc]=Mq;_.tp[zq]=Lq;_.tp[yq]=Lq;_.Dh.push(this.a)};Pq.prototype.Ca=function(){_.up(_.Ae);_.up(Aq);_.up(Bq);_.up(_.bc);_.up(zq);_.up(yq);_.Fh(this.a)};Pq.prototype.id=function(){return _.xe};_.C("clpp.vtt.VttComponent",Pq);};
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);};
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 nq="accountCode key is missing in Youbora config",oq="clpp.npaw.YouboraPlugin",pq="content.isLive",qq=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},rq=function(a){function b(c){var d=youbora.Adapter.call(this,c)||this;d.l=c;d.f=new _.bg;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.fa())){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 _.sa};b.prototype.getVersion=function(){return"6.4.0-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,_.oe,this.J.bind(this)),this.f.on(this.l,_.dd,this.D.bind(this)),this.f.on(this.l,_.Ke,this.I.bind(this)),this.f.on(this.l,_.Je,this.G.bind(this)),this.f.on(this.l,_.Tb,this.B.bind(this)),this.f.on(this.l,_.uc,this.C.bind(this)))};b.prototype.unregisterListeners=function(){this.a.debug(_.vb);_.eg(this.f)};b.prototype.dispose=function(){youbora.Adapter.prototype.dispose.call(this);this.A=!0};b.prototype.j=function(){return this.l.getStats()||_.fm()};
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 _.vm:this.m()&&this.g();break;case _.xm:this.g();this.w();this.fireResume();this.fireBufferEnd();break;case _.wm:this.m()&&this.g();this.w();this.fireBufferEnd();this.firePause();break;case _.jm:this.fireBufferEnd();this.fireStop();break;case _.qm:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();
7
- break;case _.om: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(_.Nc)?"Widevine":c.startsWith(_.Lc)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Od)?"ClearKey":c.startsWith(_.Kc)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()};b.prototype.D=
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
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)},sq=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 _.bg;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&&
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
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
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 _.sa};
13
- b.prototype.getVersion=function(){return"6.4.0-castlabsadsadapter-js"};b.prototype.getPlayerVersion=function(){return _.ia};b.prototype.registerListeners=function(){this.l&&this.f&&(this.f.on(this.l,_.Tb,this.I.bind(this)),this.f.on(this.l,_.Pb,this.G.bind(this)),this.f.on(this.l,_.Lb,this.B.bind(this)),this.f.on(this.l,_.Nb,this.C.bind(this)),this.f.on(this.l,_.Gb,this.w.bind(this)),this.f.on(this.l,_.Hb,this.j.bind(this,1)),this.f.on(this.l,_.Kb,this.j.bind(this,2)),this.f.on(this.l,_.Rb,this.j.bind(this,
14
- 3)),this.f.on(this.l,_.Fb,this.o.bind(this)),this.f.on(this.l,_.Ob,this.D.bind(this)),this.f.on(this.l,_.dd,this.A.bind(this)),this.f.on(this.l,_.Bb,this.J.bind(this)),this.f.on(this.l,_.Cb,this.K.bind(this)),this.f.on(this.l,_.Eb,this.L.bind(this)),this.f.on(this.l,_.Mb,this.O.bind(this)))};b.prototype.unregisterListeners=function(){_.eg(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);
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
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
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)},tq=function(){this.a=null;this.f=!1;this.g=new _.H(oq);this.l=null},uq=function(a,b){var c=b.getConfiguration();a.f=!_.K.R(c.youbora)&&typeof c.youbora===_.Gd;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===_.se&&null!=c.match(/^\d+\.\d+\.\d+$/)){if(d=!qq(c,"6.8.12"))d="6.8.25"===c||qq(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()===_.Dc&&(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
- vq=function(){};_.v(tq,_.Gp);_.t=tq.prototype;_.t.Ve=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);if(this.f){var b=a.getConfiguration().youbora;b.accountCode?this.Ve(new youbora.Plugin(b)):(this.g.warn(nq),a.onError(new _.L(1,9,9101)))}};
20
- _.t.onContentWillLoad=function(a,b){uq(this,a);if(this.f){var c=a.getConfiguration(),d=c.youbora;d.accountCode?(void 0===d[pq]&&(d[pq]=b.isLive),void 0===d["content.title"]&&(d["content.title"]=b.name),void 0===d.viewerId&&(d.viewerId=c.viewerId),this.a||this.Ve(new youbora.Plugin(d)),this.a.setOptions(d)):(this.g.warn(nq),a.onError(new _.L(1,9,9101)))}};_.t.onPlayerWillRelease=function(){};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"youbora"};_.C(oq,tq);
21
- tq.prototype.getAdsAdapter=tq.prototype.getAdsAdapter;tq.prototype.getAdapter=tq.prototype.getAdapter;tq.prototype.setYouboraPlugin=tq.prototype.Ve;tq.Id="youbora";vq.prototype.create=function(){return new tq};_.Un(new vq);};
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);};
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 DK=function(a){a.f=new _.Nn;a.f.on(a.l,_.ze,()=>BK(a));a.f.on(a.l,_.ye,()=>{s.Media.play(a.a,a.l.getPosition())});a.f.on(a.l,_.jd,()=>CK(a));a.f.on(a.l,_.ge,b=>{b=b.detail;switch(b.currentState){case _.ll:a.a.length||CK(a);s.Media.play(a.a,a.l.getPosition());break;case _.kl:case _.dl:BK(a);break;case _.$k:case _.il:case _.hl:a.g.info(`Close session for ${a.a} `+`in player state ${b.currentState}.`),BK(a),s.Media.close(a.a),a.a=""}})},BK=function(a){s.Media.stop(a.a,a.l.getPosition())},
2
- CK=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(),_.na)},EK=class extends _.Ep{constructor(){super();this.l=this.f=null;this.a="";this.g=new _.N("clpp.adobe.AdobePlugin")}onPlayerCreated(a){window.s&&s.Media?(this.l=a,DK(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
- _.y("clpp.adobe.AdobeAnalyticsPlugin",EK);EK.Id="adobe";_.km(new class{create(){return new EK}});};f.call(g, window);
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);
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 AK=class extends _.Ep{constructor(){super();this.a=this.l=null;this.j=this.f=this.h=!1;this.m=new _.fo(()=>{this.l.play().catch(()=>{})});this.g=new _.Nn}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(_.Kb,{canCast:this.f}))}w(){const a=(this.h=this.a.webkitCurrentPlaybackTargetIsWireless)?_.Jb:_.Ib;if(this.j||!this.l.isPaused()||this.l.getState()===_.ll)this.j?this.l.play().catch(()=>{}):this.m.ba(.01);this.l.trigger(new _.C(a))}fb(){return this.h}ed(){return this.f}Of(){this.f&&(this.j=!this.l.isPaused(),this.a.webkitShowPlaybackTargetPicker())}};_.y("clpp.airplay.AirPlayPlugin",AK);AK.prototype.showCastMenu=AK.prototype.Of;
3
- AK.prototype.canCast=AK.prototype.ed;AK.prototype.isCasting=AK.prototype.fb;AK.Id="airplay";_.km(new class{create(){return new AK}});};f.call(g, window);
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);
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 tK=function(){return!window.SmartLib||!window.GenericPlayerApi},uK=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===_.je&&a.g.setUUID(b))},wK=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,_.Tc,a.U.bind(a));a.h=new vK(a.l);a.a.attachPlayer(a.h)},xK=function(a,b){_.Kf(a.j);a.f&&
2
- (a.f.release(),a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},yK=class{constructor(a,b){this.l=a;this.f=b;this.a=new _.Nn;this.g=!1}init(){const a=this.l,b=this.a;b.on(a,_.ge,this.m.bind(this));b.on(a,_.bc,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&&(_.Kf(this.a),this.a=null)}};var vK=class extends GenericPlayerApi{constructor(a){super();this.l=a;this.a=_.ei()}getPlayerName(){return _.na}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 zK=class extends _.Ep{constructor(){super();this.h=this.f=this.a=this.g=this.l=null;this.j=new _.Nn}onPlayerCreated(a){this.l=a}onContentWillLoad(a,b){const c=a.getConfiguration().broadpeak;if(c){if(tK())return a.onError(new _.G(1,9,11E3));uK(this,c);wK(this,c);return this.a.getURL(b.url).then(d=>{if(d.isError()){const e=d.getDetailedErrorCode();d=d.getDetailedErrorMessage();this.l.onError(new _.G(1,9,11001,{bpkErrorCode:e,message:d}));xK(this,void 0)}else b.url=d.getURL(),this.f=new yK(this.l,
4
- this.h),this.f.init()})}}U(a){a=a.detail;if(7003===a.code)xK(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.F)switch(a.category){case 3:xK(this,SmartLib.BPDecodingError);break;case 1:xK(this,SmartLib.BPNetworkingError);break;case 6:xK(this,SmartLib.BPAccessRightError);break;default:xK(this,SmartLib.BPUnspecifiedError)}}onPlayerWillRelease(){tK()||xK(this,SmartLib.BPSessionEndsNormally)}id(){return"broadpeak"}};_.y("clpp.broadpeak.BroadpeakPlugin",zK);zK.isSdkMissing=tK;zK.Id="broadpeak";
5
- _.km(new class{create(){return new zK}});};f.call(g, window);
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);