@castlabs/prestoplay 6.31.0 → 6.32.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +2 -2
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +18 -18
  6. package/cjs/cl.cast.js +127 -125
  7. package/cjs/cl.cdn.js +13 -0
  8. package/cjs/cl.conviva.js +32 -32
  9. package/cjs/cl.core.js +615 -610
  10. package/cjs/cl.crypto.js +9 -9
  11. package/cjs/cl.dash.js +101 -95
  12. package/cjs/cl.externs.js +113 -44
  13. package/cjs/cl.freewheel.js +26 -26
  14. package/cjs/cl.hls.js +78 -78
  15. package/cjs/cl.hlssmpte.js +6 -6
  16. package/cjs/cl.htmlcue.js +30 -30
  17. package/cjs/cl.ima.js +26 -26
  18. package/cjs/cl.mediatailor.js +3 -3
  19. package/cjs/cl.mse.js +351 -350
  20. package/cjs/cl.muxdata.js +14 -14
  21. package/cjs/cl.onboard.js +4 -4
  22. package/cjs/cl.persistent.js +14 -14
  23. package/cjs/cl.playlist.js +6 -6
  24. package/cjs/cl.simid.js +16 -16
  25. package/cjs/cl.smooth.js +71 -71
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +11 -11
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +40 -40
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +14 -14
  38. package/cl.cast.js +102 -101
  39. package/cl.cdn.js +7 -0
  40. package/cl.conviva.js +27 -27
  41. package/cl.core.js +498 -495
  42. package/cl.crypto.js +9 -9
  43. package/cl.dash.js +91 -87
  44. package/cl.externs.js +109 -44
  45. package/cl.freewheel.js +20 -20
  46. package/cl.hls.js +82 -82
  47. package/cl.hlssmpte.js +5 -5
  48. package/cl.htmlcue.js +26 -26
  49. package/cl.ima.js +20 -20
  50. package/cl.mediatailor.js +2 -2
  51. package/cl.mse.js +301 -300
  52. package/cl.muxdata.js +13 -13
  53. package/cl.onboard.js +4 -4
  54. package/cl.persistent.js +10 -10
  55. package/cl.playlist.js +5 -5
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +61 -61
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +56 -56
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +31 -31
  67. package/package.json +10 -1
  68. package/typings.d.ts +328 -114
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 Ow="touchmove",Pw="touchstart",Rw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Qw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Sw=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)},Tw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Uw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Vw=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},Ww=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},Yw=function(a){var b=new Xw(0,0,0),c=new Xw(0,0,1);const d=new Xw,e=new Xw,f=new Xw;a=a.a;var g=
3
- new Xw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Tw(f,1/g);c=Vw(d,c,f);g=c.length();Tw(c,1/g);Vw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Uw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Uw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Uw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Zw=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},$w=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Ow,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},ax=function(a){const b=Rw(1,0,a.l*Math.PI/180);Sw(Rw(0,1,a.j*Math.PI/180),a.N);Sw(b,a.R);Yw(a.X);Ww(a.$,a.N,a.X);Ww(a.G,a.R,a.$)},Qw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Xw=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 bx=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 cx=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Zw(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=Zw(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 dx=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 ex=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 fx={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},gx=class extends _.Pv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.W=this.G=this.f=this.a=this.m=null;this.g=new _.T("clpp.vr");this.H=70;this.U=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.N=new bx;this.R=new bx;this.X=new bx;this.$=new bx;this.A=this.ia.bind(this);this.B=this.xa.bind(this);this.J=this.da.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 _.I(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.kh(e)&&0<e)this.U=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",fx)||this.a.getContext("experimental-webgl",
9
- fx);if(!this.f)throw new _.I(1,9,9003,"Unable to create GL context");this.G=new bx;Yw(this.G);this.W=new dx(this.f);this.C=new cx(this.f);this.I=new bx;this.K=new bx;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(Pw,this.J,!1));this.F();this.S()}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&&($w(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"}S(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.S.bind(this));
11
- var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new ex(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=Ww(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Rw="touchmove",Sw="touchstart",Uw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Tw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Vw=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)},Ww=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Xw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Yw=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},Zw=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},ax=function(a){var b=new $w(0,0,0),c=new $w(0,0,1);const d=new $w,e=new $w,f=new $w;a=a.a;var g=
3
+ new $w(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Ww(f,1/g);c=Yw(d,c,f);g=c.length();Ww(c,1/g);Yw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Xw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Xw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Xw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},bx=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},cx=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Rw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},dx=function(a){const b=Uw(1,0,a.l*Math.PI/180);Vw(Uw(0,1,a.j*Math.PI/180),a.P);Vw(b,a.R);ax(a.X);Zw(a.ca,a.P,a.X);Zw(a.G,a.R,a.ca)},Tw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var $w=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 ex=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 fx=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=bx(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=bx(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 gx=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 hx=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 ix={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},jx=class extends _.Uv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.W=this.G=this.f=this.a=this.m=null;this.g=new _.T("clpp.vr");this.H=70;this.U=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 ex;this.R=new ex;this.X=new ex;this.ca=new ex;this.A=this.ia.bind(this);this.B=this.Aa.bind(this);this.J=this.da.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&&_.ph(d))this.H=d;else throw new _.I(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.ph(e)&&0<e)this.U=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",ix)||this.a.getContext("experimental-webgl",
9
+ ix);if(!this.f)throw new _.I(1,9,9003,"Unable to create GL context");this.G=new ex;ax(this.G);this.W=new gx(this.f);this.C=new fx(this.f);this.I=new ex;this.K=new ex;this.o=this.w=null;this.a.addEventListener(_.Bf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Sw,this.J,!1));this.F();this.S()}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&&(cx(this),this.a.removeEventListener(_.Bf,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"}S(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.S.bind(this));
11
+ var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new hx(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=Zw(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
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.W;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)}}}}da(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Pw)a.type===Pw?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(Ow,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===Ow&&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.U;const {xh:e,yh:f}={xh:a*b*(this.L?-1:1),yh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;ax(this)}xa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();$w(this)}oi(a,b){this.l=b;this.j=a;ax(this)}Sh(){return{x:this.j,y:this.l}}Ni(a){this.H=a;this.F()}};
15
- _.x("clpp.vr.VrPlugin",gx);gx.prototype.setCameraFieldOfView=gx.prototype.Ni;gx.prototype.getCameraCoordinates=gx.prototype.Sh;gx.prototype.moveCamera=gx.prototype.oi;gx.Id="vr";_.Pn(new class{create(){return new gx}});};f.call(g, window);
13
+ 0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}da(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Sw)a.type===Sw?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(Rw,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===Rw&&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.U;const {Ih:e,Jh:f}={Ih:a*b*(this.L?-1:1),Jh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;dx(this)}Aa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();cx(this)}Ci(a,b){this.l=b;this.j=a;dx(this)}ci(){return{x:this.j,y:this.l}}Zi(a){this.H=a;this.F()}};
15
+ _.x("clpp.vr.VrPlugin",jx);jx.prototype.setCameraFieldOfView=jx.prototype.Zi;jx.prototype.getCameraCoordinates=jx.prototype.ci;jx.prototype.moveCamera=jx.prototype.Ci;jx.Id="vr";_.Tn(new class{create(){return new jx}});};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 vw=" The setting will be ignored.",ww="VTT parser encountered an invalid VTT setting: ",xw="application/x-subrip",yw="text/srt",zw='text/vtt; codecs\x3d"vtt"',Aw='text/vtt; codecs\x3d"wvtt"',Bw=function(a){return a.a===a.f.length?null:(a=_.jr(a,/[^ \t\n]*/gm))?a[0]:null},Cw=function(a){_.jr(a,/[ \t]+/gm)},Dw=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},Ew=function(a){a=_.jr(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)},Gw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.ku:a.textAlign=_.qu[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:_.Xc);else if(d=/^region:(.*)$/.exec(b)){if(b=Fw(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=_.ru[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.mu,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.ru[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Fw=function(a,b){a=a.filter(c=>c.id===b);return a.length?a[0]:(_.C("VTT parser could not find a region with id: ",
5
- b," The region will be ignored."),null)},Iw=function(a,b,c){let d,e,f;(new _.ip).O("payl",_.dp(g=>{d=_.ni(g)})).O("iden",_.dp(g=>{e=_.ni(g)})).O("sttg",_.dp(g=>{f=_.ni(g)})).parse(a);return d?Hw(d,e,f,b,c):null},Hw=function(a,b,c,d,e){a=new _.pu(d,e,a,_.Eg);b&&(a.id=b);if(c)for(b=new _.kr(c),c=Bw(b);c;)Gw(a,c,[])||_.C(ww,c,vw),Cw(b),c=Bw(b);return a},Jw=class{a(a){a=_.ni(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+=Dw(c)}return _.ri(b)}},Kw=class{create(){return new Jw}probe(a,b){return(a===yw||a===xw)&&b===_.Zf}};var Lw=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.ni(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(_.D,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=Ew(new _.kr(d[1]));if(null==a)throw new _.I(_.D,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 _.kr(f.replace(/\n/g," "));d=new _.uu;Bw(e);Cw(e);for(var g=Bw(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||_.C("VTT parser encountered an invalid VTTRegion setting: ",g,vw);Cw(e);g=Bw(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 _.kr(l[0]);g=Ew(d);const p=_.jr(d,/[ \t]+--\x3e[ \t]+/g);k=Ew(d);if(null==g||null==p||null==k)throw new _.I(_.D,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.pu(g,k,l,_.Eg);e&&(g.id=e);Cw(d);for(k=Bw(d);k;)Gw(g,k,c)||_.C(ww,k,vw),Cw(d),k=Bw(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Mw=class extends Lw{parseMedia(a,b){return super.parseMedia((new Jw).a(a),b)}};var Nw=class{constructor(){this.a=null;this.g=new _.T("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.ip).O(_.De,_.bp).O(_.hg,_.bp).O(_.ye,_.bp).fa("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.N(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.N(c.reader),c.reader.skip(8));c.reader.skip(4)}).O(_.Ce,_.bp).O(_.Sf,_.bp).fa(_.Uf,_.cp).O("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.I(_.D,2,2008);if(!b)throw new _.I(_.D,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
- new _.I(_.D,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.ip).O("moof",_.bp).O("traf",_.bp).fa("tfdt",p=>{g=!0;c=0===p.version?_.N(p.reader):_.Xo(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?_.N(p):null}).fa("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.N(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let E=0;E<y;E++){const B={duration:null,sampleSize:null,Bf:null};v&256&&(B.duration=_.N(p));v&512&&(B.sampleSize=
11
- _.N(p));v&1024&&p.skip(4);v&2048&&(B.Bf=0===u?_.N(p):_.Wo(p));A.push(B)}d=A}}).O(_.xe,_.dp(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.I(_.D,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.aq(m,!1);for(const p of d){const u=p.duration||l,v=p.Bf?c+p.Bf:a;a=v+(u||0);let y=0;do{const A=_.N(m);y+=A;var n=_.N(m);n=_.ap(n);let E=null;"vttc"===n?8<A&&(E=_.Zo(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?E&&f.push(Iw(E,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(_.Jm),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.zv{constructor(){super();this.a=new Kw}install(){_.ut(_.Zf,Lw);_.ut(zw,Lw);_.ut(Aw,Lw);_.ut(_.Ac,Nw);_.ut(yw,Mw);_.ut(xw,Mw);_.Ir.push(this.a)}uninstall(){_.wt(_.Zf);_.wt(zw);_.wt(Aw);_.wt(_.Ac);_.wt(yw);_.wt(xw);_.Kr(this.a)}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 yw=" The setting will be ignored.",zw="VTT parser encountered an invalid VTT setting: ",Aw="application/x-subrip",Bw="text/srt",Cw='text/vtt; codecs\x3d"vtt"',Dw='text/vtt; codecs\x3d"wvtt"',Ew=function(a){return a.a===a.f.length?null:(a=_.tr(a,/[^ \t\n]*/gm))?a[0]:null},Fw=function(a){_.tr(a,/[ \t]+/gm)},Gw=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},Hw=function(a){a=_.tr(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)},Jw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.uu:a.textAlign=_.Au[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.xg:_.yg;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===_.ne||b===_.Qf?_.ne:b===_.oe||b===_.Vd?
4
+ _.oe:_.Xc);else if(d=/^region:(.*)$/.exec(b)){if(b=Iw(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=_.Bu[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.wu,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Bu[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Iw=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)},Lw=function(a,b,c){let d,e,f;(new _.np).N("payl",_.ip(g=>{d=_.ri(g)})).N("iden",_.ip(g=>{e=_.ri(g)})).N("sttg",_.ip(g=>{f=_.ri(g)})).parse(a);return d?Kw(d,e,f,b,c):null},Kw=function(a,b,c,d,e){a=new _.zu(d,e,a,_.Fg);b&&(a.id=b);if(c)for(b=new _.ur(c),c=Ew(b);c;)Jw(a,c,[])||_.B(zw,c,yw),Fw(b),c=Ew(b);return a},Mw=class{a(a){a=_.ri(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+=Gw(c)}return _.vi(b)}},Nw=class{create(){return new Mw}probe(a,b){return(a===Bw||a===Aw)&&b===_.$f}};var Ow=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.ri(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(_.D,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=Hw(new _.ur(d[1]));if(null==a)throw new _.I(_.D,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 _.ur(f.replace(/\n/g," "));d=new _.Eu;Ew(e);Fw(e);for(var g=Ew(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,yw);Fw(e);g=Ew(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 _.ur(l[0]);g=Hw(d);const p=_.tr(d,/[ \t]+--\x3e[ \t]+/g);k=Hw(d);if(null==g||null==p||null==k)throw new _.I(_.D,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.zu(g,k,l,_.Fg);e&&(g.id=e);Fw(d);for(k=Ew(d);k;)Jw(g,k,c)||_.B(zw,k,yw),Fw(d),k=Ew(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Pw=class extends Ow{parseMedia(a,b){return super.parseMedia((new Mw).a(a),b)}};var Qw=class{constructor(){this.a=null;this.g=new _.T("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.np).N(_.Ee,_.gp).N(_.ig,_.gp).N(_.ze,_.gp).fa("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.N(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.N(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.De,_.gp).N(_.Tf,_.gp).fa(_.Vf,_.hp).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.I(_.D,2,2008);if(!b)throw new _.I(_.D,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
+ new _.I(_.D,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.np).N("moof",_.gp).N("traf",_.gp).fa("tfdt",p=>{g=!0;c=0===p.version?_.N(p.reader):_.bp(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?_.N(p):null}).fa("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.N(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let E=0;E<y;E++){const F={duration:null,sampleSize:null,Of:null};v&256&&(F.duration=_.N(p));v&512&&(F.sampleSize=
11
+ _.N(p));v&1024&&p.skip(4);v&2048&&(F.Of=0===u?_.N(p):_.ap(p));A.push(F)}d=A}}).N(_.ve,_.ip(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.I(_.D,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.kq(m,!1);for(const p of d){const u=p.duration||l,v=p.Of?c+p.Of:a;a=v+(u||0);let y=0;do{const A=_.N(m);y+=A;var n=_.N(m);n=_.fp(n);let E=null;"vttc"===n?8<A&&(E=_.dp(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?E&&f.push(Lw(E,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(_.Nm),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.Ev{constructor(){super();this.a=new Nw}install(){_.Et(_.$f,Ow);_.Et(Cw,Ow);_.Et(Dw,Ow);_.Et(_.Ac,Qw);_.Et(Bw,Pw);_.Et(Aw,Pw);_.Sr.push(this.a)}uninstall(){_.Gt(_.$f);_.Gt(Cw);_.Gt(Dw);_.Gt(_.Ac);_.Gt(Bw);_.Gt(Aw);_.Ur(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 qw="clpp.yospace.YospacePlugin",tw=class extends _.Pv{constructor(){super();this.a=null;this.g=new _.T(qw)}qg(){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 _.I(_.D,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||rw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case rw:d=YospaceAdManagement.SessionVOD.create(e);
2
- break a;case sw: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(_.D,9,7003,"Yospace session failed to initialize.");a.trigger(new _.H(_.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 _.H(_.Qg,{detail:b}))}}id(){return"yospace"}};_.x(qw,tw);tw.prototype.getSession=tw.prototype.qg;tw.Id="yospace";var uw=class{create(){return new tw}},rw=_.Eb,sw="LIVE";_.x("clpp.yospace.StreamType",{VOD:rw,LIVE:sw,DVR:"DVR"});_.Pn(new uw);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tw="clpp.yospace.YospacePlugin",ww=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.T(tw)}Bg(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Ie)throw new _.I(_.D,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||uw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case uw:d=YospaceAdManagement.SessionVOD.create(e);
2
+ break a;case vw: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(_.D,9,7003,"Yospace session failed to initialize.");a.trigger(new _.H(_.Wg,{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 _.H(_.Vg,{detail:b}))}}id(){return"yospace"}};_.x(tw,ww);ww.prototype.getSession=ww.prototype.Bg;ww.Id="yospace";var xw=class{create(){return new ww}},uw=_.Fb,vw="LIVE";_.x("clpp.yospace.StreamType",{VOD:uw,LIVE:vw,DVR:"DVR"});_.Tn(new xw);};f.call(g, window);
package/cl.youbora.js CHANGED
@@ -1,31 +1,31 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Qv="Unhandled state",Rv="accountCode key is missing in Youbora config",Sv="ad break start",Tv="ad buffering ended",Uv="ad buffering started",Vv="ad click through url: ",Wv="ad timeline changed",Xv="clpp.npaw.NpawPlugin",Yv="clpp.npaw.YouboraPlugin",Zv="content.isLive",$v="content.title",aw="is container visible",bw="youbora",cw=function(a){return a.startsWith(_.wd)?"Widevine":a.startsWith(_.sd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Qe)?
2
- "ClearKey":a.startsWith(_.rd)?"Primetime":a},ew=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Lt;this.g=new _.T("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.ta())&&(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.Ha())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.31.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,_.Sc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.zb);_.Xh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.ns()}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 _.xs: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(Qv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=
6
- this.m.getDrmInfo();c&&(c=cw(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=dw(c,this.m,this.g,this))&&c.severity===_.D&&(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.Mb()}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)},fw=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Lt;this.g=new _.T("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.Ua(),this.a.Ta(),this.a.Ba()));return c}getBitrate(){return this.a&&this.a.Ba()}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.Ca()){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.getAdVolume()}getExpectedBreaks(){return this.j&&this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.Va()}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(aw,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.31.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,_.gc,this.I.bind(this)),this.f.on(this.m,_.jc,this.J.bind(this)),this.f.on(this.m,_.Xb,this.G.bind(this)),this.f.on(this.m,_.Yb,this.o.bind(this,1)),this.f.on(this.m,_.dc,this.o.bind(this,2)),this.f.on(this.m,_.nc,this.o.bind(this,3)),this.f.on(this.m,_.Wb,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,_.Tb,this.A.bind(this)),
11
- this.f.on(this.m,_.Ub,this.B.bind(this)),this.f.on(this.m,_.Vb,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(Wv,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(Uv);this.fireBufferBegin()}w(){this.l&&
12
- (this.h(Tv),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.Ra();this.g.debug(Vv,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Sv,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&&dw(c,this.m,this.g,this)}h(c,
13
- ...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)},hw=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.ta())&&(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.Ha())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.31.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,_.Sc,this.G.bind(this)),b.on(this.player,_.Kc,this.L.bind(this)),b.on(this.player,_.ag,this.M.bind(this)))}unregisterListeners(){gw.debug(_.zb);_.Xh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||
16
- _.ns()}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 _.xs: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:gw.debug(Qv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=dw(b,this.player,gw,this))&&b.severity===_.D&&(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.va());b===_.q&&(d=c.ra());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 _.Lt);return this.a}I(){this.l(_.Hf);this.fireSeekEnd()}F(b){gw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Mb()}G(b){gw.debug("Casting",b);this.fireCasted()}l(b,...c){gw.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},jw=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.Ua(),this.a.Ta(),this.a.Ba()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Ba());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.Ca()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}iw.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.getAdVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.Va()}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);iw.debug(aw,
22
- b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.31.0-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Lt);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.N.bind(this)),b.on(this.player,_.gc,this.K.bind(this)),b.on(this.player,_.jc,this.L.bind(this)),b.on(this.player,_.Xb,this.I.bind(this)),b.on(this.player,_.Yb,this.w.bind(this,1)),b.on(this.player,_.dc,this.w.bind(this,
23
- 2)),b.on(this.player,_.nc,this.w.bind(this,3)),b.on(this.player,_.Wb,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,_.Tb,this.C.bind(this)),b.on(this.player,_.Ub,this.F.bind(this)),b.on(this.player,_.Vb,this.G.bind(this)),b.on(this.player,_.ic,this.S.bind(this)))}unregisterListeners(){_.Xh(this.B())}R(b){iw.debug(Wv,b);this.h=b.adsTimeline}N(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(Uv);this.fireBufferBegin()}S(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Tv),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.Ra();iw.debug(Vv,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Sv,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&&dw(b,this.player,iw,this)}f(b,...c){iw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},kw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},lw=function(a,b){if(b.namespace()===_.hd)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 _.I(1,9,9100)),!1):!0:(a.g.warn(Rv),b.onError(new _.I(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},mw=function(a,b){if(b.namespace()===_.hd)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(Rv),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 "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.I(1,9,9102)));return!0},nw=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,
28
- message:b.message,severity:b.severity}),dw=(a,b,c,d)=>{b=nw(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===_.D?(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 gw=new _.T("clpp.npaw.NpawAdapter");var iw=new _.T("clpp.npaw.NpawAdsAdapter");var ow=class extends _.Pv{constructor(){super();this.a=null;this.g=new _.T(Xv);this.m=null}wf(a){kw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,hw()),this.a.registerAdsAdapterFromClass(this.m,jw())}Xh(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;lw(this,a)&&(a=a.getConfiguration().youbora,this.wf(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(lw(this,a)){a=a.getConfiguration();
29
- var c=a.youbora;void 0===c[Zv]&&(c[Zv]=b.isLive);void 0===c[$v]&&(c[$v]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.wf(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=cw(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Je,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){kw(this);this.a.destroy()}id(){return bw}};_.x(Xv,ow);ow.prototype.getAdsAdapter=ow.prototype.getAdsAdapter;
30
- ow.prototype.getAdapter=ow.prototype.getAdapter;ow.prototype.getNpawPlugin=ow.prototype.Xh;ow.prototype.setNpawPlugin=ow.prototype.wf;ow.Id=bw;new _.T(Xv);var pw=class extends _.Pv{constructor(){super();this.a=null;this.g=new _.T(Yv);this.m=null}xf(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(ew(this.m)),this.a.setAdsAdapter(fw(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;mw(this,a)&&(a=a.getConfiguration().youbora,this.xf(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(mw(this,a)){a=a.getConfiguration();var c=
31
- a.youbora;void 0===c[Zv]&&(c[Zv]=b.isLive);void 0===c[$v]&&(c[$v]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.xf(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return bw}};_.x(Yv,pw);pw.prototype.getAdsAdapter=pw.prototype.getAdsAdapter;pw.prototype.getAdapter=pw.prototype.getAdapter;pw.prototype.setYouboraPlugin=pw.prototype.xf;pw.Id=bw;_.Pn(new class{create(a){return a.youbora&&a.youbora.v7?new ow:new pw}});};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="ad break start",Xv="ad buffering ended",Yv="ad buffering started",Zv="ad click through url: ",$v="ad timeline changed",aw="clpp.npaw.NpawPlugin",bw="clpp.npaw.YouboraPlugin",cw="content.isLive",dw="content.title",ew="is container visible",fw=function(a){return a.startsWith(_.wd)?"Widevine":a.startsWith(_.sd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Re)?"ClearKey":a.startsWith(_.rd)?"Primetime":a},hw=function(a){class b extends youbora.Adapter{constructor(c){super(c);
2
+ this.m=c;this.a=new _.Vt;this.g=new _.T("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.ta())&&(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,d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.Sa();
3
+ return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.nc()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ia())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.32.0-beta.2-castlabsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&this.a&&(this.g.debug("registering listeners"),youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Rf,this.I.bind(this)),this.a.on(this.m,
4
+ _.Xd,this.F.bind(this)),this.a.on(this.m,_.ug,this.H.bind(this)),this.a.on(this.m,_.qg,this.G.bind(this)),this.a.on(this.m,_.qc,this.B.bind(this)),this.a.on(this.m,_.Sc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.Ab);_.ai(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.xs()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;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();
5
+ break;case 4:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.Hs: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=this.m.getDrmInfo();c&&(c=fw(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||
6
+ 10003===c.code&&this.plugin.getAdsAdapter()||(c=gw(c,this.m.getConfiguration().youbora,this.g,this))&&c.severity===_.D&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Jf),this.f(),this.fireSeekBegin())}G(){this.l(_.If);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Pb()}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)},iw=function(a){class b extends youbora.Adapter{constructor(c){super(c);
7
+ this.m=c;this.j=this.a=null;this.f=new _.Vt;this.g=new _.T("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.Va(),this.a.Ua(),this.a.Ba()));return c}getBitrate(){return this.a&&this.a.Ba()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&this.a.getTitle()}getProvider(){return this.a&&
8
+ 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.Ca()){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.getAdVolume()}getExpectedBreaks(){return this.j&&this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&
9
+ this.a.Wa()}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(ew,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.32.0-beta.2-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&this.f&&(this.f.on(this.m,
10
+ _.qc,this.M.bind(this)),this.f.on(this.m,_.mc,this.L.bind(this)),this.f.on(this.m,_.hc,this.I.bind(this)),this.f.on(this.m,_.kc,this.J.bind(this)),this.f.on(this.m,_.Yb,this.G.bind(this)),this.f.on(this.m,_.Zb,this.o.bind(this,1)),this.f.on(this.m,_.ec,this.o.bind(this,2)),this.f.on(this.m,_.oc,this.o.bind(this,3)),this.f.on(this.m,_.Xb,this.F.bind(this)),this.f.on(this.m,_.lc,this.K.bind(this)),this.f.on(this.m,_.Xd,this.H.bind(this)),this.f.on(this.m,_.Ub,this.A.bind(this)),this.f.on(this.m,_.Vb,
11
+ this.B.bind(this)),this.f.on(this.m,_.Wb,this.C.bind(this)),this.f.on(this.m,_.jc,this.w.bind(this)))}unregisterListeners(){_.ai(this.f)}dispose(){super.dispose()}M(c){this.g.debug($v,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(Yv);this.fireBufferBegin()}w(){this.l&&(this.h(Xv),this.l=
12
+ !1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.Ra();this.g.debug(Zv,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Wv,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&&gw(c,this.m.getConfiguration().youbora,this.g,
13
+ this)}h(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)},kw=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.ta())&&(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.Sa();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.nc()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Ia())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.32.0-beta.2-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=
15
+ this.w();this.player&&b&&(b.on(this.player,_.Rf,this.K.bind(this)),b.on(this.player,_.Xd,this.H.bind(this)),b.on(this.player,_.Jf,this.J.bind(this)),b.on(this.player,_.If,this.I.bind(this)),b.on(this.player,_.qc,this.F.bind(this)),b.on(this.player,_.Sc,this.G.bind(this)),b.on(this.player,_.Kc,this.L.bind(this)),b.on(this.player,_.bg,this.M.bind(this)))}unregisterListeners(){jw.debug(_.Ab);_.ai(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||
16
+ _.xs()}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 _.Hs: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:jw.debug(Vv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=gw(b,this.player.getConfiguration().npaw,jw,this))&&b.severity===_.D&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.Jf),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Zf&&(d=c.ua());b===_.q&&(d=c.ra());return d?d.language:null}L(){const b=this.B(_.q);this.plugin.setVideoOptions({"content.language":b})}M(){const b=
18
+ this.B(_.Zf),c=this.C();this.plugin.setVideoOptions({"content.subtitles":b||c})}w(){this.a||(this.a=new _.Vt);return this.a}I(){this.l(_.If);this.fireSeekEnd()}F(b){jw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Pb()}G(b){jw.debug("Casting",b);this.fireCasted()}l(b,...c){jw.debug(`Reporting "${b}" event to NPAW`,...c)}C(){const b=this.player.getConfiguration();return b.npaw&&b.npaw.disabledSubtitlesLabel?b.npaw.disabledSubtitlesLabel:"off"}}return a},mw=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.Va(),this.a.Ua(),this.a.Ba()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Ba());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.Ca()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}lw.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.getAdVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.Wa()}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);lw.debug(ew,
22
+ b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.32.0-beta.2-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Vt);return this.j}registerListeners(){const b=this.B();this.player&&b&&(b.on(this.player,_.qc,this.R.bind(this)),b.on(this.player,_.mc,this.P.bind(this)),b.on(this.player,_.hc,this.K.bind(this)),b.on(this.player,_.kc,this.L.bind(this)),b.on(this.player,_.Yb,this.I.bind(this)),b.on(this.player,_.Zb,this.w.bind(this,1)),b.on(this.player,_.ec,this.w.bind(this,
23
+ 2)),b.on(this.player,_.oc,this.w.bind(this,3)),b.on(this.player,_.Xb,this.H.bind(this)),b.on(this.player,_.lc,this.M.bind(this)),b.on(this.player,_.Xd,this.J.bind(this)),b.on(this.player,_.Ub,this.C.bind(this)),b.on(this.player,_.Vb,this.F.bind(this)),b.on(this.player,_.Wb,this.G.bind(this)),b.on(this.player,_.jc,this.S.bind(this)))}unregisterListeners(){_.ai(this.B())}R(b){lw.debug($v,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(Yv);this.fireBufferBegin()}S(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Xv),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.Ra();lw.debug(Zv,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Wv,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&&gw(b,this.player.getConfiguration().npaw,lw,this)}f(b,...c){lw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},nw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},ow=function(a,b){if(b.namespace()===_.hd)return a.g.info("NPAW does not report when casting."),
26
+ !1;const c=b.getConfiguration().npaw;return _.nh(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("accountCode key is missing in NPAW config"),b.onError(new _.I(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},pw=function(a,b){if(b.namespace()===_.hd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.nh(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),
27
+ !1;if(!c.accountCode)return a.g.warn("accountCode key is missing in Youbora config"),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 "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.I(1,9,9102)));return!0},qw=a=>a&&a.errorFilter?a.errorFilter:
28
+ b=>({code:`${b.code}`,message:b.message,severity:b.severity}),gw=(a,b,c,d)=>{b=qw(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===_.D?(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 jw=new _.T("clpp.npaw.NpawAdapter");var lw=new _.T("clpp.npaw.NpawAdsAdapter");var rw=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.T(aw);this.m=null}Jf(a){nw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,kw()),this.a.registerAdsAdapterFromClass(this.m,mw())}hi(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;ow(this,a)&&(a=a.getConfiguration().npaw,this.Jf(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(ow(this,a)){a=a.getConfiguration();
29
+ var c=a.npaw;void 0===c[cw]&&(c[cw]=b.isLive);void 0===c[dw]&&(c[dw]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Jf(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=fw(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Ke,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){nw(this);this.a&&this.a.destroy()}id(){return"npaw"}};_.x(aw,rw);rw.prototype.getAdsAdapter=rw.prototype.getAdsAdapter;
30
+ rw.prototype.getAdapter=rw.prototype.getAdapter;rw.prototype.getNpawPlugin=rw.prototype.hi;rw.prototype.setNpawPlugin=rw.prototype.Jf;rw.Id="npaw";new _.T(aw);var sw=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.T(bw);this.m=null}Kf(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(hw(this.m)),this.a.setAdsAdapter(iw(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;pw(this,a)&&(a=a.getConfiguration().youbora,this.Kf(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(pw(this,a)){a=a.getConfiguration();var c=
31
+ a.youbora;void 0===c[cw]&&(c[cw]=b.isLive);void 0===c[dw]&&(c[dw]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Kf(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.x(bw,sw);sw.prototype.getAdsAdapter=sw.prototype.getAdsAdapter;sw.prototype.getAdapter=sw.prototype.getAdapter;sw.prototype.setYouboraPlugin=sw.prototype.Kf;sw.Id="youbora";_.Tn(new class{create(a){return a.npaw?new rw:a.youbora?new sw:null}});};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.31.0",
4
+ "version": "6.32.0-beta.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/castlabs/prestoplay-web.git"
@@ -41,11 +41,20 @@
41
41
  "@broadpeak/smartlib": {
42
42
  "optional": true
43
43
  },
44
+ "@broadpeak/smartlib-ad": {
45
+ "optional": true
46
+ },
44
47
  "@broadpeak/smartlib-analytics": {
45
48
  "optional": true
46
49
  },
47
50
  "@broadpeak/smartlib-all-compatibility": {
48
51
  "optional": true
52
+ },
53
+ "npaw-plugin": {
54
+ "optional": true
55
+ },
56
+ "npaw-plugin-adapters": {
57
+ "optional": true
49
58
  }
50
59
  },
51
60
  "keywords": [