@castlabs/prestoplay 6.18.0 → 6.19.1
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 +32 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +115 -114
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +581 -577
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -75
- package/cjs/cl.externs.js +175 -293
- package/cjs/cl.freewheel.js +23 -24
- package/cjs/cl.hls.js +70 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +28 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +313 -314
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +90 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +475 -474
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -71
- package/cl.externs.js +172 -294
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +277 -274
- 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 +9 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +14 -0
- package/package.json +1 -1
- package/typings.d.ts +379 -384
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
a.a;this.j=void 0===b?!1:b;this.a=
|
|
10
|
-
a.l.unshift(b);for(var c=_.w(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},
|
|
11
|
-
|
|
12
|
-
c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},
|
|
13
|
-
c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},
|
|
14
|
-
this.G=new _.
|
|
15
|
-
d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.
|
|
16
|
-
else{
|
|
17
|
-
end:c}},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
c
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_.
|
|
30
|
-
_.t.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.mb(.25),this.L.enableResizeObserver&&this.w.start(),MS(this,!0)):(this.G.stop(),this.w.stop(),SS(this)))};_.t.Fd=function(){return this.f};_.t.Ej=function(){MS(this,!0)};_.J(RR,NS);NS.prototype.setTextVisibility=NS.prototype.setTextVisibility;NS.prototype.isTextVisible=NS.prototype.isTextVisible;NS.prototype.remove=NS.prototype.remove;NS.prototype.destroy=NS.prototype.destroy;NS.prototype.append=NS.prototype.append;TS.prototype.isSupported=function(a){return!!a.enableHtmlCue&&!_.il()};TS.prototype.create=function(a){return new NS(a)};_.x(US,_.Ts);US.prototype.f=function(){_.ap(_.ze,new TS)};US.prototype.a=function(){_.Zo.has(_.ze)&&(_.Zo["delete"](_.ze),_.$o.info("Removed factory: 'html'"))};US.prototype.id=function(){return _.qg};_.J("clpp.htmlcue.HtmlCueComponent",US);};
|
|
2
|
+
var f=function(window){var YR="CLPP Subtitle Styles",ZR="Unsupported unit",$R="clpp-text-plain",aS="clpp-text-ttml",bS="clpp.htmlcue.HtmlTextDisplayer",cS="initial",dS=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},eS=function(a){return _.hi(a,{hh:function(b,c){return b.la(c)}})},fS=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},hS=function(a,b){gS(a,
|
|
3
|
+
b);Array.from(b.getElementsByTagName("*")).forEach(function(c){gS(a,c)})},gS=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},iS=function(a,b){return 0===a?"0":a+b},jS=function(a,b){return 1>Math.abs(a-b)||a<b},kS=function(a,b){return a<b&&1<Math.abs(a-b)},lS=function(a,b){return a>b&&1<Math.abs(a-b)},mS=function(a,b){return 1>Math.abs(a-b)||a>b},nS=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},oS=function(a){return new nS(a.left,a.f,a.top,a.a,
|
|
4
|
+
a.height,a.width)},pS=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new nS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},qS=function(a,b){return b.some(function(c){return kS(a.left,
|
|
5
|
+
c.f)&&lS(a.f,c.left)&&kS(a.top,c.a)&&lS(a.a,c.top)})},rS=function(a,b){return mS(a.top,b.top)&&jS(a.a,b.a)&&mS(a.left,b.left)&&jS(a.f,b.f)},sS=function(a,b,c){switch(c){case "+x":return kS(a.left,b.left);case "-x":return lS(a.f,b.f);case "+y":return kS(a.top,b.top);case "-y":return lS(a.a,b.a);default:throw Error("Unknown axis");}},tS=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},uS=function(){},vS=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);
|
|
6
|
+
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},xS=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return wS[c]});return a},yS=function(a,b,c){tS.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},AS=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return zS(a)?b:c},DS=function(a,b,c){return zS(a)&&_.M.ra(c)?iS(c,_.Jf):
|
|
7
|
+
(BS(a)||CS(a))&&_.M.ra(b)?iS(b,"%"):cS},BS=function(a){return a.f.writingMode===_.Fg},CS=function(a){return a.f.writingMode===_.Gg},zS=function(a){return a.f.writingMode===_.wk},ES=function(a,b,c){return(BS(a)||CS(a))&&_.M.ra(c)?iS(c,_.Jf):BS(a)&&_.M.R(c)?iS(0,_.Jf):zS(a)&&_.M.ra(b)?iS(b,"%"):cS},FS=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ce:return a.f.position;case "auto":case _.ud:return a.f.position-a.f.size/2;case _.De:return a.f.position-a.f.size}return 0},
|
|
8
|
+
GS=function(a){switch(a.f.positionAlign){case _.Ce:return _.ze;case "auto":case _.ud:return _.vk;case _.De:return _.Qf}return a.f.textAlign},HS=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ze:case _.ze:return _.Ce;case _.vk:return _.ud;case _.Qf:case _.Qf:return _.De}return a.f.positionAlign},IS=function(a){switch(a.f.writingMode){case _.wk:return"horizontal-tb";case _.Fg:return _.Fg;case _.Gg:return _.Gg;default:throw Error("Unknown writing mode");}},JS=function(a,b){this.l=a;this.f=
|
|
9
|
+
a.a;this.j=void 0===b?!1:b;this.a=pS(a.a);this.h=[]},KS=function(a,b){if(a.j)switch(b.writingMode){case _.wk:return["-y"];case _.Fg:return["+x"];case _.Gg:return["-x"]}var c=[];switch(b.writingMode){case _.wk:c=["+y","-y"];break;case _.Fg:c=["+x","-x"];break;case _.Gg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},LS=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=pS(a.l.a)},MS=function(a,b,c){tS.call(this,a,b,c);this.h=null;this.l=[]},NS=function(a,b){LS(a.h);
|
|
10
|
+
a.l.unshift(b);for(var c=_.w(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},OS=function(a,b){MS.call(this,a.id,"clpp-text-cue-region",b);this.f=a},PS=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Bk)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(ZR);},RS=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=QS(this,this.h);this.f=QS(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},
|
|
11
|
+
SS=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},TS=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,
|
|
12
|
+
c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},QS=function(a,b,c){var d=document.createElement(_.ig),e=d.dataset;e.name=YR;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);US(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},US=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===YR&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});
|
|
13
|
+
c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},XS=function(a){_.Vt.call(this,a);var b=this;this.g=new _.K(bS);this.m=a;this.L=VS(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new RS(a.getSurface().getUniqueCssClass());this.a=new MS(null,"clpp-text-container",{});this.w=new _.Tt(a.getSurface(),this.Qj.bind(this));this.J=null;this.C?(this.C.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.");
|
|
14
|
+
this.G=new _.Vk(function(){WS(b)});this.A=new Map;this.l=null},VS=function(a){a=_.M.$a(a.htmlcue||{});_.M.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.M.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},YS=function(a,b){return a.startTime<=b&&a.endTime>b},WS=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Cp){a.J=c;var d=ZS(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,$S(a),
|
|
15
|
+
d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.au(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.w(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.Ng:h="clpp-text-vtt";break;case _.rg:h=aS;break;case _.uk:h=$R}h&&!g.classList.contains(h)&&_.jr(g,h);g=pS(f.a.a);if(0===g.width||0===g.height)f.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.");
|
|
16
|
+
else{gS({fontSize:aT(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Ng;var l=e.payloadType===_.rg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new OS(e.region,{}),f.A.set(e.region.id,g),NS(f.a,g)));e=new yS(e,f.L,c);g?NS(g,e):NS(f.a,e)}}}}}},ZS=function(a,b){var c=dS(a.f,function(e){return YS(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;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,
|
|
17
|
+
end:c}},bT=function(a){$S(a);a.J=null;a.l=null;a.f=[]},$S=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(aS);b.classList.remove($R);a=a.a;LS(a.h);a.l=[]}},aT=function(a,b){var c=pS(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Jf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Jf;d=a.getFontSizePercent();return Math.round(c*d)+_.Jf},cT=function(){},dT=function(){};tS.prototype.init=function(){this.j=!0};tS.prototype.A=function(){return!1};uS.prototype.parse=function(a){a={input:a};for(var b=_.lr(_.Xd),c=[],d=b,e;null!==(e=vS(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=e[1];var g=e[3];var h=eT[f];h?(h=_.lr(h),(f=fT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||gT[g.localName]&&gT[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
|
|
18
|
+
d=g)}}else d.appendChild(document.createTextNode(xS(e)));return b};var 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"},wS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};_.x(yS,tS);yS.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
|
|
19
|
+
yS.prototype.init=function(a){tS.prototype.init.call(this,a);if(this.h)_.jr(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===_.rg){var c=_.lr(_.Xd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ng?b=(new uS).parse(b.payload):(c=_.lr(_.Xd),c.textContent=b.payload,b=c);_.jr(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
|
|
20
|
+
c.next();!d.done;d=c.next())_.jr(b,d.value);gS({writingMode:IS(this)},b);this.a.appendChild(b);_.jr(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.jr(this.a,"clpp-text-wrapper__"+d.value);_.M.R(this.f.line)&&(this.f.lineInterpretation=_.xk,this.f.line=zS(this)?-1:0);c=IS(this);gS({writingMode:c,webkitWritingMode:c,direction:cS,textAlign:GS(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=FS(this,HS(this));d=ES(this,c,null);var e=DS(this,
|
|
21
|
+
c,null),f=CS(this)&&_.M.R(null)?iS(0,_.Jf):cS;gS({position:"absolute",left:d,right:f,top:e,width:zS(this)?iS(this.f.size,"%"):cS,height:BS(this)||CS(this)?iS(this.f.size,"%"):cS},this.a);d=this.f;a=zS(this)?a.height:a.width;e=AS(this);if(d.lineInterpretation===_.xk)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.ud:g-=f/2;break;case _.me:g-=f}f=Math.round(g/100*a)}CS(this)&&(f=a-f-e);a=f;d=ES(this,c,a);e=CS(this)&&_.M.R(a)?
|
|
22
|
+
iS(0,_.Jf):cS;gS({left:d,right:e,top:DS(this,c,a)},this.a)}hS(this.C,b)}};yS.prototype.o=function(){return _.lr(_.Xd)};JS.prototype.append=function(a){var b=a.a;b.style.visibility=_.ue;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=pS(a.a);var d=KS(this,a.f),e=AS(a),f=oS(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;sS(c,this.a,l)||rS(c,this.a)&&qS(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||rS(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
|
|
23
|
+
l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=oS(c),h=l);c=oS(f)}c=g||f}gS({top:iS(c.top-this.a.top,_.Jf),bottom:iS(this.a.a-c.a,_.Jf),left:iS(c.left-this.a.left,_.Jf),right:iS(this.a.f-c.f,_.Jf),height:iS(c.height,_.Jf),width:iS(c.width,_.Jf)},a.a)}b.style.visibility="visible";this.h.push(pS(a.a))};_.x(MS,tS);MS.prototype.init=function(){this.h=new JS(this);this.j=!0};MS.prototype.o=function(){var a=_.lr(_.Xd);_.jr(a,this.w);this.id&&(a.id=this.id);return a};_.x(OS,MS);
|
|
24
|
+
OS.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Bk:b=b.width/100*a.width;break a;default:throw Error(ZR);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Bk)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(ZR);d=a.height;var e=PS(this,d,a.height);gS(this.B,this.a);gS({left:iS(c,_.Jf),top:iS(e,_.Jf),width:iS(b,_.Jf),height:iS(d,_.Jf)},this.a);this.f.writingMode&&gS({display:"flex",
|
|
25
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&gS({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.jr(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Bk:b=b.height/100*a.height;break a;case 2:b=b.height;d=new yS(new _.Ak(0,1,"Lorem ipsum",_.uk),{},{});c=d.a;this.a.appendChild(c);d.init(pS(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(ZR);
|
|
26
|
+
}a=PS(this,b,a.height);gS({top:iS(a,_.Jf),height:iS(b,_.Jf)},this.a);this.h=new JS(this,!0);this.j=!0};OS.prototype.getId=function(){return this.f.id};RS.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=TS(this,a);if(SS(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.l.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
27
|
+
RS.prototype.destroy=function(){var a=this;return _.I(function(b){if(null==a.a)return b["return"]();a.j.forEach(function(c){return c()});a.j=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.l=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.A(b)})};_.x(XS,_.Vt);_.u=XS.prototype;_.u.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.w(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=fS(this.f,eS(a));this.l=null;WS(this,!1)}};_.u.Mb=function(){null==this.h||WS(this,!0)};
|
|
28
|
+
_.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();bT(a);a.G.stop();return _.y(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.A(b)})};_.u.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;WS(this,!0);return!0};_.u.isTextVisible=function(){return this.j};
|
|
29
|
+
_.u.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.xb(.25),this.L.enableResizeObserver&&this.w.start(),WS(this,!0)):(this.G.stop(),this.w.stop(),bT(this)))};_.u.Qj=function(){WS(this,!0)};_.J(bS,XS);XS.prototype.setTextVisibility=XS.prototype.setTextVisibility;XS.prototype.isTextVisible=XS.prototype.isTextVisible;XS.prototype.remove=XS.prototype.remove;XS.prototype.destroy=XS.prototype.destroy;XS.prototype.append=XS.prototype.append;cT.prototype.a=function(a){return!!a.enableHtmlCue&&!_.el()};cT.prototype.create=function(a){return new XS(a)};_.x(dT,_.Lt);dT.prototype.f=function(){_.bp(_.ve,new cT)};dT.prototype.a=function(){_.$o.has(_.ve)&&(_.$o["delete"](_.ve),_.ap.info("Removed factory: 'html'"))};dT.prototype.id=function(){return _.kg};_.J("clpp.htmlcue.HtmlCueComponent",dT);};
|
|
31
30
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
32
31
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
33
32
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ima.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
null;this.N=this.H=this.
|
|
4
|
-
d.AD_PROGRESS,a.
|
|
5
|
-
b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.
|
|
6
|
-
[];return b},
|
|
7
|
-
b=!!a.m.getConfiguration().muted,_.y(d,a.L.canPlay(b),2);c=d.f;if(!c&&!
|
|
8
|
-
new _.K(
|
|
9
|
-
_.
|
|
10
|
-
_.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_.
|
|
15
|
-
_.
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
_.
|
|
19
|
-
_.
|
|
20
|
-
return g["return"](a.f)})};_.
|
|
21
|
-
_.
|
|
22
|
-
_.
|
|
23
|
-
|
|
24
|
-
_.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var ER="clpp.ima.AdsManagerFactory",FR=function(){},GR=function(a){this.a=a},HR=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},IR=function(a){this.m=a;this.A=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.M.$a(a.ima||{});this.J=_.M.sa({disableCustomPlayback:!1},a);this.o=this.m.uc("ima").bd();this.P=this.m.uc("ima").h;this.l=this.m.uc("ima").a;this.L=new _.St;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.Cj;this.I=!1;this.w=new _.Oh;this.V=new FR;this.B=
|
|
3
|
+
null;this.N=this.H=this.C=this.G=!1;this.K=this.j=null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.am.bind(this));a.on(this.l,b,this.$l.bind(this));a.on(this.m,_.ne,this.hm.bind(this))},JR=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Ql.bind(a));c.on(b,d.LOADED,a.Uj.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.im.bind(a));c.on(b,d.STARTED,a.Wj.bind(a));c.on(b,d.LOG,a.Ul.bind(a));c.on(b,
|
|
4
|
+
d.AD_PROGRESS,a.Yl.bind(a));c.on(b,d.AD_BUFFERING,a.Rl.bind(a));c.on(b,d.FIRST_QUARTILE,a.Sj.bind(a));c.on(b,d.MIDPOINT,a.Vl.bind(a));c.on(b,d.THIRD_QUARTILE,a.Xj.bind(a));c.on(b,d.PAUSED,a.Xl.bind(a));c.on(b,d.RESUMED,a.Zl.bind(a));c.on(b,d.CLICK,a.Rj.bind(a));c.on(b,d.SKIPPED,a.Vj.bind(a));c.on(b,d.IMPRESSION,a.Tj.bind(a));c.on(b,d.COMPLETE,a.Sl.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.jm.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.cm.bind(a))},KR=function(a){a=a.J;var b=new google.ima.AdsRenderingSettings;
|
|
5
|
+
b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.kd?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.k&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.k&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.kd&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:
|
|
6
|
+
[];return b},MR=function(a){a.B=null;LR(a,_.Lc);a.o&&a.m.getSurface().hide(a.o)},NR=function(a){_.kr(a.A,{visibility:"visible"})},LR=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new HR(c,a.G,a.C)});a.m.trigger(new _.L(b,d))},OR=function(a,b){var c=b?a.V.create(b.getErrorCode()):null;a.m.onError(new _.N(1,9,10003,{errorType:c},b))},PR=function(a){return!1===a.J.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Ij()},RR=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.P.initialize(),
|
|
7
|
+
b=!!a.m.getConfiguration().muted,_.y(d,a.L.canPlay(b),2);c=d.f;if(!c&&!PR(a))return LR(a,_.id),a.g.warn(_.oa),d["return"]();QR(a);_.A(d)})},SR=function(a,b){return _.I(function(c){if(1==c.a)return a.P.initialize(),_.y(c,b.play(),2);QR(a);_.A(c)})},QR=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.I=!0},TR=function(){this.a=this.h=this.f=null},UR=function(){return!window.google||!google.ima||!google.ima.AdsLoader},VR=function(){},WR=function(){this.hd=
|
|
8
|
+
new _.K(ER)};FR.prototype.create=function(a){var 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}};GR.prototype.getCuePoints=function(){return this.a};GR.prototype.Fb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};GR.prototype.Eb=function(){return 0<=this.a.indexOf(-1)};GR.prototype.hasPostroll=GR.prototype.Eb;GR.prototype.hasPreroll=GR.prototype.Fb;GR.prototype.getCuePoints=GR.prototype.getCuePoints;_.u=HR.prototype;_.u.jb=function(){return"Google IMA SDK"};_.u.kb=function(){return google.ima.VERSION};_.u.qb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};_.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.u.getTitle=function(){return this.a.getTitle()};_.u.getDuration=function(){return this.a.getDuration()};
|
|
9
|
+
_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.u.Sb=function(){return this.f?this.f.getIsBumper():!1};_.u.yb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ve&&typeof b[d].clickThroughUrl===_.gg});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};_.u.ob=function(){return this.a.getVastMediaWidth()};_.u.nb=function(){return this.a.getVastMediaHeight()};
|
|
10
|
+
_.u.ab=function(){return this.a.getVastMediaBitrate()};_.u.Ua=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Cb=function(){return this.f?this.f.getTimeOffset():0};_.u.Db=function(){return this.f?this.f.getAdPosition():1};_.u.pb=function(){return this.f?this.f.getTotalAds():1};_.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};
|
|
11
|
+
HR.prototype.getWrapperCreativeIds=HR.prototype.getWrapperCreativeIds;HR.prototype.getWrapperAdSystems=HR.prototype.getWrapperAdSystems;HR.prototype.getWrapperAdIds=HR.prototype.getWrapperAdIds;HR.prototype.getSequenceLength=HR.prototype.pb;HR.prototype.getPositionInSequence=HR.prototype.Db;HR.prototype.getPodTimeOffset=HR.prototype.Cb;HR.prototype.getPodIndex=HR.prototype.getPodIndex;HR.prototype.getPodType=HR.prototype.Ua;HR.prototype.getMediaBitrate=HR.prototype.ab;
|
|
12
|
+
HR.prototype.getMediaHeight=HR.prototype.nb;HR.prototype.getMediaWidth=HR.prototype.ob;HR.prototype.getMediaUrl=HR.prototype.getMediaUrl;HR.prototype.getClickThroughUrl=HR.prototype.yb;HR.prototype.isBumper=HR.prototype.Sb;HR.prototype.getSkipTimeOffset=HR.prototype.getSkipTimeOffset;HR.prototype.getPosition=HR.prototype.getPosition;HR.prototype.getDuration=HR.prototype.getDuration;HR.prototype.getTitle=HR.prototype.getTitle;HR.prototype.getAdvertiserName=HR.prototype.getAdvertiserName;
|
|
13
|
+
HR.prototype.getAdSystem=HR.prototype.getAdSystem;HR.prototype.getApiFramework=HR.prototype.getApiFramework;HR.prototype.getCreativeId=HR.prototype.getCreativeId;HR.prototype.getId=HR.prototype.getId;HR.prototype.getTechnology=HR.prototype.qb;HR.prototype.getAdManagerVersion=HR.prototype.kb;HR.prototype.getAdManagerName=HR.prototype.jb;_.u=IR.prototype;
|
|
14
|
+
_.u.am=function(a){var b=this;this.a=a.getAdsManager(this.A,KR(this));this.a.isCustomPlaybackUsed()&&!PR(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.N(1,9,10002)),this.pc()):(this.h=new _.Tt(this.m.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.j=new GR(a),this.m.trigger(new _.L(_.Oc,{adsTimeline:this.j})),JR(this));this.f.resolve()};
|
|
15
|
+
_.u.$l=function(a){OR(this,a.getError());this.f.resolve()};_.u.im=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.H=!0,PR(b)?(b.K=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.kr(b.A,{visibility:_.ue});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:LR(b,_.vc,a),b.h.start(),_.A(c)}})};_.u.Ql=function(){var a=this;return _.I(function(b){a.a.start();_.A(b)})};
|
|
16
|
+
_.u.Uj=function(a){a.getAd().isLinear()?LR(this,_.Ec,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))};_.u.Wj=function(a){this.B=a.getAd().getDuration();LR(this,_.Kc,a);this.m.getSurface().show(this.o)};_.u.Ul=function(a){a=a.getAdData();OR(this,a?a.adError:null);MR(this)};_.u.Yl=function(a){LR(this,_.Hc,a)};_.u.Rl=function(a){LR(this,_.xc,a)};_.u.Sj=function(a){LR(this,_.Ac,a)};_.u.Vl=function(a){LR(this,_.Fc,a)};_.u.Xj=function(a){LR(this,_.Mc,a)};_.u.Xl=function(a){LR(this,_.Gc,a)};
|
|
17
|
+
_.u.Zl=function(a){LR(this,_.Ic,a)};_.u.Rj=function(a){this.pause();LR(this,_.yc,a)};_.u.Vj=function(a){LR(this,_.Jc,a);MR(this)};_.u.Tj=function(a){LR(this,_.Dc,a)};_.u.Sl=function(a){LR(this,_.zc,a);MR(this)};
|
|
18
|
+
_.u.jm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.G=!0;if(!PR(a)||null===a.K){if(!a.H)return b["return"](a.m.play());NR(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.it(a.m),3);case 3:if(a.C){b.F(2);break}return _.y(b,a.m.seek(a.K),2);case 2:a.H=!1;a.h&&a.h.stop();if(a.C){b.F(6);break}return _.y(b,a.m.play(),6);case 6:LR(a,_.wc),_.A(b)}})};_.u.cm=function(){this.N=!0};_.u.hm=function(){this.C=!0;this.l.contentComplete()};
|
|
19
|
+
_.u.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.J;try{if(typeof c.adTagUrl!==_.gg)throw new _.N(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.y(g,a.L.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(g,a.L.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(f);
|
|
20
|
+
return g["return"](a.f)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.j&&!b.I?b.j.Fb()?_.y(c,RR(b),0):_.y(c,SR(b,a),0):_.y(c,a.play(),0)})};_.u.Vc=function(){};_.u.Rc=function(){return!0};_.u.resume=function(){this.a&&this.a.resume()};_.u.pause=function(){this.a&&this.a.pause()};_.u.skip=function(){this.a&&this.a.skip()};_.u.getVolume=function(){return this.a?this.a.getVolume():1};_.u.setVolume=function(a){this.a&&this.a.setVolume(a)};
|
|
21
|
+
_.u.getPosition=function(){if(!this.a||null===this.B)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.B-a};
|
|
22
|
+
_.u.pc=function(){var a=this;return(new Promise(function(b){a.I&&a.j&&a.j.Eb()&&!a.N?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.o&&a.m.getSurface().hide(a.o)}),_.Ph(a.w,a.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],function(){a.a&&a.a.discardAdBreak()})):b();a.a.discardAdBreak();a.l.contentComplete()})).then(function(){NR(a);a.w.release();a.h&&(a.h.stop(),a.h=null);a.a&&(a.a.destroy(),a.a=null)})};IR.prototype.getPosition=IR.prototype.getPosition;
|
|
23
|
+
IR.prototype.setVolume=IR.prototype.setVolume;IR.prototype.getVolume=IR.prototype.getVolume;IR.prototype.skip=IR.prototype.skip;IR.prototype.pause=IR.prototype.pause;IR.prototype.resume=IR.prototype.resume;_.x(TR,_.Hu);_.u=TR.prototype;_.u.onPlayerCreated=function(a){if(UR())return a.onError(new _.N(1,9,1E4));this.f=_.ir(_.Xd,{"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(_.wa);this.a.getSettings().setPlayerVersion(_.ja);this.a.getSettings().setAutoPlayAdBreaks(!0)};
|
|
24
|
+
_.u.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.u.Xk=function(){return this.a};_.u.Vk=function(){return this.h};_.u.bd=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",TR);TR.prototype.getAdContainer=TR.prototype.bd;TR.prototype.getAdDisplayContainer=TR.prototype.Vk;TR.prototype.getAdsLoader=TR.prototype.Xk;TR.Id="ima";
|
|
25
|
+
TR.isSdkMissing=UR;VR.prototype.create=function(){return new TR};_.lt(new VR);WR.prototype.name=function(){return ER};WR.prototype.a=function(a,b){return a.namespace()===_.Cd?!1:UR()?(this.hd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};WR.prototype.create=function(a){return new IR(a)};_.Yp(new WR);};
|
|
26
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
28
|
else{_=this.clpp._;(f.call(g,this));}
|