@castlabs/prestoplay 6.17.1 → 6.18.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 +30 -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 +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +566 -558
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +75 -74
- package/cjs/cl.externs.js +46 -46
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +71 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +311 -311
- 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 +15 -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 +69 -69
- package/cjs/cl.ttml.js +28 -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 +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +456 -450
- package/cl.crypto.js +8 -8
- package/cl.dash.js +70 -69
- package/cl.externs.js +46 -46
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +72 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +274 -273
- 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.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/package.json +2 -2
- package/typings.d.ts +37 -3
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
|
-
_.t)switch(b){case _.
|
|
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 _.x(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 KQ="Unsupported unit",LQ="clpp-text-plain",MQ="clpp-text-ttml",NQ="clpp.htmlcue.HtmlTextDisplayer",OQ="initial",PQ=function(a){return _.Eh(a,{af:(b,c)=>b.zc(c)})},QQ=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)},RQ=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},SQ=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},UQ=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>TQ[c]);return a},WQ=function(a,b){VQ(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{VQ(a,c)})},VQ=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},XQ=function(a,b){return 0===a?"0":a+b},YQ=function(a,b){return 1>Math.abs(a-b)||a<b},ZQ=function(a,b){return a<b&&1<Math.abs(a-b)},$Q=function(a,b){return a>b&&1<Math.abs(a-b)},aR=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},cR=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 bR(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},dR=function(a){return new bR(a.left,a.f,a.top,a.a,a.height,a.width)},eR=function(a,b){return b.some(c=>ZQ(a.left,c.f)&&$Q(a.f,c.left)&&ZQ(a.top,c.a)&&$Q(a.a,c.top))},fR=function(a,b){return aR(a.top,b.top)&&YQ(a.a,b.a)&&aR(a.left,b.left)&&YQ(a.f,b.f)},gR=function(a,b,c){switch(c){case "+x":return ZQ(a.left,b.left);case "-x":return $Q(a.f,b.f);case "+y":return ZQ(a.top,b.top);case "-y":return $Q(a.a,b.a);default:throw Error("Unknown axis");}},hR=function(a){return a.f.writingMode===_.xs},iR=
|
|
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 hR(a)?b:c},jR=function(a){switch(a.f.writingMode){case _.xs:return"horizontal-tb";case _.ig:return _.ig;case _.jg:return _.jg;default:throw Error("Unknown writing mode");}},kR=function(a){switch(a.f.positionAlign){case _.ke:return _.he;case "auto":case _.ad:return _.ws;case _.me:return _.zf}return a.f.textAlign},lR=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
|
|
6
|
+
_.t)switch(b){case _.ke:return a.f.position;case "auto":case _.ad:return a.f.position-a.f.size/2;case _.me:return a.f.position-a.f.size}return 0},mR=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.he:case _.he:return _.ke;case _.ws:return _.ad;case _.zf:case _.zf:return _.me}return a.f.positionAlign},pR=function(a,b,c){return(nR(a)||oR(a))&&_.Xg(c)?XQ(c,_.sf):nR(a)&&_.A(c)?XQ(0,_.sf):hR(a)&&_.Xg(b)?XQ(b,"%"):OQ},qR=function(a,b,c){return hR(a)&&_.Xg(c)?XQ(c,_.sf):(nR(a)||oR(a))&&_.Xg(b)?
|
|
7
|
+
XQ(b,"%"):OQ},oR=function(a){return a.f.writingMode===_.jg},nR=function(a){return a.f.writingMode===_.ig},rR=function(a,b){if(a.j)switch(b.writingMode){case _.xs:return["-y"];case _.ig:return["+x"];case _.jg:return["-x"]}a=[];switch(b.writingMode){case _.xs:a=["+y","-y"];break;case _.ig:a=["+x","-x"];break;case _.jg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},sR=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=cR(a.l.a)},tR=function(a,b){sR(a.h);a.l.unshift(b);
|
|
8
|
+
for(const c of a.l)a.h.append(c)},uR=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.Es)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(KQ);},wR=function(a,b,c,d){const e=document.createElement(_.Sf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);vR(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},xR=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)},yR=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},zR=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.o=[]}},vR=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())},AR=function(a){a=_.Qg(a.htmlcue||{});_.A(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.A(a.enableResizeObserver)&&(a.enableResizeObserver=
|
|
11
|
+
!0);return a},GR=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Zn)if(a.J=c,c=BR(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,CR(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.ns(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 _.ug:g="clpp-text-vtt";
|
|
12
|
+
break;case _.Zf:g=MQ;break;case _.vs:g=LQ}g&&!f.classList.contains(g)&&_.vo(f,g);f=cR(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{VQ({fontSize:DR(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.ug;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 ER(d.region,
|
|
13
|
+
{}),c.B.set(d.region.id,f),tR(c.a,f)));d=new FR(d,c.L,e);f?tR(f,d):tR(c.a,d)}}}}},HR=function(a){CR(a);a.J=null;a.o=null;a.f=[]},IR=function(a,b){return a.startTime<=b&&a.endTime>b},BR=function(a,b){var c=RQ(a.f,d=>IR(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&IR(a.f[d-1],b);)d--;for(;c+1<a.f.length&&IR(a.f[c+1],b);)c++;return{start:d,end:c}}},CR=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(MQ);
|
|
14
|
+
b.classList.remove(LQ);a=a.a;sR(a.h);a.l=[]}},DR=function(a,b){const c=cR(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===_.t&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*a)}px`},MR=class{parse(a){a={input:a};const b=_.xo(_.Gd),c=[];let d=b;for(var e;null!==(e=SQ(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=JR[f];h?(h=_.xo(h),(f=KR[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||LR[g.localName]&&LR[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(UQ(e)));return b}},JR={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},KR={v:"voice",lang:"lang"},LR={rt:"ruby"},TQ={"\x26amp;":"\x26",
|
|
16
|
+
"\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var bR=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 NR=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 FR=class extends NR{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)_.vo(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=_.xo(_.Gd);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.ug?b=(new MR).parse(b.payload):(c=_.xo(_.Gd),c.textContent=b.payload,b=c);_.vo(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.vo(b,d);VQ({writingMode:jR(this)},b);var d=b;this.a.appendChild(d);_.vo(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.vo(this.a,`clpp-text-wrapper__${e}`);_.A(this.f.line)&&(this.f.lineInterpretation=_.ys,this.f.line=hR(this)?-1:0);e=jR(this);VQ({writingMode:e,webkitWritingMode:e,direction:OQ,textAlign:kR(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=lR(this,mR(this));VQ({position:"absolute",left:pR(this,e,null),right:oR(this)&&_.A(null)?XQ(0,_.sf):OQ,top:qR(this,e,null),width:hR(this)?XQ(this.f.size,"%"):OQ,height:nR(this)||oR(this)?XQ(this.f.size,"%"):OQ},this.a);b=this.f;a=hR(this)?a.height:a.width;c=iR(this);if(b.lineInterpretation===_.ys){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 _.ad:g-=f/2;break;case _.Ud:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}oR(this)&&(f=a-f-c);a=f;VQ({left:pR(this,e,a),right:oR(this)&&_.A(a)?XQ(0,_.sf):OQ,top:qR(this,e,a)},this.a)}WQ(this.C,d)}}o(){return _.xo(_.Gd)}};var OR=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=cR(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.$d;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=cR(a.a);var d=rR(this,a.f),e=iR(a);const g=dR(c);let h=null,k=0;for(const l of d){for(;gR(c,this.a,l)||fR(c,this.a)&&eR(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||fR(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=dR(c),k=d);c=dR(g)}c=h||g}VQ({top:XQ(c.top-this.a.top,_.sf),bottom:XQ(this.a.a-c.a,_.sf),left:XQ(c.left-this.a.left,_.sf),right:XQ(this.a.f-c.f,_.sf),height:XQ(c.height,_.sf),width:XQ(c.width,_.sf)},a.a)}b.style.visibility="visible";this.h.push(cR(a.a))}};var PR=class extends NR{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new OR(this);this.j=!0}o(){const a=_.xo(_.Gd);_.vo(a,this.w);this.id&&(a.id=this.id);return a}};var ER=class extends PR{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 _.Es:b=b.width/100*a.width;break a;default:throw Error(KQ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Es)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(KQ);d=a.height;const e=uR(this,d,a.height);VQ(this.B,this.a);VQ({left:XQ(c,_.sf),top:XQ(e,_.sf),width:XQ(b,
|
|
21
|
+
_.sf),height:XQ(d,_.sf)},this.a);this.f.writingMode&&VQ({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&VQ({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.vo(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.Es:f=f.height/100*a.height;break a;case 2:f=f.height;c=new FR(new _.Bs(0,1,"Lorem ipsum",_.vs),{},{});b=c.a;this.a.appendChild(b);c.init(cR(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error(KQ);}a=uR(this,f,a.height);VQ({top:XQ(a,_.sf),height:XQ(f,_.sf)},this.a);this.h=new OR(this,!0);this.j=!0}getId(){return this.f.id}};var QR=class{constructor(a,b){this.g=new _.R("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=wR(this,this.h,this.j);this.f=wR(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=xR(this,a);if(yR(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 _.x(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],zR(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 RR=class extends _.xu{constructor(a){super(a);this.g=new _.R(NQ);this.m=a;this.L=AR(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new QR(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new PR(null,"clpp-text-container",{});this.A=new _.ou(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 _.Tj(()=>{GR(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=QQ(this.f,PQ(a));this.o=null;GR(this,!1)}}h(){null==this.j||GR(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(HR(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;GR(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.kb(.25),this.L.enableResizeObserver&&this.A.start(),GR(this,!0)):(this.G.stop(),this.A.stop(),HR(this)))}Rc(){return this.f}T(){GR(this,!0)}};_.z(NQ,RR);RR.prototype.setTextVisibility=RR.prototype.setTextVisibility;RR.prototype.isTextVisible=RR.prototype.isTextVisible;RR.prototype.remove=RR.prototype.remove;
|
|
26
|
+
RR.prototype.destroy=RR.prototype.destroy;RR.prototype.append=RR.prototype.append;var SR=class{isSupported(a){return!!a.enableHtmlCue&&!_.jk()}create(a){return new RR(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Yt{f(){_.Dn(_.be,new SR)}a(){_.Bn.has(_.be)&&(_.Bn.delete(_.be),_.Cn.info("Removed factory: 'html'"))}id(){return _.Tf}});};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.S.bind(a));c.on(b,d.MIDPOINT,a.
|
|
4
|
-
b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.F,a.C)});a.m.trigger(new _.E(b,d))},
|
|
5
|
-
google.ima.ViewMode.NORMAL);a.a.start();a.H=!0},
|
|
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.j})),
|
|
12
|
-
|
|
13
|
-
(yield a.m.seek(a.J))}else{if(!a.G)return a.m.play();
|
|
14
|
-
c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(e);return a.f})}start(a){const b=this;return _.x(function*(){b.a&&b.j&&!b.H?b.j.
|
|
15
|
-
return 0>a?0:this.B-a}dispose(){return(new Promise(a=>{this.H&&this.j&&this.j.
|
|
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 tQ="clpp.ima.AdsManagerFactory",uQ=function(a){a=a.I;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Pc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.t&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.t&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
|
|
2
|
+
_.Pc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},vQ=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Xj()},wQ=function(a){const b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.ea.bind(a));c.on(b,d.LOADED,a.W.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.cc.bind(a));c.on(b,d.STARTED,a.Z.bind(a));c.on(b,d.LOG,a.Ma.bind(a));c.on(b,d.AD_PROGRESS,a.Va.bind(a));c.on(b,d.AD_BUFFERING,a.la.bind(a));
|
|
3
|
+
c.on(b,d.FIRST_QUARTILE,a.S.bind(a));c.on(b,d.MIDPOINT,a.Na.bind(a));c.on(b,d.THIRD_QUARTILE,a.aa.bind(a));c.on(b,d.PAUSED,a.Oa.bind(a));c.on(b,d.RESUMED,a.lb.bind(a));c.on(b,d.CLICK,a.O.bind(a));c.on(b,d.SKIPPED,a.X.bind(a));c.on(b,d.IMPRESSION,a.T.bind(a));c.on(b,d.COMPLETE,a.Fa.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ec.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.$b.bind(a))},xQ=function(a,b){const c=b?a.ga.create(b.getErrorCode()):null;a.m.onError(new _.H(1,9,10003,{errorType:c},b))},yQ=function(a,
|
|
4
|
+
b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new X(c,a.F,a.C)});a.m.trigger(new _.E(b,d))},zQ=function(a){a.B=null;yQ(a,_.rc);a.o&&a.m.getSurface().hide(a.o)},AQ=function(a){_.wo(a.A,{visibility:"visible"})},CQ=function(a){return _.x(function*(){a.N.initialize();const b=!!a.m.getConfiguration().muted;(yield a.K.canPlay(b))||vQ(a)?BQ(a):(yQ(a,_.Mc),a.g.warn(_.ka))})},DQ=function(a,b){return _.x(function*(){a.N.initialize();yield b.play();BQ(a)})},BQ=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,
|
|
5
|
+
google.ima.ViewMode.NORMAL);a.a.start();a.H=!0},EQ=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}yb(){return"Google IMA SDK"}zb(){return google.ima.VERSION}Fb(){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()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}kc(){return this.f?
|
|
6
|
+
this.f.getIsBumper():!1}Qb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Fe&&typeof b[d].clickThroughUrl===_.Qf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Cb(){return this.a.getVastMediaWidth()}Bb(){return this.a.getVastMediaHeight()}qb(){return this.a.getVastMediaBitrate()}eb(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Rb(){return this.f?this.f.getTimeOffset():0}Sb(){return this.f?this.f.getAdPosition():
|
|
7
|
+
1}Eb(){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.Eb;X.prototype.getPositionInSequence=X.prototype.Sb;
|
|
8
|
+
X.prototype.getPodTimeOffset=X.prototype.Rb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.eb;X.prototype.getMediaBitrate=X.prototype.qb;X.prototype.getMediaHeight=X.prototype.Bb;X.prototype.getMediaWidth=X.prototype.Cb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Qb;X.prototype.isBumper=X.prototype.kc;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;
|
|
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.Fb;X.prototype.getAdManagerVersion=X.prototype.zb;X.prototype.getAdManagerName=X.prototype.yb;var FQ=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 GQ=class{constructor(a){this.a=a}getCuePoints(){return this.a}Tb(){return 0<=this.a.indexOf(0)||0===this.a.length}sb(){return 0<=this.a.indexOf(-1)}};GQ.prototype.hasPostroll=GQ.prototype.sb;GQ.prototype.hasPreroll=GQ.prototype.Tb;GQ.prototype.getCuePoints=GQ.prototype.getCuePoints;var HQ=class{constructor(a){this.m=a;this.A=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.Qg(a.ima||{});this.I=a=_.Pg({disableCustomPlayback:!1},a);this.o=this.m.gc("ima").Ac();this.N=this.m.gc("ima").h;this.l=this.m.gc("ima").a;this.K=new _.qu;this.g=new _.R("clpp.ima");this.h=this.a=null;this.f=new _.dn;this.H=!1;this.w=new _.ts;this.ga=new FQ;this.B=null;this.L=this.G=this.C=this.F=!1;this.J=this.j=null;{a=this.w;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
|
|
10
|
+
this.Ob.bind(this));a.on(this.l,b,this.mb.bind(this));a.on(this.m,_.Vd,this.bc.bind(this))}}Ob(a){this.a=a.getAdsManager(this.A,uQ(this));this.a.isCustomPlaybackUsed()&&!vQ(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.H(1,9,10002)),this.dispose()):(this.h=new _.ou(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.j=new GQ(a),this.m.trigger(new _.E(_.uc,
|
|
11
|
+
{adsTimeline:this.j})),wQ(this));this.f.resolve()}mb(a){xQ(this,a.getError());this.f.resolve()}cc(a){const b=this;return _.x(function*(){b.G=!0;if(vQ(b)){b.J=b.m.getPosition();yield b.m.detach();var c=b.m;c.a&&c.a.stopForwardingEventsTo(c)}else yield b.m.pause(),_.wo(b.A,{visibility:_.$d});yQ(b,_.cc,a);b.h.start()})}ea(){const a=this;return _.x(function*(){a.a.start()})}W(a){a.getAd().isLinear()?yQ(this,_.jc,a):(this.a.discardAdBreak(),this.F||(this.F=!0,this.m.play()))}Z(a){this.B=a.getAd().getDuration();
|
|
12
|
+
yQ(this,_.qc,a);this.m.getSurface().show(this.o)}Ma(a){a=a.getAdData();xQ(this,a?a.adError:null);zQ(this)}Va(a){yQ(this,_.nc,a)}la(a){yQ(this,_.ec,a)}S(a){yQ(this,_.hc,a)}Na(a){yQ(this,_.lc,a)}aa(a){yQ(this,_.sc,a)}Oa(a){yQ(this,_.mc,a)}lb(a){yQ(this,_.oc,a)}O(a){this.pause();yQ(this,_.fc,a)}X(a){yQ(this,_.pc,a);zQ(this)}T(a){yQ(this,_.ic,a)}Fa(a){yQ(this,_.gc,a);zQ(this)}ec(){const a=this;return _.x(function*(){a.F=!0;if(vQ(a)&&null!==a.J){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.tp(a.m);a.C||
|
|
13
|
+
(yield a.m.seek(a.J))}else{if(!a.G)return a.m.play();AQ(a)}a.G=!1;a.h&&a.h.stop();a.C||(yield a.m.play());yQ(a,_.dc)})}$b(){this.L=!0}bc(){this.C=!0;this.l.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.I;try{if(typeof c.adTagUrl!==_.Qf)throw new _.H(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.K.canPlay(!1);const d=yield a.K.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=
|
|
14
|
+
c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(e);return a.f})}start(a){const b=this;return _.x(function*(){b.a&&b.j&&!b.H?b.j.Tb()?yield CQ(b):yield DQ(b,a):yield a.play()})}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.B)return-1;const a=this.a.getRemainingTime();
|
|
15
|
+
return 0>a?0:this.B-a}dispose(){return(new Promise(a=>{this.H&&this.j&&this.j.sb()&&!this.L?(this.w.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.o&&this.m.getSurface().hide(this.o)}),_.qh(this.w,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.l.contentComplete()})).then(()=>{AQ(this);this.w.release();this.h&&(this.h.stop(),this.h=null);this.a&&(this.a.destroy(),this.a=null)})}};
|
|
16
|
+
HQ.prototype.getPosition=HQ.prototype.getPosition;HQ.prototype.setVolume=HQ.prototype.setVolume;HQ.prototype.getVolume=HQ.prototype.getVolume;HQ.prototype.skip=HQ.prototype.skip;HQ.prototype.pause=HQ.prototype.pause;HQ.prototype.resume=HQ.prototype.resume;var IQ=class extends _.Au{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(EQ())return a.onError(new _.H(1,9,1E4));this.f=_.uo(_.Gd,{"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(_.fa);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)}zg(){return this.a}xg(){return this.h}Ac(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",IQ);IQ.prototype.getAdContainer=IQ.prototype.Ac;IQ.prototype.getAdDisplayContainer=IQ.prototype.xg;IQ.prototype.getAdsLoader=IQ.prototype.zg;IQ.Id="ima";IQ.isSdkMissing=EQ;_.dp(new class{create(){return new IQ}});var JQ=class{constructor(){this.a=new _.R(tQ)}name(){return tQ}isSupported(a,b){return a.namespace()===_.kd?!1:EQ()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new HQ(a)}};JQ.prototype.create=JQ.prototype.create;JQ.prototype.isSupported=JQ.prototype.isSupported;JQ.prototype.name=JQ.prototype.name;_.ro(new JQ);};f.call(g, window);
|