@castlabs/prestoplay 6.25.0 → 6.25.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 +9 -1
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +4 -4
- package/cjs/cl.cast.js +38 -38
- package/cjs/cl.conviva.js +14 -14
- package/cjs/cl.core.js +115 -115
- package/cjs/cl.crypto.js +2 -2
- package/cjs/cl.dash.js +21 -21
- package/cjs/cl.freewheel.js +8 -8
- package/cjs/cl.hls.js +42 -42
- package/cjs/cl.htmlcue.js +7 -7
- package/cjs/cl.ima.js +9 -9
- package/cjs/cl.mse.js +46 -46
- package/cjs/cl.muxdata.js +6 -6
- package/cjs/cl.playlist.js +4 -4
- package/cjs/cl.sessions.js +5 -5
- package/cjs/cl.simid.js +2 -2
- package/cjs/cl.smooth.js +19 -19
- package/cjs/cl.thumbnails.js +2 -2
- package/cjs/cl.tizen.js +18 -18
- package/cjs/cl.ttml.js +5 -5
- package/cjs/cl.verimatrix.js +1 -1
- package/cjs/cl.vimond.js +4 -4
- package/cjs/cl.vr.js +7 -7
- package/cjs/cl.vtt.js +1 -1
- package/cjs/cl.youbora.js +6 -6
- package/cl.airplay.js +1 -1
- package/cl.cast.js +11 -11
- package/cl.conviva.js +1 -1
- package/cl.core.js +61 -61
- package/cl.crypto.js +2 -2
- package/cl.dash.js +10 -10
- package/cl.freewheel.js +1 -1
- package/cl.hls.js +9 -9
- package/cl.htmlcue.js +2 -2
- package/cl.ima.js +3 -3
- package/cl.mse.js +11 -11
- package/cl.muxdata.js +1 -1
- package/cl.playlist.js +1 -1
- package/cl.smooth.js +10 -10
- package/cl.tizen.js +3 -3
- package/cl.ttml.js +2 -2
- package/cl.vimond.js +1 -1
- package/cl.vr.js +2 -2
- package/cl.vtt.js +1 -1
- package/cl.youbora.js +4 -4
- package/clpp.styles.css +4 -0
- package/package.json +1 -1
- package/typings.d.ts +9 -11
package/cjs/cl.simid.js
CHANGED
|
@@ -6,12 +6,12 @@ this.g=new _.K("clpp.simid.SimidPlayer");MA(this.f,this)},QA=function(a){var b=O
|
|
|
6
6
|
width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:e.m.isMuted()||!1,volume:e.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:e.f.duration},creativeData:{adParameters:e.f.adParameters||"",clickThruUri:"",
|
|
7
7
|
clickThruUrl:""}};e=OA(a,"SIMID:Player:init",e);e=PA(a,e);return _.y(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.Jh(d,0);c=_.H(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.C(d)})},OA=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},RA=function(a,b){a.h?(b.type!==HA&&a.g.info("Posting message ["+b.messageId+"] '"+b.type+"':",b.args),
|
|
8
8
|
a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},LA=function(a,b){RA(a,OA(a,"resolve",{messageId:b.messageId,value:void 0}))},PA=function(a,b){return new Promise(function(c,d){new SA(a.j,c,d,b);RA(a,b)})},SA=function(a,b,c,d){var e=this;var f=void 0===f?-1:f;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},TA=function(){this.g=
|
|
9
|
-
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.
|
|
9
|
+
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.gl.bind(this);this.f=null;this.o=!1},UA=function(a,b,c){return new ResizeObserver(function(){if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};e=OA(d,"SIMID:Player:resize",e);RA(d,e)}})},VA=function(a){this.m=a;this.a=null;this.g=new _.K("clpp.simid.Loader");this.h=!1;this.f=
|
|
10
10
|
null},KA=function(a,b){var c=a.getContainer(),d=c.clientWidth;c=c.clientHeight;return{top:b.y/c*100+"%",left:b.x/d*100+"%",width:b.width/d*100+"%",height:b.height/c*100+"%"}},MA=function(a,b){a.g.info("SIMID Session created");a.a=b},WA=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width=
|
|
11
11
|
"";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height="";a.h=!1;a.m.trigger(new _.L(_.mg))},XA=function(){};NA.prototype.load=function(a){window.addEventListener(_.Ze,this.o);this.h="";this.l=0;var b=this.f.url();this.g.info('Loading "'+b+'" as src of iFrame');this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)};
|
|
12
12
|
NA.prototype.unload=function(){WA(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ze,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};SA.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};SA.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.x(TA,_.gw);_.u=TA.prototype;_.u.id=function(){return"simid"};_.u.onPlayerCreated=function(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new VA(a)};
|
|
13
13
|
_.u.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info("Setting up SIMID plugin for "+this.l.length+" creatives"),b=this.m.getSurface()){this.g.info("Creating new session");this.a=new NA(this.h);var c=b.getContainer();this.j=UA(this,c,b);this.j.observe(c);a.on(_.Hg,this.w)}else this.g.warn(GA)};
|
|
14
|
-
_.u.
|
|
14
|
+
_.u.gl=function(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b],d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(QA(this.a),this.o=!0,this.g.info(IA)),c&&(c=this.a,RA(c,OA(c,HA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(GA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
|
|
15
15
|
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.u.onPlayerWillRelease=function(a){_.gw.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Hg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};_.u=VA.prototype;_.u.release=function(){this.g.info("Releasing loader")};
|
|
16
16
|
_.u.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.O(1,10,10100,"No player container found");return a};_.u.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.O(1,10,10100,"No surface");return a};_.u.ri=function(){return this.a};_.u.url=function(){return this.f?this.f.url:""};XA.prototype.create=function(){return new TA};
|
|
17
17
|
_.cu(new XA);};
|
package/cjs/cl.smooth.js
CHANGED
|
@@ -6,9 +6,9 @@ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},NS=function(a,b,c){KS.call(t
|
|
|
6
6
|
ZS=function(a,b,c,d){XS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},$S=function(a,b){YS.call(this,"avc1");this.width=a;this.height=b},aT=function(a,b){$S.call(this,a,b);this.type="encv"},bT=function(a,b,c){ZS.call(this,"mp4a",a,b,c)},cT=function(a,b,c){bT.call(this,a,b,c);this.type="enca"},dT=function(a,b){KS.call(this,"avcC");this.hb=a;this.tc=b;this.version=1;this.f=this.hb[0][1];this.h=this.hb[0][2];this.level=this.hb[0][3]},eT=function(a){Z.call(this,"esds",0,0);this.pc=
|
|
7
7
|
a},fT=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},gT=function(){Z.call(this,"dref",0,0)},hT=function(){KS.call(this,_.tg)},iT=function(){Z.call(this,_.vg,0,0)},jT=function(){Z.call(this,"stts",0,0)},kT=function(){Z.call(this,"stsc",0,0)},lT=function(){Z.call(this,"stco",0,0)},mT=function(){Z.call(this,"stsz",0,0)},nT=function(){Z.call(this,"smhd",0,0)},oT=function(){KS.call(this,"dinf")},pT=function(){KS.call(this,_.bf)},qT=function(){KS.call(this,_.Ye)},rT=function(a,b){Z.call(this,
|
|
8
8
|
"tfdt",a,0);this.baseMediaDecodeTime=b},sT=function(){Z.call(this,"mfhd",0,0);this.f=0},tT=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},uT=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},vT=function(){KS.call(this,"traf")},wT=function(){KS.call(this,"moof")},xT=function(){KS.call(this,_.Xe);this.f=new Uint8Array(0)},yT=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},zT=
|
|
9
|
-
function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.kc=""},AT=function(a){KS.call(this,"frma");this.f=a},BT=function(){Z.call(this,"saio",0,0);this.offset=[0]},CT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},DT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},ET=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},FT=function(a,b,c,d){c=b.di[c];b=b.
|
|
9
|
+
function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.kc=""},AT=function(a){KS.call(this,"frma");this.f=a},BT=function(){Z.call(this,"saio",0,0);this.offset=[0]},CT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},DT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},ET=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},FT=function(a,b,c,d){c=b.di[c];b=b.Qo;a=a.replace("Manifest","");b=b.replace("{bitrate}",
|
|
10
10
|
String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.GE([a],[b])[0]},GT=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",CS,"fourCC"]:a.type===_.dd&&(c=["bitrate",CS,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.qa(a,b,c,["id","segmentIndex"])},HT=function(a,b,c){var d=c.Xe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,hb:null,
|
|
11
|
-
tc:null,width:NaN,height:NaN,pc:null,Be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.hb=[_.bn(d[1])];a.tc=[_.bn(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.dd:a.pc=_.bn(c.Xe),a.sampleSize=c.
|
|
11
|
+
tc:null,width:NaN,height:NaN,pc:null,Be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.hb=[_.bn(d[1])];a.tc=[_.bn(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.dd:a.pc=_.bn(c.Xe),a.sampleSize=c.Wj||16,a.Be=c.Be,a.channelCount=c.wh}return a},IT=function(a,b){return a.filter(function(c){return c.type===b})},JT=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},QT=function(a,b,
|
|
12
12
|
c){var d=null;if(KT.test(a)){a=KT.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else LT.test(a)?d=JT(LT,a):MT.test(a)?d=JT(MT,a):NT.test(a)?(a=NT.exec(a),d=Number(a[1])/c.frameRate):OT.test(a)?(a=OT.exec(a),d=Number(a[1])/c.a):PT.test(a)&&(d=JT(PT,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
|
|
13
13
|
d);return b+":"+c+":"+a+"."+d},RT=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},TT=function(a){this.a=a;this.f=ST(this)},ST=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.qn(b)},UT=function(a,b,c){a:{var d=_.w([_.Xd,_.Vd]);for(var e=d.next();!e.done;e=d.next())if((e=c.cf(e.value))&&e.keyId){d=e.keyId;break a}_.Yh(BS,
|
|
14
14
|
"Could not get default Key ID for DRM init data!");d=null}c=new KS("xxxx");a.type===_.r?c=new aT(a.width,a.height):c=new cT(a.channelCount,a.sampleSize,a.Be);a=new yT;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new KS("schi")).append([a]);b=(new KS(_.ng)).append([new AT(b),new zT(_.xd,65536),a]);c.append([b]);return c},VT=function(a,b){var c=b.ff(),d=new QS(a.timescale,a.duration,a.id),e=(new RS).append([new SS(a.id)]),f=new TS(a.id,a.duration,a.timescale,a.width,a.height),g=new US(a.timescale,
|
|
@@ -21,23 +21,23 @@ m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.Cn(m.reader,16);if(_
|
|
|
21
21
|
e.documentElement;if(h&&(d=new RT(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.ye],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(t)){p=
|
|
22
22
|
p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],QT(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.T.ib(e).buffer}else c=e;return c}h=new wT;a=g.get("mfhd");b=new vT;l=g.get("tfhd");m=new rT(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].Dd);else g=8;b.append([c,new BT,new CT(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
|
|
23
23
|
new TT([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},ZT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},$T=function(a,b,c){a=_.lp(a);c&&a.version!==c&&(a=_.vE(a,c));return{initData:_.tE(a),initDataType:_.xd,keyId:b,periodId:null}},bU=function(){this.A=this.j=this.f=
|
|
24
|
-
this.D=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=aU;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.
|
|
24
|
+
this.D=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=aU;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.mo.bind(this);this.H=new Map},cU=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.pk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
|
|
25
25
|
c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},jU=function(a,b){var c=_.gp,d=null;try{var e=_.T.ce(b);d=c.we(e,_.$b)}catch(sZ){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+dU(a,d,"MajorVersion"),g=+dU(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+dU(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
|
|
26
|
-
Infinity,q=c.Z(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(eU(a,fU),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):eU(a,aU);a.a={startTime:0,delay:0,duration:l/h,
|
|
27
|
-
keyId:G,periodId:null},[G]));z.push(ZT(_.Vd,$T(E,G,t),[G]));a.w=z}var B=[],F=_.gp.Z(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var M=0;M<F.length;M++){for(var R,la=a,U=F[M],ra=dU(la,U,"Type"),Ba=+U.getAttribute("Chunks"),Ca=U.getAttribute("Subtype")||"",Da=U.getAttribute("Language")||_.
|
|
28
|
-
_.Qb),Pv=0;Pv<Qn.length;Pv++){var
|
|
29
|
-
!Tv){var sK=Sv,tK={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Oo=tK[No];if("AACH"===rK){
|
|
30
|
-
{id:
|
|
31
|
-
isNaN(
|
|
32
|
-
{
|
|
33
|
-
textStreams:cY,thumbStreams:[]};var eY=
|
|
34
|
-
GK.type=void 0;a.C=new _.qF(GK,$v,zK,!bw,!0);a.C.f=AK;_.yF(a.C,BK);a.C.A=fY;bw||a.C.offset(-CK);a.D.filterAllPeriods([yK]);a.j={presentationTimeline:a.C,periods:[yK],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.fd(a.L),a.K=!0);a.A=
|
|
35
|
-
l.oc.type&&m.bitrate===l.oc.bitrate}}(e))){GT(e.oc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=kU(a,a.A.timescale,d,g);g=e.oc.segmentIndex;g.ua(h);(h=a.a.
|
|
36
|
-
f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=kU(a,c,m,l);n=new _.MF(n);var p=null;m.type!==_.Q&&(p=lU(a,b,c,m,l));l.segmentIndex=n;var q=_.fM++,t=Promise.resolve.bind(Promise),v=n.ld.bind(n),z=n.get.bind(n),A=n.Md.bind(n),E=n.getDuration.bind(n),G=mU[m.type],B="";switch(m.type){case _.r:B=l.Xe;var F=/00000001[0-9]7/.exec(B);B="avc1."+(F&&F[0]?B.substr(B.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.dd:B=l.Xe,F=2,"AACH"===l.
|
|
37
|
-
(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",B)}F=m.type===_.Q?nU[m.
|
|
26
|
+
Infinity,q=c.Z(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(eU(a,fU),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):eU(a,aU);a.a={startTime:0,delay:0,duration:l/h,fg:p/h,se:0};if(q){var t=a.f.playreadyVersion,v=_.gp,z=[],A=v.Z(q,"ProtectionHeader")[0],E=_.an(v.sa(A)||""),G=_.lp(E).a;z.push(ZT(_.Xd,{initData:_.tE(_.dp(G)),initDataType:_.xd,
|
|
27
|
+
keyId:G,periodId:null},[G]));z.push(ZT(_.Vd,$T(E,G,t),[G]));a.w=z}var B=[],F=_.gp.Z(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var M=0;M<F.length;M++){for(var R,la=a,U=F[M],ra=dU(la,U,"Type"),Ba=+U.getAttribute("Chunks"),Ca=U.getAttribute("Subtype")||"",Da=U.getAttribute("Language")||_.Og,Ma=_.Pj(Da),Ab=U.getAttribute("Name")||"",pe=+U.getAttribute(_.vb),Ff=+U.getAttribute(_.ub),Kg=dU(la,U,"Url"),$u=+U.getAttribute("TimeScale")||null,pd=[],Qn=_.gp.Z(U,
|
|
28
|
+
_.Qb),Pv=0;Pv<Qn.length;Pv++){var Hf=void 0,wc=void 0,Qv=void 0,If=la,Pd=Qn[Pv],Rv=ra,WX=+Pd.getAttribute("Index"),XX=+dU(If,Pd,"Bitrate"),mK=NaN,nK=NaN,No=NaN,Sv=NaN,oK=NaN,pK=NaN,qK=NaN,rK=Pd.getAttribute("FourCC")||"";switch(Rv){case _.r:mK=+dU(If,Pd,_.ub);nK=+dU(If,Pd,_.vb);break;case _.dd:Sv=+Pd.getAttribute("Channels")||2,No=+dU(If,Pd,"SamplingRate"),pK=+dU(If,Pd,"AudioTag"),oK=+dU(If,Pd,"BitsPerSample"),qK=+dU(If,Pd,"PacketSize")}var Tv=String(Pd.getAttribute("CodecPrivateData"));if(Rv===_.dd&&
|
|
29
|
+
!Tv){var sK=Sv,tK={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Oo=tK[No];if("AACH"===rK){wc=new Uint8Array(4);var uK=tK[2*No];wc[0]=40|Oo>>1;wc[1]=Oo<<7|sK<<3|uK>>1;wc[2]=uK<<7|8;wc[3]=0;Hf=new Uint16Array(2);Hf[0]=(wc[0]<<8)+wc[1];Hf[1]=(wc[2]<<8)+wc[3];Qv=Hf[0].toString(16)+Hf[1].toString(16)}else wc=new Uint8Array(2),wc[0]=16|Oo>>1,wc[1]=Oo<<7|sK<<3,Hf=new Uint16Array(1),Hf[0]=(wc[0]<<8)+wc[1],Qv=Hf[0].toString(16);Tv=Qv.toUpperCase()}var YX=
|
|
30
|
+
{id:If.P++,type:Rv,index:WX,bitrate:XX,Xe:Tv,maxHeight:mK,maxWidth:nK,Be:No,wh:Sv,gp:pK,Wj:oK,xp:qK,Tl:rK,segmentIndex:null};pd.push(YX)}R=pd;for(var Oe=[],vK=_.gp.Z(U,"c"),Ck=0;Ck<vK.length;Ck++){var Uv=vK[Ck],qe=parseInt(Uv.getAttribute("t"),10),ki=parseInt(Uv.getAttribute("d"),10),Vv=parseInt(Uv.getAttribute("r"),10),Dk=0;if(isNaN(qe)&&isNaN(ki))throw la.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.P,4,4037,la.o);0===Ck&&
|
|
31
|
+
isNaN(qe)&&(Dk=qe=0);if(0<Ck){var Ng=Oe[Oe.length-1];Dk=Ng.n+1;Ng.d||(Ng.d=qe-Ng.t);qe||(qe=Ng.t+Ng.d);ki||(ki=qe-Ng.t)}Oe.push({n:Dk,d:ki,t:qe});if(Vv){Vv--;for(var wK=0;wK<Vv;wK++){var Po=Oe[Oe.length-1];Dk=Po.n+1;qe=Po.t+Po.d;ki=Po.d;Oe.push({n:Dk,d:ki,t:qe})}}}la.Ud()||Oe.length===Ba||la.g.warn("Number of fragments ("+Ba+") differs from number of chunks ("+Oe.length+").");B.push({type:ra,lp:Ba,Bo:Ca,language:Ma,yd:Da,name:Ab,maxWidth:pe,maxHeight:Ff,Qo:Kg,tracks:R,di:Oe,timescale:$u})}var Jf=
|
|
32
|
+
{vp:f,Ni:g,timescale:h,duration:l,isLive:m,up:n,fg:p,ng:!1,streams:B};if(a.j&&a.A)return gU(a,Jf),Promise.resolve();a.H.clear();var Wv=Jf.timescale,Qo=Jf.duration,$X=IT(Jf.streams,_.dd),aY=IT(Jf.streams,_.r),bY=IT(Jf.streams,_.Q),xK=[],Ro=hU(a,Qo,Wv,$X),So=hU(a,Qo,Wv,aY),cY=hU(a,Qo,Wv,bY);Ro.length||(Ro=[null]);So.length||(So=[null]);for(var Yv=0;Yv<So.length;Yv++)for(var Zv=0;Zv<Ro.length;Zv++)xK.push(iU(a,So[Yv],Ro[Zv]));var yK={id:"ID",configurationId:void 0,startTime:0,endTime:Qo,variants:xK,
|
|
33
|
+
textStreams:cY,thumbStreams:[]};var eY=Jf.streams,$v=a.a.startTime,zK=a.a.delay,aw=a.J,AK=Math.min(a.a.duration||Infinity,aw),bw=a.Ud(),fY=a.a.fg,gY=a.a.se,BK=a.I,CK=isFinite(a.G)?a.G:0;if(bw)AK=Infinity,$v=Date.now()/1E3-gY,a.a.startTime=$v,zK=3*BK;else for(var hY=isFinite(aw)?aw:a.a.duration,DK=_.w(eY),cw=DK.next();!cw.done;cw=DK.next())for(var EK=_.w(cw.value.tracks),dw=EK.next();!dw.done;dw=EK.next()){var FK=dw.value;FK.segmentIndex.offset(-CK);_.iF(FK.segmentIndex,hY)}var GK=a.f.timeline||{};
|
|
34
|
+
GK.type=void 0;a.C=new _.qF(GK,$v,zK,!bw,!0);a.C.f=AK;_.yF(a.C,BK);a.C.A=fY;bw||a.C.offset(-CK);a.D.filterAllPeriods([yK]);a.j={presentationTimeline:a.C,periods:[yK],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.fd(a.L),a.K=!0);a.A=Jf;return Promise.resolve()},gU=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.A.streams[c].tracks),g=f.next();!g.done;e={oc:e.oc},g=f.next())if(e.oc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
|
|
35
|
+
l.oc.type&&m.bitrate===l.oc.bitrate}}(e))){GT(e.oc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=kU(a,a.A.timescale,d,g);g=e.oc.segmentIndex;g.ua(h);(h=a.a.fg)&&_.OF(g,_.NF(g)-h).forEach(function(l){l.eb().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.oc.type+" track with bitrate "+(e.oc.bitrate+". Skipping update."))},hU=function(a,b,c,d){for(var e=[],f={$c:0};f.$c<d.length;f={$c:f.$c},
|
|
36
|
+
f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=kU(a,c,m,l);n=new _.MF(n);var p=null;m.type!==_.Q&&(p=lU(a,b,c,m,l));l.segmentIndex=n;var q=_.fM++,t=Promise.resolve.bind(Promise),v=n.ld.bind(n),z=n.get.bind(n),A=n.Md.bind(n),E=n.getDuration.bind(n),G=mU[m.type],B="";switch(m.type){case _.r:B=l.Xe;var F=/00000001[0-9]7/.exec(B);B="avc1."+(F&&F[0]?B.substr(B.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.dd:B=l.Xe,F=2,"AACH"===l.Tl?F=5:B&&(F=
|
|
37
|
+
(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",B)}F=m.type===_.Q?nU[m.Bo]:void 0;return{id:q,originalId:null,Ap:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:E,segmentIndex:n,segmentLookupStrategy:_.aE,initSegmentReference:p,mimeType:G,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:F,encrypted:a.qg(),keyId:null,language:m.language,originalLanguage:m.yd,
|
|
38
38
|
label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.wh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},kU=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.di.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=FT(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Nj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.r||c.type===_.dd)b=f[f.length-
|
|
39
|
-
1],a.J=Math.min(a.J,e),0===a.a.se?a.a.se=b.endTime:a.a.se=Math.min(a.a.se,b.endTime);return f},lU=function(a,b,c,d,e){b=HT(b,d.timescale||c,e);c={isLive:a.Ud.bind(a),ff:a.qg.bind(a),
|
|
40
|
-
0),e=c?c.language:_.
|
|
39
|
+
1],a.J=Math.min(a.J,e),0===a.a.se?a.a.se=b.endTime:a.a.se=Math.min(a.a.se,b.endTime);return f},lU=function(a,b,c,d,e){b=HT(b,d.timescale||c,e);c={isLive:a.Ud.bind(a),ff:a.qg.bind(a),am:function(){return 1},cf:a.ii.bind(a)};d=new Uint8Array(0);try{d=VT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.$m(d);return new _.IE(function(){return[f]},0,null,null,!0)},iU=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
|
|
40
|
+
0),e=c?c.language:_.Og;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},dU=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},oU=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.ic.bind(a),b))},eU=function(a,b){var c=b===aU;a.j&&a.j.presentationTimeline&&_.tF(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
|
|
41
41
|
a.l=null,a.B=null);a.M=b},pU=function(){};KS.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};KS.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
|
|
42
42
|
KS.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
|
|
43
43
|
KS.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.sn(a,JS(this.type));this.size>b&&DS(a,this.size);"uuid"===this.type&&_.sn(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.x(Z,KS);Z.prototype.a=function(){return 4+KS.prototype.a.call(this)};
|
|
@@ -69,8 +69,8 @@ CT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W
|
|
|
69
69
|
DT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&ES(a,this.j);for(var b=0;b<this.h;b++)if(_.sn(a,this.f[b].yi),this.flags&2){GS(a,this.f[b].Dd);for(var c=0;c<this.f[b].Dd;c++)GS(a,this.f[b].Vg[c].th),_.W(a,this.f[b].Vg[c].uh)}a.getPosition()};var KT=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,LT=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,MT=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,NT=/^(\d*\.?\d*)f$/,OT=/^(\d*\.?\d*)t$/,PT=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;TT.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};TT.prototype.write=function(){this.f=ST(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var WT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=bU.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.vh(new Set([a,ET(a)])).concat();return cU(this,d).then(function(e){return jU(c,e.data).then(function(){oU(c,c.B);return c.j})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.ze(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
|
|
70
70
|
_.u.update=function(){var a=this;if(this.Ud())return cU(this,[this.o]).then(function(b){return jU(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.ic=function(){var a=this;this.g.debug(_.RD);this.D&&(this.l=null,this.update().then(function(){oU(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&oU(a,100))}))};_.u.Ud=function(){return this.M===fU};_.u.qg=function(){return 0<this.w.length};
|
|
71
71
|
_.u.ii=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
|
|
72
|
-
_.u.
|
|
73
|
-
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.u.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.u.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.nj(_.kD+a);return f["return"](d)})};var mU={video:_.$g,audio:_.hd,text:_.ad},aU=_.kc,fU="LIVE",nU={
|
|
72
|
+
_.u.mo=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Ud.bind(this),ff:this.qg.bind(this),am:function(){return 1},cf:this.ii.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=YT(a,b,g,c)}catch(h){d=
|
|
73
|
+
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.u.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.u.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.nj(_.kD+a);return f["return"](d)})};var mU={video:_.$g,audio:_.hd,text:_.ad},aU=_.kc,fU="LIVE",nU={So:_.td,Zo:_.xg};_.x(pU,_.Gu);pU.prototype.f=function(){_.iv.ism=bU;_.gv[_.bd]=bU};pU.prototype.a=function(){_.pG("ism");_.qG(_.bd)};pU.prototype.id=function(){return _.og};_.J("clpp.smooth.SmoothComponent",pU);};
|
|
74
74
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
75
75
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
76
76
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var cA="No thumbnail found for position: ",dA="Position is out of range: ",eA="Thumbnail URL is mandatory",fA="Wrong gridSize format",gA="clpp.thumbnails",hA=function(){this.log=new _.K(gA);this.player=null;this.a=[];this.w=!1},jA=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.gf&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return iA(a,0,e,!!f)})},Promise.resolve())},iA=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return kA(a,d).then(function(){return a.a[b].load()}).then(function(){return iA(a,
|
|
3
|
-
e,c,d)})},kA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Mq)c();else a.player.one(_.od,function(){c()})})},lA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.va=p;this.
|
|
3
|
+
e,c,d)})},kA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Mq)c();else a.player.one(_.od,function(){c()})})},lA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.va=p;this.wl=h;this.po=l;this.om=m;this.pm=n;this.rg=null},mA=function(){hA.call(this);
|
|
4
4
|
this.f=null;this.o=this.h=1;this.j=0},nA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.zd=new _.xk},oA=function(){this.g=new _.K(gA);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.xk},pA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.zd.resolve()})},rA=function(a,b){return qA(a,b).then(function(c){return new lA(c,b.time,b.duration)})},qA=function(a,b){return b.load().then(function(){var c=_.bk(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
5
|
_.Zm(c)})},sA=function(){hA.call(this);this.f=null},tA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},uA=function(){hA.apply(this,arguments)},vA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ne:c,fh:d,xi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},wA=function(){this.g=new _.K(gA);this.a=this.m=null},xA=function(a){return a.some(function(b){return 0<
|
|
6
6
|
b.thumbStreams.length})},CA=function(a){return a?a===yA||a===zA?new mA:a===AA?new sA:a===BA?new oA:null:null},DA=function(a){if(!a)return null;a=new _.$k(a);return a.path.match(/.*\.vtt$/i)?AA:a.path.match(/.*\.bif$/i)?BA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?yA:null},EA=function(){};hA.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.$f,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&jA(c,b.preload)})};lA.prototype.raw=function(){return this.va.cloneNode(!1)};
|
|
7
7
|
lA.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.fe);e.style.width=c+_.Xf;e.style.height=d+_.Xf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.va.naturalWidth||this.va.width))+"px "+Math.ceil(d/
|
|
8
8
|
this.height*(this.va.naturalHeight||this.va.height))+_.Xf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Xf;e.style.backgroundPositionY="-"+f*d+_.Xf;return e};
|
|
9
|
-
lA.prototype.load=function(){var a=this;this.rg||(this.rg=new Promise(function(b,c){function d(){a.width||(a.width=(a.va.naturalWidth||a.va.width)/a.
|
|
9
|
+
lA.prototype.load=function(){var a=this;this.rg||(this.rg=new Promise(function(b,c){function d(){a.width||(a.width=(a.va.naturalWidth||a.va.width)/a.wl);a.height||(a.height=(a.va.naturalHeight||a.va.height)/a.po);a.x||(a.x=a.width*a.om);a.y||(a.y=a.height*a.pm)}if(a.va.src&&a.va.complete)d(),b(a);else{var e=null,f=function(){d();a.va.removeEventListener(_.Se,f);a.va.removeEventListener(_.Ae,e);b(a)};e=function(g){a.va.removeEventListener(_.Se,f);a.va.removeEventListener(_.Ae,e);c(new _.O(1,9,2014,
|
|
10
10
|
"Failed to load thumbnail.",g))};a.va.addEventListener(_.Se,f);a.va.addEventListener(_.Ae,e);a.va.src=a.src}}));return this.rg};_.J("clpp.thumbnails.Thumbnail",lA);lA.prototype.load=lA.prototype.load;lA.prototype.element=lA.prototype.element;lA.prototype.raw=lA.prototype.raw;_.x(mA,hA);
|
|
11
11
|
mA.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,eA);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.O(1,9,7100,fA);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
12
|
new _.O(1,9,7100,fA);}hA.prototype.init.call(this,a,b)};mA.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,dA+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
|
package/cjs/cl.tizen.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var UQ="An unknown error occurred while trying to get volume",VQ="Cannot get loading rendition due to platform limitations",WQ="PARAM_START_POSITION",XQ="SecurityError",YQ="The require privilege is: http://tizen.org/privilege/tv.audio",ZQ="|STARTBITRATE\x3d",$Q=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},aR=function(a,b){this.h=a;this.o=null;this.a=_.ff;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},dR=function(a){var b,
|
|
3
3
|
c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Xd||a.a===_.Vd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.ue)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Xd?_.y(e,bR(a),5):_.y(e,cR(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ue,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Fg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
|
|
4
|
-
keyIds:[],periodId:null},_.Jh(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},cR=function(a,b){var c,d,e,f;return _.I(function(g){c=eR;d=fR;e={};e[d.
|
|
4
|
+
keyIds:[],periodId:null},_.Jh(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},cR=function(a,b){var c,d,e,f;return _.I(function(g){c=eR;d=fR;e={};e[d.Ej]=!b.Fg;e[d.Hj]=b.ue;""!==b.customData&&(e[d.Cj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.C(g)})},bR=function(a){var b;return _.I(function(c){b=eR;try{webapis.avplay.setDrm(b.Qe,
|
|
5
5
|
"Initialize",""),webapis.avplay.setDrm(b.Qe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Qe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.C(c)})},gR=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,E,G;_.I(function(B){if(1==B.a){c=eR;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ue;l=_.pk([h],_.lk());l.type=3;l.body=f.buffer;l.method=
|
|
6
6
|
_.Jb;_.D(B,2);return _.y(B,a.D.Eb.fetch(l).T,4)}if(2!=B.a){m=B.f;if(a.j){n=_.bk(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+WQ+(v+WQ);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Qe,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.O(_.P,6,6008,{browserError:JSON.stringify(F)}),a.D.onError(A)}}return _.Jh(B,0)}E=_.H(B);a.g.error("License request failed.",JSON.stringify(E));G=new _.O(_.P,
|
|
7
7
|
6,6007,{message:"Error while fetching license!",url:E.data.url,status:E.data.status||NaN,response:E.data.response||"",headers:E.data.headers||{}},E);a.D.onError(G);_.C(B)})},hR=function(a){this.m=a;this.a=this.m.a;this.f=_.Hq;this.j=_.Iq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},jR=function(a,b){if(a.f!==b)if(a.f===_.Sq&&b!==_.Hq)a.g.debug(_.ED+iR(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Mq?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.qd,
|
|
8
8
|
{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Mq&&a.m.trigger(new _.L(_.od,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.rg,{detail:d}));a.g.debug("State changed:",iR(a.j),"-\x3e",iR(a.f))}},iR=function(a){return Object.keys(_.Qq)[a]},mR=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case kR:c=_.Vq;break;case lR:c=_.Uq;break;default:a.m.isEnded()?c=_.Oq:a.g.debug("Inconsistent AVPlay playback state:",
|
|
9
9
|
b)}jR(a,c)}},nR=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},oR=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},pR=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.fv(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
|
|
10
|
-
qR=function(a){var b=document.createElement(_.r),c=new _.wH,d=new _.ZE,e=a.m.getTextDisplayer();return new _.yH(b,c,e,d,a.m.getConfiguration())},rR=function(a){var b={configuration:{},Qb:function(){return a.m.getPosition()},X:a.h,Eb:a.m.getNetworkEngine(),pd:null,xg:a.
|
|
10
|
+
qR=function(a){var b=document.createElement(_.r),c=new _.wH,d=new _.ZE,e=a.m.getTextDisplayer();return new _.yH(b,c,e,d,a.m.getConfiguration())},rR=function(a){var b={configuration:{},Qb:function(){return a.m.getPosition()},X:a.h,Eb:a.m.getNetworkEngine(),pd:null,xg:a.pl.bind(a),wg:a.ol.bind(a),onError:a.ql.bind(a),Si:function(){},onEvent:function(){},Xi:a.rl.bind(a),wf:function(){},ee:function(){return new _.$H},Wf:function(){return!1},Zd:null};return new _.UI(a.a,b)},sR=function(a){var b=a.m.getPosition(),
|
|
11
11
|
c=null;a=_.w(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},tR=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Qk(String(c++),_.Sk);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;
|
|
12
12
|
e.kind=a[d].kind||_.mE;var f=new _.Zk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},uR=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.XI(a.f,_.Q),c=null;if(b){a=tR(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},vR=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.Ce,a.a&&a.f)){a.setTextVisibility(!0);
|
|
13
13
|
var c=sR(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.iJ(a.f,c,!0,0),a.m.trigger(new _.L(_.Cg))),a.o=c.language):a.g.error("No stream with id",d.id)}},wR=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},xR=function(a,b){a.m.trigger(new _.L(_.bh,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
|
|
14
14
|
abrSelection:a.a.o}}))},yR=function(a){var b=a.na();b&&a.m.trigger(new _.L(_.md,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},zR=function(a){var b=a.m.getConfiguration(),c=_.Vi(b.preferredAudioLanguage||[]),d=a.f[_.V]||[];if(d.length){var e=null;c.some(function(g){e=_.LE(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
|
|
15
15
|
0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ka(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},DR=function(a,b){if(b){var c=b.track.type.toUpperCase();AR(a.a,c,Number(b.id)).then(function(){c===BR&&(a.l=b,a.m.trigger(new _.L(_.kd)));c===CR&&(a.o=b,a.m.trigger(new _.L(_.Cg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},ER=
|
|
16
|
-
function(a,b,c){var d=_.Pj(b.language||_.
|
|
16
|
+
function(a,b,c){var d=_.Pj(b.language||_.Og);c.language=_.Rk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.hd;a=new _.Zk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},FR=function(a,b,c){c.mimeType=_.$g;a=new _.Zk(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},GR=function(a,b,c){b=_.Pj(b.track_lang||_.Og);c.mimeType="text/ttml";
|
|
17
17
|
c.language=_.Rk(b);c.originalLanguage=b;c.kind=_.mE;return new _.Zk(String(a),c)},HR=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},KR=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===IR}),f=b.filter(function(n){return n.type===BR}),g=[],h=0;h<f.length;h++){var l=HR(a,f[h].extra_info);if(l){var m=
|
|
18
|
-
_.Pj(l.language||_.
|
|
18
|
+
_.Pj(l.language||_.Og);m=_.Rk(m);m=c(g,m);m||(m=new _.Qk(String(a.h++),_.V),g.push(m));m.renditions.push(ER(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Qk(String(a.h++),_.Tk);for(h=0;h<e.length;h++)(l=HR(a,e[h].extra_info))?f.renditions.push(FR(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?tR(a.j):JR(a,b);d[_.Tk]=[f];d[_.V]=g;d[_.Sk]=e;return d},JR=function(a,b){for(var c=b.filter(function(h){return h.type===CR}),d=[],e=0;e<
|
|
19
19
|
c.length;e++){var f=HR(a,c[e].extra_info);if(f){var g=new _.Qk(String(a.h++),_.Sk);g.renditions.push(GR(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},LR=function(a,b){for(var c=a.f[_.Tk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.qa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},MR=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
|
|
20
20
|
b){c=a[d].renditions[e];break}return c},OR=function(a,b){if(b===_.Sk&&a.j)return uR(a.j);var c=NR(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Tk&&(d=HR(a,c.extra_info),d=LR(a,{width:d.Width,height:d.Height}));b===_.V&&(c?(d=MR(a,c,_.V),a.l=d):d=a.l);b===_.Sk&&(c?(d=MR(a,c,_.Sk),a.o=d):d=a.o);return d},PR=function(a){_.Am.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=
|
|
21
|
-
0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},QR=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.C(b)})},SR=function(a){try{webapis.avplay.setListener({onbufferingstart:a.
|
|
22
|
-
{currentTime:b}))},onevent:a.
|
|
23
|
-
VR=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+ZQ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},ZR=function(a){return{position:a.getPosition(),state:a.m.getState(),sh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:WR(a),volume:a.getVolume(),
|
|
21
|
+
0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},QR=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.C(b)})},SR=function(a){try{webapis.avplay.setListener({onbufferingstart:a.jl.bind(a),onbufferingprogress:a.il.bind(a),onbufferingcomplete:a.hl.bind(a),onstreamcompleted:a.ml.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(RR,
|
|
22
|
+
{currentTime:b}))},onevent:a.ll.bind(a),onsubtitlechange:a.nl.bind(a),ondrmevent:a.kl.bind(a),onerror:a.Vd.bind(a)})}catch(b){a.g.error(b)}},TR=function(a){var b=!!a.m.getTrackManager().Za();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},UR=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,mp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",ZQ+d)}catch(e){a.g.debug(e)}},
|
|
23
|
+
VR=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+ZQ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},ZR=function(a){return{position:a.getPosition(),state:a.m.getState(),sh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:WR(a),volume:a.getVolume(),Io:YR(a),Dl:NR(a)}},aS=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,$R(),2);if(3!=d.a)return b=new Promise(function(e){(new _.mi(e)).fa(5)}),
|
|
24
24
|
_.y(d,Promise.race([QR(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.C(d)})},gS=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Zq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.L(bS)),f=c.currentPosition);
|
|
25
25
|
_.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Xc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(VR(a,e.nextBandwidth),a.o=!1):(a.o||UR(a,e),a.o=!0);SR(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},Eb:a.m.getNetworkEngine()};a.h=new aR(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(cS)),
|
|
26
26
|
_.y(p,dS(a),6);case 6:a.f||a.trigger(new _.L(eS));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&fS(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.Jh(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},dS=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
|
|
27
27
|
TR(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},hS=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=ZR(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.sh;a.f=!1;a.a=
|
|
28
|
-
null;return e===lR?a.pause():a.play()})}catch(e){return Promise.reject(e)}},YR=function(a){return a.f&&a.a?a.a.
|
|
28
|
+
null;return e===lR?a.pause():a.play()})}catch(e){return Promise.reject(e)}},YR=function(a){return a.f&&a.a?a.a.Io:webapis.avplay.getTotalTrackInfo()},NR=function(a){return a.f&&a.a?a.a.Dl:webapis.avplay.getCurrentStreamInfo()},AR=function(a,b,c){b=b.toUpperCase();b===CR&&iS(a,!0);var d=a.j[b];d&&(d.Ef.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
|
|
29
29
|
h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,oh:0,Ef:new _.mi(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.oh?(!a.w&&++l.oh,l.Ef.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ef.stop(),a.j[h]=null,f())}}g(b,c)})},iS=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
|
|
30
30
|
d)}},fS=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case XQ:a.g.warn("The application does not have the privilege to set mute.",YQ);break;default:a.g.warn(UQ,c)}}},WR=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case XQ:a.g.warn("The application doesn't have the privilege to get the mute state.",YQ);break;default:a.g.warn(UQ,c)}}return!!b},$R=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
|
|
31
31
|
$Q(c,_.Se,function(d){return a(d)});$Q(c,_.Ae,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},jS=function(){_.Am.call(this);this.a=new PR(this);this.f=new hR(this);this.configuration=this.B=_.Hm();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new wR;this.C=new _.Kk;this.o=this.h=null;this.A=!1},kS=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
|
|
32
32
|
a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},lS=function(){},mS=function(){};
|
|
33
33
|
aR.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.jn[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.Ob+a.h.env+_.aa),new _.O(_.P,6,6015,_.Fa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.ln(b,a.h.customData);(e=d[_.Vd])&&a.f.set(_.Vd,{ue:e.licenseUrl||"",customData:c,Fg:!1});(f=d[_.Xd])&&a.f.set(_.Xd,{ue:f.licenseUrl||"",customData:c,
|
|
34
34
|
Fg:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Vd))a.a=_.Vd;else if(a.f.get(_.Xd))a.a=_.Xd;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.y(h,dR(a),2)}a.j=!0;_.C(h)})};aR.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.ff;a.l=null;a.f=new Map;_.C(b)})};aR.prototype.getDrmInfo=function(){return this.o};
|
|
35
|
-
var fR={
|
|
35
|
+
var fR={Ej:"DeleteLicenseAfterUse",Hj:"LicenseServer",Xo:"GetChallenge",Yo:"HttpHeader",$o:"UserAgent",Uo:"Cookie",Cj:"CustomData"};_.u=hR.prototype;_.u.initialize=function(){this.a.on(bS,this.Ph,this);this.a.on(nS,this.Oh,this);this.a.on(oS,this.Nh,this);this.a.on(cS,this.Zi,this);this.a.on(eS,this.Yi,this);this.a.on(pS,this.Qh,this)};_.u.release=function(){jR(this,_.Hq);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(bS,this.Ph);this.a.off(nS,this.Oh);this.a.off(oS,this.Nh);this.a.off(cS,this.Zi);this.a.off(eS,this.Yi);this.a.off(pS,this.Qh);this.m=this.a=null};
|
|
36
36
|
_.u.Ph=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;jR(this,_.Mq)};_.u.Oh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",iR(this.f))};_.u.Nh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===qS;if(!a&&b){jR(this,_.Uq);return}}if(a=this.f!==_.Tq)a=this.a.getState(),a=a===kR||a===lR;a&&mR(this)};
|
|
37
|
-
_.u
|
|
37
|
+
_.u.Zi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===rS?jR(this,_.Tq):this.g.error("AVPlay prepares while state is not IDLE")};_.u.Yi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.Qh=function(){jR(this,_.Oq)};_.u.getState=function(){return this.f};_.u=nR.prototype;_.u.initialize=function(a){this.m=a};
|
|
38
38
|
_.u.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,pR(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
|
|
39
39
|
onEvent:function(){},onError:function(){}};_.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.Jh(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.D(m,6),g=b,_.y(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.Jh(m,4);break;case 6:h=_.H(m),b.g.error(h),b.a=null;case 4:if(!b.a||!oR(b.a)){m.F(0);break}b.h=qR(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=rR(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=
|
|
40
|
-
l.preferForcedSubtitles;_.Jh(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.C(m)}})};_.u.
|
|
41
|
-
_.u.
|
|
40
|
+
l.preferForcedSubtitles;_.Jh(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.C(m)}})};_.u.pl=function(a){this.g.debug(_.eE,a);this.w=!0;var b=_.ZH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,fb:null}};_.u.ol=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.iJ(this.f,this.l,!0,0),this.l=null)};_.u.ql=function(){this.g.debug("onError_")};
|
|
41
|
+
_.u.rl=function(){this.j&&this.j.update&&this.j.update()};_.u.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.C(b)})};_.u.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.u.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.C(b)})};
|
|
42
42
|
_.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.C(b)}})};_.x(wR,_.ul);_.u=wR.prototype;_.u.Qi=function(a){var b=a.eventid;a=a.data;switch(b){case sS:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+HR(this,b[0].extra_info).Bit_rate,b=LR(this,{bandwidth:b}))&&(this.w=b,xR(this,b));break;case tS:yR(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.u.Bg=function(a){a.detail.currentState===_.Vq&&this.m.off(_.rg,this.Bg)};
|
|
43
43
|
_.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.rg,function(c){b.A||(c=c.detail,c.currentState===_.Vq&&(b.g.debug("Current state",c.currentState),b.A=!0,zR(b)))});this.a.on(uS,this.Qi,this)};_.u.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
|
|
44
44
|
_.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.rg,this.Bg);this.m.on(_.rg,this.Bg,this);try{var a=YR(this.a);this.f=KR(this,a);var b=this.f[_.V]||[];b.length&&(this.l=b[0].renditions[0]||null);yR(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(uS,this.Qi);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.Tk]||[]};_.u.getAudioTracks=function(){return this.f[_.V]||[]};
|
|
@@ -46,8 +46,8 @@ _.u.ma=function(){return this.f[_.Sk]||[]};_.u.na=function(){return OR(this,_.Tk
|
|
|
46
46
|
_.u.Jb=function(a){var b=this;null===a?(a=this.na(),hS(this.a,a.bandwidth,null).then(function(){yR(b)})):0<a.renditions.length&&this.ub(a.renditions[0])};_.u.Ka=function(a){a?DR(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.$a=function(a){a?(a=a.renditions[0],this.j?vR(this.j,a.track):DR(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,iS(this.a,!1),this.m.trigger(new _.L(_.Cg)))};
|
|
47
47
|
_.u.ub=function(a){var b=this,c=this.na();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,xR(this,a),hS(this.a,c.bandwidth,a.bandwidth).then(function(){yR(b)})["catch"](function(d){var e=new _.O(_.P,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.u.Hb=function(a){DR(this,a)};_.u.Ib=function(a){this.j?vR(this.j,a.track):DR(this,a)};
|
|
48
48
|
_.u.addTextTrack=function(){};_.u.wa=function(){return this.a.o};wR.prototype.isAbrEnabled=wR.prototype.wa;wR.prototype.addTextTrack=wR.prototype.addTextTrack;wR.prototype.setTextRendition=wR.prototype.Ib;wR.prototype.setAudioRendition=wR.prototype.Hb;wR.prototype.setVideoRendition=wR.prototype.ub;wR.prototype.setTextTrack=wR.prototype.$a;wR.prototype.setAudioTrack=wR.prototype.Ka;wR.prototype.setVideoTrack=wR.prototype.Jb;wR.prototype.getTextTrack=wR.prototype.Ba;wR.prototype.getAudioTrack=wR.prototype.ra;
|
|
49
|
-
wR.prototype.getVideoTrack=wR.prototype.Na;wR.prototype.getLoadingTextRendition=wR.prototype.Ob;wR.prototype.getLoadingAudioRendition=wR.prototype.Nb;wR.prototype.getLoadingVideoRendition=wR.prototype.Bb;wR.prototype.getTextRendition=wR.prototype.Za;wR.prototype.getAudioRendition=wR.prototype.Va;wR.prototype.getVideoRendition=wR.prototype.na;wR.prototype.getTextTracks=wR.prototype.ma;wR.prototype.getAudioTracks=wR.prototype.getAudioTracks;wR.prototype.getVideoTracks=wR.prototype.getVideoTracks;_.x(PR,_.Am);_.u=PR.prototype;_.u.
|
|
50
|
-
_.u.
|
|
49
|
+
wR.prototype.getVideoTrack=wR.prototype.Na;wR.prototype.getLoadingTextRendition=wR.prototype.Ob;wR.prototype.getLoadingAudioRendition=wR.prototype.Nb;wR.prototype.getLoadingVideoRendition=wR.prototype.Bb;wR.prototype.getTextRendition=wR.prototype.Za;wR.prototype.getAudioRendition=wR.prototype.Va;wR.prototype.getVideoRendition=wR.prototype.na;wR.prototype.getTextTracks=wR.prototype.ma;wR.prototype.getAudioTracks=wR.prototype.getAudioTracks;wR.prototype.getVideoTracks=wR.prototype.getVideoTracks;_.x(PR,_.Am);_.u=PR.prototype;_.u.jl=function(){this.w=!0;this.f||this.trigger(new _.L(bS))};_.u.il=function(a){this.w=!0;this.trigger(new _.L(nS,{percent:a}))};_.u.hl=function(){this.w=!1;this.trigger(new _.L(oS))};_.u.ml=function(){this.trigger(new _.L(pS))};_.u.ll=function(a,b){this.trigger(new _.L(uS,{eventid:a,data:b}))};_.u.nl=function(a,b,c,d,e){this.trigger(new _.L(vS,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
|
|
50
|
+
_.u.kl=function(a,b){this.trigger(new _.L(wS,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Xd&&"Challenge"===b.name)gR(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.u.Vd=function(a){this.trigger(new _.L(xS,{eventType:a}))};
|
|
51
51
|
_.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(RR,f,b);g=setTimeout(function(){b.off(RR,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===rS)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){TR(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(xS));e(f)})})).then(function(){return a()});if(c===lR||c===qS)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===kR?
|
|
52
52
|
Promise.resolve():Promise.reject("Player is in invalid state")};_.u.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===lR?Promise.resolve():Promise.reject()};
|
|
53
53
|
_.u.setPlaybackRate=function(a){var b=this.getState();if(b===qS||b===kR||b===lR){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.u.getPlaybackRate=function(){return this.C};
|
|
@@ -56,13 +56,13 @@ _.u.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;
|
|
|
56
56
|
_.u.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.Ef.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.u.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case XQ:this.g.debug("The application does not have the privilege to get the volume.",YQ);break;default:this.g.debug(UQ,b)}}return a};
|
|
57
57
|
_.u.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case XQ:this.g.warn("The application does not have the privilege to set the volume.",YQ);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
|
|
58
58
|
_.u.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Vd(JSON.stringify(a))}};_.u.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.u.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.u.setSourceIndex=function(a){this.G=a};_.u.getSourceIndex=function(){return this.G};_.u.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
|
|
59
|
-
var rS="IDLE",qS="READY",kR="PLAYING",lR="PAUSED",IR=_.jc,BR=_.ja,CR="TEXT",tS="PLAYER_MSG_RESOLUTION_CHANGED",sS="PLAYER_MSG_BITRATE_CHANGE",eR={PLAYREADY:"PLAYREADY",
|
|
60
|
-
_.u.Mh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.T.Ug(d))&&this.o.append([new _.gj(b,c,d)],[])};_.u.Jh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.
|
|
59
|
+
var rS="IDLE",qS="READY",kR="PLAYING",lR="PAUSED",IR=_.jc,BR=_.ja,CR="TEXT",tS="PLAYER_MSG_RESOLUTION_CHANGED",sS="PLAYER_MSG_BITRATE_CHANGE",eR={PLAYREADY:"PLAYREADY",Vo:"EME_PLAYREADY",ap:"VERIMATRIX",Qe:"WIDEVINE_CDM",Wo:"EME_WIDEVINE_CDM",cp:"WIDEVINE_CLASSIC"};_.x(jS,_.Am);_.u=jS.prototype;_.u.Lh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.ze));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.Ih=function(a){this.trigger(new _.L(_.Hg,{currentTime:a.currentTime/1E3}))};
|
|
60
|
+
_.u.Mh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.T.Ug(d))&&this.o.append([new _.gj(b,c,d)],[])};_.u.Jh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.Ri=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
|
|
61
61
|
_.u.Kh=function(a){this.g.debug("Error: TYPE: "+a.eventType);jR(this.f,_.Sq);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.Ae,{detail:a}))};
|
|
62
|
-
_.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(pS,this.Lh,this);this.a.on(RR,this.Ih,this);this.a.on(vS,this.Mh,this);this.a.on(wS,this.Jh,this);this.a.on(xS,this.Kh,this);this.a.on(oS,this.
|
|
62
|
+
_.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(pS,this.Lh,this);this.a.on(RR,this.Ih,this);this.a.on(vS,this.Mh,this);this.a.on(wS,this.Jh,this);this.a.on(xS,this.Kh,this);this.a.on(oS,this.Ri,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=yS;yS+=1;this.j=_.tr(_.gf,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
|
|
63
63
|
var e=[_.mh,_.Fe,"position",_.Le,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.vr(c,f);kS(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Fb)};_.u.appendLoad=function(){return Promise.reject(_.Fb)};
|
|
64
64
|
_.u.seekWith=function(){return Promise.reject(_.Fb)};_.u.setSeekInterceptor=function(){};_.u.setPlaybackSessionId=function(){};_.u.getBandwidthEstimate=function(){return null};
|
|
65
|
-
_.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(pS,a.Lh);a.a.off(RR,a.Ih);a.a.off(vS,a.Mh);a.a.off(wS,a.Jh);a.a.off(xS,a.Kh);a.a.off(oS,a.
|
|
65
|
+
_.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(pS,a.Lh);a.a.off(RR,a.Ih);a.a.off(vS,a.Mh);a.a.off(wS,a.Jh);a.a.off(xS,a.Kh);a.a.off(oS,a.Ri);if(!a.h){b.F(3);break}return _.y(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.C(b)}})};_.u.namespace=function(){return zS};_.u.getPlaybackRate=function(){return this.a.getPlaybackRate()};
|
|
66
66
|
_.u.setDrmCustomDataModifier=function(){};_.u.setCdnErrorCallback=function(){};_.u.detach=function(){};_.u.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.u.getPosition=function(){return this.getMediaPosition()};_.u.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Oq?this.getDuration():this.a.getPosition()||0};_.u.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
|
|
67
67
|
_.u.getPresentationStartTime=function(){return null};_.u.getSeekRange=function(){return{start:0,end:0}};_.u.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.u.setVolume=function(a){this.a.setVolume(a)};_.u.getDuration=function(){return this.getMediaDuration()};_.u.getMediaDuration=function(){return this.a.getDuration()};_.u.getBufferInfo=function(){this.g.warn(_.wa);return new _.zm};_.u.getTrackManager=function(){return this.l};_.u.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
|
|
68
68
|
_.u.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.F(4);break}return _.y(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.y(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.C(b)}})};
|
package/cjs/cl.ttml.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var Qy='application/mp4; codecs\x3d"stpp.ttml"',Ry='application/mp4; codecs\x3d"stpp.ttml.im1i"',Sy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Ty="backgroundColor",Uy="direction",Vy="displayAlign",Wy="region",Xy="sans-serif",Yy="textAlign",Zy="textDecoration",$y="writingMode",az=function(a,b,c){this.h=a;this.f=b;this.a=c},bz=function(a,b,c){az.call(this,a,[],c);this.j=b||""},cz=function(a,b,c){az.call(this,a,b,c)},dz=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
|
|
3
3
|
lz=function(a,b){var c=null;if(ez.test(a)){c=ez.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else fz.test(a)?c=gz(fz,a):hz.test(a)?c=gz(hz,a):iz.test(a)?(c=iz.exec(a),c=Number(c[1])/b.frameRate):jz.test(a)?(c=jz.exec(a),c=Number(c[1])/b.a):kz.test(a)&&(c=gz(kz,a));return c},gz=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
|
|
4
|
-
0)},mz=function(a){return a.split(":").pop()},nz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},pz=function(a,b){for(;oz.test(a);){var c=oz.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},qz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},rz=function(a,b,c,d,e,f,g){az.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},sz=function(a,b,c){a=dz(a,b,Yy);if(!a&&c&&(a=dz(c,b,Yy),!a&&"rltb"===dz(c,b,$y)))return _.
|
|
5
|
-
case _.dg:case _.ye:return _.
|
|
4
|
+
0)},mz=function(a){return a.split(":").pop()},nz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},pz=function(a,b){for(;oz.test(a);){var c=oz.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},qz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},rz=function(a,b,c,d,e,f,g){az.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},sz=function(a,b,c){a=dz(a,b,Yy);if(!a&&c&&(a=dz(c,b,Yy),!a&&"rltb"===dz(c,b,$y)))return _.ye;switch(a){case _.yd:return _.bj;
|
|
5
|
+
case _.dg:case _.ye:return _.ye;default:return _.qg}},tz=function(a,b,c){if(_.T.qf(a.w))return document.createTextNode(_.T.Ug(a.w||""));if(a.A)return _.tr("br");for(var d=_.tr("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.ur(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(tz(c.get(e.value),b,c));return d},uz=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&
|
|
6
6
|
(this.frameRate*=Number(a[1])/Number(a[2]))},vz=function(a,b,c){az.call(this,a,b,c)},yz=function(a,b,c,d){var e=wz.exec(a);a=xz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},zz=function(a,b){return typeof b===_.k&&0<b?_.hj:xz.test(a)?0:_.hj},Az=function(a,b){az.call(this,"root-container",[],b);this.j=a},Bz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Cz=function(a,b){var c=a.getAttribute("extent");return(c=xz.exec(c))?Number(c[b]):null},Ez=
|
|
7
7
|
function(a){a=a.getAttribute("cellResolution");return(a=Dz.exec(a))?Number(a[2]):null},Fz=function(a,b,c){az.call(this,a,b,c)},Gz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},Iz=function(a){return Hz.some(function(b){return b in a.attributes})},Jz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.w(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.vh(Jz(a,a.a.get(e).f)).concat([e]));return c},Lz=
|
|
8
8
|
function(){return"inline-"+Kz++},Mz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Nz=function(a){this.a=a.firstChild;this.f=new Set},Oz=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Pz=function(a){return mz(a.h.nodeName)},Qz=function(){this.a=new Map},Sz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
|
|
@@ -10,10 +10,10 @@ _.vh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_
|
|
|
10
10
|
c,d,e,f,g);a.a.set(b,c);return c},Tz=function(a){this.a=a;this.f=new DOMParser},Uz=function(a){this.f=a},Vz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Wz=function(){},Xz=function(a){this.a=new Tz(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Yz=function(){this.j=new Wz};az.prototype.getId=function(){return this.h};
|
|
11
11
|
az.prototype.hasAttribute=function(a){return a in this.a};az.prototype.getAttribute=function(a){return this.a[a]};_.x(bz,az);_.x(cz,az);var ez=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fz=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hz=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,iz=/^(\d*(?:\.\d*)?)f$/,jz=/^(\d*(?:\.\d*)?)t$/,kz=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,wz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,xz=/^(\d+)px (\d+)px$/,Dz=/^(\d+) (\d+)$/,oz=/(\d+)px/,Zz=/^(\d+px|\d+em|\d*\.?\d+c)$/,Hz=[Ty,"color",Uy,Vy,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
12
12
|
"lineHeight","opacity","padding",Yy,Zy,"textOutline",$y,"zIndex"],Rz=["begin",_.ye];_.x(rz,cz);
|
|
13
|
-
rz.prototype.build=function(a,b,c,d,e,f,g){var h=lz(this.a.begin,b);b=lz(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.tr(_.fe);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(tz(g.get(m.value),e,g));g=new _.gj(h,b,c.innerHTML.trim(),_.
|
|
13
|
+
rz.prototype.build=function(a,b,c,d,e,f,g){var h=lz(this.a.begin,b);b=lz(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.tr(_.fe);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(tz(g.get(m.value),e,g));g=new _.gj(h,b,c.innerHTML.trim(),_.Lg);g.cssClassList=_.vh(this.f).concat();g.textAlign=sz(this,e,null);g.writingMode=_.cj;g.line=-1;g.lineInterpretation=_.dj;g.lineAlign=_.ej;g.containerRows=Bz(null,Ez(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
14
14
|
sz(this,e,f);a:switch(dz(f,e,$y)){case "tb":case "tblr":a=_.Xg;break a;case "tbrl":a=_.Yg;break a;default:a=_.cj}g.writingMode=a;a:switch(dz(f,e,Vy)){case _.yd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(dz(f,e,Vy)){case _.yd:a=1;break a;default:a=_.dj}g.lineInterpretation=a;a:switch(dz(f,e,Vy)){case _.yd:e=_.yd;break a;default:e=_.ej}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
|
|
15
15
|
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.x(vz,cz);
|
|
16
|
-
vz.prototype.build=function(a,b){var c=new _.jj;c.id=this.getId();var d=Bz(a.j.containerWidth,Cz(a,1),720),e=Bz(a.j.containerHeight,Cz(a,2),480);a:switch(dz(this,b,Vy)){case "after":var f="flex-start";break a;case _.yd:f=_.yd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(dz(this,b,$y)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.
|
|
16
|
+
vz.prototype.build=function(a,b){var c=new _.jj;c.id=this.getId();var d=Bz(a.j.containerWidth,Cz(a,1),720),e=Bz(a.j.containerHeight,Cz(a,2),480);a:switch(dz(this,b,Vy)){case "after":var f="flex-start";break a;case _.yd:f=_.yd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(dz(this,b,$y)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Qd}c.writingMode=f;f=this.getAttribute("extent")||dz(this,b,"extent");c.width=yz(f,d,1,100);c.widthUnits=zz(f,d);c.height=
|
|
17
17
|
yz(f,e,2,100);c.heightUnits=zz(f,e);f=this.getAttribute("origin")||dz(this,b,"origin");c.viewportAnchorX=yz(f,d,1,0);c.viewportAnchorY=yz(f,e,2,0);c.viewportAnchorUnits=zz(f,d);c.cssClassList=_.vh(this.f).concat();return c};_.x(Az,az);_.x(Fz,az);
|
|
18
18
|
Fz.prototype.build=function(a){var b=null;var c=Ez(a);c&&(b=Bz(a.j.containerHeight,Cz(a,2),480)/c);b=Bz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w($z.entries()),e=d.next();!e.done;e=d.next()){var f=_.w(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+nz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
|
|
19
19
|
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Zz.test(g)&&Zz.test(h)&&Zz.test(l)?(e=g,f=h):2===d.length&&!Zz.test(g)&&Zz.test(h)?(e=g,f=h):2===d.length&&Zz.test(g)&&Zz.test(h)&&(f=g);if(""!==f){f=nz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=qz(this.a.textShadow),d=nz(d),d="text-shadow:"+
|
|
@@ -25,7 +25,7 @@ Tz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.
|
|
|
25
25
|
b+=h}for(;f.le();)a=f.next(),a=Sz(e,a),"tt"===Pz(a)&&(d.l=new Az(d.B,Object.assign({},a.attributes))),"tt"===Pz(a)&&(d.w=new uz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Pz(a)!==_.Ie||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new bz(c,a.h.textContent,a.attributes))),Pz(a)===_.Ie&&a.attributes.begin&&a.attributes.end?(c="#"+Lz(),b=new bz(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
|
|
26
26
|
Pz(a)===_.wg&&(c=a.getId()||Lz(),b=new Fz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Pz(a)!==_.wg&&Iz(a)?(c=Lz(),b=new Fz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Pz(a)!==_.fe||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Lz(),b=new vz(c,Jz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Pz(a)!==Wy?c=null:(c=a.getId(),b=new vz(c,Jz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
|
|
27
27
|
c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Pz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Lz(),b=new rz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Pz(a),a.a,a.j,Jz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Pz(a)||a.j?(c=Lz(),b=new rz(c,null,!1,a.a,a.j,Jz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Mz(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
|
|
28
|
-
_.vh(c.value.build(d.l)));return{cues:e,styles:f}};Uz.prototype.a=function(a){a=(new Tz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.w(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Vz(c.startTime)+" --\x3e "+Vz(c.endTime),e=[];switch(c.textAlign){case _.Le:e.push("align:left");break;case _.dg:e.push("align:right");break;case _.bj:e.push("align:middle");break;case _.
|
|
28
|
+
_.vh(c.value.build(d.l)));return{cues:e,styles:f}};Uz.prototype.a=function(a){a=(new Tz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.w(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Vz(c.startTime)+" --\x3e "+Vz(c.endTime),e=[];switch(c.textAlign){case _.Le:e.push("align:left");break;case _.dg:e.push("align:right");break;case _.bj:e.push("align:middle");break;case _.qg:e.push("align:start");break;case _.ye:e.push("align:end")}switch(c.writingMode){case _.Xg:e.push("vertical:lr");break;
|
|
29
29
|
case _.Yg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.T.ib(b)};Wz.prototype.probe=function(a,b){return a===_.ad&&b===_.Ag};Wz.prototype.create=function(a){return new Uz(a)};Xz.prototype.parseInit=function(a){var b=!1;(new _.Dn).N(_.cf,_.En).N(_.Jg,_.En).N(_.Ye,_.En).N(_.bf,_.En).N(_.tg,_.En).aa(_.vg,_.Fn).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
|
|
30
30
|
Xz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Dn).N("moof",_.En).N("traf",_.En).aa("subs",function(h){for(var l=_.yn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.xn(h.reader),p=0;p<n;++p){var q=1===h.version?_.yn(h.reader):_.xn(h.reader);g.push(q);h.reader.skip(6)}}}).N(_.Xe,_.Gn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.x(Yz,_.Gu);Yz.prototype.f=function(){_.Fv(_.ad,Tz);_.Fv(_.Zc,Xz);_.Fv(Qy,Xz);_.Fv(Sy,Xz);_.Fv(Ry,Xz);_.rl.push(this.j)};Yz.prototype.a=function(){_.Hv(_.ad);_.Hv(_.Zc);_.Hv(Qy);_.Hv(Sy);_.Hv(Ry);_.tl(this.j)};Yz.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",Yz);};
|
|
31
31
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
package/cjs/cl.verimatrix.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var f=function(window){var Ey="VerimatrixVCAS",Fy="clpp.verimatrix.Vcas",Gy="clpp.verimatrix.VcasComponent",My=function(a){_.pn.call(this,Ey);var b={};b[Hy]=Hy;b[Iy]=Iy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Jy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ky:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
|
|
3
3
|
this.C=d;this.B=b;this.w=Ly(this,e);this.o=Ly(this,f);this.l=Ly(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Fy);_.T.empty(this.w)?this.g.warn(_.nc):this.gb(_.Xd,{licenseUrl:this.w,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.T.empty(this.o)?this.g.warn(_.Kb):this.gb(_.Vd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
|
|
4
4
|
_.T.empty(this.l)?this.g.warn(_.fb):_.T.empty(this.j)?this.g.warn(_.eb):this.gb(_.Sd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Ly=function(a,b){if(a.C===Jy){var c=Object.assign({},{deviceId:_.$m(_.T.Ed(a.A))},a.a&&{authenticator:_.$m(_.T.Ed(a.a))});return b+_.bl(c)}return b},Ny=function(){this.g=new _.K(Gy)};_.x(My,_.pn);
|
|
5
|
-
My.prototype.h=function(a,b){if(this.C===Oy){var c=this.B[Iy],d={};d[this.B[Hy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};My.prototype.I=function(a,b){var c=_.Mn(b);switch(this.G){case Py:c=_.bl({r:c,
|
|
5
|
+
My.prototype.h=function(a,b){if(this.C===Oy){var c=this.B[Iy],d={};d[this.B[Hy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};My.prototype.I=function(a,b){var c=_.Mn(b);switch(this.G){case Py:c=_.bl({r:c,Bp:this.H},!0)}return c};My.prototype.K=function(a,b){this.h(a,b);_.Pn(b)};My.prototype.L=function(a,b){_.Rn(b)};_.J(Fy,My);My.prototype.constructor=My.prototype.constructor;My.NAME=Ey;var Jy="query-string",Oy="http-header";
|
|
6
6
|
My.LicenseRequestVuidLocation={QUERY_STRING:Jy,HTTP_HEADER:Oy};var Hy="DeviceId",Iy="Authenticator";My.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Hy,AUTHENTICATOR_HEADER:Iy};var Ky="keyid",Py="contentid-siteid";My.FairPlayAssetIdStrategy={KEYID:Ky,CONTENTID_SITEID:Py};_.x(Ny,_.Gu);Ny.prototype.a=function(){delete _.jn.VerimatrixVCAS};Ny.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Ey){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Yd);a=new My(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.kn(a)}};Ny.prototype.id=function(){return"verimatrix-vcas"};_.J(Gy,Ny);};
|
|
7
7
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
8
8
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
package/cjs/cl.vimond.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var uy="Registering listeners",vy="clpp.vimond.VimondPlugin",wy=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.wi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.mi(this.$h.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(uy),this.a.on(this.m,_.rg,this.
|
|
2
|
+
var f=function(window){var uy="Registering listeners",vy="clpp.vimond.VimondPlugin",wy=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.wi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.mi(this.$h.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(uy),this.a.on(this.m,_.rg,this.ul.bind(this)),this.a.on(this.m,_.Hg,this.vl.bind(this)),this.a.on(this.m,_.xc,this.sl.bind(this)),this.a.on(this.m,_.yc,this.tl.bind(this)))},xy=function(a,
|
|
3
3
|
b){a.m.trigger(new _.L(_.ch,{detail:b}))},yy=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.O(b?_.P:1,9,9201,c))},zy=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},Ay=function(a){this.m=a;this.a=new _.wi;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(uy),this.a.on(this.m,_.$f,this.o.bind(this)),this.a.on(this.m,_.xc,this.j.bind(this)),this.a.on(this.m,_.yc,this.l.bind(this)))},
|
|
4
|
-
By=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.Lf];if(a.h)return[_.ye,_.sf];if(c===_.Oq)return[_.ye,null];if(c===_.Sq)return[_.Ae,_.sf];var d=_.sf;if(c===_.Mq||c===_.Vq||a.f)d=_.Lf;return["period",d]},Cy=function(){this.a=!1;this.g=new _.K(vy);this.j=this.h=this.f=null},Dy=function(){};_.u=wy.prototype;_.u.
|
|
5
|
-
_.u.
|
|
6
|
-
_.u.
|
|
4
|
+
By=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.Lf];if(a.h)return[_.ye,_.sf];if(c===_.Oq)return[_.ye,null];if(c===_.Sq)return[_.Ae,_.sf];var d=_.sf;if(c===_.Mq||c===_.Vq||a.f)d=_.Lf;return["period",d]},Cy=function(){this.a=!1;this.g=new _.K(vy);this.j=this.h=this.f=null},Dy=function(){};_.u=wy.prototype;_.u.vl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.u.sl=function(){this.g.debug("Ad break started");this.j=!0};
|
|
5
|
+
_.u.tl=function(){this.g.debug("Ad break stopped");this.j=!1};
|
|
6
|
+
_.u.ul=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.Qq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
|
|
7
7
|
b.B=e;return _.y(h,b.$h(),3)}e===d.ENDED&&b.h.stop();_.C(h)})};
|
|
8
8
|
_.u.$h=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.fa(a.l?10:a.G);a.l=!1;_.D(h,2);return _.y(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,xy(a,b),_.Jh(h,0);d=c=_.H(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),xy(a,f),yy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),xy(a,f),yy(a,a.I,f)):a.g.error(c.toString());_.C(h)})};zy.prototype.fireEvent=function(){this.f++;var a=_.N.ua(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.$k(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=By(this.a,this.f);a.client.playerEvent=
|
|
9
9
|
b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.nd&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.pk(this.l);
|
package/cjs/cl.vr.js
CHANGED
|
@@ -7,18 +7,18 @@ ly(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute
|
|
|
7
7
|
9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},ny=function(a){this.a=a;var b=[],c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI,g=Math.cos(f);for(c=0;128>=c;c++){var h=c/128,l=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(l)*g),b.push(100*Math.sin(l)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=
|
|
8
8
|
5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)},oy=function(a,
|
|
9
9
|
b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)},py=function(){var a=this;this.o=this.w=this.L=this.J=this.A=
|
|
10
|
-
this.da=this.H=this.f=this.a=this.m=null;this.g=new _.K("clpp.vr");this.I=70;this.ca=1;this.P=this.M=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.U=new iy;this.Y=new iy;this.ga=new iy;this.ja=new iy;this.B=this.
|
|
11
|
-
this.C=this.
|
|
10
|
+
this.da=this.H=this.f=this.a=this.m=null;this.g=new _.K("clpp.vr");this.I=70;this.ca=1;this.P=this.M=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.U=new iy;this.Y=new iy;this.ga=new iy;this.ja=new iy;this.B=this.yn.bind(this);
|
|
11
|
+
this.C=this.zn.bind(this);this.K=this.xn.bind(this)},qy=function(a){var b=dy(1,0,a.l*Math.PI/180);cy(dy(0,1,a.j*Math.PI/180),a.U);cy(b,a.Y);ky(a.ga);jy(a.ja,a.U,a.ga);jy(a.H,a.Y,a.ja)},ry=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener($x,a.B,!1),a.a.removeEventListener("mouseup",a.C,!1),a.a.removeEventListener("touchend",a.C,!1))},sy=function(){};ey.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};iy.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,v,z){var A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=l;A[6]=m;A[10]=n;A[14]=p;A[3]=q;A[7]=t;A[11]=v;A[15]=z;return this};var ty={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.x(py,_.gw);_.u=py.prototype;_.u.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
|
|
12
12
|
_.u.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable){var c=b.vr,d=c.fieldOfView,e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;if(void 0!==d&&_.N.xa(d))this.I=d;else throw new _.O(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.N.xa(e)&&0<e)this.ca=e;else throw new _.O(1,7,7100,"sensitivity configuration must be a positive number");this.M=!!f;this.P=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.r){this.g.info("Initialize VR Surface");
|
|
13
13
|
if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",ty)||this.a.getContext("experimental-webgl",ty);if(!this.f)throw new _.O(1,9,9003,"Unable to create GL context");this.H=new iy;ky(this.H);this.da=new ny(this.f);this.A=new my(this.f);this.J=new iy;this.L=new iy;this.o=this.w=null;this.a.addEventListener(_.cg,this.G)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,
|
|
14
|
-
!1),this.a.addEventListener(ay,this.K,!1));this.G();this.
|
|
14
|
+
!1),this.a.addEventListener(ay,this.K,!1));this.G();this.nj()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
|
|
15
15
|
_.u.onPlayerWillRelease=function(){this.g.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(ry(this),this.a.removeEventListener(_.cg,this.G),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.u.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){a.m=null;_.C(b)})};_.u.id=function(){return"vr"};
|
|
16
|
-
_.u.
|
|
16
|
+
_.u.nj=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.r){this.w=requestAnimationFrame(this.nj.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new oy(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
|
|
17
17
|
0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.A;c.a.useProgram(c.f);c=jy(this.J,this.L,this.H).a;var d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d;b.uniformMatrix4fv(this.A.h,!1,this.J.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.da;a.a.bindBuffer(a.a.ARRAY_BUFFER,
|
|
18
18
|
a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.A.a.useProgram(null)}}}};
|
|
19
|
-
_.u.
|
|
20
|
-
_.u.
|
|
21
|
-
_.u.
|
|
19
|
+
_.u.xn=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===ay)a.type===ay?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener($x,this.B,!1),this.a.addEventListener("mouseup",this.C,!1),this.a.addEventListener("touchend",this.C,!1)};
|
|
20
|
+
_.u.yn=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===$x&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.ca;c=d*b*(this.P?-1:1);this.j+=a*b*(this.M?-1:1);this.l+=c;qy(this)};_.u.zn=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();ry(this)};_.u.Qm=function(a,b){this.l=b;this.j=a;qy(this)};_.u.Yl=function(){return{x:this.j,y:this.l}};
|
|
21
|
+
_.u.ro=function(a){this.I=a;this.G()};_.J("clpp.vr.VrPlugin",py);py.prototype.setCameraFieldOfView=py.prototype.ro;py.prototype.getCameraCoordinates=py.prototype.Yl;py.prototype.moveCamera=py.prototype.Qm;py.Id="vr";sy.prototype.create=function(){return new py};_.cu(new sy);};
|
|
22
22
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
23
23
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
24
24
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.vtt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var Gx=" The setting will be ignored.",Hx="VTT parser encountered an invalid VTT setting: ",Ix="application/x-subrip",Jx="text/srt",Kx='text/vtt; codecs\x3d"vtt"',Lx='text/vtt; codecs\x3d"wvtt"',Mx=function(a){_.Wj(a,/[ \t]+/gm)},Nx=function(a){return a.a===a.f.length?null:(a=_.Wj(a,/[^ \t\n]*/gm))?a[0]:null},Ox=function(){},Px=function(a){var b="";for(a=a.split(/\n/);3<a.length;){for(var c=3;c<a.length;++c)a[2]+="\n"+a[c];a.splice(3,a.length-3)}if(3!==a.length)return"";c=0;!a[0].match(/\d+:\d+:\d+/)&&
|
|
3
3
|
a[1].match(/\d+:\d+:\d+/)&&(b+=a[0].match(/\w+/)+"\n",++c);if(a[c].match(/\d+:\d+:\d+/)){var d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=d[1]+":"+d[2]+":"+d[3]+"."+d[4]+" --\x3e ",b+=d[5]+":"+d[6]+":"+d[7]+"."+d[8]+"\n",++c;else return""}else return"";a[c]&&(b+=a[c]+"\n\n");return b},Qx=function(){},Rx=function(a){this.a=a},Tx=function(a,b,c){var d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.bj:a.textAlign=
|
|
4
|
-
_.mw[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.Xg:_.Yg;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b===_.
|
|
4
|
+
_.mw[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.Xg:_.Yg;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b===_.Pe||b===_.qg?_.Pe:b===_.Qe||b===_.ye?_.Qe:_.yd);else if(d=/^region:(.*)$/.exec(b)){if(b=Sx(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=
|
|
5
5
|
Number(c[1]),c[2]&&(a.lineAlign=_.nw[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.dj,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.nw[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Sx=function(a,b){var c=a.filter(function(d){return d.id===b});return c.length?c[0]:(_.Yh("VTT parser could not find a region with id: ",b," The region will be ignored."),null)},Ux=function(a){a=_.Wj(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==
|
|
6
6
|
a)return null;var b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+c+60*b+3600*(Number(a[1])||0)},Vx=function(){Rx.apply(this,arguments)},Wx=function(){this.a=null;this.g=new _.K("clpp.vtt.mp4")},Yx=function(a,b,c){var d,e,f;(new _.Dn).N("payl",_.Gn(function(g){d=_.T.ea(g)})).N("iden",_.Gn(function(g){e=_.T.ea(g)})).N("sttg",_.Gn(function(g){f=_.T.ea(g)})).parse(a);return d?Xx(d,e,f,b,c):null},Xx=function(a,b,c,d,e){a=new _.gj(d,e,a,_.eh);b&&(a.id=b);if(c)for(b=new _.Vj(c),c=
|
|
7
7
|
Nx(b);c;)Tx(a,c,[])||_.Yh(Hx,c,Gx),Mx(b),c=Nx(b);return a},Zx=function(){this.j=new Qx};Ox.prototype.a=function(a){a=_.T.ea(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");var b=a.split("\n\n");a="";if(0<b.length){a+="WEBVTT\n\n";b=_.w(b);for(var c=b.next();!c.done;c=b.next())a+=Px(c.value)}return _.T.ib(a)};Qx.prototype.create=function(){return new Ox};Qx.prototype.probe=function(a,b){return(a===Jx||a===Ix)&&b===_.Ag};Rx.prototype.parseInit=function(){};
|