@castlabs/prestoplay 6.27.0 → 6.29.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 (67) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +125 -114
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +632 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +201 -100
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -78
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +351 -351
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +71 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +39 -39
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +6 -5
  36. package/cl.cast.js +98 -90
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +509 -501
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +83 -82
  41. package/cl.externs.js +197 -100
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +82 -80
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mediatailor.js +2 -3
  48. package/cl.mse.js +303 -305
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +60 -60
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -29
  64. package/package.json +1 -1
  65. package/typings.d.ts +221 -152
  66. package/cjs/cl.sessions.js +0 -21
  67. package/cl.sessions.js +0 -10
package/cl.vr.js CHANGED
@@ -1,15 +1,15 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Gw="touchmove",Hw="touchstart",Jw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Iw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Kw=function(a,b){const c=a.x,d=a.y,e=a.a;a=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*a),2*(c*e+d*a),0,2*(c*d+e*a),1-2*(c*c+e*e),2*(d*e-c*a),0,2*(c*e-d*a),2*(d*e+c*a),1-2*(c*c+d*d),0,0,0,0,1)},Lw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Mw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Nw=function(a,b,c){const d=b.x,e=b.y;
2
- b=b.a;const 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},Ow=function(a,b,c){b=b.a;c=c.a;const d=a.a;let 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+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},Qw=function(a){var b=new Pw(0,0,0),c=new Pw(0,0,1);const d=new Pw,e=new Pw,f=new Pw;a=a.a;var g=
3
- new Pw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Lw(f,1/g);c=Nw(d,c,f);g=c.length();Lw(c,1/g);Nw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Mw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Mw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Mw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Rw=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 _.I(1,9,9004,"Unable to compile GL shader: "+
4
- a.a.getShaderInfoLog(b));return b},Sw=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Gw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Tw=function(a){const b=Jw(1,0,a.l*Math.PI/180);Kw(Jw(0,1,a.j*Math.PI/180),a.P);Kw(b,a.R);Qw(a.ca);Ow(a.ea,a.P,a.ca);Ow(a.G,a.R,a.ea)},Iw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Pw=class{constructor(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)}};var Uw=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,p,u,v,y){const 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]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=p;A[7]=u;A[11]=v;A[15]=y;return this}};var Vw=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Rw(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=Rw(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");
5
- a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.I(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var Ww=class{constructor(a){this.a=a;var b=[];let 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;const g=Math.cos(f);for(c=0;128>=c;c++){const h=c/128,k=(.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(k)*g),b.push(100*Math.sin(k)*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=5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+
6
- 4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var Xw=class{constructor(a,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)}};var Yw={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},Zw=class extends _.Iv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Z=this.G=this.f=this.a=this.m=null;this.g=new _.S("clpp.vr");this.H=70;this.V=1;this.M=this.L=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
7
- b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.h={x:0,y:0};this.P=new Uw;this.R=new Uw;this.ca=new Uw;this.ea=new Uw;this.A=this.ia.bind(this);this.B=this.ya.bind(this);this.J=this.ha.bind(this)}onPlayerCreated(a){this.g.info("Player created");this.m=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
8
- if(void 0!==d&&_.hh(d))this.H=d;else throw new _.I(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.hh(e)&&0<e)this.V=e;else throw new _.I(1,7,7100,"sensitivity configuration must be a positive number");this.L=!!f;this.M=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.t){this.g.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Yw)||this.a.getContext("experimental-webgl",
9
- Yw);if(!this.f)throw new _.I(1,9,9003,"Unable to create GL context");this.G=new Uw;Qw(this.G);this.Z=new Ww(this.f);this.C=new Vw(this.f);this.I=new Uw;this.K=new Uw;this.o=this.w=null;this.a.addEventListener(_.yf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Hw,this.J,!1));this.F();this.T()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.g.info("Releasing VR plugin resources");
10
- this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Sw(this),this.a.removeEventListener(_.yf,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.w(function*(){a.m=null})}id(){return"vr"}T(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.T.bind(this));
11
- var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Xw(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,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=Ow(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
12
- 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.C.h,!1,this.I.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.Z;a.a.bindBuffer(a.a.ARRAY_BUFFER,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,
13
- 0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ha(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Hw)a.type===Hw?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Gw,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
- this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Gw&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.V;const {Vg:e,Wg:f}={Vg:a*b*(this.L?-1:1),Wg:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;Tw(this)}ya(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Sw(this)}Oh(a,b){this.l=b;this.j=a;Tw(this)}qh(){return{x:this.j,y:this.l}}ki(a){this.H=a;this.F()}};
15
- _.x("clpp.vr.VrPlugin",Zw);Zw.prototype.setCameraFieldOfView=Zw.prototype.ki;Zw.prototype.getCameraCoordinates=Zw.prototype.qh;Zw.prototype.moveCamera=Zw.prototype.Oh;Zw.Id="vr";_.fs(new class{create(){return new Zw}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Tw="touchmove",Uw="touchstart",Ww=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Vw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Xw=function(a,b){const c=a.x,d=a.y,e=a.a;a=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*a),2*(c*e+d*a),0,2*(c*d+e*a),1-2*(c*c+e*e),2*(d*e-c*a),0,2*(c*e-d*a),2*(d*e+c*a),1-2*(c*c+d*d),0,0,0,0,1)},Yw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Zw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},$w=function(a,b,c){const d=b.x,e=b.y;
2
+ b=b.a;const 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},ax=function(a,b,c){b=b.a;c=c.a;const d=a.a;let 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+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},cx=function(a){var b=new bx(0,0,0),c=new bx(0,0,1);const d=new bx,e=new bx,f=new bx;a=a.a;var g=
3
+ new bx(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Yw(f,1/g);c=$w(d,c,f);g=c.length();Yw(c,1/g);$w(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Zw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Zw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Zw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},dx=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 _.H(1,9,9004,"Unable to compile GL shader: "+
4
+ a.a.getShaderInfoLog(b));return b},ex=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Tw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},fx=function(a){const b=Ww(1,0,a.l*Math.PI/180);Xw(Ww(0,1,a.j*Math.PI/180),a.P);Xw(b,a.R);cx(a.ba);ax(a.ca,a.P,a.ba);ax(a.G,a.R,a.ca)},Vw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var bx=class{constructor(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)}};var gx=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,p,u,v,y){const 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]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=p;A[7]=u;A[11]=v;A[15]=y;return this}};var hx=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=dx(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=dx(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");
5
+ a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var ix=class{constructor(a){this.a=a;var b=[];let 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;const g=Math.cos(f);for(c=0;128>=c;c++){const h=c/128,k=(.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(k)*g),b.push(100*Math.sin(k)*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=5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+
6
+ 4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var jx=class{constructor(a,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)}};var kx={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},lx=class extends _.Uv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Y=this.G=this.f=this.a=this.m=null;this.g=new _.S("clpp.vr");this.H=70;this.V=1;this.M=this.L=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
7
+ b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.h={x:0,y:0};this.P=new gx;this.R=new gx;this.ba=new gx;this.ca=new gx;this.A=this.ia.bind(this);this.B=this.za.bind(this);this.J=this.ha.bind(this)}onPlayerCreated(a){this.g.info("Player created");this.m=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
8
+ if(void 0!==d&&_.kh(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.kh(e)&&0<e)this.V=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.L=!!f;this.M=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.t){this.g.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",kx)||this.a.getContext("experimental-webgl",
9
+ kx);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new gx;cx(this.G);this.Y=new ix(this.f);this.C=new hx(this.f);this.I=new gx;this.K=new gx;this.o=this.w=null;this.a.addEventListener(_.Af,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Uw,this.J,!1));this.F();this.T()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.g.info("Releasing VR plugin resources");
10
+ this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(ex(this),this.a.removeEventListener(_.Af,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.w(function*(){a.m=null})}id(){return"vr"}T(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.T.bind(this));
11
+ var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new jx(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,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=ax(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
12
+ 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.C.h,!1,this.I.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.Y;a.a.bindBuffer(a.a.ARRAY_BUFFER,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,
13
+ 0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ha(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Uw)a.type===Uw?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Tw,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
+ this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Tw&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.V;const {qh:e,rh:f}={qh:a*b*(this.L?-1:1),rh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;fx(this)}za(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();ex(this)}hi(a,b){this.l=b;this.j=a;fx(this)}Lh(){return{x:this.j,y:this.l}}Hi(a){this.H=a;this.F()}};
15
+ _.x("clpp.vr.VrPlugin",lx);lx.prototype.setCameraFieldOfView=lx.prototype.Hi;lx.prototype.getCameraCoordinates=lx.prototype.Lh;lx.prototype.moveCamera=lx.prototype.hi;lx.Id="vr";_.Wn(new class{create(){return new lx}});};f.call(g, window);
package/cl.vtt.js CHANGED
@@ -1,12 +1,12 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nw=" The setting will be ignored.",ow="VTT parser encountered an invalid VTT setting: ",pw="application/x-subrip",qw="text/srt",rw='text/vtt; codecs\x3d"vtt"',sw='text/vtt; codecs\x3d"wvtt"',tw=function(a){return a.a===a.f.length?null:(a=_.cj(a,/[^ \t\n]*/gm))?a[0]:null},uw=function(a){_.cj(a,/[ \t]+/gm)},vw=function(a){let 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+/)&&
2
- a[1].match(/\d+:\d+:\d+/)&&(b+=`${a[0].match(/\w+/)}\n`,++c);if(a[c].match(/\d+:\d+:\d+/)){const 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]} --> `,b+=`${d[5]}:${d[6]}:${d[7]}.${d[8]}\n`,++c;else return""}else return"";a[c]&&(b+=`${a[c]}\n\n`);return b},ww=function(a){a=_.cj(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==a)return null;const b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+
3
- c+60*b+3600*(Number(a[1])||0)},yw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.Nt:a.textAlign=_.Tt[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.qg:_.rg;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===_.ke||b===_.Mf?_.ke:b===_.le||b===_.Sd?
4
- _.le:_.Vc);else if(d=/^region:(.*)$/.exec(b)){if(b=xw(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]),c[2]&&(a.lineAlign=_.Ut[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Pt,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Ut[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},xw=function(a,b){a=a.filter(c=>c.id===b);return a.length?a[0]:(_.B("VTT parser could not find a region with id: ",
5
- b," The region will be ignored."),null)},Aw=function(a,b,c){let d,e,f;(new _.Nm).N("payl",_.Im(g=>{d=_.Bi(g)})).N("iden",_.Im(g=>{e=_.Bi(g)})).N("sttg",_.Im(g=>{f=_.Bi(g)})).parse(a);return d?zw(d,e,f,b,c):null},zw=function(a,b,c,d,e){a=new _.St(d,e,a,_.Bg);b&&(a.id=b);if(c)for(b=new _.dj(c),c=tw(b);c;)yw(a,c,[])||_.B(ow,c,nw),uw(b),c=tw(b);return a},Bw=class{a(a){a=_.Bi(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");a=a.split("\n\n");let b="";if(0<a.length){b+=
6
- "WEBVTT\n\n";for(const c of a)b+=vw(c)}return _.Fi(b)}},Cw=class{create(){return new Bw}probe(a,b){return(a===qw||a===pw)&&b===_.Wf}};var Dw=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Bi(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.I(_.F,2,2E3);a=b.periodStart;if(c[0].includes("X-TIMESTAMP-MAP")){var d=c[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),e=c[0].match(/MPEGTS:(\d+)/m);if(d&&e){a=ww(new _.dj(d[1]));if(null==a)throw new _.I(_.F,2,2E3);e=Number(e[1]);for(d=b.segmentStart;95443.7176888889<=d;)d-=95443.7176888889,e+=
7
- 8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.dj(f.replace(/\n/g," "));d=new _.Xt;tw(e);uw(e);for(var g=tw(e);g;){a:{var h;var k=d;var l=g;if(h=/^id:(.*)$/.exec(l))k.id=h[1];else if(h=/^width:(\d{1,2}|100)%$/.exec(l))k.width=Number(h[1]);else if(h=/^lines:(\d+)$/.exec(l))k.height=Number(h[1]),k.heightUnits=2;else if(h=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.regionAnchorX=
8
- Number(h[1]),k.regionAnchorY=Number(h[2]);else if(h=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.viewportAnchorX=Number(h[1]),k.viewportAnchorY=Number(h[2]);else if(/^scroll:up$/.exec(l))k.scroll="up";else{k=!1;break a}k=!0}k||_.B("VTT parser encountered an invalid VTTRegion setting: ",g,nw);uw(e);g=tw(e)}e=d;b.push(e)}f=[];for(var m of c)if(/^style/.test(m.toLowerCase())){e=m.replace(/^style/i,"").replace(/\n/g," ");d=/[^{}]+{[^{}]*}/g;do(g=d.exec(e))&&f.push(g[0]);while(g)}m=[];for(const n of c)if(n.includes("--\x3e")){a:{l=
9
- n.split("\n");h=a;c=b;if(1===l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"===l[0]){c=null;break a}e=null;l[0].includes("--\x3e")||(e=l[0],l.splice(0,1));d=new _.dj(l[0]);g=ww(d);const p=_.cj(d,/[ \t]+--\x3e[ \t]+/g);k=ww(d);if(null==g||null==p||null==k)throw new _.I(_.F,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.St(g,k,l,_.Bg);e&&(g.id=e);uw(d);for(k=tw(d);k;)yw(g,k,c)||_.B(ow,k,nw),uw(d),k=tw(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Ew=class extends Dw{parseMedia(a,b){return super.parseMedia((new Bw).a(a),b)}};var Fw=class{constructor(){this.a=null;this.g=new _.S("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.Nm).N(_.Be,_.Gm).N(_.eg,_.Gm).N(_.te,_.Gm).fa("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.O(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.O(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.Ae,_.Gm).N(_.Pf,_.Gm).fa(_.Rf,_.Hm).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.I(_.F,2,2008);if(!b)throw new _.I(_.F,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
- new _.I(_.F,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.Nm).N("moof",_.Gm).N("traf",_.Gm).fa("tfdt",p=>{g=!0;c=0===p.version?_.O(p.reader):_.Bm(p.reader)}).fa("tfhd",p=>{var u=p.flags;p=p.reader;p.skip(4);u&1&&p.skip(8);u&2&&p.skip(4);l=u&8?_.O(p):null}).fa("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.O(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,cf:null};v&256&&(E.duration=_.O(p));v&512&&(E.sampleSize=
11
- _.O(p));v&1024&&p.skip(4);v&2048&&(E.cf=0===u?_.O(p):_.Am(p));A.push(E)}d=A}}).N(_.se,_.Im(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.I(_.F,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Jn(m,!1);for(const p of d){const u=p.duration||l,v=p.cf?c+p.cf:a;a=v+(u||0);let y=0;do{const A=_.O(m);y+=A;var n=_.O(m);n=_.Fm(n);let D=null;"vttc"===n?8<A&&(D=_.Dm(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(Aw(D,b.periodStart+v/this.a,
12
- b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(p.sampleSize&&y<p.sampleSize)}return{cues:f.filter(_.mi),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.uv{constructor(){super();this.j=new Cw}f(){_.vt(_.Wf,Dw);_.vt(rw,Dw);_.vt(sw,Dw);_.vt(_.xc,Fw);_.vt(qw,Ew);_.vt(pw,Ew);_.xl.push(this.j)}a(){_.xt(_.Wf);_.xt(rw);_.xt(sw);_.xt(_.xc);_.xt(qw);_.xt(pw);_.zl(this.j)}id(){return"subtitles-vtt"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Aw=" The setting will be ignored.",Bw="VTT parser encountered an invalid VTT setting: ",Cw="application/x-subrip",Dw="text/srt",Ew='text/vtt; codecs\x3d"vtt"',Fw='text/vtt; codecs\x3d"wvtt"',Gw=function(a){return a.a===a.f.length?null:(a=_.pr(a,/[^ \t\n]*/gm))?a[0]:null},Hw=function(a){_.pr(a,/[ \t]+/gm)},Iw=function(a){let 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+/)&&
2
+ a[1].match(/\d+:\d+:\d+/)&&(b+=`${a[0].match(/\w+/)}\n`,++c);if(a[c].match(/\d+:\d+:\d+/)){const 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]} --> `,b+=`${d[5]}:${d[6]}:${d[7]}.${d[8]}\n`,++c;else return""}else return"";a[c]&&(b+=`${a[c]}\n\n`);return b},Jw=function(a){a=_.pr(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==a)return null;const b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+
3
+ c+60*b+3600*(Number(a[1])||0)},Lw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.qu:a.textAlign=_.wu[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.wg:_.xg;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===_.me||b===_.Pf?_.me:b===_.ne||b===_.Vd?
4
+ _.ne:_.Wc);else if(d=/^region:(.*)$/.exec(b)){if(b=Kw(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]),c[2]&&(a.lineAlign=_.xu[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.su,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.xu[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Kw=function(a,b){a=a.filter(c=>c.id===b);return a.length?a[0]:(_.B("VTT parser could not find a region with id: ",
5
+ b," The region will be ignored."),null)},Nw=function(a,b,c){let d,e,f;(new _.op).N("payl",_.jp(g=>{d=_.pi(g)})).N("iden",_.jp(g=>{e=_.pi(g)})).N("sttg",_.jp(g=>{f=_.pi(g)})).parse(a);return d?Mw(d,e,f,b,c):null},Mw=function(a,b,c,d,e){a=new _.vu(d,e,a,_.Eg);b&&(a.id=b);if(c)for(b=new _.qr(c),c=Gw(b);c;)Lw(a,c,[])||_.B(Bw,c,Aw),Hw(b),c=Gw(b);return a},Ow=class{a(a){a=_.pi(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");a=a.split("\n\n");let b="";if(0<a.length){b+=
6
+ "WEBVTT\n\n";for(const c of a)b+=Iw(c)}return _.ti(b)}},Pw=class{create(){return new Ow}probe(a,b){return(a===Dw||a===Cw)&&b===_.Zf}};var Qw=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.pi(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.H(_.C,2,2E3);a=b.periodStart;if(c[0].includes("X-TIMESTAMP-MAP")){var d=c[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),e=c[0].match(/MPEGTS:(\d+)/m);if(d&&e){a=Jw(new _.qr(d[1]));if(null==a)throw new _.H(_.C,2,2E3);e=Number(e[1]);for(d=b.segmentStart;95443.7176888889<=d;)d-=95443.7176888889,e+=
7
+ 8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.qr(f.replace(/\n/g," "));d=new _.Au;Gw(e);Hw(e);for(var g=Gw(e);g;){a:{var h;var k=d;var l=g;if(h=/^id:(.*)$/.exec(l))k.id=h[1];else if(h=/^width:(\d{1,2}|100)%$/.exec(l))k.width=Number(h[1]);else if(h=/^lines:(\d+)$/.exec(l))k.height=Number(h[1]),k.heightUnits=2;else if(h=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.regionAnchorX=
8
+ Number(h[1]),k.regionAnchorY=Number(h[2]);else if(h=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.viewportAnchorX=Number(h[1]),k.viewportAnchorY=Number(h[2]);else if(/^scroll:up$/.exec(l))k.scroll="up";else{k=!1;break a}k=!0}k||_.B("VTT parser encountered an invalid VTTRegion setting: ",g,Aw);Hw(e);g=Gw(e)}e=d;b.push(e)}f=[];for(var m of c)if(/^style/.test(m.toLowerCase())){e=m.replace(/^style/i,"").replace(/\n/g," ");d=/[^{}]+{[^{}]*}/g;do(g=d.exec(e))&&f.push(g[0]);while(g)}m=[];for(const n of c)if(n.includes("--\x3e")){a:{l=
9
+ n.split("\n");h=a;c=b;if(1===l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"===l[0]){c=null;break a}e=null;l[0].includes("--\x3e")||(e=l[0],l.splice(0,1));d=new _.qr(l[0]);g=Jw(d);const p=_.pr(d,/[ \t]+--\x3e[ \t]+/g);k=Jw(d);if(null==g||null==p||null==k)throw new _.H(_.C,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.vu(g,k,l,_.Eg);e&&(g.id=e);Hw(d);for(k=Gw(d);k;)Lw(g,k,c)||_.B(Bw,k,Aw),Hw(d),k=Gw(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Rw=class extends Qw{parseMedia(a,b){return super.parseMedia((new Ow).a(a),b)}};var Sw=class{constructor(){this.a=null;this.g=new _.S("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.op).N(_.De,_.hp).N(_.hg,_.hp).N(_.ye,_.hp).ea("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.M(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.M(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.Ce,_.hp).N(_.Sf,_.hp).ea(_.Uf,_.ip).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.H(_.C,2,2008);if(!b)throw new _.H(_.C,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
+ new _.H(_.C,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.op).N("moof",_.hp).N("traf",_.hp).ea("tfdt",p=>{g=!0;c=0===p.version?_.M(p.reader):_.cp(p.reader)}).ea("tfhd",p=>{var u=p.flags;p=p.reader;p.skip(4);u&1&&p.skip(8);u&2&&p.skip(4);l=u&8?_.M(p):null}).ea("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.M(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,qf:null};v&256&&(E.duration=_.M(p));v&512&&(E.sampleSize=
11
+ _.M(p));v&1024&&p.skip(4);v&2048&&(E.qf=0===u?_.M(p):_.bp(p));A.push(E)}d=A}}).N(_.xe,_.jp(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.H(_.C,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.gq(m,!1);for(const p of d){const u=p.duration||l,v=p.qf?c+p.qf:a;a=v+(u||0);let y=0;do{const A=_.M(m);y+=A;var n=_.M(m);n=_.gp(n);let D=null;"vttc"===n?8<A&&(D=_.ep(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(Nw(D,b.periodStart+v/this.a,
12
+ b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(p.sampleSize&&y<p.sampleSize)}return{cues:f.filter(_.Qm),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.Ev{constructor(){super();this.a=new Pw}install(){_.zt(_.Zf,Qw);_.zt(Ew,Qw);_.zt(Fw,Qw);_.zt(_.zc,Sw);_.zt(Dw,Rw);_.zt(Cw,Rw);_.Pr.push(this.a)}uninstall(){_.Bt(_.Zf);_.Bt(Ew);_.Bt(Fw);_.Bt(_.zc);_.Bt(Dw);_.Bt(Cw);_.Rr(this.a)}id(){return"subtitles-vtt"}});};f.call(g, window);
package/cl.yospace.js CHANGED
@@ -1,3 +1,3 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jw="clpp.yospace.YospacePlugin",mw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(jw)}Tf(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Fe)throw new _.I(_.F,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||kw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case kw:d=YospaceAdManagement.SessionVOD.create(e);
2
- break a;case lw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.I(_.F,9,7003,"Yospace session failed to initialize.");a.trigger(new _.C(_.Og,{detail:d}));b.url=d.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=d}})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
3
- const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.C(_.Ng,{detail:b}))}}id(){return"yospace"}};_.x(jw,mw);mw.prototype.getSession=mw.prototype.Tf;mw.Id="yospace";_.fs(new class{create(){return new mw}});var kw=_.Db,lw="LIVE";_.x("clpp.yospace.StreamType",{VOD:kw,LIVE:lw,DVR:"DVR"});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vw="clpp.yospace.YospacePlugin",yw=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.S(vw)}gg(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.He)throw new _.H(_.C,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||ww;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case ww:d=YospaceAdManagement.SessionVOD.create(e);
2
+ break a;case xw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.H(_.C,9,7003,"Yospace session failed to initialize.");a.trigger(new _.G(_.Rg,{detail:d}));b.url=d.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=d}})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
3
+ const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.G(_.Qg,{detail:b}))}}id(){return"yospace"}};_.x(vw,yw);yw.prototype.getSession=yw.prototype.gg;yw.Id="yospace";var zw=class{create(){return new yw}},ww=_.Db,xw="LIVE";_.x("clpp.yospace.StreamType",{VOD:ww,LIVE:xw,DVR:"DVR"});_.Wn(new zw);};f.call(g, window);
package/cl.youbora.js CHANGED
@@ -1,29 +1,31 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jv="Unhandled state",Kv="accountCode key is missing in Youbora config",Lv="ad break start",Mv="ad buffering ended",Nv="ad buffering started",Ov="ad click through url: ",Pv="ad timeline changed",Qv="clpp.npaw.NpawPlugin",Rv="clpp.npaw.YouboraPlugin",Sv="content.isLive",Tv="content.title",Uv="is container visible",Vv="youbora",Wv=function(a){return a.startsWith(_.ud)?"Widevine":a.startsWith(_.qd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Oe)?
2
- "ClearKey":a.startsWith(_.pd)?"Primetime":a},Xv=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},Yv=function(a,b){if(b.namespace()===_.ed)return a.g.info("NPAW does not report when casting."),!1;const c=b.getConfiguration().youbora;return _.fh(c)?c.accountCode?_.z(window.NpawPlugin)||_.z(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.I(1,9,9100)),!1):!0:(a.g.warn(Kv),b.onError(new _.I(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),
3
- !1)},Zv=function(a,b){if(b.namespace()===_.ed)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.fh(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.g.warn(Kv),b.onError(new _.I(1,9,9101)),!1;if(_.z(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.I(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found "+
4
- `version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.I(1,9,9102)));return!0},$v=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),aw=(a,b,c,d)=>{b=$v(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.Ud;b.severity===_.F?(d.fireFatalError(b.code,b.message,b.metadata),c.debug(`Reporting "fatal ${a}" to Youbora`,
5
- b.code,b)):(d.fireError(b.code,b.message,b.metadata),c.debug(`Reporting "${a}" to Youbora`,b.code,b));return b};var bw=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Kt;this.g=new _.S("clpp.npaw.YouboraAdapter");this.h=this.o=!1;this.registerListeners()}getPlayhead(){return this.getIsLive()?-1:this.m.getPosition()}getDuration(){return this.m.getDuration()}getRendition(){let c,d,e;var f=this.m.getTrackManager();f&&(f=f.qa())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.j(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
6
- d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ea())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.27.0-castlabsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&this.a&&(this.g.debug("registering listeners"),
7
- youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Nf,this.I.bind(this)),this.a.on(this.m,_.Ud,this.F.bind(this)),this.a.on(this.m,_.ng,this.H.bind(this)),this.a.on(this.m,_.mg,this.G.bind(this)),this.a.on(this.m,_.pc,this.B.bind(this)),this.a.on(this.m,_.Rc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.xb);_.Hh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.ep()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.l("state change",c);if(c)switch(c.currentState){case _.qp:this.w()&&
8
- this.f();break;case _.sp:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.rp:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.pp:this.fireBufferEnd();this.fireStop();break;case _.hp:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.lp:this.fireBufferBegin();break;default:this.g.debug(Jv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&(c=Wv(c.keySystem))&&
9
- this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=aw(c,this.m,this.g,this))&&c.severity===_.F&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Ff),this.f(),this.fireSeekBegin())}G(){this.l(_.Ef);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Fb()}C(c){this.g.debug("Casting",c);this.fireCasted()}l(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var cw=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Kt;this.g=new _.S("clpp.npaw.YouboraAdsAdapter");this.registerListeners();this.l=!1}getDuration(){return this.a&&this.a.getDuration()}getRendition(){let c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.bb(),this.a.ab(),this.a.Na()));return c}getBitrate(){return this.a&&this.a.Na()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&
10
- this.a.getTitle()}getProvider(){return this.a&&this.a.getAdvertiserName()}getCreativeId(){return this.a&&this.a.getCreativeId()}getPosition(){const c=youbora.Constants.AdPosition;let d=null;if(this.a)switch(this.a.Oa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.m.getAdsManager();return c&&0<c.getVolume()}getExpectedBreaks(){return this.j&&
11
- this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.cb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.m.getDuration():c)}getIsFullscreen(){return this.m.getSurface().isFullscreen()}getIsVisible(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug(Uv,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.27.0-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&
12
- this.f&&(this.f.on(this.m,_.pc,this.M.bind(this)),this.f.on(this.m,_.kc,this.L.bind(this)),this.f.on(this.m,_.dc,this.I.bind(this)),this.f.on(this.m,_.fc,this.J.bind(this)),this.f.on(this.m,_.Wb,this.G.bind(this)),this.f.on(this.m,_.Xb,this.o.bind(this,1)),this.f.on(this.m,_.cc,this.o.bind(this,2)),this.f.on(this.m,_.nc,this.o.bind(this,3)),this.f.on(this.m,_.Vb,this.F.bind(this)),this.f.on(this.m,_.gc,this.K.bind(this)),this.f.on(this.m,_.Ud,this.H.bind(this)),this.f.on(this.m,_.Sb,this.A.bind(this)),
13
- this.f.on(this.m,_.Tb,this.B.bind(this)),this.f.on(this.m,_.Ub,this.C.bind(this)),this.f.on(this.m,_.ec,this.w.bind(this)))}unregisterListeners(){_.Hh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(Pv,c);this.j=c.adsTimeline}L(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.h("ad ended");this.fireStop()}I(){this.h("ad pause");this.w();this.firePause()}J(){this.h("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.h(Nv);this.fireBufferBegin()}w(){this.l&&
14
- (this.h(Mv),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.nb();this.g.debug(Ov,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Lv,this.a);this.fireBreakStart()}B(){this.h("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&aw(c,this.m,this.g,this)}h(c,
15
- ...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var ew=()=>{class a extends NpawPluginAdapters.video.Shaka{constructor(){super();this.f=this.h=!1;this.a=null}getPlayhead(){return this.getIsLive()?-1:this.player.getPosition()}getDuration(){return this.player.getDuration()}getRendition(){let b=null,c=null,d=null;var e=this.player.getTrackManager();e&&(e=e.qa())&&(b=e.width,c=e.height,d=e.bandwidth);b&&c&&d||(e=this.j(),b=b||e.width,c=c||e.height,d=d||e.streamBandwidth);return this.getNpawUtils().buildRenditionString(b,c,d)}getIsLive(){return this.player.isLive()}getResource(){const b=
16
- this.player.getLoadedSource();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.getPlaybackRate()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Ea())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.27.0-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=this.w();this.player&&b&&(b.on(this.player,_.Nf,this.K.bind(this)),b.on(this.player,
17
- _.Ud,this.H.bind(this)),b.on(this.player,_.Ff,this.J.bind(this)),b.on(this.player,_.Ef,this.I.bind(this)),b.on(this.player,_.pc,this.F.bind(this)),b.on(this.player,_.Rc,this.G.bind(this)),b.on(this.player,_.Jc,this.L.bind(this)),b.on(this.player,_.Yf,this.M.bind(this)))}unregisterListeners(){dw.debug(_.xb);_.Hh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||_.ep()}o(){return!!this.player.getConfiguration().autoplay}K(b){b=b.detail;this.l("state change",
18
- b);if(b)switch(b.currentState){case _.qp:this.plugin.setVideoOptions({"content.subtitles":this.C()});this.o()&&this.fireStart();break;case _.sp:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();break;case _.rp:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case _.pp:this.fireBufferEnd();this.fireStop();break;case _.hp:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.lp:this.fireBufferBegin();break;
19
- default:dw.debug(Jv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=aw(b,this.player,dw,this))&&b.severity===_.F&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.Ff),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Vf&&(d=c.ta());b===_.q&&(d=c.oa());return d?d.language:null}L(){const b=this.B(_.q);this.plugin.setVideoOptions({"content.language":b})}M(){const b=this.B(_.Vf),c=this.C();this.plugin.setVideoOptions({"content.subtitles":b||
20
- c})}w(){this.a||(this.a=new _.Kt);return this.a}I(){this.l(_.Ef);this.fireSeekEnd()}F(b){dw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Fb()}G(b){dw.debug("Casting",b);this.fireCasted()}l(b,...c){dw.debug(`Reporting "${b}" event to NPAW`,...c)}C(){const b=this.player.getConfiguration();return b.youbora&&b.youbora.disabledSubtitlesLabel?b.youbora.disabledSubtitlesLabel:"off"}}return a},dw=new _.S("clpp.npaw.NpawAdapter");var gw=()=>{class a extends NpawPluginAdapters.ads.Ima{constructor(){super();this.j=this.h=this.l=this.a=null;this.o=!1}getDuration(){return this.a?this.a.getDuration():null}getRendition(){let b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.bb(),this.a.ab(),this.a.Na()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Na());return b}getPlayhead(){let b=null;const c=this.player.getAdsManager();c&&(b=c.getPosition());return b}getResource(){let b=null;this.a&&(b=this.a.getMediaUrl());
21
- return b}getTitle(){let b=null;this.a&&(b=this.a.getTitle());return b}getProvider(){let b=null;this.a&&(b=this.a.getAdvertiserName());return b}getCreativeId(){let b=null;this.a&&(b=this.a.getCreativeId());return b}dispose(){this.unregisterListeners();this.j=this.h=this.a=null}getPosition(){const b=this.getNpawReference().Constants.AdPosition;let c=null;if(this.a)switch(this.a.Oa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}fw.debug("Ad position",c);return c}getIsSkippable(){return this.a&&
22
- -1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const b=this.player.getAdsManager();return b&&0<b.getVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.cb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.h&&this.h.getCuePoints().map(b=>-1===b?this.player.getDuration():b)}getIsFullscreen(){return this.player.getSurface().isFullscreen()}getIsVisible(){var b=this.player.getSurface().getContainer();
23
- b=this.getNpawUtils().calculateAdViewability(b);fw.debug(Uv,b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.27.0-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Kt);return this.j}registerListeners(){const b=this.B();this.player&&b&&(b.on(this.player,_.pc,this.R.bind(this)),b.on(this.player,_.kc,this.P.bind(this)),b.on(this.player,_.dc,this.K.bind(this)),b.on(this.player,_.fc,this.L.bind(this)),b.on(this.player,_.Wb,this.I.bind(this)),b.on(this.player,
24
- _.Xb,this.w.bind(this,1)),b.on(this.player,_.cc,this.w.bind(this,2)),b.on(this.player,_.nc,this.w.bind(this,3)),b.on(this.player,_.Vb,this.H.bind(this)),b.on(this.player,_.gc,this.M.bind(this)),b.on(this.player,_.Ud,this.J.bind(this)),b.on(this.player,_.Sb,this.C.bind(this)),b.on(this.player,_.Tb,this.F.bind(this)),b.on(this.player,_.Ub,this.G.bind(this)),b.on(this.player,_.ec,this.T.bind(this)))}unregisterListeners(){_.Hh(this.B())}R(b){fw.debug(Pv,b);this.h=b.adsTimeline}P(b){this.a=b.ad;this.f("ad start",
25
- this.a);this.fireStart();this.fireJoin()}I(){this.f("ad ended");this.fireStop({adPlayhead:this.l})}K(){this.f("ad pause");this.A();this.firePause()}L(){this.f("ad resume");this.A();this.fireResume()}G(){this.o=!0;this.f(Nv);this.fireBufferBegin()}T(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Mv),this.o=!1,this.fireBufferEnd())}w(b){this.f("ad quartile",b);this.fireQuartile(b)}H(){this.f("ad clicked");const b=this.a&&this.a.nb();fw.debug(Ov,b);this.fireClick(b)}M(){this.f("ad skipped");
26
- this.fireSkip()}C(b){this.a=b.ad;this.f(Lv,this.a);this.fireBreakStart()}F(){this.f("ad break stop");this.fireBreakStop({adPlayhead:this.l});this.getPosition()===this.getNpawReference().Constants.AdPosition.Postroll&&this.fireStop({adPlayhead:this.l})}J(b){(b=b.detail)&&10003===b.code&&aw(b,this.player,fw,this)}f(b,...c){fw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},fw=new _.S("clpp.npaw.NpawAdsAdapter");var hw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(Qv);this.m=null}Ye(a){Xv(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,ew()),this.a.registerAdsAdapterFromClass(this.m,gw())}uh(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;Yv(this,a)&&(a=a.getConfiguration().youbora,this.Ye(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(Yv(this,a)){a=a.getConfiguration();
27
- var c=a.youbora;void 0===c[Sv]&&(c[Sv]=b.isLive);void 0===c[Tv]&&(c[Tv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Ye(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=Wv(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.He,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){Xv(this);this.a.destroy()}id(){return Vv}};_.x(Qv,hw);hw.prototype.getAdsAdapter=hw.prototype.getAdsAdapter;
28
- hw.prototype.getAdapter=hw.prototype.getAdapter;hw.prototype.getNpawPlugin=hw.prototype.uh;hw.prototype.setNpawPlugin=hw.prototype.Ye;hw.Id=Vv;new _.S(Qv);var iw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(Rv);this.m=null}Ze(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(bw(this.m)),this.a.setAdsAdapter(cw(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;Zv(this,a)&&(a=a.getConfiguration().youbora,this.Ze(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(Zv(this,a)){a=a.getConfiguration();var c=
29
- a.youbora;void 0===c[Sv]&&(c[Sv]=b.isLive);void 0===c[Tv]&&(c[Tv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Ze(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return Vv}};_.x(Rv,iw);iw.prototype.getAdsAdapter=iw.prototype.getAdsAdapter;iw.prototype.getAdapter=iw.prototype.getAdapter;iw.prototype.setYouboraPlugin=iw.prototype.Ze;iw.Id=Vv;_.fs(new class{create(a){return a.youbora&&a.youbora.v7?new hw:new iw}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vv="Unhandled state",Wv="accountCode key is missing in Youbora config",Xv="ad break start",Yv="ad buffering ended",Zv="ad buffering started",$v="ad click through url: ",aw="ad timeline changed",bw="clpp.npaw.NpawPlugin",cw="clpp.npaw.YouboraPlugin",dw="content.isLive",ew="content.title",fw="is container visible",gw="youbora",hw=function(a){return a.startsWith(_.vd)?"Widevine":a.startsWith(_.rd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Qe)?
2
+ "ClearKey":a.startsWith(_.qd)?"Primetime":a},jw=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Qt;this.g=new _.S("clpp.npaw.YouboraAdapter");this.h=this.o=!1;this.registerListeners()}getPlayhead(){return this.getIsLive()?-1:this.m.getPosition()}getDuration(){return this.m.getDuration()}getRendition(){let c,d,e;var f=this.m.getTrackManager();f&&(f=f.ra())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.j(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);
3
+ return youbora.Util.buildRenditionString(c,d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Fa())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.29.0-castlabsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&
4
+ this.a&&(this.g.debug("registering listeners"),youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Qf,this.I.bind(this)),this.a.on(this.m,_.Xd,this.F.bind(this)),this.a.on(this.m,_.tg,this.H.bind(this)),this.a.on(this.m,_.sg,this.G.bind(this)),this.a.on(this.m,_.pc,this.B.bind(this)),this.a.on(this.m,_.Rc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.xb);_.Xh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.ss()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;
5
+ this.l("state change",c);if(c)switch(c.currentState){case 1:this.w()&&this.f();break;case 3:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case 4:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.Fs:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();break;default:this.g.debug(Vv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=
6
+ this.m.getDrmInfo();c&&(c=hw(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=iw(c,this.m,this.g,this))&&c.severity===_.C&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.If),this.f(),this.fireSeekBegin())}G(){this.l(_.Hf);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Hb()}C(c){this.g.debug("Casting",c);this.fireCasted()}l(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,
7
+ ...d)}}return new b(a)},kw=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Qt;this.g=new _.S("clpp.npaw.YouboraAdsAdapter");this.registerListeners();this.l=!1}getDuration(){return this.a&&this.a.getDuration()}getRendition(){let c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.cb(),this.a.bb(),this.a.Oa()));return c}getBitrate(){return this.a&&this.a.Oa()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&
8
+ this.a.getMediaUrl()}getTitle(){return this.a&&this.a.getTitle()}getProvider(){return this.a&&this.a.getAdvertiserName()}getCreativeId(){return this.a&&this.a.getCreativeId()}getPosition(){const c=youbora.Constants.AdPosition;let d=null;if(this.a)switch(this.a.Pa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.m.getAdsManager();return c&&0<
9
+ c.getVolume()}getExpectedBreaks(){return this.j&&this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.eb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.m.getDuration():c)}getIsFullscreen(){return this.m.getSurface().isFullscreen()}getIsVisible(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug(fw,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.29.0-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&
10
+ this.f&&(this.f.on(this.m,_.pc,this.M.bind(this)),this.f.on(this.m,_.lc,this.L.bind(this)),this.f.on(this.m,_.hc,this.I.bind(this)),this.f.on(this.m,_.jc,this.J.bind(this)),this.f.on(this.m,_.Wb,this.G.bind(this)),this.f.on(this.m,_.Xb,this.o.bind(this,1)),this.f.on(this.m,_.gc,this.o.bind(this,2)),this.f.on(this.m,_.nc,this.o.bind(this,3)),this.f.on(this.m,_.Vb,this.F.bind(this)),this.f.on(this.m,_.kc,this.K.bind(this)),this.f.on(this.m,_.Xd,this.H.bind(this)),this.f.on(this.m,_.Sb,this.A.bind(this)),
11
+ this.f.on(this.m,_.Tb,this.B.bind(this)),this.f.on(this.m,_.Ub,this.C.bind(this)),this.f.on(this.m,_.ic,this.w.bind(this)))}unregisterListeners(){_.Xh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(aw,c);this.j=c.adsTimeline}L(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.h("ad ended");this.fireStop()}I(){this.h("ad pause");this.w();this.firePause()}J(){this.h("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.h(Zv);this.fireBufferBegin()}w(){this.l&&
12
+ (this.h(Yv),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.ob();this.g.debug($v,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Xv,this.a);this.fireBreakStart()}B(){this.h("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&iw(c,this.m,this.g,this)}h(c,
13
+ ...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)},mw=function(){class a extends NpawPluginAdapters.video.Shaka{constructor(){super();this.f=this.h=!1;this.a=null}getPlayhead(){return this.getIsLive()?-1:this.player.getPosition()}getDuration(){return this.player.getDuration()}getRendition(){let b=null,c=null,d=null;var e=this.player.getTrackManager();e&&(e=e.ra())&&(b=e.width,c=e.height,d=e.bandwidth);b&&c&&d||(e=this.j(),b=b||e.width,c=c||e.height,d=d||e.streamBandwidth);
14
+ return this.getNpawUtils().buildRenditionString(b,c,d)}getIsLive(){return this.player.isLive()}getResource(){const b=this.player.getLoadedSource();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.getPlaybackRate()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Fa())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.29.0-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=
15
+ this.w();this.player&&b&&(b.on(this.player,_.Qf,this.K.bind(this)),b.on(this.player,_.Xd,this.H.bind(this)),b.on(this.player,_.If,this.J.bind(this)),b.on(this.player,_.Hf,this.I.bind(this)),b.on(this.player,_.pc,this.F.bind(this)),b.on(this.player,_.Rc,this.G.bind(this)),b.on(this.player,_.Jc,this.L.bind(this)),b.on(this.player,_.ag,this.M.bind(this)))}unregisterListeners(){lw.debug(_.xb);_.Xh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||
16
+ _.ss()}o(){return!!this.player.getConfiguration().autoplay}K(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case 1:this.plugin.setVideoOptions({"content.subtitles":this.C()});this.o()&&this.fireStart();break;case 3:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();break;case 4:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case _.Fs:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?
17
+ this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();break;default:lw.debug(Vv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=iw(b,this.player,lw,this))&&b.severity===_.C&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.If),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Yf&&(d=c.ua());b===_.q&&(d=c.pa());return d?d.language:null}L(){const b=this.B(_.q);this.plugin.setVideoOptions({"content.language":b})}M(){const b=
18
+ this.B(_.Yf),c=this.C();this.plugin.setVideoOptions({"content.subtitles":b||c})}w(){this.a||(this.a=new _.Qt);return this.a}I(){this.l(_.Hf);this.fireSeekEnd()}F(b){lw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Hb()}G(b){lw.debug("Casting",b);this.fireCasted()}l(b,...c){lw.debug(`Reporting "${b}" event to NPAW`,...c)}C(){const b=this.player.getConfiguration();return b.youbora&&b.youbora.disabledSubtitlesLabel?b.youbora.disabledSubtitlesLabel:"off"}}return a},ow=function(){class a extends NpawPluginAdapters.ads.Ima{constructor(){super();
19
+ this.j=this.h=this.l=this.a=null;this.o=!1}getDuration(){return this.a?this.a.getDuration():null}getRendition(){let b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.cb(),this.a.bb(),this.a.Oa()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Oa());return b}getPlayhead(){let b=null;const c=this.player.getAdsManager();c&&(b=c.getPosition());return b}getResource(){let b=null;this.a&&(b=this.a.getMediaUrl());return b}getTitle(){let b=null;this.a&&(b=this.a.getTitle());return b}getProvider(){let b=
20
+ null;this.a&&(b=this.a.getAdvertiserName());return b}getCreativeId(){let b=null;this.a&&(b=this.a.getCreativeId());return b}dispose(){this.unregisterListeners();this.j=this.h=this.a=null}getPosition(){const b=this.getNpawReference().Constants.AdPosition;let c=null;if(this.a)switch(this.a.Pa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}nw.debug("Ad position",c);return c}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const b=this.player.getAdsManager();
21
+ return b&&0<b.getVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.eb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.h&&this.h.getCuePoints().map(b=>-1===b?this.player.getDuration():b)}getIsFullscreen(){return this.player.getSurface().isFullscreen()}getIsVisible(){var b=this.player.getSurface().getContainer();b=this.getNpawUtils().calculateAdViewability(b);nw.debug(fw,
22
+ b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.29.0-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Qt);return this.j}registerListeners(){const b=this.B();this.player&&b&&(b.on(this.player,_.pc,this.R.bind(this)),b.on(this.player,_.lc,this.P.bind(this)),b.on(this.player,_.hc,this.K.bind(this)),b.on(this.player,_.jc,this.L.bind(this)),b.on(this.player,_.Wb,this.I.bind(this)),b.on(this.player,_.Xb,this.w.bind(this,1)),b.on(this.player,_.gc,this.w.bind(this,
23
+ 2)),b.on(this.player,_.nc,this.w.bind(this,3)),b.on(this.player,_.Vb,this.H.bind(this)),b.on(this.player,_.kc,this.M.bind(this)),b.on(this.player,_.Xd,this.J.bind(this)),b.on(this.player,_.Sb,this.C.bind(this)),b.on(this.player,_.Tb,this.F.bind(this)),b.on(this.player,_.Ub,this.G.bind(this)),b.on(this.player,_.ic,this.T.bind(this)))}unregisterListeners(){_.Xh(this.B())}R(b){nw.debug(aw,b);this.h=b.adsTimeline}P(b){this.a=b.ad;this.f("ad start",this.a);this.fireStart();this.fireJoin()}I(){this.f("ad ended");
24
+ this.fireStop({adPlayhead:this.l})}K(){this.f("ad pause");this.A();this.firePause()}L(){this.f("ad resume");this.A();this.fireResume()}G(){this.o=!0;this.f(Zv);this.fireBufferBegin()}T(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Yv),this.o=!1,this.fireBufferEnd())}w(b){this.f("ad quartile",b);this.fireQuartile(b)}H(){this.f("ad clicked");const b=this.a&&this.a.ob();nw.debug($v,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Xv,this.a);this.fireBreakStart()}F(){this.f("ad break stop");
25
+ this.fireBreakStop({adPlayhead:this.l});this.getPosition()===this.getNpawReference().Constants.AdPosition.Postroll&&this.fireStop({adPlayhead:this.l})}J(b){(b=b.detail)&&10003===b.code&&iw(b,this.player,nw,this)}f(b,...c){nw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},pw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},qw=function(a,b){if(b.namespace()===_.gd)return a.g.info("NPAW does not report when casting."),!1;const c=b.getConfiguration().youbora;
26
+ return _.ih(c)?c.accountCode?_.z(window.NpawPlugin)||_.z(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.H(1,9,9100)),!1):!0:(a.g.warn(Wv),b.onError(new _.H(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},rw=function(a,b){if(b.namespace()===_.gd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.ih(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),
27
+ !1;if(!c.accountCode)return a.g.warn(Wv),b.onError(new _.H(1,9,9101)),!1;if(_.z(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.H(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.H(1,9,9102)));return!0},sw=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,
28
+ message:b.message,severity:b.severity}),iw=(a,b,c,d)=>{b=sw(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.Xd;b.severity===_.C?(d.fireFatalError(b.code,b.message,b.metadata),c.debug(`Reporting "fatal ${a}" to Youbora`,b.code,b)):(d.fireError(b.code,b.message,b.metadata),c.debug(`Reporting "${a}" to Youbora`,b.code,b));return b};var lw=new _.S("clpp.npaw.NpawAdapter");var nw=new _.S("clpp.npaw.NpawAdsAdapter");var tw=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.S(bw);this.m=null}kf(a){pw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,mw()),this.a.registerAdsAdapterFromClass(this.m,ow())}Qh(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;qw(this,a)&&(a=a.getConfiguration().youbora,this.kf(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(qw(this,a)){a=a.getConfiguration();
29
+ var c=a.youbora;void 0===c[dw]&&(c[dw]=b.isLive);void 0===c[ew]&&(c[ew]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.kf(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=hw(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Je,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){pw(this);this.a.destroy()}id(){return gw}};_.x(bw,tw);tw.prototype.getAdsAdapter=tw.prototype.getAdsAdapter;
30
+ tw.prototype.getAdapter=tw.prototype.getAdapter;tw.prototype.getNpawPlugin=tw.prototype.Qh;tw.prototype.setNpawPlugin=tw.prototype.kf;tw.Id=gw;new _.S(bw);var uw=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.S(cw);this.m=null}lf(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(jw(this.m)),this.a.setAdsAdapter(kw(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;rw(this,a)&&(a=a.getConfiguration().youbora,this.lf(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(rw(this,a)){a=a.getConfiguration();var c=
31
+ a.youbora;void 0===c[dw]&&(c[dw]=b.isLive);void 0===c[ew]&&(c[ew]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.lf(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return gw}};_.x(cw,uw);uw.prototype.getAdsAdapter=uw.prototype.getAdsAdapter;uw.prototype.getAdapter=uw.prototype.getAdapter;uw.prototype.setYouboraPlugin=uw.prototype.lf;uw.Id=gw;_.Wn(new class{create(a){return a.youbora&&a.youbora.v7?new tw:new uw}});};f.call(g, window);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@castlabs/prestoplay",
3
3
  "description": "PRESTOplay Video Player",
4
- "version": "6.27.0",
4
+ "version": "6.29.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/castlabs/prestoplay-web.git"