@castlabs/prestoplay 6.33.0 → 6.34.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -19
  5. package/cjs/cl.cast.js +129 -129
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +633 -624
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +48 -72
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +76 -76
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +357 -353
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -5
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -73
  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 +36 -36
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -14
  36. package/cl.cast.js +100 -100
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +510 -502
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +90 -90
  41. package/cl.externs.js +51 -63
  42. package/cl.freewheel.js +20 -20
  43. package/cl.hls.js +82 -82
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -20
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +308 -306
  49. package/cl.muxdata.js +13 -13
  50. package/cl.onboard.js +5 -5
  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 +61 -61
  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 +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +1 -1
  65. package/typings.d.ts +33 -46
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 Jw="touchmove",Kw="touchstart",Mw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Lw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Nw=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)},Ow=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Pw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Qw=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},Rw=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},Tw=function(a){var b=new Sw(0,0,0),c=new Sw(0,0,1);const d=new Sw,e=new Sw,f=new Sw;a=a.a;var g=
3
- new Sw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Ow(f,1/g);c=Qw(d,c,f);g=c.length();Ow(c,1/g);Qw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Pw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Pw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Pw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Uw=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},Vw=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Jw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Ww=function(a){const b=Mw(1,0,a.l*Math.PI/180);Nw(Mw(0,1,a.j*Math.PI/180),a.P);Nw(b,a.R);Tw(a.Z);Rw(a.ca,a.P,a.Z);Rw(a.G,a.R,a.ca)},Lw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Sw=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 Xw=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,x,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]=x;A[15]=y;return this}};var Yw=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Uw(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=Uw(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 Zw=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 $w=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 ax={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},bx=class extends _.Mv{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 Xw;this.R=new Xw;this.Z=new Xw;this.ca=new Xw;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&&_.gh(d))this.H=d;else throw new _.I(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.gh(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",ax)||this.a.getContext("experimental-webgl",
9
- ax);if(!this.f)throw new _.I(1,9,9003,"Unable to create GL context");this.G=new Xw;Tw(this.G);this.W=new Zw(this.f);this.C=new Yw(this.f);this.I=new Xw;this.K=new Xw;this.o=this.w=null;this.a.addEventListener(_.wf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Kw,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&&(Vw(this),this.a.removeEventListener(_.wf,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 _.v(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 $w(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=Rw(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 Ew="touchmove",Fw="touchstart",Hw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Gw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Iw=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)},Jw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Kw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Lw=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},Mw=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},Ow=function(a){var b=new Nw(0,0,0),c=new Nw(0,0,1);const d=new Nw,e=new Nw,f=new Nw;a=a.a;var g=
3
+ new Nw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Jw(f,1/g);c=Lw(d,c,f);g=c.length();Jw(c,1/g);Lw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Kw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Kw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Kw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Pw=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 _.J(1,9,9004,"Unable to compile GL shader: "+
4
+ a.a.getShaderInfoLog(b));return b},Qw=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Ew,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Rw=function(a){const b=Hw(1,0,a.l*Math.PI/180);Iw(Hw(0,1,a.j*Math.PI/180),a.P);Iw(b,a.R);Ow(a.Z);Mw(a.ca,a.P,a.Z);Mw(a.G,a.R,a.ca)},Gw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Nw=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 Sw=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,x,y){const B=this.a;B[0]=a;B[4]=b;B[8]=c;B[12]=d;B[1]=e;B[5]=f;B[9]=g;B[13]=h;B[2]=k;B[6]=l;B[10]=m;B[14]=n;B[3]=p;B[7]=u;B[11]=x;B[15]=y;return this}};var Tw=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Pw(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=Pw(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 _.J(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 Uw=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 Vw=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 Ww={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},Xw=class extends _.Hv{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 _.S("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 Sw;this.R=new Sw;this.Z=new Sw;this.ca=new Sw;this.A=this.ja.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&&_.eh(d))this.H=d;else throw new _.J(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.eh(e)&&0<e)this.U=e;else throw new _.J(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",Ww)||this.a.getContext("experimental-webgl",
9
+ Ww);if(!this.f)throw new _.J(1,9,9003,"Unable to create GL context");this.G=new Sw;Ow(this.G);this.W=new Uw(this.f);this.C=new Tw(this.f);this.I=new Sw;this.K=new Sw;this.o=this.w=null;this.a.addEventListener(_.vf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Fw,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&&(Qw(this),this.a.removeEventListener(_.vf,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 _.v(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 Vw(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=Mw(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===Kw)a.type===Kw?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(Jw,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===Jw&&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 {Bh:e,Ch:f}={Bh:a*b*(this.L?-1:1),Ch:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;Ww(this)}Aa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Vw(this)}vi(a,b){this.l=b;this.j=a;Ww(this)}Wh(){return{x:this.j,y:this.l}}Ui(a){this.H=a;this.F()}};
15
- _.w("clpp.vr.VrPlugin",bx);bx.prototype.setCameraFieldOfView=bx.prototype.Ui;bx.prototype.getCameraCoordinates=bx.prototype.Wh;bx.prototype.moveCamera=bx.prototype.vi;bx.Id="vr";_.Kn(new class{create(){return new bx}});};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===Fw)a.type===Fw?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(Ew,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
+ this.B,!1)}ja(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Ew&&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 {zh:e,Ah:f}={zh:a*b*(this.L?-1:1),Ah:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;Rw(this)}Aa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Qw(this)}ri(a,b){this.l=b;this.j=a;Rw(this)}Uh(){return{x:this.j,y:this.l}}Si(a){this.H=a;this.F()}};
15
+ _.w("clpp.vr.VrPlugin",Xw);Xw.prototype.setCameraFieldOfView=Xw.prototype.Si;Xw.prototype.getCameraCoordinates=Xw.prototype.Uh;Xw.prototype.moveCamera=Xw.prototype.ri;Xw.Id="vr";_.Lr(new class{create(){return new Xw}});};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 qw=" The setting will be ignored.",rw="VTT parser encountered an invalid VTT setting: ",sw="application/x-subrip",tw="text/srt",uw='text/vtt; codecs\x3d"vtt"',vw='text/vtt; codecs\x3d"wvtt"',ww=function(a){return a.a===a.f.length?null:(a=_.fr(a,/[^ \t\n]*/gm))?a[0]:null},xw=function(a){_.fr(a,/[ \t]+/gm)},yw=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},zw=function(a){a=_.fr(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)},Bw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.ju:a.textAlign=_.pu[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.pg:_.qg;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===_.ie||b===_.Lf?_.ie:b===_.je||b===_.Rd?
4
- _.je:_.Uc);else if(d=/^region:(.*)$/.exec(b)){if(b=Aw(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=_.qu[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.lu,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.qu[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Aw=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)},Dw=function(a,b,c){let d,e,f;(new _.mp).N("payl",_.hp(g=>{d=_.ii(g)})).N("iden",_.hp(g=>{e=_.ii(g)})).N("sttg",_.hp(g=>{f=_.ii(g)})).parse(a);return d?Cw(d,e,f,b,c):null},Cw=function(a,b,c,d,e){a=new _.ou(d,e,a,_.Ag);b&&(a.id=b);if(c)for(b=new _.gr(c),c=ww(b);c;)Bw(a,c,[])||_.B(rw,c,qw),xw(b),c=ww(b);return a},Ew=class{a(a){a=_.ii(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+=yw(c)}return _.mi(b)}},Fw=class{create(){return new Ew}probe(a,b){return(a===tw||a===sw)&&b===_.Vf}};var Gw=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.ii(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=zw(new _.gr(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 _.gr(f.replace(/\n/g," "));d=new _.tu;ww(e);xw(e);for(var g=ww(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,qw);xw(e);g=ww(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 _.gr(l[0]);g=zw(d);const p=_.fr(d,/[ \t]+--\x3e[ \t]+/g);k=zw(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 _.ou(g,k,l,_.Ag);e&&(g.id=e);xw(d);for(k=ww(d);k;)Bw(g,k,c)||_.B(rw,k,qw),xw(d),k=ww(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Hw=class extends Gw{parseMedia(a,b){return super.parseMedia((new Ew).a(a),b)}};var Iw=class{constructor(){this.a=null;this.g=new _.T("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.mp).N(_.we,_.fp).N(_.dg,_.fp).N(_.re,_.fp).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(_.ve,_.fp).N(_.Of,_.fp).fa(_.Qf,_.gp).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 _.mp).N("moof",_.fp).N("traf",_.fp).fa("tfdt",p=>{g=!0;c=0===p.version?_.N(p.reader):_.ap(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,x=p.flags;p=p.reader;const y=_.N(p);x&1&&p.skip(4);x&4&&p.skip(4);const A=[];for(let E=0;E<y;E++){const F={duration:null,sampleSize:null,If:null};x&256&&(F.duration=_.N(p));x&512&&(F.sampleSize=
11
- _.N(p));x&1024&&p.skip(4);x&2048&&(F.If=0===u?_.N(p):_.$o(p));A.push(F)}d=A}}).N(_.qe,_.hp(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 _.Wp(m,!1);for(const p of d){const u=p.duration||l,x=p.If?c+p.If:a;a=x+(u||0);let y=0;do{const A=_.N(m);y+=A;var n=_.N(m);n=_.ep(n);let E=null;"vttc"===n?8<A&&(E=_.cp(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?E&&f.push(Dw(E,b.periodStart+x/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(_.Bm),styles:[]}}};_.w("clpp.vtt.VttComponent",class extends _.uv{constructor(){super();this.a=new Fw}install(){_.rt(_.Vf,Gw);_.rt(uw,Gw);_.rt(vw,Gw);_.rt(_.wc,Iw);_.rt(tw,Hw);_.rt(sw,Hw);_.Er.push(this.a)}uninstall(){_.tt(_.Vf);_.tt(uw);_.tt(vw);_.tt(_.wc);_.tt(tw);_.tt(sw);_.Gr(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 lw=" The setting will be ignored.",mw="VTT parser encountered an invalid VTT setting: ",nw="application/x-subrip",ow="text/srt",pw='text/vtt; codecs\x3d"vtt"',qw='text/vtt; codecs\x3d"wvtt"',rw=function(a){return a.a===a.f.length?null:(a=_.nk(a,/[^ \t\n]*/gm))?a[0]:null},sw=function(a){_.nk(a,/[ \t]+/gm)},tw=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},uw=function(a){a=_.nk(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)},ww=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.Kt:a.textAlign=_.Qt[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.ng:_.og;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===_.ge||b===_.Jf?_.ge:b===_.he||b===_.Qd?
4
+ _.he:_.Wc);else if(d=/^region:(.*)$/.exec(b)){if(b=vw(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=_.Rt[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Mt,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Rt[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},vw=function(a,b){a=a.filter(c=>c.id===b);return a.length?a[0]:(_.A("VTT parser could not find a region with id: ",
5
+ b," The region will be ignored."),null)},yw=function(a,b,c){let d,e,f;(new _.an).N("payl",_.Wm(g=>{d=_.vi(g)})).N("iden",_.Wm(g=>{e=_.vi(g)})).N("sttg",_.Wm(g=>{f=_.vi(g)})).parse(a);return d?xw(d,e,f,b,c):null},xw=function(a,b,c,d,e){a=new _.Pt(d,e,a,_.yg);b&&(a.id=b);if(c)for(b=new _.ok(c),c=rw(b);c;)ww(a,c,[])||_.A(mw,c,lw),sw(b),c=rw(b);return a},zw=class{a(a){a=_.vi(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+=tw(c)}return _.zi(b)}},Aw=class{create(){return new zw}probe(a,b){return(a===ow||a===nw)&&b===_.Tf}};var Bw=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.vi(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 _.J(_.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=uw(new _.ok(d[1]));if(null==a)throw new _.J(_.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 _.ok(f.replace(/\n/g," "));d=new _.Ut;rw(e);sw(e);for(var g=rw(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||_.A("VTT parser encountered an invalid VTTRegion setting: ",g,lw);sw(e);g=rw(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 _.ok(l[0]);g=uw(d);const p=_.nk(d,/[ \t]+--\x3e[ \t]+/g);k=uw(d);if(null==g||null==p||null==k)throw new _.J(_.C,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.Pt(g,k,l,_.yg);e&&(g.id=e);sw(d);for(k=rw(d);k;)ww(g,k,c)||_.A(mw,k,lw),sw(d),k=rw(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Cw=class extends Bw{parseMedia(a,b){return super.parseMedia((new zw).a(a),b)}};var Dw=class{constructor(){this.a=null;this.g=new _.S("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.an).N(_.ue,_.Um).N(_.bg,_.Um).N(_.pe,_.Um).fa("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.P(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.P(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.te,_.Um).N(_.Mf,_.Um).fa(_.Of,_.Vm).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.J(_.C,2,2008);if(!b)throw new _.J(_.C,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
+ new _.J(_.C,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.an).N("moof",_.Um).N("traf",_.Um).fa("tfdt",p=>{g=!0;c=0===p.version?_.P(p.reader):_.Pm(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?_.P(p):null}).fa("trun",p=>{h=!0;{var u=p.version,x=p.flags;p=p.reader;const y=_.P(p);x&1&&p.skip(4);x&4&&p.skip(4);const B=[];for(let F=0;F<y;F++){const G={duration:null,sampleSize:null,Ff:null};x&256&&(G.duration=_.P(p));x&512&&(G.sampleSize=
11
+ _.P(p));x&1024&&p.skip(4);x&2048&&(G.Ff=0===u?_.P(p):_.Om(p));B.push(G)}d=B}}).N(_.oe,_.Wm(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.J(_.C,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Hn(m,!1);for(const p of d){const u=p.duration||l,x=p.Ff?c+p.Ff:a;a=x+(u||0);let y=0;do{const B=_.P(m);y+=B;var n=_.P(m);n=_.Tm(n);let F=null;"vttc"===n?8<B&&(F=_.Rm(m,B-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(B-8));u?F&&f.push(yw(F,b.periodStart+x/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(_.uj),styles:[]}}};_.w("clpp.vtt.VttComponent",class extends _.mv{constructor(){super();this.a=new Aw}install(){_.lt(_.Tf,Bw);_.lt(pw,Bw);_.lt(qw,Bw);_.lt(_.yc,Dw);_.lt(ow,Cw);_.lt(nw,Cw);_.Jl.push(this.a)}uninstall(){_.nt(_.Tf);_.nt(pw);_.nt(qw);_.nt(_.yc);_.nt(ow);_.nt(nw);_.Ll(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 lw="clpp.yospace.YospacePlugin",ow=class extends _.Mv{constructor(){super();this.a=null;this.g=new _.T(lw)}tg(){return this.a}onContentWillLoad(a,b){const c=this;return _.v(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.De)throw new _.I(_.D,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||mw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case mw:d=YospaceAdManagement.SessionVOD.create(e);
2
- break a;case nw: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(_.Ng,{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(_.Mg,{detail:b}))}}id(){return"yospace"}};_.w(lw,ow);ow.prototype.getSession=ow.prototype.tg;ow.Id="yospace";var pw=class{create(){return new ow}},mw=_.Bb,nw="LIVE";_.w("clpp.yospace.StreamType",{VOD:mw,LIVE:nw,DVR:"DVR"});_.Kn(new pw);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var gw="clpp.yospace.YospacePlugin",jw=class extends _.Hv{constructor(){super();this.a=null;this.g=new _.S(gw)}rg(){return this.a}onContentWillLoad(a,b){const c=this;return _.v(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Be)throw new _.J(_.C,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||hw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case hw:d=YospaceAdManagement.SessionVOD.create(e);
2
+ break a;case iw: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 _.J(_.C,9,7003,"Yospace session failed to initialize.");a.trigger(new _.H(_.Lg,{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(_.Kg,{detail:b}))}}id(){return"yospace"}};_.w(gw,jw);jw.prototype.getSession=jw.prototype.rg;jw.Id="yospace";var kw=class{create(){return new jw}},hw=_.Db,iw="LIVE";_.w("clpp.yospace.StreamType",{VOD:hw,LIVE:iw,DVR:"DVR"});_.Lr(new kw);};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 Nv="Unhandled state",Ov="ad break start",Pv="ad buffering ended",Qv="ad buffering started",Rv="ad click through url: ",Sv="ad timeline changed",Tv="clpp.npaw.NpawPlugin",Uv="clpp.npaw.YouboraPlugin",Vv="content.isLive",Wv="content.title",Xv="is container visible",Yv=function(a){return a.startsWith(_.sd)?"Widevine":a.startsWith(_.od)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Me)?"ClearKey":a.startsWith(_.nd)?"Primetime":a},$v=function(a){class b extends youbora.Adapter{constructor(c){super(c);
2
- this.m=c;this.a=new _.It;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.Qa();
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.Ha())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.33.0-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,_.Mf,this.I.bind(this)),this.a.on(this.m,
4
- _.Td,this.F.bind(this)),this.a.on(this.m,_.mg,this.H.bind(this)),this.a.on(this.m,_.lg,this.G.bind(this)),this.a.on(this.m,_.mc,this.B.bind(this)),this.a.on(this.m,_.Pc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.vb);_.Sh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.ks()}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 _.zo: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(Nv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&(c=Yv(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=Zv(c,this.m.getConfiguration().youbora,this.g,this))&&c.severity===_.D&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Ef),this.f(),this.fireSeekBegin())}G(){this.l(_.Df);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Qb()}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)},aw=function(a){class b extends youbora.Adapter{constructor(c){super(c);
7
- this.m=c;this.j=this.a=null;this.f=new _.It;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.Ta(),this.a.Sa(),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.Ua()}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(Xv,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.33.0-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&this.f&&(this.f.on(this.m,_.mc,this.M.bind(this)),
10
- this.f.on(this.m,_.hc,this.L.bind(this)),this.f.on(this.m,_.bc,this.I.bind(this)),this.f.on(this.m,_.dc,this.J.bind(this)),this.f.on(this.m,_.Ub,this.G.bind(this)),this.f.on(this.m,_.Vb,this.o.bind(this,1)),this.f.on(this.m,_.ac,this.o.bind(this,2)),this.f.on(this.m,_.kc,this.o.bind(this,3)),this.f.on(this.m,_.Tb,this.F.bind(this)),this.f.on(this.m,_.ec,this.K.bind(this)),this.f.on(this.m,_.Td,this.H.bind(this)),this.f.on(this.m,_.Qb,this.A.bind(this)),this.f.on(this.m,_.Rb,this.B.bind(this)),this.f.on(this.m,
11
- _.Sb,this.C.bind(this)),this.f.on(this.m,_.cc,this.w.bind(this)))}unregisterListeners(){_.Sh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(Sv,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(Qv);this.fireBufferBegin()}w(){this.l&&(this.h(Pv),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",
12
- c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.Pa();this.g.debug(Rv,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Ov,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&&Zv(c,this.m.getConfiguration().youbora,this.g,this)}h(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,
13
- ...d)}}return new b(a)},cw=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);return this.getNpawUtils().buildRenditionString(b,c,
14
- d)}getIsLive(){return this.player.isLive()}getResource(){const b=this.player.Qa();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.Ha())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.33.0-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=this.w();this.player&&b&&(b.on(this.player,
15
- _.Mf,this.K.bind(this)),b.on(this.player,_.Td,this.H.bind(this)),b.on(this.player,_.Ef,this.J.bind(this)),b.on(this.player,_.Df,this.I.bind(this)),b.on(this.player,_.mc,this.F.bind(this)),b.on(this.player,_.Pc,this.G.bind(this)),b.on(this.player,_.Hc,this.L.bind(this)),b.on(this.player,_.Xf,this.M.bind(this)))}unregisterListeners(){bw.debug(_.vb);_.Sh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||_.ks()}o(){return!!this.player.getConfiguration().autoplay}K(b){b=
16
- 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 _.zo:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();
17
- break;default:bw.debug(Nv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=Zv(b,this.player.getConfiguration().npaw,bw,this))&&b.severity===_.D&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.Ef),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Uf&&(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=this.B(_.Uf),c=this.C();
18
- this.plugin.setVideoOptions({"content.subtitles":b||c})}w(){this.a||(this.a=new _.It);return this.a}I(){this.l(_.Df);this.fireSeekEnd()}F(b){bw.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Qb()}G(b){bw.debug("Casting",b);this.fireCasted()}l(b,...c){bw.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},ew=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.Ta(),this.a.Sa(),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}dw.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.Ua()}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);dw.debug(Xv,
22
- b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.33.0-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.It);return this.j}registerListeners(){const b=this.B();this.player&&b&&(b.on(this.player,_.mc,this.R.bind(this)),b.on(this.player,_.hc,this.P.bind(this)),b.on(this.player,_.bc,this.K.bind(this)),b.on(this.player,_.dc,this.L.bind(this)),b.on(this.player,_.Ub,this.I.bind(this)),b.on(this.player,_.Vb,this.w.bind(this,1)),b.on(this.player,_.ac,this.w.bind(this,
23
- 2)),b.on(this.player,_.kc,this.w.bind(this,3)),b.on(this.player,_.Tb,this.H.bind(this)),b.on(this.player,_.ec,this.M.bind(this)),b.on(this.player,_.Td,this.J.bind(this)),b.on(this.player,_.Qb,this.C.bind(this)),b.on(this.player,_.Rb,this.F.bind(this)),b.on(this.player,_.Sb,this.G.bind(this)),b.on(this.player,_.cc,this.S.bind(this)))}unregisterListeners(){_.Sh(this.B())}R(b){dw.debug(Sv,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(Qv);this.fireBufferBegin()}S(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Pv),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.Pa();dw.debug(Rv,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Ov,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&&Zv(b,this.player.getConfiguration().npaw,dw,this)}f(b,...c){dw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},fw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},gw=function(a,b){if(b.namespace()===_.ed)return a.g.info("NPAW does not report when casting."),
26
- !1;const c=b.getConfiguration().npaw;return _.eh(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)},hw=function(a,b){if(b.namespace()===_.ed)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.eh(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},iw=a=>a&&a.errorFilter?a.errorFilter:
28
- b=>({code:`${b.code}`,message:b.message,severity:b.severity}),Zv=(a,b,c,d)=>{b=iw(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.Td;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 bw=new _.T("clpp.npaw.NpawAdapter");var dw=new _.T("clpp.npaw.NpawAdsAdapter");var jw=class extends _.Mv{constructor(){super();this.a=null;this.g=new _.T(Tv);this.m=null}Df(a){fw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,cw()),this.a.registerAdsAdapterFromClass(this.m,ew())}ai(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;gw(this,a)&&(a=a.getConfiguration().npaw,this.Df(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(gw(this,a)){a=a.getConfiguration();
29
- var c=a.npaw;void 0===c[Vv]&&(c[Vv]=b.isLive);void 0===c[Wv]&&(c[Wv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Df(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=Yv(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Fe,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){fw(this);this.a&&this.a.destroy()}id(){return"npaw"}};_.w(Tv,jw);jw.prototype.getAdsAdapter=jw.prototype.getAdsAdapter;
30
- jw.prototype.getAdapter=jw.prototype.getAdapter;jw.prototype.getNpawPlugin=jw.prototype.ai;jw.prototype.setNpawPlugin=jw.prototype.Df;jw.Id="npaw";new _.T(Tv);var kw=class extends _.Mv{constructor(){super();this.a=null;this.g=new _.T(Uv);this.m=null}Ef(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter($v(this.m)),this.a.setAdsAdapter(aw(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;hw(this,a)&&(a=a.getConfiguration().youbora,this.Ef(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(hw(this,a)){a=a.getConfiguration();var c=
31
- a.youbora;void 0===c[Vv]&&(c[Vv]=b.isLive);void 0===c[Wv]&&(c[Wv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Ef(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.w(Uv,kw);kw.prototype.getAdsAdapter=kw.prototype.getAdsAdapter;kw.prototype.getAdapter=kw.prototype.getAdapter;kw.prototype.setYouboraPlugin=kw.prototype.Ef;kw.Id="youbora";_.Kn(new class{create(a){return a.npaw?new jw:a.youbora?new kw:null}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Iv="Unhandled state",Jv="ad break start",Kv="ad buffering ended",Lv="ad buffering started",Mv="ad click through url: ",Nv="ad timeline changed",Ov="clpp.npaw.NpawPlugin",Pv="clpp.npaw.YouboraPlugin",Qv="content.isLive",Rv="content.title",Sv="is container visible",Tv=function(a){return a.startsWith(_.td)?"Widevine":a.startsWith(_.pd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Ke)?"ClearKey":a.startsWith(_.od)?"Primetime":a},Vv=function(a){class b extends youbora.Adapter{constructor(c){super(c);
2
+ this.m=c;this.a=new _.Et;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.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.Ra();
3
+ return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.lc()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ha())?c.frameRate:null}getPlayerName(){return _.sa}getVersion(){return"6.34.0-beta.1-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,_.af,this.I.bind(this)),this.a.on(this.m,
4
+ _.Sd,this.F.bind(this)),this.a.on(this.m,_.kg,this.H.bind(this)),this.a.on(this.m,_.jg,this.G.bind(this)),this.a.on(this.m,_.oc,this.B.bind(this)),this.a.on(this.m,_.Rc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.yb);_.Fh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.dp()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.l("state change",c);if(c)switch(c.currentState){case 2:this.w()&&this.f();break;case 8:this.f();this.A();this.fireResume();this.fireBufferEnd();
5
+ break;case 10:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case 0:this.fireBufferEnd();this.fireStop();break;case 11:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case 6:this.fireBufferBegin();break;default:this.g.debug(Iv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&(c=Tv(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=Uv(c,this.m.getConfiguration().youbora,this.g,this))&&c.severity===_.C&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Cf),this.f(),this.fireSeekBegin())}G(){this.l(_.Bf);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)},Wv=function(a){class b extends youbora.Adapter{constructor(c){super(c);
7
+ this.m=c;this.j=this.a=null;this.f=new _.Et;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.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&&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 _.Mj:d=c.Postroll;break;case _.Pj: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.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(Sv,c);return c}getPlayerName(){return _.sa}getVersion(){return"6.34.0-beta.1-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&this.f&&(this.f.on(this.m,
10
+ _.oc,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,_.mc,this.o.bind(this,3)),this.f.on(this.m,_.Vb,this.F.bind(this)),this.f.on(this.m,_.ic,this.K.bind(this)),this.f.on(this.m,_.Sd,this.H.bind(this)),this.f.on(this.m,_.Sb,this.A.bind(this)),this.f.on(this.m,_.Tb,
11
+ 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(){_.Fh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(Nv,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(Lv);this.fireBufferBegin()}w(){this.l&&(this.h(Kv),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.Qa();this.g.debug(Mv,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Jv,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&&Uv(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)},Yv=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.Ra();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.lc()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Ha())?b.frameRate:null}getPlayerName(){return _.sa}getVersion(){return"castlabs-adapter-6.34.0-beta.1-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=
15
+ this.w();this.player&&b&&(b.on(this.player,_.af,this.K.bind(this)),b.on(this.player,_.Sd,this.H.bind(this)),b.on(this.player,_.Cf,this.J.bind(this)),b.on(this.player,_.Bf,this.I.bind(this)),b.on(this.player,_.oc,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,_.Vf,this.M.bind(this)))}unregisterListeners(){Xv.debug(_.yb);_.Fh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||
16
+ _.dp()}o(){return!!this.player.getConfiguration().autoplay}K(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case 2:this.plugin.setVideoOptions({"content.subtitles":this.C()});this.o()&&this.fireStart();break;case 8:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();break;case 10:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case 0:this.fireBufferEnd();this.fireStop();break;case 11:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?
17
+ this.firePause():this.fireStop();break;case 6:this.fireBufferBegin();break;default:Xv.debug(Iv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=Uv(b,this.player.getConfiguration().npaw,Xv,this))&&b.severity===_.C&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.Cf),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Sf&&(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(_.Sf),c=this.C();this.plugin.setVideoOptions({"content.subtitles":b||c})}w(){this.a||(this.a=new _.Et);return this.a}I(){this.l(_.Bf);this.fireSeekEnd()}F(b){Xv.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Pb()}G(b){Xv.debug("Casting",b);this.fireCasted()}l(b,...c){Xv.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},$v=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 _.Mj:c=b.Postroll;break;case _.Pj:c=b.Midroll}Zv.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);Zv.debug(Sv,
22
+ b);return b}getPlayerName(){return _.sa}getVersion(){return"castlabs-ads-adapter-6.34.0-beta.1-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Et);return this.j}registerListeners(){const b=this.B();this.player&&b&&(b.on(this.player,_.oc,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,_.Xb,this.w.bind(this,1)),b.on(this.player,_.cc,this.w.bind(this,
23
+ 2)),b.on(this.player,_.mc,this.w.bind(this,3)),b.on(this.player,_.Vb,this.H.bind(this)),b.on(this.player,_.ic,this.M.bind(this)),b.on(this.player,_.Sd,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.S.bind(this)))}unregisterListeners(){_.Fh(this.B())}R(b){Zv.debug(Nv,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(Lv);this.fireBufferBegin()}S(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Kv),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.Qa();Zv.debug(Mv,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Jv,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&&Uv(b,this.player.getConfiguration().npaw,Zv,this)}f(b,...c){Zv.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},aw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},bw=function(a,b){if(b.namespace()===_.gd)return a.g.info("NPAW does not report when casting."),
26
+ !1;const c=b.getConfiguration().npaw;return _.ch(c)?c.accountCode?_.z(window.NpawPlugin)||_.z(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.J(1,9,9100)),!1):!0:(a.g.warn("accountCode key is missing in NPAW config"),b.onError(new _.J(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},cw=function(a,b){if(b.namespace()===_.gd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.ch(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 _.J(1,9,9101)),!1;if(_.z(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.J(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 _.J(1,9,9102)));return!0},dw=a=>a&&a.errorFilter?a.errorFilter:
28
+ b=>({code:`${b.code}`,message:b.message,severity:b.severity}),Uv=(a,b,c,d)=>{b=dw(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.Sd;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 Xv=new _.S("clpp.npaw.NpawAdapter");var Zv=new _.S("clpp.npaw.NpawAdsAdapter");var ew=class extends _.Hv{constructor(){super();this.a=null;this.g=new _.S(Ov);this.m=null}Af(a){aw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,Yv()),this.a.registerAdsAdapterFromClass(this.m,$v())}Zh(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;bw(this,a)&&(a=a.getConfiguration().npaw,this.Af(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(bw(this,a)){a=a.getConfiguration();
29
+ var c=a.npaw;void 0===c[Qv]&&(c[Qv]=b.isLive);void 0===c[Rv]&&(c[Rv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Af(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=Tv(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.De,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){aw(this);this.a&&this.a.destroy()}id(){return"npaw"}};_.w(Ov,ew);ew.prototype.getAdsAdapter=ew.prototype.getAdsAdapter;
30
+ ew.prototype.getAdapter=ew.prototype.getAdapter;ew.prototype.getNpawPlugin=ew.prototype.Zh;ew.prototype.setNpawPlugin=ew.prototype.Af;ew.Id="npaw";new _.S(Ov);var fw=class extends _.Hv{constructor(){super();this.a=null;this.g=new _.S(Pv);this.m=null}Bf(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Vv(this.m)),this.a.setAdsAdapter(Wv(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;cw(this,a)&&(a=a.getConfiguration().youbora,this.Bf(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(cw(this,a)){a=a.getConfiguration();var c=
31
+ a.youbora;void 0===c[Qv]&&(c[Qv]=b.isLive);void 0===c[Rv]&&(c[Rv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Bf(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.w(Pv,fw);fw.prototype.getAdsAdapter=fw.prototype.getAdsAdapter;fw.prototype.getAdapter=fw.prototype.getAdapter;fw.prototype.setYouboraPlugin=fw.prototype.Bf;fw.Id="youbora";_.Lr(new class{create(a){return a.npaw?new ew:a.youbora?new fw: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.33.0",
4
+ "version": "6.34.0-beta.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/castlabs/prestoplay-web.git"
package/typings.d.ts CHANGED
@@ -306,12 +306,23 @@ export namespace clpp {
306
306
  * a list of hosts separated by "," (i.e "192.168.1.1,192.168.10.1")
307
307
  */
308
308
  nanoCDNHost: string;
309
+ /**
310
+ * Broadpeak streaming session options.
311
+ */
312
+ sessionOptions: clpp.BroadpeakSessionOptions;
309
313
  /**
310
314
  * The Unique User Identifier.
311
315
  */
312
316
  uuid: string;
313
317
  }
314
318
 
319
+ /**
320
+ * Broadpeak streaming session options passed to SmartLib.
321
+ * Use StreamingSessionOptions constants as keys.
322
+ * See {@link https://delivery-platform.broadpeak.tv/smartlib/public/advanced-features/session-options|Broadpeak session options docs}.
323
+ */
324
+ export type BroadpeakSessionOptions = Record<string, any>;
325
+
315
326
  /**
316
327
  * Chromecast configuration.
317
328
  */
@@ -321,7 +332,7 @@ export namespace clpp {
321
332
  */
322
333
  useSenderAbrConfig?: boolean;
323
334
  /**
324
- * Enable to pass on current sender {@link clpp.StreamingConfiguration} to reciver.
335
+ * Enable to pass on current sender {@link clpp.StreamingConfiguration} to receiver.
325
336
  */
326
337
  useSenderStreamingConfig?: boolean;
327
338
  }
@@ -1319,7 +1330,7 @@ export namespace clpp {
1319
1330
  */
1320
1331
  abr?: Partial<clpp.AbrConfiguration>;
1321
1332
  /**
1322
- * Adobe analytics plugin configuration.
1333
+ * Deprecated. Adobe analytics plugin configuration.
1323
1334
  */
1324
1335
  adobe?: Partial<clpp.AdobeConfiguration>;
1325
1336
  /**
@@ -1327,7 +1338,10 @@ export namespace clpp {
1327
1338
  */
1328
1339
  ads?: Partial<clpp.AdsConfiguration>;
1329
1340
  /**
1330
- * Configures the autoplay behavior.
1341
+ * If true, video automatically starts playback after {@link clpp.Player#open()|player.open()}.
1342
+ * Before configuring this please make sure you are familiar with browser
1343
+ * autoplay policies limiting autoplay on page load
1344
+ * {@link https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Autoplay}.
1331
1345
  */
1332
1346
  autoplay?: boolean;
1333
1347
  /**
@@ -1352,9 +1366,7 @@ export namespace clpp {
1352
1366
  */
1353
1367
  drm?: Partial<clpp.DrmConfiguration>|null;
1354
1368
  /**
1355
- * The DRM configuration resolver. Only works on MSE, not compatible
1356
- * with {@link clpp.onboard.OnboardComponent}, {@link clpp.drm.HeaderDrmComponent}
1357
- * nor {@link clpp.verimatrix.VcasComponent}.
1369
+ * The DRM configuration resolver. Only works on MSE.
1358
1370
  */
1359
1371
  drmResolver?: Partial<clpp.DrmConfigurationResolver>;
1360
1372
  /**
@@ -1589,7 +1601,7 @@ export namespace clpp {
1589
1601
  */
1590
1602
  viewerId?: string;
1591
1603
  /**
1592
- * Vimond plugin configuration.
1604
+ * Deprecated. Vimond plugin configuration.
1593
1605
  */
1594
1606
  vimond?: Partial<clpp.VimondConfiguration>;
1595
1607
  /**
@@ -2267,6 +2279,13 @@ export namespace clpp {
2267
2279
  * When set to |true|, live edge chasing algorithm will be enabled.
2268
2280
  */
2269
2281
  enableLiveEdgeChasing: boolean;
2282
+ /**
2283
+ * Defaults to true.
2284
+ *
2285
+ * When enabled, the player monitors segment downloads and aborts
2286
+ * any request that has been running longer than rebufferingGoal.
2287
+ */
2288
+ enableStalledSegmentAbort?: boolean;
2270
2289
  /**
2271
2290
  * If this is true, native TS support will be used where possible. Otherwise
2272
2291
  * we will transmux TS content even if not strictly necessary
@@ -3603,15 +3622,6 @@ export namespace clpp {
3603
3622
  * Triggered by the Yospace plugin when the Yospace session has been shut down.
3604
3623
  */
3605
3624
  YOSPACE_SESSION_ENDED = "yospace-session-ended",
3606
- /**
3607
- * Triggered when location selection and priorities are updated
3608
- * for a BaseUriCollection
3609
- */
3610
- CONTENT_STEERING_CHANGE = "content-steering-change",
3611
- /**
3612
- * Triggered when a service location is banned/unbanned
3613
- */
3614
- CONTENT_STEERING_LOCATION_BAN_UPDATE = "content-steering-location-ban-update",
3615
3625
  }
3616
3626
 
3617
3627
  /**
@@ -3735,8 +3745,9 @@ export namespace clpp {
3735
3745
  * 'message' property, which will be used as the error message
3736
3746
  * @param opt_error Optional cause. This will be available as the cause
3737
3747
  * for this error.
3748
+ * @param opt_svtaCode Optional SVTA code.
3738
3749
  */
3739
- constructor(severity: clpp.Error.Severity, category: clpp.Error.Category, code: clpp.Error.Code, opt_data?: Record<string, any>|string, opt_error?: any);
3750
+ constructor(severity: clpp.Error.Severity, category: clpp.Error.Category, code: clpp.Error.Code, opt_data?: Record<string, any>|string, opt_error?: any, opt_svtaCode?: number);
3740
3751
  /**
3741
3752
  * The error category.
3742
3753
  */
@@ -3761,6 +3772,10 @@ export namespace clpp {
3761
3772
  * The error severity.
3762
3773
  */
3763
3774
  severity: clpp.Error.Severity;
3775
+ /**
3776
+ * The SVTA error code.
3777
+ */
3778
+ svtaCode: number;
3764
3779
  }
3765
3780
 
3766
3781
  /**
@@ -3809,7 +3824,7 @@ export namespace clpp {
3809
3824
  destroy(): Promise<void>;
3810
3825
  /**
3811
3826
  * Returns the ads manager or null if not available.
3812
- * The ads manager is available when {@link clpp.Player.open} is resolved.
3827
+ * The ads manager is available when {@link clpp.Player#open} is resolved.
3813
3828
  */
3814
3829
  getAdsManager(): clpp.ads.IAdsManager|null;
3815
3830
  /**
@@ -5769,12 +5784,6 @@ export namespace clpp {
5769
5784
  }
5770
5785
  }
5771
5786
 
5772
- namespace adobe {
5773
- export class AdobeAnalyticsPlugin {
5774
- static Id: string;
5775
- }
5776
- }
5777
-
5778
5787
  namespace ads {
5779
5788
  export interface IAd {
5780
5789
  /**
@@ -6211,10 +6220,6 @@ export namespace clpp {
6211
6220
  setPlayerConfigInterceptor(interceptor: clpp.cast.utils.PlayerConfigInterceptor|null): void;
6212
6221
  }
6213
6222
 
6214
- export class CastUtils {
6215
-
6216
- }
6217
-
6218
6223
  export class Queue {
6219
6224
 
6220
6225
  }
@@ -6898,10 +6903,6 @@ export namespace clpp {
6898
6903
  }
6899
6904
 
6900
6905
  namespace eme {
6901
- export class EmeFactory {
6902
-
6903
- }
6904
-
6905
6906
  namespace EmeFactory {
6906
6907
  /**
6907
6908
  * Versions of Encrypted Media Extensions (EME) API.
@@ -9572,20 +9573,6 @@ export namespace clpp {
9572
9573
  }
9573
9574
  }
9574
9575
 
9575
- namespace vimond {
9576
- export class VimondPlugin {
9577
- static Id: string;
9578
- /**
9579
- * Update the auth token.
9580
- * The auth token may expire during playback.
9581
- * Pass a fresh auth token regularly to prevent failure.
9582
- *
9583
- * @param authToken Authentication token
9584
- */
9585
- updateAuthToken(authToken: string): void;
9586
- }
9587
- }
9588
-
9589
9576
  namespace vr {
9590
9577
  export class VrPlugin {
9591
9578
  static Id: string;