@castlabs/prestoplay 6.30.0 → 6.31.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 +247 -179
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +19 -7
- package/cjs/cl.cast.js +120 -120
- package/cjs/cl.conviva.js +31 -31
- package/cjs/cl.core.js +567 -566
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +95 -92
- package/cjs/cl.externs.js +224 -40
- package/cjs/cl.freewheel.js +26 -25
- package/cjs/cl.hls.js +79 -78
- package/cjs/cl.hlssmpte.js +4 -4
- package/cjs/cl.htmlcue.js +19 -19
- package/cjs/cl.ima.js +26 -25
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +352 -350
- package/cjs/cl.muxdata.js +13 -13
- package/cjs/cl.onboard.js +2 -2
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +10 -10
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +16 -16
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +15 -15
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +11 -11
- package/cjs/cl.vr.js +12 -12
- package/cjs/cl.vtt.js +12 -12
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +35 -35
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -6
- package/cl.cast.js +99 -98
- package/cl.conviva.js +26 -26
- package/cl.core.js +413 -412
- package/cl.crypto.js +8 -8
- package/cl.dash.js +87 -84
- package/cl.externs.js +225 -37
- package/cl.freewheel.js +20 -19
- package/cl.hls.js +76 -76
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +20 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +299 -300
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +62 -60
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +55 -55
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +8 -7
- package/typings.d.ts +85 -61
package/cl.htmlcue.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},
|
|
3
|
-
function(a,b){return 1>Math.abs(a-b)||a>b},
|
|
4
|
-
d-e)},
|
|
5
|
-
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return
|
|
6
|
-
_.r)switch(b){case _.me:return a.f.position;case "auto":case _.Xc:return a.f.position-a.f.size/2;case _.ne:return a.f.position-a.f.size}return 0},
|
|
7
|
-
|
|
8
|
-
a.viewportAnchorUnits;if(d===_.
|
|
9
|
-
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},
|
|
10
|
-
a.o=[]}},
|
|
11
|
-
if(b||a.J!==c&&3===a.m.getState())if(a.J=c,c=
|
|
12
|
-
_.Ci(f,g);f=
|
|
13
|
-
c.a.appendChild(d)}}}}},
|
|
14
|
-
b){const c=
|
|
15
|
-
e[1];var g=e[3];var h=
|
|
16
|
-
"\x26nbsp;":"\u00a0"};var
|
|
17
|
-
_.Eg?b=(new
|
|
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
|
-
_.uf),height:
|
|
22
|
-
b=c;f*=b;break a;default:throw Error(
|
|
23
|
-
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],
|
|
24
|
-
this.G=new _.Li(()=>{
|
|
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 BS="Unsupported unit",CS="clpp-text-plain",DS="clpp-text-ttml",ES="clpp.htmlcue.HtmlTextDisplayer",FS="initial",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){return _.ci(a,{bg:(b,c)=>b.Rc(c)})},IS=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)},JS=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},LS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>KS[c]);return a},NS=function(a,b){MS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{MS(a,c)})},MS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},OS=function(a,b){return 0===a?"0":a+b},PS=function(a,b){return 1>Math.abs(a-b)||a<b},QS=function(a,b){return a<b&&1<Math.abs(a-b)},RS=function(a,b){return a>b&&1<Math.abs(a-b)},SS=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},US=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 TS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},VS=function(a){return new TS(a.left,a.f,a.top,a.a,a.height,a.width)},WS=function(a,b){return b.some(c=>QS(a.left,c.f)&&RS(a.f,c.left)&&QS(a.top,c.a)&&RS(a.a,c.top))},XS=function(a,b){return SS(a.top,b.top)&&PS(a.a,b.a)&&SS(a.left,b.left)&&PS(a.f,b.f)},YS=function(a,b,c){switch(c){case "+x":return QS(a.left,b.left);case "-x":return RS(a.f,b.f);case "+y":return QS(a.top,b.top);case "-y":return RS(a.a,b.a);default:throw Error("Unknown axis");}},ZS=function(a){return a.f.writingMode===_.lu},$S=
|
|
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 ZS(a)?b:c},aT=function(a){switch(a.f.writingMode){case _.lu:return"horizontal-tb";case _.wg:return _.wg;case _.xg:return _.xg;default:throw Error("Unknown writing mode");}},bT=function(a){switch(a.f.positionAlign){case _.me:return _.je;case "auto":case _.Xc:return _.ku;case _.ne:return _.Bf}return a.f.textAlign},cT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
|
|
6
|
+
_.r)switch(b){case _.me:return a.f.position;case "auto":case _.Xc:return a.f.position-a.f.size/2;case _.ne:return a.f.position-a.f.size}return 0},dT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Pf:case _.je:return _.me;case _.ku:return _.Xc;case _.Vd:case _.Bf:return _.ne}return a.f.positionAlign},gT=function(a,b,c){return(eT(a)||fT(a))&&_.kh(c)?OS(c,_.uf):eT(a)&&_.z(c)?OS(0,_.uf):ZS(a)&&_.kh(b)?OS(b,"%"):FS},hT=function(a,b,c){return ZS(a)&&_.kh(c)?OS(c,_.uf):(eT(a)||fT(a))&&_.kh(b)?
|
|
7
|
+
OS(b,"%"):FS},fT=function(a){return a.f.writingMode===_.xg},eT=function(a){return a.f.writingMode===_.wg},iT=function(a,b){if(a.j)switch(b.writingMode){case _.lu:return["-y"];case _.wg:return["+x"];case _.xg:return["-x"]}a=[];switch(b.writingMode){case _.lu:a=["+y","-y"];break;case _.wg:a=["+x","-x"];break;case _.xg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},jT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=US(a.l.a)},kT=function(a,b,c){a=a.f;const d=
|
|
8
|
+
a.viewportAnchorUnits;if(d===_.su)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(BS);},mT=function(a,b,c,d){const e=document.createElement(_.Vf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);lT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},nT=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,
|
|
9
|
+
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},oT=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},pT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
|
|
10
|
+
a.o=[]}},lT=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())},qT=function(a){a=_.dh(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},wT=function(a,b){if((b||a.l)&&a.F){var c=a.m.getPosition();
|
|
11
|
+
if(b||a.J!==c&&3===a.m.getState())if(a.J=c,c=rT(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,sT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Bt(a)||void 0};c=a.f.slice(c.start,c.end+1);for(const k of c){c=a;var d=k,e=b,f=c.a.a,g=null;switch(d.payloadType){case _.Eg:g="clpp-text-vtt";break;case _.ig:g=DS;break;case _.ju:g=CS}g&&!f.classList.contains(g)&&
|
|
12
|
+
_.Ci(f,g);f=US(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{MS({fontSize:tT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Eg;var h=d.payloadType===_.ig;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new uT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new vT(d,c.L,e);f?f.appendChild(d):
|
|
13
|
+
c.a.appendChild(d)}}}}},xT=function(a){sT(a);a.J=null;a.o=null;a.f=[]},yT=function(a,b){return a.startTime<=b&&a.endTime>b},rT=function(a,b){var c=GS(a.f,d=>yT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&yT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&yT(a.f[c+1],b);)c++;return{start:d,end:c}}},sT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(DS);b.classList.remove(CS);a=a.a;jT(a.h);a.l=[]}},tT=function(a,
|
|
14
|
+
b){const c=US(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`},CT=class{parse(a){a={input:a};const b=_.Ei(_.Fd),c=[];let d=b;for(var e;null!==(e=JS(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=
|
|
15
|
+
e[1];var g=e[3];var h=zT[f];h?(h=_.Ei(h),(f=AT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||BT[g.localName]&&BT[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(LS(e)));return b}},zT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},AT={v:"voice",lang:"lang"},BT={rt:"ruby"},KS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
|
|
16
|
+
"\x26nbsp;":"\u00a0"};var TS=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 DT=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 vT=class extends DT{constructor(a,b,c){super(a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c}A(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.h)_.Ci(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage=`url("${this.f.backgroundImage}")`,this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.ig){var c=_.Ei(_.Fd);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.Eg?b=(new CT).parse(b.payload):(c=_.Ei(_.Fd),c.textContent=b.payload,b=c);_.Ci(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Ci(b,d);MS({writingMode:aT(this)},b);var d=b;this.a.appendChild(d);_.Ci(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Ci(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.mu,this.f.line=ZS(this)?-1:0);e=aT(this);MS({writingMode:e,webkitWritingMode:e,direction:FS,textAlign:bT(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=cT(this,dT(this));MS({position:"absolute",left:gT(this,e,null),right:fT(this)&&_.z(null)?OS(0,_.uf):FS,top:hT(this,e,null),width:ZS(this)?OS(this.f.size,"%"):FS,height:eT(this)||fT(this)?OS(this.f.size,"%"):FS},this.a);b=this.f;a=ZS(this)?a.height:a.width;c=$S(this);if(b.lineInterpretation===_.mu){var f=c*Math.round(b.line);Math.abs(f)>a&&(f=c*(0>b.line?0:-1));0>f&&(f+=a)}else{f=c/a*100;let g=b.line;switch(b.lineAlign){case _.Xc:g-=f/2;break;case _.Vd:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}fT(this)&&(f=a-f-c);a=f;MS({left:gT(this,e,a),right:fT(this)&&_.z(a)?OS(0,_.uf):FS,top:hT(this,e,a)},this.a)}NS(this.C,d)}}o(){return _.Ei(_.Fd)}};var ET=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=US(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.ce;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=US(a.a);var d=iT(this,a.f),e=$S(a);const g=VS(c);let h=null,k=0;for(const l of d){for(;YS(c,this.a,l)||XS(c,this.a)&&WS(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||XS(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=VS(c),k=d);c=VS(g)}c=h||g}MS({top:OS(c.top-this.a.top,_.uf),bottom:OS(this.a.a-c.a,_.uf),left:OS(c.left-this.a.left,_.uf),right:OS(this.a.f-c.f,_.uf),height:OS(c.height,_.uf),width:OS(c.width,_.uf)},a.a)}b.style.visibility="visible";this.h.push(US(a.a))}};var FT=class extends DT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new ET(this);this.j=!0}o(){const a=_.Ei(_.Fd);_.Ci(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){jT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var uT=class extends FT{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 _.su:b=b.width/100*a.width;break a;default:throw Error(BS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.su)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(BS);d=a.height;const e=kT(this,d,a.height);MS(this.B,this.a);MS({left:OS(c,_.uf),top:OS(e,_.uf),width:OS(b,
|
|
21
|
+
_.uf),height:OS(d,_.uf)},this.a);this.f.writingMode&&MS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&MS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Ci(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.su:f=f.height/100*a.height;break a;case 2:f=f.height;c=new vT(new _.pu(0,1,"Lorem ipsum",_.ju),{},{});b=c.a;this.a.appendChild(b);c.init(US(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error(BS);}a=kT(this,f,a.height);MS({top:OS(a,_.uf),height:OS(f,_.uf)},this.a);this.h=new ET(this,!0);this.j=!0}getId(){return this.f.id}};var GT=class{constructor(a,b){this.g=new _.T("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=mT(this,this.h,this.j);this.f=mT(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=nT(this,a);if(oT(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=[],pT(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 HT=class extends _.Hv{constructor(a){super(a);this.g=new _.T(ES);this.m=a;this.L=qT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new GT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new FT(null,"clpp-text-container",{});this.A=new _.Dv(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 _.Li(()=>{wT(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=IS(this.f,HS(a));this.o=null;wT(this,!1)}}h(){null==this.j||wT(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(xT(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;wT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.Fb(.25),this.L.enableResizeObserver&&this.A.start(),wT(this,!0)):(this.G.stop(),this.A.stop(),xT(this)))}S(){wT(this,!0)}};_.x(ES,HT);HT.prototype.setTextVisibility=HT.prototype.setTextVisibility;HT.prototype.isTextVisible=HT.prototype.isTextVisible;HT.prototype.remove=HT.prototype.remove;HT.prototype.destroy=HT.prototype.destroy;
|
|
26
|
+
HT.prototype.append=HT.prototype.append;var IT=class{a(a){return!!a.enableHtmlCue&&!_.$i()}create(a){return new HT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.zv{install(){_.hs(_.ee,new IT)}uninstall(){_.fs.has(_.ee)&&(_.fs.delete(_.ee),_.gs.info("Removed factory: 'html'"))}id(){return _.Wf}});};f.call(g, window);
|
package/cl.ima.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hS="clpp.ima.AdsManagerFactory",iS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},jS=function(a){a=a.
|
|
2
|
-
_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Nc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},kS=function(a){
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},
|
|
6
|
-
this.j=b;this.h=c}
|
|
7
|
-
this.f.getIsBumper():!1}
|
|
8
|
-
1}
|
|
9
|
-
W.prototype.getSequenceLength=W.prototype.
|
|
10
|
-
W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;W.prototype.getSourceId=W.prototype.
|
|
11
|
-
W.prototype.getTechnology=W.prototype.
|
|
12
|
-
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Rh(){return this.a}Ph(){return this.h}
|
|
13
|
-
this
|
|
14
|
-
(this.h=new _.
|
|
15
|
-
this.
|
|
16
|
-
null!==a.
|
|
17
|
-
a.f;b=yield a
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hS="clpp.ima.AdsManagerFactory",iS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},jS=function(a){a=a.I;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Nc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
|
|
2
|
+
_.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Nc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},kS=function(a){const b=_.Pi()||_.Si()||_.$i();return!1===a.I.disableCustomPlayback&&b},lS=function(a){const b=a.a,c=a.U,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.sc.bind(a));c.on(b,d.LOADED,a.Gb.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.fd.bind(a));c.on(b,d.STARTED,a.Rb.bind(a));c.on(b,d.LOG,a.xc.bind(a));
|
|
3
|
+
c.on(b,d.AD_PROGRESS,a.Hb.bind(a));c.on(b,d.AD_BUFFERING,a.tc.bind(a));c.on(b,d.FIRST_QUARTILE,a.ab.bind(a));c.on(b,d.MIDPOINT,a.Ac.bind(a));c.on(b,d.THIRD_QUARTILE,a.pc.bind(a));c.on(b,d.PAUSED,a.Bc.bind(a));c.on(b,d.RESUMED,a.Dc.bind(a));c.on(b,d.CLICK,a.Ma.bind(a));c.on(b,d.SKIPPED,a.Qb.bind(a));c.on(b,d.IMPRESSION,a.kb.bind(a));c.on(b,d.COMPLETE,a.vc.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.hd.bind(a))},mS=function(a,b){const c=b?a.qc.create(b.getErrorCode()):null;a.m.onError(new _.I(1,9,
|
|
4
|
+
10003,{errorType:c},b))},nS=function(a){return kS(a)&&a.a.isCustomPlaybackUsed()},oS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.K,a.J)});a.m.trigger(new _.H(b,d))},rS=function(a){_.w(function*(){a.N=a.m.getPosition();yield pS(a,3);yield a.m.pause();yield qS(a);a.a.start()})},pS=function(a,b){return _.w(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{a.m.getState()>=b&&(clearInterval(f),
|
|
5
|
+
clearTimeout(e),c())},200)})})},qS=function(a){return _.w(function*(){yield a.m.detach();var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},sS=function(a){a.W=!1;a.H=null;oS(a,_.mc);a.m.getSurface().hide(a.ia)},tS=function(a){_.Di(a.G,{visibility:"visible"})},vS=function(a){_.w(function*(){a.xa.initialize();const b=!!a.m.getConfiguration().muted;(yield a.$.canPlay(b))||nS(a)?uS(a):(oS(a,_.Lc),a.g.warn(_.ja))})},uS=function(a){a.a.init(a.G.offsetWidth,a.G.offsetHeight,google.ima.ViewMode.NORMAL);nS(a)?
|
|
6
|
+
a.I.isVast&&rS(a):a.a.start();a.da=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}bb(){return"Google IMA SDK"}cb(){return google.ima.VERSION}fb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}xb(){return""}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}zb(){return this.f?
|
|
7
|
+
this.f.getIsBumper():!1}Ra(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.He&&typeof b[d].clickThroughUrl===_.Tf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Ua(){return this.a.getVastMediaWidth()}Ta(){return this.a.getVastMediaHeight()}Ba(){return this.a.getVastMediaBitrate()}Ca(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}ob(){return this.f?this.f.getTimeOffset():0}eb(){return this.f?this.f.getAdPosition():
|
|
8
|
+
1}Va(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}yb(){return null}};W.prototype.getVideoElement=W.prototype.yb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
|
|
9
|
+
W.prototype.getSequenceLength=W.prototype.Va;W.prototype.getPositionInSequence=W.prototype.eb;W.prototype.getPodTimeOffset=W.prototype.ob;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ca;W.prototype.getMediaBitrate=W.prototype.Ba;W.prototype.getMediaHeight=W.prototype.Ta;W.prototype.getMediaWidth=W.prototype.Ua;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Ra;W.prototype.isBumper=W.prototype.zb;
|
|
10
|
+
W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;W.prototype.getSourceId=W.prototype.xb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
|
|
11
|
+
W.prototype.getTechnology=W.prototype.fb;W.prototype.getAdManagerVersion=W.prototype.cb;W.prototype.getAdManagerName=W.prototype.bb;var wS=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 xS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Nb(){return 0<=this.a.indexOf(0)||0===this.a.length}Mb(){return 0<=this.a.indexOf(-1)}};xS.prototype.hasPostroll=xS.prototype.Mb;xS.prototype.hasPreroll=xS.prototype.Nb;xS.prototype.getCuePoints=xS.prototype.getCuePoints;var yS=class extends _.Pv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(iS())return a.onError(new _.I(1,9,1E4));this.f=_.Bi(_.Fd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.ra);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
|
|
12
|
+
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Rh(){return this.a}Ph(){return this.h}Sc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",yS);yS.prototype.getAdContainer=yS.prototype.Sc;yS.prototype.getAdDisplayContainer=yS.prototype.Ph;yS.prototype.getAdsLoader=yS.prototype.Rh;yS.Id="ima";yS.isSdkMissing=iS;var zS=class{create(){return new yS}};var AS=class{constructor(a){var b=a.wd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Sc(),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.G=e;a=this.m.getConfiguration();a=_.dh(a.ima||{});this.I=a=_.ch({disableCustomPlayback:!1},a);this.ia=c;this.xa=d;this.C=b;this.$=new _.Fv;this.g=new _.T("clpp.ima");this.a=null;this.X=!1;this.l=null;this.f=new _.Gl;this.da=!1;this.U=new _.Lt;
|
|
13
|
+
this.qc=new wS;this.H=null;this.F=this.W=!1;this.M=1;this.R=this.J=this.K=!1;this.N=this.S=null;this.L=!0;c=this.U;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.C,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.$c.bind(this));c.on(this.C,d,this.Zc.bind(this));c.on(this.m,_.Wd,this.dd.bind(this))}$c(a){this.a=a.getAdsManager(this.G,jS(this));this.a.isCustomPlaybackUsed()&&!kS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.I(1,
|
|
14
|
+
9,10002)),this.w()):(this.setMuted(this.F),this.h(this.M),this.l=new _.Dv(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.S=new xS(a),this.m.trigger(new _.H(_.pc,{adsTimeline:this.S})),lS(this));this.f.resolve()}Zc(a){mS(this,a.getError());this.f.resolve()}fd(a){this.R=!0;nS(this)||(this.m.pause(),_.Di(this.G,{visibility:_.ce}));oS(this,_.Tb,a);this.l.start()}sc(){nS(this)?rS(this):this.a.start()}Gb(a){a.getAd().isLinear()?
|
|
15
|
+
oS(this,_.cc,a):(this.a.discardAdBreak(),this.K||(this.K=!0,this.m.play()))}Rb(a){this.W=!0;this.L=!1;this.H=a.getAd().getDuration();oS(this,_.lc,a);this.m.getSurface().show(this.ia)}xc(a){a=a.getAdData();mS(this,a?a.adError:null);sS(this)}Hb(a){oS(this,_.ic,a)}tc(a){oS(this,_.Vb,a)}ab(a){oS(this,_.Yb,a)}Ac(a){oS(this,_.dc,a)}pc(a){oS(this,_.nc,a)}Bc(a){this.L=!0;oS(this,_.gc,a)}Dc(a){this.L=!1;oS(this,_.jc,a)}Ma(a){this.pause();oS(this,_.Wb,a)}Qb(a){oS(this,_.kc,a);sS(this)}kb(a){oS(this,_.bc,a)}vc(a){oS(this,
|
|
16
|
+
_.Xb,a);sS(this)}hd(){const a=this;return _.w(function*(){a.K=!0;if(nS(a)&&null!==a.N){const c=a.m.getVolume(),d=a.m.isMuted();var b=a.m;b.a&&b.a.forwardEventsTo(b);b=a.m;b.f=_.ch(b.f,{volume:c,muted:d});yield _.jo(a.m);!a.J&&a.N&&(yield pS(a,2),yield a.m.play(),yield a.m.pause(),yield pS(a,4),yield a.m.seek(a.N))}else{if(!a.R)return a.m.play();tS(a)}a.R=!1;a.l&&a.l.stop();a.J||(yield a.m.play());oS(a,_.Ub)})}dd(){this.J=!0;this.C.contentComplete()}load(){const a=this;return _.w(function*(){var b=
|
|
17
|
+
a.m;const c=a.I;try{if(typeof c.adTagUrl!==_.Tf)throw new _.I(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.$.canPlay(!1);const d=yield a.$.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.C.getSettings().setAutoPlayAdBreaks(!1);a.C.requestAds(e);return a.f})}j(){if(this.X||!this.a||this.X)return!0;if(!this.da){if(this.S.Nb())return vS(this),!1;this.xa.initialize();
|
|
18
|
+
uS(this);return!0}return this.o()&&this.a?(this.a.resume(),!1):!0}B(){}A(){return!0}hb(){this.a&&this.a.pause()}isPaused(){return this.L}skip(){this.a&&this.a.skip()}getAdVolume(){return this.a?this.F?this.M:this.a.getVolume():1}h(a){this.M=a;this.a&&(this.F||this.a.setVolume(a))}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.hb()}resume(){this.j()}setMuted(a){this.F=a;this.a&&(a?this.a.setVolume(0):this.a.setVolume(this.M))}isMuted(){return this.F}o(){return this.W}getPosition(){if(!this.a||
|
|
19
|
+
null===this.H)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.H-a}w(){this.a&&(this.a.destroy(),this.a=null);this.X=!0;tS(this);this.U.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};AS.prototype.getPosition=AS.prototype.getPosition;AS.prototype.resume=AS.prototype.resume;AS.prototype.pause=AS.prototype.pause;AS.prototype.getVolume=AS.prototype.getVolume;AS.prototype.setVolume=AS.prototype.setVolume;AS.prototype.getAdVolume=AS.prototype.getAdVolume;
|
|
20
|
+
AS.prototype.skip=AS.prototype.skip;AS.prototype.pauseAd=AS.prototype.hb;_.Fh(new class{constructor(){this.Xa=new _.T(hS)}name(){return hS}a(a,b){return a.namespace()===_.hd?!1:iS()?(this.Xa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new AS(a)}});_.Pn(new zS);};f.call(g, window);
|
package/cl.mediatailor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var fS=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.eb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Lg:_.
|
|
2
|
-
- manifest URI: ${d.Lg}`);return d})},gS=class extends _.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var fS=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.eb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Lg:_.Pm(d.manifestUrl,b),Jj:e?_.Pm(e,b):null};a.g.info(`Media Tailor session initialized.
|
|
2
|
+
- manifest URI: ${d.Lg}`);return d})},gS=class extends _.Pv{constructor(){super();this.g=new _.T("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield fS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Lg}catch(e){throw c.g.error("Failed to start session",e),new _.I(_.D,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Pn(new class{create(){return new gS}});};f.call(g, window);
|