@castlabs/prestoplay 6.27.0 → 6.28.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 +19 -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 +113 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +625 -624
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -89
- package/cjs/cl.externs.js +80 -72
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +78 -79
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -24
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +347 -347
- package/cjs/cl.muxdata.js +14 -15
- package/cjs/cl.onboard.js +4 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -38
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -5
- package/cl.cast.js +91 -90
- package/cl.conviva.js +27 -27
- package/cl.core.js +503 -499
- package/cl.crypto.js +8 -8
- package/cl.dash.js +83 -82
- package/cl.externs.js +80 -72
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +80 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +2 -3
- package/cl.mse.js +304 -305
- 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.simid.js +14 -14
- package/cl.smooth.js +60 -60
- 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.yospace.js +3 -3
- package/cl.youbora.js +31 -29
- package/package.json +1 -1
- package/typings.d.ts +34 -65
- package/cjs/cl.sessions.js +0 -21
- package/cl.sessions.js +0 -10
package/cl.htmlcue.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},
|
|
3
|
-
function(a,b){return 1>Math.abs(a-b)||a>b},
|
|
4
|
-
d-e)}
|
|
5
|
-
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return
|
|
6
|
-
_.r)switch(b){case _.
|
|
7
|
-
|
|
8
|
-
a.viewportAnchorUnits;if(d===_.
|
|
9
|
-
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},
|
|
10
|
-
a.o=[]}},
|
|
11
|
-
if(b||a.J!==c&&a.m.getState()
|
|
12
|
-
_.
|
|
13
|
-
c.a.appendChild(d)}}}}},
|
|
14
|
-
b){const c=
|
|
15
|
-
e[1];var g=e[3];var h=
|
|
16
|
-
"\x26nbsp;":"\u00a0"};var
|
|
17
|
-
_.
|
|
18
|
-
!this.f.region.displayAlign){e=
|
|
19
|
-
100*a)}
|
|
20
|
-
d=this.a;d=Math.max(0,Math.min(c.f,d.f)-Math.max(c.left,d.left))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.top,d.top))/(c.height*c.width);d>k&&(h
|
|
21
|
-
_.
|
|
22
|
-
b=c;f*=b;break a;default:throw Error(
|
|
23
|
-
`because it's not safe: ${b}`)}}destroy(){const a=this;return _.w(function*(){null!=a.a&&(a.l.forEach(b=>b()),a.l=[],
|
|
24
|
-
this.G=new _.
|
|
25
|
-
this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;
|
|
26
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var GS="Unsupported unit",HS="clpp-text-plain",IS="clpp-text-ttml",JS="clpp.htmlcue.HtmlTextDisplayer",KS="initial",LS=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},MS=function(a){return _.bi(a,{Pf:(b,c)=>b.Ic(c)})},NS=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)},OS=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},QS=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>PS[c]);return a},SS=function(a,b){RS(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{RS(a,c)})},RS=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},TS=function(a,b){return 0===a?"0":a+b},US=function(a,b){return 1>Math.abs(a-b)||a<b},VS=function(a,b){return a<b&&1<Math.abs(a-b)},WS=function(a,b){return a>b&&1<Math.abs(a-b)},XS=
|
|
3
|
+
function(a,b){return 1>Math.abs(a-b)||a>b},ZS=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 YS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
|
+
d-e)},$S=function(a){return new YS(a.left,a.f,a.top,a.a,a.height,a.width)},aT=function(a,b){return b.some(c=>VS(a.left,c.f)&&WS(a.f,c.left)&&VS(a.top,c.a)&&WS(a.a,c.top))},bT=function(a,b){return XS(a.top,b.top)&&US(a.a,b.a)&&XS(a.left,b.left)&&US(a.f,b.f)},cT=function(a,b,c){switch(c){case "+x":return VS(a.left,b.left);case "-x":return WS(a.f,b.f);case "+y":return VS(a.top,b.top);case "-y":return WS(a.a,b.a);default:throw Error("Unknown axis");}},dT=function(a){return a.f.writingMode===_.fu},eT=
|
|
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 dT(a)?b:c},fT=function(a){switch(a.f.writingMode){case _.fu:return"horizontal-tb";case _.vg:return _.vg;case _.wg:return _.wg;default:throw Error("Unknown writing mode");}},gT=function(a){switch(a.f.positionAlign){case _.le:return _.ie;case "auto":case _.Vc:return _.eu;case _.me:return _.Af}return a.f.textAlign},hT=function(a,b){if(typeof a.f.position===_.r&&typeof a.f.size===
|
|
6
|
+
_.r)switch(b){case _.le:return a.f.position;case "auto":case _.Vc:return a.f.position-a.f.size/2;case _.me:return a.f.position-a.f.size}return 0},iT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Of:case _.ie:return _.le;case _.eu:return _.Vc;case _.Ud:case _.Af:return _.me}return a.f.positionAlign},lT=function(a,b,c){return(jT(a)||kT(a))&&_.jh(c)?TS(c,_.tf):jT(a)&&_.z(c)?TS(0,_.tf):dT(a)&&_.jh(b)?TS(b,"%"):KS},mT=function(a,b,c){return dT(a)&&_.jh(c)?TS(c,_.tf):(jT(a)||kT(a))&&_.jh(b)?
|
|
7
|
+
TS(b,"%"):KS},kT=function(a){return a.f.writingMode===_.wg},jT=function(a){return a.f.writingMode===_.vg},nT=function(a,b){if(a.j)switch(b.writingMode){case _.fu:return["-y"];case _.vg:return["+x"];case _.wg:return["-x"]}a=[];switch(b.writingMode){case _.fu:a=["+y","-y"];break;case _.vg:a=["+x","-x"];break;case _.wg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},oT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=ZS(a.l.a)},pT=function(a,b,c){a=a.f;const d=
|
|
8
|
+
a.viewportAnchorUnits;if(d===_.mu)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(GS);},rT=function(a,b,c,d){const e=document.createElement(_.Uf),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);qT(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},sT=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)},tT=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},uT=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
|
|
10
|
+
a.o=[]}},qT=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())},vT=function(a){a=_.ch(a.htmlcue||{});_.z(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.z(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},BT=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=wT(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,xT(a),c)){b={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.ut(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 _.Dg:g="clpp-text-vtt";break;case _.hg:g=IS;break;case _.du:g=HS}g&&!f.classList.contains(g)&&
|
|
12
|
+
_.Di(f,g);f=ZS(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{RS({fontSize:yT(c,d.containerRows)},c.a.a);f=null;g=d.payloadType===_.Dg;var h=d.payloadType===_.hg;d.region&&(g||h||d.backgroundImage)&&(c.B.has(d.region.id)?f=c.B.get(d.region.id):(f=new zT(d.region,{}),c.B.set(d.region.id,f),c.a.appendChild(f)));d=new AT(d,c.L,e);f?f.appendChild(d):
|
|
13
|
+
c.a.appendChild(d)}}}}},CT=function(a){xT(a);a.J=null;a.o=null;a.f=[]},DT=function(a,b){return a.startTime<=b&&a.endTime>b},wT=function(a,b){var c=LS(a.f,d=>DT(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=c;for(;0<=d-1&&DT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&DT(a.f[c+1],b);)c++;return{start:d,end:c}}},xT=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(IS);b.classList.remove(HS);a=a.a;oT(a.h);a.l=[]}},yT=function(a,
|
|
14
|
+
b){const c=ZS(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`},HT=class{parse(a){a={input:a};const b=_.Fi(_.Dd),c=[];let d=b;for(var e;null!==(e=OS(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=ET[f];h?(h=_.Fi(h),(f=FT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||GT[g.localName]&>[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(QS(e)));return b}},ET={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},FT={v:"voice",lang:"lang"},GT={rt:"ruby"},PS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f",
|
|
16
|
+
"\x26nbsp;":"\u00a0"};var YS=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 IT=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 AT=class extends IT{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)_.Di(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===_.hg){var c=_.Fi(_.Dd);c.innerHTML=b.payload;b=c}else b.payloadType===
|
|
17
|
+
_.Dg?b=(new HT).parse(b.payload):(c=_.Fi(_.Dd),c.textContent=b.payload,b=c);_.Di(b,this.w);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Di(b,d);RS({writingMode:fT(this)},b);var d=b;this.a.appendChild(d);_.Di(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Di(this.a,`clpp-text-wrapper__${e}`);_.z(this.f.line)&&(this.f.lineInterpretation=_.gu,this.f.line=dT(this)?-1:0);e=fT(this);RS({writingMode:e,webkitWritingMode:e,direction:KS,textAlign:gT(this)},this.a);if(!this.f.region||
|
|
18
|
+
!this.f.region.displayAlign){e=hT(this,iT(this));RS({position:"absolute",left:lT(this,e,null),right:kT(this)&&_.z(null)?TS(0,_.tf):KS,top:mT(this,e,null),width:dT(this)?TS(this.f.size,"%"):KS,height:jT(this)||kT(this)?TS(this.f.size,"%"):KS},this.a);b=this.f;a=dT(this)?a.height:a.width;c=eT(this);if(b.lineInterpretation===_.gu){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 _.Vc:g-=f/2;break;case _.Ud:g-=f}f=Math.round(g/
|
|
19
|
+
100*a)}kT(this)&&(f=a-f-c);a=f;RS({left:lT(this,e,a),right:kT(this)&&_.z(a)?TS(0,_.tf):KS,top:mT(this,e,a)},this.a)}SS(this.C,d)}}o(){return _.Fi(_.Dd)}};var JT=class{constructor(a,b){this.l=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=ZS(a.a);this.h=[]}append(a){const b=a.a;b.style.visibility=_.be;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=ZS(a.a);var d=nT(this,a.f),e=eT(a);const g=$S(c);let h=null,k=0;for(const l of d){for(;cT(c,this.a,l)||bT(c,this.a)&&aT(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||bT(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=$S(c),k=d);c=$S(g)}c=h||g}RS({top:TS(c.top-this.a.top,_.tf),bottom:TS(this.a.a-c.a,_.tf),left:TS(c.left-this.a.left,_.tf),right:TS(this.a.f-c.f,_.tf),height:TS(c.height,_.tf),width:TS(c.width,_.tf)},a.a)}b.style.visibility="visible";this.h.push(ZS(a.a))}};var KT=class extends IT{constructor(a,b,c){super(a,b,c);this.h=null;this.l=[]}init(){this.h=new JT(this);this.j=!0}o(){const a=_.Fi(_.Dd);_.Di(a,this.w);this.id&&(a.id=this.id);return a}appendChild(a){oT(this.h);this.l.unshift(a);for(const b of this.l)this.h.append(b)}};var zT=class extends KT{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 _.mu:b=b.width/100*a.width;break a;default:throw Error(GS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.mu)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(GS);d=a.height;const e=pT(this,d,a.height);RS(this.B,this.a);RS({left:TS(c,_.tf),top:TS(e,_.tf),width:TS(b,
|
|
21
|
+
_.tf),height:TS(d,_.tf)},this.a);this.f.writingMode&&RS({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&RS({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Di(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.mu:f=f.height/100*a.height;break a;case 2:f=f.height;c=new AT(new _.ju(0,1,"Lorem ipsum",_.du),{},{});b=c.a;this.a.appendChild(b);c.init(ZS(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
|
|
22
|
+
b=c;f*=b;break a;default:throw Error(GS);}a=pT(this,f,a.height);RS({top:TS(a,_.tf),height:TS(f,_.tf)},this.a);this.h=new JT(this,!0);this.j=!0}getId(){return this.f.id}};var LT=class{constructor(a,b){this.g=new _.S("clpp.htmlcue.StyleManager");this.l=[];this.j=a;this.h=b;this.o=[];this.a=rT(this,this.h,this.j);this.f=rT(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=sT(this,a);if(tT(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=[],uT(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 MT=class extends _.Av{constructor(a){super(a);this.g=new _.S(JS);this.m=a;this.L=vT(a.getConfiguration());this.l=!1;this.f=[];this.F=a.getSurface().getContainer();this.j=new LT(a.getSurface().getUniqueCssClass(),"CLPP Subtitle Styles");this.a=new KT(null,"clpp-text-container",{});this.A=new _.wv(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 _.Mi(()=>{BT(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=NS(this.f,MS(a));this.o=null;BT(this,!1)}}h(){null==this.j||BT(this,!0)}destroy(){const a=this;return _.w(function*(){null!=a.j&&(CT(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;BT(this,!0);return!0}isTextVisible(){return this.l}setTextVisibility(a){null!=this.j&&this.l!==a&&((this.l=a)?(this.G.zb(.25),this.L.enableResizeObserver&&this.A.start(),BT(this,!0)):(this.G.stop(),this.A.stop(),CT(this)))}T(){BT(this,!0)}};_.x(JS,MT);MT.prototype.setTextVisibility=MT.prototype.setTextVisibility;MT.prototype.isTextVisible=MT.prototype.isTextVisible;MT.prototype.remove=MT.prototype.remove;MT.prototype.destroy=MT.prototype.destroy;
|
|
26
|
+
MT.prototype.append=MT.prototype.append;var NT=class{a(a){return!!a.enableHtmlCue&&!_.bj()}create(a){return new MT(a)}};_.x("clpp.htmlcue.HtmlCueComponent",class extends _.rv{install(){_.bs(_.de,new NT)}uninstall(){_.$r.has(_.de)&&(_.$r.delete(_.de),_.as.info("Removed factory: 'html'"))}id(){return _.Vf}});};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
|
-
a.Za.bind(a));c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.
|
|
4
|
-
var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},
|
|
5
|
-
(
|
|
6
|
-
this.f.getIsBumper():!1}
|
|
7
|
-
1}
|
|
8
|
-
W.prototype.getSequenceLength=W.prototype.
|
|
9
|
-
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.
|
|
10
|
-
W.prototype.getTechnology=W.prototype.
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nS="clpp.ima.AdsManagerFactory",oS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},pS=function(a){a=a.K;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Lc?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===_.Lc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},qS=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Qi()||_.Ti()},rS=function(a){const b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Ua.bind(a));c.on(b,d.LOADED,a.ba.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.qc.bind(a));c.on(b,d.STARTED,a.ia.bind(a));c.on(b,
|
|
3
|
+
d.LOG,a.Bb.bind(a));c.on(b,d.AD_PROGRESS,a.da.bind(a));c.on(b,d.AD_BUFFERING,a.Za.bind(a));c.on(b,d.FIRST_QUARTILE,a.V.bind(a));c.on(b,d.MIDPOINT,a.ic.bind(a));c.on(b,d.THIRD_QUARTILE,a.ya.bind(a));c.on(b,d.PAUSED,a.jc.bind(a));c.on(b,d.RESUMED,a.kc.bind(a));c.on(b,d.CLICK,a.T.bind(a));c.on(b,d.SKIPPED,a.ha.bind(a));c.on(b,d.IMPRESSION,a.Y.bind(a));c.on(b,d.COMPLETE,a.Ab.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.sc.bind(a))},sS=function(a,b){const c=b?a.Ta.create(b.getErrorCode()):null;a.m.onError(new _.H(1,
|
|
4
|
+
9,10003,{errorType:c},b))},tS=function(a){return _.w(function*(){yield a.m.detach();var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},uS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.G,a.F)});a.m.trigger(new _.G(b,d))},vS=function(a){a.B=null;uS(a,_.lc);a.m.getSurface().hide(a.P)},wS=function(a){return _.w(function*(){return new Promise(b=>{a.H.on(a.m,_.Pf,()=>{4===a.m.getState()&&b()})})})},xS=function(a){_.Ei(a.A,{visibility:"visible"})},zS=function(a){return _.w(function*(){a.R.initialize();
|
|
5
|
+
const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||qS(a)?(qS(a)&&(yield tS(a)),yS(a)):(uS(a,_.Jc),a.g.warn(_.ka))})},AS=function(a,b){return _.w(function*(){a.R.initialize();yield b.play();yS(a)})},yS=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}lb(){return"Google IMA SDK"}nb(){return google.ima.VERSION}sb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Nb(){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()}Qb(){return this.f?
|
|
6
|
+
this.f.getIsBumper():!1}ob(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ge&&typeof b[d].clickThroughUrl===_.Sf);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}cb(){return this.a.getVastMediaWidth()}bb(){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}Fb(){return this.f?this.f.getTimeOffset():0}qb(){return this.f?this.f.getAdPosition():
|
|
7
|
+
1}eb(){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()}Pb(){return null}};W.prototype.getVideoElement=W.prototype.Pb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
|
|
8
|
+
W.prototype.getSequenceLength=W.prototype.eb;W.prototype.getPositionInSequence=W.prototype.qb;W.prototype.getPodTimeOffset=W.prototype.Fb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Oa;W.prototype.getMediaBitrate=W.prototype.Na;W.prototype.getMediaHeight=W.prototype.bb;W.prototype.getMediaWidth=W.prototype.cb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.ob;W.prototype.isBumper=W.prototype.Qb;
|
|
9
|
+
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.Nb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
|
|
10
|
+
W.prototype.getTechnology=W.prototype.sb;W.prototype.getAdManagerVersion=W.prototype.nb;W.prototype.getAdManagerName=W.prototype.lb;var BS=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 CS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Hb(){return 0<=this.a.indexOf(0)||0===this.a.length}Gb(){return 0<=this.a.indexOf(-1)}};CS.prototype.hasPostroll=CS.prototype.Gb;CS.prototype.hasPreroll=CS.prototype.Hb;CS.prototype.getCuePoints=CS.prototype.getCuePoints;var DS=class extends _.Iv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(oS())return a.onError(new _.H(1,9,1E4));this.f=_.Ci(_.Dd,{"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&&
|
|
11
|
+
(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Dh(){return this.a}Bh(){return this.h}Jc(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",DS);DS.prototype.getAdContainer=DS.prototype.Jc;DS.prototype.getAdDisplayContainer=DS.prototype.Bh;DS.prototype.getAdsLoader=DS.prototype.Dh;DS.Id="ima";DS.isSdkMissing=oS;var ES=class{create(){return new DS}};var FS=class{constructor(a){var b=a.ed("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Jc(),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=_.ch(a.ima||{});this.K=a=_.bh({disableCustomPlayback:!1},a);this.P=c;this.R=d;this.w=b;this.L=new _.yv;this.g=new _.S("clpp.ima");this.j=this.a=null;this.f=new _.Tl;this.M=!1;this.H=new _.Gt;this.Ta=new BS;
|
|
12
|
+
this.B=null;this.J=this.F=this.G=!1;this.I=this.C=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.w,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.nc.bind(this));c.on(this.w,d,this.lc.bind(this));c.on(this.m,_.Vd,this.oc.bind(this))}nc(a){this.a=a.getAdsManager(this.A,pS(this));this.a.isCustomPlaybackUsed()&&!qS(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.h()):(this.j=new _.wv(this.m.getSurface(),
|
|
13
|
+
(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.C=new CS(a),this.m.trigger(new _.G(_.oc,{adsTimeline:this.C})),rS(this));this.f.resolve()}lc(a){sS(this,a.getError());this.f.resolve()}qc(a){const b=this;return _.w(function*(){b.J=!0;qS(b)?(b.I=b.m.getPosition(),yield tS(b)):(yield b.m.pause(),_.Ei(b.A,{visibility:_.be}));uS(b,_.Rb,a);b.j.start()})}Ua(){const a=this;return _.w(function*(){a.a.start()})}ba(a){a.getAd().isLinear()?
|
|
14
|
+
uS(this,_.ec,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))}ia(a){this.B=a.getAd().getDuration();uS(this,_.kc,a);this.m.getSurface().show(this.P)}Bb(a){a=a.getAdData();sS(this,a?a.adError:null);vS(this)}da(a){uS(this,_.hc,a)}Za(a){uS(this,_.Tb,a)}V(a){uS(this,_.Wb,a)}ic(a){uS(this,_.fc,a)}ya(a){uS(this,_.mc,a)}jc(a){uS(this,_.gc,a)}kc(a){uS(this,_.ic,a)}T(a){this.pause();uS(this,_.Ub,a)}ha(a){uS(this,_.jc,a);vS(this)}Y(a){uS(this,_.cc,a)}Ab(a){uS(this,_.Vb,a);vS(this)}sc(){const a=
|
|
15
|
+
this;return _.w(function*(){a.G=!0;if(qS(a)&&null!==a.I){var b=a.m;b.a&&b.a.forwardEventsTo(b);yield _.eo(a.m);!a.F&&a.I&&(yield wS(a),yield a.m.seek(a.I))}else{if(!a.J)return a.m.play();xS(a)}a.J=!1;a.j&&a.j.stop();a.F||(yield a.m.play());uS(a,_.Sb)})}oc(){this.F=!0;this.w.contentComplete()}load(){const a=this;return _.w(function*(){var b=a.m;const c=a.K;try{if(typeof c.adTagUrl!==_.Sf)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(),
|
|
16
|
+
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 _.w(function*(){b.a&&b.C&&!b.M?b.C.Hb()?yield zS(b):yield AS(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&&
|
|
17
|
+
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);xS(this);this.H.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()}};FS.prototype.getPosition=FS.prototype.getPosition;FS.prototype.setVolume=FS.prototype.setVolume;FS.prototype.getVolume=FS.prototype.getVolume;FS.prototype.skip=FS.prototype.skip;FS.prototype.pause=FS.prototype.pause;FS.prototype.resume=FS.prototype.resume;_.Eh(new class{constructor(){this.Qa=new _.S(nS)}name(){return nS}a(a,b){return a.namespace()===_.fd?!1:oS()?(this.Qa.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new FS(a)}});_.Ln(new ES);};f.call(g, window);
|
package/cl.mediatailor.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
- manifest URI: ${d.
|
|
3
|
-
_.fs(new class{create(){return new rT}});};f.call(g, window);
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lS=function(a,b,c){return _.w(function*(){var d=yield(yield fetch(b,{method:_.cb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={zg:_.Lm(d.manifestUrl,b),vj:e?_.Lm(e,b):null};a.g.info(`Media Tailor session initialized.
|
|
2
|
+
- manifest URI: ${d.zg}`);return d})},mS=class extends _.Iv{constructor(){super();this.g=new _.S("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 lS(c,b.url,d);a.trigger(new _.G("mt-session-started"));b.url=e.zg}catch(e){throw c.g.error("Failed to start session",e),new _.H(_.C,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Ln(new class{create(){return new mS}});};f.call(g, window);
|