@castlabs/prestoplay 6.13.0 → 6.14.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 +42 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +528 -518
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +60 -58
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -67
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +265 -274
- package/cjs/cl.muxdata.js +15 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +70 -70
- package/cjs/cl.ttml.js +28 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- 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 +441 -431
- package/cl.crypto.js +8 -8
- package/cl.dash.js +68 -68
- package/cl.externs.js +60 -58
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +71 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +236 -239
- package/cl.muxdata.js +13 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- 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.youbora.js +15 -15
- package/clpp.styles.css +2 -0
- package/package.json +4 -4
- package/typings.d.ts +93 -50
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
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.l.unshift(b);for(var c=_.u(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
c
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_.r.
|
|
31
|
-
_.r.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.hb(.25),this.M.enableResizeObserver&&this.w.start(),JO(this,!0)):(this.G.stop(),this.w.stop(),PO(this)))};_.r.yd=function(){return this.f};_.r.Ui=function(){JO(this,!0)};_.H(PN,KO);KO.prototype.setTextVisibility=KO.prototype.setTextVisibility;KO.prototype.isTextVisible=KO.prototype.isTextVisible;KO.prototype.remove=KO.prototype.remove;KO.prototype.destroy=KO.prototype.destroy;KO.prototype.append=KO.prototype.append;QO.prototype.ba=function(a){return!!a.enableHtmlCue&&!_.Dk()};QO.prototype.create=function(a){return new KO(a)};_.w(RO,_.Hr);RO.prototype.f=function(){_.to(_.se,new QO)};RO.prototype.a=function(){_.ro.has(_.se)&&(_.ro["delete"](_.se),_.so.info("Removed factory: 'html'"))};RO.prototype.id=function(){return _.$f};_.H("clpp.htmlcue.HtmlCueComponent",RO);};
|
|
2
|
+
var f=function(window){var hO="CLPP Subtitle Styles",iO="Unsupported unit",jO="clpp-text-plain",kO="clpp-text-ttml",lO="clpp.htmlcue.HtmlTextDisplayer",mO="initial",nO=function(a){return _.Xh(a,{ug:function(b,c){return b.ta(c)}})},oO=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)},pO=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},qO=function(){},rO=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},tO=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return sO[c]});return a},vO=function(a,b){uO(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){uO(a,c)})},uO=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},wO=function(a,b){return 0===a?"0":a+b},xO=function(a,b){return 1>Math.abs(a-b)||a<b},yO=function(a,b){return a<b&&
|
|
4
|
+
1<Math.abs(a-b)},zO=function(a,b){return a>b&&1<Math.abs(a-b)},AO=function(a,b){return 1>Math.abs(a-b)||a>b},BO=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},CO=function(a){return new BO(a.left,a.f,a.top,a.a,a.height,a.width)},DO=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 BO(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},EO=function(a,b){return b.some(function(c){return yO(a.left,c.f)&&zO(a.f,c.left)&&yO(a.top,c.a)&&zO(a.a,c.top)})},FO=function(a,b){return AO(a.top,b.top)&&xO(a.a,b.a)&&AO(a.left,b.left)&&xO(a.f,b.f)},GO=function(a,b,c){switch(c){case "+x":return yO(a.left,b.left);case "-x":return zO(a.f,b.f);
|
|
6
|
+
case "+y":return yO(a.top,b.top);case "-y":return zO(a.a,b.a);default:throw Error("Unknown axis");}},HO=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},IO=function(a,b,c){HO.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.D=c},KO=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 JO(a)?b:c},NO=function(a,b,c){return JO(a)&&_.O.na(c)?wO(c,_.Ff):(LO(a)||
|
|
7
|
+
MO(a))&&_.O.na(b)?wO(b,"%"):mO},LO=function(a){return a.f.writingMode===_.rg},MO=function(a){return a.f.writingMode===_.sg},JO=function(a){return a.f.writingMode===_.$h},OO=function(a,b,c){return(LO(a)||MO(a))&&_.O.na(c)?wO(c,_.Ff):LO(a)&&_.O.R(c)?wO(0,_.Ff):JO(a)&&_.O.na(b)?wO(b,"%"):mO},PO=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ee:return a.f.position;case "auto":case _.td:return a.f.position-a.f.size/2;case _.Fe:return a.f.position-a.f.size}return 0},
|
|
8
|
+
QO=function(a){switch(a.f.positionAlign){case _.Ee:return _.Be;case "auto":case _.td:return _.Zh;case _.Fe:return _.Mf}return a.f.textAlign},RO=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Be:case _.Be:return _.Ee;case _.Zh:return _.td;case _.Mf:case _.Mf:return _.Fe}return a.f.positionAlign},SO=function(a){switch(a.f.writingMode){case _.$h:return"horizontal-tb";case _.rg:return _.rg;case _.sg:return _.sg;default:throw Error("Unknown writing mode");}},TO=function(a,b){this.l=a;this.f=
|
|
9
|
+
a.a;this.j=void 0===b?!1:b;this.a=DO(a.a);this.h=[]},UO=function(a,b){if(a.j)switch(b.writingMode){case _.$h:return["-y"];case _.rg:return["+x"];case _.sg:return["-x"]}var c=[];switch(b.writingMode){case _.$h:c=["+y","-y"];break;case _.rg:c=["+x","-x"];break;case _.sg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},VO=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=DO(a.l.a)},WO=function(a,b,c){HO.call(this,a,b,c);this.h=null;this.l=[]},XO=function(a,b){VO(a.h);
|
|
10
|
+
a.l.unshift(b);for(var c=_.u(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},YO=function(a,b){WO.call(this,a.id,"clpp-text-cue-region",b);this.f=a},ZO=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.ei)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(iO);},aP=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.l=[];this.h=a;this.j=[];this.a=$O(this,this.h);this.f=$O(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},
|
|
11
|
+
bP=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},cP=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)},$O=function(a,b,c){var d=document.createElement(_.$f),e=d.dataset;e.name=hO;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);dP(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},dP=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===hO&&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.l.push(function(){return c.disconnect()})},gP=function(a){_.Wt.call(this,a);var b=this;this.g=new _.K(lO);this.m=a;this.L=eP(a.getConfiguration());this.j=!1;this.f=[];this.D=a.getSurface().getContainer();this.h=new aP(a.getSurface().getUniqueCssClass());this.a=new WO(null,"clpp-text-container",{});this.w=new _.Xs(a.getSurface(),this.Xi.bind(this));this.J=null;this.D?(this.D.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 _.Gk(function(){fP(b)});this.A=new Map;this.l=null},eP=function(a){a=_.O.Na(a.htmlcue||{});_.O.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.O.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},hP=function(a,b){return a.startTime<=b&&a.endTime>b},fP=function(a,b){if((b||a.j)&&a.D){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.ip){a.J=c;var d=iP(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,jP(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=_.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 _.Ag:h="clpp-text-vtt";break;case _.hg:h=kO;break;case _.Yh:h=jO}h&&!g.classList.contains(h)&&_.Gp(g,h);g=DO(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{uO({fontSize:kP(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Ag;var l=e.payloadType===_.hg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new YO(e.region,{}),f.A.set(e.region.id,g),XO(f.a,g)));e=new IO(e,f.L,c);g?XO(g,e):XO(f.a,e)}}}}}},iP=function(a,b){var c=pO(a.f,function(e){return hP(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&hP(a.f[d-1],b);)d--;for(;c+1<a.f.length&&hP(a.f[c+1],b);)c++;return{start:d,
|
|
17
|
+
end:c}},lP=function(a){jP(a);a.J=null;a.l=null;a.f=[]},jP=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(kO);b.classList.remove(jO);a=a.a;VO(a.h);a.l=[]}},kP=function(a,b){var c=DO(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Ff}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Ff;d=a.getFontSizePercent();return Math.round(c*d)+_.Ff},mP=function(){},nP=function(){};
|
|
18
|
+
qO.prototype.parse=function(a){a={input:a};for(var b=_.Ip(_.Zd),c=[],d=b,e;null!==(e=rO(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=oP[f];h?(h=_.Ip(h),(f=pP[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||qP[g.localName]&&qP[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(tO(e)));return b};var oP={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},pP={v:"voice",lang:"lang"},qP={rt:"ruby"},sO={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};HO.prototype.init=function(){this.j=!0};HO.prototype.A=function(){return!1};_.w(IO,HO);IO.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
|
|
20
|
+
IO.prototype.init=function(a){HO.prototype.init.call(this,a);if(this.h)_.Gp(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.hg){var c=_.Ip(_.Zd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ag?b=(new qO).parse(b.payload):(c=_.Ip(_.Zd),c.textContent=b.payload,b=c);_.Gp(b,this.w);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
|
|
21
|
+
c.next();!d.done;d=c.next())_.Gp(b,d.value);uO({writingMode:SO(this)},b);this.a.appendChild(b);_.Gp(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.Gp(this.a,"clpp-text-wrapper__"+d.value);_.O.R(this.f.line)&&(this.f.lineInterpretation=_.ai,this.f.line=JO(this)?-1:0);c=SO(this);uO({writingMode:c,webkitWritingMode:c,direction:mO,textAlign:QO(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=PO(this,RO(this));d=OO(this,c,null);var e=NO(this,
|
|
22
|
+
c,null),f=MO(this)&&_.O.R(null)?wO(0,_.Ff):mO;uO({position:"absolute",left:d,right:f,top:e,width:JO(this)?wO(this.f.size,"%"):mO,height:LO(this)||MO(this)?wO(this.f.size,"%"):mO},this.a);d=this.f;a=JO(this)?a.height:a.width;e=KO(this);if(d.lineInterpretation===_.ai)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 _.td:g-=f/2;break;case _.ne:g-=f}f=Math.round(g/100*a)}MO(this)&&(f=a-f-e);a=f;d=OO(this,c,a);e=MO(this)&&_.O.R(a)?
|
|
23
|
+
wO(0,_.Ff):mO;uO({left:d,right:e,top:NO(this,c,a)},this.a)}vO(this.D,b)}};IO.prototype.o=function(){return _.Ip(_.Zd)};TO.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=DO(a.a);var d=UO(this,a.f),e=KO(a),f=CO(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;GO(c,this.a,l)||FO(c,this.a)&&EO(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||FO(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
|
|
24
|
+
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=CO(c),h=l);c=CO(f)}c=g||f}uO({top:wO(c.top-this.a.top,_.Ff),bottom:wO(this.a.a-c.a,_.Ff),left:wO(c.left-this.a.left,_.Ff),right:wO(this.a.f-c.f,_.Ff),height:wO(c.height,_.Ff),width:wO(c.width,_.Ff)},a.a)}b.style.visibility="visible";this.h.push(DO(a.a))};_.w(WO,HO);WO.prototype.init=function(){this.h=new TO(this);this.j=!0};WO.prototype.o=function(){var a=_.Ip(_.Zd);_.Gp(a,this.w);this.id&&(a.id=this.id);return a};_.w(YO,WO);
|
|
25
|
+
YO.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.ei:b=b.width/100*a.width;break a;default:throw Error(iO);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.ei)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(iO);d=a.height;var e=ZO(this,d,a.height);uO(this.B,this.a);uO({left:wO(c,_.Ff),top:wO(e,_.Ff),width:wO(b,_.Ff),height:wO(d,_.Ff)},this.a);this.f.writingMode&&uO({display:"flex",
|
|
26
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&uO({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.Gp(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.ei:b=b.height/100*a.height;break a;case 2:b=b.height;d=new IO(new _.di(0,1,"Lorem ipsum",_.Yh),{},{});c=d.a;this.a.appendChild(c);d.init(DO(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(iO);
|
|
27
|
+
}a=ZO(this,b,a.height);uO({top:wO(a,_.Ff),height:wO(b,_.Ff)},this.a);this.h=new TO(this,!0);this.j=!0};YO.prototype.getId=function(){return this.f.id};aP.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=cP(this,a);if(bP(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.j.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
28
|
+
aP.prototype.destroy=function(){var a=this;return _.E(function(b){if(null==a.a)return b["return"]();a.l.forEach(function(c){return c()});a.l=[];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.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.y(b)})};_.w(gP,_.Wt);_.r=gP.prototype;_.r.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.u(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=oO(this.f,nO(a));this.l=null;fP(this,!1)}};_.r.vb=function(){null==this.h||fP(this,!0)};
|
|
29
|
+
_.r.destroy=function(){var a=this;return _.E(function(b){if(1==b.a){if(null==a.h)return b["return"]();lP(a);a.G.stop();return _.x(b,a.h.destroy(),2)}a.h=null;a.D.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.y(b)})};_.r.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;fP(this,!0);return!0};_.r.isTextVisible=function(){return this.j};
|
|
30
|
+
_.r.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.kb(.25),this.L.enableResizeObserver&&this.w.start(),fP(this,!0)):(this.G.stop(),this.w.stop(),lP(this)))};_.r.Bd=function(){return this.f};_.r.Xi=function(){fP(this,!0)};_.I(lO,gP);gP.prototype.setTextVisibility=gP.prototype.setTextVisibility;gP.prototype.isTextVisible=gP.prototype.isTextVisible;gP.prototype.remove=gP.prototype.remove;gP.prototype.destroy=gP.prototype.destroy;gP.prototype.append=gP.prototype.append;mP.prototype.isSupported=function(a){return!!a.enableHtmlCue&&!_.Pk()};mP.prototype.create=function(a){return new gP(a)};_.w(nP,_.fs);nP.prototype.f=function(){_.Io(_.ve,new mP)};nP.prototype.a=function(){_.Go.has(_.ve)&&(_.Go["delete"](_.ve),_.Ho.info("Removed factory: 'html'"))};nP.prototype.id=function(){return _.bg};_.I("clpp.htmlcue.HtmlCueComponent",nP);};
|
|
32
31
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
33
32
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
34
33
|
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.P=this.H=this.D=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.
|
|
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,_.x(d,a.
|
|
8
|
-
_.r=
|
|
9
|
-
_.r.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.r.
|
|
10
|
-
_.r.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_.r.
|
|
15
|
-
_.r.
|
|
16
|
-
_.r.
|
|
17
|
-
_.r
|
|
18
|
-
_.r.
|
|
19
|
-
_.r.load=function(){var a=this,b,c,d,e,f;return _.E(function(g){if(1==g.a){b=a.m;c=a.J;try{if(typeof c.adTagUrl!==_.
|
|
20
|
-
return g["return"](a.f)})};_.r.start=function(a){var b=this;return _.E(function(c){return b.a&&b.j&&!b.I?b.j.Vb()?_.x(c,
|
|
2
|
+
var f=function(window){var PN="clpp.ima.AdsManagerFactory",QN=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},RN=function(){},SN=function(a){this.a=a},TN=function(a){this.m=a;this.A=a.getSurface().getMedia();a=this.m.getConfiguration();a=_.O.Na(a.ima||{});this.J=_.O.oa({disableCustomPlayback:!1},a);this.o=this.m.lc("ima").Pc();this.U=this.m.lc("ima").h;this.l=this.m.lc("ima").a;this.L=new _.Zs;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.zj;this.I=!1;this.w=new _.Eh;this.V=new RN;this.B=
|
|
3
|
+
null;this.P=this.H=this.D=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.bl.bind(this));a.on(this.l,b,this.al.bind(this));a.on(this.m,_.oe,this.il.bind(this))},UN=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Rk.bind(a));c.on(b,d.LOADED,a.aj.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.jl.bind(a));c.on(b,d.STARTED,a.cj.bind(a));c.on(b,d.LOG,a.Vk.bind(a));c.on(b,
|
|
4
|
+
d.AD_PROGRESS,a.Zk.bind(a));c.on(b,d.AD_BUFFERING,a.Sk.bind(a));c.on(b,d.FIRST_QUARTILE,a.Zi.bind(a));c.on(b,d.MIDPOINT,a.Wk.bind(a));c.on(b,d.THIRD_QUARTILE,a.dj.bind(a));c.on(b,d.PAUSED,a.Yk.bind(a));c.on(b,d.RESUMED,a.$k.bind(a));c.on(b,d.CLICK,a.Yi.bind(a));c.on(b,d.SKIPPED,a.bj.bind(a));c.on(b,d.IMPRESSION,a.$i.bind(a));c.on(b,d.COMPLETE,a.Tk.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.kl.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.dl.bind(a))},VN=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===_.id?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===_.id&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:
|
|
6
|
+
[];return b},XN=function(a){a.B=null;WN(a,_.Ic);a.o&&a.m.getSurface().hide(a.o)},YN=function(a){_.Hp(a.A,{visibility:"visible"})},WN=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new QN(c,a.G,a.D)});a.m.trigger(new _.L(b,d))},ZN=function(a,b){var c=b?a.V.create(b.getErrorCode()):null;a.m.onError(new _.P(1,9,10003,{errorType:c},b))},$N=function(a){return!1===a.J.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.Gj()},bO=function(a){var b,c;return _.E(function(d){if(1==d.a)return a.U.initialize(),
|
|
7
|
+
b=!!a.m.getConfiguration().muted,_.x(d,a.L.canPlay(b),2);c=d.f;if(!c&&!$N(a))return WN(a,_.gd),a.g.warn(_.ma),d["return"]();aO(a);_.y(d)})},cO=function(a,b){return _.E(function(c){if(1==c.a)return a.U.initialize(),_.x(c,b.play(),2);aO(a);_.y(c)})},aO=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.I=!0},dO=function(){this.a=this.h=this.f=null},eO=function(){return!window.google||!google.ima||!google.ima.AdsLoader},fO=function(){},gO=function(){this.Vc=new _.K(PN)};
|
|
8
|
+
_.r=QN.prototype;_.r.yb=function(){return"Google IMA SDK"};_.r.zb=function(){return google.ima.VERSION};_.r.Fb=function(){return 0};_.r.getId=function(){return this.a.getAdId()};_.r.getCreativeId=function(){return this.a.getCreativeId()};_.r.getApiFramework=function(){return this.a.getApiFramework()};_.r.getAdSystem=function(){return this.a.getAdSystem()};_.r.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.r.getTitle=function(){return this.a.getTitle()};_.r.getDuration=function(){return this.a.getDuration()};
|
|
9
|
+
_.r.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.r.pc=function(){return this.f?this.f.getIsBumper():!1};_.r.Rb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ve&&typeof b[d].clickThroughUrl===_.Yf});c&&(a=b[c].clickThroughUrl);return a};_.r.getMediaUrl=function(){return this.a.getMediaUrl()};_.r.Cb=function(){return this.a.getVastMediaWidth()};_.r.Bb=function(){return this.a.getVastMediaHeight()};_.r.ob=function(){return this.a.getVastMediaBitrate()};
|
|
10
|
+
_.r.eb=function(){return this.h?2:this.j?1:0};_.r.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.r.Sb=function(){return this.f?this.f.getTimeOffset():0};_.r.Tb=function(){return this.f?this.f.getAdPosition():1};_.r.Eb=function(){return this.f?this.f.getTotalAds():1};_.r.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.r.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.r.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};
|
|
11
|
+
QN.prototype.getWrapperCreativeIds=QN.prototype.getWrapperCreativeIds;QN.prototype.getWrapperAdSystems=QN.prototype.getWrapperAdSystems;QN.prototype.getWrapperAdIds=QN.prototype.getWrapperAdIds;QN.prototype.getSequenceLength=QN.prototype.Eb;QN.prototype.getPositionInSequence=QN.prototype.Tb;QN.prototype.getPodTimeOffset=QN.prototype.Sb;QN.prototype.getPodIndex=QN.prototype.getPodIndex;QN.prototype.getPodType=QN.prototype.eb;QN.prototype.getMediaBitrate=QN.prototype.ob;
|
|
12
|
+
QN.prototype.getMediaHeight=QN.prototype.Bb;QN.prototype.getMediaWidth=QN.prototype.Cb;QN.prototype.getMediaUrl=QN.prototype.getMediaUrl;QN.prototype.getClickThroughUrl=QN.prototype.Rb;QN.prototype.isBumper=QN.prototype.pc;QN.prototype.getSkipTimeOffset=QN.prototype.getSkipTimeOffset;QN.prototype.getDuration=QN.prototype.getDuration;QN.prototype.getTitle=QN.prototype.getTitle;QN.prototype.getAdvertiserName=QN.prototype.getAdvertiserName;QN.prototype.getAdSystem=QN.prototype.getAdSystem;
|
|
13
|
+
QN.prototype.getApiFramework=QN.prototype.getApiFramework;QN.prototype.getCreativeId=QN.prototype.getCreativeId;QN.prototype.getId=QN.prototype.getId;QN.prototype.getTechnology=QN.prototype.Fb;QN.prototype.getAdManagerVersion=QN.prototype.zb;QN.prototype.getAdManagerName=QN.prototype.yb;RN.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}};SN.prototype.getCuePoints=function(){return this.a};SN.prototype.Vb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};SN.prototype.pb=function(){return 0<=this.a.indexOf(-1)};SN.prototype.hasPostroll=SN.prototype.pb;SN.prototype.hasPreroll=SN.prototype.Vb;SN.prototype.getCuePoints=SN.prototype.getCuePoints;_.r=TN.prototype;
|
|
14
|
+
_.r.bl=function(a){var b=this;this.a=a.getAdsManager(this.A,VN(this));this.a.isCustomPlaybackUsed()&&!$N(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.P(1,9,10002)),this.dispose()):(this.h=new _.Xs(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 SN(a),this.m.trigger(new _.L(_.Lc,{adsTimeline:this.j})),UN(this));this.f.resolve()};
|
|
15
|
+
_.r.al=function(a){ZN(this,a.getError());this.f.resolve()};_.r.jl=function(a){var b=this;return _.E(function(c){if(1==c.a)return b.H=!0,$N(b)?c.F(2):_.x(c,b.m.pause(),3);2!=c.a&&_.Hp(b.A,{visibility:_.ue});WN(b,_.uc,a);b.h.start();_.y(c)})};_.r.Rk=function(){var a=this;return _.E(function(b){if(1==b.a){if(!$N(a))return b.F(2);a.K=a.m.getPosition();return _.x(b,a.m.detach(),3)}if(2!=b.a){var c=a.m;c.a&&c.a.removeDelegate(c)}a.a.start();_.y(b)})};
|
|
16
|
+
_.r.aj=function(a){a.getAd().isLinear()?WN(this,_.Bc,a):(this.a.discardAdBreak(),this.G||(this.G=!0,this.m.play()))};_.r.cj=function(a){this.B=a.getAd().getDuration();WN(this,_.Hc,a);this.m.getSurface().show(this.o)};_.r.Vk=function(a){a=a.getAdData();ZN(this,a?a.adError:null);XN(this)};_.r.Zk=function(a){WN(this,_.Ec,a)};_.r.Sk=function(a){WN(this,_.wc,a)};_.r.Zi=function(a){WN(this,_.zc,a)};_.r.Wk=function(a){WN(this,_.Cc,a)};_.r.dj=function(a){WN(this,_.Jc,a)};_.r.Yk=function(a){WN(this,_.Dc,a)};
|
|
17
|
+
_.r.$k=function(a){WN(this,_.Fc,a)};_.r.Yi=function(a){this.pause();WN(this,_.xc,a)};_.r.bj=function(a){WN(this,_.Gc,a);XN(this)};_.r.$i=function(a){WN(this,_.Ac,a)};_.r.Tk=function(a){WN(this,_.yc,a);XN(this)};
|
|
18
|
+
_.r.kl=function(){var a=this;return _.E(function(b){switch(b.a){case 1:a.G=!0;if(!$N(a)||null===a.K){if(!a.H)return b["return"](a.m.play());YN(a);b.F(2);break}var c=a.m;c.a&&c.a.addDelegate(c);return _.x(b,_.Aq(a.m),3);case 3:if(a.D){b.F(2);break}return _.x(b,a.m.seek(a.K),2);case 2:a.H=!1;a.h&&a.h.stop();if(a.D){b.F(6);break}return _.x(b,a.m.play(),6);case 6:WN(a,_.vc),_.y(b)}})};_.r.dl=function(){this.P=!0};_.r.il=function(){this.D=!0;this.l.contentComplete()};
|
|
19
|
+
_.r.load=function(){var a=this,b,c,d,e,f;return _.E(function(g){if(1==g.a){b=a.m;c=a.J;try{if(typeof c.adTagUrl!==_.Yf)throw new _.P(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.x(g,a.L.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(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)})};_.r.start=function(a){var b=this;return _.E(function(c){return b.a&&b.j&&!b.I?b.j.Vb()?_.x(c,bO(b),0):_.x(c,cO(b,a),0):_.x(c,a.play(),0)})};_.r.resume=function(){this.a&&this.a.resume()};_.r.pause=function(){this.a&&this.a.pause()};_.r.skip=function(){this.a&&this.a.skip()};_.r.getVolume=function(){return this.a?this.a.getVolume():1};_.r.setVolume=function(a){this.a&&this.a.setVolume(a)};
|
|
21
21
|
_.r.getPosition=function(){if(!this.a||null===this.B)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.B-a};
|
|
22
|
-
_.r.dispose=function(){var a=this;return(new Promise(function(b){a.I&&a.j&&a.j.
|
|
23
|
-
|
|
24
|
-
_.r.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)};_.r.
|
|
25
|
-
|
|
22
|
+
_.r.dispose=function(){var a=this;return(new Promise(function(b){a.I&&a.j&&a.j.pb()&&!a.P?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.o&&a.m.getSurface().hide(a.o)}),_.Fh(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(){YN(a);a.w.release();a.h&&(a.h.stop(),a.h=null);a.a&&(a.a.destroy(),a.a=null)})};TN.prototype.getPosition=TN.prototype.getPosition;
|
|
23
|
+
TN.prototype.setVolume=TN.prototype.setVolume;TN.prototype.getVolume=TN.prototype.getVolume;TN.prototype.skip=TN.prototype.skip;TN.prototype.pause=TN.prototype.pause;TN.prototype.resume=TN.prototype.resume;_.w(dO,_.fu);_.r=dO.prototype;_.r.onPlayerCreated=function(a){if(eO())return a.onError(new _.P(1,9,1E4));this.f=_.Fp(_.Zd,{"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(_.va);this.a.getSettings().setPlayerVersion(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
|
|
24
|
+
_.r.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)};_.r.ak=function(){return this.a};_.r.Zj=function(){return this.h};_.r.Pc=function(){return this.f};_.r.id=function(){return"ima"};_.I("clpp.ima.ImaPlugin",dO);dO.prototype.getAdContainer=dO.prototype.Pc;dO.prototype.getAdDisplayContainer=dO.prototype.Zj;dO.prototype.getAdsLoader=dO.prototype.ak;dO.Id="ima";
|
|
25
|
+
dO.isSdkMissing=eO;fO.prototype.create=function(){return new dO};_.Dq(new fO);gO.prototype.name=function(){return PN};gO.prototype.isSupported=function(a,b){return a.namespace()===_.Dd?!1:eO()?(this.Vc.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};gO.prototype.create=function(a){return new TN(a)};gO.prototype.create=gO.prototype.create;gO.prototype.isSupported=gO.prototype.isSupported;gO.prototype.name=gO.prototype.name;_.Cp(new gO);};
|
|
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));}
|