@castlabs/prestoplay 6.20.0 → 6.21.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 +35 -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 +109 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +553 -550
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +78 -77
- package/cjs/cl.externs.js +81 -97
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +22 -24
- package/cjs/cl.mse.js +305 -305
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +70 -69
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +9 -0
- package/cjs/cl.youbora.js +38 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +471 -468
- package/cl.crypto.js +8 -8
- package/cl.dash.js +74 -72
- package/cl.externs.js +71 -99
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +16 -17
- package/cl.mse.js +276 -276
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -0
- package/cl.youbora.js +27 -15
- package/package.json +3 -1
- package/typings.d.ts +123 -24
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.h.append(c)},
|
|
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 $R="Unsupported unit",aS="clpp-text-plain",bS="clpp-text-ttml",cS="clpp.htmlcue.HtmlTextDisplayer",dS="initial",eS=function(a){return _.Vh(a,{ef:(b,c)=>b.yc(c)})},fS=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)},gS=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},hS=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},jS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>iS[c]);return a},lS=function(a,b){kS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{kS(a,c)})},kS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},mS=function(a,b){return 0===a?"0":a+b},nS=function(a,b){return 1>Math.abs(a-b)||a<b},oS=function(a,b){return a<b&&1<Math.abs(a-b)},pS=function(a,b){return a>b&&1<Math.abs(a-b)},qS=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},sS=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 rS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},tS=function(a){return new rS(a.left,a.f,a.top,a.a,a.height,a.width)},uS=function(a,b){return b.some(c=>oS(a.left,c.f)&&pS(a.f,c.left)&&oS(a.top,c.a)&&pS(a.a,c.top))},vS=function(a,b){return qS(a.top,b.top)&&nS(a.a,b.a)&&qS(a.left,b.left)&&nS(a.f,b.f)},wS=function(a,b,c){switch(c){case "+x":return oS(a.left,b.left);case "-x":return pS(a.f,b.f);case "+y":return oS(a.top,b.top);case "-y":return pS(a.a,b.a);default:throw Error("Unknown axis");}},xS=function(a){return a.f.writingMode===_.ft},yS=
|
|
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 xS(a)?b:c},zS=function(a){switch(a.f.writingMode){case _.ft:return"horizontal-tb";case _.hg:return _.hg;case _.ig:return _.ig;default:throw Error("Unknown writing mode");}},AS=function(a){switch(a.f.positionAlign){case _.ge:return _.de;case "auto":case _.bd:return _.et;case _.he:return _.xf}return a.f.textAlign},BS=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
|
|
6
|
+
_.t)switch(b){case _.ge:return a.f.position;case "auto":case _.bd:return a.f.position-a.f.size/2;case _.he:return a.f.position-a.f.size}return 0},CS=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.de:case _.de:return _.ge;case _.et:return _.bd;case _.xf:case _.xf:return _.he}return a.f.positionAlign},FS=function(a,b,c){return(DS(a)||ES(a))&&_.Xg(c)?mS(c,_.qf):DS(a)&&_.B(c)?mS(0,_.qf):xS(a)&&_.Xg(b)?mS(b,"%"):dS},GS=function(a,b,c){return xS(a)&&_.Xg(c)?mS(c,_.qf):(DS(a)||ES(a))&&_.Xg(b)?
|
|
7
|
+
mS(b,"%"):dS},ES=function(a){return a.f.writingMode===_.ig},DS=function(a){return a.f.writingMode===_.hg},HS=function(a,b){if(a.j)switch(b.writingMode){case _.ft:return["-y"];case _.hg:return["+x"];case _.ig:return["-x"]}a=[];switch(b.writingMode){case _.ft:a=["+y","-y"];break;case _.hg:a=["+x","-x"];break;case _.ig:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},IS=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=sS(a.l.a)},JS=function(a,b){IS(a.h);a.l.unshift(b);
|
|
8
|
+
for(const c of a.l)a.h.append(c)},KS=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.mt)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error($R);},MS=function(a,b,c,d){const e=document.createElement(_.Qf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);LS(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},NS=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)},OS=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},PS=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.o=[]}},LS=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())},QS=function(a){a=_.Qg(a.htmlcue||{});_.B(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.B(a.enableResizeObserver)&&(a.enableResizeObserver=
|
|
11
|
+
!0);return a},WS=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.zo)if(a.J=c,c=RS(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,SS(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Ws(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 _.pg:g="clpp-text-vtt";
|
|
12
|
+
break;case _.Xf:g=bS;break;case _.dt:g=aS}g&&!f.classList.contains(g)&&_.Uo(f,g);f=sS(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{kS({fontSize:TS(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.pg;var h=d.payloadType===_.Xf;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new US(d.region,
|
|
13
|
+
{}),c.B.set(d.region.id,f),JS(c.a,f)));d=new VS(d,c.L,e);f?JS(f,d):JS(c.a,d)}}}}},XS=function(a){SS(a);a.J=null;a.o=null;a.f=[]},YS=function(a,b){return a.startTime<=b&&a.endTime>b},RS=function(a,b){var c=gS(a.f,d=>YS(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&YS(a.f[d-1],b);)d--;for(;c+1<a.f.length&&YS(a.f[c+1],b);)c++;return{start:d,end:c}}},SS=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(bS);
|
|
14
|
+
b.classList.remove(aS);a=a.a;IS(a.h);a.l=[]}},TS=function(a,b){const c=sS(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`},bT=class{parse(a){a={input:a};const b=_.Wo(_.Ed),c=[];let d=b;for(var e;null!==(e=hS(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=ZS[f];h?(h=_.Wo(h),(f=$S[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(jS(e)));return b}},ZS={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},$S={v:"voice",lang:"lang"},aT={rt:"ruby"},iS={"\x26amp;":"\x26",
|
|
16
|
+
"\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var rS=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 VS=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)_.Uo(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===_.Xf){var c=_.Wo(_.Ed);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.pg?b=(new bT).parse(b.payload):(c=_.Wo(_.Ed),c.textContent=b.payload,b=c);_.Uo(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Uo(b,d);kS({writingMode:zS(this)},b);var d=b;this.a.appendChild(d);_.Uo(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Uo(this.a,`clpp-text-wrapper__${e}`);_.B(this.f.line)&&(this.f.lineInterpretation=_.gt,this.f.line=xS(this)?-1:0);e=zS(this);kS({writingMode:e,webkitWritingMode:e,direction:dS,textAlign:AS(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=BS(this,CS(this));kS({position:"absolute",left:FS(this,e,null),right:ES(this)&&_.B(null)?mS(0,_.qf):dS,top:GS(this,e,null),width:xS(this)?mS(this.f.size,"%"):dS,height:DS(this)||ES(this)?mS(this.f.size,"%"):dS},this.a);b=this.f;a=xS(this)?a.height:a.width;c=yS(this);if(b.lineInterpretation===_.gt){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 _.bd:g-=f/2;break;case _.Sd:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}ES(this)&&(f=a-f-c);a=f;kS({left:FS(this,e,a),right:ES(this)&&_.B(a)?mS(0,_.qf):dS,top:GS(this,e,a)},this.a)}lS(this.C,d)}}o(){return _.Wo(_.Ed)}};var dT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=sS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.Zd;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=sS(a.a);var d=HS(this,a.f),e=yS(a);const g=tS(c);let h=null,k=0;for(const l of d){for(;wS(c,this.a,l)||vS(c,this.a)&&uS(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||vS(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=tS(c),k=d);c=tS(g)}c=h||g}kS({top:mS(c.top-this.a.top,_.qf),bottom:mS(this.a.a-c.a,_.qf),left:mS(c.left-this.a.left,_.qf),right:mS(this.a.f-c.f,_.qf),height:mS(c.height,_.qf),width:mS(c.width,_.qf)},a.a)}b.style.visibility="visible";this.h.push(sS(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=_.Wo(_.Ed);_.Uo(a,this.w);this.id&&(a.id=this.id);return a}};var US=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 _.mt:b=b.width/100*a.width;break a;default:throw Error($R);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.mt)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error($R);d=a.height;const e=KS(this,d,a.height);kS(this.B,this.a);kS({left:mS(c,_.qf),top:mS(e,_.qf),width:mS(b,
|
|
21
|
+
_.qf),height:mS(d,_.qf)},this.a);this.f.writingMode&&kS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&kS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Uo(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.mt:f=f.height/100*a.height;break a;case 2:f=f.height;c=new VS(new _.jt(0,1,"Lorem ipsum",_.dt),{},{});b=c.a;this.a.appendChild(b);c.init(sS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error($R);}a=KS(this,f,a.height);kS({top:mS(a,_.qf),height:mS(f,_.qf)},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 _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=MS(this,this.h,this.j);this.f=MS(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=NS(this,a);if(OS(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=[],PS(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 _.Yu{constructor(a){super(a);this.g=new _.S(cS);this.m=a;this.L=QS(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 _.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 _.pk(()=>{WS(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=fS(this.f,eS(a));this.o=null;WS(this,!1)}}h(){null==this.j||WS(this,!0)}destroy(){const a=this;return _.x(function*(){null!=a.j&&(XS(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;WS(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.wb(.25),this.L.enableResizeObserver&&this.A.start(),WS(this,!0)):(this.G.stop(),this.A.stop(),XS(this)))}S(){WS(this,!0)}};_.z(cS,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&&!_.Fk()}create(a){return new gT(a)}};_.z("clpp.htmlcue.HtmlCueComponent",class extends _.Au{f(){_.co(_.$d,new hT)}a(){_.ao.has(_.$d)&&(_.ao.delete(_.$d),_.bo.info("Removed factory: 'html'"))}id(){return _.Rf}});};f.call(g, window);
|
package/cl.ima.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
_.Pc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},
|
|
3
|
-
c.on(b,d.FIRST_QUARTILE,a.
|
|
4
|
-
|
|
5
|
-
a.
|
|
6
|
-
this.f.getIsBumper():!1}
|
|
7
|
-
1}
|
|
8
|
-
W.prototype.getPodTimeOffset=W.prototype.Bb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.
|
|
9
|
-
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.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;W.prototype.getTechnology=W.prototype.
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
a.f
|
|
15
|
-
this.a.
|
|
16
|
-
|
|
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)}Fg(){return this.a}Dg(){return this.h}zc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",pR);pR.prototype.getAdContainer=pR.prototype.zc;pR.prototype.getAdDisplayContainer=pR.prototype.Dg;pR.prototype.getAdsLoader=pR.prototype.Fg;pR.Id="ima";pR.isSdkMissing=lR;_.Hq(new class{create(){return new pR}});_.Ko(new class{constructor(){this.f=new _.R(aR)}name(){return aR}a(a,b){return a.namespace()===_.jd?!1:lR()?(this.f.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new oR(a)}});};f.call(g, window);
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JR="clpp.ima.AdsManagerFactory",KR=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},LR=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.tk()},MR=function(a){const b=a.a,c=a.J,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Sa.bind(a));c.on(b,d.LOADED,a.Y.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.hc.bind(a));c.on(b,d.STARTED,a.ba.bind(a));c.on(b,d.LOG,a.Va.bind(a));c.on(b,d.AD_PROGRESS,a.Kb.bind(a));c.on(b,d.AD_BUFFERING,a.Ta.bind(a));
|
|
3
|
+
c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.Ja.bind(a));c.on(b,d.THIRD_QUARTILE,a.ca.bind(a));c.on(b,d.PAUSED,a.xb.bind(a));c.on(b,d.RESUMED,a.bc.bind(a));c.on(b,d.CLICK,a.S.bind(a));c.on(b,d.SKIPPED,a.Z.bind(a));c.on(b,d.IMPRESSION,a.X.bind(a));c.on(b,d.COMPLETE,a.Ua.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.jc.bind(a))},NR=function(a,b){const c=b?a.ga.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},OR=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d=
|
|
4
|
+
{ad:new W(c,a.G,a.F)});a.m.trigger(new _.E(b,d))},PR=function(a){a.B=null;OR(a,_.sc);a.m.getSurface().hide(a.O)},QR=function(a){_.Vo(a.A,{visibility:"visible"})},SR=function(a){return _.x(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||LR(a)?RR(a):(OR(a,_.Nc),a.g.warn(_.ia))})},TR=function(a,b){return _.x(function*(){a.R.initialize();yield b.play();RR(a)})},RR=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();
|
|
5
|
+
a.M=!0},UR=function(){return!window.google||!google.ima||!google.ima.AdsLoader},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}kb(){return"Google IMA SDK"}lb(){return google.ima.VERSION}pb(){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}nb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ce&&typeof b[d].clickThroughUrl===_.Of);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}bb(){return this.a.getVastMediaWidth()}ab(){return this.a.getVastMediaHeight()}Na(){return this.a.getVastMediaBitrate()}Oa(){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}cb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.cb;W.prototype.getPositionInSequence=W.prototype.Cb;
|
|
8
|
+
W.prototype.getPodTimeOffset=W.prototype.Bb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Oa;W.prototype.getMediaBitrate=W.prototype.Na;W.prototype.getMediaHeight=W.prototype.ab;W.prototype.getMediaWidth=W.prototype.bb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.nb;W.prototype.isBumper=W.prototype.Nb;W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;
|
|
9
|
+
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.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;W.prototype.getTechnology=W.prototype.pb;W.prototype.getAdManagerVersion=W.prototype.lb;W.prototype.getAdManagerName=W.prototype.kb;var VR=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 WR=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)}};WR.prototype.hasPostroll=WR.prototype.Db;WR.prototype.hasPreroll=WR.prototype.Eb;WR.prototype.getCuePoints=WR.prototype.getCuePoints;var YR=class{constructor(a){var b=a.Qc("ima");if(!b)throw Error("IMA plugin not created.");var c=b.zc(),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.A=e;a=this.m.getConfiguration();a=_.Qg(a.ima||{});this.I=a=_.Pg({disableCustomPlayback:!1},a);this.O=c;this.R=d;this.w=b;this.L=new _.Tu;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.Cn;this.M=!1;this.J=new _.bt;this.ga=new VR;
|
|
10
|
+
this.B=null;this.H=this.F=this.G=!1;this.K=this.C=null;c=this.J;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.ec.bind(this));c.on(this.w,d,this.cc.bind(this));c.on(this.m,_.Td,this.fc.bind(this))}ec(a){this.a=a.getAdsManager(this.A,KR(this));this.a.isCustomPlaybackUsed()&&!LR(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.h()):(this.j=new _.Ru(this.m.getSurface(),
|
|
11
|
+
(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.C=new WR(a),this.m.trigger(new _.E(_.vc,{adsTimeline:this.C})),MR(this));this.f.resolve()}cc(a){NR(this,a.getError());this.f.resolve()}hc(a){const b=this;return _.x(function*(){b.H=!0;if(LR(b)){b.K=b.m.getPosition();yield b.m.detach();var c=b.m;c.a&&c.a.stopForwardingEventsTo(c)}else yield b.m.pause(),_.Vo(b.A,{visibility:_.Zd});OR(b,_.bc,a);b.j.start()})}Sa(){const a=this;return _.x(function*(){a.a.start()})}Y(a){a.getAd().isLinear()?
|
|
12
|
+
OR(this,_.kc,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ba(a){this.B=a.getAd().getDuration();OR(this,_.rc,a);this.m.getSurface().show(this.O)}Va(a){a=a.getAdData();NR(this,a?a.adError:null);PR(this)}Kb(a){OR(this,_.nc,a)}Ta(a){OR(this,_.dc,a)}V(a){OR(this,_.gc,a)}Ja(a){OR(this,_.lc,a)}ca(a){OR(this,_.tc,a)}xb(a){OR(this,_.mc,a)}bc(a){OR(this,_.oc,a)}S(a){this.pause();OR(this,_.ec,a)}Z(a){OR(this,_.qc,a);PR(this)}X(a){OR(this,_.jc,a)}Ua(a){OR(this,_.fc,a);PR(this)}jc(){const a=
|
|
13
|
+
this;return _.x(function*(){a.G=!0;if(LR(a)&&null!==a.K){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.ir(a.m);a.F||(yield a.m.seek(a.K))}else{if(!a.H)return a.m.play();QR(a)}a.H=!1;a.j&&a.j.stop();a.F||(yield a.m.play());OR(a,_.cc)})}fc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.I;try{if(typeof c.adTagUrl!==_.Of)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(),
|
|
14
|
+
a.f;b=yield a.L.canPlay(!1);const d=yield a.L.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})}start(a){const b=this;return _.x(function*(){b.a&&b.C&&!b.M?b.C.Eb()?yield SR(b):yield TR(b,a):yield a.play()})}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():1}setVolume(a){this.a&&
|
|
15
|
+
this.a.setVolume(a)}getPosition(){if(!this.a||null===this.B)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.B-a}h(){this.a&&(this.a.destroy(),this.a=null);QR(this);this.J.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};YR.prototype.getPosition=YR.prototype.getPosition;YR.prototype.setVolume=YR.prototype.setVolume;YR.prototype.getVolume=YR.prototype.getVolume;YR.prototype.skip=YR.prototype.skip;YR.prototype.pause=YR.prototype.pause;YR.prototype.resume=YR.prototype.resume;var ZR=class extends _.av{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(UR())return a.onError(new _.I(1,9,1E4));this.f=_.To(_.Ed,{"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(_.pa);this.a.getSettings().setPlayerVersion(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
|
|
16
|
+
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Ig(){return this.a}Gg(){return this.h}zc(){return this.f}id(){return"ima"}};_.z("clpp.ima.ImaPlugin",ZR);ZR.prototype.getAdContainer=ZR.prototype.zc;ZR.prototype.getAdDisplayContainer=ZR.prototype.Gg;ZR.prototype.getAdsLoader=ZR.prototype.Ig;ZR.Id="ima";ZR.isSdkMissing=UR;_.Qq(new class{create(){return new ZR}});_.Ro(new class{constructor(){this.f=new _.S(JR)}name(){return JR}a(a,b){return a.namespace()===_.jd?!1:UR()?(this.f.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new YR(a)}});};f.call(g, window);
|