@castlabs/prestoplay 6.27.0 → 6.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +113 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +625 -624
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -89
- package/cjs/cl.externs.js +80 -72
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +78 -79
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -24
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +347 -347
- package/cjs/cl.muxdata.js +14 -15
- package/cjs/cl.onboard.js +4 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -38
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -5
- package/cl.cast.js +91 -90
- package/cl.conviva.js +27 -27
- package/cl.core.js +503 -499
- package/cl.crypto.js +8 -8
- package/cl.dash.js +83 -82
- package/cl.externs.js +80 -72
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +80 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +2 -3
- package/cl.mse.js +304 -305
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -29
- package/package.json +1 -1
- package/typings.d.ts +34 -65
- package/cjs/cl.sessions.js +0 -21
- package/cl.sessions.js +0 -10
package/cl.vr.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
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},
|
|
3
|
-
new
|
|
4
|
-
a.a.getShaderInfoLog(b));return b},
|
|
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 _.
|
|
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
|
|
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
|
|
8
|
-
if(void 0!==d&&_.
|
|
9
|
-
|
|
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&&(
|
|
11
|
-
var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new
|
|
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.
|
|
13
|
-
0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ha(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===
|
|
14
|
-
this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===
|
|
15
|
-
_.x("clpp.vr.VrPlugin"
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hw="touchmove",Iw="touchstart",Kw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Jw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Lw=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)},Mw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Nw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Ow=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},Pw=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},Rw=function(a){var b=new Qw(0,0,0),c=new Qw(0,0,1);const d=new Qw,e=new Qw,f=new Qw;a=a.a;var g=
|
|
3
|
+
new Qw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Mw(f,1/g);c=Ow(d,c,f);g=c.length();Mw(c,1/g);Ow(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Nw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Nw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Nw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Sw=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},Tw=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Hw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Uw=function(a){const b=Kw(1,0,a.l*Math.PI/180);Lw(Kw(0,1,a.j*Math.PI/180),a.P);Lw(b,a.R);Rw(a.ba);Pw(a.da,a.P,a.ba);Pw(a.G,a.R,a.da)},Jw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Qw=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 Vw=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,p,u,v,y){const A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=p;A[7]=u;A[11]=v;A[15]=y;return this}};var Ww=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Sw(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=Sw(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
|
|
5
|
+
a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var Xw=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 Yw=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 Zw={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},$w=class extends _.Iv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Y=this.G=this.f=this.a=this.m=null;this.g=new _.S("clpp.vr");this.H=70;this.V=1;this.M=this.L=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
|
|
7
|
+
b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.h={x:0,y:0};this.P=new Vw;this.R=new Vw;this.ba=new Vw;this.da=new Vw;this.A=this.ia.bind(this);this.B=this.ya.bind(this);this.J=this.ha.bind(this)}onPlayerCreated(a){this.g.info("Player created");this.m=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
|
|
8
|
+
if(void 0!==d&&_.jh(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.jh(e)&&0<e)this.V=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.L=!!f;this.M=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.t){this.g.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Zw)||this.a.getContext("experimental-webgl",
|
|
9
|
+
Zw);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new Vw;Rw(this.G);this.Y=new Xw(this.f);this.C=new Ww(this.f);this.I=new Vw;this.K=new Vw;this.o=this.w=null;this.a.addEventListener(_.zf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Iw,this.J,!1));this.F();this.T()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.g.info("Releasing VR plugin resources");
|
|
10
|
+
this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Tw(this),this.a.removeEventListener(_.zf,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.w(function*(){a.m=null})}id(){return"vr"}T(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.T.bind(this));
|
|
11
|
+
var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Yw(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=Pw(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
|
|
12
|
+
c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d}b.uniformMatrix4fv(this.C.h,!1,this.I.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.Y;a.a.bindBuffer(a.a.ARRAY_BUFFER,a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,
|
|
13
|
+
0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ha(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Iw)a.type===Iw?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(Hw,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===Hw&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.V;const {jh:e,kh:f}={jh:a*b*(this.L?-1:1),kh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;Uw(this)}ya(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Tw(this)}bi(a,b){this.l=b;this.j=a;Uw(this)}Eh(){return{x:this.j,y:this.l}}Ci(a){this.H=a;this.F()}};
|
|
15
|
+
_.x("clpp.vr.VrPlugin",$w);$w.prototype.setCameraFieldOfView=$w.prototype.Ci;$w.prototype.getCameraCoordinates=$w.prototype.Eh;$w.prototype.moveCamera=$w.prototype.bi;$w.Id="vr";_.Ln(new class{create(){return new $w}});};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
|
|
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},
|
|
3
|
-
c+60*b+3600*(Number(a[1])||0)},
|
|
4
|
-
_.
|
|
5
|
-
b," The region will be ignored."),null)},
|
|
6
|
-
"WEBVTT\n\n";for(const c of a)b+=
|
|
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 _.
|
|
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,
|
|
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 _.
|
|
10
|
-
new _.
|
|
11
|
-
_.
|
|
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(_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ow=" The setting will be ignored.",pw="VTT parser encountered an invalid VTT setting: ",qw="application/x-subrip",rw="text/srt",sw='text/vtt; codecs\x3d"vtt"',tw='text/vtt; codecs\x3d"wvtt"',uw=function(a){return a.a===a.f.length?null:(a=_.er(a,/[^ \t\n]*/gm))?a[0]:null},vw=function(a){_.er(a,/[ \t]+/gm)},ww=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},xw=function(a){a=_.er(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)},zw=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.eu:a.textAlign=_.ku[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.vg:_.wg;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===_.le||b===_.Of?_.le:b===_.me||b===_.Ud?
|
|
4
|
+
_.me:_.Vc);else if(d=/^region:(.*)$/.exec(b)){if(b=yw(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=_.lu[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.gu,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.lu[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},yw=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)},Bw=function(a,b,c){let d,e,f;(new _.dp).N("payl",_.Zo(g=>{d=_.oi(g)})).N("iden",_.Zo(g=>{e=_.oi(g)})).N("sttg",_.Zo(g=>{f=_.oi(g)})).parse(a);return d?Aw(d,e,f,b,c):null},Aw=function(a,b,c,d,e){a=new _.ju(d,e,a,_.Dg);b&&(a.id=b);if(c)for(b=new _.fr(c),c=uw(b);c;)zw(a,c,[])||_.B(pw,c,ow),vw(b),c=uw(b);return a},Cw=class{a(a){a=_.oi(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+=ww(c)}return _.si(b)}},Dw=class{create(){return new Cw}probe(a,b){return(a===rw||a===qw)&&b===_.Yf}};var Ew=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.oi(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.H(_.C,2,2E3);a=b.periodStart;if(c[0].includes("X-TIMESTAMP-MAP")){var d=c[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),e=c[0].match(/MPEGTS:(\d+)/m);if(d&&e){a=xw(new _.fr(d[1]));if(null==a)throw new _.H(_.C,2,2E3);e=Number(e[1]);for(d=b.segmentStart;95443.7176888889<=d;)d-=95443.7176888889,e+=
|
|
7
|
+
8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.fr(f.replace(/\n/g," "));d=new _.ou;uw(e);vw(e);for(var g=uw(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,ow);vw(e);g=uw(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 _.fr(l[0]);g=xw(d);const p=_.er(d,/[ \t]+--\x3e[ \t]+/g);k=xw(d);if(null==g||null==p||null==k)throw new _.H(_.C,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.ju(g,k,l,_.Dg);e&&(g.id=e);vw(d);for(k=uw(d);k;)zw(g,k,c)||_.B(pw,k,ow),vw(d),k=uw(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Fw=class extends Ew{parseMedia(a,b){return super.parseMedia((new Cw).a(a),b)}};var Gw=class{constructor(){this.a=null;this.g=new _.S("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.dp).N(_.Ce,_.Xo).N(_.gg,_.Xo).N(_.xe,_.Xo).ea("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.M(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.M(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.Be,_.Xo).N(_.Rf,_.Xo).ea(_.Tf,_.Yo).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.H(_.C,2,2008);if(!b)throw new _.H(_.C,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
|
|
10
|
+
new _.H(_.C,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.dp).N("moof",_.Xo).N("traf",_.Xo).ea("tfdt",p=>{g=!0;c=0===p.version?_.M(p.reader):_.So(p.reader)}).ea("tfhd",p=>{var u=p.flags;p=p.reader;p.skip(4);u&1&&p.skip(8);u&2&&p.skip(4);l=u&8?_.M(p):null}).ea("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.M(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,lf:null};v&256&&(E.duration=_.M(p));v&512&&(E.sampleSize=
|
|
11
|
+
_.M(p));v&1024&&p.skip(4);v&2048&&(E.lf=0===u?_.M(p):_.Ro(p));A.push(E)}d=A}}).N(_.we,_.Zo(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.H(_.C,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Wp(m,!1);for(const p of d){const u=p.duration||l,v=p.lf?c+p.lf:a;a=v+(u||0);let y=0;do{const A=_.M(m);y+=A;var n=_.M(m);n=_.Wo(n);let D=null;"vttc"===n?8<A&&(D=_.Uo(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(Bw(D,b.periodStart+v/this.a,
|
|
12
|
+
b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(p.sampleSize&&y<p.sampleSize)}return{cues:f.filter(_.Fm),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.rv{constructor(){super();this.a=new Dw}install(){_.nt(_.Yf,Ew);_.nt(sw,Ew);_.nt(tw,Ew);_.nt(_.yc,Gw);_.nt(rw,Fw);_.nt(qw,Fw);_.Er.push(this.a)}uninstall(){_.pt(_.Yf);_.pt(sw);_.pt(tw);_.pt(_.yc);_.pt(rw);_.pt(qw);_.Gr(this.a)}id(){return"subtitles-vtt"}});};f.call(g, window);
|
package/cl.yospace.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jw="clpp.yospace.YospacePlugin",mw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(jw)}
|
|
2
|
-
break a;case lw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.
|
|
3
|
-
const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jw="clpp.yospace.YospacePlugin",mw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(jw)}dg(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Ge)throw new _.H(_.C,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||kw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case kw:d=YospaceAdManagement.SessionVOD.create(e);
|
|
2
|
+
break a;case lw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.H(_.C,9,7003,"Yospace session failed to initialize.");a.trigger(new _.G(_.Qg,{detail:d}));b.url=d.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=d}})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
|
|
3
|
+
const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.G(_.Pg,{detail:b}))}}id(){return"yospace"}};_.x(jw,mw);mw.prototype.getSession=mw.prototype.dg;mw.Id="yospace";var nw=class{create(){return new mw}},kw=_.Db,lw="LIVE";_.x("clpp.yospace.StreamType",{VOD:kw,LIVE:lw,DVR:"DVR"});_.Ln(new nw);};f.call(g, window);
|
package/cl.youbora.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jv="Unhandled state",Kv="accountCode key is missing in Youbora config",Lv="ad break start",Mv="ad buffering ended",Nv="ad buffering started",Ov="ad click through url: ",Pv="ad timeline changed",Qv="clpp.npaw.NpawPlugin",Rv="clpp.npaw.YouboraPlugin",Sv="content.isLive",Tv="content.title",Uv="is container visible",Vv="youbora",Wv=function(a){return a.startsWith(_.ud)?"Widevine":a.startsWith(_.qd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.
|
|
2
|
-
"ClearKey":a.startsWith(_.pd)?"Primetime":a},
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return b}
|
|
22
|
-
|
|
23
|
-
b
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
a.youbora;void 0===c[Sv]&&(c[Sv]=b.isLive);void 0===c[Tv]&&(c[Tv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jv="Unhandled state",Kv="accountCode key is missing in Youbora config",Lv="ad break start",Mv="ad buffering ended",Nv="ad buffering started",Ov="ad click through url: ",Pv="ad timeline changed",Qv="clpp.npaw.NpawPlugin",Rv="clpp.npaw.YouboraPlugin",Sv="content.isLive",Tv="content.title",Uv="is container visible",Vv="youbora",Wv=function(a){return a.startsWith(_.ud)?"Widevine":a.startsWith(_.qd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Pe)?
|
|
2
|
+
"ClearKey":a.startsWith(_.pd)?"Primetime":a},Yv=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Gt;this.g=new _.S("clpp.npaw.YouboraAdapter");this.h=this.o=!1;this.registerListeners()}getPlayhead(){return this.getIsLive()?-1:this.m.getPosition()}getDuration(){return this.m.getDuration()}getRendition(){let c,d,e;var f=this.m.getTrackManager();f&&(f=f.qa())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.j(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);
|
|
3
|
+
return youbora.Util.buildRenditionString(c,d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ea())?c.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"6.28.0-castlabsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&
|
|
4
|
+
this.a&&(this.g.debug("registering listeners"),youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Pf,this.I.bind(this)),this.a.on(this.m,_.Wd,this.F.bind(this)),this.a.on(this.m,_.sg,this.H.bind(this)),this.a.on(this.m,_.rg,this.G.bind(this)),this.a.on(this.m,_.oc,this.B.bind(this)),this.a.on(this.m,_.Qc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.xb);_.Wh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.hs()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;
|
|
5
|
+
this.l("state change",c);if(c)switch(c.currentState){case 1:this.w()&&this.f();break;case 3:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case 4:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.ts: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(Jv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=
|
|
6
|
+
this.m.getDrmInfo();c&&(c=Wv(c.keySystem))&&this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=Xv(c,this.m,this.g,this))&&c.severity===_.C&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Hf),this.f(),this.fireSeekBegin())}G(){this.l(_.Gf);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Gb()}C(c){this.g.debug("Casting",c);this.fireCasted()}l(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,
|
|
7
|
+
...d)}}return new b(a)},Zv=function(a){class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Gt;this.g=new _.S("clpp.npaw.YouboraAdsAdapter");this.registerListeners();this.l=!1}getDuration(){return this.a&&this.a.getDuration()}getRendition(){let c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.cb(),this.a.bb(),this.a.Na()));return c}getBitrate(){return this.a&&this.a.Na()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&
|
|
8
|
+
this.a.getMediaUrl()}getTitle(){return this.a&&this.a.getTitle()}getProvider(){return this.a&&this.a.getAdvertiserName()}getCreativeId(){return this.a&&this.a.getCreativeId()}getPosition(){const c=youbora.Constants.AdPosition;let d=null;if(this.a)switch(this.a.Oa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.m.getAdsManager();return c&&0<
|
|
9
|
+
c.getVolume()}getExpectedBreaks(){return this.j&&this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.eb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.m.getDuration():c)}getIsFullscreen(){return this.m.getSurface().isFullscreen()}getIsVisible(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.g.debug(Uv,c);return c}getPlayerName(){return _.ra}getVersion(){return"6.28.0-castlabsadsadapter-js"}getPlayerVersion(){return _.ea}registerListeners(){this.m&&
|
|
10
|
+
this.f&&(this.f.on(this.m,_.oc,this.M.bind(this)),this.f.on(this.m,_.kc,this.L.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,_.Vb,this.G.bind(this)),this.f.on(this.m,_.Wb,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,_.Ub,this.F.bind(this)),this.f.on(this.m,_.jc,this.K.bind(this)),this.f.on(this.m,_.Wd,this.H.bind(this)),this.f.on(this.m,_.Rb,this.A.bind(this)),
|
|
11
|
+
this.f.on(this.m,_.Sb,this.B.bind(this)),this.f.on(this.m,_.Tb,this.C.bind(this)),this.f.on(this.m,_.hc,this.w.bind(this)))}unregisterListeners(){_.Wh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(Pv,c);this.j=c.adsTimeline}L(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.h("ad ended");this.fireStop()}I(){this.h("ad pause");this.w();this.firePause()}J(){this.h("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.h(Nv);this.fireBufferBegin()}w(){this.l&&
|
|
12
|
+
(this.h(Mv),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.ob();this.g.debug(Ov,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(Lv,this.a);this.fireBreakStart()}B(){this.h("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&Xv(c,this.m,this.g,this)}h(c,
|
|
13
|
+
...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)},aw=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.qa())&&(b=e.width,c=e.height,d=e.bandwidth);b&&c&&d||(e=this.j(),b=b||e.width,c=c||e.height,d=d||e.streamBandwidth);
|
|
14
|
+
return this.getNpawUtils().buildRenditionString(b,c,d)}getIsLive(){return this.player.isLive()}getResource(){const b=this.player.getLoadedSource();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.getPlaybackRate()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Ea())?b.frameRate:null}getPlayerName(){return _.ra}getVersion(){return"castlabs-adapter-6.28.0-js"}getPlayerVersion(){return _.ea}registerListeners(){const b=
|
|
15
|
+
this.w();this.player&&b&&(b.on(this.player,_.Pf,this.K.bind(this)),b.on(this.player,_.Wd,this.H.bind(this)),b.on(this.player,_.Hf,this.J.bind(this)),b.on(this.player,_.Gf,this.I.bind(this)),b.on(this.player,_.oc,this.F.bind(this)),b.on(this.player,_.Qc,this.G.bind(this)),b.on(this.player,_.Ic,this.L.bind(this)),b.on(this.player,_.$f,this.M.bind(this)))}unregisterListeners(){$v.debug(_.xb);_.Wh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||
|
|
16
|
+
_.hs()}o(){return!!this.player.getConfiguration().autoplay}K(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case 1:this.plugin.setVideoOptions({"content.subtitles":this.C()});this.o()&&this.fireStart();break;case 3:this.fireStart();this.A();this.fireResume();this.fireBufferEnd();break;case 4:this.o()&&this.fireStart();this.A();this.fireBufferEnd();this.firePause();break;case _.ts:this.fireBufferEnd();this.fireStop();break;case 5:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?
|
|
17
|
+
this.firePause():this.fireStop();break;case 2:this.fireBufferBegin();break;default:$v.debug(Jv,b)}}A(){this.fireJoin()}H(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=Xv(b,this.player,$v,this))&&b.severity===_.C&&(this.f=!0)}J(){this.player.isEnded()||(this.l(_.Hf),this.fireSeekBegin())}B(b){const c=this.player.getTrackManager();if(!c)return null;let d=null;b===_.Xf&&(d=c.ta());b===_.q&&(d=c.oa());return d?d.language:null}L(){const b=this.B(_.q);this.plugin.setVideoOptions({"content.language":b})}M(){const b=
|
|
18
|
+
this.B(_.Xf),c=this.C();this.plugin.setVideoOptions({"content.subtitles":b||c})}w(){this.a||(this.a=new _.Gt);return this.a}I(){this.l(_.Gf);this.fireSeekEnd()}F(b){$v.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Gb()}G(b){$v.debug("Casting",b);this.fireCasted()}l(b,...c){$v.debug(`Reporting "${b}" event to NPAW`,...c)}C(){const b=this.player.getConfiguration();return b.youbora&&b.youbora.disabledSubtitlesLabel?b.youbora.disabledSubtitlesLabel:"off"}}return a},cw=function(){class a extends NpawPluginAdapters.ads.Ima{constructor(){super();
|
|
19
|
+
this.j=this.h=this.l=this.a=null;this.o=!1}getDuration(){return this.a?this.a.getDuration():null}getRendition(){let b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.cb(),this.a.bb(),this.a.Na()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Na());return b}getPlayhead(){let b=null;const c=this.player.getAdsManager();c&&(b=c.getPosition());return b}getResource(){let b=null;this.a&&(b=this.a.getMediaUrl());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.Oa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}bw.debug("Ad position",c);return c}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const b=this.player.getAdsManager();
|
|
21
|
+
return b&&0<b.getVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.eb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.h&&this.h.getCuePoints().map(b=>-1===b?this.player.getDuration():b)}getIsFullscreen(){return this.player.getSurface().isFullscreen()}getIsVisible(){var b=this.player.getSurface().getContainer();b=this.getNpawUtils().calculateAdViewability(b);bw.debug(Uv,
|
|
22
|
+
b);return b}getPlayerName(){return _.ra}getVersion(){return"castlabs-ads-adapter-6.28.0-js"}getPlayerVersion(){return _.ea}B(){this.j||(this.j=new _.Gt);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,_.gc,this.K.bind(this)),b.on(this.player,_.ic,this.L.bind(this)),b.on(this.player,_.Vb,this.I.bind(this)),b.on(this.player,_.Wb,this.w.bind(this,1)),b.on(this.player,_.fc,this.w.bind(this,
|
|
23
|
+
2)),b.on(this.player,_.mc,this.w.bind(this,3)),b.on(this.player,_.Ub,this.H.bind(this)),b.on(this.player,_.jc,this.M.bind(this)),b.on(this.player,_.Wd,this.J.bind(this)),b.on(this.player,_.Rb,this.C.bind(this)),b.on(this.player,_.Sb,this.F.bind(this)),b.on(this.player,_.Tb,this.G.bind(this)),b.on(this.player,_.hc,this.T.bind(this)))}unregisterListeners(){_.Wh(this.B())}R(b){bw.debug(Pv,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(Nv);this.fireBufferBegin()}T(){this.l=this.getPlayhead();this.A()}A(){this.o&&(this.f(Mv),this.o=!1,this.fireBufferEnd())}w(b){this.f("ad quartile",b);this.fireQuartile(b)}H(){this.f("ad clicked");const b=this.a&&this.a.ob();bw.debug(Ov,b);this.fireClick(b)}M(){this.f("ad skipped");this.fireSkip()}C(b){this.a=b.ad;this.f(Lv,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&&Xv(b,this.player,bw,this)}f(b,...c){bw.debug(`Reporting "${b}" event to NPAW`,...c)}}return a},dw=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},ew=function(a,b){if(b.namespace()===_.fd)return a.g.info("NPAW does not report when casting."),!1;const c=b.getConfiguration().youbora;
|
|
26
|
+
return _.hh(c)?c.accountCode?_.z(window.NpawPlugin)||_.z(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.H(1,9,9100)),!1):!0:(a.g.warn(Kv),b.onError(new _.H(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),!1)},fw=function(a,b){if(b.namespace()===_.fd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.hh(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),
|
|
27
|
+
!1;if(!c.accountCode)return a.g.warn(Kv),b.onError(new _.H(1,9,9101)),!1;if(_.z(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.H(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.H(1,9,9102)));return!0},gw=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,
|
|
28
|
+
message:b.message,severity:b.severity}),Xv=(a,b,c,d)=>{b=gw(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.Wd;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 $v=new _.S("clpp.npaw.NpawAdapter");var bw=new _.S("clpp.npaw.NpawAdsAdapter");var hw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(Qv);this.m=null}ff(a){dw(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,aw()),this.a.registerAdsAdapterFromClass(this.m,cw())}Ih(){return this.a}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;ew(this,a)&&(a=a.getConfiguration().youbora,this.ff(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(ew(this,a)){a=a.getConfiguration();
|
|
29
|
+
var c=a.youbora;void 0===c[Sv]&&(c[Sv]=b.isLive);void 0===c[Tv]&&(c[Tv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.ff(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onContentLoaded(a){const b={};(a=a.getDrmInfo())&&(a=Wv(a.keySystem))&&(b["content.drm"]=a);this.g.info(_.Ie,b);this.a.setAnalyticsOptions(b)}onPlayerWillRelease(){}onPlayerWillDestroy(){dw(this);this.a.destroy()}id(){return Vv}};_.x(Qv,hw);hw.prototype.getAdsAdapter=hw.prototype.getAdsAdapter;
|
|
30
|
+
hw.prototype.getAdapter=hw.prototype.getAdapter;hw.prototype.getNpawPlugin=hw.prototype.Ih;hw.prototype.setNpawPlugin=hw.prototype.ff;hw.Id=Vv;new _.S(Qv);var iw=class extends _.Iv{constructor(){super();this.a=null;this.g=new _.S(Rv);this.m=null}gf(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Yv(this.m)),this.a.setAdsAdapter(Zv(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;fw(this,a)&&(a=a.getConfiguration().youbora,this.gf(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(fw(this,a)){a=a.getConfiguration();var c=
|
|
31
|
+
a.youbora;void 0===c[Sv]&&(c[Sv]=b.isLive);void 0===c[Tv]&&(c[Tv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.gf(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return Vv}};_.x(Rv,iw);iw.prototype.getAdsAdapter=iw.prototype.getAdsAdapter;iw.prototype.getAdapter=iw.prototype.getAdapter;iw.prototype.setYouboraPlugin=iw.prototype.gf;iw.Id=Vv;_.Ln(new class{create(a){return a.youbora&&a.youbora.v7?new hw:new iw}});};f.call(g, window);
|
package/package.json
CHANGED
package/typings.d.ts
CHANGED
|
@@ -304,6 +304,20 @@ export namespace clpp {
|
|
|
304
304
|
uuid: string;
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Chromecast configuration.
|
|
309
|
+
*/
|
|
310
|
+
export type ChromecastConfiguration = {
|
|
311
|
+
/**
|
|
312
|
+
* Enable to pass on current sender {@link clpp.AbrConfiguration} to receiver.
|
|
313
|
+
*/
|
|
314
|
+
useSenderAbrConfig?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Enable to pass on current sender {@link clpp.StreamingConfiguration} to reciver.
|
|
317
|
+
*/
|
|
318
|
+
useSenderStreamingConfig?: boolean;
|
|
319
|
+
}
|
|
320
|
+
|
|
307
321
|
/**
|
|
308
322
|
* Common Media Client Data (CMCD) configuration.
|
|
309
323
|
*/
|
|
@@ -1141,6 +1155,10 @@ export namespace clpp {
|
|
|
1141
1155
|
* The Playready path. Default is 'playready'.
|
|
1142
1156
|
*/
|
|
1143
1157
|
playreadyUrl: string;
|
|
1158
|
+
/**
|
|
1159
|
+
* Widevine server certificate.
|
|
1160
|
+
*/
|
|
1161
|
+
serverCertificate?: string|Uint8Array|null;
|
|
1144
1162
|
/**
|
|
1145
1163
|
* The Widevine path. Default is 'widevine'.
|
|
1146
1164
|
*/
|
|
@@ -1270,6 +1288,10 @@ export namespace clpp {
|
|
|
1270
1288
|
* Broadpeak plugin configuration.
|
|
1271
1289
|
*/
|
|
1272
1290
|
broadpeak?: Partial<clpp.BroadpeakConfiguration>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Chromecast configuration.
|
|
1293
|
+
*/
|
|
1294
|
+
chromecast?: Partial<clpp.ChromecastConfiguration>;
|
|
1273
1295
|
/**
|
|
1274
1296
|
* Connectivity check configuration is used to determine network connection.
|
|
1275
1297
|
* If not configured, connectivity check will be disabled.
|
|
@@ -1460,10 +1482,6 @@ export namespace clpp {
|
|
|
1460
1482
|
* Safari-related configuration.
|
|
1461
1483
|
*/
|
|
1462
1484
|
safari?: Partial<clpp.SafariConfiguration>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Sessions plugin configuration.
|
|
1465
|
-
*/
|
|
1466
|
-
sessions?: Partial<clpp.SessionsConfiguration>;
|
|
1467
1485
|
/**
|
|
1468
1486
|
* SIMID plugin configuration.
|
|
1469
1487
|
*/
|
|
@@ -1883,16 +1901,6 @@ export namespace clpp {
|
|
|
1883
1901
|
ldlDelay: number;
|
|
1884
1902
|
}
|
|
1885
1903
|
|
|
1886
|
-
/**
|
|
1887
|
-
* Configuration section for PRESTOplay Sessions.
|
|
1888
|
-
*/
|
|
1889
|
-
export type SessionsConfiguration = {
|
|
1890
|
-
/**
|
|
1891
|
-
* The event injection API URL.
|
|
1892
|
-
*/
|
|
1893
|
-
apiUrl: string;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
1904
|
/**
|
|
1897
1905
|
* Configuration container for SIMID
|
|
1898
1906
|
*/
|
|
@@ -3235,8 +3243,7 @@ export namespace clpp {
|
|
|
3235
3243
|
*/
|
|
3236
3244
|
TRACKS_ADDED = "tracksadded",
|
|
3237
3245
|
/**
|
|
3238
|
-
* Triggered when the
|
|
3239
|
-
* player started to loaded the sources
|
|
3246
|
+
* Triggered when the player started to load the source.
|
|
3240
3247
|
*/
|
|
3241
3248
|
LOAD_START = "loadstart",
|
|
3242
3249
|
/**
|
|
@@ -4603,12 +4610,6 @@ export namespace clpp {
|
|
|
4603
4610
|
* following properties:
|
|
4604
4611
|
*/
|
|
4605
4612
|
MALFORMED_DATA_URI = 1004,
|
|
4606
|
-
/**
|
|
4607
|
-
* A network request was made with a data URI using an unknown encoding.
|
|
4608
|
-
* The {@link clpp.Error#data|data} property contains an object with the
|
|
4609
|
-
* following properties:
|
|
4610
|
-
*/
|
|
4611
|
-
UNKNOWN_DATA_URI_ENCODING = 1005,
|
|
4612
4613
|
/**
|
|
4613
4614
|
* A request modifier threw an error. The {@link clpp.Error#cause|cause}
|
|
4614
4615
|
* contains the original error.
|
|
@@ -4624,16 +4625,6 @@ export namespace clpp {
|
|
|
4624
4625
|
* This error is only used by unit and integration tests.
|
|
4625
4626
|
*/
|
|
4626
4627
|
MALFORMED_TEST_URI = 1008,
|
|
4627
|
-
/**
|
|
4628
|
-
* An unexpected network request was made to the FakeNetworkingEngine.
|
|
4629
|
-
* This error is only used by unit and integration tests.
|
|
4630
|
-
*/
|
|
4631
|
-
UNEXPECTED_TEST_REQUEST = 1009,
|
|
4632
|
-
/**
|
|
4633
|
-
* The number of retry attempts have run out.
|
|
4634
|
-
* This is an internal error and shouldn't be propagated.
|
|
4635
|
-
*/
|
|
4636
|
-
ATTEMPTS_EXHAUSTED = 1010,
|
|
4637
4628
|
/**
|
|
4638
4629
|
* A network request was made with a malformed URL.
|
|
4639
4630
|
* The {@link clpp.Error#data|data} property contains an object with the
|
|
@@ -4648,15 +4639,6 @@ export namespace clpp {
|
|
|
4648
4639
|
* The text parser failed to parse a text stream due to an invalid cue.
|
|
4649
4640
|
*/
|
|
4650
4641
|
INVALID_TEXT_CUE = 2001,
|
|
4651
|
-
/**
|
|
4652
|
-
* Was unable to detect the encoding of the response text. Suggest adding
|
|
4653
|
-
* byte-order-markings to the response data.
|
|
4654
|
-
*/
|
|
4655
|
-
UNABLE_TO_DETECT_ENCODING = 2003,
|
|
4656
|
-
/**
|
|
4657
|
-
* The response data contains invalid Unicode character encoding.
|
|
4658
|
-
*/
|
|
4659
|
-
BAD_ENCODING = 2004,
|
|
4660
4642
|
/**
|
|
4661
4643
|
* The XML parser failed to parse an xml stream, or the XML lacks mandatory
|
|
4662
4644
|
* elements for TTML.
|
|
@@ -4672,13 +4654,6 @@ export namespace clpp {
|
|
|
4672
4654
|
* MP4 segment does not contain VTT.
|
|
4673
4655
|
*/
|
|
4674
4656
|
INVALID_MP4_VTT = 2008,
|
|
4675
|
-
/**
|
|
4676
|
-
* When examining media in advance, we were unable to extract the cue time.
|
|
4677
|
-
* This should only be possible with HLS, where we do not have explicit
|
|
4678
|
-
* segment start times. The {@link clpp.Error#cause|cause}
|
|
4679
|
-
* is the underlying exception or Error object.
|
|
4680
|
-
*/
|
|
4681
|
-
UNABLE_TO_EXTRACT_CUE_START_TIME = 2009,
|
|
4682
4657
|
/**
|
|
4683
4658
|
* An error occurred while fetching or appending a text stream.
|
|
4684
4659
|
* The {@link clpp.Error#data|data} is the underlying exception
|
|
@@ -4821,19 +4796,11 @@ export namespace clpp {
|
|
|
4821
4796
|
* must be one of {@link clpp.Track.Type}.
|
|
4822
4797
|
*/
|
|
4823
4798
|
INVALID_TRACK_TYPE = 3101,
|
|
4824
|
-
/**
|
|
4825
|
-
* An error raised when the requested track is unknown.
|
|
4826
|
-
*/
|
|
4827
|
-
UNKNOWN_TRACK = 3102,
|
|
4828
4799
|
/**
|
|
4829
4800
|
* A media segment could not be decrypted. This can happen e.g for
|
|
4830
4801
|
* HLS + AES-128 content.
|
|
4831
4802
|
*/
|
|
4832
4803
|
MEDIA_DECRYPTION_ERROR = 3103,
|
|
4833
|
-
/**
|
|
4834
|
-
* An error raised when the play is not allowed.
|
|
4835
|
-
*/
|
|
4836
|
-
PLAY_NOT_ALLOWED = 3200,
|
|
4837
4804
|
/**
|
|
4838
4805
|
* An error raised when the player fails to be paused.
|
|
4839
4806
|
*/
|
|
@@ -5086,10 +5053,6 @@ export namespace clpp {
|
|
|
5086
5053
|
* only certain simple playlists are supported.
|
|
5087
5054
|
*/
|
|
5088
5055
|
HLS_DISCONTINUITY_NOT_SUPPORTED = 4045,
|
|
5089
|
-
/**
|
|
5090
|
-
* Encountered a feature of HLS which is not currently supported.
|
|
5091
|
-
*/
|
|
5092
|
-
HLS_UNSUPPORTED_FEATURE = 4046,
|
|
5093
5056
|
/**
|
|
5094
5057
|
* The content of the media playlist is incompatible with new content
|
|
5095
5058
|
* after an update.
|
|
@@ -5275,11 +5238,6 @@ export namespace clpp {
|
|
|
5275
5238
|
* another load call has been executed.
|
|
5276
5239
|
*/
|
|
5277
5240
|
OPERATION_ABORTED = 7001,
|
|
5278
|
-
/**
|
|
5279
|
-
* The call to Player.load() failed because the Player does not have a video
|
|
5280
|
-
* element. The video element must be provided to the constructor.
|
|
5281
|
-
*/
|
|
5282
|
-
NO_VIDEO_ELEMENT = 7002,
|
|
5283
5241
|
/**
|
|
5284
5242
|
* The player could not load the configured {@link clpp.Source}.
|
|
5285
5243
|
* Either the player is missing some capabilities (e.g. from one or more
|
|
@@ -6476,6 +6434,10 @@ export namespace clpp {
|
|
|
6476
6434
|
setDrmSystem(identifier: clpp.drm.KeySystem, config: clpp.PlayreadyDrmSystem|clpp.FairplayDrmSystem|clpp.WidevineDrmSystem): void;
|
|
6477
6435
|
}
|
|
6478
6436
|
|
|
6437
|
+
export class DrmToday {
|
|
6438
|
+
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6479
6441
|
export class HeaderDrm {
|
|
6480
6442
|
/**
|
|
6481
6443
|
* @param wvLicenseUrl The Widevine License URL
|
|
@@ -8953,6 +8915,13 @@ export namespace clpp {
|
|
|
8953
8915
|
}
|
|
8954
8916
|
|
|
8955
8917
|
export class PlayerConfiguration {
|
|
8918
|
+
/**
|
|
8919
|
+
* Builds player configuration object including defaults to be serialized.
|
|
8920
|
+
*
|
|
8921
|
+
* @param configs Partial config objects to merge
|
|
8922
|
+
* @param options
|
|
8923
|
+
*/
|
|
8924
|
+
static build(configs: Array<any>, options?: Record<string, any>): clpp.PlayerConfiguration;
|
|
8956
8925
|
/**
|
|
8957
8926
|
* Creates a configuration out of the data object and the
|
|
8958
8927
|
* default configuration.
|
package/cjs/cl.sessions.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var GA="apiUrl config is missing",HA="prestoplay-web",IA=function(a,b){a.l=a.l.filter(function(c){return c!==b})},JA=function(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},KA=function(){this.a=[]},NA=function(a,b,c){LA(a,b,c,function(d,e){MA(d,e)})},MA=function(a,b){if(0<=b)OA(a,b);else{for(var c=b,d=0;9>d;d++)a.a.push(c&127|128),c>>=7;a.a.push(1)}},QA=function(a,b,c){LA(a,b,c,function(d,
|
|
3
|
-
e){if(0<=e){var f=_.v(JA(e)),g=f.next().value;f=f.next().value;PA(d,g,f)}else f=_.v(JA(e)),g=f.next().value,f=f.next().value,PA(d,g,f)})},SA=function(a,b,c){RA(a,b,c,function(d,e){for(var f=0;f<e.length;f++){var g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){var h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|128),d.a.push(g&
|
|
4
|
-
63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},UA=function(a,b,c){RA(a,b,c,function(d,e){TA(d,e.a())})},VA=function(a,b,c){RA(a,b,c,function(d,e){TA(d,e)})},TA=function(a,b){a.a.push.apply(a.a,b)},LA=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.eg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){OA(a,b<<3|2);b=new KA;for(var e=0;e<c.length;e++)d(b,c[e]);MA(a,b.length());TA(a,b.end())}else OA(a,b<<3|0),d(a,c)},
|
|
5
|
-
RA=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.eg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(var e=0;e<c.length;e++){OA(a,b<<3|2);var f=new KA;d(f,c[e]);MA(a,f.length());TA(a,f.end())}else OA(a,b<<3|2),b=new KA,d(b,c),MA(a,b.length()),TA(a,b.end())},OA=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},PA=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},WA=function(a,b,c,d){this.downloadId=
|
|
6
|
-
a;this.h=b;this.duration=c;this.j=d;this.f=[]},XA=function(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null},YA=function(a,b){this.h=a;this.f=b},ZA=function(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null},$A=function(a,b){this.key=a;this.value=b},aB=function(){this.cause=this.severity=this.code=null},bB=function(){this.data=null},cB=function(){this.data=null;var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&
|
|
7
|
-
63|128;this.data=a},dB=function(){this.headers=[]},eB=function(){},fB=function(a){this.j=a;this.f=this.h=this.time=this.sessionId=null},gB=function(){this.f=null;this.events=[]},hB=function(){this.f=this.h=null},iB=function(){this.f=this.h=null},jB=function(a){var b=new iB;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},mB=function(a,b,c,d,e){var f=new Uint8Array([]),g=this;var h=void 0===h?2500:h;this.o=f;this.l=e;this.w=new cB;this.A=new cB;this.a=[];this.h=setInterval(function(){return kB(g)},h);
|
|
8
|
-
this.f=null;this.j=!1;lB(this,a,b,c,d)},nB=function(a){return _.I(function(b){switch(b.a){case 1:a.h&&(clearInterval(a.h),a.h=null);if(!a.f){b.C(2);break}return _.x(b,a.f,2);case 2:if(!(0<a.a.length)){b.C(4);break}return _.x(b,kB(a),5);case 5:a.a=[];case 4:a.j=!0,_.z(b)}})},lB=function(a,b,c,d,e){var f=new dB;f.headers=[new $A("CL-BROWSER-NAME",b),new $A("CL-BROWSER-VERSION",c),new $A("CL-OS-FAMILY",d),new $A("CL-OS-VERSION",e),new $A("CL-SDK-NAME",HA),new $A("CL-SDK-NAME",HA),new $A("CL-SDK-VERSION",
|
|
9
|
-
_.ia)];oB(a,f)},kB=function(a){var b,c,d,e;return _.I(function(f){if(1==f.a){if(a.j||a.f)return f["return"]();0===a.a.length&&oB(a,new eB);b=function(){};a.f=new Promise(function(g){b=g});_.uh(f);c=new gB;c.f=a.o;c.events.push.apply(c.events,_.hh(a.a));d=_.hh(a.a).concat();return _.x(f,fetch(a.l,{method:_.rb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())}),4)}if(2!=f.a)if(e=f.f,e.ok)a.a=a.a.filter(function(g){return!d.includes(g)});else throw Error("An error occurred while sending telemetry events to the API, status\x3d'"+
|
|
10
|
-
(e.status+"' statusText\x3d'"+e.statusText+"'"));_.vh(f);b();a.f=null;return _.wh(f)})},oB=function(a,b){if(!a.j){var c=new fB(a.w);c.sessionId=a.A;var d=Date.now(),e=new hB;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},pB=function(){this.reason=this.currentState=this.previousState=null},qB=function(){this.m=null;this.f=this.l=!1;this.a=new _.gi;this.h=null;this.g=new _.K("clpp.sessions.SessionsPlugin");this.o=this.an.bind(this);this.j=this.$m.bind(this)},
|
|
11
|
-
yB=function(a){switch(a){case _.Lq:return rB;case _.Xq:return sB;case _.Qq:return tB;case _.Zq:return uB;case _.Yq:return vB;case _.Sq:return wB;case _.Wq:return xB;default:return null}},GB=function(a,b){switch(a){case 1:return zB;case 2:return b===_.Jg?AB:b===_.Oc?BB:b===_.yj?CB:b===_.se?DB:EB;case 3:return FB;default:return EB}},HB=function(a){var b;_.I(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.ji(a.a),a.f=!1,b=a.m.getNetworkEngine(),b.Bg(a.o),b.ue(a.j),
|
|
12
|
-
IA(b,a.j),a.h?_.x(c,nB(a.h),3):c.C(0);a.h=null;_.z(c)})},IB=function(a,b){a.g.debug("Sending event",b);oB(a.h,b)},JB=function(){};KA.prototype.length=function(){return this.a.length};KA.prototype.end=function(){var a=this.a;this.a=[];return a};WA.prototype.a=function(){var a=new KA;UA(a,1,this.downloadId);NA(a,2,this.h);UA(a,3,this.duration);NA(a,4,this.j);UA(a,5,this.f);return a.end()};WA.prototype.getId=function(){return 4};XA.prototype.a=function(){var a=new KA;NA(a,1,this.f);UA(a,2,this.downloadId);SA(a,3,this.url);UA(a,4,this.headers);SA(a,5,null);UA(a,6,null);UA(a,7,this.duration);QA(a,8,this.size);return a.end()};XA.prototype.getId=function(){return 2};YA.prototype.a=function(){var a=new KA;NA(a,1,this.h);VA(a,2,this.f);return a.end()};ZA.prototype.a=function(){var a=new KA;NA(a,1,this.errorCode);NA(a,2,this.severity);SA(a,3,this.message);SA(a,4,this.f);UA(a,5,this.cause);return a.end()};ZA.prototype.getId=function(){return 7};$A.prototype.a=function(){var a=new KA;SA(a,1,this.key);SA(a,2,this.value);return a.end()};aB.prototype.a=function(){var a=new KA;NA(a,1,this.code);NA(a,2,this.severity);UA(a,3,this.cause);return a.end()};aB.prototype.getId=function(){return 12};bB.prototype.a=function(){var a=new KA;VA(a,1,this.data);return a.end()};_.w(cB,bB);cB.prototype.toString=function(){for(var a=[],b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]};dB.prototype.a=function(){var a=new KA;UA(a,1,this.headers);return a.end()};dB.prototype.getId=function(){return 1};eB.prototype.a=function(){return(new KA).end()};eB.prototype.getId=function(){return 6};fB.prototype.a=function(){var a=new KA;UA(a,1,this.j);UA(a,2,this.sessionId);UA(a,3,this.time);QA(a,4,null);SA(a,5,null);NA(a,6,this.h);VA(a,7,this.f);return a.end()};gB.prototype.a=function(){var a=new KA;VA(a,1,this.f);UA(a,2,this.events);return a.end()};hB.prototype.a=function(){var a=new KA;QA(a,1,this.h);NA(a,2,this.f);return a.end()};iB.prototype.a=function(){var a=new KA;QA(a,1,this.h);NA(a,2,this.f);return a.end()};pB.prototype.a=function(){var a=new KA;NA(a,1,this.previousState);NA(a,2,this.currentState);NA(a,3,this.reason);UA(a,4,null);UA(a,5,null);UA(a,6,null);return a.end()};pB.prototype.getId=function(){return 5};_.w(qB,_.Hv);_.r=qB.prototype;_.r.onPlayerCreated=function(a){this.m=a};
|
|
13
|
-
_.r.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Re))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.ya),this.g.info("Create a session and start sending events."),a=_.gl(),this.h=new mB(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.a.on(this.m,_.bg,this.Qk.bind(this)),this.a.on(this.m,_.Uf,this.Pk.bind(this)),this.a.on(this.m,_.Tf,
|
|
14
|
-
this.Ok.bind(this)),this.a.on(this.m,_.he,this.Nk.bind(this)),a=this.m.getNetworkEngine(),a.Of(this.o),a.bd(this.j),a.l.push(this.j)):(this.g.warn(GA),a.onError(new _.O(1,9,15E3,GA)))};_.r.onPlayerWillRelease=function(){HB(this)};_.r.id=function(){return"sessions"};_.r.Qk=function(a){if(!this.f){a=a.detail;var b=a.currentState,c=new pB;c.previousState=yB(a.previousState);c.currentState=yB(b);IB(this,c)}};
|
|
15
|
-
_.r.Pk=function(){if(!this.f){var a=new pB;a.previousState=yB(this.m.getState());a.currentState=KB;IB(this,a);this.f=!0}};_.r.Ok=function(){if(this.f){var a=new pB;a.previousState=KB;a.currentState=yB(this.m.getState());IB(this,a);this.f=!1}};_.r.Nk=function(a){a=a.detail;var b=new aB;b=new ZA(new YA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.Q?LB:MB;IB(this,b)};
|
|
16
|
-
_.r.an=function(a){var b=new cB;a.downloadId=b;var c=new XA(GB(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(function(d){return new $A(d,a.headers[d])});IB(this,c)};_.r.$m=function(a){var b=a.request.downloadId;b?(b=new WA(b,a.data.byteLength,jB(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(function(c){return new $A(c,a.headers[c])}),IB(this,b)):this.g.warn("Download ID is missing on download completed event.")};JB.prototype.create=function(){return new qB};
|
|
17
|
-
_.ru(new JB);var MB=1,LB=2;var rB=0,sB=2,xB=3,KB=5,tB=6,uB=8,vB=10,wB=11;var zB=0,AB=1,BB=2,CB=3,DB=4,FB=5,EB=9;};
|
|
18
|
-
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
19
|
-
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
20
|
-
else{_=this.clpp._;(f.call(g,this));}
|
|
21
|
-
})();
|