@castlabs/prestoplay 6.17.1 → 6.19.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 +55 -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 +115 -114
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +575 -565
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -74
- package/cjs/cl.externs.js +175 -293
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +70 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +315 -314
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +90 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +473 -466
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -70
- package/cl.externs.js +172 -294
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +276 -273
- 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.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- 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.youbora.js +15 -15
- package/clpp.styles.css +14 -0
- package/package.json +2 -2
- package/typings.d.ts +406 -377
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
|
-
_.
|
|
7
|
-
|
|
8
|
-
for(const c of a.l)a.
|
|
9
|
-
const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${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
|
-
return c},
|
|
11
|
-
!0);return a},
|
|
12
|
-
break;case _.
|
|
13
|
-
{}),c.B.set(d.region.id,f),
|
|
14
|
-
b.classList.remove(
|
|
15
|
-
else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=
|
|
16
|
-
"\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\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 _.
|
|
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 YQ="Unsupported unit",ZQ="clpp-text-plain",$Q="clpp-text-ttml",aR="clpp.htmlcue.HtmlTextDisplayer",bR="initial",cR=function(a){return _.Gh(a,{bf:(b,c)=>b.Ac(c)})},dR=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)},eR=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},fR=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},hR=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>gR[c]);return a},jR=function(a,b){iR(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{iR(a,c)})},iR=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},kR=function(a,b){return 0===a?"0":a+b},lR=function(a,b){return 1>Math.abs(a-b)||a<b},mR=function(a,b){return a<b&&1<Math.abs(a-b)},nR=function(a,b){return a>b&&1<Math.abs(a-b)},oR=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},qR=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 pR(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},rR=function(a){return new pR(a.left,a.f,a.top,a.a,a.height,a.width)},sR=function(a,b){return b.some(c=>mR(a.left,c.f)&&nR(a.f,c.left)&&mR(a.top,c.a)&&nR(a.a,c.top))},tR=function(a,b){return oR(a.top,b.top)&&lR(a.a,b.a)&&oR(a.left,b.left)&&lR(a.f,b.f)},uR=function(a,b,c){switch(c){case "+x":return mR(a.left,b.left);case "-x":return nR(a.f,b.f);case "+y":return mR(a.top,b.top);case "-y":return nR(a.a,b.a);default:throw Error("Unknown axis");}},vR=function(a){return a.f.writingMode===_.Fs},wR=
|
|
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 vR(a)?b:c},xR=function(a){switch(a.f.writingMode){case _.Fs:return"horizontal-tb";case _.kg:return _.kg;case _.lg:return _.lg;default:throw Error("Unknown writing mode");}},yR=function(a){switch(a.f.positionAlign){case _.je:return _.ge;case "auto":case _.cd:return _.Es;case _.le:return _.yf}return a.f.textAlign},zR=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
|
|
6
|
+
_.r)switch(b){case _.je:return a.f.position;case "auto":case _.cd:return a.f.position-a.f.size/2;case _.le:return a.f.position-a.f.size}return 0},AR=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ge:case _.ge:return _.je;case _.Es:return _.cd;case _.yf:case _.yf:return _.le}return a.f.positionAlign},DR=function(a,b,c){return(BR(a)||CR(a))&&_.Yg(c)?kR(c,_.rf):BR(a)&&_.z(c)?kR(0,_.rf):vR(a)&&_.Yg(b)?kR(b,"%"):bR},ER=function(a,b,c){return vR(a)&&_.Yg(c)?kR(c,_.rf):(BR(a)||CR(a))&&_.Yg(b)?
|
|
7
|
+
kR(b,"%"):bR},CR=function(a){return a.f.writingMode===_.lg},BR=function(a){return a.f.writingMode===_.kg},FR=function(a,b){if(a.j)switch(b.writingMode){case _.Fs:return["-y"];case _.kg:return["+x"];case _.lg:return["-x"]}a=[];switch(b.writingMode){case _.Fs:a=["+y","-y"];break;case _.kg:a=["+x","-x"];break;case _.lg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},GR=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=qR(a.l.a)},HR=function(a,b){GR(a.h);a.l.unshift(b);
|
|
8
|
+
for(const c of a.l)a.h.append(c)},IR=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.Ms)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(YQ);},KR=function(a,b,c,d){const e=document.createElement(_.Rf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);JR(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},LR=function(a,b){a=`.${a.j} .clpp-text-container`;
|
|
9
|
+
const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${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)},MR=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);
|
|
10
|
+
return c},NR=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.o=[]}},JR=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())},OR=function(a){a=_.Rg(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=
|
|
11
|
+
!0);return a},UR=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.bo)if(a.J=c,c=PR(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,QR(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.vs(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 _.vg:g="clpp-text-vtt";
|
|
12
|
+
break;case _.Zf:g=$Q;break;case _.Ds:g=ZQ}g&&!f.classList.contains(g)&&_.xo(f,g);f=qR(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{iR({fontSize:RR(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.vg;var h=d.payloadType===_.Zf;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new SR(d.region,
|
|
13
|
+
{}),c.B.set(d.region.id,f),HR(c.a,f)));d=new TR(d,c.L,e);f?HR(f,d):HR(c.a,d)}}}}},VR=function(a){QR(a);a.J=null;a.o=null;a.f=[]},WR=function(a,b){return a.startTime<=b&&a.endTime>b},PR=function(a,b){var c=eR(a.f,d=>WR(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&WR(a.f[d-1],b);)d--;for(;c+1<a.f.length&&WR(a.f[c+1],b);)c++;return{start:d,end:c}}},QR=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove($Q);
|
|
14
|
+
b.classList.remove(ZQ);a=a.a;GR(a.h);a.l=[]}},RR=function(a,b){const c=qR(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`},aS=class{parse(a){a={input:a};const b=_.zo(_.Fd),c=[];let d=b;for(var e;null!==(e=fR(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);
|
|
15
|
+
else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=YR[f];h?(h=_.zo(h),(f=ZR[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||$R[g.localName]&&$R[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(hR(e)));return b}},YR={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},ZR={v:"voice",lang:"lang"},$R={rt:"ruby"},gR={"\x26amp;":"\x26",
|
|
16
|
+
"\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var pR=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 bS=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 TR=class extends bS{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)_.xo(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===_.Zf){var c=_.zo(_.Fd);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.vg?b=(new aS).parse(b.payload):(c=_.zo(_.Fd),c.textContent=b.payload,b=c);_.xo(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.xo(b,d);iR({writingMode:xR(this)},b);var d=b;this.a.appendChild(d);_.xo(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.xo(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.Gs,this.f.line=vR(this)?-1:0);e=xR(this);iR({writingMode:e,webkitWritingMode:e,direction:bR,textAlign:yR(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=zR(this,AR(this));iR({position:"absolute",left:DR(this,e,null),right:CR(this)&&_.z(null)?kR(0,_.rf):bR,top:ER(this,e,null),width:vR(this)?kR(this.f.size,"%"):bR,height:BR(this)||CR(this)?kR(this.f.size,"%"):bR},this.a);b=this.f;a=vR(this)?a.height:a.width;c=wR(this);if(b.lineInterpretation===_.Gs){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 _.cd:g-=f/2;break;case _.Td:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}CR(this)&&(f=a-f-c);a=f;iR({left:DR(this,e,a),right:CR(this)&&_.z(a)?kR(0,_.rf):bR,top:ER(this,e,a)},this.a)}jR(this.C,d)}}o(){return _.zo(_.Fd)}};var cS=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=qR(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.ae;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=qR(a.a);var d=FR(this,a.f),e=wR(a);const g=rR(c);let h=null,k=0;for(const l of d){for(;uR(c,this.a,l)||tR(c,this.a)&&sR(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||tR(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=rR(c),k=d);c=rR(g)}c=h||g}iR({top:kR(c.top-this.a.top,_.rf),bottom:kR(this.a.a-c.a,_.rf),left:kR(c.left-this.a.left,_.rf),right:kR(this.a.f-c.f,_.rf),height:kR(c.height,_.rf),width:kR(c.width,_.rf)},a.a)}b.style.visibility="visible";this.h.push(qR(a.a))}};var dS=class extends bS{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new cS(this);this.j=!0}o(){const a=_.zo(_.Fd);_.xo(a,this.w);this.id&&(a.id=this.id);return a}};var SR=class extends dS{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 _.Ms:b=b.width/100*a.width;break a;default:throw Error(YQ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ms)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(YQ);d=a.height;const e=IR(this,d,a.height);iR(this.B,this.a);iR({left:kR(c,_.rf),top:kR(e,_.rf),width:kR(b,
|
|
21
|
+
_.rf),height:kR(d,_.rf)},this.a);this.f.writingMode&&iR({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&iR({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.xo(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Ms:f=f.height/100*a.height;break a;case 2:f=f.height;c=new TR(new _.Js(0,1,"Lorem ipsum",_.Ds),{},{});b=c.a;this.a.appendChild(b);c.init(qR(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error(YQ);}a=IR(this,f,a.height);iR({top:kR(a,_.rf),height:kR(f,_.rf)},this.a);this.h=new cS(this,!0);this.j=!0}getId(){return this.f.id}};var eS=class{constructor(a,b){this.g=new _.R("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=KR(this,this.h,this.j);this.f=KR(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=LR(this,a);if(MR(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=[],NR(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 fS=class extends _.yu{constructor(a){super(a);this.g=new _.R(aR);this.m=a;this.L=OR(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new eS(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new dS(null,"clpp-text-container",{});this.A=new _.ru(a.getSurface(),this.S.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 _.Wj(()=>{UR(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=dR(this.f,cR(a));this.o=null;UR(this,!1)}}h(){null==this.j||UR(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(VR(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;UR(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.vb(.25),this.L.enableResizeObserver&&this.A.start(),UR(this,!0)):(this.G.stop(),this.A.stop(),VR(this)))}S(){UR(this,!0)}};_.x(aR,fS);fS.prototype.setTextVisibility=fS.prototype.setTextVisibility;fS.prototype.isTextVisible=fS.prototype.isTextVisible;fS.prototype.remove=fS.prototype.remove;fS.prototype.destroy=fS.prototype.destroy;
|
|
26
|
+
fS.prototype.append=fS.prototype.append;var gS=class{a(a){return!!a.enableHtmlCue&&!_.mk()}create(a){return new fS(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.au{f(){_.Gn(_.ce,new gS)}a(){_.En.has(_.ce)&&(_.En.delete(_.ce),_.Fn.info("Removed factory: 'html'"))}id(){return _.Sf}});};f.call(g, window);
|
package/cl.ima.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
_.
|
|
3
|
-
c.on(b,d.FIRST_QUARTILE,a.
|
|
4
|
-
b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.
|
|
5
|
-
google.ima.ViewMode.NORMAL);a.a.start();a.
|
|
6
|
-
this.f.getIsBumper():!1}
|
|
7
|
-
1}
|
|
8
|
-
X.prototype.getPodTimeOffset=X.prototype.
|
|
9
|
-
X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.
|
|
10
|
-
this.
|
|
11
|
-
{adsTimeline:this.
|
|
12
|
-
|
|
13
|
-
(yield a.m.seek(a.
|
|
14
|
-
c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.
|
|
15
|
-
return 0>a?0:this.
|
|
16
|
-
|
|
17
|
-
(this.a.destroy(),this.a=null);this.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var IQ="clpp.ima.AdsManagerFactory",JQ=function(a){a=a.L;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Rc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
|
|
2
|
+
_.Rc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},KQ=function(a){return!1===a.L.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.ak()},LQ=function(a){const b=a.a,c=a.C,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Pa.bind(a));c.on(b,d.LOADED,a.Z.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Dc.bind(a));c.on(b,d.STARTED,a.da.bind(a));c.on(b,d.LOG,a.Ya.bind(a));c.on(b,d.AD_PROGRESS,a.bc.bind(a));c.on(b,d.AD_BUFFERING,a.Qa.bind(a));
|
|
3
|
+
c.on(b,d.FIRST_QUARTILE,a.X.bind(a));c.on(b,d.MIDPOINT,a.wb.bind(a));c.on(b,d.THIRD_QUARTILE,a.ia.bind(a));c.on(b,d.PAUSED,a.Kb.bind(a));c.on(b,d.RESUMED,a.cc.bind(a));c.on(b,d.CLICK,a.V.bind(a));c.on(b,d.SKIPPED,a.ba.bind(a));c.on(b,d.IMPRESSION,a.Y.bind(a));c.on(b,d.COMPLETE,a.Ra.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.Fc.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.hc.bind(a))},MQ=function(a,b){const c=b?a.Oa.create(b.getErrorCode()):null;a.m.onError(new _.G(1,9,10003,{errorType:c},b))},NQ=function(a,
|
|
4
|
+
b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.I,a.H)});a.m.trigger(new _.C(b,d))},OQ=function(a){a.G=null;NQ(a,_.tc);a.B&&a.m.getSurface().hide(a.B)},PQ=function(a){_.yo(a.F,{visibility:"visible"})},RQ=function(a){return _.w(function*(){a.S.initialize();const b=!!a.m.getConfiguration().muted;(yield a.O.canPlay(b))||KQ(a)?QQ(a):(NQ(a,_.Oc),a.g.warn(_.ka))})},SQ=function(a,b){return _.w(function*(){a.S.initialize();yield b.play();QQ(a)})},QQ=function(a){a.a.init(a.F.offsetWidth,a.F.offsetHeight,
|
|
5
|
+
google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},TQ=function(){return!window.google||!google.ima||!google.ima.AdsLoader},X=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}hb(){return"Google IMA SDK"}ib(){return google.ima.VERSION}ob(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}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()}Nb(){return this.f?
|
|
6
|
+
this.f.getIsBumper():!1}xb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Fe&&typeof b[d].clickThroughUrl===_.Pf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}lb(){return this.a.getVastMediaWidth()}kb(){return this.a.getVastMediaHeight()}Za(){return this.a.getVastMediaBitrate()}Ua(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Bb(){return this.f?this.f.getTimeOffset():0}Cb(){return this.f?this.f.getAdPosition():
|
|
7
|
+
1}nb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.nb;X.prototype.getPositionInSequence=X.prototype.Cb;
|
|
8
|
+
X.prototype.getPodTimeOffset=X.prototype.Bb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ua;X.prototype.getMediaBitrate=X.prototype.Za;X.prototype.getMediaHeight=X.prototype.kb;X.prototype.getMediaWidth=X.prototype.lb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.xb;X.prototype.isBumper=X.prototype.Nb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;
|
|
9
|
+
X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.ob;X.prototype.getAdManagerVersion=X.prototype.ib;X.prototype.getAdManagerName=X.prototype.hb;var UQ=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 VQ=class{constructor(a){this.a=a}getCuePoints(){return this.a}Eb(){return 0<=this.a.indexOf(0)||0===this.a.length}Db(){return 0<=this.a.indexOf(-1)}};VQ.prototype.hasPostroll=VQ.prototype.Db;VQ.prototype.hasPreroll=VQ.prototype.Eb;VQ.prototype.getCuePoints=VQ.prototype.getCuePoints;var WQ=class{constructor(a){this.m=a;this.F=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.Rg(a.ima||{});this.L=a=_.Qg({disableCustomPlayback:!1},a);this.B=this.m.kc("ima").Bc();this.S=this.m.kc("ima").h;this.A=this.m.kc("ima").a;this.O=new _.tu;this.g=new _.R("clpp.ima");this.j=this.a=null;this.f=new _.gn;this.K=!1;this.C=new _.Bs;this.Oa=new UQ;this.G=null;this.R=this.J=this.H=this.I=!1;this.M=this.l=null;{a=this.C;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.A,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
10
|
+
this.fc.bind(this));a.on(this.A,b,this.ec.bind(this));a.on(this.m,_.Ud,this.jc.bind(this))}}fc(a){this.a=a.getAdsManager(this.F,JQ(this));this.a.isCustomPlaybackUsed()&&!KQ(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.G(1,9,10002)),this.h()):(this.j=new _.ru(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.l=new VQ(a),this.m.trigger(new _.C(_.wc,
|
|
11
|
+
{adsTimeline:this.l})),LQ(this));this.f.resolve()}ec(a){MQ(this,a.getError());this.f.resolve()}Dc(a){const b=this;return _.w(function*(){b.J=!0;if(KQ(b)){b.M=b.m.getPosition();yield b.m.detach();var c=b.m;c.a&&c.a.stopForwardingEventsTo(c)}else yield b.m.pause(),_.yo(b.F,{visibility:_.ae});NQ(b,_.cc,a);b.j.start()})}Pa(){const a=this;return _.w(function*(){a.a.start()})}Z(a){a.getAd().isLinear()?NQ(this,_.mc,a):(this.a.discardAdBreak(),this.I||(this.I=!0,this.m.play()))}da(a){this.G=a.getAd().getDuration();
|
|
12
|
+
NQ(this,_.sc,a);this.m.getSurface().show(this.B)}Ya(a){a=a.getAdData();MQ(this,a?a.adError:null);OQ(this)}bc(a){NQ(this,_.pc,a)}Qa(a){NQ(this,_.ec,a)}X(a){NQ(this,_.hc,a)}wb(a){NQ(this,_.nc,a)}ia(a){NQ(this,_.uc,a)}Kb(a){NQ(this,_.oc,a)}cc(a){NQ(this,_.qc,a)}V(a){this.pause();NQ(this,_.fc,a)}ba(a){NQ(this,_.rc,a);OQ(this)}Y(a){NQ(this,_.lc,a)}Ra(a){NQ(this,_.gc,a);OQ(this)}Fc(){const a=this;return _.w(function*(){a.I=!0;if(KQ(a)&&null!==a.M){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.Iq(a.m);a.H||
|
|
13
|
+
(yield a.m.seek(a.M))}else{if(!a.J)return a.m.play();PQ(a)}a.J=!1;a.j&&a.j.stop();a.H||(yield a.m.play());NQ(a,_.dc)})}hc(){this.R=!0}jc(){this.H=!0;this.A.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.L;try{if(typeof c.adTagUrl!==_.Pf)throw new _.G(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.O.canPlay(!1);const d=yield a.O.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=
|
|
14
|
+
c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.A.getSettings().setAutoPlayAdBreaks(!1);a.A.requestAds(e);return a.f})}start(a){const b=this;return _.w(function*(){b.a&&b.l&&!b.K?b.l.Eb()?yield RQ(b):yield SQ(b,a):yield a.play()})}w(){}o(){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():1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.G)return-1;const a=this.a.getRemainingTime();
|
|
15
|
+
return 0>a?0:this.G-a}h(){return(new Promise(a=>{this.K&&this.l&&this.l.Db()&&!this.R?(this.C.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.B&&this.m.getSurface().hide(this.B)}),_.sh(this.C,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.A.contentComplete()})).then(()=>{PQ(this);this.C.release();this.j&&(this.j.stop(),this.j=null);this.a&&(this.a.destroy(),this.a=null)})}};
|
|
16
|
+
WQ.prototype.getPosition=WQ.prototype.getPosition;WQ.prototype.setVolume=WQ.prototype.setVolume;WQ.prototype.getVolume=WQ.prototype.getVolume;WQ.prototype.skip=WQ.prototype.skip;WQ.prototype.pause=WQ.prototype.pause;WQ.prototype.resume=WQ.prototype.resume;var XQ=class extends _.Bu{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(TQ())return a.onError(new _.G(1,9,1E4));this.f=_.wo(_.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(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
|
|
17
|
+
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Cg(){return this.a}Ag(){return this.h}Bc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",XQ);XQ.prototype.getAdContainer=XQ.prototype.Bc;XQ.prototype.getAdDisplayContainer=XQ.prototype.Ag;XQ.prototype.getAdsLoader=XQ.prototype.Cg;XQ.Id="ima";XQ.isSdkMissing=TQ;_.rq(new class{create(){return new XQ}});_.uo(new class{constructor(){this.f=new _.R(IQ)}name(){return IQ}a(a,b){return a.namespace()===_.kd?!1:TQ()?(this.f.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new WQ(a)}});};f.call(g, window);
|