@castlabs/prestoplay 6.23.1 → 6.24.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 +14 -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 -113
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +608 -591
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +87 -86
- package/cjs/cl.externs.js +94 -30
- package/cjs/cl.freewheel.js +25 -24
- package/cjs/cl.hls.js +73 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +344 -339
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- 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 +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +492 -478
- package/cl.crypto.js +9 -9
- package/cl.dash.js +81 -80
- package/cl.externs.js +94 -30
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +75 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +307 -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.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -28
- package/package.json +1 -1
- package/typings.d.ts +44 -10
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},
|
|
4
|
-
1<Math.abs(a-b)},
|
|
5
|
-
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
|
|
6
|
-
case "+y":return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
a.a;this.j=void 0===b?!1:b;this.a=
|
|
10
|
-
a.id,"clpp-text-cue-region",b);this.f=a},
|
|
11
|
-
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},
|
|
12
|
-
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
d=g)}}else d.appendChild(document.createTextNode(
|
|
21
|
-
|
|
22
|
-
c.next();!d.done;d=c.next())_.
|
|
23
|
-
c,null),f=
|
|
24
|
-
|
|
25
|
-
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=
|
|
26
|
-
|
|
27
|
-
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&
|
|
28
|
-
}a=
|
|
29
|
-
|
|
30
|
-
_.t.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();
|
|
31
|
-
_.t.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.
|
|
2
|
+
var f=function(window){var PU="CLPP Subtitle Styles",QU="Unsupported unit",RU="clpp-text-plain",SU="clpp-text-ttml",TU="clpp.htmlcue.HtmlTextDisplayer",UU="initial",VU=function(a){return _.Yi(a,{Sh:function(b,c){return b.qa(c)}})},WU=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)},XU=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},YU=function(){},ZU=function(a){if(!a.input)return null;
|
|
3
|
+
var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},aV=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return $U[c]});return a},cV=function(a,b){bV(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){bV(a,c)})},bV=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},dV=function(a,b){return 0===a?"0":a+b},eV=function(a,b){return 1>Math.abs(a-b)||a<b},fV=function(a,b){return a<b&&
|
|
4
|
+
1<Math.abs(a-b)},gV=function(a,b){return a>b&&1<Math.abs(a-b)},hV=function(a,b){return 1>Math.abs(a-b)||a>b},iV=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},jV=function(a){return new iV(a.left,a.f,a.top,a.a,a.height,a.width)},kV=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"))||
|
|
5
|
+
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 iV(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},lV=function(a,b){return b.some(function(c){return fV(a.left,c.f)&&gV(a.f,c.left)&&fV(a.top,c.a)&&gV(a.a,c.top)})},mV=function(a,b){return hV(a.top,b.top)&&eV(a.a,b.a)&&hV(a.left,b.left)&&eV(a.f,b.f)},nV=function(a,b,c){switch(c){case "+x":return fV(a.left,b.left);case "-x":return gV(a.f,b.f);
|
|
6
|
+
case "+y":return fV(a.top,b.top);case "-y":return gV(a.a,b.a);default:throw Error("Unknown axis");}},oV=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},pV=function(a,b,c){oV.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},rV=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 qV(a)?b:c},uV=function(a,b,c){return qV(a)&&_.N.xa(c)?dV(c,_.Wf):(sV(a)||
|
|
7
|
+
tV(a))&&_.N.xa(b)?dV(b,"%"):UU},sV=function(a){return a.f.writingMode===_.Vg},tV=function(a){return a.f.writingMode===_.Wg},qV=function(a){return a.f.writingMode===_.bj},vV=function(a,b,c){return(sV(a)||tV(a))&&_.N.xa(c)?dV(c,_.Wf):sV(a)&&_.N.R(c)?dV(0,_.Wf):qV(a)&&_.N.xa(b)?dV(b,"%"):UU},wV=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Oe:return a.f.position;case "auto":case _.wd:return a.f.position-a.f.size/2;case _.Pe:return a.f.position-a.f.size}return 0},
|
|
8
|
+
xV=function(a){switch(a.f.positionAlign){case _.Oe:return _.Ke;case "auto":case _.wd:return _.aj;case _.Pe:return _.cg}return a.f.textAlign},yV=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Ke:case _.Ke:return _.Oe;case _.aj:return _.wd;case _.cg:case _.cg:return _.Pe}return a.f.positionAlign},zV=function(a){switch(a.f.writingMode){case _.bj:return"horizontal-tb";case _.Vg:return _.Vg;case _.Wg:return _.Wg;default:throw Error("Unknown writing mode");}},AV=function(a,b){this.l=a;this.f=
|
|
9
|
+
a.a;this.j=void 0===b?!1:b;this.a=kV(a.a);this.h=[]},BV=function(a,b){if(a.j)switch(b.writingMode){case _.bj:return["-y"];case _.Vg:return["+x"];case _.Wg:return["-x"]}var c=[];switch(b.writingMode){case _.bj:c=["+y","-y"];break;case _.Vg:c=["+x","-x"];break;case _.Wg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},CV=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=kV(a.l.a)},DV=function(a,b,c){oV.call(this,a,b,c);this.h=null;this.l=[]},EV=function(a,b){DV.call(this,
|
|
10
|
+
a.id,"clpp-text-cue-region",b);this.f=a},FV=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.gj)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(QU);},HV=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=GV(this,this.h);this.f=GV(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},IV=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=
|
|
11
|
+
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},JV=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,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,
|
|
12
|
+
c)},GV=function(a,b,c){var d=document.createElement(_.vg),e=d.dataset;e.name=PU;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);KV(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},KV=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===PU&&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()})},NV=function(a){_.Gv.call(this,a);var b=this;this.g=new _.K(TU);this.m=a;this.L=LV(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new HV(a.getSurface().getUniqueCssClass());this.a=new DV(null,"clpp-text-container",{});this.w=new _.Yu(a.getSurface(),this.Nk.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 _.li(function(){MV(b)});this.A=new Map;this.l=null},LV=function(a){a=_.N.nb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},OV=function(a,b){return a.startTime<=b&&a.endTime>b},MV=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Uq){a.J=c;var d=PV(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,QV(a),
|
|
15
|
+
d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$v(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 _.ch:h="clpp-text-vtt";break;case _.Jg:h=SU;break;case _.$i:h=RU}h&&!g.classList.contains(h)&&_.tr(g,h);g=kV(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{bV({fontSize:RV(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.ch;var l=e.payloadType===_.Jg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new EV(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new pV(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},PV=function(a,b){var c=XU(a.f,function(e){return OV(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&OV(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
|
|
17
|
+
OV(a.f[c+1],b);)c++;return{start:d,end:c}},SV=function(a){QV(a);a.J=null;a.l=null;a.f=[]},QV=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(SU);b.classList.remove(RU);a=a.a;CV(a.h);a.l=[]}},RV=function(a,b){var c=kV(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Wf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Wf;d=a.getFontSizePercent();return Math.round(c*d)+_.Wf},TV=function(){},
|
|
18
|
+
UV=function(){};
|
|
19
|
+
YU.prototype.parse=function(a){a={input:a};for(var b=_.vr(_.fe),c=[],d=b,e;null!==(e=ZU(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=VV[f];h?(h=_.vr(h),(f=WV[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||XV[g.localName]&&XV[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
|
|
20
|
+
d=g)}}else d.appendChild(document.createTextNode(aV(e)));return b};var VV={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},WV={v:"voice",lang:"lang"},XV={rt:"ruby"},$U={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};oV.prototype.init=function(){this.j=!0};oV.prototype.A=function(){return!1};_.x(pV,oV);pV.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
|
|
21
|
+
pV.prototype.init=function(a){oV.prototype.init.call(this,a);if(this.h)_.tr(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===_.Jg){var c=_.vr(_.fe);c.innerHTML=b.payload;b=c}else b.payloadType===_.ch?b=(new YU).parse(b.payload):(c=_.vr(_.fe),c.textContent=b.payload,b=c);_.tr(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
|
|
22
|
+
c.next();!d.done;d=c.next())_.tr(b,d.value);bV({writingMode:zV(this)},b);this.a.appendChild(b);_.tr(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.tr(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.cj,this.f.line=qV(this)?-1:0);c=zV(this);bV({writingMode:c,webkitWritingMode:c,direction:UU,textAlign:xV(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=wV(this,yV(this));d=vV(this,c,null);var e=uV(this,
|
|
23
|
+
c,null),f=tV(this)&&_.N.R(null)?dV(0,_.Wf):UU;bV({position:"absolute",left:d,right:f,top:e,width:qV(this)?dV(this.f.size,"%"):UU,height:sV(this)||tV(this)?dV(this.f.size,"%"):UU},this.a);d=this.f;a=qV(this)?a.height:a.width;e=rV(this);if(d.lineInterpretation===_.cj)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 _.wd:g-=f/2;break;case _.xe:g-=f}f=Math.round(g/100*a)}tV(this)&&(f=a-f-e);a=f;d=vV(this,c,a);e=tV(this)&&_.N.R(a)?
|
|
24
|
+
dV(0,_.Wf):UU;bV({left:d,right:e,top:uV(this,c,a)},this.a)}cV(this.C,b)}};pV.prototype.o=function(){return _.vr(_.fe)};AV.prototype.append=function(a){var b=a.a;b.style.visibility=_.Fe;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=kV(a.a);var d=BV(this,a.f),e=rV(a),f=jV(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;nV(c,this.a,l)||mV(c,this.a)&&lV(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||mV(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
|
|
25
|
+
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=jV(c),h=l);c=jV(f)}c=g||f}bV({top:dV(c.top-this.a.top,_.Wf),bottom:dV(this.a.a-c.a,_.Wf),left:dV(c.left-this.a.left,_.Wf),right:dV(this.a.f-c.f,_.Wf),height:dV(c.height,_.Wf),width:dV(c.width,_.Wf)},a.a)}b.style.visibility="visible";this.h.push(kV(a.a))};_.x(DV,oV);DV.prototype.init=function(){this.h=new AV(this);this.j=!0};DV.prototype.o=function(){var a=_.vr(_.fe);_.tr(a,this.w);this.id&&(a.id=this.id);return a};DV.prototype.appendChild=function(a){CV(this.h);this.l.unshift(a);a=_.w(this.l);for(var b=a.next();!b.done;b=a.next())this.h.append(b.value)};_.x(EV,DV);
|
|
26
|
+
EV.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.gj:b=b.width/100*a.width;break a;default:throw Error(QU);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.gj)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(QU);d=a.height;var e=FV(this,d,a.height);bV(this.B,this.a);bV({left:dV(c,_.Wf),top:dV(e,_.Wf),width:dV(b,_.Wf),height:dV(d,_.Wf)},this.a);this.f.writingMode&&bV({display:"flex",
|
|
27
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&bV({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.tr(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.gj:b=b.height/100*a.height;break a;case 2:b=b.height;d=new pV(new _.fj(0,1,"Lorem ipsum",_.$i),{},{});c=d.a;this.a.appendChild(c);d.init(kV(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(QU);
|
|
28
|
+
}a=FV(this,b,a.height);bV({top:dV(a,_.Wf),height:dV(b,_.Wf)},this.a);this.h=new AV(this,!0);this.j=!0};EV.prototype.getId=function(){return this.f.id};HV.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=JV(this,a);if(IV(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)}};
|
|
29
|
+
HV.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.");_.B(b)})};_.x(NV,_.Gv);_.t=NV.prototype;_.t.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=WU(this.f,VU(a));this.l=null;MV(this,!1)}};_.t.Xb=function(){null==this.h||MV(this,!0)};
|
|
30
|
+
_.t.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();SV(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;_.B(b)})};_.t.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;MV(this,!0);return!0};_.t.isTextVisible=function(){return this.j};
|
|
31
|
+
_.t.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.Kb(.25),this.L.enableResizeObserver&&this.w.start(),MV(this,!0)):(this.G.stop(),this.w.stop(),SV(this)))};_.t.Nk=function(){MV(this,!0)};_.J(TU,NV);NV.prototype.setTextVisibility=NV.prototype.setTextVisibility;NV.prototype.isTextVisible=NV.prototype.isTextVisible;NV.prototype.remove=NV.prototype.remove;NV.prototype.destroy=NV.prototype.destroy;NV.prototype.append=NV.prototype.append;TV.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Ul()};TV.prototype.create=function(a){return new NV(a)};_.x(UV,_.Fu);UV.prototype.f=function(){_.wq(_.Ge,new TV)};UV.prototype.a=function(){_.uq.has(_.Ge)&&(_.uq["delete"](_.Ge),_.vq.info("Removed factory: 'html'"))};UV.prototype.id=function(){return _.xg};_.J("clpp.htmlcue.HtmlCueComponent",UV);};
|
|
32
32
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
33
33
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
34
34
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ima.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
c;this.M=d;this.j=b;this.J=new _
|
|
4
|
-
d.LOADED,a.
|
|
5
|
-
d.CONTENT_RESUME_REQUESTED,a.
|
|
6
|
-
_.
|
|
7
|
-
_.
|
|
8
|
-
!google.ima||!google.ima.AdsLoader},
|
|
9
|
-
_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.
|
|
10
|
-
_.t.
|
|
11
|
-
_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.t
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_.t.
|
|
16
|
-
_.t.
|
|
17
|
-
_.t.
|
|
18
|
-
_.t.
|
|
19
|
-
_.t.
|
|
20
|
-
_.t.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.G;try{if(typeof c.adTagUrl!==_.
|
|
21
|
-
return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.
|
|
22
|
-
_.t.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.t.
|
|
23
|
-
_.t.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)};_.t.
|
|
24
|
-
|
|
2
|
+
var f=function(window){var wU="clpp.ima.AdsManagerFactory",xU=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},yU=function(){},zU=function(a){this.a=a},AU=function(a){var b=a.ge("ima");if(!b)throw Error("IMA plugin not created.");var c=b.td(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");var e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.l=e;a=this.m.getConfiguration();a=_.N.nb(a.ima||{});this.G=_.N.ua({disableCustomPlayback:!1},a);this.L=
|
|
3
|
+
c;this.M=d;this.j=b;this.J=new _.$u;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.Gk;this.K=!1;this.H=new _.vi;this.P=new yU;this.o=null;this.C=this.A=this.B=!1;this.I=this.w=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.cn.bind(this));c.on(this.j,d,this.bn.bind(this));c.on(this.m,_.ye,this.jn.bind(this))},BU=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Tm.bind(a));c.on(b,
|
|
4
|
+
d.LOADED,a.Rk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kn.bind(a));c.on(b,d.STARTED,a.Uk.bind(a));c.on(b,d.LOG,a.Xm.bind(a));c.on(b,d.AD_PROGRESS,a.Sk.bind(a));c.on(b,d.AD_BUFFERING,a.Um.bind(a));c.on(b,d.FIRST_QUARTILE,a.Pk.bind(a));c.on(b,d.MIDPOINT,a.Ym.bind(a));c.on(b,d.THIRD_QUARTILE,a.Vk.bind(a));c.on(b,d.PAUSED,a.$m.bind(a));c.on(b,d.RESUMED,a.an.bind(a));c.on(b,d.CLICK,a.Ok.bind(a));c.on(b,d.SKIPPED,a.Tk.bind(a));c.on(b,d.IMPRESSION,a.Qk.bind(a));c.on(b,d.COMPLETE,a.Vm.bind(a));c.on(b,
|
|
5
|
+
d.CONTENT_RESUME_REQUESTED,a.ln.bind(a))},CU=function(a){a=a.G;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.md?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===
|
|
6
|
+
_.md&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},EU=function(a){a.o=null;DU(a,_.Nc);a.m.getSurface().hide(a.L)},FU=function(a){_.ur(a.l,{visibility:"visible"})},DU=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new xU(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},GU=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.O(1,9,10003,{errorType:c},b))},HU=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
|
|
7
|
+
_.Mk()},JU=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.M.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.J.canPlay(b),2);c=d.f;if(!c&&!HU(a))return DU(a,_.kd),a.g.warn(_.oa),d["return"]();IU(a);_.B(d)})},KU=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);IU(a);_.B(c)})},IU=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},LU=function(){this.a=this.h=this.f=null},MU=function(){return!window.google||
|
|
8
|
+
!google.ima||!google.ima.AdsLoader},NU=function(){},OU=function(){this.Ca=new _.K(wU)};_.t=xU.prototype;_.t.yb=function(){return"Google IMA SDK"};_.t.zb=function(){return google.ima.VERSION};_.t.Db=function(){return 0};_.t.getId=function(){return this.a.getAdId()};_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.cc=function(){return""};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};
|
|
9
|
+
_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.gc=function(){return this.f?this.f.getIsBumper():!1};_.t.Ab=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.ff&&typeof b[d].clickThroughUrl===_.tg});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};
|
|
10
|
+
_.t.qb=function(){return this.a.getVastMediaWidth()};_.t.pb=function(){return this.a.getVastMediaHeight()};_.t.Xa=function(){return this.a.getVastMediaBitrate()};_.t.Ya=function(){return this.h?2:this.j?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.t.Pb=function(){return this.f?this.f.getTimeOffset():0};_.t.Cb=function(){return this.f?this.f.getAdPosition():1};_.t.rb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
|
|
11
|
+
_.t.canSeek=function(){return!1};_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.t.fc=function(){return null};xU.prototype.getVideoElement=xU.prototype.fc;xU.prototype.getWrapperCreativeIds=xU.prototype.getWrapperCreativeIds;xU.prototype.getWrapperAdSystems=xU.prototype.getWrapperAdSystems;xU.prototype.canSeek=xU.prototype.canSeek;xU.prototype.getWrapperAdIds=xU.prototype.getWrapperAdIds;
|
|
12
|
+
xU.prototype.getSequenceLength=xU.prototype.rb;xU.prototype.getPositionInSequence=xU.prototype.Cb;xU.prototype.getPodTimeOffset=xU.prototype.Pb;xU.prototype.getPodIndex=xU.prototype.getPodIndex;xU.prototype.getPodType=xU.prototype.Ya;xU.prototype.getMediaBitrate=xU.prototype.Xa;xU.prototype.getMediaHeight=xU.prototype.pb;xU.prototype.getMediaWidth=xU.prototype.qb;xU.prototype.getMediaUrl=xU.prototype.getMediaUrl;xU.prototype.getClickThroughUrl=xU.prototype.Ab;xU.prototype.isBumper=xU.prototype.gc;
|
|
13
|
+
xU.prototype.getSkipTimeOffset=xU.prototype.getSkipTimeOffset;xU.prototype.getPosition=xU.prototype.getPosition;xU.prototype.getDuration=xU.prototype.getDuration;xU.prototype.getTitle=xU.prototype.getTitle;xU.prototype.getAdvertiserName=xU.prototype.getAdvertiserName;xU.prototype.getAdSystem=xU.prototype.getAdSystem;xU.prototype.getApiFramework=xU.prototype.getApiFramework;xU.prototype.getSourceId=xU.prototype.cc;xU.prototype.getCreativeId=xU.prototype.getCreativeId;xU.prototype.getId=xU.prototype.getId;
|
|
14
|
+
xU.prototype.getTechnology=xU.prototype.Db;xU.prototype.getAdManagerVersion=xU.prototype.zb;xU.prototype.getAdManagerName=xU.prototype.yb;yU.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}};zU.prototype.getCuePoints=function(){return this.a};zU.prototype.Sb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};zU.prototype.Rb=function(){return 0<=this.a.indexOf(-1)};zU.prototype.hasPostroll=zU.prototype.Rb;zU.prototype.hasPreroll=zU.prototype.Sb;zU.prototype.getCuePoints=zU.prototype.getCuePoints;_.t=AU.prototype;
|
|
15
|
+
_.t.cn=function(a){var b=this;this.a=a.getAdsManager(this.l,CU(this));this.a.isCustomPlaybackUsed()&&!HU(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.O(1,9,10002)),this.Dc()):(this.h=new _.Yu(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.w=new zU(a),this.m.trigger(new _.L(_.Qc,{adsTimeline:this.w})),BU(this));this.f.resolve()};
|
|
16
|
+
_.t.bn=function(a){GU(this,a.getError());this.f.resolve()};_.t.kn=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,HU(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.ur(b.l,{visibility:_.Fe});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:DU(b,_.wc,a),b.h.start(),_.B(c)}})};_.t.Tm=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
|
|
17
|
+
_.t.Rk=function(a){a.getAd().isLinear()?DU(this,_.Gc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.t.Uk=function(a){this.o=a.getAd().getDuration();DU(this,_.Mc,a);this.m.getSurface().show(this.L)};_.t.Xm=function(a){a=a.getAdData();GU(this,a?a.adError:null);EU(this)};_.t.Sk=function(a){DU(this,_.Jc,a)};_.t.Um=function(a){DU(this,_.yc,a)};_.t.Pk=function(a){DU(this,_.Bc,a)};_.t.Ym=function(a){DU(this,_.Hc,a)};_.t.Vk=function(a){DU(this,_.Oc,a)};_.t.$m=function(a){DU(this,_.Ic,a)};
|
|
18
|
+
_.t.an=function(a){DU(this,_.Kc,a)};_.t.Ok=function(a){this.pause();DU(this,_.zc,a)};_.t.Tk=function(a){DU(this,_.Lc,a);EU(this)};_.t.Qk=function(a){DU(this,_.Fc,a)};_.t.Vm=function(a){DU(this,_.Ac,a);EU(this)};
|
|
19
|
+
_.t.ln=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!HU(a)||null===a.I){if(!a.C)return b["return"](a.m.play());FU(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Yt(a.m),3);case 3:if(a.A){b.F(2);break}return _.y(b,a.m.seek(a.I),2);case 2:a.C=!1;a.h&&a.h.stop();if(a.A){b.F(6);break}return _.y(b,a.m.play(),6);case 6:DU(a,_.xc),_.B(b)}})};_.t.jn=function(){this.A=!0;this.j.contentComplete()};
|
|
20
|
+
_.t.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.G;try{if(typeof c.adTagUrl!==_.tg)throw new _.O(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.y(g,a.J.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(g,a.J.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.j.getSettings().setAutoPlayAdBreaks(!1);a.j.requestAds(f);
|
|
21
|
+
return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Sb()?_.y(c,JU(b),0):_.y(c,KU(b,a),0):_.y(c,a.play(),0)})};_.t.kd=function(){};_.t.gd=function(){return!0};_.t.resume=function(){this.a&&this.a.resume()};_.t.pause=function(){this.a&&this.a.pause()};_.t.skip=function(){this.a&&this.a.skip()};_.t.getVolume=function(){return this.a?this.a.getVolume():1};_.t.setVolume=function(a){this.a&&this.a.setVolume(a)};
|
|
22
|
+
_.t.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.t.Dc=function(){this.a&&(this.a.destroy(),this.a=null);FU(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};AU.prototype.getPosition=AU.prototype.getPosition;AU.prototype.setVolume=AU.prototype.setVolume;AU.prototype.getVolume=AU.prototype.getVolume;AU.prototype.skip=AU.prototype.skip;AU.prototype.pause=AU.prototype.pause;AU.prototype.resume=AU.prototype.resume;_.x(LU,_.ew);_.t=LU.prototype;_.t.onPlayerCreated=function(a){if(MU())return a.onError(new _.O(1,9,1E4));this.f=_.sr(_.fe,{"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(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
|
|
23
|
+
_.t.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)};_.t.Zl=function(){return this.a};_.t.Xl=function(){return this.h};_.t.td=function(){return this.f};_.t.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",LU);LU.prototype.getAdContainer=LU.prototype.td;LU.prototype.getAdDisplayContainer=LU.prototype.Xl;LU.prototype.getAdsLoader=LU.prototype.Zl;LU.Id="ima";
|
|
24
|
+
LU.isSdkMissing=MU;NU.prototype.create=function(){return new LU};_.bu(new NU);OU.prototype.name=function(){return wU};OU.prototype.a=function(a,b){return a.namespace()===_.Fd?!1:MU()?(this.Ca.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};OU.prototype.create=function(a){return new AU(a)};_.mr(new OU);};
|
|
25
25
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
26
26
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
27
27
|
else{_=this.clpp._;(f.call(g,this));}
|