@castlabs/prestoplay 6.6.1-beta.2 → 6.7.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 +20 -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 +403 -403
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +47 -41
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +68 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +263 -260
- package/cjs/cl.muxdata.js +11 -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 +70 -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 +13 -13
- package/cjs/cl.vtt.js +11 -11
- package/cjs/cl.youbora.js +19 -19
- 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 +345 -343
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +47 -41
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +57 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -16
- package/cl.mse.js +227 -227
- package/cl.muxdata.js +9 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- 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 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +118 -12
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
function(c){return
|
|
4
|
-
f},
|
|
5
|
-
d-e)}
|
|
6
|
-
this.
|
|
7
|
-
|
|
8
|
-
case _.ug:return _.
|
|
9
|
-
case _.Pe:c=["+x","-x"];break;case _.Qe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},
|
|
10
|
-
100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(
|
|
11
|
-
e.trim().indexOf("."+a.
|
|
12
|
-
e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.iq(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 _.Ye:h="clpp-text-vtt";break;case _.He:h
|
|
16
|
-
else{
|
|
17
|
-
end:c}},
|
|
18
|
-
|
|
19
|
-
d=g)}}else d.appendChild(document.createTextNode(
|
|
20
|
-
|
|
21
|
-
c.next();!d.done;d=c.next())_.Jn(b,d.value);
|
|
22
|
-
c,null),f=
|
|
23
|
-
|
|
24
|
-
l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.
|
|
25
|
-
|
|
26
|
-
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&
|
|
27
|
-
}a=
|
|
28
|
-
|
|
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={
|
|
30
|
-
g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.
|
|
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.
|
|
32
|
-
|
|
2
|
+
var f=function(window){var FJ="CLPP Subtitle Styles",GJ="Unsupported unit",HJ="clpp-text-plain",IJ="clpp-text-ttml",JJ="clpp.htmlcue.HtmlTextDisplayer",KJ="initial",LJ=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},MJ=function(){},NJ=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},PJ=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
|
|
3
|
+
function(c){return OJ[c]});return a},RJ=function(a,b){QJ(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){QJ(a,c)})},QJ=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},SJ=function(a,b){return 0===a?"0":a+b},TJ=function(a,b){return 1>Math.abs(a-b)||a<b},UJ=function(a,b){return a<b&&1<Math.abs(a-b)},VJ=function(a,b){return a>b&&1<Math.abs(a-b)},WJ=function(a,b){return 1>Math.abs(a-b)||a>b},XJ=function(a,b,c,d,e,f){this.f=a;this.g=b;this.j=c;this.a=d;this.height=e;this.width=
|
|
4
|
+
f},YJ=function(a){return new XJ(a.f,a.g,a.j,a.a,a.height,a.width)},ZJ=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 XJ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
5
|
+
d-e)},$J=function(a,b){return b.some(function(c){return UJ(a.f,c.g)&&VJ(a.g,c.f)&&UJ(a.j,c.a)&&VJ(a.a,c.j)})},aK=function(a,b){return WJ(a.j,b.j)&&TJ(a.a,b.a)&&WJ(a.f,b.f)&&TJ(a.g,b.g)},bK=function(a,b,c){switch(c){case "+x":return UJ(a.f,b.f);case "-x":return VJ(a.g,b.g);case "+y":return UJ(a.j,b.j);case "-y":return VJ(a.a,b.a);default:throw Error("Unknown axis");}},cK=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},dK=function(a,b,c){cK.call(this,a.id,"clpp-text-cue",{});
|
|
6
|
+
this.m=b;this.f=a;this.g=!!this.f.backgroundImage;this.D=c},fK=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 eK(a)?b:c},iK=function(a,b,c){return eK(a)&&_.K.la(c)?SJ(c,_.de):(gK(a)||hK(a))&&_.K.la(b)?SJ(b,"%"):KJ},gK=function(a){return a.f.writingMode===_.Pe},hK=function(a){return a.f.writingMode===_.Qe},eK=function(a){return a.f.writingMode===_.vg},jK=function(a,b,c){return(gK(a)||hK(a))&&_.K.la(c)?SJ(c,_.de):
|
|
7
|
+
gK(a)&&_.K.R(c)?SJ(0,_.de):eK(a)&&_.K.la(b)?SJ(b,"%"):KJ},kK=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.ud:return a.f.position;case "auto":case _.Ec:return a.f.position-a.f.size/2;case _.vd:return a.f.position-a.f.size}return 0},lK=function(a){switch(a.f.positionAlign){case _.ud:return _.rd;case "auto":case _.Ec:return _.ug;case _.vd:return _.ke}return a.f.textAlign},mK=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.rd:case _.rd:return _.ud;
|
|
8
|
+
case _.ug:return _.Ec;case _.ke:case _.ke:return _.vd}return a.f.positionAlign},nK=function(a){switch(a.f.writingMode){case _.vg:return"horizontal-tb";case _.Pe:return _.Pe;case _.Qe:return _.Qe;default:throw Error("Unknown writing mode");}},oK=function(a,b){this.m=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=ZJ(a.a);this.g=[]},pK=function(a,b){if(a.j)switch(b.writingMode){case _.vg:return["-y"];case _.Pe:return["+x"];case _.Qe:return["-x"]}var c=[];switch(b.writingMode){case _.vg:c=["+y","-y"];break;
|
|
9
|
+
case _.Pe:c=["+x","-x"];break;case _.Qe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},qK=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=ZJ(a.m.a)},rK=function(a,b,c){cK.call(this,a,b,c);this.g=null;this.m=[]},sK=function(a,b){qK(a.g);a.m.unshift(b);for(var c=_.u(a.m),d=c.next();!d.done;d=c.next())a.g.append(d.value)},tK=function(a,b){rK.call(this,a.id,"clpp-text-cue-region",b);this.f=a},uK=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Ag)return a.viewportAnchorY/
|
|
10
|
+
100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(GJ);},wK=function(a){this.h=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.g=a.getSurface().getUniqueCssClass();this.j=[];this.a=vK(this,this.g);this.f=vK(this,this.g,!0);this.f.disabled=!0;this.h.debug("Stylesheet CLPP Subtitle Styles has been created.")},xK=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===
|
|
11
|
+
e.trim().indexOf("."+a.g+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},yK=function(a,b){var c="."+a.g+" .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)},vK=function(a,b,c){var d=document.createElement(_.xe),e=d.dataset;e.name=FJ;
|
|
12
|
+
e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);zK(a,b);a.h.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},zK=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===FJ&&a.h.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
|
+
CK=function(a){_.dq.call(this,a);var b=this;this.h=new _.H(JJ);this.l=a;this.M=AK(a);this.j=!1;this.f=[];this.D=a.getSurface().getContainer();this.g=new wK(a);this.a=new rK(null,"clpp-text-container",{});this.w=new _.Ap(a.getSurface(),this.Yh.bind(this));this.J=null;this.D?(this.D.appendChild(this.a.a),this.a.init(null)):this.h.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.F=new _.aj(function(){BK(b)});
|
|
14
|
+
this.A=new Map;this.m=null},AK=function(a){a=_.K.Qa(a.getConfiguration().htmlcue||{});_.K.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},DK=function(a,b){return a.startTime<=b&&a.endTime>b},BK=function(a,b){if((b||a.j)&&a.D){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.mn){a.J=c;var d=EK(a,c);(c=b)||(c=a.m,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.m=d,FK(a),d)){c={color:a.getFontColor()||
|
|
15
|
+
void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.iq(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 _.Ye:h="clpp-text-vtt";break;case _.He:h=IJ;break;case _.tg:h=HJ}h&&!g.classList.contains(h)&&_.Jn(g,h);g=ZJ(f.a.a);if(0===g.width||0===g.height)f.h.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{QJ({fontSize:GK(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Ye;var l=e.payloadType===_.He;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new tK(e.region,{}),f.A.set(e.region.id,g),sK(f.a,g)));e=new dK(e,f.M,c);g?sK(g,e):sK(f.a,e)}}}}}},EK=function(a,b){var c=LJ(a.f,function(e){return DK(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&DK(a.f[d-1],b);)d--;for(;c+1<a.f.length&&DK(a.f[c+1],b);)c++;return{start:d,
|
|
17
|
+
end:c}},HK=function(a){FK(a);a.J=null;a.m=null;a.f=[]},FK=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(IJ);b.classList.remove(HJ);a=a.a;qK(a.g);a.m=[]}},GK=function(a,b){var c=ZJ(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.de}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.de;d=a.getFontSizePercent();return Math.round(c*d)+_.de},IK=function(){},JK=function(){};
|
|
18
|
+
MJ.prototype.parse=function(a){a={input:a};for(var b=_.Ln(_.$c),c=[],d=b,e;null!==(e=NJ(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=KK[f];h?(h=_.Ln(h),(f=LK[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||MK[g.localName]&&MK[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(PJ(e)));return b};var KK={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},LK={v:"voice",lang:"lang"},MK={rt:"ruby"},OJ={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};cK.prototype.init=function(){this.j=!0};cK.prototype.A=function(){return!1};_.w(dK,cK);dK.prototype.A=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
|
|
20
|
+
dK.prototype.init=function(a){cK.prototype.init.call(this,a);if(this.g)_.Jn(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.m.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.He){var c=_.Ln(_.$c);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ye?b=(new MJ).parse(b.payload):(c=_.Ln(_.$c),c.textContent=b.payload,b=c);_.Jn(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())_.Jn(b,d.value);QJ({writingMode:nK(this)},b);this.a.appendChild(b);_.Jn(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.Jn(this.a,"clpp-text-wrapper__"+d.value);_.K.R(this.f.line)&&(this.f.lineInterpretation=_.wg,this.f.line=eK(this)?-1:0);c=nK(this);QJ({writingMode:c,webkitWritingMode:c,direction:KJ,textAlign:lK(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=kK(this,mK(this));d=jK(this,c,null);var e=iK(this,
|
|
22
|
+
c,null),f=hK(this)&&_.K.R(null)?SJ(0,_.de):KJ;QJ({position:"absolute",left:d,right:f,top:e,width:eK(this)?SJ(this.f.size,"%"):KJ,height:gK(this)||hK(this)?SJ(this.f.size,"%"):KJ},this.a);d=this.f;a=eK(this)?a.height:a.width;e=fK(this);if(d.lineInterpretation===_.wg)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 _.Ec:g-=f/2;break;case _.hd:g-=f}f=Math.round(g/100*a)}hK(this)&&(f=a-f-e);a=f;d=jK(this,c,a);e=hK(this)&&_.K.R(a)?
|
|
23
|
+
SJ(0,_.de):KJ;QJ({left:d,right:e,top:iK(this,c,a)},this.a)}RJ(this.D,b)}};dK.prototype.o=function(){return _.Ln(_.$c)};oK.prototype.append=function(a){var b=a.a;b.style.visibility=_.nd;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=ZJ(a.a);var d=pK(this,a.f),e=fK(a),f=YJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;bK(c,this.a,l)||aK(c,this.a)&&$J(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.j+=n;m.a+=n;break;case "-y":m.j-=n,m.a-=n}}if(this.j||aK(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.j,l.j))/(c.height*c.width);l>h&&(g=YJ(c),h=l);c=YJ(f)}c=g||f}QJ({top:SJ(c.j-this.a.j,_.de),bottom:SJ(this.a.a-c.a,_.de),left:SJ(c.f-this.a.f,_.de),right:SJ(this.a.g-c.g,_.de),height:SJ(c.height,_.de),width:SJ(c.width,_.de)},a.a)}b.style.visibility="visible";this.g.push(ZJ(a.a))};_.w(rK,cK);rK.prototype.init=function(){this.g=new oK(this);this.j=!0};rK.prototype.o=function(){var a=_.Ln(_.$c);_.Jn(a,this.w);this.id&&(a.id=this.id);return a};_.w(tK,rK);
|
|
25
|
+
tK.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Ag:b=b.width/100*a.width;break a;default:throw Error(GJ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ag)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(GJ);d=a.height;var e=uK(this,d,a.height);QJ(this.B,this.a);QJ({left:SJ(c,_.de),top:SJ(e,_.de),width:SJ(b,_.de),height:SJ(d,_.de)},this.a);this.f.writingMode&&QJ({display:"flex",
|
|
26
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&QJ({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.Jn(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Ag:b=b.height/100*a.height;break a;case 2:b=b.height;d=new dK(new _.zg(0,1,"Lorem ipsum",_.tg),{},{});c=d.a;this.a.appendChild(c);d.init(ZJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(GJ);
|
|
27
|
+
}a=uK(this,b,a.height);QJ({top:SJ(a,_.de),height:SJ(b,_.de)},this.a);this.g=new oK(this,!0);this.j=!0};tK.prototype.getId=function(){return this.f.id};wK.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=yK(this,a);if(xK(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.h.debug("Added CSS rule "+b)}catch(c){this.h.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.h.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
28
|
+
wK.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.f.ownerNode);a.a=null;a.f=null;a.h.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.w(CK,_.dq);_.t=CK.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={wd:c.wd},e=d.next())c.wd=e.value,this.f.some(function(f){return function(g){var h=f.wd;return g.payload!==h.payload?!1:
|
|
30
|
+
g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.wd);this.m=null;BK(this,!1)}};_.t.rb=function(){null==this.g||BK(this,!0)};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a){if(null==a.g)return b["return"]();HK(a);a.F.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.D.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!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.m=null;BK(this,!0);return!0};_.t.isTextVisible=function(){return this.j};_.t.setTextVisibility=function(a){null!=this.g&&this.j!==a&&((this.j=a)?(this.F.eb(.25),this.M.enableResizeObserver&&this.w.start(),BK(this,!0)):(this.F.stop(),this.w.stop(),HK(this)))};_.t.Yh=function(){BK(this,!0)};_.C(JJ,CK);CK.prototype.setTextVisibility=CK.prototype.setTextVisibility;
|
|
32
|
+
CK.prototype.isTextVisible=CK.prototype.isTextVisible;CK.prototype.remove=CK.prototype.remove;CK.prototype.destroy=CK.prototype.destroy;CK.prototype.append=CK.prototype.append;IK.prototype.$=function(a){return!!a.enableHtmlCue&&!_.jj()};IK.prototype.create=function(a){return new CK(a)};_.w(JK,_.Ko);JK.prototype.Ma=function(){_.Lm("html",new IK)};JK.prototype.Fa=function(){};JK.prototype.id=function(){return _.ze};_.C("clpp.htmlcue.HtmlCueComponent",JK);};
|
|
33
33
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
34
34
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
35
35
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ima.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
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.
|
|
4
|
-
a.
|
|
5
|
-
a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.
|
|
6
|
-
function(a){_.Kn(a.
|
|
7
|
-
c.a)return a.
|
|
8
|
-
_.t.
|
|
9
|
-
_.t.
|
|
10
|
-
_.t.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_.t.
|
|
15
|
-
_.t.
|
|
16
|
-
_.t.
|
|
17
|
-
_.t.
|
|
18
|
-
_.t.
|
|
19
|
-
_.t.
|
|
20
|
-
_.t.
|
|
21
|
-
_.t.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
var f=function(window){var mJ="clpp.ima.AdsManagerFactory",nJ=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.g=c},oJ=function(){},pJ=function(a){this.a=a},qJ=function(a){this.l=a;this.A=a.getSurface().getMedia();a=this.l.getConfiguration();this.I=_.K.Qa(a.ima||{});this.o=this.l.cc("ima").Jc();this.P=this.l.cc("ima").g;this.m=this.l.cc("ima").a;this.K=new _.Cp;this.h=new _.H("clpp.ima");this.g=this.a=null;this.f=new _.di;this.H=!1;this.w=new _.eg;this.V=new oJ;this.B=null;this.M=this.F=this.T=this.D=!1;this.J=
|
|
3
|
+
this.j=null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.m,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Tj.bind(this));a.on(this.m,b,this.Sj.bind(this));a.on(this.l,_.se,this.fi.bind(this))},rJ=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Ij.bind(a));c.on(b,d.LOADED,a.bi.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.$j.bind(a));c.on(b,d.STARTED,a.di.bind(a));c.on(b,d.LOG,a.Mj.bind(a));c.on(b,d.AD_PROGRESS,a.Qj.bind(a));c.on(b,d.AD_BUFFERING,
|
|
4
|
+
a.Jj.bind(a));c.on(b,d.FIRST_QUARTILE,a.$h.bind(a));c.on(b,d.MIDPOINT,a.Nj.bind(a));c.on(b,d.THIRD_QUARTILE,a.ei.bind(a));c.on(b,d.PAUSED,a.Pj.bind(a));c.on(b,d.RESUMED,a.Rj.bind(a));c.on(b,d.CLICK,a.Zh.bind(a));c.on(b,d.SKIPPED,a.ci.bind(a));c.on(b,d.IMPRESSION,a.ai.bind(a));c.on(b,d.COMPLETE,a.Kj.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ak.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Vj.bind(a))},sJ=function(a){a=a.I;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=
|
|
5
|
+
!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.vc?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===_.vc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},uJ=function(a){a.B=null;tJ(a,_.Wb);
|
|
6
|
+
a.o&&a.l.getSurface().hide(a.o)},vJ=function(a){_.Kn(a.A,{visibility:"visible"})},tJ=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new nJ(c,a.D,a.T)});a.l.trigger(new _.I(b,d))},wJ=function(a,b){var c=b?a.V.create(b.getErrorCode()):null;a.l.onError(new _.L(1,9,10003,{errorType:c},b))},xJ=function(a){return a.a.isCustomPlaybackUsed()&&!1===a.I.disableCustomPlayback&&(_.ki()||_.li())},zJ=function(a){var b,c;return _.B(function(d){if(1==d.a)return a.P.initialize(),b=!!a.l.getConfiguration().muted,
|
|
7
|
+
_.x(d,a.K.canPlay(b),2);c=d.f;if(!c&&!xJ(a))return tJ(a,_.tc),a.h.warn(_.ka),d["return"]();yJ(a);_.z(d)})},AJ=function(a,b){return _.B(function(c){if(1==c.a)return a.P.initialize(),_.x(c,b.play(),2);yJ(a);_.z(c)})},yJ=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.H=!0},BJ=function(){this.a=this.g=this.f=null},CJ=function(){return!window.google||!google.ima||!google.ima.AdsLoader},DJ=function(){},EJ=function(){this.a=new _.H(mJ)};_.t=nJ.prototype;_.t.ub=function(){return"Google IMA SDK"};
|
|
8
|
+
_.t.vb=function(){return google.ima.VERSION};_.t.Ab=function(){return 0};_.t.getId=function(){return this.a.getAdId()};_.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()};
|
|
9
|
+
_.t.gc=function(){return this.f?this.f.getIsBumper():!1};_.t.Nb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ld&&typeof b[d].clickThroughUrl===_.ve});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};_.t.xb=function(){return this.a.getVastMediaWidth()};_.t.wb=function(){return this.a.getVastMediaHeight()};_.t.jb=function(){return this.a.getVastMediaBitrate()};_.t.Ya=function(){return this.g?2:this.j?1:0};
|
|
10
|
+
_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.t.Ob=function(){return this.f?this.f.getTimeOffset():0};_.t.Pb=function(){return this.f?this.f.getAdPosition():1};_.t.zb=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()};nJ.prototype.getWrapperCreativeIds=nJ.prototype.getWrapperCreativeIds;
|
|
11
|
+
nJ.prototype.getWrapperAdSystems=nJ.prototype.getWrapperAdSystems;nJ.prototype.getWrapperAdIds=nJ.prototype.getWrapperAdIds;nJ.prototype.getSequenceLength=nJ.prototype.zb;nJ.prototype.getPositionInSequence=nJ.prototype.Pb;nJ.prototype.getPodTimeOffset=nJ.prototype.Ob;nJ.prototype.getPodIndex=nJ.prototype.getPodIndex;nJ.prototype.getPodType=nJ.prototype.Ya;nJ.prototype.getMediaBitrate=nJ.prototype.jb;nJ.prototype.getMediaHeight=nJ.prototype.wb;nJ.prototype.getMediaWidth=nJ.prototype.xb;
|
|
12
|
+
nJ.prototype.getMediaUrl=nJ.prototype.getMediaUrl;nJ.prototype.getClickThroughUrl=nJ.prototype.Nb;nJ.prototype.isBumper=nJ.prototype.gc;nJ.prototype.getSkipTimeOffset=nJ.prototype.getSkipTimeOffset;nJ.prototype.getDuration=nJ.prototype.getDuration;nJ.prototype.getTitle=nJ.prototype.getTitle;nJ.prototype.getAdvertiserName=nJ.prototype.getAdvertiserName;nJ.prototype.getAdSystem=nJ.prototype.getAdSystem;nJ.prototype.getApiFramework=nJ.prototype.getApiFramework;nJ.prototype.getCreativeId=nJ.prototype.getCreativeId;
|
|
13
|
+
nJ.prototype.getId=nJ.prototype.getId;nJ.prototype.getTechnology=nJ.prototype.Ab;nJ.prototype.getAdManagerVersion=nJ.prototype.vb;nJ.prototype.getAdManagerName=nJ.prototype.ub;oJ.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}};pJ.prototype.getCuePoints=function(){return this.a};pJ.prototype.Qb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};pJ.prototype.kb=function(){return 0<=this.a.indexOf(-1)};pJ.prototype.hasPostroll=pJ.prototype.kb;pJ.prototype.hasPreroll=pJ.prototype.Qb;pJ.prototype.getCuePoints=pJ.prototype.getCuePoints;_.t=qJ.prototype;_.t.fi=function(a){if(a=a.detail)switch(a.currentState){case _.en:this.T=!0,this.m.contentComplete()}};
|
|
14
|
+
_.t.Tj=function(a){var b=this;this.a=a.getAdsManager(this.A,sJ(this));this.a.isCustomPlaybackUsed()&&!xJ(this)?(this.h.warn("IMA plugin is disabled for platforms with single video element. Disposing."),this.l.onError(new _.L(1,9,10002)),this.dispose()):(this.g=new _.Ap(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.j=new pJ(a),this.l.trigger(new _.I(_.Zb,{adsTimeline:this.j})),rJ(this));this.f.resolve()};
|
|
15
|
+
_.t.Sj=function(a){wJ(this,a.getError());this.f.resolve()};_.t.$j=function(a){var b=this;return _.B(function(c){if(1==c.a)return b.F=!0,xJ(b)?c.G(2):_.x(c,b.l.pause(),3);2!=c.a&&_.Kn(b.A,{visibility:_.nd});tJ(b,_.Ib,a);b.g.start();_.z(c)})};_.t.Ij=function(){var a=this;return _.B(function(b){if(1==b.a){if(!xJ(a))return b.G(2);a.J=a.l.getPosition();return _.x(b,a.l.detach(),2)}a.a.start();_.z(b)})};
|
|
16
|
+
_.t.bi=function(a){a.getAd().isLinear()?tJ(this,_.Pb,a):(this.a.discardAdBreak(),this.D||(this.D=!0,this.l.play()))};_.t.di=function(a){this.B=a.getAd().getDuration();tJ(this,_.Vb,a);this.l.getSurface().show(this.o)};_.t.Mj=function(a){a=a.getAdData();wJ(this,a?a.adError:null);uJ(this)};_.t.Qj=function(a){tJ(this,_.Sb,a)};_.t.Jj=function(a){tJ(this,_.Kb,a)};_.t.$h=function(a){tJ(this,_.Nb,a)};_.t.Nj=function(a){tJ(this,_.Qb,a)};_.t.ei=function(a){tJ(this,_.Xb,a)};_.t.Pj=function(a){tJ(this,_.Rb,a)};
|
|
17
|
+
_.t.Rj=function(a){tJ(this,_.Tb,a)};_.t.Zh=function(a){this.pause();tJ(this,_.Lb,a)};_.t.ci=function(a){tJ(this,_.Ub,a);uJ(this)};_.t.ai=function(a){tJ(this,_.Ob,a)};_.t.Kj=function(a){tJ(this,_.Mb,a);uJ(this)};
|
|
18
|
+
_.t.ak=function(){var a=this;return _.B(function(b){switch(b.a){case 1:a.D=!0;if(!xJ(a)||null===a.J){if(!a.F)return b["return"](a.l.play());vJ(a);b.G(2);break}return _.x(b,_.Co(a.l),3);case 3:return _.x(b,a.l.seek(a.J),2);case 2:a.F=!1;a.g&&a.g.stop();if(a.l.isEnded()){b.G(5);break}return _.x(b,a.l.play(),5);case 5:tJ(a,_.Jb),_.z(b)}})};_.t.Vj=function(){this.M=!0};
|
|
19
|
+
_.t.load=function(){var a=this,b,c,d,e,f;return _.B(function(g){if(1==g.a){b=a.l;c=a.I;try{if(typeof c.adTagUrl!==_.ve)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.K.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(g,a.K.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.m.getSettings().setAutoPlayAdBreaks(!1);a.m.requestAds(f);
|
|
20
|
+
return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.B(function(c){return b.a&&b.j&&!b.H?b.j.Qb()?_.x(c,zJ(b),0):_.x(c,AJ(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)};
|
|
21
|
+
_.t.getPosition=function(){if(!this.a||null===this.B)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.B-a};
|
|
22
|
+
_.t.dispose=function(){var a=this;return(new Promise(function(b){a.H&&a.j&&a.j.kb()&&!a.M?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.o&&a.l.getSurface().hide(a.o)}),_.fg(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.m.contentComplete()})).then(function(){vJ(a);a.w.release();a.g&&(a.g.stop(),a.g=null);a.a&&(a.a.destroy(),a.a=null)})};qJ.prototype.getPosition=qJ.prototype.getPosition;
|
|
23
|
+
qJ.prototype.setVolume=qJ.prototype.setVolume;qJ.prototype.getVolume=qJ.prototype.getVolume;qJ.prototype.skip=qJ.prototype.skip;qJ.prototype.pause=qJ.prototype.pause;qJ.prototype.resume=qJ.prototype.resume;_.w(BJ,_.nq);_.t=BJ.prototype;_.t.onPlayerCreated=function(a){if(CJ())return a.onError(new _.L(1,9,1E4));this.f=_.In(_.$c,{"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(_.ra);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)};
|
|
24
|
+
_.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.Zi=function(){return this.a};_.t.Xi=function(){return this.g};_.t.Jc=function(){return this.f};_.t.id=function(){return"ima"};_.C("clpp.ima.ImaPlugin",BJ);BJ.prototype.getAdContainer=BJ.prototype.Jc;BJ.prototype.getAdDisplayContainer=BJ.prototype.Xi;BJ.prototype.getAdsLoader=BJ.prototype.Zi;BJ.Id="ima";
|
|
25
|
+
BJ.isSdkMissing=CJ;DJ.prototype.create=function(){return new BJ};_.Fo(new DJ);EJ.prototype.name=function(){return mJ};EJ.prototype.$=function(a,b){return a.namespace()===_.Kc?!1:CJ()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};EJ.prototype.create=function(a){return new qJ(a)};EJ.prototype.create=EJ.prototype.create;EJ.prototype.isSupported=EJ.prototype.$;EJ.prototype.name=EJ.prototype.name;_.Fn(new EJ);};
|
|
25
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
26
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
27
28
|
else{_=this.clpp._;(f.call(g,this));}
|