@castlabs/prestoplay 6.28.0 → 6.30.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 +37 -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 +128 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +619 -614
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +92 -89
- package/cjs/cl.externs.js +154 -60
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +25 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +350 -349
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +15 -15
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +57 -58
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +60 -60
- 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/cjs/polyfill.min.js +2 -2
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -6
- package/cl.cast.js +101 -92
- package/cl.conviva.js +27 -27
- package/cl.core.js +500 -496
- package/cl.crypto.js +9 -9
- package/cl.dash.js +84 -83
- package/cl.externs.js +150 -60
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +82 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -17
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +304 -305
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- 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 +56 -56
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +1 -1
- package/typings.d.ts +198 -88
package/cl.htmlcue.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},
|
|
3
|
-
function(a,b){return 1>Math.abs(a-b)||a>b},
|
|
4
|
-
d-e)}
|
|
5
|
-
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return
|
|
6
|
-
_.r)switch(b){case _.
|
|
7
|
-
|
|
8
|
-
a.viewportAnchorUnits;if(d===_.
|
|
9
|
-
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},
|
|
10
|
-
a.o=[]}},
|
|
11
|
-
if(b||a.J!==c&&3===a.m.getState())if(a.J=c,c=
|
|
12
|
-
_.
|
|
13
|
-
c.a.appendChild(d)}}}}},
|
|
14
|
-
b){const c=
|
|
15
|
-
e[1];var g=e[3];var h=
|
|
16
|
-
"\x26nbsp;":"\u00a0"};var
|
|
17
|
-
_.
|
|
18
|
-
!this.f.region.displayAlign){e=
|
|
19
|
-
100*a)}
|
|
20
|
-
d=this.a;d=Math.max(0,Math.min(c.f,d.f)-Math.max(c.left,d.left))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.top,d.top))/(c.height*c.width);d>k&&(h
|
|
21
|
-
_.
|
|
22
|
-
b=c;f*=b;break a;default:throw Error(
|
|
23
|
-
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],
|
|
24
|
-
this.G=new _.
|
|
25
|
-
this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;
|
|
26
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var AS="Unsupported unit",BS="clpp-text-plain",CS="clpp-text-ttml",DS="clpp.htmlcue.HtmlTextDisplayer",ES="initial",FS=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},GS=function(a){return _.ci(a,{$f:(b,c)=>b.Oc(c)})},HS=function(a,b){if(0===b.length)return a;let c=a;a=a.findIndex(d=>d.startTime>=b[0].startTime);0<=a&&(c=c.slice(0,a));return c.concat(b)},IS=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);
|
|
2
|
+
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},KS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>JS[c]);return a},MS=function(a,b){LS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{LS(a,c)})},LS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},NS=function(a,b){return 0===a?"0":a+b},OS=function(a,b){return 1>Math.abs(a-b)||a<b},PS=function(a,b){return a<b&&1<Math.abs(a-b)},QS=function(a,b){return a>b&&1<Math.abs(a-b)},RS=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},TS=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new SS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},US=function(a){return new SS(a.left,a.f,a.top,a.a,a.height,a.width)},VS=function(a,b){return b.some(c=>PS(a.left,c.f)&&QS(a.f,c.left)&&PS(a.top,c.a)&&QS(a.a,c.top))},WS=function(a,b){return RS(a.top,b.top)&&OS(a.a,b.a)&&RS(a.left,b.left)&&OS(a.f,b.f)},XS=function(a,b,c){switch(c){case "+x":return PS(a.left,b.left);case "-x":return QS(a.f,b.f);case "+y":return PS(a.top,b.top);case "-y":return QS(a.a,b.a);default:throw Error("Unknown axis");}},YS=function(a){return a.f.writingMode===_.ku},ZS=
|
|
5
|
+
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return YS(a)?b:c},$S=function(a){switch(a.f.writingMode){case _.ku:return"horizontal-tb";case _.wg:return _.wg;case _.xg:return _.xg;default:throw Error("Unknown writing mode");}},aT=function(a){switch(a.f.positionAlign){case _.me:return _.je;case "auto":case _.Xc:return _.ju;case _.ne:return _.Bf}return a.f.textAlign},bT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
|
|
6
|
+
_.r)switch(b){case _.me:return a.f.position;case "auto":case _.Xc:return a.f.position-a.f.size/2;case _.ne:return a.f.position-a.f.size}return 0},cT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Pf:case _.je:return _.me;case _.ju:return _.Xc;case _.Vd:case _.Bf:return _.ne}return a.f.positionAlign},fT=function(a,b,c){return(dT(a)||eT(a))&&_.kh(c)?NS(c,_.uf):dT(a)&&_.z(c)?NS(0,_.uf):YS(a)&&_.kh(b)?NS(b,"%"):ES},gT=function(a,b,c){return YS(a)&&_.kh(c)?NS(c,_.uf):(dT(a)||eT(a))&&_.kh(b)?
|
|
7
|
+
NS(b,"%"):ES},eT=function(a){return a.f.writingMode===_.xg},dT=function(a){return a.f.writingMode===_.wg},hT=function(a,b){if(a.j)switch(b.writingMode){case _.ku:return["-y"];case _.wg:return["+x"];case _.xg:return["-x"]}a=[];switch(b.writingMode){case _.ku:a=["+y","-y"];break;case _.wg:a=["+x","-x"];break;case _.xg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},iT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=TS(a.l.a)},jT=function(a,b,c){a=a.f;const d=
|
|
8
|
+
a.viewportAnchorUnits;if(d===_.ru)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(AS);},lT=function(a,b,c,d){const e=document.createElement(_.Vf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);kT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},mT=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,
|
|
9
|
+
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},nT=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},oT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
|
|
10
|
+
a.o=[]}},kT=function(a,b,c){const d=new MutationObserver(e=>{e.forEach(f=>{f.removedNodes.forEach(g=>{g.id===c&&a.g.error(`PRESTOplay HTML style element #${c} has `+"been unexpectedly removed! Some styles will not work!")})})});d.observe(b,{subtree:!1,childList:!0});a.l.push(()=>d.disconnect())},pT=function(a){a=_.dh(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},vT=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
|
|
11
|
+
if(b||a.J!==c&&3===a.m.getState())if(a.J=c,c=qT(a,c),b||(b=a.o,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.o=c,rT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.At(a)||void 0};c=a.f.slice(c.start,c.end+1);for(const k of c){c=a;var d=k,e=b,f=c.a.a,g=null;switch(d.payloadType){case _.Eg:g="clpp-text-vtt";break;case _.ig:g=CS;break;case _.iu:g=BS}g&&!f.classList.contains(g)&&
|
|
12
|
+
_.Ci(f,g);f=TS(c.a.a);if(0===f.width||0===f.height)c.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");else{LS({fontSize:sT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Eg;var h=d.payloadType===_.ig;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new tT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new uT(d,c.L,e);f?f.appendChild(d):
|
|
13
|
+
c.a.appendChild(d)}}}}},wT=function(a){rT(a);a.J=null;a.o=null;a.f=[]},xT=function(a,b){return a.startTime<=b&&a.endTime>b},qT=function(a,b){var c=FS(a.f,d=>xT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&xT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&xT(a.f[c+1],b);)c++;return{start:d,end:c}}},rT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(CS);b.classList.remove(BS);a=a.a;iT(a.h);a.l=[]}},sT=function(a,
|
|
14
|
+
b){const c=TS(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.C)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.r&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},BT=class{parse(a){a={input:a};const b=_.Ei(_.Fd),c=[];let d=b;for(var e;null!==(e=IS(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=
|
|
15
|
+
e[1];var g=e[3];var h=yT[f];h?(h=_.Ei(h),(f=zT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||AT[g.localName]&&AT[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(KS(e)));return b}},yT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},zT={v:"voice",lang:"lang"},AT={rt:"ruby"},JS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
|
|
16
|
+
"\x26nbsp;":"\u00a0"};var SS=class{constructor(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f}};var CT=class{constructor(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1}init(){this.j=!0}A(){return!1}};var uT=class extends CT{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c}A(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.h)_.Ci(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage=`url("${this.f.backgroundImage}")`,this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.ig){var c=_.Ei(_.Fd);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.Eg?b=(new BT).parse(b.payload):(c=_.Ei(_.Fd),c.textContent=b.payload,b=c);_.Ci(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Ci(b,d);LS({writingMode:$S(this)},b);var d=b;this.a.appendChild(d);_.Ci(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Ci(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.lu,this.f.line=YS(this)?-1:0);e=$S(this);LS({writingMode:e,webkitWritingMode:e,direction:ES,textAlign:aT(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=bT(this,cT(this));LS({position:"absolute",left:fT(this,e,null),right:eT(this)&&_.z(null)?NS(0,_.uf):ES,top:gT(this,e,null),width:YS(this)?NS(this.f.size,"%"):ES,height:dT(this)||eT(this)?NS(this.f.size,"%"):ES},this.a);b=this.f;a=YS(this)?a.height:a.width;c=ZS(this);if(b.lineInterpretation===_.lu){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.Xc:g-=f/2;break;case _.Vd:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}eT(this)&&(f=a-f-c);a=f;LS({left:fT(this,e,a),right:eT(this)&&_.z(a)?NS(0,_.uf):ES,top:gT(this,e,a)},this.a)}MS(this.C,d)}}o(){return _.Ei(_.Fd)}};var DT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=TS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.ce;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=TS(a.a);var d=hT(this,a.f),e=ZS(a);const g=US(c);let h=null,k=0;for(const l of d){for(;XS(c,this.a,l)||WS(c,this.a)&&VS(c,this.h);){d=c;var f=e;switch(l){case "+x":d.left+=f;d.f+=f;break;case "-x":d.left-=f;d.f-=f;break;case "+y":d.top+=f;d.a+=f;break;case "-y":d.top-=f,d.a-=f}}if(this.j||WS(c,this.a))break a;
|
|
20
|
+
d=this.a;d=Math.max(0,Math.min(c.f,d.f)-Math.max(c.left,d.left))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.top,d.top))/(c.height*c.width);d>k&&(h=US(c),k=d);c=US(g)}c=h||g}LS({top:NS(c.top-this.a.top,_.uf),bottom:NS(this.a.a-c.a,_.uf),left:NS(c.left-this.a.left,_.uf),right:NS(this.a.f-c.f,_.uf),height:NS(c.height,_.uf),width:NS(c.width,_.uf)},a.a)}b.style.visibility="visible";this.h.push(TS(a.a))}};var ET=class extends CT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new DT(this);this.j=!0}o(){const a=_.Ei(_.Fd);_.Ci(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){iT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var tT=class extends ET{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.ru:b=b.width/100*a.width;break a;default:throw Error(AS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.ru)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(AS);d=a.height;const e=jT(this,d,a.height);LS(this.B,this.a);LS({left:NS(c,_.uf),top:NS(e,_.uf),width:NS(b,
|
|
21
|
+
_.uf),height:NS(d,_.uf)},this.a);this.f.writingMode&&LS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&LS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Ci(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.ru:f=f.height/100*a.height;break a;case 2:f=f.height;c=new uT(new _.ou(0,1,"Lorem ipsum",_.iu),{},{});b=c.a;this.a.appendChild(b);c.init(TS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error(AS);}a=jT(this,f,a.height);LS({top:NS(a,_.uf),height:NS(f,_.uf)},this.a);this.h=new DT(this,!0);this.j=!0}getId(){return this.f.id}};var FT=class{constructor(a,b){this.g=new _.T("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=lT(this,this.h,this.j);this.f=lT(this,this.h,this.j,!0);this.f.disabled=!0;this.g.debug(`Stylesheet ${this.h} has been created.`)}appendRule(a){if(null!=this.a&&!this.o.some(b=>b===a)){const b=mT(this,a);if(nT(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug(`Added CSS rule ${b}`)}catch(c){this.g.error(`An error occurred when adding a CSS rule: ${b}`)}this.o.push(a)}else this.g.warn(`Stylesheet ${this.h} ignoring the CSS rule `+
|
|
23
|
+
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],oT(a),document.head.removeChild(a.a.ownerNode),document.head.removeChild(a.f.ownerNode),a.a=null,a.f=null,a.g.debug(`Stylesheet ${a.h} has been destroyed.`))})}};var GT=class extends _.Gv{constructor(a){super(a);this.g=new _.T(DS);this.m=a;this.L=pT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new FT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new ET(null,"clpp-text-container",{});this.A=new _.Cv(a.getSurface(),this.T.bind(this));this.J=null;this.F?(this.F.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
|
|
24
|
+
this.G=new _.Li(()=>{vT(this)});this.B=new Map;this.o=null}append(a,b){if(null!=this.j&&0!==a.length){for(const c of b)this.j.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);this.f=HS(this.f,GS(a));this.o=null;vT(this,!1)}}h(){null==this.j||vT(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(wT(a),a.G.stop(),yield a.j.destroy(),a.j=null,a.F.removeChild(a.a.a),a.a=null,a.A.stop(),a.A=null,a.l=!1)})}remove(a,b){if(null==this.j)return!1;
|
|
25
|
+
this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;vT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Ab(.25),this.L.enableResizeObserver&&this.A.start(),vT(this,!0)):(this.G.stop(),this.A.stop(),wT(this)))}T(){vT(this,!0)}};_.x(DS,GT);GT.prototype.setTextVisibility=GT.prototype.setTextVisibility;GT.prototype.isTextVisible=GT.prototype.isTextVisible;GT.prototype.remove=GT.prototype.remove;GT.prototype.destroy=GT.prototype.destroy;
|
|
26
|
+
GT.prototype.append=GT.prototype.append;var HT=class{a(a){return!!a.enableHtmlCue&&!_.aj()}create(a){return new GT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.yv{install(){_.gs(_.ee,new HT)}uninstall(){_.es.has(_.ee)&&(_.es.delete(_.ee),_.fs.info("Removed factory: 'html'"))}id(){return _.Wf}});};f.call(g, window);
|
package/cl.ima.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.
|
|
3
|
-
d.LOG,a.
|
|
4
|
-
9,10003,{errorType:c},b))},
|
|
5
|
-
|
|
6
|
-
this.
|
|
7
|
-
1}
|
|
8
|
-
|
|
9
|
-
W.prototype.
|
|
10
|
-
W.prototype.
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this
|
|
16
|
-
a.
|
|
17
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hS="clpp.ima.AdsManagerFactory",iS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},jS=function(a){a=a.F;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Nc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
|
|
2
|
+
_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Nc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},kS=function(a){return!1===a.F.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&(_.Pi()||_.Si())},lS=function(a){const b=a.a,c=a.L,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Bb.bind(a));c.on(b,d.LOADED,a.ga.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.yc.bind(a));c.on(b,d.STARTED,a.Ua.bind(a));c.on(b,
|
|
3
|
+
d.LOG,a.Nb.bind(a));c.on(b,d.AD_PROGRESS,a.ia.bind(a));c.on(b,d.AD_BUFFERING,a.Cb.bind(a));c.on(b,d.FIRST_QUARTILE,a.ba.bind(a));c.on(b,d.MIDPOINT,a.oc.bind(a));c.on(b,d.THIRD_QUARTILE,a.Va.bind(a));c.on(b,d.PAUSED,a.pc.bind(a));c.on(b,d.RESUMED,a.rc.bind(a));c.on(b,d.CLICK,a.Y.bind(a));c.on(b,d.SKIPPED,a.Aa.bind(a));c.on(b,d.IMPRESSION,a.ca.bind(a));c.on(b,d.COMPLETE,a.Mb.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.zc.bind(a))},mS=function(a,b){const c=b?a.$a.create(b.getErrorCode()):null;a.m.onError(new _.I(1,
|
|
4
|
+
9,10003,{errorType:c},b))},nS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.H,a.G)});a.m.trigger(new _.H(b,d))},qS=function(a){_.w(function*(){a.I=a.m.getPosition();yield oS(a,3);yield a.m.pause();yield pS(a);a.a.start()})},oS=function(a,b){return _.w(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{a.m.getState()>=b&&(clearInterval(f),clearTimeout(e),c())},200)})})},pS=function(a){return _.w(function*(){yield a.m.detach();
|
|
5
|
+
var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},rS=function(a){a.C=null;nS(a,_.mc);a.m.getSurface().hide(a.R)},sS=function(a){_.Di(a.B,{visibility:"visible"})},uS=function(a){_.w(function*(){a.T.initialize();const b=!!a.m.getConfiguration().muted;(yield a.M.canPlay(b))||kS(a)?tS(a):(nS(a,_.Lc),a.g.warn(_.ka))})},tS=function(a){a.a.init(a.B.offsetWidth,a.B.offsetHeight,google.ima.ViewMode.NORMAL);kS(a)?a.F.isVast&&qS(a):a.a.start();a.P=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();
|
|
6
|
+
this.j=b;this.h=c}nb(){return"Google IMA SDK"}ob(){return google.ima.VERSION}ub(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Qb(){return""}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Ub(){return this.f?
|
|
7
|
+
this.f.getIsBumper():!1}pb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.He&&typeof b[d].clickThroughUrl===_.Tf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}eb(){return this.a.getVastMediaWidth()}cb(){return this.a.getVastMediaHeight()}Pa(){return this.a.getVastMediaBitrate()}Qa(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Hb(){return this.f?this.f.getTimeOffset():0}rb(){return this.f?this.f.getAdPosition():
|
|
8
|
+
1}fb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}Sb(){return null}};W.prototype.getVideoElement=W.prototype.Sb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
|
|
9
|
+
W.prototype.getSequenceLength=W.prototype.fb;W.prototype.getPositionInSequence=W.prototype.rb;W.prototype.getPodTimeOffset=W.prototype.Hb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Qa;W.prototype.getMediaBitrate=W.prototype.Pa;W.prototype.getMediaHeight=W.prototype.cb;W.prototype.getMediaWidth=W.prototype.eb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.pb;W.prototype.isBumper=W.prototype.Ub;
|
|
10
|
+
W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;W.prototype.getSourceId=W.prototype.Qb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
|
|
11
|
+
W.prototype.getTechnology=W.prototype.ub;W.prototype.getAdManagerVersion=W.prototype.ob;W.prototype.getAdManagerName=W.prototype.nb;var vS=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var wS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Jb(){return 0<=this.a.indexOf(0)||0===this.a.length}Ib(){return 0<=this.a.indexOf(-1)}};wS.prototype.hasPostroll=wS.prototype.Ib;wS.prototype.hasPreroll=wS.prototype.Jb;wS.prototype.getCuePoints=wS.prototype.getCuePoints;var xS=class extends _.Ov{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(iS())return a.onError(new _.I(1,9,1E4));this.f=_.Bi(_.Fd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.ra);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
|
|
12
|
+
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Rh(){return this.a}Ph(){return this.h}Pc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",xS);xS.prototype.getAdContainer=xS.prototype.Pc;xS.prototype.getAdDisplayContainer=xS.prototype.Ph;xS.prototype.getAdsLoader=xS.prototype.Rh;xS.Id="ima";xS.isSdkMissing=iS;var yS=class{create(){return new xS}};var zS=class{constructor(a){var b=a.md("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Pc(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.B=e;a=this.m.getConfiguration();a=_.dh(a.ima||{});this.F=a=_.ch({disableCustomPlayback:!1},a);this.R=c;this.T=d;this.w=b;this.M=new _.Ev;this.g=new _.T("clpp.ima");this.a=null;this.V=!1;this.h=null;this.f=new _.Hl;this.P=!1;this.L=new _.Kt;
|
|
13
|
+
this.$a=new vS;this.C=null;this.J=this.G=this.H=!1;this.I=this.K=null;c=this.L;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.uc.bind(this));c.on(this.w,d,this.sc.bind(this));c.on(this.m,_.Wd,this.wc.bind(this))}uc(a){this.a=a.getAdsManager(this.B,jS(this));this.a.isCustomPlaybackUsed()&&!kS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.I(1,9,10002)),this.j()):
|
|
14
|
+
(this.h=new _.Cv(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.K=new wS(a),this.m.trigger(new _.H(_.pc,{adsTimeline:this.K})),lS(this));this.f.resolve()}sc(a){mS(this,a.getError());this.f.resolve()}yc(a){this.J=!0;kS(this)||(this.m.pause(),_.Di(this.B,{visibility:_.ce}));nS(this,_.Tb,a);this.h.start()}Bb(){kS(this)?qS(this):this.a.start()}ga(a){a.getAd().isLinear()?nS(this,_.ec,a):(this.a.discardAdBreak(),
|
|
15
|
+
this.H||(this.H=!0,this.m.play()))}Ua(a){this.C=a.getAd().getDuration();nS(this,_.lc,a);this.m.getSurface().show(this.R)}Nb(a){a=a.getAdData();mS(this,a?a.adError:null);rS(this)}ia(a){nS(this,_.ic,a)}Cb(a){nS(this,_.Vb,a)}ba(a){nS(this,_.Yb,a)}oc(a){nS(this,_.gc,a)}Va(a){nS(this,_.nc,a)}pc(a){nS(this,_.hc,a)}rc(a){nS(this,_.jc,a)}Y(a){this.pause();nS(this,_.Wb,a)}Aa(a){nS(this,_.kc,a);rS(this)}ca(a){nS(this,_.bc,a)}Mb(a){nS(this,_.Xb,a);rS(this)}zc(){const a=this;return _.w(function*(){a.H=!0;if(kS(a)&&
|
|
16
|
+
null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.jo(a.m);!a.G&&a.I&&(yield oS(a,2),yield a.m.play(),yield a.m.pause(),yield oS(a,4),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();sS(a)}a.J=!1;a.h&&a.h.stop();a.G||(yield a.m.play());nS(a,_.Ub)})}wc(){this.G=!0;this.w.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.F;try{if(typeof c.adTagUrl!==_.Tf)throw new _.I(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),
|
|
17
|
+
a.f;b=yield a.M.canPlay(!1);const d=yield a.M.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.w.getSettings().setAutoPlayAdBreaks(!1);a.w.requestAds(e);return a.f})}A(){if(!this.a)return!0;if(!this.V&&!this.P){if(this.K.Jb())return uS(this),!1;this.T.initialize();tS(this)}return!0}o(){}l(){return!0}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():
|
|
18
|
+
1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.C)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.C-a}j(){this.a&&(this.a.destroy(),this.a=null);this.V=!0;sS(this);this.L.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()}};zS.prototype.getPosition=zS.prototype.getPosition;zS.prototype.setVolume=zS.prototype.setVolume;zS.prototype.getVolume=zS.prototype.getVolume;zS.prototype.skip=zS.prototype.skip;zS.prototype.pause=zS.prototype.pause;
|
|
19
|
+
zS.prototype.resume=zS.prototype.resume;_.Fh(new class{constructor(){this.Sa=new _.T(hS)}name(){return hS}a(a,b){return a.namespace()===_.hd?!1:iS()?(this.Sa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new zS(a)}});_.Qn(new yS);};f.call(g, window);
|
package/cl.mediatailor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
- manifest URI: ${d.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var fS=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.eb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Lg:_.Qm(d.manifestUrl,b),Ij:e?_.Qm(e,b):null};a.g.info(`Media Tailor session initialized.
|
|
2
|
+
- manifest URI: ${d.Lg}`);return d})},gS=class extends _.Ov{constructor(){super();this.g=new _.T("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield fS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Lg}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.D,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Qn(new class{create(){return new gS}});};f.call(g, window);
|