@castlabs/prestoplay 6.13.0 → 6.14.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 (62) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -6
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +528 -518
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +60 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +265 -274
  17. package/cjs/cl.muxdata.js +15 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +71 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +88 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +441 -431
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +68 -68
  39. package/cl.externs.js +60 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +236 -239
  46. package/cl.muxdata.js +13 -12
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +4 -4
  62. package/typings.d.ts +93 -50
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 Lt="touchmove",Mt="touchstart",Ot=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Nt(a/d*e,b/d*e,0/d*e,Math.cos(c))},Pt=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)},Qt=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Rt=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},St=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},Tt=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},Vt=function(a){var b=new Ut(0,0,0),c=new Ut(0,0,1);const d=new Ut,e=new Ut,f=new Ut;a=a.a;var g=
3
- new Ut(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Qt(f,1/g);c=St(d,c,f);g=c.length();Qt(c,1/g);St(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Rt(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Rt(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Rt(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Wt=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.H(1,9,9004,"Unable to compile GL shader: "+
4
- a.a.getShaderInfoLog(b));return b},Xt=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Lt,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Yt=function(a){const b=Ot(1,0,a.l*Math.PI/180);Pt(Ot(0,1,a.j*Math.PI/180),a.R);Pt(b,a.T);Vt(a.aa);Tt(a.ba,a.R,a.aa);Tt(a.G,a.T,a.ba)},Nt=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Ut=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 Zt=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,q,t,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]=q;A[7]=t;A[11]=v;A[15]=y;return this}};var $t=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Wt(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=Wt(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
5
- a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var au=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.g=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var bu=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 cu={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},du=class extends _.jt{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Z=this.G=this.f=this.a=this.m=null;this.h=new _.R("clpp.vr");this.H=70;this.W=1;this.N=this.M=!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.g={x:0,y:0};this.R=new Zt;this.T=new Zt;this.aa=new Zt;this.ba=new Zt;this.A=this.ja.bind(this);this.B=this.Ga.bind(this);this.J=this.ea.bind(this)}onPlayerCreated(a){this.h.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&&_.Bg(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.Bg(e)&&0<e)this.W=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.M=!!f;this.N=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.w){this.h.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",cu)||this.a.getContext("experimental-webgl",
9
- cu);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new Zt;Vt(this.G);this.Z=new au(this.f);this.C=new $t(this.f);this.I=new Zt;this.K=new Zt;this.o=this.w=null;this.a.addEventListener(_.gf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Mt,this.J,!1));this.F();this.V()}else this.h.info("No video element found, can not initialize VR plugin");else this.h.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.h.info("Releasing VR plugin resources");
10
- this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.l=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Xt(this),this.a.removeEventListener(_.gf,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 _.x(function*(){a.m=null})}id(){return"vr"}V(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.w){this.w=requestAnimationFrame(this.V.bind(this));
11
- var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new bu(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=Tt(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 ju="touchmove",ku="touchstart",mu=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new lu(a/d*e,b/d*e,0/d*e,Math.cos(c))},nu=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)},ou=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},pu=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},qu=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},ru=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},tu=function(a){var b=new su(0,0,0),c=new su(0,0,1);const d=new su,e=new su,f=new su;a=a.a;var g=
3
+ new su(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();ou(f,1/g);c=qu(d,c,f);g=c.length();ou(c,1/g);qu(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-pu(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-pu(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-pu(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},uu=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.H(1,9,9004,"Unable to compile GL shader: "+
4
+ a.a.getShaderInfoLog(b));return b},vu=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(ju,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},wu=function(a){const b=mu(1,0,a.l*Math.PI/180);nu(mu(0,1,a.j*Math.PI/180),a.R);nu(b,a.U);tu(a.aa);ru(a.ba,a.R,a.aa);ru(a.G,a.U,a.ba)},lu=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var su=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 xu=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,q,t,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]=q;A[7]=t;A[11]=v;A[15]=y;return this}};var yu=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=uu(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=uu(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
5
+ a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var zu=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.g=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var Au=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 Bu={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},Cu=class extends _.It{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Z=this.G=this.f=this.a=this.m=null;this.h=new _.R("clpp.vr");this.H=70;this.W=1;this.O=this.M=!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.g={x:0,y:0};this.R=new xu;this.U=new xu;this.aa=new xu;this.ba=new xu;this.A=this.oa.bind(this);this.B=this.Oa.bind(this);this.J=this.fa.bind(this)}onPlayerCreated(a){this.h.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&&_.Fg(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.Fg(e)&&0<e)this.W=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.M=!!f;this.O=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.u){this.h.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Bu)||this.a.getContext("experimental-webgl",
9
+ Bu);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new xu;tu(this.G);this.Z=new zu(this.f);this.C=new yu(this.f);this.I=new xu;this.K=new xu;this.o=this.w=null;this.a.addEventListener(_.lf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(ku,this.J,!1));this.F();this.V()}else this.h.info("No video element found, can not initialize VR plugin");else this.h.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.h.info("Releasing VR plugin resources");
10
+ this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.l=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(vu(this),this.a.removeEventListener(_.lf,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"}V(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.u){this.w=requestAnimationFrame(this.V.bind(this));
11
+ var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Au(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=ru(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.g,!1,this.I.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.Z;a.a.bindBuffer(a.a.ARRAY_BUFFER,a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,
13
- 0,a.g);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ea(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Mt)a.type===Mt?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Lt,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===Lt&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;const d=this.g.y-c;this.g.x=b;this.g.y=c;b=this.W;const {Sf:e,Tf:f}={Sf:a*b*(this.M?-1:1),Tf:d*b*(this.N?-1:1)};this.j+=e;this.l+=f;Yt(this)}Ga(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Xt(this)}Dg(a,b){this.l=b;this.j=a;Yt(this)}lg(){return{x:this.j,y:this.l}}Rg(a){this.H=a;this.F()}};
15
- _.z("clpp.vr.VrPlugin",du);du.prototype.setCameraFieldOfView=du.prototype.Rg;du.prototype.getCameraCoordinates=du.prototype.lg;du.prototype.moveCamera=du.prototype.Dg;du.Id="vr";_.ro(new class{create(){return new du}});};f.call(g, window);
13
+ 0,a.g);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}fa(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===ku)a.type===ku?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(ju,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
+ this.B,!1)}oa(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===ju&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;const d=this.g.y-c;this.g.x=b;this.g.y=c;b=this.W;const {Sf:e,Tf:f}={Sf:a*b*(this.M?-1:1),Tf:d*b*(this.O?-1:1)};this.j+=e;this.l+=f;wu(this)}Oa(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();vu(this)}Cg(a,b){this.l=b;this.j=a;wu(this)}lg(){return{x:this.j,y:this.l}}Qg(a){this.H=a;this.F()}};
15
+ _.x("clpp.vr.VrPlugin",Cu);Cu.prototype.setCameraFieldOfView=Cu.prototype.Qg;Cu.prototype.getCameraCoordinates=Cu.prototype.lg;Cu.prototype.moveCamera=Cu.prototype.Cg;Cu.Id="vr";_.Ho(new class{create(){return new Cu}});};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 st=" The setting will be ignored.",tt="VTT parser encountered an invalid VTT setting: ",ut="application/x-subrip",vt="text/srt",wt='text/vtt; codecs\x3d"vtt"',xt='text/vtt; codecs\x3d"wvtt"',yt=function(a){return a.a==a.f.length?null:(a=_.ki(a,/[^ \t\n]*/gm))?a[0]:null},zt=function(a){_.ki(a,/[ \t]+/gm)},At=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},Bt=function(a){a=_.ki(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)},Dt=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.kr:a.textAlign=_.qr[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Mf:_.Nf;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==_.de||b==_.qf?_.de:b==_.ee||b==_.Ld?_.ee:
4
- _.Tc);else if(d=/^region:(.*)$/.exec(b)){if(b=Ct(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=_.rr[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.mr,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.rr[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Ct=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)},Ft=function(a,b,c){let d,e,f;(new _.el).L("payl",_.Zk(g=>{d=_.Qh(g)})).L("iden",_.Zk(g=>{e=_.Qh(g)})).L("sttg",_.Zk(g=>{f=_.Qh(g)})).parse(a);return d?Et(d,e,f,b,c):null},Et=function(a,b,c,d,e){a=new _.pr(d,e,a,_.Zf);b&&(a.id=b);if(c)for(b=new _.li(c),c=yt(b);c;)Dt(a,c,[])||_.C(tt,c,st),zt(b),c=yt(b);return a},Gt=class{a(a){a=_.Qh(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+=At(c)}return _.Uh(b)}},Ht=class{create(){return new Gt}probe(a,b){return(a===vt||a===ut)&&b===_.zf}};var It=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Qh(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.H(_.G,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=Bt(new _.li(d[1]));if(null==a)throw new _.H(_.G,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 _.li(f.replace(/\n/g," "));d=new _.ur;yt(e);zt(e);for(var g=yt(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,st);zt(e);g=yt(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 _.li(l[0]);g=Bt(d);const q=_.ki(d,/[ \t]+--\x3e[ \t]+/g);k=Bt(d);if(null==g||null==q||null==k)throw new _.H(_.G,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.pr(g,k,l,_.Zf);e&&(g.id=e);zt(d);for(k=yt(d);k;)Dt(g,k,c)||_.C(tt,k,st),zt(d),k=yt(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Jt=class extends It{parseMedia(a,b){return super.parseMedia((new Gt).a(a),b)}};var Kt=class{constructor(){this.a=null;this.h=new _.R("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.el).L(_.pe,_.Xk).L(_.Cf,_.Xk).L(_.ke,_.Xk).$("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)}).L(_.oe,_.Xk).L(_.tf,_.Xk).$(_.vf,_.Yk).L("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.H(_.G,2,2008);if(!b)throw new _.H(_.G,2,2008);}parseMedia(a,b){if(!this.a)throw this.h.error("No init segment for MP4+VTT!"),
10
- new _.H(_.G,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.el).L("moof",_.Xk).L("traf",_.Xk).$("tfdt",q=>{g=!0;c=0==q.version?_.P(q.reader):_.Sk(q.reader)}).$("tfhd",q=>{var t=q.flags;q=q.reader;q.skip(4);t&1&&q.skip(8);t&2&&q.skip(4);l=t&8?_.P(q):null}).$("trun",q=>{h=!0;{var t=q.version,v=q.flags;q=q.reader;const y=_.P(q);v&1&&q.skip(4);v&4&&q.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,xe:null};v&256&&(E.duration=_.P(q));v&512&&(E.sampleSize=
11
- _.P(q));v&1024&&q.skip(4);v&2048&&(E.xe=0==t?_.P(q):_.Rk(q));A.push(E)}d=A}}).L(_.je,_.Zk(q=>{k=!0;e=q})).parse(a);if(!k&&!g&&!h)throw new _.H(_.G,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Rl(m,!1);for(const q of d){const t=q.duration||l,v=q.xe?c+q.xe:a;a=v+(t||0);let y=0;do{const A=_.P(m);y+=A;var n=_.P(m);n=_.Wk(n);let D=null;"vttc"==n?8<A&&(D=_.Uk(m,A-8)):("vtte"!=n&&this.h.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));t?D&&f.push(Ft(D,b.periodStart+v/this.a,
12
- b.periodStart+a/this.a)):this.h.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&y<q.sampleSize)}return{cues:f.filter(_.lh),styles:[]}}};_.z("clpp.vtt.VttComponent",class extends _.Js{constructor(){super();this.j=new Ht}f(){_.Wq[_.zf]=It;_.Wq[wt]=It;_.Wq[xt]=It;_.Wq[_.wc]=Kt;_.Wq[vt]=Jt;_.Wq[ut]=Jt;_.ej.push(this.j)}a(){_.Xq(_.zf);_.Xq(wt);_.Xq(xt);_.Xq(_.wc);_.Xq(vt);_.Xq(ut);_.gj(this.j)}id(){return"subtitles-vtt"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Rt=" The setting will be ignored.",St="VTT parser encountered an invalid VTT setting: ",Tt="application/x-subrip",Ut="text/srt",Vt='text/vtt; codecs\x3d"vtt"',Wt='text/vtt; codecs\x3d"wvtt"',Xt=function(a){return a.a==a.f.length?null:(a=_.qi(a,/[^ \t\n]*/gm))?a[0]:null},Yt=function(a){_.qi(a,/[ \t]+/gm)},Zt=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},$t=function(a){a=_.qi(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)},bu=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.Hr:a.textAlign=_.Nr[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Vf:_.Wf;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==_.he||b==_.uf?_.he:b==_.ie||b==_.Od?_.ie:
4
+ _.Vc);else if(d=/^region:(.*)$/.exec(b)){if(b=au(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=_.Or[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Jr,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Or[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},au=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)},du=function(a,b,c){let d,e,f;(new _.sl).L("payl",_.nl(g=>{d=_.Wh(g)})).L("iden",_.nl(g=>{e=_.Wh(g)})).L("sttg",_.nl(g=>{f=_.Wh(g)})).parse(a);return d?cu(d,e,f,b,c):null},cu=function(a,b,c,d,e){a=new _.Mr(d,e,a,_.cg);b&&(a.id=b);if(c)for(b=new _.ri(c),c=Xt(b);c;)bu(a,c,[])||_.B(St,c,Rt),Yt(b),c=Xt(b);return a},eu=class{a(a){a=_.Wh(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+=Zt(c)}return _.$h(b)}},fu=class{create(){return new eu}probe(a,b){return(a===Ut||a===Tt)&&b===_.Df}};var gu=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Wh(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.H(_.F,2,2E3);a=b.periodStart;if(c[0].includes("X-TIMESTAMP-MAP")){var d=c[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),e=c[0].match(/MPEGTS:(\d+)/m);if(d&&e){a=$t(new _.ri(d[1]));if(null==a)throw new _.H(_.F,2,2E3);e=Number(e[1]);for(d=b.segmentStart;95443.7176888889<=d;)d-=95443.7176888889,e+=
7
+ 8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.ri(f.replace(/\n/g," "));d=new _.Rr;Xt(e);Yt(e);for(var g=Xt(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,Rt);Yt(e);g=Xt(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 _.ri(l[0]);g=$t(d);const q=_.qi(d,/[ \t]+--\x3e[ \t]+/g);k=$t(d);if(null==g||null==q||null==k)throw new _.H(_.F,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.Mr(g,k,l,_.cg);e&&(g.id=e);Yt(d);for(k=Xt(d);k;)bu(g,k,c)||_.B(St,k,Rt),Yt(d),k=Xt(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var hu=class extends gu{parseMedia(a,b){return super.parseMedia((new eu).a(a),b)}};var iu=class{constructor(){this.a=null;this.h=new _.R("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.sl).L(_.ue,_.ll).L(_.Gf,_.ll).L(_.pe,_.ll).$("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)}).L(_.te,_.ll).L(_.xf,_.ll).$(_.zf,_.ml).L("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.H(_.F,2,2008);if(!b)throw new _.H(_.F,2,2008);}parseMedia(a,b){if(!this.a)throw this.h.error("No init segment for MP4+VTT!"),
10
+ new _.H(_.F,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.sl).L("moof",_.ll).L("traf",_.ll).$("tfdt",q=>{g=!0;c=0==q.version?_.P(q.reader):_.gl(q.reader)}).$("tfhd",q=>{var t=q.flags;q=q.reader;q.skip(4);t&1&&q.skip(8);t&2&&q.skip(4);l=t&8?_.P(q):null}).$("trun",q=>{h=!0;{var t=q.version,v=q.flags;q=q.reader;const y=_.P(q);v&1&&q.skip(4);v&4&&q.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,we:null};v&256&&(E.duration=_.P(q));v&512&&(E.sampleSize=
11
+ _.P(q));v&1024&&q.skip(4);v&2048&&(E.we=0==t?_.P(q):_.fl(q));A.push(E)}d=A}}).L(_.oe,_.nl(q=>{k=!0;e=q})).parse(a);if(!k&&!g&&!h)throw new _.H(_.F,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.em(m,!1);for(const q of d){const t=q.duration||l,v=q.we?c+q.we:a;a=v+(t||0);let y=0;do{const A=_.P(m);y+=A;var n=_.P(m);n=_.kl(n);let D=null;"vttc"==n?8<A&&(D=_.il(m,A-8)):("vtte"!=n&&this.h.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));t?D&&f.push(du(D,b.periodStart+v/this.a,
12
+ b.periodStart+a/this.a)):this.h.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&y<q.sampleSize)}return{cues:f.filter(_.rh),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.ht{constructor(){super();this.j=new fu}f(){_.rr(_.Df,gu);_.rr(Vt,gu);_.rr(Wt,gu);_.rr(_.wc,iu);_.rr(Ut,hu);_.rr(Tt,hu);_.kj.push(this.j)}a(){_.tr(_.Df);_.tr(Vt);_.tr(Wt);_.tr(_.wc);_.tr(Ut);_.tr(Tt);_.mj(this.j)}id(){return"subtitles-vtt"}});};f.call(g, window);
package/cl.youbora.js CHANGED
@@ -1,15 +1,15 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kt="clpp.npaw.YouboraPlugin",lt="content.isLive",mt=function(a,b){if(b.namespace()===_.dd)return a.h.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.zg(c))return a.h.warn("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.h.warn("accountCode key is missing in Youbora config"),b.onError(new _.H(1,9,9101)),!1;if(_.B(window.youbora))return a.h.warn("Youbora SDK not found."),b.onError(new _.H(1,9,
2
- 9100)),!1;"6.8.49"!==youbora.VERSION&&(a.h.warn("Youbora SDK version is not supported. The supported version is 6.8.49, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.H(1,9,9102)));return!0},nt=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),ot=(a,b,c,d)=>{b=nt(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===
3
- a.code?"ad error":_.Nd;b.severity===_.G?(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 pt=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.hr;this.h=new _.R("clpp.npaw.YouboraAdapter");this.g=this.w=!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.ia())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.l(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
4
- d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.l().streamBandwidth}getThroughput(){return this.l().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ma())?c.frameRate:null}getPlayerName(){return _.pa}getVersion(){return"6.13.0-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&this.a&&(this.h.debug("registering listeners"),
5
- youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.rf,this.I.bind(this)),this.a.on(this.m,_.Nd,this.F.bind(this)),this.a.on(this.m,_.Kf,this.H.bind(this)),this.a.on(this.m,_.Jf,this.G.bind(this)),this.a.on(this.m,_.nc,this.B.bind(this)),this.a.on(this.m,_.Pc,this.C.bind(this)))}unregisterListeners(){this.h.debug(_.Jb);_.Tg(this.a)}dispose(){super.dispose()}l(){return this.m.getStats()||_.$m()}o(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.j("state change",c);if(c)switch(c.currentState){case _.on:this.o()&&
6
- this.f();break;case _.qn:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.pn:this.o()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.nn:this.fireBufferEnd();this.fireStop();break;case _.en:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.hn:this.fireBufferBegin();break;default:this.h.debug("Unhandled state",c)}}f(){this.plugin.isInitiated||(this.g=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&
7
- (c=c.keySystem,(c=c.startsWith(_.rd)?"Widevine":c.startsWith(_.nd)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Ce)?"ClearKey":c.startsWith(_.md)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()}F(c){!(c=c.detail)||this.g||10003===c.code&&this.plugin.getAdsAdapter()||(c=ot(c,this.m,this.h,this))&&c.severity===_.G&&(this.g=!0)}H(){this.j(_.kf);this.m.isEnded()||(this.f(),this.fireSeekBegin())}G(){this.j(_.jf);this.fireSeekEnd()}B(c){this.h.debug("adsTimeline",
8
- c);c=c.adsTimeline;this.w=!!c&&c.jb()}C(c){this.h.debug("Casting",c);this.fireCasted()}j(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var qt=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.hr;this.h=new _.R("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.vb(),this.a.ub(),this.a.ib()));return c}getBitrate(){return this.a&&this.a.ib()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&
9
- 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.Va()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.h.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.m.getAdsManager();return c&&0<c.getVolume()}getExpectedBreaks(){return this.j&&
10
- this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.xb()}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.h.debug("is container visible",c);return c}getPlayerName(){return _.pa}getVersion(){return"6.13.0-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&
11
- this.f&&(this.f.on(this.m,_.nc,this.N.bind(this)),this.f.on(this.m,_.jc,this.M.bind(this)),this.f.on(this.m,_.fc,this.I.bind(this)),this.f.on(this.m,_.hc,this.J.bind(this)),this.f.on(this.m,_.ac,this.G.bind(this)),this.f.on(this.m,_.bc,this.o.bind(this,1)),this.f.on(this.m,_.ec,this.o.bind(this,2)),this.f.on(this.m,_.lc,this.o.bind(this,3)),this.f.on(this.m,_.$b,this.F.bind(this)),this.f.on(this.m,_.ic,this.K.bind(this)),this.f.on(this.m,_.Nd,this.H.bind(this)),this.f.on(this.m,_.Wb,this.A.bind(this)),
12
- this.f.on(this.m,_.Xb,this.B.bind(this)),this.f.on(this.m,_.Yb,this.C.bind(this)),this.f.on(this.m,_.gc,this.w.bind(this)))}unregisterListeners(){_.Tg(this.f)}dispose(){super.dispose()}N(c){this.h.debug("ad timeline changed",c);this.j=c.adsTimeline}M(c){this.a=c.ad;this.g("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.g("ad ended");this.fireStop()}I(){this.g("ad pause");this.w();this.firePause()}J(){this.g("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.g("ad buffering started");
13
- this.fireBufferBegin()}w(){this.l&&(this.g("ad buffering ended"),this.l=!1,this.fireBufferEnd())}o(c){this.g("ad quartile",c);this.fireQuartile(c)}F(){this.g("ad clicked");const c=this.a&&this.a.Lb();this.h.debug("ad click through url: ",c);this.fireClick(c)}K(){this.g("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.g("ad break start",this.a);this.fireBreakStart()}B(){this.g("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();
14
- c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&ot(c,this.m,this.h,this)}g(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var rt=class extends _.jt{constructor(){super();this.a=null;this.h=new _.R(kt);this.m=null}te(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(pt(this.m)),this.a.setAdsAdapter(qt(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;mt(this,a)&&(a=a.getConfiguration().youbora,this.te(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(mt(this,a)){a=a.getConfiguration();var c=
15
- a.youbora;void 0===c[lt]&&(c[lt]=b.isLive);void 0===c["content.title"]&&(c["content.title"]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.te(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.z(kt,rt);rt.prototype.getAdsAdapter=rt.prototype.getAdsAdapter;rt.prototype.getAdapter=rt.prototype.getAdapter;rt.prototype.setYouboraPlugin=rt.prototype.te;rt.Id="youbora";_.ro(new class{create(){return new rt}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jt="clpp.npaw.YouboraPlugin",Kt="content.isLive",Lt=function(a,b){if(b.namespace()===_.fd)return a.h.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.Dg(c))return a.h.warn("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.h.warn("accountCode key is missing in Youbora config"),b.onError(new _.H(1,9,9101)),!1;if(_.z(window.youbora))return a.h.warn("Youbora SDK not found."),b.onError(new _.H(1,9,
2
+ 9100)),!1;"6.8.49"!==youbora.VERSION&&(a.h.warn("Youbora SDK version is not supported. The supported version is 6.8.49, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.H(1,9,9102)));return!0},Mt=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),Nt=(a,b,c,d)=>{b=Mt(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===
3
+ a.code?"ad error":_.Qd;b.severity===_.F?(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 Ot=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Er;this.h=new _.R("clpp.npaw.YouboraAdapter");this.g=this.w=!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.ka())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.l(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
4
+ d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.l().streamBandwidth}getThroughput(){return this.l().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ea())?c.frameRate:null}getPlayerName(){return _.pa}getVersion(){return"6.14.1-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&this.a&&(this.h.debug("registering listeners"),
5
+ youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.vf,this.I.bind(this)),this.a.on(this.m,_.Qd,this.F.bind(this)),this.a.on(this.m,_.Pf,this.H.bind(this)),this.a.on(this.m,_.Of,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.h.debug(_.Kb);_.Xg(this.a)}dispose(){super.dispose()}l(){return this.m.getStats()||_.pn()}o(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.j("state change",c);if(c)switch(c.currentState){case _.Dn:this.o()&&
6
+ this.f();break;case _.Fn:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.En:this.o()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.Cn:this.fireBufferEnd();this.fireStop();break;case _.un:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.xn:this.fireBufferBegin();break;default:this.h.debug("Unhandled state",c)}}f(){this.plugin.isInitiated||(this.g=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&
7
+ (c=c.keySystem,(c=c.startsWith(_.ud)?"Widevine":c.startsWith(_.pd)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Ge)?"ClearKey":c.startsWith(_.od)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()}F(c){!(c=c.detail)||this.g||10003===c.code&&this.plugin.getAdsAdapter()||(c=Nt(c,this.m,this.h,this))&&c.severity===_.F&&(this.g=!0)}H(){this.m.isEnded()||(this.j(_.of),this.f(),this.fireSeekBegin())}G(){this.j(_.nf);this.fireSeekEnd()}B(c){this.h.debug("adsTimeline",
8
+ c);c=c.adsTimeline;this.w=!!c&&c.kb()}C(c){this.h.debug("Casting",c);this.fireCasted()}j(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var Pt=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Er;this.h=new _.R("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.wb(),this.a.vb(),this.a.jb()));return c}getBitrate(){return this.a&&this.a.jb()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&
9
+ 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.Wa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.h.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.m.getAdsManager();return c&&0<c.getVolume()}getExpectedBreaks(){return this.j&&
10
+ this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.yb()}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.h.debug("is container visible",c);return c}getPlayerName(){return _.pa}getVersion(){return"6.14.1-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&
11
+ this.f&&(this.f.on(this.m,_.oc,this.O.bind(this)),this.f.on(this.m,_.kc,this.M.bind(this)),this.f.on(this.m,_.gc,this.I.bind(this)),this.f.on(this.m,_.ic,this.J.bind(this)),this.f.on(this.m,_.bc,this.G.bind(this)),this.f.on(this.m,_.cc,this.o.bind(this,1)),this.f.on(this.m,_.fc,this.o.bind(this,2)),this.f.on(this.m,_.mc,this.o.bind(this,3)),this.f.on(this.m,_.ac,this.F.bind(this)),this.f.on(this.m,_.jc,this.K.bind(this)),this.f.on(this.m,_.Qd,this.H.bind(this)),this.f.on(this.m,_.Xb,this.A.bind(this)),
12
+ this.f.on(this.m,_.Zb,this.B.bind(this)),this.f.on(this.m,_.$b,this.C.bind(this)),this.f.on(this.m,_.hc,this.w.bind(this)))}unregisterListeners(){_.Xg(this.f)}dispose(){super.dispose()}O(c){this.h.debug("ad timeline changed",c);this.j=c.adsTimeline}M(c){this.a=c.ad;this.g("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.g("ad ended");this.fireStop()}I(){this.g("ad pause");this.w();this.firePause()}J(){this.g("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.g("ad buffering started");
13
+ this.fireBufferBegin()}w(){this.l&&(this.g("ad buffering ended"),this.l=!1,this.fireBufferEnd())}o(c){this.g("ad quartile",c);this.fireQuartile(c)}F(){this.g("ad clicked");const c=this.a&&this.a.Ib();this.h.debug("ad click through url: ",c);this.fireClick(c)}K(){this.g("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.g("ad break start",this.a);this.fireBreakStart()}B(){this.g("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();
14
+ c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&Nt(c,this.m,this.h,this)}g(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var Qt=class extends _.It{constructor(){super();this.a=null;this.h=new _.R(Jt);this.m=null}se(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Ot(this.m)),this.a.setAdsAdapter(Pt(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;Lt(this,a)&&(a=a.getConfiguration().youbora,this.se(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(Lt(this,a)){a=a.getConfiguration();var c=
15
+ a.youbora;void 0===c[Kt]&&(c[Kt]=b.isLive);void 0===c["content.title"]&&(c["content.title"]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.se(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.x(Jt,Qt);Qt.prototype.getAdsAdapter=Qt.prototype.getAdsAdapter;Qt.prototype.getAdapter=Qt.prototype.getAdapter;Qt.prototype.setYouboraPlugin=Qt.prototype.se;Qt.Id="youbora";_.Ho(new class{create(){return new Qt}});};f.call(g, window);
package/clpp.styles.css CHANGED
@@ -160,7 +160,9 @@
160
160
  }
161
161
  .clpp-mc-playlist .clpp-mc-playlist-item video {
162
162
  z-index: 0;
163
+ opacity: 0;
163
164
  }
164
165
  .clpp-mc-playlist .clpp-mc-playlist-item video.clpp-visible {
165
166
  z-index: 1;
167
+ opacity: 1;
166
168
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@castlabs/prestoplay",
3
3
  "description": "PRESTOplay Video Player",
4
- "version": "6.13.0",
4
+ "version": "6.14.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/castlabs/prestoplay-web.git"
@@ -22,9 +22,9 @@
22
22
  "CHANGELOG.md"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@broadpeak/smartlib": "4.5.1-328cb1e",
26
- "@broadpeak/smartlib-all-compatibility": "4.5.1-328cb1e",
27
- "@broadpeak/smartlib-analytics": "4.5.1-328cb1e",
25
+ "@broadpeak/smartlib": "5.0.1-4c69e21",
26
+ "@broadpeak/smartlib-all-compatibility": "5.0.1-4c69e21",
27
+ "@broadpeak/smartlib-analytics": "5.0.1-4c69e21",
28
28
  "mux.js": "^5.14.1",
29
29
  "youboralib": "6.8.49"
30
30
  },
package/typings.d.ts CHANGED
@@ -217,10 +217,10 @@ export namespace clpp {
217
217
  /**
218
218
  * The restrictions to apply to ABR decisions. These are "soft" restrictions.
219
219
  * Any track that fails to meet these restrictions will not be selected
220
- * automatically, but will still appear in the track list and can still be
221
- * selected via selectVariantTrack(). If no tracks meet these restrictions,
222
- * AbrManager should not fail, but choose a low-res or low-bandwidth variant
223
- * instead.
220
+ * automatically, but will still appear in the track list and can be selected
221
+ * via {@link clpp.TrackManager#setVideoTrack}. If no tracks meet these
222
+ * restrictions, AbrManager should not fail but should choose a low-resolution
223
+ * or low-bandwidth variant instead.
224
224
  */
225
225
  restrictions: clpp.Restrictions;
226
226
  /**
@@ -1204,6 +1204,16 @@ export namespace clpp {
1204
1204
  * back into foreground.
1205
1205
  */
1206
1206
  pauseWhenInBackground?: boolean;
1207
+ /**
1208
+ * Defaults to `false`.
1209
+ *
1210
+ * If `true`, a forced text track is preferred. If the content has no text
1211
+ * tracks marked as forced and the value is `true`, no text track is chosen.
1212
+ * If `true` and the `preferredTextLanguage` is set, and the specified
1213
+ * language is available for the forced text track, the forced text track will
1214
+ * be preferred over the non-forced subtitles and be enabled at startup.
1215
+ */
1216
+ preferForcedSubtitles?: boolean;
1207
1217
  /**
1208
1218
  * Defaults to `false`.
1209
1219
  *
@@ -1243,8 +1253,10 @@ export namespace clpp {
1243
1253
  * Defaults to ''.
1244
1254
  *
1245
1255
  * Language code for the preferred text language. If this is specified,
1246
- * subtitles will be enabled at startup.
1247
- * Pass an array of languages if you want to define fallback languages.
1256
+ * subtitles will be enabled at startup. Pass an array of languages if you
1257
+ * want to define fallback languages. If `preferForcedSubtitles` is set to
1258
+ * `true`, this language preference will be applied to the forced track
1259
+ * selection first, and will enable the forced track.
1248
1260
  */
1249
1261
  preferredTextLanguage?: string|Array<string>;
1250
1262
  /**
@@ -1267,7 +1279,10 @@ export namespace clpp {
1267
1279
  */
1268
1280
  remoteTextTracks?: Array<clpp.RemoteTextTrack>;
1269
1281
  /**
1270
- * Limit the renditions that can be played.
1282
+ * The application restrictions to apply to the tracks. These are "hard"
1283
+ * restrictions. Any track that fails to meet these restrictions will not
1284
+ * appear in the track list. If no tracks meet these restrictions, playback
1285
+ * will fail.
1271
1286
  */
1272
1287
  restrictions?: Partial<clpp.Restrictions>;
1273
1288
  /**
@@ -1294,11 +1309,8 @@ export namespace clpp {
1294
1309
  */
1295
1310
  streaming?: Partial<clpp.StreamingConfiguration>;
1296
1311
  /**
1297
- * The suggested presentation delay for live content in seconds. By default
1298
- * this is not specified. The default live edge is
1299
- * minBufferDuration * 3 in case of DASH and 3 * segmentDuration in case of
1300
- * HLS. This parameter can be used to adjust the live edge. If set it will
1301
- * take precedence.
1312
+ * The suggested presentation delay for live content in seconds. Presentation
1313
+ * delay is the difference between playback position and the live edge.
1302
1314
  */
1303
1315
  suggestedPresentationDelay?: number;
1304
1316
  /**
@@ -1541,10 +1553,15 @@ export namespace clpp {
1541
1553
  }
1542
1554
 
1543
1555
  /**
1544
- * An object of this type can be used apply restrictions and filters to
1545
- * video renditions and force the player to exclude video tracks based on
1546
- * these restrictions. All restrictions must be fulfilled for a track to be
1547
- * playable.
1556
+ * An object describing application restrictions on what tracks can play. All
1557
+ * restrictions must be fulfilled for a track to be playable/selectable.
1558
+ * The restrictions system behaves somewhat differently at the ABR level and the
1559
+ * player level, so please refer to the documentation for those specific
1560
+ * settings:
1561
+ *
1562
+ * {@link clpp.PlayerConfiguration#restrictions}
1563
+ * {@link clpp.AbrConfiguration}
1564
+ *
1548
1565
  */
1549
1566
  export type Restrictions = {
1550
1567
  /**
@@ -3083,8 +3100,18 @@ export namespace clpp {
3083
3100
  TIMELINE_CUE_EXIT = "timeline-cue-exit",
3084
3101
  /**
3085
3102
  * Triggered when a MPD type has changed from dynamic to static.
3103
+ * Note: You can also listen to the {@link clpp.events.LIVE_TURNED_STATIC}
3104
+ * event instead.
3086
3105
  */
3087
3106
  MPD_TYPE_CHANGED = "mpd-type-changed",
3107
+ /**
3108
+ * Triggered when a live stream turned in to a static stream.
3109
+ * In HLS this happens when EXT-X-ENDLIST appears in the playlist
3110
+ * and the playlist stops updating. In DASH this happens when
3111
+ * the type attribute of MPD turns from "dynamic" to "static"
3112
+ * and the manifest stops updating.
3113
+ */
3114
+ LIVE_TURNED_STATIC = "live-turned-static",
3088
3115
  /**
3089
3116
  * Triggered when there is a response from Vimond Session API.
3090
3117
  */
@@ -3384,11 +3411,11 @@ export namespace clpp {
3384
3411
  /**
3385
3412
  * Returns the player surface.
3386
3413
  */
3387
- getSurface(): clpp.IPlayerSurface|null;
3414
+ getSurface(): clpp.IPlayerSurface;
3388
3415
  /**
3389
3416
  * Get the text displayer.
3390
3417
  */
3391
- getTextDisplayer(): clpp.ITextDisplayer;
3418
+ getTextDisplayer(): clpp.ITextDisplayer|null;
3392
3419
  /**
3393
3420
  * Returns an array of timeline cues.
3394
3421
  */
@@ -3400,7 +3427,7 @@ export namespace clpp {
3400
3427
  */
3401
3428
  getTimelineOffset(): clpp.TimelineOffset|null;
3402
3429
  /**
3403
- * Returns track manager.
3430
+ * Returns the track manager.
3404
3431
  */
3405
3432
  getTrackManager(): clpp.TrackManager|null;
3406
3433
  /**
@@ -3409,7 +3436,7 @@ export namespace clpp {
3409
3436
  */
3410
3437
  getVolume(): number|null;
3411
3438
  /**
3412
- * Returns true if playback ended. False otherwise.
3439
+ * Returns true if playback ended, false otherwise.
3413
3440
  */
3414
3441
  isEnded(): boolean;
3415
3442
  /**
@@ -3420,21 +3447,19 @@ export namespace clpp {
3420
3447
  * On the Tizen platform the `http://tizen.org/privilege/tv.audio` privilege
3421
3448
  * is required.
3422
3449
  */
3423
- isMuted(): boolean|null;
3450
+ isMuted(): boolean;
3424
3451
  /**
3425
- * Returns true if playback is paused. False otherwise.
3452
+ * Returns true if playback is paused, false otherwise.
3426
3453
  */
3427
3454
  isPaused(): boolean;
3428
3455
  /**
3429
3456
  * Tell the player to load given content.
3430
- *
3431
3457
  * You may load content by passing a `string`, a {@link clpp.Source}, an array
3432
3458
  * of sources or player configuration. If multiple sources are passed to a
3433
3459
  * `load` method, player will play first source, that can be played on given
3434
3460
  * platform. Please refer to examples below for more details.
3435
- *
3436
- * If the player already playing another source, it will release itself first
3437
- * before loading the new source.
3461
+ * If the player is already playing another source, it will release itself
3462
+ * first before loading the new source.
3438
3463
  *
3439
3464
  * @example // Passing a string
3440
3465
  *
@@ -3641,13 +3666,6 @@ export namespace clpp {
3641
3666
  * });
3642
3667
  */
3643
3668
  setDrmCustomDataModifier(modifier: Function): void;
3644
- /**
3645
- * On the Tizen platform the `http://tizen.org/privilege/tv.audio` privilege
3646
- * is required.
3647
- *
3648
- * @param muted The muted state
3649
- */
3650
- setMuted(muted: boolean): void;
3651
3669
  /**
3652
3670
  * Set the network engine.
3653
3671
  *
@@ -3934,7 +3952,7 @@ export namespace clpp {
3934
3952
  id: string;
3935
3953
  /**
3936
3954
  * The track kind.
3937
- * This can be for instance be 'captions' or 'subtitles'.
3955
+ * This can be for instance be 'captions', 'subtitles' or 'forced`.
3938
3956
  */
3939
3957
  kind: string|null;
3940
3958
  /**
@@ -3975,6 +3993,16 @@ export namespace clpp {
3975
3993
  * This is usually set for side-loaded remote text tracks.
3976
3994
  */
3977
3995
  src: string|null;
3996
+ /**
3997
+ * True indicates that this track is intended for trick mode playback.
3998
+ * Note that tracks marked as trick play are completely ignored by ABR,
3999
+ * meaning their renditions are not considered for automatic selection when
4000
+ * the normal track associated with this trick play track is active. It is
4001
+ * also not possible to enable ABR when the currently active track is a
4002
+ * trick play track. You can only manually select a desired trick play
4003
+ * tracks and its renditions using methods from {@link clpp.TrackManager}.
4004
+ */
4005
+ trickPlay: boolean;
3978
4006
  /**
3979
4007
  * The track type.
3980
4008
  */
@@ -4527,7 +4555,7 @@ export namespace clpp {
4527
4555
  */
4528
4556
  CONTENT_UNSUPPORTED_BY_BROWSER = 4032,
4529
4557
  /**
4530
- * Microsoft smooth streaming invalid manifest XML
4558
+ * Microsoft smooth streaming invalid manifest XML.
4531
4559
  * The {@link clpp.Error#data} property contains an object with the following
4532
4560
  * properties:
4533
4561
  *
@@ -4554,7 +4582,7 @@ export namespace clpp {
4554
4582
  */
4555
4583
  SMOOTH_MEDIA_PROCESSING_ERROR = 4035,
4556
4584
  /**
4557
- * The smooth streaming manifest version is invalid
4585
+ * The smooth streaming manifest version is invalid.
4558
4586
  * The {@link clpp.Error#data} property contains an object with the following
4559
4587
  * properties:
4560
4588
  *
@@ -4818,16 +4846,16 @@ export namespace clpp {
4818
4846
  */
4819
4847
  INVALID_CONTAINER_ELEMENT = 7006,
4820
4848
  /**
4821
- * The provided {@link clpp.PlayerConfiguration} is invalid
4849
+ * The provided {@link clpp.PlayerConfiguration} is invalid.
4822
4850
  */
4823
4851
  INVALID_CONFIGURATION = 7100,
4824
4852
  /**
4825
4853
  * The provided {@link clpp.PlayerConfiguration#license} does not exist
4826
- * or is invalid
4854
+ * or is invalid.
4827
4855
  */
4828
4856
  INVALID_LICENSE = 7101,
4829
4857
  /**
4830
- * No DOM element or element ID was provided when initializing the player
4858
+ * No DOM element or element ID was provided when initializing the player.
4831
4859
  */
4832
4860
  NO_ELEMENT = 7102,
4833
4861
  /**
@@ -4906,7 +4934,7 @@ export namespace clpp {
4906
4934
  */
4907
4935
  GL_CONTEXT_ERROR = 9003,
4908
4936
  /**
4909
- * Error code that indicates that the player not able to compile a shader
4937
+ * Error code that indicates that the player not able to compile a shader.
4910
4938
  */
4911
4939
  GL_SHADER_ERROR = 9004,
4912
4940
  /**
@@ -4962,7 +4990,7 @@ export namespace clpp {
4962
4990
  */
4963
4991
  AD_ERROR = 10003,
4964
4992
  /**
4965
- * Triggered when no container could be found to add a SIMID creative
4993
+ * Triggered when no container could be found to add a SIMID creative.
4966
4994
  */
4967
4995
  SIMID_CONTAINER_MISSING = 10100,
4968
4996
  /**
@@ -6214,9 +6242,8 @@ export namespace clpp {
6214
6242
  */
6215
6243
  append(cues: Array<clpp.text.Cue>, styles: Array<string>): void;
6216
6244
  /**
6217
- * Request that this object be destroyed, releasing all resources.
6218
- * It also shuts down all active operations.
6219
- * Returns a Promise which is resolved when destruction
6245
+ * Request that this object be destroyed, releasing all resources and shutting
6246
+ * down all operations. Returns a Promise which is resolved when destruction
6220
6247
  * is complete. This Promise should never be rejected.
6221
6248
  */
6222
6249
  destroy(): Promise<void>;
@@ -6452,9 +6479,8 @@ export namespace clpp {
6452
6479
  */
6453
6480
  constructor(options: clpp.interstitial.Options);
6454
6481
  /**
6455
- * Request that this object be destroyed, releasing all resources.
6456
- * It also shuts down all active operations.
6457
- * Returns a Promise which is resolved when destruction
6482
+ * Request that this object be destroyed, releasing all resources and shutting
6483
+ * down all operations. Returns a Promise which is resolved when destruction
6458
6484
  * is complete. This Promise should never be rejected.
6459
6485
  */
6460
6486
  destroy(): Promise<void>;
@@ -6686,6 +6712,15 @@ export namespace clpp {
6686
6712
  namespace muxdata {
6687
6713
  export class MuxDataPlugin {
6688
6714
  static Id: string;
6715
+ /**
6716
+ * Emit a custom event.
6717
+ * This method can be used to send supplementary events to Mux, in addition to
6718
+ * the mandatory playback events.
6719
+ *
6720
+ * @param eventType event name
6721
+ * @param data data to send along with the event
6722
+ */
6723
+ emit(eventType: string, data: Record<string, any>): void;
6689
6724
  }
6690
6725
  }
6691
6726
 
@@ -7381,6 +7416,15 @@ export namespace clpp {
7381
7416
  * for video elements created by this playlist.
7382
7417
  */
7383
7418
  anchorId: string;
7419
+ /**
7420
+ * If true, when one item finishes playback the next item is played
7421
+ * automatically and so on until the end of the playlist.
7422
+ */
7423
+ autoplayNext?: boolean;
7424
+ /**
7425
+ * Default configuration for player instances.
7426
+ */
7427
+ config: clpp.PlayerConfiguration;
7384
7428
  /**
7385
7429
  * If true, preloaded items will have also their media segments preloaded
7386
7430
  * thus reducing the time to start playback to minimum. This option is
@@ -7441,9 +7485,8 @@ export namespace clpp {
7441
7485
  */
7442
7486
  constructor(options: clpp.plist.Options);
7443
7487
  /**
7444
- * Request that this object be destroyed, releasing all resources.
7445
- * It also shuts down all active operations.
7446
- * Returns a Promise which is resolved when destruction
7488
+ * Request that this object be destroyed, releasing all resources and shutting
7489
+ * down all operations. Returns a Promise which is resolved when destruction
7447
7490
  * is complete. This Promise should never be rejected.
7448
7491
  */
7449
7492
  destroy(): Promise<void>;