@castlabs/prestoplay 6.4.0 → 6.5.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 +57 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +421 -402
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +54 -133
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +258 -255
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +69 -69
- package/cjs/cl.thumbnails.js +24 -24
- 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 +13 -13
- package/cjs/cl.vr.js +19 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- 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 +363 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +49 -132
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +230 -231
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- 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 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -16
- package/package.json +8 -2
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
return a},
|
|
4
|
-
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
|
|
5
|
-
b){return
|
|
6
|
-
b=c.height/d.length;c=c.width/d.length;return
|
|
7
|
-
case "auto":case _.
|
|
8
|
-
case _.
|
|
9
|
-
a.a=
|
|
10
|
-
this.
|
|
11
|
-
a.g.deleteRule(0);return c},
|
|
12
|
-
c.
|
|
13
|
-
|
|
14
|
-
null},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
c
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
oJ.prototype.isTextVisible=oJ.prototype.isTextVisible;oJ.prototype.remove=oJ.prototype.remove;oJ.prototype.destroy=oJ.prototype.destroy;oJ.prototype.append=oJ.prototype.append;uJ.prototype.W=function(a){return!!a.enableHtmlCue&&!_.Ki()};uJ.prototype.create=function(a){return new oJ(a)};uJ.prototype.create=uJ.prototype.create;uJ.prototype.isSupported=uJ.prototype.W;_.v(vJ,_.Zn);vJ.prototype.Ja=function(){_.Wl("html",new uJ)};vJ.prototype.Ca=function(){};vJ.prototype.id=function(){return _.we};_.C("clpp.htmlcue.HtmlCueComponent",vJ);};
|
|
2
|
+
var f=function(window){var NI="CLPP Subtitle Styles",OI="Unsupported unit",PI="clpp-text-plain",QI="clpp-text-ttml",RI="clpp.htmlcue.HtmlTextDisplayer",SI="initial",TI=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},UI=function(){},VI=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},XI=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
|
|
3
|
+
function(c){return WI[c]});return a},ZI=function(a,b){YI(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){YI(a,c)})},YI=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},$I=function(a,b){return 0===a?"0":a+b},aJ=function(a,b){return 1>Math.abs(a-b)||a<b},bJ=function(a,b){return a<b&&1<Math.abs(a-b)},cJ=function(a,b){return a>b&&1<Math.abs(a-b)},dJ=function(a,b){return 1>Math.abs(a-b)||a>b},eJ=function(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=
|
|
4
|
+
f},fJ=function(a){return new eJ(a.f,a.g,a.h,a.a,a.height,a.width)},gJ=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 eJ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
5
|
+
d-e)},hJ=function(a,b){return b.some(function(c){return bJ(a.f,c.g)&&cJ(a.g,c.f)&&bJ(a.h,c.a)&&cJ(a.a,c.h)})},iJ=function(a,b){return dJ(a.h,b.h)&&aJ(a.a,b.a)&&dJ(a.f,b.f)&&aJ(a.g,b.g)},jJ=function(a,b,c){switch(c){case "+x":return bJ(a.f,b.f);case "-x":return cJ(a.g,b.g);case "+y":return bJ(a.h,b.h);case "-y":return cJ(a.a,b.a);default:throw Error("Unknown axis");}},kJ=function(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1},lJ=function(a,b,c){kJ.call(this,a.id,"clpp-text-cue",{});
|
|
6
|
+
this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},nJ=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 mJ(a)?b:c},qJ=function(a,b,c){return mJ(a)&&_.K.ka(c)?$I(c,_.be):(oJ(a)||pJ(a))&&_.K.ka(b)?$I(b,"%"):SI},oJ=function(a){return a.f.writingMode===_.Oe},pJ=function(a){return a.f.writingMode===_.Pe},mJ=function(a){return a.f.writingMode===_.ug},rJ=function(a,b,c){return(oJ(a)||pJ(a))&&_.K.ka(c)?$I(c,_.be):
|
|
7
|
+
oJ(a)&&_.K.S(c)?$I(0,_.be):mJ(a)&&_.K.ka(b)?$I(b,"%"):SI},sJ=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.sd:return a.f.position;case "auto":case _.Ac:return a.f.position-a.f.size/2;case _.td:return a.f.position-a.f.size}return 0},tJ=function(a){switch(a.f.positionAlign){case _.sd:return _.pd;case "auto":case _.Ac:return _.tg;case _.td:return _.ie}return a.f.textAlign},uJ=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.pd:case _.pd:return _.sd;
|
|
8
|
+
case _.tg:return _.Ac;case _.ie:case _.ie:return _.td}return a.f.positionAlign},vJ=function(a){switch(a.f.writingMode){case _.ug:return"horizontal-tb";case _.Oe:return _.Oe;case _.Pe:return _.Pe;default:throw Error("Unknown writing mode");}},wJ=function(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=gJ(a.a);this.g=[]},xJ=function(a,b){if(a.h)switch(b.writingMode){case _.ug:return["-y"];case _.Oe:return["+x"];case _.Pe:return["-x"]}var c=[];switch(b.writingMode){case _.ug:c=["+y","-y"];break;
|
|
9
|
+
case _.Oe:c=["+x","-x"];break;case _.Pe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},yJ=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=gJ(a.j.a)},zJ=function(a,b,c){kJ.call(this,a,b,c);this.g=null;this.j=[]},AJ=function(a,b){yJ(a.g);a.j.unshift(b);for(var c=_.u(a.j),d=c.next();!d.done;d=c.next())a.g.append(d.value)},BJ=function(a,b){zJ.call(this,a.id,"clpp-text-cue-region",b);this.f=a},CJ=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.zg)return a.viewportAnchorY/
|
|
10
|
+
100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(OI);},EJ=function(a){this.f=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=DJ(this,this.h);this.g=DJ(this,this.h,!0);this.g.disabled=!0;this.f.debug("Stylesheet CLPP Subtitle Styles has been created.")},FJ=function(a,b){var c=!1;try{a.g.insertRule(b,0);var d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
|
|
11
|
+
e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},GJ=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,c)},DJ=function(a,b,c){var d=document.createElement(_.we),e=d.dataset;e.name=NI;
|
|
12
|
+
e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);HJ(a,b);a.f.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},HJ=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===NI&&a.f.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.m.push(function(){return c.disconnect()})},
|
|
13
|
+
KJ=function(a){_.Vp.call(this,a);var b=this;this.N=new _.H(RI);this.l=a;this.L=IJ(a);this.h=!1;this.f=[];this.B=a.getSurface().getContainer();this.g=new EJ(a);this.a=new zJ(null,"clpp-text-container",{});this.o=new _.rp(a.getSurface(),this.oh.bind(this));this.J=null;this.B?(this.B.appendChild(this.a.a),this.a.init(null)):this.N.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.D=new _.Ni(function(){JJ(b)});
|
|
14
|
+
this.w=new Map;this.j=null},IJ=function(a){a=_.K.Na(a.getConfiguration().htmlcue||{});_.K.S(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.S(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},LJ=function(a,b){return a.startTime<=b&&a.endTime>b},JJ=function(a,b){if((b||a.h)&&a.B){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.cn){a.J=c;var d=MJ(a,c);(c=b)||(c=a.j,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.j=d,NJ(a),d)){c={color:a.getFontColor()||
|
|
15
|
+
void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$p(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(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 _.Xe:h="clpp-text-vtt";break;case _.Ge:h=QI;break;case _.sg:h=PI}h&&!g.classList.contains(h)&&_.An(g,h);g=gJ(f.a.a);if(0===g.width||0===g.height)f.N.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{YI({fontSize:OJ(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Xe;var l=e.payloadType===_.Ge;e.region&&(h||l||e.backgroundImage)&&(f.w.has(e.region.id)?g=f.w.get(e.region.id):(g=new BJ(e.region,{}),f.w.set(e.region.id,g),AJ(f.a,g)));e=new lJ(e,f.L,c);g?AJ(g,e):AJ(f.a,e)}}}}}},MJ=function(a,b){var c=TI(a.f,function(e){return LJ(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&LJ(a.f[d-1],b);)d--;for(;c+1<a.f.length&&LJ(a.f[c+1],b);)c++;return{start:d,
|
|
17
|
+
end:c}},PJ=function(a){NJ(a);a.J=null;a.j=null;a.f=[]},NJ=function(a){a.w.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(QI);b.classList.remove(PI);a=a.a;yJ(a.g);a.j=[]}},OJ=function(a,b){var c=gJ(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.A){var d=a.getFontSizePercent();return Math.round(c*d)+_.be}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.be;d=a.getFontSizePercent();return Math.round(c*d)+_.be},QJ=function(){},RJ=function(){};
|
|
18
|
+
UI.prototype.parse=function(a){a={input:a};for(var b=_.Cn(_.Wc),c=[],d=b,e;null!==(e=VI(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=SJ[f];h?(h=_.Cn(h),(f=TJ[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||UJ[g.localName]&&UJ[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
|
|
19
|
+
d=g)}}else d.appendChild(document.createTextNode(XI(e)));return b};var SJ={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},TJ={v:"voice",lang:"lang"},UJ={rt:"ruby"},WI={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};kJ.prototype.init=function(){this.h=!0};kJ.prototype.w=function(){return!1};_.v(lJ,kJ);lJ.prototype.w=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
|
|
20
|
+
lJ.prototype.init=function(a){kJ.prototype.init.call(this,a);if(this.g)_.An(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Ge){var c=_.Cn(_.Wc);c.innerHTML=b.payload;b=c}else b.payloadType===_.Xe?b=(new UI).parse(b.payload):(c=_.Cn(_.Wc),c.textContent=b.payload,b=c);_.An(b,this.o);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
|
|
21
|
+
c.next();!d.done;d=c.next())_.An(b,d.value);YI({writingMode:vJ(this)},b);this.a.appendChild(b);_.An(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.An(this.a,"clpp-text-wrapper__"+d.value);_.K.S(this.f.line)&&(this.f.lineInterpretation=_.vg,this.f.line=mJ(this)?-1:0);c=vJ(this);YI({writingMode:c,webkitWritingMode:c,direction:SI,textAlign:tJ(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=sJ(this,uJ(this));d=rJ(this,c,null);var e=qJ(this,
|
|
22
|
+
c,null),f=pJ(this)&&_.K.S(null)?$I(0,_.be):SI;YI({position:"absolute",left:d,right:f,top:e,width:mJ(this)?$I(this.f.size,"%"):SI,height:oJ(this)||pJ(this)?$I(this.f.size,"%"):SI},this.a);d=this.f;a=mJ(this)?a.height:a.width;e=nJ(this);if(d.lineInterpretation===_.vg)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 _.Ac:g-=f/2;break;case _.ed:g-=f}f=Math.round(g/100*a)}pJ(this)&&(f=a-f-e);a=f;d=rJ(this,c,a);e=pJ(this)&&_.K.S(a)?
|
|
23
|
+
$I(0,_.be):SI;YI({left:d,right:e,top:qJ(this,c,a)},this.a)}ZI(this.B,b)}};lJ.prototype.m=function(){return _.Cn(_.Wc)};wJ.prototype.append=function(a){var b=a.a;b.style.visibility=_.kd;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=gJ(a.a);var d=xJ(this,a.f),e=nJ(a),f=fJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;jJ(c,this.a,l)||iJ(c,this.a)&&hJ(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.h+=n;m.a+=n;break;case "-y":m.h-=n,m.a-=n}}if(this.h||iJ(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
|
|
24
|
+
l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=fJ(c),h=l);c=fJ(f)}c=g||f}YI({top:$I(c.h-this.a.h,_.be),bottom:$I(this.a.a-c.a,_.be),left:$I(c.f-this.a.f,_.be),right:$I(this.a.g-c.g,_.be),height:$I(c.height,_.be),width:$I(c.width,_.be)},a.a)}b.style.visibility="visible";this.g.push(gJ(a.a))};_.v(zJ,kJ);zJ.prototype.init=function(){this.g=new wJ(this);this.h=!0};zJ.prototype.m=function(){var a=_.Cn(_.Wc);_.An(a,this.o);this.id&&(a.id=this.id);return a};_.v(BJ,zJ);
|
|
25
|
+
BJ.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.zg:b=b.width/100*a.width;break a;default:throw Error(OI);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.zg)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(OI);d=a.height;var e=CJ(this,d,a.height);YI(this.A,this.a);YI({left:$I(c,_.be),top:$I(e,_.be),width:$I(b,_.be),height:$I(d,_.be)},this.a);this.f.writingMode&&YI({display:"flex",
|
|
26
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&YI({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.An(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.zg:b=b.height/100*a.height;break a;case 2:b=b.height;d=new lJ(new _.yg(0,1,"Lorem ipsum",_.sg),{},{});c=d.a;this.a.appendChild(c);d.init(gJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(OI);
|
|
27
|
+
}a=CJ(this,b,a.height);YI({top:$I(a,_.be),height:$I(b,_.be)},this.a);this.g=new wJ(this,!0);this.h=!0};BJ.prototype.getId=function(){return this.f.id};EJ.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=GJ(this,a);if(FJ(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug("Added CSS rule "+b)}catch(c){this.f.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.f.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
28
|
+
EJ.prototype.destroy=function(){var a=this;return _.B(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.g.ownerNode);a.a=null;a.g=null;a.f.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.v(KJ,_.Vp);_.t=KJ.prototype;
|
|
29
|
+
_.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={od:c.od},e=d.next())c.od=e.value,this.f.some(function(f){return function(g){var h=f.od;return g.payload!==h.payload?!1:
|
|
30
|
+
g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.od);this.j=null;JJ(this,!1)}};_.t.pb=function(){null==this.g||JJ(this,!0)};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a){if(null==a.g)return b["return"]();PJ(a);a.D.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.B.removeChild(a.a.a);a.a=null;a.o.stop();a.o=null;a.h=!1;_.z(b)})};
|
|
31
|
+
_.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;JJ(this,!0);return!0};_.t.isTextVisible=function(){return this.h};_.t.setTextVisibility=function(a){null!=this.g&&this.h!==a&&((this.h=a)?(this.D.bb(.25),this.L.enableResizeObserver&&this.o.start(),JJ(this,!0)):(this.D.stop(),this.o.stop(),PJ(this)))};_.t.oh=function(){JJ(this,!0)};_.C(RI,KJ);KJ.prototype.setTextVisibility=KJ.prototype.setTextVisibility;
|
|
32
|
+
KJ.prototype.isTextVisible=KJ.prototype.isTextVisible;KJ.prototype.remove=KJ.prototype.remove;KJ.prototype.destroy=KJ.prototype.destroy;KJ.prototype.append=KJ.prototype.append;QJ.prototype.ca=function(a){return!!a.enableHtmlCue&&!_.Wi()};QJ.prototype.create=function(a){return new KJ(a)};_.v(RJ,_.Bo);RJ.prototype.Ja=function(){_.xm("html",new QJ)};RJ.prototype.Ca=function(){};RJ.prototype.id=function(){return _.ye};_.C("clpp.htmlcue.HtmlCueComponent",RJ);};
|
|
34
33
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
35
34
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
36
35
|
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
|
-
null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.
|
|
4
|
-
a.
|
|
5
|
-
a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.
|
|
6
|
-
function(a){_.
|
|
7
|
-
c.a)return a.
|
|
8
|
-
_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.
|
|
9
|
-
_.t.
|
|
10
|
-
_.t.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_.t.
|
|
15
|
-
_.t.
|
|
16
|
-
_.t.
|
|
17
|
-
_.t.
|
|
18
|
-
_.t.load=function(){var a=this,b,c,d,e,f;return _.
|
|
19
|
-
_.t.start=function(a){var b=this;return _.
|
|
2
|
+
var f=function(window){var vI="clpp.ima.AdsManagerFactory",wI=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c},xI=function(){},yI=function(a){this.a=a},zI=function(a){this.l=a;this.j=a.getSurface().getMedia();a=this.l.getConfiguration();this.L=_.K.Na(a.ima||{});this.m=this.l.bc("ima").Fc();this.K=this.l.bc("ima").g;this.o=this.l.bc("ima").a;this.I=new _.tp;this.R=new _.H("clpp.ima");this.h=this.a=null;this.f=new _.Nh;this.F=!1;this.w=new _.dg;this.T=new xI;this.A=null;this.J=this.D=this.N=this.B=!1;this.g=
|
|
3
|
+
null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Pi.bind(this));a.on(this.o,b,this.Oi.bind(this));a.one(this.j,_.fd,this.Wi.bind(this))},AI=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.LOADED,a.sh.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Xi.bind(a));c.on(b,d.STARTED,a.uh.bind(a));c.on(b,d.LOG,a.Ii.bind(a));c.on(b,d.AD_PROGRESS,a.Mi.bind(a));c.on(b,d.AD_BUFFERING,a.Fi.bind(a));c.on(b,d.FIRST_QUARTILE,
|
|
4
|
+
a.qh.bind(a));c.on(b,d.MIDPOINT,a.Ji.bind(a));c.on(b,d.THIRD_QUARTILE,a.vh.bind(a));c.on(b,d.PAUSED,a.Li.bind(a));c.on(b,d.RESUMED,a.Ni.bind(a));c.on(b,d.CLICK,a.ph.bind(a));c.on(b,d.SKIPPED,a.th.bind(a));c.on(b,d.IMPRESSION,a.rh.bind(a));c.on(b,d.COMPLETE,a.Gi.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.Yi.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Ri.bind(a))},BI=function(a){a=a.L;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=
|
|
5
|
+
a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.rc?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===_.rc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},DI=function(a){a.A=null;CI(a,_.Tb);a.m&&a.l.getSurface().hide(a.m)},EI=
|
|
6
|
+
function(a){_.Bn(a.j,{visibility:"visible"})},CI=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new wI(c,a.B,a.N)});a.l.trigger(new _.J(b,d))},FI=function(a,b){var c=b?a.T.create(b.getErrorCode()):null;a.l.onError(new _.L(1,9,10003,{errorType:c},b))},HI=function(a){var b,c;return _.B(function(d){if(1==d.a)return a.K.initialize(),b=!!a.l.getConfiguration().muted,_.x(d,a.I.canPlay(b),2);c=d.f;if(!c)return CI(a,_.pc),a.R.warn(_.ma),d["return"]();GI(a);_.z(d)})},II=function(a,b){return _.B(function(c){if(1==
|
|
7
|
+
c.a)return a.K.initialize(),_.x(c,b.play(),2);GI(a);_.z(c)})},GI=function(a){a.a.init(a.j.offsetWidth,a.j.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.F=!0},JI=function(){this.a=this.g=this.f=null},KI=function(){return!window.google||!google.ima||!google.ima.AdsLoader},LI=function(){},MI=function(){this.a=new _.H(vI)};_.t=wI.prototype;_.t.sb=function(){return"Google IMA SDK"};_.t.tb=function(){return google.ima.VERSION};_.t.yb=function(){return 0};_.t.getId=function(){return this.a.getAdId()};
|
|
8
|
+
_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.fc=function(){return this.f?this.f.getIsBumper():!1};
|
|
9
|
+
_.t.Kb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Jd&&typeof b[d].clickThroughUrl===_.ue});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};_.t.vb=function(){return this.a.getVastMediaWidth()};_.t.ub=function(){return this.a.getVastMediaHeight()};_.t.hb=function(){return this.a.getVastMediaBitrate()};_.t.Va=function(){return this.g?2:this.h?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};
|
|
10
|
+
_.t.Lb=function(){return this.f?this.f.getTimeOffset():0};_.t.Mb=function(){return this.f?this.f.getAdPosition():1};_.t.xb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};wI.prototype.getWrapperCreativeIds=wI.prototype.getWrapperCreativeIds;wI.prototype.getWrapperAdSystems=wI.prototype.getWrapperAdSystems;
|
|
11
|
+
wI.prototype.getWrapperAdIds=wI.prototype.getWrapperAdIds;wI.prototype.getSequenceLength=wI.prototype.xb;wI.prototype.getPositionInSequence=wI.prototype.Mb;wI.prototype.getPodTimeOffset=wI.prototype.Lb;wI.prototype.getPodIndex=wI.prototype.getPodIndex;wI.prototype.getPodType=wI.prototype.Va;wI.prototype.getMediaBitrate=wI.prototype.hb;wI.prototype.getMediaHeight=wI.prototype.ub;wI.prototype.getMediaWidth=wI.prototype.vb;wI.prototype.getMediaUrl=wI.prototype.getMediaUrl;
|
|
12
|
+
wI.prototype.getClickThroughUrl=wI.prototype.Kb;wI.prototype.isBumper=wI.prototype.fc;wI.prototype.getSkipTimeOffset=wI.prototype.getSkipTimeOffset;wI.prototype.getDuration=wI.prototype.getDuration;wI.prototype.getTitle=wI.prototype.getTitle;wI.prototype.getAdvertiserName=wI.prototype.getAdvertiserName;wI.prototype.getAdSystem=wI.prototype.getAdSystem;wI.prototype.getApiFramework=wI.prototype.getApiFramework;wI.prototype.getCreativeId=wI.prototype.getCreativeId;wI.prototype.getId=wI.prototype.getId;
|
|
13
|
+
wI.prototype.getTechnology=wI.prototype.yb;wI.prototype.getAdManagerVersion=wI.prototype.tb;wI.prototype.getAdManagerName=wI.prototype.sb;xI.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}};yI.prototype.getCuePoints=function(){return this.a};yI.prototype.Nb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};yI.prototype.ib=function(){return 0<=this.a.indexOf(-1)};yI.prototype.hasPostroll=yI.prototype.ib;yI.prototype.hasPreroll=yI.prototype.Nb;yI.prototype.getCuePoints=yI.prototype.getCuePoints;_.t=zI.prototype;
|
|
14
|
+
_.t.Pi=function(a){var b=this;this.a=a.getAdsManager(this.j,BI(this));this.a.isCustomPlaybackUsed()?(this.R.warn("IMA plugin does not work correctly right now on platforms with single video element. Disposing."),this.l.onError(new _.L(1,9,10002)),this.dispose()):(this.h=new _.rp(this.l.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.g=new yI(a),this.l.trigger(new _.J(_.Wb,{adsTimeline:this.g})),AI(this));this.f.resolve()};
|
|
15
|
+
_.t.Oi=function(a){FI(this,a.getError());this.f.resolve()};_.t.Xi=function(a){var b=this;return _.B(function(c){if(1==c.a)return b.D=!0,_.x(c,b.l.pause(),2);_.Bn(b.j,{visibility:_.kd});CI(b,_.Fb,a);b.h.start();_.z(c)})};_.t.sh=function(a){a.getAd().isLinear()?CI(this,_.Mb,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.l.play()))};_.t.uh=function(a){this.A=a.getAd().getDuration();CI(this,_.Sb,a);this.l.getSurface().show(this.m)};_.t.Ii=function(a){a=a.getAdData();FI(this,a?a.adError:null);DI(this)};
|
|
16
|
+
_.t.Mi=function(a){CI(this,_.Pb,a)};_.t.Fi=function(a){CI(this,_.Hb,a)};_.t.qh=function(a){CI(this,_.Kb,a)};_.t.Ji=function(a){CI(this,_.Nb,a)};_.t.vh=function(a){CI(this,_.Ub,a)};_.t.Li=function(a){CI(this,_.Ob,a)};_.t.Ni=function(a){CI(this,_.Qb,a)};_.t.ph=function(a){this.pause();CI(this,_.Ib,a)};_.t.th=function(a){CI(this,_.Rb,a);DI(this)};_.t.rh=function(a){CI(this,_.Lb,a)};_.t.Gi=function(a){CI(this,_.Jb,a);DI(this)};
|
|
17
|
+
_.t.Yi=function(){this.B=!0;if(!this.D)return this.l.play();this.D=!1;this.h.stop();this.l.isEnded()||this.l.play();CI(this,_.Gb);EI(this)};_.t.Ri=function(){this.J=!0};_.t.Wi=function(){this.N=!0;this.o.contentComplete()};
|
|
18
|
+
_.t.load=function(){var a=this,b,c,d,e,f;return _.B(function(g){if(1==g.a){b=a.l;c=a.L;try{if(typeof c.adTagUrl!==_.ue)throw new _.L(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.x(g,a.I.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(g,a.I.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.o.requestAds(f);return g["return"](a.f)})};
|
|
19
|
+
_.t.start=function(a){var b=this;return _.B(function(c){return b.a&&b.g&&!b.F?b.g.Nb()?_.x(c,HI(b),0):_.x(c,II(b,a),0):_.x(c,a.play(),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)};
|
|
20
20
|
_.t.getPosition=function(){if(!this.a||null===this.A)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.A-a};
|
|
21
|
-
_.t.dispose=function(){var a=this;return(new Promise(function(b){a.
|
|
22
|
-
|
|
23
|
-
_.t.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.t.
|
|
24
|
-
|
|
21
|
+
_.t.dispose=function(){var a=this;return(new Promise(function(b){a.F&&a.g&&a.g.ib()&&!a.J?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.m&&a.l.getSurface().hide(a.m)}),_.eg(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.o.contentComplete()})).then(function(){EI(a);a.w.release();a.h&&(a.h.stop(),a.h=null);a.a&&(a.a.destroy(),a.a=null)})};zI.prototype.getPosition=zI.prototype.getPosition;
|
|
22
|
+
zI.prototype.setVolume=zI.prototype.setVolume;zI.prototype.getVolume=zI.prototype.getVolume;zI.prototype.skip=zI.prototype.skip;zI.prototype.pause=zI.prototype.pause;zI.prototype.resume=zI.prototype.resume;_.v(JI,_.eq);_.t=JI.prototype;_.t.onPlayerCreated=function(a){if(KI())return a.onError(new _.L(1,9,1E4));this.f=_.zn(_.Wc,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.ta);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)};
|
|
23
|
+
_.t.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.t.gi=function(){return this.a};_.t.ei=function(){return this.g};_.t.Fc=function(){return this.f};_.t.id=function(){return"ima"};_.C("clpp.ima.ImaPlugin",JI);JI.prototype.getAdContainer=JI.prototype.Fc;JI.prototype.getAdDisplayContainer=JI.prototype.ei;JI.prototype.getAdsLoader=JI.prototype.gi;JI.Id="ima";
|
|
24
|
+
JI.isSdkMissing=KI;LI.prototype.create=function(){return new JI};_.wo(new LI);MI.prototype.name=function(){return vI};MI.prototype.ca=function(a,b){return a.namespace()===_.Gc?!1:KI()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};MI.prototype.create=function(a){return new zI(a)};MI.prototype.create=MI.prototype.create;MI.prototype.isSupported=MI.prototype.ca;MI.prototype.name=MI.prototype.name;_.wn(new MI);};
|
|
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));}
|